|
@@ -63,6 +63,7 @@ $(document).ready(function() {
|
|
autoFlashHeight();
|
|
autoFlashHeight();
|
|
// 初始化台账
|
|
// 初始化台账
|
|
const ledgerSpread = SpreadJsObj.createNewSpread($('#ledger-spread')[0]);
|
|
const ledgerSpread = SpreadJsObj.createNewSpread($('#ledger-spread')[0]);
|
|
|
|
+ const ledgerSheet = ledgerSpread.getActiveSheet();
|
|
removeLocalCache('bills-fold');
|
|
removeLocalCache('bills-fold');
|
|
const treeSetting = {
|
|
const treeSetting = {
|
|
id: 'ledger_id',
|
|
id: 'ledger_id',
|
|
@@ -94,6 +95,11 @@ $(document).ready(function() {
|
|
});
|
|
});
|
|
const posSpread = SpreadJsObj.createNewSpread($('#pos-spread')[0]);
|
|
const posSpread = SpreadJsObj.createNewSpread($('#pos-spread')[0]);
|
|
|
|
|
|
|
|
+ // 初始化 附属工程量
|
|
|
|
+ const ancGcl = createAncillaryGcl({ id: 'id', masterId: 'lid', sort: [['g_order', 'asc']] });
|
|
|
|
+ const ancGclSpread = SpreadJsObj.createNewSpread($('#anc-gcl-spread')[0]);
|
|
|
|
+ const ancGclSheet = ancGclSpread.getActiveSheet();
|
|
|
|
+
|
|
const billsTag = $.billsTag({
|
|
const billsTag = $.billsTag({
|
|
selector: '#bills-tag',
|
|
selector: '#bills-tag',
|
|
relaSpread: ledgerSpread,
|
|
relaSpread: ledgerSpread,
|
|
@@ -104,6 +110,7 @@ $(document).ready(function() {
|
|
},
|
|
},
|
|
afterLocated: function (lid, pos_id) {
|
|
afterLocated: function (lid, pos_id) {
|
|
posOperationObj.loadCurPosData();
|
|
posOperationObj.loadCurPosData();
|
|
|
|
+ ancGclObj.loadCurAncillaryGcl();
|
|
if (pos_id) {
|
|
if (pos_id) {
|
|
const posSheet = posSpread.getActiveSheet();
|
|
const posSheet = posSpread.getActiveSheet();
|
|
const relaPos = posSheet.zh_data.find(x => { return x.id === pos_id; });
|
|
const relaPos = posSheet.zh_data.find(x => { return x.id === pos_id; });
|
|
@@ -113,6 +120,7 @@ $(document).ready(function() {
|
|
afterShow: function () {
|
|
afterShow: function () {
|
|
ledgerSpread.refresh();
|
|
ledgerSpread.refresh();
|
|
if (posSpread) posSpread.refresh();
|
|
if (posSpread) posSpread.refresh();
|
|
|
|
+ if (ancGclSpread) ancGclSpread.refresh();
|
|
},
|
|
},
|
|
});
|
|
});
|
|
const errorList = $.cs_errorList({
|
|
const errorList = $.cs_errorList({
|
|
@@ -122,10 +130,12 @@ $(document).ready(function() {
|
|
storeKey: 'ledger-error-' + getTenderId(),
|
|
storeKey: 'ledger-error-' + getTenderId(),
|
|
afterLocated: function () {
|
|
afterLocated: function () {
|
|
posOperationObj.loadCurPosData();
|
|
posOperationObj.loadCurPosData();
|
|
|
|
+ ancGclObj.loadCurAncillaryGcl();
|
|
},
|
|
},
|
|
afterShow: function () {
|
|
afterShow: function () {
|
|
ledgerSpread.refresh();
|
|
ledgerSpread.refresh();
|
|
if (posSpread) posSpread.refresh();
|
|
if (posSpread) posSpread.refresh();
|
|
|
|
+ if (ancGclSpread) ancGclSpread.refresh();
|
|
},
|
|
},
|
|
});
|
|
});
|
|
const checkList = $.ledger_checkList({
|
|
const checkList = $.ledger_checkList({
|
|
@@ -137,10 +147,12 @@ $(document).ready(function() {
|
|
checkType: getCheckType(checkOption),
|
|
checkType: getCheckType(checkOption),
|
|
afterLocated: function () {
|
|
afterLocated: function () {
|
|
posOperationObj.loadCurPosData();
|
|
posOperationObj.loadCurPosData();
|
|
|
|
+ ancGclObj.loadCurAncillaryGcl();
|
|
},
|
|
},
|
|
afterShow: function () {
|
|
afterShow: function () {
|
|
ledgerSpread.refresh();
|
|
ledgerSpread.refresh();
|
|
if (posSpread) posSpread.refresh();
|
|
if (posSpread) posSpread.refresh();
|
|
|
|
+ if (ancGclSpread) ancGclSpread.refresh();
|
|
},
|
|
},
|
|
});
|
|
});
|
|
|
|
|
|
@@ -165,27 +177,14 @@ $(document).ready(function() {
|
|
}
|
|
}
|
|
autoFlashHeight();
|
|
autoFlashHeight();
|
|
ledgerSpread.refresh();
|
|
ledgerSpread.refresh();
|
|
- if (posSpread) {
|
|
|
|
- posSpread.refresh();
|
|
|
|
- }
|
|
|
|
- if (stdXmj) {
|
|
|
|
- stdXmj.spread.refresh();
|
|
|
|
- }
|
|
|
|
- if (stdGcl) {
|
|
|
|
- stdGcl.spread.refresh();
|
|
|
|
- }
|
|
|
|
- if (dealBills) {
|
|
|
|
- dealBills.spread.refresh();
|
|
|
|
- }
|
|
|
|
- if (searchLedger) {
|
|
|
|
- searchLedger.spread.refresh();
|
|
|
|
- }
|
|
|
|
- if (errorList) {
|
|
|
|
- errorList.spread.refresh();
|
|
|
|
- }
|
|
|
|
- if (checkList) {
|
|
|
|
- checkList.spread.refresh();
|
|
|
|
- }
|
|
|
|
|
|
+ if (posSpread) posSpread.refresh();
|
|
|
|
+ if (ancGclSpread) ancGclSpread.refresh();
|
|
|
|
+ if (stdXmj) stdXmj.spread.refresh();
|
|
|
|
+ if (stdGcl) stdGcl.spread.refresh();
|
|
|
|
+ if (dealBills) dealBills.spread.refresh();
|
|
|
|
+ if (searchLedger) searchLedger.spread.refresh();
|
|
|
|
+ if (errorList) errorList.spread.refresh();
|
|
|
|
+ if (checkList) checkList.spread.refresh();
|
|
if (gclGather) gclGather.spread.refresh();
|
|
if (gclGather) gclGather.spread.refresh();
|
|
}
|
|
}
|
|
});
|
|
});
|
|
@@ -425,6 +424,7 @@ $(document).ready(function() {
|
|
self.refreshTree(sheet, refreshNode);
|
|
self.refreshTree(sheet, refreshNode);
|
|
self.refreshOperationValid(sheet);
|
|
self.refreshOperationValid(sheet);
|
|
posOperationObj.loadCurPosData();
|
|
posOperationObj.loadCurPosData();
|
|
|
|
+ ancGclObj.loadCurAncillaryGcl();
|
|
billsTag.afterDeleteBills(refreshNode.delete);
|
|
billsTag.afterDeleteBills(refreshNode.delete);
|
|
});
|
|
});
|
|
});
|
|
});
|
|
@@ -900,6 +900,7 @@ $(document).ready(function() {
|
|
},
|
|
},
|
|
loadRelaData: function () {
|
|
loadRelaData: function () {
|
|
posOperationObj.loadCurPosData();
|
|
posOperationObj.loadCurPosData();
|
|
|
|
+ ancGclObj.loadCurAncillaryGcl();
|
|
posSearch.search($('#pos-keyword').val());
|
|
posSearch.search($('#pos-keyword').val());
|
|
treeOperationObj.loadExprToInput(ledgerSpread.getActiveSheet());
|
|
treeOperationObj.loadExprToInput(ledgerSpread.getActiveSheet());
|
|
},
|
|
},
|
|
@@ -1595,6 +1596,7 @@ $(document).ready(function() {
|
|
SpreadJsObj.loadSheetData(ledgerSpread.getActiveSheet(), 'tree', ledgerTree);
|
|
SpreadJsObj.loadSheetData(ledgerSpread.getActiveSheet(), 'tree', ledgerTree);
|
|
pos.loadDatas(result.pos);
|
|
pos.loadDatas(result.pos);
|
|
posOperationObj.loadCurPosData();
|
|
posOperationObj.loadCurPosData();
|
|
|
|
+ ancGclObj.loadCurAncillaryGcl();
|
|
checkShowLast(result.bills.length);
|
|
checkShowLast(result.bills.length);
|
|
}, null);
|
|
}, null);
|
|
},
|
|
},
|
|
@@ -1745,6 +1747,7 @@ $(document).ready(function() {
|
|
let bcontent = $(".bcontent-wrap") ? $(".bcontent-wrap").height() : 0;
|
|
let bcontent = $(".bcontent-wrap") ? $(".bcontent-wrap").height() : 0;
|
|
$(".sp-wrap").height(bcontent-30);
|
|
$(".sp-wrap").height(bcontent-30);
|
|
posSpread.refresh();
|
|
posSpread.refresh();
|
|
|
|
+ if (ancGclSpread) ancGclSpread.refresh();
|
|
}
|
|
}
|
|
});
|
|
});
|
|
sjsSettingObj.setGridSelectStyle(posSpreadSetting);
|
|
sjsSettingObj.setGridSelectStyle(posSpreadSetting);
|
|
@@ -2386,11 +2389,369 @@ $(document).ready(function() {
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
|
|
|
|
+ // 附属工程量相关
|
|
|
|
+ const ancGclSpreadSetting = {
|
|
|
|
+ cols: [
|
|
|
|
+ {title: '辅材', colSpan: '1', rowSpan: '1', field: 'is_aux', hAlign: 1, width: 40, cellType: 'checkbox'},
|
|
|
|
+ {title: '名称', colSpan: '1', rowSpan: '1', field: 'name', hAlign: 0, width: 120, formatter: '@'},
|
|
|
|
+ {title: '单位', colSpan: '1', rowSpan: '1', field: 'unit', hAlign: 1, width: 40, formatter: '@', cellType: 'unit'},
|
|
|
|
+ {title: '设计量', colSpan: '1', rowSpan: '1', field: 'quantity', hAlign: 2, width: 60, type: 'Number'},
|
|
|
|
+ {title: '设计量公式', colSpan: '1', rowSpan: '1', field: 'expr', hAlign: 0, width: 80, formatter: '@'},
|
|
|
|
+ {title: '图册号', colSpan: '1', rowSpan: '1', field: 'drawing_code', hAlign: 0, width: 80, formatter: '@'},
|
|
|
|
+ {title: '备注', colSpan: '1', rowSpan: '1', field: 'memo', hAlign: 0, width: 80, formatter: '@'},
|
|
|
|
+ ],
|
|
|
|
+ emptyRows: 3,
|
|
|
|
+ headRows: 1,
|
|
|
|
+ headRowHeight: [32],
|
|
|
|
+ headColWidth: [30],
|
|
|
|
+ defaultRowHeight: 21,
|
|
|
|
+ headerFont: '12px 微软雅黑',
|
|
|
|
+ font: '12px 微软雅黑',
|
|
|
|
+ };
|
|
|
|
+ SpreadJsObj.initSheet(ancGclSheet, ancGclSpreadSetting);
|
|
|
|
+ const ancGclObj = {
|
|
|
|
+ loadCurAncillaryGcl: function () {
|
|
|
|
+ const node = treeOperationObj.getSelectNode(ledgerSheet);
|
|
|
|
+ const gclData = node ? ancGcl.getPartData(node.id) || [] : [];
|
|
|
|
+ SpreadJsObj.loadSheetData(ancGclSheet, SpreadJsObj.DataType.Data, gclData);
|
|
|
|
+ },
|
|
|
|
+ baseOpr: function (type) {
|
|
|
|
+ const data = {};
|
|
|
|
+
|
|
|
|
+ const gclRange = ancGclSheet.zh_data;
|
|
|
|
+ if (type !== 'insert' && (!gclRange || gclRange.length === 0)) return;
|
|
|
|
+
|
|
|
|
+ const sel = ancGclSheet.getSelections();
|
|
|
|
+ if (!sel[0]) return;
|
|
|
|
+
|
|
|
|
+ const row = sel[0].row, count = sel[0].rowCount;
|
|
|
|
+ const first = gclRange[row];
|
|
|
|
+ if (type === 'insert') {
|
|
|
|
+ const node = SpreadJsObj.getSelectObject(ledgerSheet);
|
|
|
|
+ data.add = [{ lid: node.id, g_order: gclRange.length + 1 }];
|
|
|
|
+ } else if (type === 'delete') {
|
|
|
|
+ data.del = [];
|
|
|
|
+ for (let iRow = 0; iRow < count; iRow++) {
|
|
|
|
+ const gclData = gclRange[row + iRow];
|
|
|
|
+ if (!gclData) continue;
|
|
|
|
+ data.del.push(gclData.id);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (data.del.length === 0) return;
|
|
|
|
+ } else if (type === 'up-move') {
|
|
|
|
+ data.update = [];
|
|
|
|
+ const pre = gclRange[row - 1];
|
|
|
|
+ if (!pre) return;
|
|
|
|
+
|
|
|
|
+ const preUpdate = { id: pre.id };
|
|
|
|
+ for (let iRow = 0; iRow < count; iRow++) {
|
|
|
|
+ const gclData = gclRange[iRow + row];
|
|
|
|
+ if (!gclData) continue;
|
|
|
|
+ data.update.push({ id: gclData.id, g_order: gclRange[iRow + row - 1].g_order });
|
|
|
|
+ preUpdate.g_order = gclData.g_order;
|
|
|
|
+ }
|
|
|
|
+ data.update.push(preUpdate);
|
|
|
|
+
|
|
|
|
+ if (data.update <= 1) return;
|
|
|
|
+ } else if (type === 'down-move') {
|
|
|
|
+ data.update = [];
|
|
|
|
+ const next = gclRange[row + count];
|
|
|
|
+ if (!next) return;
|
|
|
|
+
|
|
|
|
+ const nextUpdate = { id: next.id };
|
|
|
|
+ for (let iRow = count - 1; iRow >= 0; iRow--) {
|
|
|
|
+ const gclData = gclRange[iRow + row];
|
|
|
|
+ if (!gclData) continue;
|
|
|
|
+
|
|
|
|
+ data.update.push({ id: gclData.id, g_order: gclRange[iRow + row + 1].g_order});
|
|
|
|
+ nextUpdate.g_order = gclData.g_order;
|
|
|
|
+ }
|
|
|
|
+ data.update.push(nextUpdate);
|
|
|
|
+
|
|
|
|
+ if (data.update <= 1) return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ postData('/tender/' + getTenderId() + '/anc-gcl/update', data, function(result) {
|
|
|
|
+ ancGcl.updateDatas(result);
|
|
|
|
+ ancGclObj.loadCurAncillaryGcl();
|
|
|
|
+ if (type !== 'delete') SpreadJsObj.locateData(ancGclSheet, first);
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ editStarting: function (e, info) {
|
|
|
|
+ ancGclObj.ledgerTreeNode = SpreadJsObj.getSelectObject(ledgerSheet);
|
|
|
|
+ },
|
|
|
|
+ editEnded: function (e, info) {
|
|
|
|
+ const setting = info.sheet.zh_setting;
|
|
|
|
+ if (!setting) return;
|
|
|
|
+ const gclData = SpreadJsObj.getSelectObject(info.sheet);
|
|
|
|
+
|
|
|
|
+ const col = setting.cols[info.col];
|
|
|
|
+ const orgText = gclData ? gclData[col.field] : '', newText = trimInvalidChar(info.editingText);
|
|
|
|
+ if (orgText === newText || (!orgText && !newText)) return;
|
|
|
|
+
|
|
|
|
+ const node = ancGclObj.ledgerTreeNode;
|
|
|
|
+ if (!node) {
|
|
|
|
+ toastr.error('数据错误,请选择台账节点后再试');
|
|
|
|
+ SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ if (!!newText && node.children && node.children.length > 0) {
|
|
|
|
+ toastr.error('父节点不可添加附属工程量');
|
|
|
|
+ SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ if (!!newText && (!node.b_code || node.b_code === '')) {
|
|
|
|
+ toastr.error('项目节不可插入附属工程量');
|
|
|
|
+ SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ const data = {};
|
|
|
|
+ if (gclData) {
|
|
|
|
+ const updateData = { id: gclData.id };
|
|
|
|
+ if (col.type === 'Number') {
|
|
|
|
+ const num = _.toNumber(newText);
|
|
|
|
+ if (!_.isFinite(num)) {
|
|
|
|
+ toastr.error('输入的数字非法');
|
|
|
|
+ SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ updateData[col.field] = num;
|
|
|
|
+ if (gclData.expr) updateData.expr = '';
|
|
|
|
+ } else if (col.field === 'expr') {
|
|
|
|
+ try {
|
|
|
|
+ updateData.expr = newText;
|
|
|
|
+ updateData.quantity = math.evaluate(transExpr(newText));
|
|
|
|
+ } catch(err) {
|
|
|
|
+ toastr.error('输入的计算式非法');
|
|
|
|
+ SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ updateData[col.field] = newText;
|
|
|
|
+ }
|
|
|
|
+ data.update = [ updateData ];
|
|
|
|
+ } else {
|
|
|
|
+ const sortData = info.sheet.zh_data;
|
|
|
|
+ const order = (!sortData || sortData.length === 0) ? 1 : Math.max(sortData[sortData.length - 1].g_order + 1, sortData.length + 1);
|
|
|
|
+ const addData = { lid: node.id, g_order: order };
|
|
|
|
+ if (col.type === 'Number') {
|
|
|
|
+ const num = _.toNumber(newText);
|
|
|
|
+ if (!_.isFinite(num)) {
|
|
|
|
+ toastr.error('输入的数字非法');
|
|
|
|
+ SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ addData[col.field] = num;
|
|
|
|
+ if (gclData.expr) addData.expr = '';
|
|
|
|
+ } else if (col.field === 'expr') {
|
|
|
|
+ try {
|
|
|
|
+ addData.expr = newText;
|
|
|
|
+ addData.quantity = math.evaluate(transExpr(newText));
|
|
|
|
+ } catch(err) {
|
|
|
|
+ toastr.error('输入的计算式非法');
|
|
|
|
+ SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ addData[col.field] = newText;
|
|
|
|
+ }
|
|
|
|
+ data.add = [addData];
|
|
|
|
+ }
|
|
|
|
+ postData('/tender/' + getTenderId() + '/anc-gcl/update', data, function (result) {
|
|
|
|
+ ancGcl.updateDatas(result);
|
|
|
|
+ ancGclObj.loadCurAncillaryGcl();
|
|
|
|
+ }, function () {
|
|
|
|
+ SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ deletePress: function (sheet) {
|
|
|
|
+ const setting = sheet.zh_setting;
|
|
|
|
+ if (!setting) return;
|
|
|
|
+
|
|
|
|
+ const sortData = sheet.zh_data;
|
|
|
|
+ if (!sortData || sortData.length === 0) return;
|
|
|
|
+
|
|
|
|
+ const sel = sheet.getSelections()[0];
|
|
|
|
+ const data = { update: [] };
|
|
|
|
+ for (let iRow = sel.row; iRow < sel.row + sel.rowCount; iRow++) {
|
|
|
|
+ let bDel = false;
|
|
|
|
+ const node = sortData[iRow];
|
|
|
|
+ if (!node) continue;
|
|
|
|
+
|
|
|
|
+ const updateData = { id: node.id };
|
|
|
|
+ for (let iCol = sel.col; iCol < sel.col + sel.colCount; iCol++) {
|
|
|
|
+ const style = sheet.getStyle(iRow, iCol);
|
|
|
|
+ if (style.locked) continue;
|
|
|
|
+
|
|
|
|
+ const col = setting.cols[iCol];
|
|
|
|
+ if (col.field === 'expr') {
|
|
|
|
+ updateData.expr = '';
|
|
|
|
+ updateData.quantity = 0;
|
|
|
|
+ } else {
|
|
|
|
+ updateData[col.field] = col.type === 'Number' ? 0 : '';
|
|
|
|
+ if (col.field === 'quantity') updateDataexpr = '';
|
|
|
|
+ }
|
|
|
|
+ bDel = true;
|
|
|
|
+ }
|
|
|
|
+ if (bDel) data.update.push(updateData);
|
|
|
|
+ }
|
|
|
|
+ if (data.update.length === 0) return;
|
|
|
|
+
|
|
|
|
+ postData('/tender/' + getTenderId() + '/anc-gcl/update', data, function (result) {
|
|
|
|
+ ancGcl.updateDatas(result);
|
|
|
|
+ ancGclObj.loadCurAncillaryGcl();
|
|
|
|
+ }, function () {
|
|
|
|
+ SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ clipboardPasting: function(e, info) {
|
|
|
|
+ info.cancel = true;
|
|
|
|
+ const node = SpreadJsObj.getSelectObject(ledgerSheet);
|
|
|
|
+ if (!node) {
|
|
|
|
+ toastr.error('数据错误,请选择台账节点后再试');
|
|
|
|
+ SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ if (node.children && node.children.length > 0) {
|
|
|
|
+ toastr.error('父节点不可添加附属工程量');
|
|
|
|
+ SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ if ((!node.b_code || node.b_code === '')) {
|
|
|
|
+ toastr.error('项目节不可插入附属工程量');
|
|
|
|
+ SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ const hint = {
|
|
|
|
+ expr: {type: 'warning', msg: '输入的 计算式 非法,已过滤'},
|
|
|
|
+ num: {type: 'warning', msg: '输入的 数字 非法,已过滤'},
|
|
|
|
+ };
|
|
|
|
+ const setting = info.sheet.zh_setting;
|
|
|
|
+ const sortData = info.sheet.zh_data || [];
|
|
|
|
+ const pasteData = SpreadJsObj.analysisPasteText(info.pasteData.text);
|
|
|
|
+ const data = {};
|
|
|
|
+ const analysisData = function(pasteRow, targetData) {
|
|
|
|
+ pasteRow.forEach((value, iCol) => {
|
|
|
|
+ const col = setting.cols[info.cellRange.col + iCol];
|
|
|
|
+ if (col.field === 'expr') {
|
|
|
|
+ try {
|
|
|
|
+ targetData.expr = trimInvalidChar(value);
|
|
|
|
+ targetData.quantity = math.evaluate(transExpr(targetData.expr));
|
|
|
|
+ } catch(err) {
|
|
|
|
+ toastMessageUniq(hint.expr);
|
|
|
|
+ targetData.expr = '';
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ } else if (col.type === 'Number') {
|
|
|
|
+ const num = _.toNumber(value);
|
|
|
|
+ if (!_.isFinite(num)) {
|
|
|
|
+ toastMessageUniq(hint.num);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ targetData[col.field] = num;
|
|
|
|
+ if (col.field === 'quantity') targetData.expr = '';
|
|
|
|
+ } else {
|
|
|
|
+ targetData[col.field] = value;
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ };
|
|
|
|
+ for (let iRow = 0; iRow < pasteData.length; iRow++) {
|
|
|
|
+ const curRow = iRow + info.cellRange.row;
|
|
|
|
+ const gclData = sortData[curRow];
|
|
|
|
+ if (gclData) {
|
|
|
|
+ if (!data.update) data.update = [];
|
|
|
|
+ const updateData = { id: gclData.id };
|
|
|
|
+ analysisData(pasteData[iRow], updateData);
|
|
|
|
+ data.update.push(updateData);
|
|
|
|
+ } else {
|
|
|
|
+ if (!data.add) data.add = [];
|
|
|
|
+ const addData = { lid: node.id, g_order: curRow + 1};
|
|
|
|
+ analysisData(pasteData[iRow], addData);
|
|
|
|
+ data.add.push(addData);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if ((!data.update || data.update.length === 0) && (!data.add || data.add.length === 0)) return;
|
|
|
|
+
|
|
|
|
+ postData('/tender/' + getTenderId() + '/anc-gcl/update', data, function (result) {
|
|
|
|
+ ancGcl.updateDatas(result);
|
|
|
|
+ ancGclObj.loadCurAncillaryGcl();
|
|
|
|
+ }, function () {
|
|
|
|
+ SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ };
|
|
|
|
+ SpreadJsObj.addDeleteBind(ancGclSpread, ancGclObj.deletePress);
|
|
|
|
+ ancGclSpread.bind(spreadNS.Events.EditStarting, ancGclObj.editStarting);
|
|
|
|
+ ancGclSpread.bind(spreadNS.Events.EditEnded, ancGclObj.editEnded);
|
|
|
|
+ ancGclSpread.bind(spreadNS.Events.ClipboardPasting, ancGclObj.clipboardPasting);
|
|
|
|
+ $.contextMenu({
|
|
|
|
+ selector: '#anc-gcl-spread',
|
|
|
|
+ build: function ($trigger, e) {
|
|
|
|
+ const target = SpreadJsObj.safeRightClickSelection($trigger, e, ancGclSpread);
|
|
|
|
+ return target.hitTestType === GC.Spread.Sheets.SheetArea.viewport || target.hitTestType === GC.Spread.Sheets.SheetArea.rowHeader;
|
|
|
|
+ },
|
|
|
|
+ items: {
|
|
|
|
+ 'insert': {
|
|
|
|
+ name: '插入',
|
|
|
|
+ icon: 'fa-plus',
|
|
|
|
+ disabled: function (key, opt) {
|
|
|
|
+ const node = SpreadJsObj.getSelectObject(ledgerSheet);
|
|
|
|
+ return !node || !node.b_code || (node.children && node.children.length > 0);
|
|
|
|
+ },
|
|
|
|
+ callback: function (key, opt) {
|
|
|
|
+ ancGclObj.baseOpr('insert');
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ 'delete': {
|
|
|
|
+ name: '删除',
|
|
|
|
+ icon: 'fa-remove',
|
|
|
|
+ disabled: function (key, opt) {
|
|
|
|
+ const gclData = SpreadJsObj.getSelectObject(ancGclSheet);
|
|
|
|
+ return !gclData;
|
|
|
|
+ },
|
|
|
|
+ callback: function (key, opt) {
|
|
|
|
+ ancGclObj.baseOpr('delete');
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ 'down-move': {
|
|
|
|
+ name: '下移',
|
|
|
|
+ icon: 'fa-arrow-down',
|
|
|
|
+ disabled: function(key, opt) {
|
|
|
|
+ const sel = ancGclSheet.getSelections()[0];
|
|
|
|
+ const row = sel ? sel.row : -1;
|
|
|
|
+ const first = ancGclSheet.zh_data[row];
|
|
|
|
+ const next = ancGclSheet.zh_data[sel.row + sel.rowCount];
|
|
|
|
+ return !first || !next;
|
|
|
|
+ },
|
|
|
|
+ callback: function(key, opt) {
|
|
|
|
+ ancGclObj.baseOpr('down-move');
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ 'up-move': {
|
|
|
|
+ name: '上移',
|
|
|
|
+ icon: 'fa-arrow-up',
|
|
|
|
+ disabled: function(key, opt) {
|
|
|
|
+ const sel = ancGclSheet.getSelections()[0];
|
|
|
|
+ const row = sel ? sel.row : -1;
|
|
|
|
+ const first = ancGclSheet.zh_data[row];
|
|
|
|
+ const preNode = ancGclSheet.zh_data[row - 1];
|
|
|
|
+ return !first || !preNode;
|
|
|
|
+ },
|
|
|
|
+ callback: function(key, opt) {
|
|
|
|
+ ancGclObj.baseOpr('up-move');
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+
|
|
postData(window.location.pathname + '/load', {}, function (data) {
|
|
postData(window.location.pathname + '/load', {}, function (data) {
|
|
ledgerTree.loadDatas(data.bills);
|
|
ledgerTree.loadDatas(data.bills);
|
|
treeCalc.calculateAll(ledgerTree);
|
|
treeCalc.calculateAll(ledgerTree);
|
|
checkShowLast(data.bills.length);
|
|
checkShowLast(data.bills.length);
|
|
pos.loadDatas(data.pos);
|
|
pos.loadDatas(data.pos);
|
|
|
|
+ ancGcl.loadDatas(data.ancGcl);
|
|
|
|
|
|
for (const t of data.tags) {
|
|
for (const t of data.tags) {
|
|
t.node = ledgerTree.datas.find(x => { return x.id === t.lid; });
|
|
t.node = ledgerTree.datas.find(x => { return x.id === t.lid; });
|
|
@@ -2406,6 +2767,9 @@ $(document).ready(function() {
|
|
posOperationObj.loadCurPosData();
|
|
posOperationObj.loadCurPosData();
|
|
SpreadJsObj.resetTopAndSelect(posSpread.getActiveSheet());
|
|
SpreadJsObj.resetTopAndSelect(posSpread.getActiveSheet());
|
|
|
|
|
|
|
|
+ ancGclObj.loadCurAncillaryGcl();
|
|
|
|
+ SpreadJsObj.resetTopAndSelect(ancGclSheet);
|
|
|
|
+
|
|
treeOperationObj.refreshOperationValid(ledgerSpread.getActiveSheet());
|
|
treeOperationObj.refreshOperationValid(ledgerSpread.getActiveSheet());
|
|
treeOperationObj.loadExprToInput(ledgerSpread.getActiveSheet());
|
|
treeOperationObj.loadExprToInput(ledgerSpread.getActiveSheet());
|
|
|
|
|
|
@@ -2416,27 +2780,14 @@ $(document).ready(function() {
|
|
select: '#right-spr',
|
|
select: '#right-spr',
|
|
callback: function () {
|
|
callback: function () {
|
|
ledgerSpread.refresh();
|
|
ledgerSpread.refresh();
|
|
- if (posSpread) {
|
|
|
|
- posSpread.refresh();
|
|
|
|
- }
|
|
|
|
- if (stdXmj) {
|
|
|
|
- stdXmj.spread.refresh();
|
|
|
|
- }
|
|
|
|
- if (stdGcl) {
|
|
|
|
- stdGcl.spread.refresh();
|
|
|
|
- }
|
|
|
|
- if (dealBills) {
|
|
|
|
- dealBills.spread.refresh();
|
|
|
|
- }
|
|
|
|
- if (searchLedger) {
|
|
|
|
- searchLedger.spread.refresh();
|
|
|
|
- }
|
|
|
|
- if (errorList) {
|
|
|
|
- errorList.spread.refresh();
|
|
|
|
- }
|
|
|
|
- if (checkList) {
|
|
|
|
- checkList.spread.refresh();
|
|
|
|
- }
|
|
|
|
|
|
+ if (posSpread) posSpread.refresh();
|
|
|
|
+ if (ancGclSpread) ancGclSpread.refresh();
|
|
|
|
+ if (stdXmj) stdXmj.spread.refresh();
|
|
|
|
+ if (stdGcl) stdGcl.spread.refresh();
|
|
|
|
+ if (dealBills) dealBills.spread.refresh();
|
|
|
|
+ if (searchLedger) searchLedger.spread.refresh();
|
|
|
|
+ if (errorList) errorList.spread.refresh();
|
|
|
|
+ if (checkList) checkList.spread.refresh();
|
|
if (gclGather) gclGather.spread.refresh();
|
|
if (gclGather) gclGather.spread.refresh();
|
|
}
|
|
}
|
|
});
|
|
});
|
|
@@ -2487,6 +2838,7 @@ $(document).ready(function() {
|
|
treeOperationObj.refreshOperationValid(mainSheet);
|
|
treeOperationObj.refreshOperationValid(mainSheet);
|
|
ledgerSpread.focus();
|
|
ledgerSpread.focus();
|
|
posOperationObj.loadCurPosData();
|
|
posOperationObj.loadCurPosData();
|
|
|
|
+ ancGclObj.loadCurAncillaryGcl();
|
|
});
|
|
});
|
|
};
|
|
};
|
|
const stdXmjSetting = {
|
|
const stdXmjSetting = {
|
|
@@ -2627,6 +2979,7 @@ $(document).ready(function() {
|
|
},
|
|
},
|
|
afterLocated: function () {
|
|
afterLocated: function () {
|
|
posOperationObj.loadCurPosData();
|
|
posOperationObj.loadCurPosData();
|
|
|
|
+ ancGclObj.loadCurAncillaryGcl();
|
|
},
|
|
},
|
|
calcSum: function (result) {
|
|
calcSum: function (result) {
|
|
const sum = { name: '合计' };
|
|
const sum = { name: '合计' };
|
|
@@ -2661,6 +3014,7 @@ $(document).ready(function() {
|
|
if (posSpread) {
|
|
if (posSpread) {
|
|
posSpread.refresh();
|
|
posSpread.refresh();
|
|
}
|
|
}
|
|
|
|
+ if (ancGclSpread) ancGclSpread.refresh();
|
|
});
|
|
});
|
|
class DealBills {
|
|
class DealBills {
|
|
constructor (selector, spreadSetting) {
|
|
constructor (selector, spreadSetting) {
|
|
@@ -2882,6 +3236,7 @@ $(document).ready(function() {
|
|
treeOperationObj.refreshOperationValid(mainSheet);
|
|
treeOperationObj.refreshOperationValid(mainSheet);
|
|
ledgerSpread.focus();
|
|
ledgerSpread.focus();
|
|
posOperationObj.loadCurPosData();
|
|
posOperationObj.loadCurPosData();
|
|
|
|
+ ancGclObj.loadCurAncillaryGcl();
|
|
});
|
|
});
|
|
});
|
|
});
|
|
}
|
|
}
|
|
@@ -3285,6 +3640,7 @@ $(document).ready(function() {
|
|
SpreadJsObj.reloadRowsBackColor(sheet, [sel.row, result.create[0].index]);
|
|
SpreadJsObj.reloadRowsBackColor(sheet, [sel.row, result.create[0].index]);
|
|
treeOperationObj.refreshOperationValid(sheet);
|
|
treeOperationObj.refreshOperationValid(sheet);
|
|
posOperationObj.loadCurPosData();
|
|
posOperationObj.loadCurPosData();
|
|
|
|
+ ancGclObj.loadCurAncillaryGcl();
|
|
self.obj.modal('hide');
|
|
self.obj.modal('hide');
|
|
}, null, true);
|
|
}, null, true);
|
|
} else {
|
|
} else {
|
|
@@ -3586,6 +3942,49 @@ $(document).ready(function() {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ $('a', '#anc-gcl-nav').bind('click', function(e) {
|
|
|
|
+ e.preventDefault();
|
|
|
|
+ const tab = $(this);
|
|
|
|
+ const showSideTab = function (show) {
|
|
|
|
+ const left = $('#pos-spread'), right = $('#pos-right'), parent = left.parent();
|
|
|
|
+ if (show) {
|
|
|
|
+ right.show();
|
|
|
|
+ autoFlashHeight();
|
|
|
|
+ /**
|
|
|
|
+ * right.show()后, parent被撑开成2倍left.height, 导致parent.width减少了10px
|
|
|
|
+ * 第一次left.width调整后,parent的缩回left.height, 此时parent.width又增加了10px
|
|
|
|
+ * 故需要通过最终的parent.width再计算一次left.width
|
|
|
|
+ *
|
|
|
|
+ * Q: 为什么不通过先计算left.width的宽度,以避免计算两次left.width?
|
|
|
|
+ * A: 右侧工具栏不一定显示,当右侧工具栏显示过一次后,就必须使用parent和right来计算left.width
|
|
|
|
+ *
|
|
|
|
+ */
|
|
|
|
+ const percent = 100 - right.outerWidth() /parent.width() * 100;
|
|
|
|
+ left.css('width', percent + '%');
|
|
|
|
+ } else {
|
|
|
|
+ left.width(parent.width());
|
|
|
|
+ right.hide();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ };
|
|
|
|
+ if (!tab.hasClass('active')) {
|
|
|
|
+ tab.addClass('active');
|
|
|
|
+ showSideTab(tab.hasClass('active'));
|
|
|
|
+ } else {
|
|
|
|
+ tab.removeClass('active');
|
|
|
|
+ showSideTab(tab.hasClass('active'));
|
|
|
|
+ }
|
|
|
|
+ if (posSpread) posSpread.refresh();
|
|
|
|
+ if (ancGclSpread) ancGclSpread.refresh();
|
|
|
|
+ });
|
|
|
|
+ $.divResizer({
|
|
|
|
+ select: '#pos-right-spr',
|
|
|
|
+ callback: function () {
|
|
|
|
+ if (posSpread) posSpread.refresh();
|
|
|
|
+ if (ancGclSpread) ancGclSpread.refresh();
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+
|
|
// $('#searchAccount').click(() => {
|
|
// $('#searchAccount').click(() => {
|
|
// const data = {
|
|
// const data = {
|
|
// keyword: $('#searchName').val(),
|
|
// keyword: $('#searchName').val(),
|
|
@@ -3871,6 +4270,7 @@ $(document).ready(function() {
|
|
SpreadJsObj.loadSheetData(ledgerSpread.getActiveSheet(), 'tree', ledgerTree);
|
|
SpreadJsObj.loadSheetData(ledgerSpread.getActiveSheet(), 'tree', ledgerTree);
|
|
pos.loadDatas(result.pos);
|
|
pos.loadDatas(result.pos);
|
|
posOperationObj.loadCurPosData();
|
|
posOperationObj.loadCurPosData();
|
|
|
|
+ ancGclObj.loadCurAncillaryGcl();
|
|
checkShowLast(result.bills.length);
|
|
checkShowLast(result.bills.length);
|
|
});
|
|
});
|
|
});
|
|
});
|
|
@@ -3882,6 +4282,7 @@ $(document).ready(function() {
|
|
const loadResult = ledgerTree.loadPostData({update: data.source.bills});
|
|
const loadResult = ledgerTree.loadPostData({update: data.source.bills});
|
|
treeOperationObj.refreshTree(ledgerSpread.getActiveSheet(), loadResult);
|
|
treeOperationObj.refreshTree(ledgerSpread.getActiveSheet(), loadResult);
|
|
posOperationObj.loadCurPosData();
|
|
posOperationObj.loadCurPosData();
|
|
|
|
+ ancGclObj.loadCurAncillaryGcl();
|
|
for (const e of data.error) {
|
|
for (const e of data.error) {
|
|
e.serialNo = ledgerTree.getNodeIndex(ledgerTree.getItems(e.ledger_id)) + 1;
|
|
e.serialNo = ledgerTree.getNodeIndex(ledgerTree.getItems(e.ledger_id)) + 1;
|
|
}
|
|
}
|
|
@@ -4110,6 +4511,7 @@ $(document).ready(function() {
|
|
if (Object.keys(att).length) {
|
|
if (Object.keys(att).length) {
|
|
SpreadJsObj.locateTreeNode(ledgerSpread.getActiveSheet(), att.ledger_id, true);
|
|
SpreadJsObj.locateTreeNode(ledgerSpread.getActiveSheet(), att.ledger_id, true);
|
|
posOperationObj.loadCurPosData();
|
|
posOperationObj.loadCurPosData();
|
|
|
|
+ ancGclObj.loadCurAncillaryGcl();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
});
|
|
});
|