Procházet zdrojové kódy

1.导入接口文件,特征及内容窗口应从接口文件导入
2.导入接口文件,工程量表达式应正确
3.清单锁定时,特征及内容窗口选中框应只读

zhongzewei před 6 roky
rodič
revize
87068b5ef6

+ 59 - 21
web/building_saas/main/js/models/importStandardInterface.js

@@ -356,6 +356,9 @@ const ImportXML = (() => {
         }
         //提取清单项目数据
         function extractBills(billsSrc, type) {
+            let {features, contents} = getFeaturesAndContents(billsSrc);
+            // 特征及内容窗口
+            let {itemCharacter, jobContent} = featureAndContent(features, contents);
             let obj = {
                 type: type, //清单类型
                 code: getValue(billsSrc, ['_项目编码']),
@@ -365,7 +368,9 @@ const ImportXML = (() => {
                 mainBills: getValue(billsSrc, ['_主要清单标志']) === 'true' ? true : false,
                 quantity: getValue(billsSrc, ['_工程量']) || '0' ,
                 remark: getValue(billsSrc, ['_备注']),
-                itemCharacterText: itemCharacterText(billsSrc)
+                itemCharacterText: featureAndContentText(features, contents),
+                itemCharacter: itemCharacter,
+                jobContent: jobContent
             };
             //投标和控制价,需要导入最高限价
             if ([FileKind.tender ,FileKind.control].includes(importFileKind)) {
@@ -387,34 +392,66 @@ const ImportXML = (() => {
                 obj.rations = extractRation(billsSrc);
             }
             return obj;
-            //特征及内容文本(默认显示在项目特征列)
-            function itemCharacterText(fxSrc) {
+            // 获取特征及内容源数据
+            function getFeaturesAndContents(billsSrc) {
+                let features = arrayValue(billsSrc, ['项目特征', '特征']).map(fSrc => {
+                    return {
+                        name: getValue(fSrc, ['_特征名称']),
+                        eigenvalue: getValue(fSrc, ['_特征描述'])
+                    };
+                });
+                let contents = arrayValue(billsSrc, ['工程内容', '内容']).map(cSrc => {
+                    return {
+                        name: getValue(cSrc, ['_内容'])
+                    }
+                });
+                return {features, contents};
+            }
+            // 特征及内容窗口
+            function featureAndContent(features, contents) {
+                // 项目特征
+                let itemCharacter = features.map((feature, idx) => {
+                    let obj = {
+                        character: feature.name,
+                        isChecked: true,
+                        serialNo: idx + 1,
+                        eigenvalue: []
+                    };
+                    if (feature.eigenvalue) {
+                        obj.eigenvalue.push({value: feature.eigenvalue, isSelected: true});
+                    }
+                    return obj;
+                });
+                // 工作内容
+                let jobContent = contents.map((content, idx) => {
+                    return {
+                        content: content.name,
+                        serialNo: idx + 1,
+                        isChecked: true
+                    };
+                });
+                return {itemCharacter, jobContent};
+            }
+            // 特征及内容文本(默认显示在项目特征列)
+            function featureAndContentText(features, contents) {
                 let textArr = [];
-                //项目特征
-                let itemCharacter = getValue(fxSrc, ['项目特征']);
-                if (itemCharacter) {
+                // 项目特征
+                if (features.length) {
                     textArr.push('[项目特征]');
-                    let features = arrayValue(itemCharacter, ['特征']);
                     textArr.push(...features.map(feature => {
-                        let fName = getValue(feature, ['_特征名称']),
-                            fDesr = getValue(feature, ['_特征描述']);
                         //若不存在特征描述,同时特征名称中含有“:”,则直接返回特征名称 (广联达招标文件中,特征名称包含了特征名:值)
-                        if (!fDesr && /[\:,:]/.test(fName)) {
-                            return fName;
+                        if (!feature.eigenvalue && /[\:,:]/.test(feature.name)) {
+                            return feature.name;
                         } else {
-                            return `${fName}: ${fDesr}`;
+                            return `${feature.name}: ${feature.eigenvalue}`;
                         }
                     }));
                 }
-                //工作内容
+                // 工作内容
                 if (textArr.length) {
                     textArr.push('[工作内容]');
                 }
-                let jobContent = getValue(fxSrc, ['工程内容']);
-                if (jobContent) {
-                    let jobs = arrayValue(jobContent, ['内容']);
-                    textArr.push(...jobs.map(job => getValue(job, ['_内容'])));
-                }
+                textArr.push(...contents.map(content => content.name));
                 return textArr.join('\n');
             }
         }
@@ -431,6 +468,7 @@ const ImportXML = (() => {
                     unit: getValue(rationSrc, ['_单位']),
                     libCode: getValue(rationSrc, ['_定额库编码']),
                     quantity: getValue(rationSrc, ['_工程量']) || '0',
+                    quantityEXP: getValue(rationSrc, ['_工程量计算式']),
                     adjustState: getValue(rationSrc, ['_子目类型']) == '2' ? '1' : '',  //子目类型2为换算定额,标记一下我们软件才能显示
                     isSubcontract: getValue(rationSrc, ['_分包标志']) === 'false' ? false : true,
                     remark: getValue(rationSrc, ['_备注']),
@@ -1455,7 +1493,7 @@ const ImportXML = (() => {
                 //获取含有定额数据的清单
                 handleRation(billsData);
             }
-            //处理清单 设置必要数据 设置无用属性
+            //处理清单 设置必要数据 删除无用属性
             billsData.forEach(bills => {
                 //处理综合单价
                 //1.没有子清单,且没有综合单价,则综合单价=综合合价/工程量
@@ -1508,7 +1546,7 @@ const ImportXML = (() => {
                             ration.contain = scMathUtil.roundForObj(ration.quantity / bills.quantity, 6);
                         }
                         //工程量表达式:工程量 * 单位前的量
-                        if (!ration.unit) {
+                        /*if (!ration.unit) {
                             ration.quantityEXP = ration.quantity;
                         } else {
                             let unitNum = ration.unit.match(/^\d+/);
@@ -1517,7 +1555,7 @@ const ImportXML = (() => {
                             ration.quantityEXP = unitNum
                                 ? scMathUtil.roundForObj(ration.quantity * unitNum[0], qDecimal ? qDecimal[0] - 1 : 0)
                                 : ration.quantity;
-                        }
+                        }*/
                         //处理定额人材机,添加需要的数据
                         ration.rationGljs.forEach(rGLJ => {
                             let matchGLJ = projectGLJMap[rGLJ.code];

+ 6 - 4
web/building_saas/main/js/views/character_content_view.js

@@ -204,11 +204,12 @@ let contentOprObj = {
         if(args.sheet.isEditing()){
             args.sheet.endEdit(true);
         }
+        let isChecked = args.sheet.getValue(args.row, args.col);
+        // 锁定清单值不变
         if(projectObj.project.projectInfo.property.lockBills && projectObj.project.withinBillsLocked(projectObj.project.mainTree.selected)){
-            args.sheet.setValue(args.row, args.col, 0);
+            args.sheet.setValue(args.row, args.col, !isChecked);
             return;
         }
-        let isChecked = args.sheet.getValue(args.row, args.col);
         if(me.currentCache.length > args.row){
             me.currentCache[args.row].isChecked = isChecked;
             me.save();
@@ -766,11 +767,12 @@ let characterOprObj = {
         if(args.sheet.isEditing()){
             args.sheet.endEdit(true);
         }
+        let isChecked = args.sheet.getValue(args.row, args.col);
+        // 锁定清单值不变
         if(projectObj.project.projectInfo.property.lockBills && projectObj.project.withinBillsLocked(projectObj.project.mainTree.selected)){
-            args.sheet.setValue(args.row, args.col, 0);
+            args.sheet.setValue(args.row, args.col, !isChecked);
             return;
         }
-        let isChecked = args.sheet.getValue(args.row, args.col);
         if(me.currentCache.length > args.row){
             me.currentCache[args.row].isChecked = isChecked;
             me.save();