瀏覽代碼

feat: 导入投标09表,应导入综合单价,综合合价=工程量*综合单价;有综合单价时,清单下不自动生成定额空行

vian 3 年之前
父節點
當前提交
4ac74a83a6

+ 1 - 1
modules/main/controllers/bills_controller.js

@@ -334,7 +334,7 @@ async function importSheet(position, excelBills, removeData, projectID, stdData)
         // 如果导入招标、控制价文件、每个分项底下自动生成一条空定额
         // 如果导入招标、控制价文件、每个分项底下自动生成一条空定额
         const rations = [];
         const rations = [];
         excelBills.forEach(bills => {
         excelBills.forEach(bills => {
-            if (bills.type === billType.FX) {
+            if (bills.type === billType.FX && !bills.lockUnitPrice) {
                 const emptyRation = {
                 const emptyRation = {
                     projectID: bills.projectID,
                     projectID: bills.projectID,
                     ID: uuidV1(),
                     ID: uuidV1(),

+ 21 - 0
web/building_saas/main/js/views/importBills.js

@@ -36,6 +36,7 @@ const importBills = (function(){
         unit: ['单位', '计量单位'],
         unit: ['单位', '计量单位'],
         quantity: ['工程量', '项目工程量'],
         quantity: ['工程量', '项目工程量'],
         money: ['金额'],
         money: ['金额'],
+        unitPrice: ['综合单价', '单价'],
         quantityDetail: ['工程量明细'],
         quantityDetail: ['工程量明细'],
         feeDetail: ['费用明细'],
         feeDetail: ['费用明细'],
         summation: ['合计', '本页小计'],
         summation: ['合计', '本页小计'],
@@ -184,6 +185,8 @@ const importBills = (function(){
             //金额
             //金额
             else if(colMapping.money === undefined && _deESC(cellData).includes(colText.money[0])){
             else if(colMapping.money === undefined && _deESC(cellData).includes(colText.money[0])){
                 colMapping.money = colIdx;
                 colMapping.money = colIdx;
+                // 特殊处理单价
+                colMapping.unitPrice = colIdx;
             }
             }
             //工程量明细
             //工程量明细
             else if(colMapping.quantityDetail === undefined && _deESC(cellData) === colText.quantityDetail[0]){
             else if(colMapping.quantityDetail === undefined && _deESC(cellData) === colText.quantityDetail[0]){
@@ -402,6 +405,7 @@ const importBills = (function(){
                         ? '\n' + _deNR(rData[colMapping.itemCharacterText]['value']) : '';
                         ? '\n' + _deNR(rData[colMapping.itemCharacterText]['value']) : '';
                     preBill.unit += rData[colMapping.unit] && rData[colMapping.unit]['value'] && _isDef(_deESC(rData[colMapping.unit]['value'])) ? rData[colMapping.unit]['value'] : '';
                     preBill.unit += rData[colMapping.unit] && rData[colMapping.unit]['value'] && _isDef(_deESC(rData[colMapping.unit]['value'])) ? rData[colMapping.unit]['value'] : '';
                     preBill.quantity += rData[colMapping.quantity] && rData[colMapping.quantity]['value'] && _isDef(_deESC(rData[colMapping.quantity]['value'])) ? rData[colMapping.quantity]['value'] : '';
                     preBill.quantity += rData[colMapping.quantity] && rData[colMapping.quantity]['value'] && _isDef(_deESC(rData[colMapping.quantity]['value'])) ? rData[colMapping.quantity]['value'] : '';
+                    preBill.unitPrice += rData[colMapping.unitPrice] && rData[colMapping.unitPrice]['value'] && _isDef(_deESC(rData[colMapping.unitPrice]['value'])) ? rData[colMapping.unitPrice]['value'] : '';
                 }
                 }
             } else {
             } else {
                 let newID = uuid.v1();
                 let newID = uuid.v1();
@@ -435,6 +439,7 @@ const importBills = (function(){
                     unit: rData[colMapping.unit] && rData[colMapping.unit]['value'] ? _deESC(rData[colMapping.unit]['value']) : '',
                     unit: rData[colMapping.unit] && rData[colMapping.unit]['value'] ? _deESC(rData[colMapping.unit]['value']) : '',
                     quantity: rData[colMapping.quantity] && rData[colMapping.quantity]['value'] ? _deESC(rData[colMapping.quantity]['value']) : '',
                     quantity: rData[colMapping.quantity] && rData[colMapping.quantity]['value'] ? _deESC(rData[colMapping.quantity]['value']) : '',
                     quantityEXP: rData[colMapping.quantity] && rData[colMapping.quantity]['value'] ? _deESC(rData[colMapping.quantity]['value']) : '',
                     quantityEXP: rData[colMapping.quantity] && rData[colMapping.quantity]['value'] ? _deESC(rData[colMapping.quantity]['value']) : '',
+                    unitPrice: rData[colMapping.unitPrice] && rData[colMapping.unitPrice]['value'] ? _deESC(rData[colMapping.unitPrice]['value']) : '',
                     //安全文明
                     //安全文明
                     flags: flag === fixedFlag.CONSTRUCTION_ORGANIZATION && (rData[colMapping.name] && (rData[colMapping.name]['value'] === '安全文明施工专项费用' || rData[colMapping.name]['value'] === '安全文明施工费')) ?
                     flags: flag === fixedFlag.CONSTRUCTION_ORGANIZATION && (rData[colMapping.name] && (rData[colMapping.name]['value'] === '安全文明施工专项费用' || rData[colMapping.name]['value'] === '安全文明施工费')) ?
                         [{fieldName: 'fixed', flag: fixedFlag.SAFETY_CONSTRUCTION}] : [],
                         [{fieldName: 'fixed', flag: fixedFlag.SAFETY_CONSTRUCTION}] : [],
@@ -458,6 +463,22 @@ const importBills = (function(){
             preData = rData;
             preData = rData;
         }
         }
         for(let i in billIdx){
         for(let i in billIdx){
+            if (!commonUtil.isEmptyVal(billIdx[i].unitPrice)) {
+                billIdx[i].lockUnitPrice = true;
+                const quantity = +billIdx[i].quantity || 0;
+                const unitPrice = +billIdx[i].unitPrice;
+                const totalPrice = scMathUtil.roundForObj(unitPrice * quantity, decimalObj.bills.totalPrice);
+                billIdx[i].fees = [
+                    {
+                        fieldName: "common",
+                        tenderTotalFee: totalPrice,
+                        tenderUnitFee: unitPrice,
+                        totalFee: totalPrice,
+                        unitFee: unitPrice,
+                    }
+                ];
+                delete billIdx[i].unitPrice;
+            }
             rst.push(billIdx[i]);
             rst.push(billIdx[i]);
         }
         }
         return rst;
         return rst;

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

@@ -3197,6 +3197,7 @@ $('#importConfirm').click(function () {
                 remove: importBills.getRemoveIDs(position, importBillsData[position]),
                 remove: importBills.getRemoveIDs(position, importBillsData[position]),
             }
             }
         })
         })
+        console.log(postData);
         let compressData = LZString.compressToUTF16(JSON.stringify(postData));
         let compressData = LZString.compressToUTF16(JSON.stringify(postData));
         formData.append('compressData', compressData);
         formData.append('compressData', compressData);
         let eDate = +new Date();
         let eDate = +new Date();
@@ -3323,6 +3324,10 @@ function doAfterImportPosition(positionData){
             node.source = projectObj.project.Bills.tree.nodes['id_' + node.getID()];
             node.source = projectObj.project.Bills.tree.nodes['id_' + node.getID()];
             node.data = node.source.data;
             node.data = node.source.data;
             node.sourceType = projectObj.project.Bills.getSourceType();
             node.sourceType = projectObj.project.Bills.getSourceType();
+            node.data.feesIndex = {};
+            for (let fee of node.data.fees) {
+                node.data.feesIndex[fee.fieldName] = fee;
+            }
         }
         }
         ProjectController.syncDisplayNewNodes(projectObj.mainController, newNodes);
         ProjectController.syncDisplayNewNodes(projectObj.mainController, newNodes);
     }
     }