|
@@ -10,6 +10,7 @@
|
|
|
|
|
|
$(document).ready(function() {
|
|
|
const billsSpread = SpreadJsObj.createNewSpread($('#bills-spread')[0]);
|
|
|
+ const billsSheet = billsSpread.getActiveSheet();
|
|
|
const billsTree = createNewPathTree({
|
|
|
id: 'n_id',
|
|
|
pid: 'n_pid',
|
|
@@ -22,15 +23,15 @@ $(document).ready(function() {
|
|
|
preUrl: '/lib/detail',
|
|
|
});
|
|
|
billsTree.loadDatas(bills);
|
|
|
- SpreadJsObj.initSheet(billsSpread.getActiveSheet(), {
|
|
|
+ SpreadJsObj.initSheet(billsSheet, {
|
|
|
cols: [
|
|
|
- {title: '项目节编号', field: 'code', width: 120, cellType: 'tree', vAlign: 1, readOnly: true,},
|
|
|
- {title: '清单编号', field: 'b_code', width: 80, vAlign: 1, readOnly: true,},
|
|
|
- {title: '名称', field: 'name', width: 200, vAlign: 1, readOnly: true,},
|
|
|
- {title: '单位', field: 'unit', width: 50, vAlign: 1, readOnly: true,},
|
|
|
- {title: '数量1', field: 'dgn_quantity1', width: 60, type: 'Number', vAlign: 1, readOnly: true,},
|
|
|
- {title: '数量2', field: 'dgn_quantity2', width: 60, type: 'Number', vAlign: 1, readOnly: true,},
|
|
|
- {title: '金额', field: 'total_price', width: 60, type: 'Number', vAlign: 1, readOnly: true,},
|
|
|
+ {title: '项目节编号', field: 'code', width: 120, cellType: 'tree', vAlign: 1, readOnly: true},
|
|
|
+ {title: '清单编号', field: 'b_code', width: 80, vAlign: 1, readOnly: true},
|
|
|
+ {title: '名称', field: 'name', width: 200, vAlign: 1, readOnly: true},
|
|
|
+ {title: '单位', field: 'units', width: 50, vAlign: 1, readOnly: true},
|
|
|
+ {title: '数量1', field: 'dgn_quantity1', width: 60, type: 'Number', vAlign: 1, readOnly: true},
|
|
|
+ {title: '数量2', field: 'dgn_quantity2', width: 60, type: 'Number', vAlign: 1, readOnly: true},
|
|
|
+ {title: '金额', field: 'total_price', width: 60, type: 'Number', vAlign: 1, readOnly: true},
|
|
|
],
|
|
|
treeCol: 0,
|
|
|
emptyRows: 3,
|
|
@@ -38,5 +39,44 @@ $(document).ready(function() {
|
|
|
headRowHeight: [28],
|
|
|
defaultRowHeight: 30,
|
|
|
});
|
|
|
- SpreadJsObj.loadSheetData(billsSpread.getActiveSheet(), 'tree', billsTree);
|
|
|
+ SpreadJsObj.loadSheetData(billsSheet, 'tree', billsTree);
|
|
|
+ billsSheet.selectionPolicy(0);
|
|
|
+ billsSheet.selectionUnit(1);
|
|
|
+ billsSheet.clearSelection();
|
|
|
+ const spreadNS = GC.Spread.Sheets;
|
|
|
+
|
|
|
+ //项目节选中
|
|
|
+ billsSheet.bind(spreadNS.Events.SelectionChanged, function (e, info) {
|
|
|
+ const billsInfo = billsTree.nodes[info.newSelections[0].row];
|
|
|
+ $('#codeName').text(billsInfo.name);
|
|
|
+ $('#indexList').html('');
|
|
|
+ $('#paramList').html('');
|
|
|
+ if(billsInfo.match_node !== null){
|
|
|
+ const postUrl = '/lib/getNodeAndIndex';
|
|
|
+ const postInfo = {
|
|
|
+ lib_id:billsInfo.lib_id,
|
|
|
+ node_id:billsInfo.match_node,
|
|
|
+ bills_id:billsInfo.id
|
|
|
+ };
|
|
|
+ postData(postUrl, postInfo, function (result) {
|
|
|
+ let index_html = '';
|
|
|
+ const index_list = result.indexList;
|
|
|
+ for(let i in index_list) {
|
|
|
+ index_list[i].unit1 = index_list[i].unit1 !== null ? index_list[i].unit1 : '';
|
|
|
+ index_list[i].unit2 = index_list[i].unit2 !== null ? index_list[i].unit2 : '';
|
|
|
+ index_html += '<tr> <td>'+ index_list[i].code +'</td> <td>'+ index_list[i].name +'</td> <td>'+ index_list[i].unit1 +'</td> <td>'+ index_list[i].unit2 +'</td> <td></td> <td>'+ index_list[i].rule +'</td> <td></td> <td></td> </tr>';
|
|
|
+ }
|
|
|
+ $('#indexList').html(index_html);
|
|
|
+
|
|
|
+ let param_html = '';
|
|
|
+ const param_list = result.paramList;
|
|
|
+ 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>';
|
|
|
+ }
|
|
|
+ $('#paramList').html(param_html);
|
|
|
+ console.log(param_html);
|
|
|
+ console.log(index_html);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
});
|