|
@@ -781,7 +781,7 @@ $(document).ready(() => {
|
|
|
}
|
|
|
}
|
|
|
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; padding-right: 4px;">行</div>')
|
|
|
+ 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 = () => { item.batchInsert($input[0], root); };
|
|
@@ -1343,6 +1343,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;
|
|
@@ -1527,6 +1586,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',
|
|
@@ -1544,6 +1619,9 @@ $(document).ready(() => {
|
|
|
if (dealBills) {
|
|
|
dealBills.spread.refresh();
|
|
|
}
|
|
|
+ if (bgBills) {
|
|
|
+ bgBills.spread.refresh();
|
|
|
+ }
|
|
|
if (searchLedger) {
|
|
|
searchLedger.spread.refresh();
|
|
|
}
|
|
@@ -1576,6 +1654,9 @@ $(document).ready(() => {
|
|
|
if (dealBills) {
|
|
|
dealBills.spread.refresh();
|
|
|
}
|
|
|
+ if (bgBills) {
|
|
|
+ bgBills.spread.refresh();
|
|
|
+ }
|
|
|
if (searchLedger) {
|
|
|
searchLedger.spread.refresh();
|
|
|
}
|
|
@@ -1744,6 +1825,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({
|