|
@@ -43,20 +43,26 @@ $(document).ready(function() {
|
|
billsSheet.selectionPolicy(0);
|
|
billsSheet.selectionPolicy(0);
|
|
billsSheet.selectionUnit(1);
|
|
billsSheet.selectionUnit(1);
|
|
billsSheet.clearSelection();
|
|
billsSheet.clearSelection();
|
|
|
|
+ billsSheet.setActiveCell(0);
|
|
|
|
+ setquotaParamIndex();
|
|
const spreadNS = GC.Spread.Sheets;
|
|
const spreadNS = GC.Spread.Sheets;
|
|
|
|
|
|
//项目节选中
|
|
//项目节选中
|
|
billsSheet.bind(spreadNS.Events.SelectionChanged, function (e, info) {
|
|
billsSheet.bind(spreadNS.Events.SelectionChanged, function (e, info) {
|
|
- const billsInfo = billsTree.nodes[info.newSelections[0].row];
|
|
|
|
|
|
+ setquotaParamIndex();
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ function setquotaParamIndex() {
|
|
|
|
+ const billsInfo = billsTree.nodes[billsSheet.getActiveRowIndex()];
|
|
$('#codeName').text(billsInfo.name);
|
|
$('#codeName').text(billsInfo.name);
|
|
$('#indexList').html('');
|
|
$('#indexList').html('');
|
|
$('#paramList').html('');
|
|
$('#paramList').html('');
|
|
if(billsInfo.match_node !== null){
|
|
if(billsInfo.match_node !== null){
|
|
- const postUrl = '/lib/getNodeAndIndex';
|
|
|
|
|
|
+ const postUrl = '/lib/getParamAndIndex';
|
|
const postInfo = {
|
|
const postInfo = {
|
|
- lib_id:billsInfo.lib_id,
|
|
|
|
- node_id:billsInfo.match_node,
|
|
|
|
- bills_id:billsInfo.id
|
|
|
|
|
|
+ lib_id: billsInfo.lib_id,
|
|
|
|
+ node_id: billsInfo.match_node,
|
|
|
|
+ bills_id: billsInfo.id
|
|
};
|
|
};
|
|
postData(postUrl, postInfo, function (result) {
|
|
postData(postUrl, postInfo, function (result) {
|
|
let index_html = '';
|
|
let index_html = '';
|
|
@@ -71,12 +77,29 @@ $(document).ready(function() {
|
|
let param_html = '';
|
|
let param_html = '';
|
|
const param_list = result.paramList;
|
|
const param_list = result.paramList;
|
|
for(let i in param_list) {
|
|
for(let i in param_list) {
|
|
- param_html += '<tr> <td>'+ param_list[i].name +'</th><td>'+ param_list[i].code +'</td><td><input class="form-control form-control-sm" value=""></td> </tr>';
|
|
|
|
|
|
+ param_list[i].calc_value = param_list[i].calc_value !== null ? param_list[i].calc_value : '';
|
|
|
|
+ let subNode = param_list[i].match_type === 3 ? '(自动绑定)' : (param_list[i].match_type === 4 ? param_list[i].match_key : '');
|
|
|
|
+ param_html += '<tr> <td>'+ param_list[i].name +'</th><td>'+ subNode +'</td><td><input type="number" class="form-control form-control-sm" value="'+ param_list[i].calc_value +'" data-old-value="'+ param_list[i].calc_value +'" data-lib-id="'+ param_list[i].lib_id +'" data-node-id="'+ param_list[i].node_id +'" data-code="'+ param_list[i].code +'"></td> </tr>';
|
|
}
|
|
}
|
|
$('#paramList').html(param_html);
|
|
$('#paramList').html(param_html);
|
|
- console.log(param_html);
|
|
|
|
- console.log(index_html);
|
|
|
|
});
|
|
});
|
|
}
|
|
}
|
|
- });
|
|
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ $('body').on('blur', '#paramList input', function () {
|
|
|
|
+ if($(this).val() != $(this).attr('data-old-value')){
|
|
|
|
+ const postInfo = {
|
|
|
|
+ lib_id: parseInt($(this).attr('data-lib-id')),
|
|
|
|
+ node_id: parseInt($(this).attr('data-node-id')),
|
|
|
|
+ code: $(this).attr('data-code'),
|
|
|
|
+ updateType: 'modify',
|
|
|
|
+ value: parseFloat($(this).val())
|
|
|
|
+ };
|
|
|
|
+ $(this).attr('data-old-value', $(this).val());
|
|
|
|
+ const postUrl = '/lib/updateParamValue';
|
|
|
|
+ postData(postUrl, postInfo, function (result) {
|
|
|
|
+ // console.log(result);
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ })
|
|
});
|
|
});
|