Parcourir la source

清单子菜单分成动态的,清单指引、清单精灵
导入qtf文件的时候,生成指标信息

zhongzewei il y a 6 ans
Parent
commit
cedff814f6

+ 2 - 0
modules/pm/facade/pm_facade.js

@@ -1406,6 +1406,8 @@ async function importProject(importObj, userID, compilationID) {
             });
             });
         }
         }
         data.property.projectFeature = featureLib ? featureLib.feature : [];
         data.property.projectFeature = featureLib ? featureLib.feature : [];
+        // 指标信息相关设置
+        await project_facade.setSEILibData(data.property);
     }
     }
 }
 }
 
 

+ 2 - 1
web/building_saas/main/html/main.html

@@ -454,7 +454,8 @@
                                       <div class="main-data-bottom ovf-hidden" id="qdjl" style="float: left" >
                                       <div class="main-data-bottom ovf-hidden" id="qdjl" style="float: left" >
                                           <div class="p-0" style="background: #efefef">
                                           <div class="p-0" style="background: #efefef">
                                               <div class=" p-0">
                                               <div class=" p-0">
-                                                  <div id="qdjlTools" style="width: calc(100% - 5px); border-bottom: solid 1px lightgrey;">
+                                                  <div id="qdjlTools" style="display: none; width: calc(100% - 5px); border-bottom: solid 1px lightgrey;">
+                                                      <a id="guidanceInsertRation" href="javascript:void(0)" class="btn btn-sm btn-primary px-1 ml-1">插入定额</a>
                                                       <a id="elfInsertRation" href="javascript:void(0);" class="btn btn-sm btn-primary px-1 ml-1">应用选项</a>
                                                       <a id="elfInsertRation" href="javascript:void(0);" class="btn btn-sm btn-primary px-1 ml-1">应用选项</a>
                                                       <a id="elfInsertSingle" href="javascript:void(0)" class="btn btn-sm btn-primary px-1 ml-1">应用单条</a>
                                                       <a id="elfInsertSingle" href="javascript:void(0)" class="btn btn-sm btn-primary px-1 ml-1">应用单条</a>
                                                   </div>
                                                   </div>

+ 188 - 125
web/building_saas/main/js/views/billsElf.js

