|
@@ -0,0 +1,146 @@
|
|
|
+'use strict';
|
|
|
+
|
|
|
+/**
|
|
|
+ * 材料调差 - 调差清单
|
|
|
+ *
|
|
|
+ * @author EllisRan
|
|
|
+ * @date 2019/10/25
|
|
|
+ * @version
|
|
|
+ */
|
|
|
+
|
|
|
+$(document).ready(() => {
|
|
|
+ autoFlashHeight();
|
|
|
+ // 清单table
|
|
|
+ const ledgerSpread = SpreadJsObj.createNewSpread($('#ledger-spread')[0]);
|
|
|
+ const ledgerSpreadSetting = {
|
|
|
+ cols: [
|
|
|
+ {title: '清单编号', colSpan: '1', rowSpan: '2', field: 'b_code', hAlign: 0, width: 150, formatter: '@'},
|
|
|
+ {title: '名称', colSpan: '1', rowSpan: '2', field: 'name', hAlign: 0, width: 250, formatter: '@'},
|
|
|
+ {title: '单位', colSpan: '1', rowSpan: '2', field: 'unit', hAlign: 1, width: 120, formatter: '@'},
|
|
|
+ {title: '单价', colSpan: '1', rowSpan: '2', field: 'unit_price', hAlign: 2, width: 120, type: 'Number'},
|
|
|
+ {title: '本期计量数量|合同', colSpan: '3|1', rowSpan: '1|1', field: 'contract_qty', hAlign: 2, width: 120, type: 'Number'},
|
|
|
+ {title: '|数量变更', colSpan: '|1', rowSpan: '|1', field: 'qc_qty', hAlign: 2, width: 120, type: 'Number'},
|
|
|
+ {title: '|小计', colSpan: '|1', rowSpan: '|1', field: 'total_qty', hAlign: 2, width: 120, type: 'Number', getValue: 'getValue.qty'},
|
|
|
+ ],
|
|
|
+ emptyRows: 0,
|
|
|
+ headRows: 2,
|
|
|
+ headRowHeight: [32, 32],
|
|
|
+ defaultRowHeight: 30,
|
|
|
+ headerFont: '10pt 微软雅黑',
|
|
|
+ readOnly: true,
|
|
|
+ font: '10pt 微软雅黑',
|
|
|
+ };
|
|
|
+
|
|
|
+ const ledgerCol = {
|
|
|
+ getValue: {
|
|
|
+ qty: function (data) {
|
|
|
+ return ZhCalc.add(data.contract_qty, data.qc_qty);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
+ // 解析清单汇总数据
|
|
|
+ gclGatherModel.loadLedgerData(ledger, curLedgerData);
|
|
|
+ gclGatherModel.loadPosData(pos, curPosData);
|
|
|
+ const gclGatherData = gclGatherModel.gatherGclData();
|
|
|
+ // 获取项目节数据
|
|
|
+ function loadLeafXmjData(iGclRow) {
|
|
|
+ const gcl = gclGatherData[iGclRow];
|
|
|
+ if (gcl) {
|
|
|
+ SpreadJsObj.loadSheetData(leafXmjSpread.getActiveSheet(), SpreadJsObj.DataType.Data, gcl.leafXmjs);
|
|
|
+ } else {
|
|
|
+ SpreadJsObj.loadSheetData(leafXmjSpread.getActiveSheet(), SpreadJsObj.DataType.Data, []);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ SpreadJsObj.initSpreadSettingEvents(ledgerSpreadSetting, ledgerCol);
|
|
|
+ SpreadJsObj.initSheet(ledgerSpread.getActiveSheet(), ledgerSpreadSetting);
|
|
|
+
|
|
|
+ // 项目明细table
|
|
|
+ const leafXmjSpread = SpreadJsObj.createNewSpread($('#leaf-xmj-spread')[0]);
|
|
|
+ const leafXmjSpreadSetting = {
|
|
|
+ cols: [
|
|
|
+ {title: '项目节|编号', colSpan: '2|1', rowSpan: '1|1', field: 'code', hAlign: 0, width: 80, formatter: '@'},
|
|
|
+ {title: '|项目节名称', colSpan: '|1', rowSpan: '|1', field: 'jldy', hAlign: 0, width: 100, formatter: '@'},
|
|
|
+ {title: '部位明细|部位明细', colSpan: '2|1', rowSpan: '1|1', field: 'bwmx', hAlign: 0, width: 100, formatter: '@'},
|
|
|
+ {title: '|复核数量', colSpan: '|1', rowSpan: '|1', field: 'quantity', hAlign: 0, width: 80, type: 'Number'},
|
|
|
+ {title: '部位信息|单位工程', colSpan: '3|1', rowSpan: '1|1', field: 'dwgc', hAlign: 0, width: 100, formatter: '@'},
|
|
|
+ {title: '|分部工程', colSpan: '|1', rowSpan: '|1', field: 'fbgc', hAlign: 0, width: 100, formatter: '@'},
|
|
|
+ {title: '|分项工程', colSpan: '|1', rowSpan: '|1', field: 'fxgc', hAlign: 0, width: 180, formatter: '@'},
|
|
|
+ {title: '本期计量数量|合同', colSpan: '3|1', rowSpan: '1|1', field: 'contract_qty', hAlign: 2, width: 60, type: 'Number'},
|
|
|
+ {title: '|数量变更', colSpan: '|1', rowSpan: '|1', field: 'qc_qty', hAlign: 2, width: 80, type: 'Number'},
|
|
|
+ {title: '|小计', colSpan: '|1', rowSpan: '|1', field: 'total_qty', hAlign: 2, width: 60, type: 'Number', getValue: 'getValue.qty'},
|
|
|
+ {title: '本期价差', colSpan: '1', rowSpan: '2', field: 'jijia', hAlign: 2, width: 80, type: 'Number'},
|
|
|
+ ],
|
|
|
+ emptyRows: 0,
|
|
|
+ headRows: 2,
|
|
|
+ headRowHeight: [32, 32],
|
|
|
+ defaultRowHeight: 30,
|
|
|
+ headerFont: '10pt 微软雅黑',
|
|
|
+ readOnly: true,
|
|
|
+ font: '10pt 微软雅黑',
|
|
|
+ };
|
|
|
+ const leafXmjCol = {
|
|
|
+ getValue: {
|
|
|
+ qty: function (data) {
|
|
|
+ return ZhCalc.add(data.contract_qty, data.qc_qty);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
+ SpreadJsObj.initSpreadSettingEvents(leafXmjSpreadSetting, leafXmjCol);
|
|
|
+ SpreadJsObj.initSheet(leafXmjSpread.getActiveSheet(), leafXmjSpreadSetting);
|
|
|
+ // 加载清单数据
|
|
|
+ SpreadJsObj.loadSheetData(ledgerSpread.getActiveSheet(), SpreadJsObj.DataType.Data, gclGatherData);
|
|
|
+ loadLeafXmjData(0);
|
|
|
+ SpreadJsObj.forbiddenSpreadContextMenu('#ledger-spread', ledgerSpread);
|
|
|
+
|
|
|
+ // 调差清单工料table
|
|
|
+ const materialSpread = SpreadJsObj.createNewSpread($('#material-spread')[0]);
|
|
|
+ const materialSpreadSetting = {
|
|
|
+ cols: [
|
|
|
+ {title: '清单调差工料|编号', colSpan: '4|1', rowSpan: '1|1', field: 'code', hAlign: 0, width: 80, formatter: '@'},
|
|
|
+ {title: '|名称', colSpan: '|1', rowSpan: '|1', field: 'name', hAlign: 0, width: 100, formatter: '@'},
|
|
|
+ {title: '|单位', colSpan: '|1', rowSpan: '|1', field: 'unit', hAlign: 1, width: 60, formatter: '@'},
|
|
|
+ {title: '|kg数量', colSpan: '1', rowSpan: '|1', field: 'num', hAlign: 2, width: 60, type: 'Number'},
|
|
|
+ ],
|
|
|
+ emptyRows: 0,
|
|
|
+ headRows: 2,
|
|
|
+ headRowHeight: [32, 32],
|
|
|
+ defaultRowHeight: 30,
|
|
|
+ headerFont: '10pt 微软雅黑',
|
|
|
+ readOnly: true,
|
|
|
+ font: '10pt 微软雅黑',
|
|
|
+ };
|
|
|
+ SpreadJsObj.initSheet(materialSpread.getActiveSheet(), materialSpreadSetting);
|
|
|
+
|
|
|
+ if (!readOnly) {
|
|
|
+ } else {
|
|
|
+ SpreadJsObj.forbiddenSpreadContextMenu('#leaf-xmj-spread', leafXmjSpread);
|
|
|
+ SpreadJsObj.forbiddenSpreadContextMenu('#material-spread', materialSpread);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 切换清单行,读取所属项目节数据
|
|
|
+ ledgerSpread.getActiveSheet().bind(spreadNS.Events.SelectionChanged, function (e, info) {
|
|
|
+ const iOldRow = info.oldSelections[0].row, iNewRow = info.newSelections[0].row;
|
|
|
+ if (iNewRow !== iOldRow) {
|
|
|
+ loadLeafXmjData(iNewRow);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ $.subMenu({
|
|
|
+ menu: '#sub-menu', miniMenu: '#sub-mini-menu', miniMenuList: '#mini-menu-list',
|
|
|
+ toMenu: '#to-menu', toMiniMenu: '#to-mini-menu',
|
|
|
+ //key: 'stage.compare.memu.1.0.0',
|
|
|
+ callback: function (info) {
|
|
|
+ if (info.mini) {
|
|
|
+ $('.panel-title').addClass('fluid');
|
|
|
+ $('#sub-menu').removeClass('panel-sidebar');
|
|
|
+ } else {
|
|
|
+ $('.panel-title').removeClass('fluid');
|
|
|
+ $('#sub-menu').addClass('panel-sidebar');
|
|
|
+ }
|
|
|
+ autoFlashHeight();
|
|
|
+ ledgerSpread.refresh();
|
|
|
+ leafXmjSpread.refresh();
|
|
|
+ materialSpread.refresh();
|
|
|
+ }
|
|
|
+ });
|
|
|
+});
|