|
@@ -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,66 @@ $(document).ready(() => {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ class BgBills {
|
|
|
+ constructor (selector, spreadSetting) {
|
|
|
+ const self = this;
|
|
|
+ this.loaded = false;
|
|
|
+ this.obj = $(selector)[0];
|
|
|
+ this.url = '/tender/' + window.location.pathname.split('/')[2] + '/deal';
|
|
|
+ this.spreadSetting = spreadSetting;
|
|
|
+ this.spread = SpreadJsObj.createNewSpread(this.obj);
|
|
|
+ SpreadJsObj.initSheet(this.spread.getActiveSheet(), this.spreadSetting);
|
|
|
+ if (!readOnly) {
|
|
|
+ this.spread.bind(spreadNS.Events.CellDoubleClick, function (e, info) {
|
|
|
+ const dealSheet = info.sheet;
|
|
|
+ const mainSheet = billsSheet;
|
|
|
+
|
|
|
+ const dealBills = SpreadJsObj.getSelectObject(dealSheet);
|
|
|
+ if (!dealBills) { 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-deal',
|
|
|
+ postData: {
|
|
|
+ id: mainNode.ledger_id,
|
|
|
+ type: mainNode.code ? 'child' : 'next',
|
|
|
+ dealBills: {
|
|
|
+ b_code: dealBills.code, name: dealBills.name, unit: dealBills.unit,
|
|
|
+ unit_price: dealBills.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] +'/get-bg-bills', {}, function (data) {
|
|
|
+ self.data = data;
|
|
|
+ SpreadJsObj.loadSheetData(self.spread.getActiveSheet(), 'data', data);
|
|
|
+ self.loaded = true;
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
class BatchInsertBillsPosObj {
|
|
|
constructor (obj) {
|
|
|
const self = this;
|