|
@@ -8,6 +8,9 @@
|
|
* @version
|
|
* @version
|
|
*/
|
|
*/
|
|
|
|
|
|
|
|
+//清单指引/精灵获取完清单数据后的回调函数
|
|
|
|
+let doAfterLoadGuidance = null;
|
|
|
|
+
|
|
const billsGuidance = (function () {
|
|
const billsGuidance = (function () {
|
|
let currentLib = null;
|
|
let currentLib = null;
|
|
//库类型
|
|
//库类型
|
|
@@ -33,7 +36,7 @@ const billsGuidance = (function () {
|
|
headRowHeight: [40],
|
|
headRowHeight: [40],
|
|
defaultRowHeight: 21,
|
|
defaultRowHeight: 21,
|
|
cols: [{
|
|
cols: [{
|
|
- width: 160,
|
|
|
|
|
|
+ width: 140,
|
|
readOnly: true,
|
|
readOnly: true,
|
|
head: {
|
|
head: {
|
|
titleNames: ["项目编码"],
|
|
titleNames: ["项目编码"],
|
|
@@ -50,7 +53,7 @@ const billsGuidance = (function () {
|
|
font: "Arial"
|
|
font: "Arial"
|
|
}
|
|
}
|
|
}, {
|
|
}, {
|
|
- width: 220,
|
|
|
|
|
|
+ width: 190,
|
|
readOnly: true,
|
|
readOnly: true,
|
|
head: {
|
|
head: {
|
|
titleNames: ["项目名称"],
|
|
titleNames: ["项目名称"],
|
|
@@ -70,7 +73,6 @@ const billsGuidance = (function () {
|
|
{
|
|
{
|
|
width: 45,
|
|
width: 45,
|
|
readOnly: true,
|
|
readOnly: true,
|
|
- showHint: true,
|
|
|
|
head: {
|
|
head: {
|
|
titleNames: ["计量单位"],
|
|
titleNames: ["计量单位"],
|
|
spanCols: [1],
|
|
spanCols: [1],
|
|
@@ -89,8 +91,8 @@ const billsGuidance = (function () {
|
|
]
|
|
]
|
|
},
|
|
},
|
|
headers: [
|
|
headers: [
|
|
- {name: '项目编码', dataCode: 'code', width: 160, vAlign: 'center', hAlign: 'left', formatter: '@'},
|
|
|
|
- {name: '项目名称', dataCode: 'name', width: 220, vAlign: 'center', hAlign: 'left', formatter: '@'},
|
|
|
|
|
|
+ {name: '项目编码', dataCode: 'code', width: 140, vAlign: 'center', hAlign: 'left', formatter: '@'},
|
|
|
|
+ {name: '项目名称', dataCode: 'name', width: 190, vAlign: 'center', hAlign: 'left', formatter: '@'},
|
|
{name: '单位', dataCode: 'unit', width: 45, vAlign: 'center', hAlign: 'center', formatter: '@'},
|
|
{name: '单位', dataCode: 'unit', width: 45, vAlign: 'center', hAlign: 'center', formatter: '@'},
|
|
],
|
|
],
|
|
events: {
|
|
events: {
|
|
@@ -126,11 +128,11 @@ const billsGuidance = (function () {
|
|
} else {
|
|
} else {
|
|
ConfirmModal.stdBillsUnit.check(node.data, function (std) {
|
|
ConfirmModal.stdBillsUnit.check(node.data, function (std) {
|
|
canAdd = ProjectController.addBills(projectObj.project, projectObj.mainController, std);
|
|
canAdd = ProjectController.addBills(projectObj.project, projectObj.mainController, std);
|
|
- if(canAdd !== null || canAdd !== false){
|
|
|
|
|
|
+ /* if(canAdd !== null || canAdd !== false){
|
|
//插入选中的定额
|
|
//插入选中的定额
|
|
let addRationDatas = currentLib.type && currentLib.type === libType.elf ? getInsertElfRationData() : getInsertRationData(getCheckedRows());
|
|
let addRationDatas = currentLib.type && currentLib.type === libType.elf ? getInsertElfRationData() : getInsertRationData(getCheckedRows());
|
|
insertRations(addRationDatas);
|
|
insertRations(addRationDatas);
|
|
- }
|
|
|
|
|
|
+ }*/
|
|
if(canAdd === false && $.bootstrapLoading.isLoading()){
|
|
if(canAdd === false && $.bootstrapLoading.isLoading()){
|
|
$.bootstrapLoading.end();
|
|
$.bootstrapLoading.end();
|
|
}
|
|
}
|
|
@@ -143,11 +145,11 @@ const billsGuidance = (function () {
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
let insert = billsLibObj.insertBills(stdBillsJobData, stdBillsFeatureData, node);
|
|
let insert = billsLibObj.insertBills(stdBillsJobData, stdBillsFeatureData, node);
|
|
- if(insert){
|
|
|
|
|
|
+ /*if(insert){
|
|
//插入选中的定额
|
|
//插入选中的定额
|
|
let addRationDatas = currentLib.type && currentLib.type === libType.elf ? getInsertElfRationData() : getInsertRationData(getCheckedRows());
|
|
let addRationDatas = currentLib.type && currentLib.type === libType.elf ? getInsertElfRationData() : getInsertRationData(getCheckedRows());
|
|
insertRations(addRationDatas);
|
|
insertRations(addRationDatas);
|
|
- }
|
|
|
|
|
|
+ }*/
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
@@ -317,8 +319,8 @@ const billsGuidance = (function () {
|
|
]
|
|
]
|
|
},
|
|
},
|
|
headers: [
|
|
headers: [
|
|
- {name: '施工工序', dataCode: 'name', width: 250, vAlign: 'center', hAlign: 'center', formatter: '@'},
|
|
|
|
- {name: '选项', dataCode: 'options', width: 250, vAlign: 'center', hAlign: 'left', formatter: '@'},
|
|
|
|
|
|
+ {name: '施工工序', dataCode: 'name', width: 250, rateWidth: 0.5, vAlign: 'center', hAlign: 'center', formatter: '@'},
|
|
|
|
+ {name: '选项', dataCode: 'options', width: 250, rateWidth: 0.5, vAlign: 'center', hAlign: 'left', formatter: '@'},
|
|
],
|
|
],
|
|
events: {
|
|
events: {
|
|
CellClick: function (sender, args) {
|
|
CellClick: function (sender, args) {
|
|
@@ -398,6 +400,27 @@ const billsGuidance = (function () {
|
|
workBook.bind(Events[event], events[event]);
|
|
workBook.bind(Events[event], events[event]);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ //根据宽度比例设置列宽
|
|
|
|
+ //@param {Object}workBook {Number}workBookWidth {Array}headers @return {void}
|
|
|
|
+ function setColumnWidthByRate(workBook, workBookWidth, headers) {
|
|
|
|
+ if(workBook){
|
|
|
|
+ const sheet = workBook.getActiveSheet();
|
|
|
|
+ sheet.suspendEvent();
|
|
|
|
+ sheet.suspendPaint();
|
|
|
|
+ for(let col = 0; col < headers.length; col++){
|
|
|
|
+ if(headers[col]['rateWidth'] !== undefined && headers[col]['rateWidth'] !== null && headers[col]['rateWidth'] !== ''){
|
|
|
|
+ sheet.setColumnWidth(col, workBookWidth * headers[col]['rateWidth'], GC.Spread.Sheets.SheetArea.colHeader)
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ if(headers[col]['headerWidth'] !== undefined && headers[col]['headerWidth'] !== null && headers[col]['headerWidth'] !== ''){
|
|
|
|
+ sheet.setColumnWidth(col, headers[col]['headerWidth'], GC.Spread.Sheets.SheetArea.colHeader)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ sheet.resumeEvent();
|
|
|
|
+ sheet.resumePaint();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
//建表
|
|
//建表
|
|
//@param {Object}module @return {void}
|
|
//@param {Object}module @return {void}
|
|
function buildSheet(module) {
|
|
function buildSheet(module) {
|
|
@@ -425,6 +448,10 @@ const billsGuidance = (function () {
|
|
}
|
|
}
|
|
setOptions(module.workBook, options);
|
|
setOptions(module.workBook, options);
|
|
buildHeader(module.workBook.getActiveSheet(), module.headers);
|
|
buildHeader(module.workBook.getActiveSheet(), module.headers);
|
|
|
|
+ if(module === elfItem){
|
|
|
|
+ console.log($('#zy').width());
|
|
|
|
+ setColumnWidthByRate(elfItem.workBook, $('#zy').width(), elfItem.headers)
|
|
|
|
+ }
|
|
bindEvent(module.workBook, module.events);
|
|
bindEvent(module.workBook, module.events);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -449,7 +476,7 @@ const billsGuidance = (function () {
|
|
//@param {Object}module {Object}sheet {Object}treeSetting {Array}datas
|
|
//@param {Object}module {Object}sheet {Object}treeSetting {Array}datas
|
|
function initTree(module, sheet, treeSetting, datas){
|
|
function initTree(module, sheet, treeSetting, datas){
|
|
module.tree = idTree.createNew({id: 'ID', pid: 'ParentID', nid: 'NextSiblingID', rootId: -1, autoUpdate: true});
|
|
module.tree = idTree.createNew({id: 'ID', pid: 'ParentID', nid: 'NextSiblingID', rootId: -1, autoUpdate: true});
|
|
- module.controller = TREE_SHEET_CONTROLLER.createNew(module.tree, sheet, treeSetting);
|
|
|
|
|
|
+ module.controller = TREE_SHEET_CONTROLLER.createNew(module.tree, sheet, treeSetting, false);
|
|
module.tree.loadDatas(datas);
|
|
module.tree.loadDatas(datas);
|
|
if(module === bills){
|
|
if(module === bills){
|
|
initExpandStat();
|
|
initExpandStat();
|
|
@@ -917,6 +944,24 @@ const billsGuidance = (function () {
|
|
}
|
|
}
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
+ //根据编码定位至清单精灵库中
|
|
|
|
+ //
|
|
|
|
+ function locateAtBills(code) {
|
|
|
|
+ let nineCode = code.substring(0, 9);
|
|
|
|
+ let items = bills.tree.items;
|
|
|
|
+ let locateBills = _.find(items, function(item){
|
|
|
|
+ return item.data.code === nineCode;
|
|
|
|
+ });
|
|
|
|
+ if(locateBills){
|
|
|
|
+ expandSearchNodes([locateBills]);
|
|
|
|
+ sessionStorage.setItem('stdBillsGuidanceExpState', bills.tree.getExpState(bills.tree.items));
|
|
|
|
+ }
|
|
|
|
+ let sheet = bills.workBook.getActiveSheet();
|
|
|
|
+ let locateRow = locateBills ? locateBills.serialNo() : 0;
|
|
|
|
+ sheet.setActiveCell(locateRow, 0);
|
|
|
|
+ billsInitSel(locateRow);
|
|
|
|
+ sheet.showRow(locateRow, GC.Spread.Sheets.VerticalPosition.center);
|
|
|
|
+ }
|
|
//初始选择清单指引库
|
|
//初始选择清单指引库
|
|
//@param {Number}libID @return {void}
|
|
//@param {Number}libID @return {void}
|
|
function libInitSel(libID){
|
|
function libInitSel(libID){
|
|
@@ -955,6 +1000,9 @@ const billsGuidance = (function () {
|
|
setTagForHint(bills.tree.items);
|
|
setTagForHint(bills.tree.items);
|
|
//默认初始节点
|
|
//默认初始节点
|
|
billsInitSel(0);
|
|
billsInitSel(0);
|
|
|
|
+ if(doAfterLoadGuidance){
|
|
|
|
+ doAfterLoadGuidance();
|
|
|
|
+ }
|
|
$.bootstrapLoading.end();
|
|
$.bootstrapLoading.end();
|
|
}, function () {
|
|
}, function () {
|
|
$.bootstrapLoading.end();
|
|
$.bootstrapLoading.end();
|
|
@@ -1148,6 +1196,21 @@ const billsGuidance = (function () {
|
|
}
|
|
}
|
|
if(bills.tree.selected.children.length === 0){
|
|
if(bills.tree.selected.children.length === 0){
|
|
let insert = billsLibObj.insertBills(stdBillsJobData, stdBillsFeatureData, bills.tree.selected);
|
|
let insert = billsLibObj.insertBills(stdBillsJobData, stdBillsFeatureData, bills.tree.selected);
|
|
|
|
+ /*if(insert){
|
|
|
|
+ //插入选中的定额
|
|
|
|
+ let addRationDatas = currentLib.type && currentLib.type === libType.elf ? getInsertElfRationData() : getInsertRationData(getCheckedRows());
|
|
|
|
+ insertRations(addRationDatas);
|
|
|
|
+ }*/
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ //插入清单和定额
|
|
|
|
+ $('#guidanceInsertBillsAndRation').click(function () {
|
|
|
|
+ //插入清单
|
|
|
|
+ if(!bills.tree || !bills.tree.selected){
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ if(bills.tree.selected.children.length === 0){
|
|
|
|
+ let insert = billsLibObj.insertBills(stdBillsJobData, stdBillsFeatureData, bills.tree.selected);
|
|
if(insert){
|
|
if(insert){
|
|
//插入选中的定额
|
|
//插入选中的定额
|
|
let addRationDatas = currentLib.type && currentLib.type === libType.elf ? getInsertElfRationData() : getInsertRationData(getCheckedRows());
|
|
let addRationDatas = currentLib.type && currentLib.type === libType.elf ? getInsertElfRationData() : getInsertRationData(getCheckedRows());
|
|
@@ -1246,7 +1309,7 @@ const billsGuidance = (function () {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- return {initViews, bindBtn, refreshWorkBook, refreshInsertRation, bills};
|
|
|
|
|
|
+ return {initViews, bindBtn, refreshWorkBook, refreshInsertRation, setColumnWidthByRate, locateAtBills, bills, elfItem};
|
|
})();
|
|
})();
|
|
|
|
|
|
$(document).ready(function(){
|
|
$(document).ready(function(){
|