@@ -17,10 +17,20 @@ let billsGuidanceSelMode = 0;
 const BillsSub = (function() {
 const BillsSub = (function() {
     //清单子树挂载的地方,selected:当前选中的清单,mapping:以前九位清单编码为索引, 'xxx' : {sub: {datas, tree, controller}}
     //清单子树挂载的地方,selected:当前选中的清单,mapping:以前九位清单编码为索引, 'xxx' : {sub: {datas, tree, controller}}
     let bills = {selected: null, mapping: {}};
     let bills = {selected: null, mapping: {}};
+    // 指引类型
     const itemType = {
     const itemType = {
+        // 工作内容
         job: 0,
         job: 0,
+        // 定额
         ration: 1
         ration: 1
     };
     };
+    // 库类型
+    const libType = {
+        // 清单指引
+        guidance: 1,
+        // 清单精灵
+        elf: 2
+    };
     // 清单精灵
     // 清单精灵
     const elfItem = {
     const elfItem = {
         dom: $('#billsSubItems'),
         dom: $('#billsSubItems'),
@@ -100,7 +110,7 @@ const BillsSub = (function() {
         tree: null,
         tree: null,
         controller: null,
         controller: null,
         treeSetting: {
         treeSetting: {
-            treeCol: 1,
+            treeCol: 0,
             emptyRows: 0,
             emptyRows: 0,
             headRows: 1,
             headRows: 1,
             headRowHeight: [40],
             headRowHeight: [40],
@@ -108,7 +118,7 @@ const BillsSub = (function() {
             cols: [
             cols: [
                 {
                 {
                     width: 420,
                     width: 420,
-                    readOnly: false,
+                    readOnly: true,
                     head: {
                     head: {
                         titleNames: ["项目指引"],
                         titleNames: ["项目指引"],
                         spanCols: [1],
                         spanCols: [1],
@@ -169,10 +179,28 @@ const BillsSub = (function() {
     // 切换目前的模块
     // 切换目前的模块
     // 1:清单指引 2:清单精灵
     // 1:清单指引 2:清单精灵
     function switchModule(type) {
     function switchModule(type) {
-        curModule = elfItem;
-       /* curModule = type === 1
-            ? guideItem
-            : elfItem;*/
+        let libText;
+        if (type === libType.guidance) {
+            curModule = guideItem;
+            libText = '清单指引';
+            // 动态按钮
+            $('#guidanceInsertRation').show();
+            $('#elfInsertRation').hide();
+            $('#elfInsertSingle').hide();
+        } else {
+            curModule = elfItem;
+            libText = '清单精灵';
+            // 动态按钮
+            $('#guidanceInsertRation').hide();
+            $('#elfInsertRation').show();
+            $('#elfInsertSingle').show();
+        }
+        $('#qdjlTools').show();
+        // 库名称、清单子菜单名称动态显示
+        $('#stdBillsGuidanceTab').text(libText);
+        $('#linkQDJL').text(libText);
+        // 监听按钮事件
+        bindListener();
     }
     }
 
 
     const options = {
     const options = {
@@ -337,10 +365,90 @@ const BillsSub = (function() {
             }
             }
         }
         }
     }
     }
+    // 清单精灵数据初始化
+    function initElf(sheet, elf, treeData) {
+        //定额数据删除编号信息,(编码后+空格才会去除编码)
+        for(let rData of treeData){
+            if(rData.type === itemType.ration){
+                let nameArr = rData.name.split(' ');
+                if(nameArr.length > 1){
+                    nameArr.splice(0, 1);
+                    rData.name = nameArr.join(' ');
+                }
+            }
+        }
+        elf.sub.datas = treeData;
+        //第一层节点数据
+        let firstLevelDatas = _.filter(treeData, function (data) {
+            return data.ParentID == -1;
+        });
+        //第一层初始数据的选项显示
+        for(let fData of firstLevelDatas){
+            let options = getOptions(fData, treeData);
+            fData.options = options.length > 0 ? options[0].name : '';
+            //下挂的选项
+            fData.optionsData = options && options.length > 0 ? _.cloneDeep(options) : [];
+            fData.optionChecked = options && options.length > 0 ? [_.cloneDeep(options[0])] : [];
+        }
+        renderSheetFunc(sheet, function () {
+            initTree(elf.sub, sheet, elfItem.treeSetting, firstLevelDatas);
+            //初始选择选项
+            let initOptsOpr = [];
+            for(let elfNode of elf.sub.tree.items){
+                if(elfNode.data.optionsData.length > 0){
+                    initOptsOpr.push({node: elfNode, data: elfNode.data.optionsData[0]});
+                }
+            }
+            for(let opr of initOptsOpr){
+                insertNodeByData(opr.node, opr.data);
+            }
+            TREE_SHEET_HELPER.refreshTreeNodeData(elfItem.treeSetting, sheet, elf.sub.tree.items, false);
+            setOptionsCellType(elf.sub.tree.items);
+            //项目指引初始焦点
+            elfItemInitSel(sheet.getActiveRowIndex() ? sheet.getActiveRowIndex() : 0);
+        });
+    }
+    // 已经初始化过的清单精灵数据,重新展示
+    function reshowElf(sheet, elf) {
+        renderSheetFunc(sheet, function () {
+            elf.sub.controller.showTreeData();
+            setOptionsCellType(elf.sub.tree.items);
+            //清单精灵初始焦点
+            elfItemInitSel(sheet.getActiveRowIndex() ? sheet.getActiveRowIndex() : 0);
+        });
+    }
+    //根据项目指引的类型设置单元格类型,定额类型的项目指引为复选框
+    //@param {Array}nodes @return {void}
+    function setItemCellType(nodes){
+        //设置单元格类型
+        const base = new GC.Spread.Sheets.CellTypes.Base();
+        const checkBox = new GC.Spread.Sheets.CellTypes.CheckBox();
+        const sheet = guideItem.workBook.getActiveSheet();
+        renderSheetFunc(sheet, function(){
+            for(let node of nodes){
+                sheet.setCellType(node.serialNo(), 1, node.data.type === itemType.ration ?  checkBox : base);
+            }
+        });
+    }
+    // 清单指引数据初始化
+    function initGuidance(sheet, guidance, treeData) {
+        guidance.sub.datas = treeData;
+        renderSheetFunc(sheet, function () {
+            initTree(guidance.sub, sheet, guideItem.treeSetting, treeData);
+            //TREE_SHEET_HELPER.refreshTreeNodeData(guideItem.treeSetting, sheet, guidance.sub.tree.items, false);
+            setItemCellType(guidance.sub.tree.items);
+        });
+    }
+    // 已经初始化过的清单指引数据,重新展示
+    function reshowGuidance(sheet, guidance) {
+        renderSheetFunc(sheet, function () {
+            guidance.sub.controller.showTreeData();
+            setItemCellType(guidance.sub.tree.items);
+        });
+    }
     //清单焦点变换-清单子界面操作,获取清单前九位编码的标准清单清单精灵选项 或 清单指引数据
     //清单焦点变换-清单子界面操作,获取清单前九位编码的标准清单清单精灵选项 或 清单指引数据
     //@param {String}code @return {void}
     //@param {String}code @return {void}
     function billsSelSub(code) {
     function billsSelSub(code) {
-        console.log(bills);
         let sheet = curModule.workBook.getActiveSheet();
         let sheet = curModule.workBook.getActiveSheet();
         cleanData(sheet, curModule.headers, -1);
         cleanData(sheet, curModule.headers, -1);
         if (!code || code === '') {
         if (!code || code === '') {
@@ -351,9 +459,9 @@ const BillsSub = (function() {
         if (!bills.mapping[nineCode]) {
         if (!bills.mapping[nineCode]) {
             bills.mapping[nineCode] = {sub: {datas: [], tree: null, controller: null}};
             bills.mapping[nineCode] = {sub: {datas: [], tree: null, controller: null}};
         }
         }
-        let node = bills.mapping[nineCode];
-        bills.selected = node;
-        if(!node.sub.tree){
+        let container = bills.mapping[nineCode];
+        bills.selected = container;
+        if(!container.sub.tree){
             let guidanceLibID;
             let guidanceLibID;
             if (projectObj.project.projectInfo.engineeringInfo && projectObj.project.projectInfo.engineeringInfo.billsGuidance_lib) {
             if (projectObj.project.projectInfo.engineeringInfo && projectObj.project.projectInfo.engineeringInfo.billsGuidance_lib) {
                 guidanceLibID = projectObj.project.projectInfo.engineeringInfo.billsGuidance_lib[0]
                 guidanceLibID = projectObj.project.projectInfo.engineeringInfo.billsGuidance_lib[0]
@@ -361,54 +469,14 @@ const BillsSub = (function() {
                     : null;
                     : null;
             }
             }
             CommonAjax.post('/billsGuidance/api/getItemsByCode', {guidanceLibID: guidanceLibID, code: nineCode}, function (rstData) {
             CommonAjax.post('/billsGuidance/api/getItemsByCode', {guidanceLibID: guidanceLibID, code: nineCode}, function (rstData) {
-                //定额数据删除编号信息,(编码后+空格才会去除编码)
-                for(let rData of rstData){
-                    if(rData.type === itemType.ration){
-                        let nameArr = rData.name.split(' ');
-                        if(nameArr.length > 1){
-                            nameArr.splice(0, 1);
-                            rData.name = nameArr.join(' ');
-                        }
-                    }
-                }
-                node.sub.datas = rstData;
-                //第一层节点数据
-                let firstLevelDatas = _.filter(rstData, function (data) {
-                    return data.ParentID == -1;
-                });
-                //第一层初始数据的选项显示
-                for(let fData of firstLevelDatas){
-                    let options = getOptions(fData, rstData);
-                    fData.options = options.length > 0 ? options[0].name : '';
-                    //下挂的选项
-                    fData.optionsData = options && options.length > 0 ? _.cloneDeep(options) : [];
-                    fData.optionChecked = options && options.length > 0 ? [_.cloneDeep(options[0])] : [];
-                }
-                renderSheetFunc(sheet, function () {
-                    initTree(node.sub, sheet, elfItem.treeSetting, firstLevelDatas);
-                    //初始选择选项
-                    let initOptsOpr = [];
-                    for(let elfNode of node.sub.tree.items){
-                        if(elfNode.data.optionsData.length > 0){
-                            initOptsOpr.push({node: elfNode, data: elfNode.data.optionsData[0]});
-                        }
-                    }
-                    for(let opr of initOptsOpr){
-                        insertNodeByData(opr.node, opr.data);
-                    }
-                    TREE_SHEET_HELPER.refreshTreeNodeData(elfItem.treeSetting, sheet, node.sub.tree.items, false);
-                    setOptionsCellType(node.sub.tree.items);
-                    //项目指引初始焦点
-                    elfItemInitSel(sheet.getActiveRowIndex() ? sheet.getActiveRowIndex() : 0);
-                });
+                curModule === elfItem
+                    ? initElf(sheet, container, rstData)
+                    : initGuidance(sheet, container, rstData);
             });
             });
         } else{
         } else{
-            renderSheetFunc(sheet, function () {
-                node.sub.controller.showTreeData();
-                setOptionsCellType(node.sub.tree.items);
-                //项目指引初始焦点
-                elfItemInitSel(sheet.getActiveRowIndex() ? sheet.getActiveRowIndex() : 0);
-            });
+            curModule === elfItem
+                ? reshowElf(sheet, container)
+                : reshowGuidance(sheet, container);
         }
         }
     }
     }
     //获取选项的深度
     //获取选项的深度
@@ -694,29 +762,6 @@ const BillsSub = (function() {
             this.isEscKey = e.keyCode === GC.Spread.Commands.Key.esc;
             this.isEscKey = e.keyCode === GC.Spread.Commands.Key.esc;
             return false;
             return false;
         };
         };
-        /* OptionsCellType.prototype.paint = function (ctx, value, x, y, w, h, style, options) {
-         if(style.backColor){
-         ctx.fillStyle = style.backColor;
-         ctx.fillRect(x, y, w, h);
-         ctx.save();
-         }
-         //边长
-         const l = 7;
-         let leftPointX = x + w - 15,
-         rightPointX = leftPointX + l,
-         middlePointX = (leftPointX + rightPointX)/2;
-         const cos30 = Math.cos(2*Math.PI * 30 / 360);
-         let hL = l * cos30;
-         let beginY = y + h/2 - hL;
-         ctx.beginPath();
-         ctx.moveTo(leftPointX, beginY);
-         ctx.lineTo(rightPointX, beginY);
-         ctx.lineTo(middlePointX, beginY + hL);
-         ctx.fillStyle = 'black';
-         ctx.fill();
-         ctx.save();
-         };*/
-        // override getHitInfo to allow cell type get mouse messages
         OptionsCellType.prototype.getHitInfo = function (x, y, cellStyle, cellRect, context) {
         OptionsCellType.prototype.getHitInfo = function (x, y, cellStyle, cellRect, context) {
             return {
             return {
                 x: x,
                 x: x,
@@ -730,9 +775,47 @@ const BillsSub = (function() {
         };
         };
         return new OptionsCellType();
         return new OptionsCellType();
     }
     }
+    //原本清单存在此定额
+    function existTheRation(nodes, rationID) {
+        return nodes.find(node => node.data && node.data.stdID == rationID)
+    }
+    // 获取清单指生成的定额数据(不允许重复插入)
+    function getInsertGuidanceRationData() {
+        let rst = [];
+        if(!bills.selected || !bills.selected.sub){
+            return rst;
+        }
+        let tree = bills.selected.sub.tree;
+        if(!tree){
+            return rst;
+        }
+        let mainSelected = projectObj.project.mainTree.selected,
+            mainSelRationNodes = mainSelected.children.filter(node => node.data && node.data.type === rationType.ration);
+        // 从指引表从获取勾选的定额数据
+        let sheet = guideItem.workBook.getSheet(0),
+            rowCount = sheet.getRowCount();
+        for (let row = 0; row < rowCount; row++) {
+            let data = tree.items[row].data;
+            // 勾选的定额,且该定额在目标清单下不存在才插入
+            let isChecked = sheet.getValue(row, 1);
+            if (isChecked
+                && data.type === itemType.ration
+                && !existTheRation(mainSelRationNodes, data.rationID)) {
+                rst.push({
+                    itemQuery: {
+                        userID,
+                        ID: data.rationID
+                    },
+                    rationType: rationType.ration
+                });
+            }
+        }
+        return rst;
+    }
+
     //获取清单精灵生成的定额数据(跳过重复,不允许重复插入)
     //获取清单精灵生成的定额数据(跳过重复,不允许重复插入)
     //@return {Array}
     //@return {Array}
-    function getInsertElfRationData(){
+    function getInsertElfRationData() {
         let rst = [];
         let rst = [];
         if(!bills.selected || !bills.selected.sub){
         if(!bills.selected || !bills.selected.sub){
             return rst;
             return rst;
@@ -741,29 +824,20 @@ const BillsSub = (function() {
         if(!tree){
         if(!tree){
             return rst;
             return rst;
         }
         }
-        let mainSelected = projectObj.project.mainTree.selected;
-        let mainSelRationNodes = _.filter(mainSelected.children, function (c) {
-            return c.data && c.data.type === rationType.ration;
-        });
-        //原本清单存在此定额
-        function existTheRation(rationID) {
-            let r = _.find(mainSelRationNodes, function (node) {
-                return node.data && node.data.stdID && node.data.stdID == rationID;
-            });
-            return r;
-        }
+        let mainSelected = projectObj.project.mainTree.selected,
+            mainSelRationNodes = mainSelected.children.filter(node => node.data && node.data.type === rationType.ration);
         //造价书当前选中清单下的定额
         //造价书当前选中清单下的定额
         for(let node of tree.items){
         for(let node of tree.items){
             for(let perChecked of node.data.optionChecked){
             for(let perChecked of node.data.optionChecked){
                 //选项直接是定额
                 //选项直接是定额
-                if(perChecked.type === itemType.ration && !existTheRation(perChecked.rationID)){
+                if(perChecked.type === itemType.ration && !existTheRation(mainSelRationNodes, perChecked.rationID)){
                     rst.push({itemQuery: {userID: userID, ID: perChecked.rationID}, rationType: rationType.ration});
                     rst.push({itemQuery: {userID: userID, ID: perChecked.rationID}, rationType: rationType.ration});
                 }
                 }
                 //选项下子选项是定额
                 //选项下子选项是定额
                 else {
                 else {
                     let rationOpts = getOptions(perChecked, bills.selected.sub.datas);
                     let rationOpts = getOptions(perChecked, bills.selected.sub.datas);
                     for(let ration of rationOpts){
                     for(let ration of rationOpts){
-                        if(ration.type === itemType.ration && !existTheRation(ration.rationID)){
+                        if(ration.type === itemType.ration && !existTheRation(mainSelRationNodes, ration.rationID)){
                             rst.push({itemQuery: {userID: userID, ID: ration.rationID}, rationType: rationType.ration});
                             rst.push({itemQuery: {userID: userID, ID: ration.rationID}, rationType: rationType.ration});
                         }
                         }
                     }
                     }
@@ -787,25 +861,16 @@ const BillsSub = (function() {
         if (!elfSelected || !elfSelected.data.optionChecked || !elfSelected.data.optionChecked[0]) {
         if (!elfSelected || !elfSelected.data.optionChecked || !elfSelected.data.optionChecked[0]) {
             return rst;
             return rst;
         }
         }
-        let mainSelected = projectObj.project.mainTree.selected;
-        let mainSelRationNodes = _.filter(mainSelected.children, function (c) {
-            return c.data && c.data.type === rationType.ration;
-        });
-        //原本清单存在此定额
-        function existTheRation(rationID) {
-            let r = _.find(mainSelRationNodes, function (node) {
-                return node.data && node.data.stdID && node.data.stdID == rationID;
-            });
-            return r;
-        }
+        let mainSelected = projectObj.project.mainTree.selected,
+            mainSelRationNodes = mainSelected.children.filter(node => node.data && node.data.type === rationType.ration);
         //选中的节点第一个选项时定额选项或第一个选项下的子选项时定额选项
         //选中的节点第一个选项时定额选项或第一个选项下的子选项时定额选项
         let firstOptionChecked = elfSelected.data.optionChecked[0];
         let firstOptionChecked = elfSelected.data.optionChecked[0];
-        if (firstOptionChecked.type === itemType.ration && !existTheRation(firstOptionChecked.rationID)) {
+        if (firstOptionChecked.type === itemType.ration && !existTheRation(mainSelRationNodes, firstOptionChecked.rationID)) {
             rst.push({itemQuery: {userID: userID, ID: firstOptionChecked.rationID}, rationType: rationType.ration});
             rst.push({itemQuery: {userID: userID, ID: firstOptionChecked.rationID}, rationType: rationType.ration});
         } else {
         } else {
             let rationOpts = getOptions(firstOptionChecked, bills.selected.sub.datas);
             let rationOpts = getOptions(firstOptionChecked, bills.selected.sub.datas);
             for(let ration of rationOpts){
             for(let ration of rationOpts){
-                if(ration.type === itemType.ration && !existTheRation(ration.rationID)){
+                if(ration.type === itemType.ration && !existTheRation(mainSelRationNodes, ration.rationID)){
                     rst.push({itemQuery: {userID: userID, ID: ration.rationID}, rationType: rationType.ration});
                     rst.push({itemQuery: {userID: userID, ID: ration.rationID}, rationType: rationType.ration});
                     break;
                     break;
                 }
                 }
@@ -822,24 +887,27 @@ const BillsSub = (function() {
             });
             });
         }
         }
     }
     }
+    function handleClick(getRationFunc) {
+        if (!projectObj.project.Ration.canAdd(projectObj.project.mainTree.selected)) {
+            return;
+        }
+        let addRationDatas = getRationFunc();
+        insertRations(addRationDatas);
+    }
     //各监听事件
     //各监听事件
     //@return {void}
     //@return {void}
     function bindListener(){
     function bindListener(){
-        //插入定额
+        // 插入定额
+        $('#guidanceInsertRation').click(function () {
+            handleClick(getInsertGuidanceRationData);
+        });
+        // 应用选项
         $('#elfInsertRation').click(function () {
         $('#elfInsertRation').click(function () {
-            if (!projectObj.project.Ration.canAdd(projectObj.project.mainTree.selected)) {
-                return;
-            }
-            let addRationDatas =  getInsertElfRationData();
-            insertRations(addRationDatas);
+            handleClick(getInsertElfRationData);
         });
         });
-        //插入单条
+        // 应用单条
         $('#elfInsertSingle').click(function () {
         $('#elfInsertSingle').click(function () {
-            if (!projectObj.project.Ration.canAdd(projectObj.project.mainTree.selected)) {
-                return;
-            }
-            let addRationDatas = getInsertElfSingleRation();
-            insertRations(addRationDatas);
+            handleClick(getInsertElfSingleRation);
         });
         });
     }
     }
     return {
     return {
@@ -847,11 +915,6 @@ const BillsSub = (function() {
         buildSheet,
         buildSheet,
         refreshWorkBook,
         refreshWorkBook,
         billsSelSub,
         billsSelSub,
-        setColumnWidthByRate,
-        bindListener
+        setColumnWidthByRate
     };
     };
-})();
-
-$(document).ready(function () {
-    BillsSub.bindListener();
-});
+})();

+ 2 - 6
web/building_saas/main/js/views/project_info.js

@@ -34,12 +34,8 @@ var projectInfoObj = {
             if(!data.engineeringInfo.billsGuidance_lib || data.engineeringInfo.billsGuidance_lib.length === 0){
             if(!data.engineeringInfo.billsGuidance_lib || data.engineeringInfo.billsGuidance_lib.length === 0){
                 $('#stdBillsGuidanceTab').addClass('disabled');
                 $('#stdBillsGuidanceTab').addClass('disabled');
             } else {
             } else {
-                let billsGuidanceLib = data.engineeringInfo.billsGuidance_lib[0],
-                    libText = billsGuidanceLib.type === 1
-                        ? '清单精灵'
-                        : '清单精灵';
-                $('#stdBillsGuidanceTab').text(libText);
-                $('#linkQDJL').text(libText);
+                let billsGuidanceLib = data.engineeringInfo.billsGuidance_lib[0];
+                // 切换清单子界面的模块:清单指引、清单精灵
                 BillsSub.switchModule(billsGuidanceLib.type);
                 BillsSub.switchModule(billsGuidanceLib.type);
             }
             }
             //init decimal
             //init decimal

+ 2 - 0
web/building_saas/main/js/views/project_view.js

@@ -3178,6 +3178,8 @@ function disableTools(){
     $('#property_default').addClass('disabled');
     $('#property_default').addClass('disabled');
     //项目属性确定
     //项目属性确定
     $('#property_ok').addClass('disabled');
     $('#property_ok').addClass('disabled');
+    // 清单指引
+    $('#guidanceInsertRation').addClass('disabled');
     //清单精灵
     //清单精灵
     $('#elfInsertRation').addClass('disabled');
     $('#elfInsertRation').addClass('disabled');
     $('#elfInsertSingle').addClass('disabled');
     $('#elfInsertSingle').addClass('disabled');

+ 0 - 2
web/building_saas/main/js/views/side_tools.js

@@ -6,7 +6,6 @@ $(window).resize(function() {
     if ($('#stdRationChapter').width() > 0) {
     if ($('#stdRationChapter').width() > 0) {
         sheetCommonObj.setColumnWidthByRate($('#stdRationChapter').width() - 30, rationLibObj.rationChapterSpread, rationLibObj.rationChapterTreeSetting.cols);
         sheetCommonObj.setColumnWidthByRate($('#stdRationChapter').width() - 30, rationLibObj.rationChapterSpread, rationLibObj.rationChapterTreeSetting.cols);
     }
     }
-    billsGuidance.setColumnWidthByRate(billsGuidance.elfItem.workBook, $('#zy').width(), billsGuidance.elfItem.headers);
     billsGuidance.refreshWorkBook();
     billsGuidance.refreshWorkBook();
     rationLibObj.refreshSpread();
     rationLibObj.refreshSpread();
     loadSideToolsHeight();
     loadSideToolsHeight();
@@ -38,7 +37,6 @@ SlideResize.horizontalSlide(sideResizeEles.eleObj, sideResizeEles.limit, functio
     projectObj.refreshMainSpread();
     projectObj.refreshMainSpread();
     refreshSubSpread();
     refreshSubSpread();
     if (sideResizeEles.eleObj.module === 'stdBillsGuidanceTab') {//清单精灵(规则)
     if (sideResizeEles.eleObj.module === 'stdBillsGuidanceTab') {//清单精灵(规则)
-        billsGuidance.setColumnWidthByRate(billsGuidance.elfItem.workBook, $('#zy').width(), billsGuidance.elfItem.headers);
         billsGuidance.refreshWorkBook();
         billsGuidance.refreshWorkBook();
     } else if (sideResizeEles.eleObj.module === 'stdRationTab') {//定额库
     } else if (sideResizeEles.eleObj.module === 'stdRationTab') {//定额库
         sheetCommonObj.setColumnWidthByRate($('#stdRationChapter').width() - 40, rationLibObj.rationChapterSpread, rationLibObj.rationChapterTreeSetting.cols);
         sheetCommonObj.setColumnWidthByRate($('#stdRationChapter').width() - 40, rationLibObj.rationChapterSpread, rationLibObj.rationChapterTreeSetting.cols);

+ 7 - 290
web/building_saas/main/js/views/std_billsGuidance_lib.js

@@ -13,8 +13,6 @@ let doAfterLoadGuidance = null;
 
 
 const billsGuidance = (function () {
 const billsGuidance = (function () {
     let currentLib = null;
     let currentLib = null;
-    //库类型
-    const libType = {'guidance': 1, 'elf': 2}; //清单指引、清单精灵
     const libSel = $('#stdBillsGuidanceLibSelect');
     const libSel = $('#stdBillsGuidanceLibSelect');
     //工作内容
     //工作内容
     let stdBillsJobData = [];
     let stdBillsJobData = [];
@@ -124,174 +122,6 @@ const billsGuidance = (function () {
             }
             }
         }
         }
     };
     };
-    //项目指引类型
-    const itemType = {
-        job: 0,
-        ration: 1
-    };
-    const guideItem = {
-        dom: $('#billsGuidance_items'),
-        workBook: null,
-        tree: null,
-        controller: null,
-        treeSetting: {
-            treeCol: 1,
-            emptyRows: 0,
-            headRows: 1,
-            headRowHeight: [40],
-            defaultRowHeight: 21,
-            cols: [
-                {
-                    width: 35,
-                    readOnly: false,
-                    head: {
-                        titleNames: ["选择"],
-                        spanCols: [1],
-                        spanRows: [1],
-                        vAlign: [1],
-                        hAlign: [1],
-                        font: ["Arial"]
-                    },
-                    data: {
-                        field: "select",
-                        vAlign: 1,
-                        hAlign: 1,
-                        font: "Arial"
-                    }
-                },
-                {
-                width: 420,
-                readOnly: false,
-                head: {
-                    titleNames: ["项目指引"],
-                    spanCols: [1],
-                    spanRows: [1],
-                    vAlign: [1],
-                    hAlign: [1],
-                    font: ["Arial"]
-                },
-                data: {
-                    field: "name",
-                    vAlign: 1,
-                    hAlign: 0,
-                    font: "Arial"
-                }
-            }
-            ]
-        },
-        headers: [
-            {name: '选择', dataCode: 'select', width: 35, vAlign: 'center', hAlign: 'center', formatter: '@'},
-            {name: '项目指引', dataCode: 'name', width: 300, vAlign: 'center', hAlign: 'left', formatter: '@'},
-        ],
-        rowHeaderWidth:25,
-        events: {
-            EditStarting: function (sender, args) {
-                if(!bills.tree || guideItem.headers[args.col]['dataCode'] === 'name'){
-                    args.cancel = true;
-                }
-            },
-            ButtonClicked: function (sender, args) {
-                if(args.sheet.isEditing()){
-                    args.sheet.endEdit(true);
-                }
-                refreshInsertRation();
-            },
-            CellDoubleClick: function (sender, args) {
-                if(!bills.tree || !bills.tree.selected){
-                    return;
-                }
-                let node = bills.tree.selected.guidance.tree.selected;
-                if(!node){
-                    return;
-                }
-                if(node.children.length === 0){
-                    if(guideItem.headers[args.col]['dataCode'] === 'name'){
-                        insertRations(getInsertRationData([args.row]));
-                    }
-                }
-                else {
-                    node.setExpanded(!node.expanded);
-                    renderSheetFunc(args.sheet, function () {
-                        let iCount = node.posterityCount(), i, child;
-                        for (i = 0; i < iCount; i++) {
-                            child = bills.tree.selected.guidance.tree.items[args.row + i + 1];
-                            args.sheet.setRowVisible(args.row + i + 1, child.visible, args.sheetArea);
-                        }
-                        args.sheet.invalidateLayout();
-                    });
-                    args.sheet.repaint();
-                }
-            }
-        }
-    };
-    const elfItem = {
-        dom: $('#billsGuidance_items'),
-        workBook: null,
-        tree: null,
-        controller: null,
-        treeSetting: {
-            treeCol: 0,
-            emptyRows: 0,
-            headRows: 1,
-            headRowHeight: [40],
-            defaultRowHeight: 21,
-            cols: [
-                {
-                    width: 250,
-                    readOnly: true,
-                    head: {
-                        titleNames: ["施工工序"],
-                        spanCols: [1],
-                        spanRows: [1],
-                        vAlign: [1],
-                        hAlign: [1],
-                        font: ["Arial"]
-                    },
-                    data: {
-                        field: "name",
-                        vAlign: 1,
-                        hAlign: 0,
-                        font: "Arial"
-                    }
-                },
-                {
-                    width: 250,
-                    readOnly: false,
-                    head: {
-                        titleNames: ["选项"],
-                        spanCols: [1],
-                        spanRows: [1],
-                        vAlign: [1],
-                        hAlign: [1],
-                        font: ["Arial"]
-                    },
-                    data: {
-                        field: "options",
-                        vAlign: 1,
-                        hAlign: 0,
-                        font: "Arial"
-                    }
-                }
-            ]
-        },
-        headers: [
-            {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: '@'},
-        ],
-        rowHeaderWidth:25,
-        events: {
-            CellClick: function (sender, args) {
-                if(elfItem.headers[args.col]['dataCode'] === 'options' && args.sheetArea === 3){
-                    if(!args.sheet.getCell(args.row, args.col).locked() && !args.sheet.isEditing()){
-                        args.sheet.startEdit();
-                    }
-                }
-            },
-            ClipboardPasting: function (sender, info) {
-                info.cancel = true;
-            }
-        }
-    };
     const options = {
     const options = {
         workBook: {
         workBook: {
             tabStripVisible:  false,
             tabStripVisible:  false,
@@ -334,10 +164,6 @@ const billsGuidance = (function () {
         let fuc = function () {
         let fuc = function () {
             sheet.setColumnCount(headers.length);
             sheet.setColumnCount(headers.length);
             sheet.setRowHeight(0, 30, GC.Spread.Sheets.SheetArea.colHeader);
             sheet.setRowHeight(0, 30, GC.Spread.Sheets.SheetArea.colHeader);
-            //sheet.setColumnWidth(0, sheet.getParent() === bills.workBook ? 15 : 25, GC.Spread.Sheets.SheetArea.rowHeader);
-            if(sheet.getParent() === elfItem.workBook || sheet.getParent() === guideItem.workBook){
-                sheet.setRowHeight(0, 20, GC.Spread.Sheets.SheetArea.colHeader);
-            }
             for(let i = 0, len = headers.length; i < len; i++){
             for(let i = 0, len = headers.length; i < len; i++){
                 sheet.setValue(0, i, headers[i].name, GC.Spread.Sheets.SheetArea.colHeader);
                 sheet.setValue(0, i, headers[i].name, GC.Spread.Sheets.SheetArea.colHeader);
                 sheet.setColumnWidth(i, headers[i].width, GC.Spread.Sheets.SheetArea.colHeader);
                 sheet.setColumnWidth(i, headers[i].width, GC.Spread.Sheets.SheetArea.colHeader);
@@ -361,32 +187,6 @@ 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){
-            workBookWidth -= 48;
-            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'] !== ''){
-                    let width = workBookWidth * headers[col]['rateWidth'];
-                    if(headers[col]['dataCode'] === 'options'){
-                        width = width;
-                    }
-                    sheet.setColumnWidth(col, width, 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) {
@@ -403,37 +203,14 @@ const billsGuidance = (function () {
                 //设置悬浮提示
                 //设置悬浮提示
                 TREE_SHEET_HELPER.initSetting(bills.dom[0], bills.treeSetting);
                 TREE_SHEET_HELPER.initSetting(bills.dom[0], bills.treeSetting);
             }
             }
-            if(module === guideItem){
-                sheet.options.isProtected = true;
-                sheet.getRange(-1, 0, -1, 1).locked(false);
-                sheet.getRange(-1, 1, -1, 1).locked(true);
-            }
-            if(module === elfItem){
-                sheet.options.isProtected = true;
-                sheet.getRange(-1, 0, -1, 1).locked(true);
-                sheet.getRange(-1, 1, -1, 1).locked(false);
-            }
             if(module.rowHeaderWidth) {
             if(module.rowHeaderWidth) {
                 sheet.setColumnWidth(0, module.rowHeaderWidth, GC.Spread.Sheets.SheetArea.rowHeader);
                 sheet.setColumnWidth(0, module.rowHeaderWidth, GC.Spread.Sheets.SheetArea.rowHeader);
             }
             }
             setOptions(module.workBook, options);
             setOptions(module.workBook, options);
             buildHeader(module.workBook.getActiveSheet(), module.headers);
             buildHeader(module.workBook.getActiveSheet(), module.headers);
-            if(module === elfItem){
-                setColumnWidthByRate(elfItem.workBook, $('#zy').width(), elfItem.headers)
-            }
             bindEvent(module.workBook, module.events);
             bindEvent(module.workBook, module.events);
         }
         }
     }
     }
-    //清空表数据
-    //@param {Object}sheet {Array}headers {Number}rowCount @return {void}
-    function cleanData(sheet, headers, rowCount){
-        renderSheetFunc(sheet, function () {
-            sheet.clear(-1, 0, -1, headers.length, GC.Spread.Sheets.SheetArea.viewport, GC.Spread.Sheets.StorageType.data);
-            if (rowCount > 0) {
-                sheet.setRowCount(rowCount);
-            }
-        });
-    }
     //初始化各工作表
     //初始化各工作表
     //@param {Array}modules @return {void}
     //@param {Array}modules @return {void}
     function initWorkBooks(modules){
     function initWorkBooks(modules){
@@ -496,43 +273,6 @@ const billsGuidance = (function () {
             });
             });
         }
         }
     }
     }
-    //项目指引表焦点控制
-    //@param {Number}row @return {void}
-    function guideItemInitSel(row){
-        let billsNode = bills.tree.selected;
-        let node = null;
-        if(billsNode && billsNode.guidance.tree){
-            node = billsNode.guidance.tree.items[row];
-            if(node){
-                billsNode.guidance.tree.selected = node;
-            }
-        }
-    }
-    //清单精灵表焦点控制
-    //@param {Number}row @return {void}
-    function elfItemInitSel(row){
-        let billsNode = bills.tree.selected;
-        let node = null;
-        if(billsNode && billsNode.elf.tree){
-            node = billsNode.elf.tree.items[row];
-            if(node){
-                billsNode.elf.tree.selected = node;
-            }
-        }
-    }
-    //根据项目指引的类型设置单元格类型,定额类型的项目指引为复选框
-    //@param {Array}nodes @return {void}
-    function setItemCellType(nodes){
-        //设置单元格类型
-        const base = new GC.Spread.Sheets.CellTypes.Base();
-        const checkBox = new GC.Spread.Sheets.CellTypes.CheckBox();
-        const sheet = guideItem.workBook.getActiveSheet();
-        renderSheetFunc(sheet, function(){
-            for(let node of nodes){
-                sheet.setCellType(node.serialNo(), 0, node.data.type === itemType.ration ?  checkBox : base);
-            }
-        });
-    }
     //初始化清单的工作内容和项目特征
     //初始化清单的工作内容和项目特征
     //@param {Number}billsLibId {Function}callback @return {void}
     //@param {Number}billsLibId {Function}callback @return {void}
     function initJobAndCharacter(billsLibId, callback){
     function initJobAndCharacter(billsLibId, callback){
@@ -631,14 +371,6 @@ const billsGuidance = (function () {
                     jobCount ++;
                     jobCount ++;
                 }
                 }
             }
             }
-            /*if(billsNode.data.ruleText && billsNode.data.ruleText !== ''){
-                hintArr.push('工程量计算规则:');
-                hintArr.push(billsNode.data.ruleText);
-            }
-            if(billsNode.data.recharge && billsNode.data.recharge !== ''){
-                hintArr.push('补注:');
-                hintArr.push(billsNode.data.recharge);
-            }*/
             if(hintArr.length > 0){
             if(hintArr.length > 0){
                 tagInfo.push({row: billsNode.serialNo(), value: hintArr.join('\n')});
                 tagInfo.push({row: billsNode.serialNo(), value: hintArr.join('\n')});
             }
             }
@@ -657,14 +389,6 @@ const billsGuidance = (function () {
         $.bootstrapLoading.start();
         $.bootstrapLoading.start();
         CommonAjax.post('/billsGuidance/api/getLibWithBills', {libID: libID}, function(rstData){
         CommonAjax.post('/billsGuidance/api/getLibWithBills', {libID: libID}, function(rstData){
             currentLib = rstData.guidanceLib;
             currentLib = rstData.guidanceLib;
-            if(guideItem.workBook){
-                guideItem.workBook.destroy();
-                guideItem.workBook = null;
-            }
-            if(elfItem.workBook){
-                elfItem.workBook.destroy();
-                elfItem.workBook = null;
-            }
             initViews();
             initViews();
             let callback = function () {
             let callback = function () {
                 initTree(bills, bills.workBook.getActiveSheet(), bills.treeSetting, rstData.bills);
                 initTree(bills, bills.workBook.getActiveSheet(), bills.treeSetting, rstData.bills);
@@ -707,19 +431,12 @@ const billsGuidance = (function () {
             $('#billsGuidance_items').height(height / 2);
             $('#billsGuidance_items').height(height / 2);
         }
         }
         let modules = [bills];
         let modules = [bills];
-        if(currentLib.type && currentLib.type === libType.elf){
-            modules.push(elfItem);
-        }
-        else {
-            modules.push(guideItem);
-        }
         initWorkBooks(modules);
         initWorkBooks(modules);
 
 
     }
     }
     //展开至搜索出来点的节点
     //展开至搜索出来点的节点
     //@param {Array}nodes @return {void}
     //@param {Array}nodes @return {void}
     function expandSearchNodes(nodes){
     function expandSearchNodes(nodes){
-        let that = this;
         let billsSheet = bills.workBook.getActiveSheet();
         let billsSheet = bills.workBook.getActiveSheet();
         renderSheetFunc(billsSheet, function () {
         renderSheetFunc(billsSheet, function () {
             function expParentNode(node){
             function expParentNode(node){
@@ -855,15 +572,15 @@ const billsGuidance = (function () {
         if(bills.workBook){
         if(bills.workBook){
             bills.workBook.refresh();
             bills.workBook.refresh();
         }
         }
-        if(guideItem.workBook){
-            guideItem.workBook.refresh();
-        }
-        if(elfItem.workBook){
-            elfItem.workBook.refresh();
-        }
     }
     }
 
 
-    return {initViews, bindBtn, refreshWorkBook, setColumnWidthByRate, locateAtBills, bills, elfItem};
+    return {
+        initViews,
+        bindBtn,
+        refreshWorkBook,
+        locateAtBills,
+        bills
+    };
 })();
 })();
 
 
 $(document).ready(function(){
 $(document).ready(function(){

+ 6 - 0
web/building_saas/pm/js/pm_import.js

@@ -261,6 +261,12 @@ const importView = (() => {
             engineering: curEngineering.lib.engineering,    //定额取费专业
             engineering: curEngineering.lib.engineering,    //定额取费专业
             projectEngineering: curEngineering.lib.projectEngineering,  //单位工程取费专业
             projectEngineering: curEngineering.lib.projectEngineering,  //单位工程取费专业
             featureLibID: curEngineering.lib.feature_lib[0] ? curEngineering.lib.feature_lib[0].id : '',    //工程特征
             featureLibID: curEngineering.lib.feature_lib[0] ? curEngineering.lib.feature_lib[0].id : '',    //工程特征
+            indexName: curEngineering.lib.indexName,    // 指标名称
+            engineerInfoLibID: curEngineering.lib.engineer_info_lib[0] ? curEngineering.lib.engineer_info_lib[0].id : '',   // 工程信息指标
+            engineerFeatureLibID: curEngineering.lib.engineer_feature_lib[0] ? curEngineering.lib.engineer_feature_lib[0].id : '',  //工程特征指标
+            economicLibID: curEngineering.lib.economic_lib[0] ?  curEngineering.lib.economic_lib[0].id : '',    // 主要经济指标
+            mainQuantityLibID: curEngineering.lib.main_quantity_lib[0] ? curEngineering.lib.main_quantity_lib[0].id : '',   // 主要工程量指标
+            materialLibID: curEngineering.lib.material_lib[0] ? curEngineering.lib.material_lib[0].id : '', // 主要工料指标
             calcProgram: {name: taxData.program_lib.name, id: taxData.program_lib.id},  //计算程序
             calcProgram: {name: taxData.program_lib.name, id: taxData.program_lib.id},  //计算程序
             colLibID: taxData.col_lib.id,   //列设置
             colLibID: taxData.col_lib.id,   //列设置
             templateLibID: taxData.template_lib.id, //清单模板
             templateLibID: taxData.template_lib.id, //清单模板