|
@@ -1034,7 +1034,7 @@ $(document).ready(function() {
|
|
|
}
|
|
|
},
|
|
|
'batchInsertBillsPos': {
|
|
|
- name: '批量插入清单-部位',
|
|
|
+ name: '批量插入清单-计量单元',
|
|
|
icon: 'fa-sign-in',
|
|
|
disabled: function (key, opt) {
|
|
|
if (!checkTzMeasureType()) return true;
|
|
@@ -1479,6 +1479,110 @@ $(document).ready(function() {
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
+ const stdLibCellDoubleClick = function (e, info) {
|
|
|
+ const stdSheet = info.sheet;
|
|
|
+ const mainSheet = ledgerSpread.getActiveSheet();
|
|
|
+ if (!stdSheet.zh_setting || !stdSheet.zh_tree || !mainSheet.zh_tree) { return; }
|
|
|
+
|
|
|
+ const stdTree = stdSheet.zh_tree;
|
|
|
+ const stdNode = stdTree.nodes[info.row];
|
|
|
+
|
|
|
+ const mainTree = mainSheet.zh_tree;
|
|
|
+ const sel = mainSheet.getSelections()[0];
|
|
|
+ const mainNode = mainTree.nodes[sel.row];
|
|
|
+ if (!stdNode) { return; }
|
|
|
+ if (info.sheet.zh_setting.stdType === 'gcl') {
|
|
|
+ if (mainNode.code && mainNode.code !== '' && !mainTree.isLeafXmj(mainNode)) {
|
|
|
+ toastr.warning('非最底层项目下,不应添加清单');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ postData(window.location.pathname + '/update', {
|
|
|
+ postType: 'add-std',
|
|
|
+ postData: {
|
|
|
+ id: ledgerTree.getNodeKey(mainNode),
|
|
|
+ tender_id: mainNode.tender_id,
|
|
|
+ stdType: info.sheet.zh_setting.stdType,
|
|
|
+ stdLibId: stdNode.list_id,
|
|
|
+ stdNode: stdTree.getNodeKey(stdNode)
|
|
|
+ }
|
|
|
+ }, function (result) {
|
|
|
+ const refreshNode = mainTree.loadPostData(result);
|
|
|
+ treeOperationObj.refreshTree(mainSheet, refreshNode);
|
|
|
+ if (refreshNode.create && refreshNode.create.length > 0) {
|
|
|
+ mainSheet.setSelection(refreshNode.create[refreshNode.create.length - 1].index, sel.col, sel.rowCount, sel.colCount);
|
|
|
+ } else {
|
|
|
+ const node = _.find(ledgerTree.nodes, {code: stdNode.code, name: stdNode.name});
|
|
|
+ if (node) {
|
|
|
+ mainSheet.setSelection(ledgerTree.nodes.indexOf(node), sel.col, sel.rowCount, sel.colCount);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ treeOperationObj.refreshOperationValid(mainSheet);
|
|
|
+ ledgerSpread.focus();
|
|
|
+ posOperationObj.loadCurPosData();
|
|
|
+ });
|
|
|
+ };
|
|
|
+ const stdXmjSetting = {
|
|
|
+ selector: '#std-xmj',
|
|
|
+ stdType: 'xmj',
|
|
|
+ treeSetting: {
|
|
|
+ id: 'chapter_id',
|
|
|
+ pid: 'pid',
|
|
|
+ order: 'order',
|
|
|
+ level: 'level',
|
|
|
+ rootId: -1,
|
|
|
+ keys: ['id', 'list_id', 'chapter_id'],
|
|
|
+ },
|
|
|
+ spreadSetting: {
|
|
|
+ cols: [
|
|
|
+ {title: '项目节编号', field: 'code', hAlign: 0, width: 120, formatter: '@', readOnly: true, cellType: 'tree'},
|
|
|
+ {title: '名称', field: 'name', hAlign: 0, width: 150, formatter: '@', readOnly: true},
|
|
|
+ {title: '单位', field: 'unit', hAlign: 1, width: 50, formatter: '@', readOnly: true}
|
|
|
+ ],
|
|
|
+ treeCol: 0,
|
|
|
+ emptyRows: 0,
|
|
|
+ headRows: 1,
|
|
|
+ headRowHeight: [32],
|
|
|
+ defaultRowHeight: 21,
|
|
|
+ headerFont: '12px 微软雅黑',
|
|
|
+ font: '12px 微软雅黑',
|
|
|
+ headColWidth: [0],
|
|
|
+ },
|
|
|
+ cellDoubleClick: stdLibCellDoubleClick,
|
|
|
+ page: 'ledger',
|
|
|
+ tid: getTenderId(),
|
|
|
+ };
|
|
|
+ const stdGclSetting = {
|
|
|
+ selector: '#std-gcl',
|
|
|
+ stdType: 'gcl',
|
|
|
+ treeSetting: {
|
|
|
+ id: 'bill_id',
|
|
|
+ pid: 'pid',
|
|
|
+ order: 'order',
|
|
|
+ level: 'level',
|
|
|
+ rootId: -1,
|
|
|
+ keys: ['id', 'list_id', 'bill_id']
|
|
|
+ },
|
|
|
+ spreadSetting: {
|
|
|
+ cols: [
|
|
|
+ {title: '清单编号', field: 'b_code', hAlign: 0, width: 120, formatter: '@', readOnly: true, cellType: 'tree'},
|
|
|
+ {title: '名称', field: 'name', hAlign: 0, width: 150, formatter: '@', readOnly: true},
|
|
|
+ {title: '单位', field: 'unit', hAlign: 1, width: 50, formatter: '@', readOnly: true}
|
|
|
+ ],
|
|
|
+ treeCol: 0,
|
|
|
+ emptyRows: 0,
|
|
|
+ headRows: 1,
|
|
|
+ headRowHeight: [32],
|
|
|
+ defaultRowHeight: 21,
|
|
|
+ headerFont: '12px 微软雅黑',
|
|
|
+ font: '12px 微软雅黑',
|
|
|
+ headColWidth: [0],
|
|
|
+ },
|
|
|
+ cellDoubleClick: stdLibCellDoubleClick,
|
|
|
+ page: 'ledger',
|
|
|
+ tid: getTenderId(),
|
|
|
+ };
|
|
|
// 展开收起标准清单
|
|
|
$('a', '#side-menu').bind('click', function (e) {
|
|
|
e.preventDefault();
|
|
@@ -1516,56 +1620,14 @@ $(document).ready(function() {
|
|
|
showSideTools(tab.hasClass('active'));
|
|
|
if (tab.attr('content') === '#std-xmj') {
|
|
|
if (!stdXmj) {
|
|
|
- stdXmj = new stdLib('#std-xmj', 'xmj', {
|
|
|
- id: 'chapter_id',
|
|
|
- pid: 'pid',
|
|
|
- order: 'order',
|
|
|
- level: 'level',
|
|
|
- rootId: -1,
|
|
|
- keys: ['id', 'list_id', 'chapter_id'],
|
|
|
- }, {
|
|
|
- cols: [
|
|
|
- {title: '项目节编号', field: 'code', hAlign: 0, width: 120, formatter: '@', readOnly: true, cellType: 'tree'},
|
|
|
- {title: '名称', field: 'name', hAlign: 0, width: 150, formatter: '@', readOnly: true},
|
|
|
- {title: '单位', field: 'unit', hAlign: 1, width: 50, formatter: '@', readOnly: true}
|
|
|
- ],
|
|
|
- treeCol: 0,
|
|
|
- emptyRows: 0,
|
|
|
- headRows: 1,
|
|
|
- headRowHeight: [32],
|
|
|
- defaultRowHeight: 21,
|
|
|
- headerFont: '12px 微软雅黑',
|
|
|
- font: '12px 微软雅黑',
|
|
|
- headColWidth: [0],
|
|
|
- });
|
|
|
- stdXmj.loadLib($('select', '#std-xmj').val());
|
|
|
+ stdXmj = new stdLib(stdXmjSetting);
|
|
|
+ //stdXmj.loadLib($('select', '#std-xmj').val());
|
|
|
}
|
|
|
stdXmj.spread.refresh();
|
|
|
} else if (tab.attr('content') === '#std-gcl') {
|
|
|
if (!stdGcl) {
|
|
|
- stdGcl = new stdLib('#std-gcl', 'gcl', {
|
|
|
- id: 'bill_id',
|
|
|
- pid: 'pid',
|
|
|
- order: 'order',
|
|
|
- level: 'level',
|
|
|
- rootId: -1,
|
|
|
- keys: ['id', 'list_id', 'bill_id']
|
|
|
- }, {
|
|
|
- cols: [
|
|
|
- {title: '清单编号', field: 'b_code', hAlign: 0, width: 120, formatter: '@', readOnly: true, cellType: 'tree'},
|
|
|
- {title: '名称', field: 'name', hAlign: 0, width: 150, formatter: '@', readOnly: true},
|
|
|
- {title: '单位', field: 'unit', hAlign: 1, width: 50, formatter: '@', readOnly: true}
|
|
|
- ],
|
|
|
- treeCol: 0,
|
|
|
- emptyRows: 0,
|
|
|
- headRows: 1,
|
|
|
- headRowHeight: [32],
|
|
|
- defaultRowHeight: 21,
|
|
|
- headerFont: '12px 微软雅黑',
|
|
|
- font: '12px 微软雅黑',
|
|
|
- headColWidth: [0],
|
|
|
- });
|
|
|
- stdGcl.loadLib($('select', '#std-gcl').val());
|
|
|
+ stdGcl = new stdLib(stdGclSetting);
|
|
|
+ //stdGcl.loadLib($('select', '#std-gcl').val());
|
|
|
}
|
|
|
stdGcl.spread.refresh();
|
|
|
} else if (tab.attr('content') === '#deal-bills') {
|
|
@@ -1628,85 +1690,6 @@ $(document).ready(function() {
|
|
|
posSpread.refresh();
|
|
|
}
|
|
|
});
|
|
|
-
|
|
|
- class stdLib {
|
|
|
- constructor(selector, stdType, treeSetting, spreadSetting) {
|
|
|
- const self = this;
|
|
|
- this.obj = $(selector + '-spread')[0];
|
|
|
- this.stdType = stdType;
|
|
|
- this.treeSetting = treeSetting;
|
|
|
- treeSetting.preUrl = this.url;
|
|
|
- this.spreadSetting = spreadSetting;
|
|
|
- this.spread = SpreadJsObj.createNewSpread(this.obj);
|
|
|
- SpreadJsObj.initSheet(this.spread.getActiveSheet(), this.spreadSetting);
|
|
|
- SpreadJsObj.forbiddenSpreadContextMenu(selector, this.spread);
|
|
|
- this.spread.getActiveSheet().bind(GC.Spread.Sheets.Events.CellDoubleClick, function (e, info) {
|
|
|
- const stdSheet = info.sheet;
|
|
|
- const mainSheet = ledgerSpread.getActiveSheet();
|
|
|
- if (!stdSheet.zh_setting || !stdSheet.zh_tree || !mainSheet.zh_tree) { return; }
|
|
|
-
|
|
|
- const stdTree = stdSheet.zh_tree;
|
|
|
- const stdNode = stdTree.nodes[info.row];
|
|
|
-
|
|
|
- const mainTree = mainSheet.zh_tree;
|
|
|
- const sel = mainSheet.getSelections()[0];
|
|
|
- const mainNode = mainTree.nodes[sel.row];
|
|
|
- if (!stdNode) { return; }
|
|
|
- if (stdType === 'gcl') {
|
|
|
- if (mainNode.code && mainNode.code !== '' && !mainTree.isLeafXmj(mainNode)) {
|
|
|
- toastr.warning('非最底层项目下,不应添加清单');
|
|
|
- return;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- postData(window.location.pathname + '/update', {
|
|
|
- postType: 'add-std',
|
|
|
- postData: {
|
|
|
- id: ledgerTree.getNodeKey(mainNode),
|
|
|
- tender_id: mainNode.tender_id,
|
|
|
- stdType: stdType,
|
|
|
- stdLibId: stdNode.list_id,
|
|
|
- stdNode: stdTree.getNodeKey(stdNode)
|
|
|
- }
|
|
|
- }, function (result) {
|
|
|
- const refreshNode = mainTree.loadPostData(result);
|
|
|
- treeOperationObj.refreshTree(mainSheet, refreshNode);
|
|
|
- if (refreshNode.create && refreshNode.create.length > 0) {
|
|
|
- mainSheet.setSelection(refreshNode.create[refreshNode.create.length - 1].index, sel.col, sel.rowCount, sel.colCount);
|
|
|
- } else {
|
|
|
- const node = _.find(ledgerTree.nodes, {code: stdNode.code, name: stdNode.name});
|
|
|
- if (node) {
|
|
|
- mainSheet.setSelection(ledgerTree.nodes.indexOf(node), sel.col, sel.rowCount, sel.colCount);
|
|
|
- }
|
|
|
- }
|
|
|
- treeOperationObj.refreshOperationValid(mainSheet);
|
|
|
- ledgerSpread.focus();
|
|
|
- posOperationObj.loadCurPosData();
|
|
|
- });
|
|
|
- });
|
|
|
- this.pathTree = createNewPathTree('base', this.treeSetting);
|
|
|
- this.cacheLib = [];
|
|
|
- $('select', selector).change(function () {
|
|
|
- self.loadLib(parseInt(this.value));
|
|
|
- });
|
|
|
- }
|
|
|
- loadLib (listId) {
|
|
|
- const cacheData = this.cacheLib.find(function (lib) {
|
|
|
- return lib.id === listId;
|
|
|
- });
|
|
|
- if (cacheData) {
|
|
|
- this.pathTree.loadDatas(cacheData.data);
|
|
|
- SpreadJsObj.loadSheetData(this.spread.getActiveSheet(), 'tree', this.pathTree);
|
|
|
- } else {
|
|
|
- const self = this;
|
|
|
- postData('/std-lib/get-data', {stdType: this.stdType, list_id: listId}, function (data) {
|
|
|
- self.cacheLib.push({id: listId, data: data});
|
|
|
- self.pathTree.loadDatas(data);
|
|
|
- SpreadJsObj.loadSheetData(self.spread.getActiveSheet(), 'tree', self.pathTree);
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
class DealBills {
|
|
|
constructor (selector, spreadSetting) {
|
|
|
const self = this;
|
|
@@ -1806,7 +1789,7 @@ $(document).ready(function() {
|
|
|
// 初始化 部位数量复核表 参数
|
|
|
this.posSpreadSetting = {
|
|
|
cols: [
|
|
|
- {title: '部位', field: 'bw', hAlign: 0, width: 80, formatter: '@'},
|
|
|
+ {title: '名称', field: 'bw', hAlign: 0, width: 80, formatter: '@'},
|
|
|
{title: '图册号', field: 'drawingCode', hAlign: 0, formatter: '@', width: 60},
|
|
|
],
|
|
|
emptyRows: this.posCount,
|