|
@@ -65,31 +65,38 @@ $(document).ready(function() {
|
|
|
bills_id: billsInfo.id
|
|
|
};
|
|
|
postData(postUrl, postInfo, function (result) {
|
|
|
- let index_html = '';
|
|
|
- const index_list = result.indexList;
|
|
|
- for(let i in index_list) {
|
|
|
- index_html += '<tr> <td>'+ index_list[i].code +'</td> <td>'+ index_list[i].name +'</td>' +
|
|
|
- '<td>'+ (index_list[i].unit1 !== null ? index_list[i].unit1 : '') +'</td>' +
|
|
|
- '<td>'+ (index_list[i].unit2 !== null ? index_list[i].unit2 : '') +'</td>' +
|
|
|
- '<td>'+ index_list[i].rule +'</td> <td>'+ (index_list[i].eval_rule !== null ? index_list[i].eval_rule : '') +'</td>' +
|
|
|
- '<td>'+ (index_list[i].value !== null ? index_list[i].value : '') +'</td> </tr>';
|
|
|
- }
|
|
|
- $('#indexList').html(index_html);
|
|
|
-
|
|
|
- let param_html = '';
|
|
|
- const param_list = result.paramList;
|
|
|
- for(let i in param_list) {
|
|
|
- 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 +'</td><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);
|
|
|
+ updateIndexHTML(result.indexList);
|
|
|
+ updateParamHTML(result.paramList);
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ function updateIndexHTML(indexlist) {
|
|
|
+ let index_html = '';
|
|
|
+ const index_list = indexlist;
|
|
|
+ for(let i in index_list) {
|
|
|
+ index_html += '<tr> <td>'+ index_list[i].code +'</td> <td>'+ index_list[i].name +'</td>' +
|
|
|
+ '<td>'+ (index_list[i].unit1 !== null ? index_list[i].unit1 : '') +'</td>' +
|
|
|
+ '<td>'+ (index_list[i].unit2 !== null ? index_list[i].unit2 : '') +'</td>' +
|
|
|
+ '<td>'+ index_list[i].rule +'</td> <td class="text-right">'+ (index_list[i].eval_rule !== null ? index_list[i].eval_rule : '') +'</td>' +
|
|
|
+ '<td class="text-right">'+ (index_list[i].value !== null ? index_list[i].value : '') +'</td> </tr>';
|
|
|
+ }
|
|
|
+ $('#indexList').html(index_html);
|
|
|
+ }
|
|
|
+
|
|
|
+ function updateParamHTML(paramlist) {
|
|
|
+ let param_html = '';
|
|
|
+ const param_list = paramlist;
|
|
|
+ for(let i in param_list) {
|
|
|
+ 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 +'</td><td>'+ subNode +'</td>' +
|
|
|
+ '<td><input type="text" class="form-control form-control-sm text-right" 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);
|
|
|
+ }
|
|
|
|
|
|
$('body').on('blur', '#paramList input', function () {
|
|
|
const self = $(this);
|
|
@@ -104,6 +111,7 @@ $(document).ready(function() {
|
|
|
const postUrl = '/lib/updateParamValue';
|
|
|
postData(postUrl, postInfo, function (result) {
|
|
|
self.attr('data-old-value', result.param.calc_value);
|
|
|
+ updateIndexHTML(result.indexes);
|
|
|
},function (result) {
|
|
|
self.val(self.attr('data-old-value'));
|
|
|
});
|