|
@@ -122,7 +122,7 @@ function getNodeList(node) {
|
|
|
}
|
|
|
|
|
|
$(document).ready(() => {
|
|
|
- let detail, searchLedger;
|
|
|
+ let detail, searchLedger, checkedChanges;
|
|
|
// 界面布局
|
|
|
autoFlashHeight();
|
|
|
// 初始化 台账树结构 数据结构
|
|
@@ -1495,6 +1495,7 @@ $(document).ready(() => {
|
|
|
if (detail) {
|
|
|
detail.spread.refresh();
|
|
|
}
|
|
|
+ if (checkedChanges) checkedChanges.refresh();
|
|
|
}
|
|
|
});
|
|
|
|
|
@@ -1809,6 +1810,7 @@ $(document).ready(() => {
|
|
|
if (detail) {
|
|
|
detail.spread.refresh();
|
|
|
}
|
|
|
+ if (checkedChanges) checkedChanges.refresh();
|
|
|
}
|
|
|
});
|
|
|
|
|
@@ -2534,6 +2536,114 @@ $(document).ready(() => {
|
|
|
$('#view-calc-img').attr('src', calcImgSrc);
|
|
|
}
|
|
|
}
|
|
|
+ class CheckedChange {
|
|
|
+ constructor (setting) {
|
|
|
+ const self = this;
|
|
|
+ this.changeSpreadSetting = {
|
|
|
+ cols: [
|
|
|
+ {title: '变更令号', colSpan: '1', rowSpan: '1', field: 'p_code', hAlign: 0, width: 100, formatter: '@'},
|
|
|
+ {title: '变更名称', colSpan: '1', rowSpan: '1', field: 'name', hAlign: 0, width: 180, formatter: '@'},
|
|
|
+ {title: '金额', colSpan: '1', rowSpan: '1', field: 'total_price', hAlign: 2, width: 80, type: 'Number'},
|
|
|
+ {title: '批复文号', colSpan: '1', rowSpan: '1', field: 'w_code', hAlign: 0, width: 100, formatter: '@'},
|
|
|
+ ],
|
|
|
+ emptyRows: 0,
|
|
|
+ headRows: 1,
|
|
|
+ headRowHeight: [32],
|
|
|
+ defaultRowHeight: 21,
|
|
|
+ headerFont: '12px 微软雅黑',
|
|
|
+ font: '12px 微软雅黑',
|
|
|
+ readOnly: true,
|
|
|
+ };
|
|
|
+ this.changeSpread = SpreadJsObj.createNewSpread(setting.changeObj[0]);
|
|
|
+ this.changeSheet = this.changeSpread.getActiveSheet();
|
|
|
+ SpreadJsObj.initSheet(this.changeSheet, this.changeSpreadSetting);
|
|
|
+
|
|
|
+ this.changeBillsSpreadSetting = {
|
|
|
+ cols: [
|
|
|
+ {title: '清单编号', colSpan: '1', rowSpan: '1', field: 'code', hAlign: 0, width: 80, formatter: '@'},
|
|
|
+ {title: '名称', colSpan: '1', rowSpan: '1', field: 'name', hAlign: 0, width: 150, type: 'Number'},
|
|
|
+ {title: '单位', colSpan: '1', rowSpan: '1', field: 'unit', hAlign: 1, width: 50, formatter: '@'},
|
|
|
+ {title: '单价', colSpan: '1', rowSpan: '1', field: 'unit_price', hAlign: 2, width: 60, type: 'Number'},
|
|
|
+ {title: '数量', colSpan: '1', rowSpan: '1', field: 'qty', hAlign: 2, width: 60, formatter: '@'},
|
|
|
+ {title: '金额', colSpan: '1', rowSpan: '1', field: 'tp', hAlign: 2, width: 60, formatter: '@'},
|
|
|
+ {title: '变更部位', colSpan: '1', rowSpan: '1', field: 'bwmx', hAlign: 0, width: 100, formatter: '@'},
|
|
|
+ ],
|
|
|
+ emptyRows: 0,
|
|
|
+ headRows: 1,
|
|
|
+ headRowHeight: [32],
|
|
|
+ defaultRowHeight: 21,
|
|
|
+ headerFont: '12px 微软雅黑',
|
|
|
+ font: '12px 微软雅黑',
|
|
|
+ readOnly: true
|
|
|
+ };
|
|
|
+ this.changeBillsSpread = SpreadJsObj.createNewSpread(setting.changeBillsObj[0]);
|
|
|
+ this.changeBillsSheet = this.changeBillsSpread.getActiveSheet();
|
|
|
+ SpreadJsObj.initSheet(this.changeBillsSheet, this.changeBillsSpreadSetting);
|
|
|
+
|
|
|
+ this.changeSheet.bind(spreadNS.Events.SelectionChanged, function (e, info) {
|
|
|
+ const change = SpreadJsObj.getSelectObject(self.changeSheet);
|
|
|
+ if (change.cid === self.curChangeId) { return; }
|
|
|
+ self.curChangeId = change.cid;
|
|
|
+ if (change.detail) {
|
|
|
+ self.loadChangeDetailData();
|
|
|
+ } else {
|
|
|
+ postData(window.location.pathname + '/change/detail', {cid: change.cid}, function (result) {
|
|
|
+ change.detail = result;
|
|
|
+ self.analyzeChange(change);
|
|
|
+ self.loadChangeDetailData();
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ this.changes = null;
|
|
|
+ this.reloadChangeData();
|
|
|
+ setting.reloadObj.click(function() {
|
|
|
+ self.reloadChangeData();
|
|
|
+ });
|
|
|
+ }
|
|
|
+ loadChangeDetailData() {
|
|
|
+ const change = SpreadJsObj.getSelectObject(this.changeSheet);
|
|
|
+ if (change) {
|
|
|
+ SpreadJsObj.loadSheetData(this.changeBillsSheet, SpreadJsObj.DataType.Data, change.bills);
|
|
|
+ } else {
|
|
|
+ SpreadJsObj.loadSheetData(this.changeBillsSheet, SpreadJsObj.DataType.Data, []);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ refresh() {
|
|
|
+ this.changeSpread.refresh();
|
|
|
+ this.changeBillsSpread.refresh();
|
|
|
+ }
|
|
|
+ reloadChangeData() {
|
|
|
+ const self = this;
|
|
|
+ postData(window.location.pathname + '/change/data', null, function (result) {
|
|
|
+ self.changes = result.changes;
|
|
|
+ SpreadJsObj.loadSheetData(self.changeSheet, SpreadJsObj.DataType.Data, self.changes);
|
|
|
+ self.changeSheet.setSelection(0, 0, 1, 1);
|
|
|
+ if (self.changes.length > 0) self.analyzeChange(result.changes[0]);
|
|
|
+ self.loadChangeDetailData();
|
|
|
+ });
|
|
|
+ }
|
|
|
+ analyzeChange(change) {
|
|
|
+ change.bills = change.detail.bills;
|
|
|
+ for (const b of change.bills) {
|
|
|
+ console.log(b);
|
|
|
+ const aub = change.detail.addUsedBills.find(function (x) {
|
|
|
+ return x.id === b.id;
|
|
|
+ });
|
|
|
+ if (aub) {
|
|
|
+ b.used_qty = aub.used_qty;
|
|
|
+ }
|
|
|
+ b.qty = _.toNumber(b.samount);
|
|
|
+ b.valid_qty = ZhCalc.sub(b.qty, b.used_qty);
|
|
|
+ b.tp = ZhCalc.round(ZhCalc.mul(b.qty, b.unit_price), tenderInfo.decimal.tp);
|
|
|
+ b.pos = _.filter(change.detail.curUsedBills, {cbid: b.id});
|
|
|
+ b.cur_qty = 0;
|
|
|
+ for (const p of b.pos) {
|
|
|
+ p.f_qty = p.p_qty ? p.p_qty : p.l_qty;
|
|
|
+ b.cur_qty = ZhCalc.add(b.cur_qty, p.qty);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
// 展开收起附件
|
|
|
$('a', '.right-nav').bind('click', function () {
|
|
|
//const main = $('#main-view'), tool = $('#tools-view');
|
|
@@ -2581,6 +2691,16 @@ $(document).ready(() => {
|
|
|
detail.spread.refresh();
|
|
|
}
|
|
|
}
|
|
|
+ if (tab.attr('content') === '#checked-change') {
|
|
|
+ if (!checkedChanges) {
|
|
|
+ checkedChanges = new CheckedChange({
|
|
|
+ changeObj: $('#cc-spread'),
|
|
|
+ changeBillsObj: $('#ccb-spread'),
|
|
|
+ reloadObj: $('#refresh-cc'),
|
|
|
+ });
|
|
|
+ checkedChanges.refresh();
|
|
|
+ }
|
|
|
+ }
|
|
|
} else {
|
|
|
tab.removeClass('active');
|
|
|
tabPanel.removeClass('active');
|