|
@@ -9,6 +9,12 @@
|
|
|
*/
|
|
|
|
|
|
const ckBillsSpread = window.location.pathname + '-billsSelect';
|
|
|
+const invalidFields = {
|
|
|
+ parent: ['sgfh_qty', 'sgfh_tp', 'sjcl_qty', 'sjcl_tp', 'qtcl_qty', 'qtcl_tp', 'deal_qty', 'deal_tp', 'unit_price'],
|
|
|
+ gcl: ['dgn_qty1', 'dgn_qty2'],
|
|
|
+ posCode: ['b_code'],
|
|
|
+ posCalc: ['sgfh_qty', 'sgfh_tp', 'sjcl_qty', 'sjcl_tp', 'qtcl_qty', 'qtcl_tp'],
|
|
|
+};
|
|
|
function transExpr(expr) {
|
|
|
return $.trim(expr).replace('\t', '').replace('=', '').replace('%', '/100');
|
|
|
}
|
|
@@ -56,7 +62,7 @@ $(document).ready(() => {
|
|
|
loadExprToInput(sheet) {
|
|
|
const sel = sheet.getSelections()[0];
|
|
|
const col = sheet.zh_setting.cols[sel.col], cell = sheet.getCell(sel.row, sel.col);
|
|
|
- if (col.type === 'Number') {
|
|
|
+ if (col && col.type === 'Number') {
|
|
|
const data = SpreadJsObj.getSelectObject(sheet);
|
|
|
if (data) {
|
|
|
$('#bills-expr').val(data[col.field]).attr('field', col.field).attr('org', data[col.field]);
|
|
@@ -233,7 +239,7 @@ $(document).ready(() => {
|
|
|
* 新增节点
|
|
|
* @param spread
|
|
|
*/
|
|
|
- baseOpr: function (sheet, type) {
|
|
|
+ baseOpr: function (sheet, type, addCount = 1) {
|
|
|
const self = this;
|
|
|
const [tree, node, count] = this.getDefaultSelectInfo(sheet);
|
|
|
if (!tree || !node || !count) return;
|
|
@@ -281,7 +287,7 @@ $(document).ready(() => {
|
|
|
postType: type,
|
|
|
postData: {
|
|
|
id: node.ledger_id,
|
|
|
- count: count,
|
|
|
+ count: type === 'add' ? addCount : count,
|
|
|
}
|
|
|
}, function (result) {
|
|
|
const refreshData = tree.loadPostData(result);
|
|
@@ -389,17 +395,113 @@ $(document).ready(() => {
|
|
|
}
|
|
|
},
|
|
|
clipboardPasting: function (e, info) {
|
|
|
- if (info.sheet.zh_setting) {
|
|
|
- const range = info.cellRange;
|
|
|
- for (let iRow = range.row; iRow < range.row + range.rowCount; iRow++) {
|
|
|
- const node = info.sheet.zh_tree.nodes[iRow];
|
|
|
- if (info.sheet.zh_tree.checkNodeUsed(node, pos)) {
|
|
|
- toastr.warning('"' + node.code + node.b_code + ' ' + node.name +'"已计量,请勿修改');
|
|
|
- info.cancel = true;
|
|
|
- return;
|
|
|
+ const tree = info.sheet.zh_tree, setting = info.sheet.zh_setting;
|
|
|
+ info.cancel = true;
|
|
|
+ if (!setting || !tree) return;
|
|
|
+ // const range = info.cellRange;
|
|
|
+ // for (let iRow = range.row; iRow < range.row + range.rowCount; iRow++) {
|
|
|
+ // const node = tree.nodes[iRow];
|
|
|
+ // if (tree.checkNodeUsed(node, pos)) {
|
|
|
+ // toastr.warning('"' + node.code + node.b_code + ' ' + node.name +'"已计量,请勿修改');
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+
|
|
|
+ const pasteData = info.pasteData.html
|
|
|
+ ? SpreadJsObj.analysisPasteHtml(info.pasteData.html)
|
|
|
+ : (info.pasteData.text === ''
|
|
|
+ ? SpreadJsObj.Clipboard.getAnalysisPasteText()
|
|
|
+ : SpreadJsObj.analysisPasteText(info.pasteData.text));
|
|
|
+ const hint = {
|
|
|
+ usedUp: {type: 'warning', msg: '节点已计量,不可修改单价'},
|
|
|
+ usedCode: {type: 'warning', msg: '节点已计量,编号不可修改为空值'},
|
|
|
+ invalidExpr: {type: 'warning', msg: '粘贴的表达式非法'},
|
|
|
+ posCode: {type: 'warning', msg: '清单含有计量单元,请先删除计量单元,再修改清单编号为空'},
|
|
|
+ posQty: {type: 'warning', msg: '清单含有计量单元,数量金额根据计量单元汇总计算所得,不可修改'},
|
|
|
+ parent: {type: 'warning', msg: '含有子项的清单,不可粘贴数量、单价、金额'},
|
|
|
+ gcl: {type: 'warning', msg: '工程量清单,不可粘贴项目节数量'},
|
|
|
+ };
|
|
|
+ const datas = [], filterNodes = [];
|
|
|
+
|
|
|
+ for (let iRow = 0; iRow < info.cellRange.rowCount; iRow ++) {
|
|
|
+ const curRow = info.cellRange.row + iRow;
|
|
|
+ const node = tree.nodes[curRow];
|
|
|
+ if (!node) continue;
|
|
|
+
|
|
|
+ let bPaste = false;
|
|
|
+ const data = info.sheet.zh_tree.getNodeKeyData(node);
|
|
|
+ for (let iCol = 0; iCol < info.cellRange.colCount; iCol++) {
|
|
|
+ const curCol = info.cellRange.col + iCol;
|
|
|
+ const colSetting = info.sheet.zh_setting.cols[curCol];
|
|
|
+ if (node.children && node.children.length > 0 && invalidFields.parent.indexOf(colSetting.field) >= 0) {
|
|
|
+ toastMessageUniq(hint.parent);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (!_.isEmpty(node.b_code) && invalidFields.gcl.indexOf(colSetting.field) >= 0) {
|
|
|
+ toastMessageUniq(hint.gcl);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ const lPos = pos.getLedgerPos(node.id);
|
|
|
+ if (lPos && lPos.length > 0) {
|
|
|
+ if (value === '' && colSetting.field === 'b_code') {
|
|
|
+ toastMessageUniq(hint.posCode);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (colSetting.field === 'sgfh_qty' || colSetting.field === 'sgfh_tp' ||
|
|
|
+ colSetting.field === 'sjcl_qty' || colSetting.field === 'sjcl_tp' ||
|
|
|
+ colSetting.field === 'qtcl_qty' || colSetting.field === 'qtcl_tp') {
|
|
|
+ toastMessageUniq(hint.posQty);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ const value = trimInvalidChar(pasteData[iRow][iCol]);
|
|
|
+ if (tree.checkNodeUsed(node, pos) && col.field === 'unit_price') {
|
|
|
+ toastMessageUniq (hint.usedUp);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (colSetting.type === 'Number') {
|
|
|
+ const num = _.toNumber(value);
|
|
|
+ if (num) {
|
|
|
+ data[colSetting.field] = num;
|
|
|
+ } else {
|
|
|
+ try {
|
|
|
+ data[colSetting.field] = math.evaluate(transExpr(value));
|
|
|
+ } catch (err) {
|
|
|
+ toastMessageUniq(hint.invalidExpr);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (node.used && (col.field === 'code' || col.field ==='b_code')
|
|
|
+ && data[colSetting.field] !== '' && value === '') {
|
|
|
+ toastMessageUniq(hint.usedCode);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ data[colSetting.field] = value;
|
|
|
}
|
|
|
+ bPaste = true;
|
|
|
+ }
|
|
|
+ if (bPaste) {
|
|
|
+ datas.push(data);
|
|
|
+ } else {
|
|
|
+ filterNodes.push(node);
|
|
|
}
|
|
|
}
|
|
|
+ if (datas.length > 0) {
|
|
|
+ postData(window.location.pathname + '/update', {postType: 'update', postData: datas}, function (result) {
|
|
|
+ const refreshNode = tree.loadPostData(result);
|
|
|
+ if (refreshNode.update) {
|
|
|
+ refreshNode.update = refreshNode.update.concat(filterNodes);
|
|
|
+ }
|
|
|
+ billsTreeSpreadObj.refreshTree(info.sheet, refreshNode);
|
|
|
+ }, function () {
|
|
|
+ SpreadJsObj.reLoadRowData(info.sheet, info.cellRange.row, info.cellRange.rowCount);
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ SpreadJsObj.reLoadRowData(info.sheet, info.cellRange.row, info.cellRange.rowCount);
|
|
|
+ }
|
|
|
},
|
|
|
clipboardPasted: function (e, info) {
|
|
|
const hint = {
|
|
@@ -559,7 +661,50 @@ $(document).ready(() => {
|
|
|
info.cancel = !_.isEmpty(node.b_code);
|
|
|
break;
|
|
|
}
|
|
|
- }
|
|
|
+ },
|
|
|
+ cut: function (sheet, sel, callback) {
|
|
|
+ if (!sheet || !sel) return;
|
|
|
+ if (sel.colCount >= sheet.zh_setting.cols.length) {
|
|
|
+ toastr.warning('请勿选中整行剪切');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ const sortData = SpreadJsObj.getSortData(sheet), datas = [];
|
|
|
+ for (let iRow = sel.row; iRow < sel.row + sel.rowCount; iRow++) {
|
|
|
+ const node = sortData[iRow];
|
|
|
+ if (node) {
|
|
|
+ const data = sheet.zh_tree.getNodeKeyData(node);
|
|
|
+ for (let iCol = sel.col; iCol < sel.col + sel.colCount; iCol++) {
|
|
|
+ const col = sheet.zh_setting.cols[iCol];
|
|
|
+ if (col.field === 'b_code' || col.field === 'sgfh_qty' || col.field === 'sgfh_tp' ||
|
|
|
+ col.field === 'sjcl_qty' || col.field === 'sjcl_tp' ||
|
|
|
+ col.field === 'qtcl_qty' || col.field === 'qtcl_tp') {
|
|
|
+ const lPos = pos.getLedgerPos(node.id);
|
|
|
+ if (lPos && lPos.length > 0) {
|
|
|
+ toastr.error('不可剪切');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ const style = sheet.getStyle(iRow, iCol);
|
|
|
+ if (style.locked) {
|
|
|
+ toastr.error('不可剪切');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const colSetting = sheet.zh_setting.cols[iCol];
|
|
|
+ data[colSetting.field] = null;
|
|
|
+ }
|
|
|
+ datas.push(data);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (datas.length > 0) {
|
|
|
+ callback();
|
|
|
+ postData(window.location.pathname + '/update', {postType: 'update', postData: datas}, function (result) {
|
|
|
+ const refreshNode = sheet.zh_tree.loadPostData(result);
|
|
|
+ billsTreeSpreadObj.refreshTree(sheet, refreshNode);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
};
|
|
|
billsTreeSpreadObj.refreshOperationValid(billsSheet);
|
|
|
billsTreeSpreadObj.loadExprToInput(billsSheet);
|
|
@@ -573,7 +718,7 @@ $(document).ready(() => {
|
|
|
$('a[name=cpc]').click(function () {
|
|
|
billsSpread.commandManager().execute({
|
|
|
cmd: this.getAttribute('type'),
|
|
|
- sheetName: billsSpread.getActiveSheet().name()
|
|
|
+ sheetName: billsSheet.name()
|
|
|
});
|
|
|
});
|
|
|
|
|
@@ -617,9 +762,39 @@ $(document).ready(() => {
|
|
|
billsSpread.bind(spreadNS.Events.EditStarting, billsTreeSpreadObj.editStarting);
|
|
|
billsSpread.bind(spreadNS.Events.EditEnded, billsTreeSpreadObj.editEnded);
|
|
|
billsSpread.bind(spreadNS.Events.ClipboardPasting, billsTreeSpreadObj.clipboardPasting);
|
|
|
- billsSpread.bind(spreadNS.Events.ClipboardPasted, billsTreeSpreadObj.clipboardPasted);
|
|
|
+ billsSpread.bind(spreadNS.Events.ClipboardChanging, function (e, info) {
|
|
|
+ const copyText = SpreadJsObj.getFilterCopyText(info.sheet);
|
|
|
+ SpreadJsObj.Clipboard.setCopyData(copyText);
|
|
|
+ });
|
|
|
SpreadJsObj.addDeleteBind(billsSpread, billsTreeSpreadObj.deletePress);
|
|
|
+ SpreadJsObj.addCutEvents(billsSpread, billsTreeSpreadObj.cut);
|
|
|
let batchInsertObj;
|
|
|
+ $.contextMenu.types.batchInsert = function (item, opt, root) {
|
|
|
+ const self = this;
|
|
|
+ if ($.isFunction(item.icon)) {
|
|
|
+ item._icon = item.icon.call(this, this, $t, key, item);
|
|
|
+ } else {
|
|
|
+ if (typeof(item.icon) === 'string' && item.icon.substring(0, 3) === 'fa-') {
|
|
|
+ // to enable font awesome
|
|
|
+ item._icon = root.classNames.icon + ' ' + root.classNames.icon + '--fa fa ' + item.icon;
|
|
|
+ } else {
|
|
|
+ item._icon = root.classNames.icon + ' ' + root.classNames.icon + '-' + item.icon;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.addClass(item._icon);
|
|
|
+ const $obj = $('<div>' + item.name + '<input class="text-right ml-1 mr-1" type="tel" max="20" min="1" value="' + item.value + '" style="width: 30px; height: 18px; padding-right: 4px;">行</div>')
|
|
|
+ .appendTo(this);
|
|
|
+ const $input = $obj.find('input');
|
|
|
+
|
|
|
+ const event = () => {
|
|
|
+ if (self.hasClass('context-menu-disabled')) return;
|
|
|
+ item.batchInsert($input[0], root);
|
|
|
+ };
|
|
|
+ $obj.on('click', event).keypress(function (e) {if (e.keyCode === 13) { event(); }});
|
|
|
+ $input.click((e) => {e.stopPropagation();})
|
|
|
+ .keyup((e) => {if (e.keyCode === 13) item.batchInsert($input[0], root);})
|
|
|
+ .on('input', function () {this.value = this.value.replace(/[^\d]/g, '');});
|
|
|
+ };
|
|
|
// 右键菜单
|
|
|
$.contextMenu({
|
|
|
selector: '#bills-spread',
|
|
@@ -681,6 +856,35 @@ $(document).ready(() => {
|
|
|
return !(valid && first && sameParent && !(first.level === 1 && first.node_type) && !nodeUsed);
|
|
|
}
|
|
|
},
|
|
|
+ 'batchInsert': {
|
|
|
+ name: '批量插入',
|
|
|
+ type: 'batchInsert',
|
|
|
+ value: '2',
|
|
|
+ icon: 'fa-sign-in',
|
|
|
+ batchInsert: function (obj, root) {
|
|
|
+ if (_.toNumber(obj.value) > _.toNumber(obj.max)) {
|
|
|
+ obj.value = obj.max;
|
|
|
+ toastr.warning('批量插入不可多于' + obj.max);
|
|
|
+ } else if (_.toNumber(obj.value) < _.toNumber(obj.min)) {
|
|
|
+ obj.value = obj.min;
|
|
|
+ toastr.warning('批量插入不可少于' + obj.min);
|
|
|
+ } else {
|
|
|
+ billsTreeSpreadObj.baseOpr(billsSheet, 'add', parseInt(obj.value));
|
|
|
+ root.$menu.trigger('contextmenu:hide');
|
|
|
+ }
|
|
|
+ },
|
|
|
+ disabled: function (key, opt) {
|
|
|
+ const sheet = billsSheet;
|
|
|
+ const selection = sheet.getSelections();
|
|
|
+ const sel = selection ? selection[0] : sheet.getSelections()[0];
|
|
|
+ const row = sel ? sel.row : -1;
|
|
|
+ const tree = sheet.zh_tree;
|
|
|
+ if (!tree) return true;
|
|
|
+ const first = sheet.zh_tree.nodes[row];
|
|
|
+ const valid = !sheet.zh_setting.readOnly;
|
|
|
+ return !(valid && first && first.level > 1);
|
|
|
+ }
|
|
|
+ },
|
|
|
'batchInsertBillsPos': {
|
|
|
name: '批量插入清单-计量单元',
|
|
|
icon: 'fa-sign-in',
|
|
@@ -992,7 +1196,7 @@ $(document).ready(() => {
|
|
|
selectionChanged: function (e, info) {
|
|
|
const col = info.sheet.zh_setting.cols[info.newSelections[0].col];
|
|
|
const cell = info.sheet.getCell(info.newSelections[0].col, info.newSelections[0].col);
|
|
|
- if (col.type === 'Number') {
|
|
|
+ if (col && col.type === 'Number') {
|
|
|
const data = SpreadJsObj.getSelectObject(info.sheet);
|
|
|
if (data) {
|
|
|
$('#pos-expr').val(data[col.field]).attr('field', col.field).attr('org', data[col.field])
|
|
@@ -1004,6 +1208,22 @@ $(document).ready(() => {
|
|
|
$('#pos-expr').val('').attr('readOnly', true);
|
|
|
}
|
|
|
},
|
|
|
+ addPegs: function (pegs) {
|
|
|
+ if (!pegs || pegs.length <= 0) return;
|
|
|
+ const node = SpreadJsObj.getSelectObject(billsSheet);
|
|
|
+ if (!node) return;
|
|
|
+
|
|
|
+ const sheet = posSpread.getActiveSheet();
|
|
|
+ const sortData = sheet.zh_data || [];
|
|
|
+ let order = sortData.length > 0 ? sortData[sortData.length - 1].porder + 1 : 1;
|
|
|
+ pegs.forEach(function (p) {p.porder = ++order; p.lid = node.id});
|
|
|
+
|
|
|
+ postData(window.location.pathname + '/update', {postType: 'pos', posPostType: 'paste', postData: pegs}, function (result) {
|
|
|
+ pos.updateDatas(result.pos);
|
|
|
+ posSpreadObj.loadCurPosData();
|
|
|
+ billsTreeSpreadObj.refreshOperationValid(billsSheet);
|
|
|
+ });
|
|
|
+ }
|
|
|
};
|
|
|
posSpreadObj.loadCurPosData();
|
|
|
SpreadJsObj.resetTopAndSelect(posSheet);
|
|
@@ -1052,6 +1272,8 @@ $(document).ready(() => {
|
|
|
posSpread.bind(spreadNS.Events.ClipboardPasting, posSpreadObj.clipboardPasting);
|
|
|
posSpread.bind(spreadNS.Events.ClipboardPasted, posSpreadObj.clipboardPasted);
|
|
|
SpreadJsObj.addDeleteBind(posSpread, posSpreadObj.deletePress);
|
|
|
+
|
|
|
+ const mergePeg = NewMergePeg({ callback: posSpreadObj.addPegs });
|
|
|
$.contextMenu({
|
|
|
selector: '#pos-spread',
|
|
|
build: function ($trigger, e) {
|
|
@@ -1073,6 +1295,16 @@ $(document).ready(() => {
|
|
|
callback: function (key, opt) {
|
|
|
posSpreadObj.deletePos(posSheet);
|
|
|
}
|
|
|
+ },
|
|
|
+ 'merge-peg': {
|
|
|
+ name: '合并起讫桩号',
|
|
|
+ disabled: function (key, opt) {
|
|
|
+ const node = SpreadJsObj.getSelectObject(billsSheet);
|
|
|
+ return _.isNil(node) || _.isNil(node.b_code) || node.b_code === '';
|
|
|
+ },
|
|
|
+ callback: function (key, opt) {
|
|
|
+ mergePeg.show();
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1138,13 +1370,17 @@ $(document).ready(() => {
|
|
|
}
|
|
|
SpreadJsObj.forbiddenSpreadContextMenu(selector, this.spread);
|
|
|
}
|
|
|
- loadData () {
|
|
|
- if (this.loaded) return;
|
|
|
+ loadData (callback) {
|
|
|
+ if (this.loaded) {
|
|
|
+ if (callback) callback();
|
|
|
+ return;
|
|
|
+ }
|
|
|
const self = this;
|
|
|
postData(this.url+'/get-data', {}, function (data) {
|
|
|
self.data = data;
|
|
|
SpreadJsObj.loadSheetData(self.spread.getActiveSheet(), 'data', data);
|
|
|
self.loaded = true;
|
|
|
+ if (callback) callback();
|
|
|
});
|
|
|
}
|
|
|
calculateData () {
|
|
@@ -1155,6 +1391,65 @@ $(document).ready(() => {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ class BgBills {
|
|
|
+ constructor (selector, spreadSetting) {
|
|
|
+ this.loaded = false;
|
|
|
+ this.obj = $(selector)[0];
|
|
|
+ this.spreadSetting = spreadSetting;
|
|
|
+ this.spread = SpreadJsObj.createNewSpread(this.obj);
|
|
|
+ this.sheet = this.spread.getActiveSheet();
|
|
|
+ SpreadJsObj.initSheet(this.sheet, this.spreadSetting);
|
|
|
+ if (!readOnly) {
|
|
|
+ this.spread.bind(spreadNS.Events.CellDoubleClick, function (e, info) {
|
|
|
+ const dealSheet = info.sheet;
|
|
|
+ const mainSheet = billsSheet;
|
|
|
+
|
|
|
+ const bgBills = SpreadJsObj.getSelectObject(dealSheet);
|
|
|
+ if (!bgBills) { return; }
|
|
|
+ const mainTree = mainSheet.zh_tree;
|
|
|
+ const mainNode = SpreadJsObj.getSelectObject(mainSheet);
|
|
|
+ if (!mainNode || !mainTree) { return; }
|
|
|
+
|
|
|
+ if (mainNode.code && mainNode.code !== '' && !mainTree.isLeafXmj(mainNode)) {
|
|
|
+ toastr.warning('非最底层项目下,不应添加变更清单');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ postData(window.location.pathname + '/update', {
|
|
|
+ postType: 'add-bg',
|
|
|
+ postData: {
|
|
|
+ id: mainNode.ledger_id,
|
|
|
+ type: mainNode.code ? 'child' : 'next',
|
|
|
+ dealBills: {
|
|
|
+ b_code: bgBills.code, name: bgBills.name, unit: bgBills.unit,
|
|
|
+ unit_price: bgBills.unit_price,
|
|
|
+ }
|
|
|
+ },
|
|
|
+ }, function (result) {
|
|
|
+ const refreshData = mainTree.loadPostData(result);
|
|
|
+ billsTreeSpreadObj.refreshTree(mainSheet, refreshData);
|
|
|
+ const sel = mainSheet.getSelections()[0];
|
|
|
+ if (sel && refreshData.create[0]) {
|
|
|
+ mainSheet.setSelection(mainTree.nodes.indexOf(refreshData.create[0]), sel.col, sel.rowCount, sel.colCount);
|
|
|
+ }
|
|
|
+ billsTreeSpreadObj.refreshOperationValid(mainSheet);
|
|
|
+ billsSpread.focus();
|
|
|
+ posSpreadObj.loadCurPosData();
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
+ SpreadJsObj.forbiddenSpreadContextMenu(selector, this.spread);
|
|
|
+ }
|
|
|
+ loadData () {
|
|
|
+ if (this.loaded) return;
|
|
|
+ const self = this;
|
|
|
+ postData('/tender/' + window.location.pathname.split('/')[2] +'/change/bills', {type: 'gather'}, function (data) {
|
|
|
+ self.data = data;
|
|
|
+ SpreadJsObj.loadSheetData(self.spread.getActiveSheet(), 'data', data);
|
|
|
+ self.loaded = true;
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
class BatchInsertBillsPosObj {
|
|
|
constructor (obj) {
|
|
|
const self = this;
|
|
@@ -1191,7 +1486,7 @@ $(document).ready(() => {
|
|
|
};
|
|
|
for (let iNum = 1; iNum <= this.billsCount; iNum++) {
|
|
|
this.posSpreadSetting.cols.push(
|
|
|
- {title: '节点' + iNum, field: 'bills' + iNum, hAlign: 2, width: 50}
|
|
|
+ {title: '清单' + iNum, field: 'bills' + iNum, hAlign: 2, width: 50}
|
|
|
)
|
|
|
}
|
|
|
this.posSpread = SpreadJsObj.createNewSpread($('.batch-l-b', this.obj)[0]);
|
|
@@ -1215,8 +1510,9 @@ $(document).ready(() => {
|
|
|
SpreadJsObj.initSheet(this.dealSpread.getActiveSheet(), this.dealSpreadSetting);
|
|
|
SpreadJsObj.refreshColumnAlign(this.dealSpread.getActiveSheet());
|
|
|
// 拉取签约节点数据
|
|
|
- dealBills.loadData();
|
|
|
- SpreadJsObj.loadSheetData(this.dealSpread.getActiveSheet(), 'data', dealBills.data);
|
|
|
+ dealBills.loadData(() => {
|
|
|
+ SpreadJsObj.loadSheetData(this.dealSpread.getActiveSheet(), 'data', dealBills.data);
|
|
|
+ });
|
|
|
// 双击签约节点,自动添加到清单编号窗口
|
|
|
this.dealSpread.bind(GC.Spread.Sheets.Events.CellDoubleClick, function (e, info) {
|
|
|
const deal = info.sheet.zh_data[info.row];
|
|
@@ -1229,7 +1525,7 @@ $(document).ready(() => {
|
|
|
if (sel.row + 1 === qdSheet.getRowCount()) {
|
|
|
const count = sel.row + 2;
|
|
|
qdSheet.setRowCount(count);
|
|
|
- qdSheet.getCell(sel.row + 1, 0, GC.Spread.Sheets.SheetArea.rowHeader).text('节点' + count);
|
|
|
+ qdSheet.getCell(sel.row + 1, 0, GC.Spread.Sheets.SheetArea.rowHeader).text('清单' + count);
|
|
|
|
|
|
const colCount = posSheet.getColumnCount() + 1;
|
|
|
posSheet.setColumnCount(colCount);
|
|
@@ -1258,8 +1554,8 @@ $(document).ready(() => {
|
|
|
postData(window.location.pathname + '/update', {postType: 'batch-insert', postData: insertData}, function (data) {
|
|
|
pos.updateDatas(data.pos);
|
|
|
const result = billsTree.loadPostData(data.ledger);
|
|
|
- billsTreeSpreadObj.refreshTree(sheet, result);
|
|
|
- billsTreeSpreadObj.refreshOperationValid(sheet, selection);
|
|
|
+ billsTreeSpreadObj.refreshTree(billsSheet, result);
|
|
|
+ billsTreeSpreadObj.refreshOperationValid(billsSheet, selection);
|
|
|
self.obj.modal('hide');
|
|
|
}, null, true);
|
|
|
}
|
|
@@ -1275,7 +1571,7 @@ $(document).ready(() => {
|
|
|
SpreadJsObj.beginMassOperation(qdSheet);
|
|
|
qdSheet.clear(0, 0, qdSheet.getRowCount(), qdSheet.getColumnCount(), GC.Spread.Sheets.SheetArea.viewport, GC.Spread.Sheets.StorageType.data);
|
|
|
for (let iRow = 1; iRow <= this.billsCount; iRow++) {
|
|
|
- qdSheet.getCell(iRow - 1, 0, GC.Spread.Sheets.SheetArea.rowHeader).text('节点' + iRow);
|
|
|
+ qdSheet.getCell(iRow - 1, 0, GC.Spread.Sheets.SheetArea.rowHeader).text('清单' + iRow);
|
|
|
}
|
|
|
qdSheet.setSelection(0, 0, 1 ,1);
|
|
|
SpreadJsObj.endMassOperation(qdSheet);
|
|
@@ -1339,6 +1635,22 @@ $(document).ready(() => {
|
|
|
headerFont: '12px 微软雅黑',
|
|
|
font: '12px 微软雅黑',
|
|
|
});
|
|
|
+ const bgBills = new BgBills('#bg-bills-spread', {
|
|
|
+ cols: [
|
|
|
+ {title: '清单编号', field: 'code', hAlign: 0, width: 85, formatter: '@', readOnly: true},
|
|
|
+ {title: '名称', field: 'name', hAlign: 0, width: 150, formatter: '@', readOnly: true},
|
|
|
+ {title: '单位', field: 'unit', hAlign: 1, width: 50, formatter: '@', readOnly: true},
|
|
|
+ {title: '单价', field: 'unit_price', hAlign: 2, width: 50, readOnly: true},
|
|
|
+ {title: '数量', field: 'quantity', hAlign: 2, width: 50, readOnly: true},
|
|
|
+ {title: '金额', field: 'total_price', hAlign: 2, width: 50, readOnly: true},
|
|
|
+ ],
|
|
|
+ emptyRows: 0,
|
|
|
+ headRows: 1,
|
|
|
+ headRowHeight: [32],
|
|
|
+ defaultRowHeight: 21,
|
|
|
+ headerFont: '12px 微软雅黑',
|
|
|
+ font: '12px 微软雅黑',
|
|
|
+ });
|
|
|
|
|
|
$.divResizer({
|
|
|
select: '#revise-right-spr',
|
|
@@ -1356,6 +1668,9 @@ $(document).ready(() => {
|
|
|
if (dealBills) {
|
|
|
dealBills.spread.refresh();
|
|
|
}
|
|
|
+ if (bgBills) {
|
|
|
+ bgBills.spread.refresh();
|
|
|
+ }
|
|
|
if (searchLedger) {
|
|
|
searchLedger.spread.refresh();
|
|
|
}
|
|
@@ -1388,6 +1703,9 @@ $(document).ready(() => {
|
|
|
if (dealBills) {
|
|
|
dealBills.spread.refresh();
|
|
|
}
|
|
|
+ if (bgBills) {
|
|
|
+ bgBills.spread.refresh();
|
|
|
+ }
|
|
|
if (searchLedger) {
|
|
|
searchLedger.spread.refresh();
|
|
|
}
|
|
@@ -1556,6 +1874,9 @@ $(document).ready(() => {
|
|
|
} else if (tab.attr('content') === '#deal-bills') {
|
|
|
dealBills.loadData();
|
|
|
dealBills.spread.refresh();
|
|
|
+ } else if (tab.attr('content') === '#bg-bills') {
|
|
|
+ bgBills.loadData();
|
|
|
+ bgBills.spread.refresh();
|
|
|
} else if (tab.attr('content') === '#search' && !searchLedger) {
|
|
|
if (!searchLedger) {
|
|
|
searchLedger = $.billsSearch({
|