|
@@ -176,11 +176,22 @@ const BillsSub = (function() {
|
|
|
|
|
|
// 目前的模块:清单精灵或清单指引,默认是清单指引
|
|
|
let curModule = guideItem;
|
|
|
+ let curModules = [];// 清单指引和清单精灵共存
|
|
|
+ let isFirst = true;
|
|
|
// 切换目前的模块
|
|
|
// 1:清单指引 2:清单精灵
|
|
|
function switchModule(type) {
|
|
|
- let libText;
|
|
|
- if (type === libType.guidance) {
|
|
|
+
|
|
|
+ if(type === libType.guidance){
|
|
|
+ curModules.push(guideItem);
|
|
|
+ if(isFirst) gljOprObj.billsTab = "#linkQDZY";
|
|
|
+ }else{
|
|
|
+ curModules.push(elfItem);
|
|
|
+ if(isFirst) gljOprObj.billsTab = "#linkQDJL";
|
|
|
+ }
|
|
|
+ //2020-03-20清单指引和清单精灵并且,暂不用切换显示,只需绑定事件
|
|
|
+ /* let libText;
|
|
|
+ if (type === libType.guidance) {
|
|
|
curModule = guideItem;
|
|
|
libText = '清单指引';
|
|
|
// 动态按钮
|
|
@@ -197,9 +208,10 @@ const BillsSub = (function() {
|
|
|
}
|
|
|
$('#qdjlTools').show();
|
|
|
// 库名称、清单子菜单名称动态显示
|
|
|
- $('#linkQDJL').text(libText);
|
|
|
+ $('#linkQDJL').text(libText); */
|
|
|
// 监听按钮事件
|
|
|
- bindListener();
|
|
|
+ if(isFirst == true) bindListener();//绑定一次事件就行了
|
|
|
+ isFirst = false;
|
|
|
}
|
|
|
|
|
|
const options = {
|
|
@@ -302,31 +314,54 @@ const BillsSub = (function() {
|
|
|
}
|
|
|
//建表
|
|
|
//@param {Object}module @return {void}
|
|
|
- function buildSheet() {
|
|
|
- console.log(curModule);
|
|
|
- if(!curModule.workBook){
|
|
|
- curModule.workBook = new GC.Spread.Sheets.Workbook(curModule.dom[0], {sheetCount: 1});
|
|
|
- sheetCommonObj.spreadDefaultStyle(curModule.workBook);
|
|
|
- let sheet = curModule.workBook.getActiveSheet();
|
|
|
+ function buildSheet(cmodule) {
|
|
|
+ console.log(cmodule);
|
|
|
+ if(!cmodule.workBook){
|
|
|
+ cmodule.workBook = new GC.Spread.Sheets.Workbook(cmodule.dom[0], {sheetCount: 1});
|
|
|
+ sheetCommonObj.spreadDefaultStyle(cmodule.workBook);
|
|
|
+ let sheet = cmodule.workBook.getActiveSheet();
|
|
|
/*sheet.options.isProtected = true;
|
|
|
sheet.getRange(-1, 0, -1, 1).locked(true);
|
|
|
sheet.getRange(-1, 1, -1, 1).locked(false);*/
|
|
|
- if(curModule.rowHeaderWidth) {
|
|
|
- sheet.setColumnWidth(0, curModule.rowHeaderWidth, GC.Spread.Sheets.SheetArea.rowHeader);
|
|
|
+ if(cmodule.rowHeaderWidth) {
|
|
|
+ sheet.setColumnWidth(0, cmodule.rowHeaderWidth, GC.Spread.Sheets.SheetArea.rowHeader);
|
|
|
}
|
|
|
- setOptions(curModule.workBook, options);
|
|
|
- buildHeader(curModule.workBook.getActiveSheet(), curModule.headers);
|
|
|
- bindEvent(curModule.workBook, curModule.events);
|
|
|
+ setOptions(cmodule.workBook, options);
|
|
|
+ buildHeader(cmodule.workBook.getActiveSheet(), cmodule.headers);
|
|
|
+ bindEvent(cmodule.workBook, cmodule.events);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ function buildSheets(){
|
|
|
+ for(let c of curModules){
|
|
|
+ buildSheet(c);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
//刷新表
|
|
|
//@return {void}
|
|
|
function refreshWorkBook(){
|
|
|
+ let eleID = "";
|
|
|
+ let spreadEleID = "";
|
|
|
+ let toolsID = "";
|
|
|
+ if(gljOprObj.activeTab=='#linkQDZY'){
|
|
|
+ curModule = guideItem;
|
|
|
+ eleID = "qdzy";
|
|
|
+ spreadEleID = "billsSubItems_ZY";
|
|
|
+ toolsID = "qdzyTools";
|
|
|
+ }else if(gljOprObj.activeTab=='#linkQDJL'){
|
|
|
+ eleID = "qdjl";
|
|
|
+ spreadEleID = "billsSubItems_JL";
|
|
|
+ toolsID = "qdjlTools";
|
|
|
+ curModule = elfItem;
|
|
|
+ }
|
|
|
+ if(eleID == "") return;
|
|
|
//计算内部的表格高度
|
|
|
- if ($('#qdjl').is(':visible')) {
|
|
|
- let totalHeight = $('#qdjl').height(),
|
|
|
- elfToolsHeight = $('#qdjlTools').height();
|
|
|
- $('#billsSubItems').height(totalHeight - elfToolsHeight);
|
|
|
+ if ($('#'+eleID).is(':visible')) {
|
|
|
+ let totalHeight = $('#'+eleID).height(),
|
|
|
+ elfToolsHeight = $('#'+toolsID).height();
|
|
|
+ $('#'+spreadEleID).height(totalHeight - elfToolsHeight);
|
|
|
if (curModule.workBook) {
|
|
|
curModule.workBook.refresh();
|
|
|
}
|
|
@@ -448,6 +483,12 @@ const BillsSub = (function() {
|
|
|
//清单焦点变换-清单子界面操作,获取清单前九位编码的标准清单清单精灵选项 或 清单指引数据
|
|
|
//@param {String}code @return {void}
|
|
|
function billsSelSub(code) {
|
|
|
+ let type = libType.guidance;//指引和精灵可共存,所以需要类型区分
|
|
|
+ curModule = guideItem;
|
|
|
+ if(gljOprObj.activeTab=='#linkQDJL'){
|
|
|
+ type = libType.elf;
|
|
|
+ curModule = elfItem;
|
|
|
+ }
|
|
|
let sheet = curModule.workBook.getActiveSheet();
|
|
|
cleanData(sheet, curModule.headers, -1);
|
|
|
if (!code || code === '') {
|
|
@@ -455,17 +496,17 @@ const BillsSub = (function() {
|
|
|
}
|
|
|
let nineCode = code.substr(0, 9);
|
|
|
//查看此清单映射是否存在此编码映射数据,不存在,则新建映射
|
|
|
- if (!bills.mapping[nineCode]) {
|
|
|
- bills.mapping[nineCode] = {sub: {datas: [], tree: null, controller: null}};
|
|
|
+ if (!bills.mapping[nineCode+type]) {
|
|
|
+ bills.mapping[nineCode+type] = {sub: {datas: [], tree: null, controller: null}};
|
|
|
}
|
|
|
- let container = bills.mapping[nineCode];
|
|
|
+ let container = bills.mapping[nineCode+type];
|
|
|
bills.selected = container;
|
|
|
if(!container.sub.tree){
|
|
|
let guidanceLibID;
|
|
|
if (projectObj.project.projectInfo.engineeringInfo && projectObj.project.projectInfo.engineeringInfo.billsGuidance_lib) {
|
|
|
- guidanceLibID = projectObj.project.projectInfo.engineeringInfo.billsGuidance_lib[0]
|
|
|
- ? projectObj.project.projectInfo.engineeringInfo.billsGuidance_lib[0].id
|
|
|
- : null;
|
|
|
+ for(let lib of projectObj.project.projectInfo.engineeringInfo.billsGuidance_lib){
|
|
|
+ if(lib && lib.type == type) guidanceLibID = lib.id;
|
|
|
+ }
|
|
|
}
|
|
|
CommonAjax.post('/billsGuidance/api/getItemsByCode', {guidanceLibID: guidanceLibID, code: nineCode}, function (rstData) {
|
|
|
curModule === elfItem
|
|
@@ -909,9 +950,24 @@ const BillsSub = (function() {
|
|
|
handleClick(getInsertElfSingleRation);
|
|
|
});
|
|
|
}
|
|
|
+ function toggleDiv(action){
|
|
|
+ if(action=='hide'){
|
|
|
+ $('#QDZY_div').hide();
|
|
|
+ $('#QDJL_div').hide();
|
|
|
+ }else{
|
|
|
+ for(let c of curModules){
|
|
|
+ if(c == guideItem) $('#QDZY_div').show();
|
|
|
+ if(c == elfItem) $('#QDJL_div').show();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
return {
|
|
|
+ toggleDiv,
|
|
|
switchModule,
|
|
|
- buildSheet,
|
|
|
+ buildSheets,
|
|
|
refreshWorkBook,
|
|
|
billsSelSub,
|
|
|
setColumnWidthByRate
|