Forráskód Böngészése

Merge branch 'master' of http://192.168.1.41:3000/SmartCost/YangHuCost

Tony Kang 1 éve
szülő
commit
6a0ad9beab

+ 1 - 1
modules/all_models/projects.js

@@ -17,7 +17,7 @@ const shareSchema = new Schema({
 const ProjectSchema = new Schema({
     "ID": { type: Number, index: true },
     "GUID": String, // 接口需要
-    "ParentID": Number,
+    "ParentID": { type: Number, index: true },
     "NextSiblingID": Number,
     "userID": String,
     "importedByInterface": { type: Boolean, default: false },

+ 118 - 117
modules/main/controllers/bills_controller.js

@@ -15,15 +15,15 @@ let stdBillCharacterModel = mongoose.model('std_bills_lib_itemCharacter');
 const { fixedFlag } = require('../../../public/common_constants');
 let LZString = require('lz-string');
 const uuidV1 = require('uuid/v1');
-const billType ={
-    DXFY:1,//大项费用
-    FB:2,//分部
-    FX:3,//分项
-    BILL:4,//清单
-    BX:5//补项
+const billType = {
+    DXFY: 1,//大项费用
+    FB: 2,//分部
+    FX: 3,//分项
+    BILL: 4,//清单
+    BX: 5//补项
 };
 //上传的09表、广联达表
-const uploadType = {lj: 'lj', gld: 'gld'};
+const uploadType = { lj: 'lj', gld: 'gld' };
 // 上传控件
 const multiparty = require("multiparty");
 const fs = require("fs");
@@ -31,14 +31,14 @@ const fs = require("fs");
 const excel = require("node-xlsx");
 const urlencode = require('urlencode');
 //统一回调函数
-var callback = function(req, res, err, message, data){
-    res.json({error: err, message: message, data: data});
+var callback = function (req, res, err, message, data) {
+    res.json({ error: err, message: message, data: data });
 };
 
 module.exports = {
-    getData: function(req, res){
+    getData: function (req, res) {
         var data = JSON.parse(req.body.data);
-        billsData.getData(data.projectId, function(err, message, billsList){
+        billsData.getData(data.projectId, function (err, message, billsList) {
             if (err === 0) {
                 callback(req, res, err, message, billsList);
             } else {
@@ -47,9 +47,9 @@ module.exports = {
         });
     },
 
-    getItemTemplate: function(req, res){
+    getItemTemplate: function (req, res) {
         //var data = JSON.parse(req.body.data);
-        billsData.getItemTemplate(function(err, message, billsItem){
+        billsData.getItemTemplate(function (err, message, billsItem) {
             if (billsItem) {
                 callback(req, res, err, message, billsItem);
             } else {
@@ -58,8 +58,8 @@ module.exports = {
         });
     },
 
-    allocIDs: function(req, res){
-        billsData.allocIDs(function(err, message, data){
+    allocIDs: function (req, res) {
+        billsData.allocIDs(function (err, message, data) {
             if (err) {
                 callback(req, res, err, message, data);
             } else {
@@ -78,16 +78,16 @@ module.exports = {
         });
     },
     updateBills: async function (req, res) {
-        try{
+        try {
             let data = JSON.parse(req.body.data);
             await billsData.updateBills(data.updateDatas);
             callback(req, res, 0, 'success', null);
         }
-        catch (err){
+        catch (err) {
             callback(req, res, 1, err, null);
         }
     },
-    updateBill: async function(request, response) {
+    updateBill: async function (request, response) {
         const data = JSON.parse(request.body.data);
         const findSet = data.findSet;
         const updateData = data.updateData;
@@ -111,90 +111,90 @@ module.exports = {
         const err = !result ? 1 : 0;
         callback(request, response, err, message, null);
     },
-    singleDelete:async function(req, res){
-        let result={
-            error:0
+    singleDelete: async function (req, res) {
+        let result = {
+            error: 0
         }
         try {
             let data = req.body.data;
             data = JSON.parse(data);
             let tasks = generateSingleDeleteTasks(data);
-            let resultData= await billsData.model.bulkWrite(tasks);
+            let resultData = await billsData.model.bulkWrite(tasks);
             //删除工程量明细
-            await quantity_detail.deleteByQuery({projectID: data.projectID, billID: data.ID}) ;
-            result.data=resultData;
-        }catch (err){
+            await quantity_detail.deleteByQuery({ projectID: data.projectID, billID: data.ID });
+            result.data = resultData;
+        } catch (err) {
             logger.err(err);
-            result.error=1;
+            result.error = 1;
             result.message = err.message;
         }
         res.json(result);
     },
-    multiDelete:async function(req, res){
-        let result={
-            error:0
+    multiDelete: async function (req, res) {
+        let result = {
+            error: 0
         };
         try {
             let data = req.body.data;
             data = JSON.parse(data);
-            result.data=await doBillsOrRationsDelete(data);
-        }catch (err){
+            result.data = await doBillsOrRationsDelete(data);
+        } catch (err) {
             logger.err(err);
-            result.error=1;
+            result.error = 1;
             result.message = err.message;
         }
         res.json(result);
     },
-    getSectionInfo:async function(req, res){
-        let result={
-            error:0
+    getSectionInfo: async function (req, res) {
+        let result = {
+            error: 0
         }
         try {
             let data = req.body.data;
             data = JSON.parse(data);
-            let sectionInfo= await bill_facade.getSectionInfo(data);
-            result.data=sectionInfo;
-        }catch (err){
+            let sectionInfo = await bill_facade.getSectionInfo(data);
+            result.data = sectionInfo;
+        } catch (err) {
             logger.err(err);
-            result.error=1;
+            result.error = 1;
             result.message = err.message;
         }
         res.json(result);
     },
-    reorganizeFBFX:async function(req,res){
-        let result={
-            error:0
+    reorganizeFBFX: async function (req, res) {
+        let result = {
+            error: 0
         }
         try {
             let data = req.body.data;
             data = JSON.parse(data);
-            let reorganizeResult= await bill_facade.reorganizeFBFX(data);
-            result.data=reorganizeResult;
-        }catch (err){
+            let reorganizeResult = await bill_facade.reorganizeFBFX(data);
+            result.data = reorganizeResult;
+        } catch (err) {
             logger.err(err);
-            result.error=1;
+            result.error = 1;
             result.message = err.message;
         }
         res.json(result);
     },
-    pasteBlock:async function(req,res){
-        let result={
-            error:0
+    pasteBlock: async function (req, res) {
+        let result = {
+            error: 0
         };
         try {
             let data = req.body.data;
             data = JSON.parse(data);
-            let pasteResult = await bill_facade.pasteBlock(data,req.session.sessionCompilation);
+            let pasteResult = await bill_facade.pasteBlock(data, req.session.sessionCompilation);
             result.data = pasteResult;
-        }catch (err){
+        } catch (err) {
             logger.err(err);
-            result.error=1;
+            result.error = 1;
             result.message = err.message;
         }
         res.json(result);
     },
     //下载导入清单示例
-    downloadExample: async function(request, response) {
+    downloadExample: async function (request, response) {
         try {
             const filePath = './public/static/清单示例.xlsx';
             const stats = fs.statSync(filePath);
@@ -213,15 +213,15 @@ module.exports = {
 
     },
     //导入清单
-    import: async function(req, res){
+    import: async function (req, res) {
         let responseData = {
             err: 0,
             msg: '',
             data: []
         };
         const form = new multiparty.Form();
-        form.parse(req, async function(err, fields, files) {
-            try{
+        form.parse(req, async function (err, fields, files) {
+            try {
                 const projectID = fields.projectID !== undefined && fields.projectID.length > 0 ?
                     parseInt(fields.projectID[0]) : 0;
                 if (projectID <= 0) {
@@ -230,21 +230,21 @@ module.exports = {
                 //导入清单数据
                 let compressData = fields.compressData !== undefined && fields.compressData.length > 0 ?
                     fields.compressData[0] : null;
-                if(compressData === null){
+                if (compressData === null) {
                     throw 'excel没有对应数据'
                 }
-                let importData = JSON.parse(LZString.decompressFromUTF16(compressData));
+                let { insertData, removeData } = JSON.parse(LZString.decompressFromUTF16(compressData));
                 //导入表
                 let importDateA = +new Date();
-                let updateFrontData = await importSheet(importData, req.session.sessionUser.id, projectID);
-                if(updateFrontData){
+                let updateFrontData = await importSheet(insertData, removeData, req.session.sessionUser.id, projectID);
+                if (updateFrontData) {
                     responseData.data.push(updateFrontData);
                 }
                 let importDateB = +new Date();
                 console.log(`导入时间: ${importDateB - importDateA}=========================================================================`);
                 res.json(responseData);
             }
-            catch (error){
+            catch (error) {
                 responseData.err = 1;
                 console.log(error);
                 responseData.msg = typeof error === 'object' ? '上传失败' : error;
@@ -264,77 +264,78 @@ module.exports = {
     }
 };
 
-async function importSheet(excelBills, userID, projectID,){
+async function importSheet(excelBills, removeData, userID, projectID,) {
     //导入位置的有固定行
     let flag = fixedFlag.ONE_SEVEN_BILLS;   //第100章至700章清单
-    let fixedBill = await billsData.model.findOne({projectID: projectID, 'flags.flag': flag, deleteInfo: null});
+    let fixedBill = await billsData.model.findOne({ projectID: projectID, 'flags.flag': flag, deleteInfo: null });
     //删除相关数据
-    let deleteDatas = await billsData.deepDeleteBill([fixedBill], userID, projectID);
+    // let deleteDatas = await billsData.deepDeleteBill([fixedBill], userID, projectID);
+    let deleteDatas = await billsData.newDeepDeleteBill(removeData.rBillIDs, removeData.rRationIDs);
     //新增清单数据
     await billsData.importBills(excelBills);
     //返回数据以更新前端
-    return {fixedBill: fixedBill, insert: {bill: excelBills, ration: []}, remove: {bill: deleteDatas.bill, ration: deleteDatas.ration}};
+    return { fixedBill: fixedBill, insert: { bill: excelBills, ration: [] }, remove: { bill: deleteDatas.bill, ration: deleteDatas.ration } };
 }
 
 
-function getImportFlag(position){
-    const fixedItem = {'fbfx': fixedFlag.SUB_ENGINERRING, 'jscsxm': fixedFlag.CONSTRUCTION_TECH, 'zzcsxm': fixedFlag.CONSTRUCTION_ORGANIZATION};
+function getImportFlag(position) {
+    const fixedItem = { 'fbfx': fixedFlag.SUB_ENGINERRING, 'jscsxm': fixedFlag.CONSTRUCTION_TECH, 'zzcsxm': fixedFlag.CONSTRUCTION_ORGANIZATION };
     return fixedItem[position] ? fixedItem[position] : null;
 }
-function isDef(data){
+function isDef(data) {
     return typeof data !== 'undefined' && data !== null && data !== '';
 }
 
 async function doBillsOrRationsDelete(data) {
     let billTask = [];
     let deleteBillIDs = [];
-    let rationTask=[];
-    let deleteRationIDs=[];
-    let qd_query=null;
-    let sub_query=null;
-    if(data['bills']){
-        billTask = generateUpdateTasks(data['bills'],data.projectID,data.user_id);
-        for(let b_key in data['bills']){
-            if(data['bills'][b_key]===true){
-                deleteBillIDs.push(b_key+'');
+    let rationTask = [];
+    let deleteRationIDs = [];
+    let qd_query = null;
+    let sub_query = null;
+    if (data['bills']) {
+        billTask = generateUpdateTasks(data['bills'], data.projectID, data.user_id);
+        for (let b_key in data['bills']) {
+            if (data['bills'][b_key] === true) {
+                deleteBillIDs.push(b_key + '');
             }
         }
-        if(deleteBillIDs.length>0){
-            qd_query={projectID: data.projectID, billID: {"$in": deleteBillIDs}};
+        if (deleteBillIDs.length > 0) {
+            qd_query = { projectID: data.projectID, billID: { "$in": deleteBillIDs } };
         }
     }
-    if(data['ration']){
-        rationTask = generateUpdateTasks(data['ration'],data.projectID,data.user_id);
-        for(let r_key in data['ration']){
-            if(data['ration'][r_key]===true){
-                deleteRationIDs.push(r_key+'');
+    if (data['ration']) {
+        rationTask = generateUpdateTasks(data['ration'], data.projectID, data.user_id);
+        for (let r_key in data['ration']) {
+            if (data['ration'][r_key] === true) {
+                deleteRationIDs.push(r_key + '');
             }
         }
-        if(deleteRationIDs.length>0){
-            if(qd_query==null){//说明没删除清单
-                qd_query={projectID: data.projectID, rationID: {"$in": deleteRationIDs}};
-            }else {
-                qd_query={
-                    "$or":[
-                        {projectID: data.projectID, billID: {"$in": deleteBillIDs}},
-                        {projectID: data.projectID, rationID: {"$in": deleteRationIDs}}
+        if (deleteRationIDs.length > 0) {
+            if (qd_query == null) {//说明没删除清单
+                qd_query = { projectID: data.projectID, rationID: { "$in": deleteRationIDs } };
+            } else {
+                qd_query = {
+                    "$or": [
+                        { projectID: data.projectID, billID: { "$in": deleteBillIDs } },
+                        { projectID: data.projectID, rationID: { "$in": deleteRationIDs } }
                     ]
                 }
             }
-            sub_query={projectID: data.projectID, rationID: {"$in": deleteRationIDs}};
+            sub_query = { projectID: data.projectID, rationID: { "$in": deleteRationIDs } };
         }
     }
     //先删除工程量明细
-    if(qd_query!=null){
-        await quantity_detail.deleteByQuery(qd_query) ;
+    if (qd_query != null) {
+        await quantity_detail.deleteByQuery(qd_query);
     }
-    if(sub_query!=null){
+    if (sub_query != null) {
         await raiton_facade.deleteSubListByQuery(sub_query);
     }
-    if(rationTask.length>0){
+    if (rationTask.length > 0) {
         await ration_model.model.bulkWrite(rationTask);//删除定额
     }
-    if(billTask.length>0){
+    if (billTask.length > 0) {
         await billsData.model.bulkWrite(billTask);//删除清单
     }
     return 'success';
@@ -342,41 +343,41 @@ async function doBillsOrRationsDelete(data) {
 
 
 
-function  generateSingleDeleteTasks(data) {
+function generateSingleDeleteTasks(data) {
     let updateData = data.updateData;
-    updateData[data.ID]=true;
-    let tasks = generateUpdateTasks(updateData,data.projectID,data.user_id);
+    updateData[data.ID] = true;
+    let tasks = generateUpdateTasks(updateData, data.projectID, data.user_id);
     return tasks;
 }
 
-function  generateUpdateTasks(data,projectID,user_id) {
-    let tasks=[];
+function generateUpdateTasks(data, projectID, user_id) {
+    let tasks = [];
     let updateData = data;
-    let deleteInfo={deleted: true, deleteDateTime: new Date(), deleteBy: user_id};
-    for(let key in updateData){
-        let task={
-            updateOne:{
-                filter:{
-                    ID:key,
-                    projectID:projectID
+    let deleteInfo = { deleted: true, deleteDateTime: new Date(), deleteBy: user_id };
+    for (let key in updateData) {
+        let task = {
+            updateOne: {
+                filter: {
+                    ID: key,
+                    projectID: projectID
                 }
             }
         };
-        if(updateData[key]===true){
+        if (updateData[key] === true) {
             //原先是假删除,现在改成真删除
             task = {
-                deleteOne:{
-                    filter:{
-                        ID:key,
-                        projectID:projectID
+                deleteOne: {
+                    filter: {
+                        ID: key,
+                        projectID: projectID
                     }
                 }
             }
             /* task.updateOne.update={
              deleteInfo:deleteInfo
              };*/
-        }else {
-            task.updateOne.update=updateData[key];
+        } else {
+            task.updateOne.update = updateData[key];
         }
         tasks.push(task);
     }

A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 403 - 229
modules/main/facade/project_facade.js


+ 93 - 69
modules/main/models/bills.js

@@ -19,35 +19,35 @@ const { fixedFlag } = require('../../../public/common_constants');
 let bills = mongoose.model("bills");
 let baseModel = require('./base_model');
 const uuidV1 = require('uuid/v1');
-const billType ={
-    DXFY:1,//大项费用
-    FB:2,//分部
-    FX:3,//分项
-    BILL:4,//清单
-    BX:5//补项
+const billType = {
+    DXFY: 1,//大项费用
+    FB: 2,//分部
+    FX: 3,//分项
+    BILL: 4,//清单
+    BX: 5//补项
 };
 
 class billsModel extends baseModel {
-    constructor () {
+    constructor() {
         super(bills);
     };
 
-    getData (projectID, callback, isReport = false) {
+    getData(projectID, callback, isReport = false) {
         //已经改成真删除了 {'$or': [{projectID: projectID, deleteInfo: null}, {projectID: projectID, 'deleteInfo.deleted': {$in: [null, false]}}]}
-        this.model.find({projectID: projectID}, '-_id', function(err, datas){
+        this.model.find({ projectID: projectID }, '-_id', function (err, datas) {
             if (!err) {
-                if (isReport){   // 调价中间件机制
+                if (isReport) {   // 调价中间件机制
                     for (let i = 0; i < datas.length; i++) {
-                       let fees = datas[i]._doc.fees;
-                       if (fees){
-                           for (let i = 0; i < fees.length; i++) {
-                               let doc = fees[i]._doc;
-                               if (doc){
-                                   if (doc.tenderTotalFee) doc.totalFee = doc.tenderTotalFee;
-                                   if (doc.tenderUnitFee) doc.unitFee = doc.tenderUnitFee;
-                               }
-                           }
-                       }
+                        let fees = datas[i]._doc.fees;
+                        if (fees) {
+                            for (let i = 0; i < fees.length; i++) {
+                                let doc = fees[i]._doc;
+                                if (doc) {
+                                    if (doc.tenderTotalFee) doc.totalFee = doc.tenderTotalFee;
+                                    if (doc.tenderUnitFee) doc.unitFee = doc.tenderUnitFee;
+                                }
+                            }
+                        }
                     }
                 };
                 callback(0, projectConsts.BILLS, datas);
@@ -57,7 +57,7 @@ class billsModel extends baseModel {
         });
     };
 
-    save (user_id, datas, callback) {
+    save(user_id, datas, callback) {
         let functions = [];
         let data;
 
@@ -67,17 +67,17 @@ class billsModel extends baseModel {
                     case commonConsts.UT_UPDATE:
                         async.parallel([      // CSL,2018.01.10 如果是总造价清单,要将4个汇总金额写到projects表中
                             function (asyncCB) {
-                                bills.update({projectID: doc.updateData.projectID, ID: doc.updateData.ID,deleteInfo: null}, doc.updateData, asyncCB);
+                                bills.update({ projectID: doc.updateData.projectID, ID: doc.updateData.ID, deleteInfo: null }, doc.updateData, asyncCB);
                             },
                             function (asyncCB) {
-                                if (doc.updateData.summaryFees){
+                                if (doc.updateData.summaryFees) {
                                     // console.log('%%%%%%%%%%%%%%%%%%%  ' + doc.updateData.projectID + ' | ' + JSON.stringify(doc.updateData.summaryFees));
-                                    projectModel.update({ID: doc.updateData.projectID}, {"summaryFees": doc.updateData.summaryFees}, asyncCB);
-                                }else {
+                                    projectModel.update({ ID: doc.updateData.projectID }, { "summaryFees": doc.updateData.summaryFees }, asyncCB);
+                                } else {
                                     asyncCB(null, {});
                                 };
                             }
-                        ], function(err,result){
+                        ], function (err, result) {
                             cb(err, {});
                         });
                         break;
@@ -85,59 +85,59 @@ class billsModel extends baseModel {
                         bills.create(doc.updateData, cb);
                         break;
                     case commonConsts.UT_DELETE:
-                        doc.updateData.deleteInfo = {deleted: true, deleteDateTime: new Date(), deleteBy: user_id};
-                       //bills.update({projectID: doc.updateData.projectID, ID: doc.updateData.ID}, doc.updateData, cb);
-                        bills.deleteOne({projectID: doc.updateData.projectID, ID: doc.updateData.ID},cb);
+                        doc.updateData.deleteInfo = { deleted: true, deleteDateTime: new Date(), deleteBy: user_id };
+                        //bills.update({projectID: doc.updateData.projectID, ID: doc.updateData.ID}, doc.updateData, cb);
+                        bills.deleteOne({ projectID: doc.updateData.projectID, ID: doc.updateData.ID }, cb);
                         break;
                 }
             }
         }
-        for (let i = 0; i < datas.length; i++){
+        for (let i = 0; i < datas.length; i++) {
             data = datas[i];
             functions.push(saveOne(data));
-            quantity_detial.quantityEditChecking(data,'bills',functions);
+            quantity_detial.quantityEditChecking(data, 'bills', functions);
         }
-        async.parallel(functions, function(err,result){
+        async.parallel(functions, function (err, result) {
             let returnData = {
-                moduleName:'bills',
-                data:result
+                moduleName: 'bills',
+                data: result
             };
             callback(err, returnData);
         });
     };
 
-    getItemTemplate (callback) {
+    getItemTemplate(callback) {
         let data = new bills;
         /* to do: 需要根据标准配置库填充fees和flags字段,是否需要更多的参数? */
         callback(0, '', data);
     };
 
-    allocIDs (IDStep, callback) {
-        counter.counterDAO.getIDAfterCount(counter.moduleName.bills, IDStep, function(err, highID){
+    allocIDs(IDStep, callback) {
+        counter.counterDAO.getIDAfterCount(counter.moduleName.bills, IDStep, function (err, highID) {
             let lowID = highID - IDStep + 1;
-            callback(0, '', {lowID: lowID, highID: highID});
+            callback(0, '', { lowID: lowID, highID: highID });
         });
     };
     //zhong 2017-9-1
     updateCharacterContent(findSet, updateObj, txtObj, callback) {
         let updateSet = {};
         updateSet[updateObj.field] = updateObj.updateArr;
-        if(txtObj && typeof txtObj !== 'undefined'){
+        if (txtObj && typeof txtObj !== 'undefined') {
             updateSet[txtObj.field] = txtObj.text;
         }
-       bills.update(findSet, updateSet, function (err) {
-           if(err){
-               callback(1, '更新失败');
-           }
-           else{
-               callback(0, '更新成功');
-           }
-       });
+        bills.update(findSet, updateSet, function (err) {
+            if (err) {
+                callback(1, '更新失败');
+            }
+            else {
+                callback(0, '更新成功');
+            }
+        });
     };
-    async updateBills(updateDatas){
+    async updateBills(updateDatas) {
         let bulk = [];
-        for(let updateData of updateDatas){
-            bulk.push({updateOne: {filter: updateData.findSet, update: {$set: updateData.updateData}}});
+        for (let updateData of updateDatas) {
+            bulk.push({ updateOne: { filter: updateData.findSet, update: { $set: updateData.updateData } } });
         }
         await bills.bulkWrite(bulk);
     };
@@ -160,21 +160,21 @@ class billsModel extends baseModel {
 
         return bills.update(findSet, update);
     };
-    async importBills(bills){
+    async importBills(bills) {
         let operations = [];
-        for(let bill of bills){
-            operations.push({insertOne: {document: bill}});
+        for (let bill of bills) {
+            operations.push({ insertOne: { document: bill } });
         }
         return await this.model.bulkWrite(operations);
     }
     //删除清单节点的所有子节点及其他附带数据
-    async deepDeleteBill(bills, userID, projectID){
+    async deepDeleteBill(bills, userID, projectID) {
         let bill_ids = [],
             ration_ids = [];
         let me = this;
-        function getIDs(datas){
+        function getIDs(datas) {
             let ids = [];
-            for(let data of datas){
+            for (let data of datas) {
                 ids.push(data.ID);
             }
             return ids;
@@ -191,13 +191,13 @@ class billsModel extends baseModel {
         await findBillsChildren(bills);
         /*/
         // 优化:一次性获取所有清单,再一个个剔除,剩下bills下所有的子清单,省的递归查询
-        const allBills = await me.model.find({projectID: projectID}, '-_id');
+        const allBills = await me.model.find({ projectID: projectID }, '-_id');
         function getAllSubIDs(topDatas) {
             bill_ids = bill_ids.concat(getIDs(topDatas));
             function _getSubs(datas, rstBills) {
                 let subIDs = []
                 for (let bill of allBills) {
-                    for(let data of datas){
+                    for (let data of datas) {
                         if (data.ID === bill.ParentID) {
                             subIDs.push(bill.ID);
                             rstBills.push(bill);
@@ -221,27 +221,51 @@ class billsModel extends baseModel {
         //剔除第一个节点
         bill_ids = bill_ids.slice(1);
         //获取删除清单下的所有定额
-        let rations = await rationModel.find({billsItemID: {$in: bill_ids}, deleteInfo: null}, 'ID');
+        let rations = await rationModel.find({ billsItemID: { $in: bill_ids }, deleteInfo: null }, 'ID');
         ration_ids = ration_ids.concat(getIDs(rations));
         //deep delete datas
-        let deleteInfo = {deleted: true, deleteDateTime: new Date(), deleteBy: userID};
-        if(bill_ids.length > 0){
+        let deleteInfo = { deleted: true, deleteDateTime: new Date(), deleteBy: userID };
+        if (bill_ids.length > 0) {
+            //删除bills
+            await me.model.deleteMany({ ID: { $in: bill_ids } });
+            //删除bill-quantity_detail
+            await quantityDelModel.deleteMany({ billID: { $in: bill_ids } });
+        }
+        if (ration_ids.length > 0) {
+            //删除rations
+            await rationModel.deleteMany({ ID: { $in: ration_ids } });
+            //删除ration-glj
+            await rationGljModel.deleteMany({ rationID: { $in: ration_ids } });
+            //删除ration-coe
+            await rationCoeModel.deleteMany({ rationID: { $in: ration_ids } });
+            //删除ration-quantity_detail
+            await quantityDelModel.deleteMany({ rationID: { $in: ration_ids } });
+        }
+        return { bill: bill_ids, ration: ration_ids };
+    }
+
+    async newDeepDeleteBill(bill_ids, ration_ids) {
+        let me = this;
+        //deep delete datas
+        if (bill_ids.length > 0) {
             //删除bills
-            await me.model.deleteMany({ID: {$in: bill_ids}});
+            await me.model.deleteMany({ ID: { $in: bill_ids } });
             //删除bill-quantity_detail
-            await quantityDelModel.deleteMany({billID: {$in: bill_ids}});
+            await quantityDelModel.deleteMany({ billID: { $in: bill_ids } });
         }
-        if(ration_ids.length > 0){
+        if (ration_ids.length > 0) {
             //删除rations
-            await rationModel.deleteMany({ID: {$in: ration_ids}});
+            await rationModel.deleteMany({ ID: { $in: ration_ids } });
             //删除ration-glj
-            await rationGljModel.deleteMany({rationID: {$in: ration_ids}});
+            await rationGljModel.deleteMany({ rationID: { $in: ration_ids } });
             //删除ration-coe
-            await rationCoeModel.deleteMany({rationID: {$in: ration_ids}});
+            await rationCoeModel.deleteMany({ rationID: { $in: ration_ids } });
+            //删除ration-installation
+            await rationInstModel.deleteMany({ rationID: { $in: ration_ids } });
             //删除ration-quantity_detail
-            await quantityDelModel.deleteMany({rationID: {$in: ration_ids}});
+            await quantityDelModel.deleteMany({ rationID: { $in: ration_ids } });
         }
-        return {bill: bill_ids, ration: ration_ids};
+        return { bill: bill_ids, ration: ration_ids };
     }
 }
 

+ 44 - 44
modules/pm/controllers/pm_controller.js

@@ -79,7 +79,7 @@ module.exports = {
         });
     },
     getProjects: async function (req, res) {
-         await ProjectsData.getUserProjects(req.session.sessionUser.id, req.session.sessionCompilation._id, function(err, message, projects){
+        await ProjectsData.getUserProjects(req.session.sessionUser.id, req.session.sessionCompilation._id, function (err, message, projects) {
             if (projects) {
                 callback(req, res, err, message, projects);
             } else {
@@ -156,7 +156,7 @@ module.exports = {
                                 specialResult.newFeeLibID = engineering.tax_group[0].fee_lib.id;
                             }
                             specialResult.billLibs = engineering.bill_lib;
-                            
+
                         }
                     }
                 }
@@ -191,7 +191,7 @@ module.exports = {
         asyncTool.parallel(functions, function (err, result) {
             {
                 if (!err) {
-                    res.json({ error: 0, message: err, data: specialResult});
+                    res.json({ error: 0, message: err, data: specialResult });
                 } else {
                     res.json({ error: 1, message: err, data: null });
                 }
@@ -273,8 +273,8 @@ module.exports = {
                 projInfo.shareState = await pm_facade.getShareState(projectID, userID);
             }
             // 获取项目所属用户
-            projInfo.owner = await userModel.findOne({_id: mongoose.Types.ObjectId(project.userID)}, 'real_name mobile').lean();
-            projInfo.opener = await userModel.findOne({_id: mongoose.Types.ObjectId(userID)}, 'real_name mobile').lean();
+            projInfo.owner = await userModel.findOne({ _id: mongoose.Types.ObjectId(project.userID) }, 'real_name mobile').lean();
+            projInfo.opener = await userModel.findOne({ _id: mongoose.Types.ObjectId(userID) }, 'real_name mobile').lean();
             callback('', consts.projectConst.PROJECT_INFO, project);
         }, function (err) {
             callback(err, consts.projectConst.PROJECT_INFO, {});
@@ -303,7 +303,7 @@ module.exports = {
                 }
                 //读取建设项目的基本信息
                 let basicInfo = await ProjectsData.getBasicInfo(projectID);
-                if(basicInfo !== null){
+                if (basicInfo !== null) {
                     projInfo.property.basicInformation = basicInfo;
                 }
                 //获取单位工程完整目录结构
@@ -344,9 +344,9 @@ module.exports = {
                 compilationName: sessionCompilation.name,
                 versionName: request.session.compilationVersion,
 
-                title:getTitle(request.headers.host) 
+                title: getTitle(request.headers.host)
             };
-    
+
             response.render('building_saas/pm/html/blank-project.html', renderData);
         } else {
             let compilationModel = new CompilationModel();
@@ -356,54 +356,54 @@ module.exports = {
             sessionCompilation = request.session.sessionCompilation;
             //更新用户的使用过的费用定额列表
             let isFirst = await pm_facade.isFirst(request.session.sessionUser.id, compilationData._id.toString());
-            
+
             let engineeringLibModel = new EngineeringLibModel();
-    
+
             // 建议估算
             let suggestionValuation = sessionCompilation.suggestion_valuation !== undefined ?
                 sessionCompilation.suggestion_valuation : [];
             suggestionValuation = await engineeringLibModel.getLib(suggestionValuation);
-    
+
             // 可行性估算
             let feasibilityValuation = sessionCompilation.feasibility_valuation !== undefined ?
                 sessionCompilation.feasibility_valuation : [];
             feasibilityValuation = await engineeringLibModel.getLib(feasibilityValuation);
-    
+
             // 估算
             let estimationValuation = sessionCompilation.estimation_valuation !== undefined ?
                 sessionCompilation.estimation_valuation : [];
-                estimationValuation = await engineeringLibModel.getLib(estimationValuation);
-    
+            estimationValuation = await engineeringLibModel.getLib(estimationValuation);
+
             // 概算
             let roughValuation = sessionCompilation.rough_valuation !== undefined ?
                 sessionCompilation.rough_valuation : [];
             roughValuation = await engineeringLibModel.getLib(roughValuation);
-            
+
             // 清单计价
             let billValuation = sessionCompilation.bill_valuation !== undefined ?
                 sessionCompilation.bill_valuation : [];
             billValuation = await engineeringLibModel.getLib(billValuation);
-    
+
             // 定额计价
             let rationValuation = sessionCompilation.ration_valuation !== undefined ?
                 sessionCompilation.ration_valuation : [];
             rationValuation = await engineeringLibModel.getLib(rationValuation);
-    
+
             if (sessionCompilation.name === '四川养护(2013)' || sessionCompilation.name === '部颁2018计价标准') {
                 billValuation = rationValuation;
             }
-    
+
             let absoluteUrl = compilationData.overWriteUrl ? request.app.locals.rootDir + compilationData.overWriteUrl : request.app.locals.rootDir;
             let overWriteUrl = fs.existsSync(absoluteUrl) && fs.statSync(absoluteUrl).isFile() ? compilationData.overWriteUrl : null;
             //欢迎页显示控制
-            let [isShow,context,showTime] = await pm_facade.getWelcomeInfo(sessionCompilation._id,request.session.sessionUser,request.session.compilationVersion.includes('学习'));
+            let [isShow, context, showTime] = await pm_facade.getWelcomeInfo(sessionCompilation._id, request.session.sessionUser, request.session.compilationVersion.includes('学习'));
             const unreadShareList = await pm_facade.getUnreadShareListByCompilation(request.session.sessionUser.id, sessionCompilation._id);
             let renderData = {
                 unreadShareList: JSON.stringify(unreadShareList),
                 isFirst: isFirst,
-                isShow:isShow,
-                context:context,
-                showTime:showTime,
+                isShow: isShow,
+                context: context,
+                showTime: showTime,
                 userAccount: request.session.userAccount,
                 userID: request.session.sessionUser.id,
                 isFree,
@@ -419,12 +419,12 @@ module.exports = {
                 adminLevelType: JSON.stringify(AdminLevelType),
                 compilationName: sessionCompilation.name,
                 versionName: request.session.compilationVersion,
-                socketPort:config[process.env.NODE_ENV].socketPort?config[process.env.NODE_ENV].socketPort:5500,
-                LicenseKey:config.getLicenseKey(process.env.NODE_ENV),
+                socketPort: config[process.env.NODE_ENV].socketPort ? config[process.env.NODE_ENV].socketPort : 5500,
+                LicenseKey: config.getLicenseKey(process.env.NODE_ENV),
                 cloudTitle: config.prod_sc.title,
-                title:getTitle(request.headers.host) 
+                title: getTitle(request.headers.host)
             };
-    
+
             response.render('building_saas/pm/html/project-management.html', renderData);
         }
     },
@@ -500,7 +500,7 @@ module.exports = {
         }
     },
 
-    getGC: async function(req, res) {
+    getGC: async function (req, res) {
         const userID = req.session.sessionUser.id;
         const compilationId = req.session.sessionCompilation._id;
         try {
@@ -574,14 +574,14 @@ module.exports = {
                 for (let i = 0, len = gc_tenderFiles.length; i < len; i++) {
                     let gc_t = gc_tenderFiles[i];
                     let theProj = _projs[prefix + gc_t.ParentID] || null;
-                    if(!theProj){
+                    if (!theProj) {
                         let tempProjs = await ProjectsData.getProjectsByIds(userID, compilatoinId, [gc_t.ParentID]);
-                        if(tempProjs.length > 0 && tempProjs[0].projType === projType.project){
+                        if (tempProjs.length > 0 && tempProjs[0].projType === projType.project) {
                             theProj = _projs[prefix + gc_t.ParentID] = tempProjs[0]._doc;
                             buildProj(theProj);
                         }
                     }
-                    if(theProj) {
+                    if (theProj) {
                         theProj.children.push(gc_t);
                     }
                 }
@@ -1022,7 +1022,7 @@ module.exports = {
         };
         try {
             data.session = req.session;
-            result = await redirectToImportServer(data,"importProject",req);
+            result = await redirectToImportServer(data, "importProject", req);
         } catch (err) {
             console.log(err);
             result.error = 1;
@@ -1031,19 +1031,19 @@ module.exports = {
         res.json(result);
     },
     copyConstructionProject: async function (req, res) {
-      let data = JSON.parse(req.body.data);
-      let result = {
-          error: 0
-      };
-      try {
-          data.session = req.session;
-          result.data = await redirectToImportServer(data, "copyConstructionProject", req);
-      } catch (err) {
-          console.log(err);
-          result.error = 1;
-          result.message = err.message;
-      }
-      res.json(result);
+        let data = JSON.parse(req.body.data);
+        let result = {
+            error: 0
+        };
+        try {
+            data.session = req.session;
+            result.data = await redirectToImportServer(data, "copyConstructionProject", req);
+        } catch (err) {
+            console.log(err);
+            result.error = 1;
+            result.message = err.message;
+        }
+        res.json(result);
     },
     importProcessChecking: async function (req, res) {
         let result = {

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

@@ -1384,7 +1384,10 @@ async function getSummaryInfo(projectIDs, flagFieldMapping = null) {
             [fixedFlag.TOTAL_COST]: [{ name: 'totalCost', feeField: 'common' }], // 总造价
         };
     }
+    const date6 = Date.now();
     let projects = await projectModel.find({ ID: { $in: projectIDs }, projType: projectType.project, $or: [{ deleteInfo: null }, { 'deleteInfo.deleted': false }] });
+    const date7 = Date.now();
+    console.log('date7 - date6', date7 - date6);
     for (let project of projects) {
         IDMapping[project.ID] = { totalCost: 0 };
     }
@@ -1393,6 +1396,8 @@ async function getSummaryInfo(projectIDs, flagFieldMapping = null) {
     if (projectIDs.length > 0) {
         tenders = await projectModel.find({ ParentID: { $in: projectIDs }, projType: projectType.tender, $or: [{ deleteInfo: null }, { 'deleteInfo.deleted': false }] });
     }
+    const date8 = Date.now();
+    console.log('date8 - date7', date8 - date7);
     let tenderIDs = [];
     if (tenders.length > 0) {
         for (let tender of tenders) {
@@ -1417,6 +1422,8 @@ async function getSummaryInfo(projectIDs, flagFieldMapping = null) {
             summarizeToParent(IDMapping[tender.ParentID], IDMapping[tender.ID], flagFieldMapping);
         }
     }
+    const date9 = Date.now();
+    console.log('date9 - date8', date9 - date8);
     return IDMapping;
 }
 

+ 138 - 128
modules/pm/models/project_model.js

@@ -12,7 +12,8 @@ let fileType = {
     feeRateFile: 'FeeRateFile'
 };
 //先导出后require可以解决循环引用问题
-module.exports ={    project: new ProjectsDAO(),
+module.exports = {
+    project: new ProjectsDAO(),
     projType: projectType,
     fileType: fileType
 };
@@ -64,24 +65,24 @@ ProjectsDAO.prototype.getAllUnitProjects = async function (userId, compilation,
         let projects = await Projects.find({
             '$or': [
                 {
-                'userID': userId,
-                'compilation': compilation,
-                'property.rootProjectID': rootPrjID,
-                'deleteInfo': null
-                }, 
+                    'userID': userId,
+                    'compilation': compilation,
+                    'property.rootProjectID': rootPrjID,
+                    'deleteInfo': null
+                },
                 {
-                    'userID': userId, 
-                    'compilation': compilation, 
+                    'userID': userId,
+                    'compilation': compilation,
                     'property.rootProjectID': rootPrjID,
-                    'deleteInfo.deleted': {'$in': [null, false]}
+                    'deleteInfo.deleted': { '$in': [null, false] }
                 }
             ]
-        }, '-_id', {lean: true});
-        let projIDs= [];
+        }, '-_id', { lean: true });
+        let projIDs = [];
         const allIDs = [];
-        for(let project of projects){
+        for (let project of projects) {
             allIDs.push(project.ID);
-            if(project.projType === projectType.project){
+            if (project.projType === projectType.project) {
                 projIDs.push(project.ID);
             }
         }
@@ -91,7 +92,7 @@ ProjectsDAO.prototype.getAllUnitProjects = async function (userId, compilation,
             project.shareInfo = shareMap[project.ID] || [];
         });
         // 当前费用定额未读的分享的条目数量
-        
+
         // 设置汇总字段
         let summaryInfo = await pmFacade.getSummaryInfo(projIDs);
         pmFacade.setupSummaryFields(summaryInfo, projects);
@@ -104,30 +105,39 @@ ProjectsDAO.prototype.getAllUnitProjects = async function (userId, compilation,
 
 ProjectsDAO.prototype.getUserProjects = async function (userId, compilation, callback) {
     try {//
+        const date1 = Date.now();
         let projects = await Projects.find({
             '$or': [{
                 'userID': userId,
                 'compilation': compilation,
                 'deleteInfo': null
-            }, {'userID': userId, 'compilation': compilation, 'deleteInfo.deleted': {'$in': [null, false]}}]
-        }, '-_id', {lean: true});
+            }, { 'userID': userId, 'compilation': compilation, 'deleteInfo.deleted': { '$in': [null, false] } }]
+        }, '-_id', { lean: true });
+        const date2 = Date.now();
+        console.log('date2 - date1', date2 - date1);
         await pmFacade.checkFiles(projects);
-        let projIDs= [];
+        const date3 = Date.now();
+        console.log('date3 - date2', date3 - date2);
+        let projIDs = [];
         const allIDs = [];
-        for(let project of projects){
+        for (let project of projects) {
             allIDs.push(project.ID);
-            if(project.projType === projectType.project){
+            if (project.projType === projectType.project) {
                 projIDs.push(project.ID);
             }
         }
         // 设置分享信息 
         const shareMap = await pmFacade.getShareInfoMap(allIDs);
+        const date4 = Date.now();
+        console.log('date4 - date3', date4 - date3);
         projects.forEach(project => {
             project.shareInfo = shareMap[project.ID] || [];
         });
         //设置汇总字段
         let summaryInfo = await pmFacade.getSummaryInfo(projIDs);
         pmFacade.setupSummaryFields(summaryInfo, projects);
+        const date5 = Date.now();
+        console.log('date5 - date4', date5 - date4);
         /* for(let proj of projects){
             let summaryProj = summaryInfo[proj.ID];
             if(summaryProj){
@@ -143,7 +153,7 @@ ProjectsDAO.prototype.getUserProjects = async function (userId, compilation, cal
 };
 
 ProjectsDAO.prototype.getUserProjectAsync = async function (userId, ProjId) {
-    let template = await Projects.findOne({$or: [{deleteInfo: null}, {'deleteInfo.deleted': false}], ID: ProjId}, '-_id');
+    let template = await Projects.findOne({ $or: [{ deleteInfo: null }, { 'deleteInfo.deleted': false }], ID: ProjId }, '-_id');
     if (template && userId !== template.userID) {
         template._doc.readOnly = true;
     }
@@ -151,12 +161,12 @@ ProjectsDAO.prototype.getUserProjectAsync = async function (userId, ProjId) {
 };
 
 ProjectsDAO.prototype.getUserProject = function (userId, ProjId, callback) {
-    Projects.findOne({$or: [{deleteInfo: null}, {'deleteInfo.deleted': false}], ID: ProjId}, '-_id', function (err, template) {
+    Projects.findOne({ $or: [{ deleteInfo: null }, { 'deleteInfo.deleted': false }], ID: ProjId }, '-_id', function (err, template) {
         if (err) {
             callback(1, '找不到标段数据', null);
         } else {
             //打开分享的项目,只读
-            if(template && userId !== template.userID){
+            if (template && userId !== template.userID) {
                 template._doc.readOnly = true;
             }
 
@@ -186,19 +196,19 @@ ProjectsDAO.prototype.updateUserProjects = async function (userId, compilationId
                 data.updateData.name = data.updateData.name.trim();
             }
             if (data.updateType === 'update') {
-                Projects.update({userID: userId, ID: data.updateData.ID}, data.updateData, updateAll);
+                Projects.update({ userID: userId, ID: data.updateData.ID }, data.updateData, updateAll);
             }
             else if (data.updateType === 'new') {
                 let overWrite;
-                if(compilation.overWriteUrl && compilation.overWriteUrl!=""){
-                    overWrite = require("../../.."+compilation.overWriteUrl);
+                if (compilation.overWriteUrl && compilation.overWriteUrl != "") {
+                    overWrite = require("../../.." + compilation.overWriteUrl);
                 }
                 data.updateData.GUID = uuidV1();
                 data.updateData['userID'] = userId;
                 data.updateData['compilation'] = compilationId;
                 data.updateData['createDateTime'] = new Date();
                 data.updateData['fileVer'] = await index.getVersion();
-                if(data.updateData.projType === projectType.project){
+                if (data.updateData.projType === projectType.project) {
                     //设置建设项目基本信息,多个单位工程共用
                     const fileKind = data.updateData.property.boqType;
                     if (fileKind) {
@@ -220,7 +230,7 @@ ProjectsDAO.prototype.updateUserProjects = async function (userId, compilationId
                         user_id: userId,
                         root_project_id: data.updateData.property.rootProjectID
                     };
-                    if(overWrite && overWrite.getDefalutAssistProductionFeeRate) insertData.assistProductionFeeRate = overWrite.getDefalutAssistProductionFeeRate();
+                    if (overWrite && overWrite.getDefalutAssistProductionFeeRate) insertData.assistProductionFeeRate = overWrite.getDefalutAssistProductionFeeRate();
                     let addResult = await unitPriceFileModel.add(insertData);
                     if (!addResult) {
                         callback(1, '新增单价文件失败.', null);
@@ -228,11 +238,11 @@ ProjectsDAO.prototype.updateUserProjects = async function (userId, compilationId
                     }
                     data.updateData.property.unitPriceFile.id = addResult.id;
                     //新增单价文件的同时,在项目工料机和空白的单价文件中先插入机械组成物等信息
-                    await gljFacade.addMixRatioForNew(data.updateData.ID,addResult.id,data.updateData.property.engineering_id,pmFacade.getExtendData(data.updateData.property,compilation));
+                    await gljFacade.addMixRatioForNew(data.updateData.ID, addResult.id, data.updateData.property.engineering_id, pmFacade.getExtendData(data.updateData.property, compilation));
                 }
                 if (data.updateData.projType === projectType.tender) {
                     //单价文件
-                    data.updateData.property.unitPriceFile.id=parseInt(data.updateData.property.unitPriceFile.id);
+                    data.updateData.property.unitPriceFile.id = parseInt(data.updateData.property.unitPriceFile.id);
                     //小数位数
                     data.updateData.property.decimal = overWrite && overWrite.defaultDecimal || defaultDecimal;
                     //清单工程量精度
@@ -241,7 +251,7 @@ ProjectsDAO.prototype.updateUserProjects = async function (userId, compilationId
                     //basicInformation[0]['items'][1]['value'] = data.updateData.property.engineeringName || '';
                     //data.updateData.property.basicInformation = basicInformation;
                     //工程特征
-                    if(data.updateData.property.featureLibID){
+                    if (data.updateData.property.featureLibID) {
                         const matchedConstructionProject = datas.find(item => item.updateData.projType === projectType.project);
                         let constructionProjectName = '';
                         if (matchedConstructionProject) {
@@ -283,24 +293,24 @@ ProjectsDAO.prototype.updateUserProjects = async function (userId, compilationId
                         data.updateData.property.growthPeriod = 0;
                     }
                     //安装增加费
-                    if(data.updateData.property.isInstall == true || data.updateData.property.isInstall=='true'){//判断是否安装工程
-                        await installationFacade.copyInstallationFeeFromLib(data.updateData.ID,data.updateData.property.engineering_id);
+                    if (data.updateData.property.isInstall == true || data.updateData.property.isInstall == 'true') {//判断是否安装工程
+                        await installationFacade.copyInstallationFeeFromLib(data.updateData.ID, data.updateData.property.engineering_id);
                     }
                     //锁定清单
                     data.updateData.property.lockBills = false;
                     //工料机单价调整系数
                     data.updateData.property.tenderSetting = tenderSetting;
                     //书签和批注
-                    data.updateData.property.bookmarkSetting =  bookmarkSetting;
+                    data.updateData.property.bookmarkSetting = bookmarkSetting;
                 }
 
                 newProject = new Projects(data.updateData);
-               /* // 查找同级是否存在同名数据
-                let exist = await this.isExist(userId, compilationId, data.updateData.name, data.updateData.ParentID);
-                if (exist) {
-                    callback(1, '同级目录已存在相同名称数据.', null);
-                    return;
-                }*/
+                /* // 查找同级是否存在同名数据
+                 let exist = await this.isExist(userId, compilationId, data.updateData.name, data.updateData.ParentID);
+                 if (exist) {
+                     callback(1, '同级目录已存在相同名称数据.', null);
+                     return;
+                 }*/
                 if (data.updateData.projType === 'Tender') {
                     let feeRateFileID = await feeRateFacade.newFeeRateFile(userId, data.updateData);
                     newProject.property.feeFile = feeRateFileID ? feeRateFileID : -1;
@@ -378,7 +388,7 @@ ProjectsDAO.prototype.updateUserProjects = async function (userId, compilationId
 };
 
 ProjectsDAO.prototype.udpateUserFiles = async function (userId, datas, callback) {
-    let updateType = {update: 'update', delete: 'delete'};
+    let updateType = { update: 'update', delete: 'delete' };
     let deleteInfo = Object.create(null);
     deleteInfo.deleted = true;
     deleteInfo.deleteBy = userId;
@@ -387,26 +397,26 @@ ProjectsDAO.prototype.udpateUserFiles = async function (userId, datas, callback)
         for (let i = 0, len = datas.length; i < len; i++) {
             let data = datas[i];
             if (data.updateType === updateType.update && data.fileType === fileType.unitPriceFile) {
-                await UnitPriceFiles.update({user_id: userId, id: parseInt(data.updateData.id)}, data.updateData);
+                await UnitPriceFiles.update({ user_id: userId, id: parseInt(data.updateData.id) }, data.updateData);
                 await Projects.update({
                     userID: userId,
                     'property.unitPriceFile.id': data.updateData.id
-                }, {$set: {'property.unitPriceFile.name': data.updateData.name}}, {multi: true});
+                }, { $set: { 'property.unitPriceFile.name': data.updateData.name } }, { multi: true });
             }
             else if (data.updateType === updateType.update && data.fileType === fileType.feeRateFile) {
-                await FeeRateFiles.update({ID: data.updateData.ID}, data.updateData);
+                await FeeRateFiles.update({ ID: data.updateData.ID }, data.updateData);
                 await Projects.update({
                     userID: userId,
                     'property.feeFile.id': data.updateData.ID
-                }, {$set: {'property.feeFile.name': data.updateData.name}}, {multi: true});
+                }, { $set: { 'property.feeFile.name': data.updateData.name } }, { multi: true });
             }
             else if (data.updateType === updateType.delete && data.fileType === fileType.unitPriceFile) {
                 data.updateData.deleteInfo = deleteInfo;
-                await UnitPriceFiles.update({user_id: userId, id: parseInt(data.updateData.id)}, data.updateData);
+                await UnitPriceFiles.update({ user_id: userId, id: parseInt(data.updateData.id) }, data.updateData);
             }
             else if (data.updateType === updateType.delete && data.fileType === fileType.feeRateFile) {
                 data.updateData.deleteInfo = deleteInfo;
-                await FeeRateFiles.update({ID: data.updateData.ID}, data.updateData);
+                await FeeRateFiles.update({ ID: data.updateData.ID }, data.updateData);
             }
             else throw '未知文件类型,删除失败'
         }
@@ -434,7 +444,7 @@ ProjectsDAO.prototype.copyUserProjects = function (userId, compilationId, datas,
         for (i = 0; i < datas.length && !hasError; i++) {
             data = datas[i];
             if (data.updateType === 'update') {
-                Projects.update({userID: userId, ID: data.updateData.ID}, data.updateData, updateAll)
+                Projects.update({ userID: userId, ID: data.updateData.ID }, data.updateData, updateAll)
             } else if (data.updateType === 'copy') {
                 console.log(userId);
                 data.updateData['userID'] = userId;
@@ -468,13 +478,13 @@ ProjectsDAO.prototype.rename = async function (userId, compilationId, data, call
         }
         data.newName = data.newName.trim();
         //重名前端控制
-       /* // 查找同级是否存在同名数据
-        let exist = await this.isExist(userId, compilationId, data.newName, data.parentID);
-        if (exist) {
-            throw '同级目录已存在相同名称数据';
-        }*/
+        /* // 查找同级是否存在同名数据
+         let exist = await this.isExist(userId, compilationId, data.newName, data.parentID);
+         if (exist) {
+             throw '同级目录已存在相同名称数据';
+         }*/
 
-        Projects.update({userID: userId, ID: data.id}, {name: data.newName}, function (err) {
+        Projects.update({ userID: userId, ID: data.id }, { name: data.newName }, function (err) {
             if (err) {
                 throw '项目不存在';
             }
@@ -488,7 +498,7 @@ ProjectsDAO.prototype.rename = async function (userId, compilationId, data, call
 
 ProjectsDAO.prototype.beforeOpenProject = function (userId, projectId, updateData, callback) {
     updateData['recentDateTime'] = new Date();
-    Projects.update({userID: userId, ID: projectId}, updateData, function (err) {
+    Projects.update({ userID: userId, ID: projectId }, updateData, function (err) {
         if (err) {
             callback(1, '项目不存在.');
         } else {
@@ -502,7 +512,7 @@ ProjectsDAO.prototype.getNewProjectID = function (count, callback) {
         console.log(result);
         let highID = result.sequence_value;
         if (!err) {
-            callback(0, '', {lowID: highID - count + 1, highID: highID});
+            callback(0, '', { lowID: highID - count + 1, highID: highID });
         } else {
             callback(1, '获取主键失败', null);
         }
@@ -511,7 +521,7 @@ ProjectsDAO.prototype.getNewProjectID = function (count, callback) {
 
 ProjectsDAO.prototype.getProject = function (key, callback) {
     if (callback) {
-        Projects.findOne({'_id': key}, function (err, result) {
+        Projects.findOne({ '_id': key }, function (err, result) {
             if (err) {
                 callback(1, '查找标段失败');
             } else {
@@ -519,12 +529,12 @@ ProjectsDAO.prototype.getProject = function (key, callback) {
             }
         });
     } else {
-        return Projects.findOne({$or: [{deleteInfo: null}, {'deleteInfo.deleted': false}], 'ID': key}).exec();
+        return Projects.findOne({ $or: [{ deleteInfo: null }, { 'deleteInfo.deleted': false }], 'ID': key }).exec();
     }
 };
 
 ProjectsDAO.prototype.getProjectsByIds = async function (userId, compilationId, ids) {
-    return await Projects.find({userID: userId, compilation: compilationId, ID: {$in: ids}}, '-_id -property');
+    return await Projects.find({ userID: userId, compilation: compilationId, ID: { $in: ids } }, '-_id -property');
 };
 
 ProjectsDAO.prototype.getGCFiles = async function (fileType, userID) {
@@ -546,13 +556,13 @@ ProjectsDAO.prototype.getGCFiles = async function (fileType, userID) {
         }
         if (!isExist) throw '不存在此项目类型!';
         rst = await Projects.find(
-            {userID: userID, projType: fileType, 'deleteInfo.deleted': true, '$or': [{'deleteInfo.completeDeleted': false}, {'deleteInfo.completeDeleted': null}]});
+            { userID: userID, projType: fileType, 'deleteInfo.deleted': true, '$or': [{ 'deleteInfo.completeDeleted': false }, { 'deleteInfo.completeDeleted': null }] });
     }
     return rst;
 };
 
 ProjectsDAO.prototype.getFirstNodeID = async function (userID, compilationId, pid) {
-    let nodes = await Projects.find({userID: userID, compilation: compilationId, ParentID: pid, deleteInfo: null});
+    let nodes = await Projects.find({ userID: userID, compilation: compilationId, ParentID: pid, deleteInfo: null });
     if (nodes.length === 0) {
         return -1;
     }
@@ -596,10 +606,10 @@ ProjectsDAO.prototype.recGC = async function (userID, compilationId, datas, call
             }
         } else {
             if (datas[i].updateType === projectType.project && datas[i].updateData.NextSiblingID === undefined) {//则为待查询NextSiblingID,前端无法查询
-                let projData = await Projects.find({userID: userID, ID: datas[i].findData.ID});//建设项目原本可能属于某文件夹、文件夹的存在需要判断
+                let projData = await Projects.find({ userID: userID, ID: datas[i].findData.ID });//建设项目原本可能属于某文件夹、文件夹的存在需要判断
                 let projPid = projData[0].ParentID;
                 if (projPid !== -1) {
-                    let projFolder = await Projects.find({userID: userID, ID: projPid});
+                    let projFolder = await Projects.find({ userID: userID, ID: projPid });
                     if (projFolder.length === 0) {//文件夹已不存在
                         projPid = -1;
                         datas[i].updateData.ParentID = -1;
@@ -613,43 +623,43 @@ ProjectsDAO.prototype.recGC = async function (userID, compilationId, datas, call
     }
     for (let i = 0, len = updateDatas.length; i < len; i++) {
         functions.push((function (data) {
-                return function (cb) {
-                    if (data.updateType === fileType.unitPriceFile) {
-                        UnitPriceFiles.update({id: parseInt(data.findData.id)}, data.updateData, function (err) {
-                            if (err) cb(err);
-                            else {
-                                Projects.update({
-                                    userID: userID,
-                                    'property.unitPriceFile.id': data.findData.id
-                                }, {$set: {'property.unitPriceFile.name': data.updateData.name}}, function (err) {
-                                    if (err) cb(err);
-                                    else cb(false);
-                                });
-                            }
-                        })
-                    } else if (data.updateType === fileType.feeRateFile) {
-                        FeeRateFiles.update(data.findData, data.updateData, function (err) {
-                            if (err) cb(err);
-                            else {
-                                Projects.update({
-                                    userID: userID,
-                                    'property.feeFile.id': data.findData.ID
-                                }, {$set: {'property.feeFile.name': data.updateData.name}}, function (err) {
-                                    if (err) cb(err);
-                                    else cb(false);
-                                });
-                            }
-                        });
-                    } else {
-                        if (data) {
-                            Projects.update(data.findData, data.updateData, function (err) {
+            return function (cb) {
+                if (data.updateType === fileType.unitPriceFile) {
+                    UnitPriceFiles.update({ id: parseInt(data.findData.id) }, data.updateData, function (err) {
+                        if (err) cb(err);
+                        else {
+                            Projects.update({
+                                userID: userID,
+                                'property.unitPriceFile.id': data.findData.id
+                            }, { $set: { 'property.unitPriceFile.name': data.updateData.name } }, function (err) {
+                                if (err) cb(err);
+                                else cb(false);
+                            });
+                        }
+                    })
+                } else if (data.updateType === fileType.feeRateFile) {
+                    FeeRateFiles.update(data.findData, data.updateData, function (err) {
+                        if (err) cb(err);
+                        else {
+                            Projects.update({
+                                userID: userID,
+                                'property.feeFile.id': data.findData.ID
+                            }, { $set: { 'property.feeFile.name': data.updateData.name } }, function (err) {
                                 if (err) cb(err);
                                 else cb(false);
                             });
                         }
+                    });
+                } else {
+                    if (data) {
+                        Projects.update(data.findData, data.updateData, function (err) {
+                            if (err) cb(err);
+                            else cb(false);
+                        });
                     }
                 }
-            })(updateDatas[i]));
+            }
+        })(updateDatas[i]));
     }
     async_c.parallel(functions, function (err, results) {
         if (err) callback(err, 'fail', null);
@@ -673,7 +683,7 @@ ProjectsDAO.prototype.isExist = async function (userId, compilationId, name, par
         compilation: compilationId,
         ParentID: parentID,
         name: name,
-        "$or": [{deleteInfo: null}, {"deleteInfo.deleted": false}]
+        "$or": [{ deleteInfo: null }, { "deleteInfo.deleted": false }]
     };
     let count = await Projects.count(condition);
     return count > 0;
@@ -688,7 +698,7 @@ ProjectsDAO.prototype.isExist = async function (userId, compilationId, name, par
 ProjectsDAO.prototype.getTenderByProjectId = async function (projectId) {
     let result = [];
     // 首先获取对应的单位工程id
-    let engineeringData = await Projects.find({ParentID: projectId});
+    let engineeringData = await Projects.find({ ParentID: projectId });
     if (engineeringData.length <= 0) {
         return result;
     }
@@ -699,7 +709,7 @@ ProjectsDAO.prototype.getTenderByProjectId = async function (projectId) {
     }
 
     // 查找对应的单位工程id
-    let tenderData = await Projects.find({ParentID: {$in: engineeringIdList},deleteInfo: null});
+    let tenderData = await Projects.find({ ParentID: { $in: engineeringIdList }, deleteInfo: null });
     if (tenderData.length <= 0) {
         return result;
     }
@@ -726,8 +736,8 @@ ProjectsDAO.prototype.getTenderByUnitPriceFileId = async function (unitPriceFile
     }
 
     //let condition = {projType: 'Tender', "property.unitPriceFile.id": unitPriceFileId};
-    let condition = {"property.unitPriceFile.id": unitPriceFileId,deleteInfo:null};
-    result = await Projects.find(condition,['ID','name','property']);
+    let condition = { "property.unitPriceFile.id": unitPriceFileId, deleteInfo: null };
+    result = await Projects.find(condition, ['ID', 'name', 'property']);
 
     return result;
 };
@@ -740,7 +750,7 @@ ProjectsDAO.prototype.getTenderByUnitPriceFileId = async function (unitPriceFile
  */
 ProjectsDAO.prototype.getProjectProperty = async function (projectId) {
     let result = null;
-    let projectData = await Projects.findOne({ID: projectId},['property']);
+    let projectData = await Projects.findOne({ ID: projectId }, ['property']);
     if (projectData === null) {
         return result;
     }
@@ -753,13 +763,13 @@ ProjectsDAO.prototype.getProjectProperty = async function (projectId) {
  * @paraconsolem {Number} userId
  * @return {Promise}
  */
-ProjectsDAO.prototype.getUserProjectData = async function (userId,compilation) {
+ProjectsDAO.prototype.getUserProjectData = async function (userId, compilation) {
     let projectList = await Projects.find({
         '$or': [
-            {'userID': userId, 'compilation': compilation, 'deleteInfo': null, projType: 'Project'},
-            {'userID': userId, 'compilation': compilation,'deleteInfo.deleted': {'$in': [null, false]}, projType: 'Project'}
+            { 'userID': userId, 'compilation': compilation, 'deleteInfo': null, projType: 'Project' },
+            { 'userID': userId, 'compilation': compilation, 'deleteInfo.deleted': { '$in': [null, false] }, projType: 'Project' }
         ]
-    }, {_id: 0, name: 1, ID: 1, NextSiblingID: 1, ParentID: 1});
+    }, { _id: 0, name: 1, ID: 1, NextSiblingID: 1, ParentID: 1 });
 
     return projectList;
 };
@@ -776,7 +786,7 @@ ProjectsDAO.prototype.changeUnitPriceFileInfo = async function (projectId, chang
     if (isNaN(projectId) || projectId <= 0) {
         return false;
     }
-    let result = await Projects.update({ID: projectId}, {"property.unitPriceFile": changeInfo});
+    let result = await Projects.update({ ID: projectId }, { "property.unitPriceFile": changeInfo });
 
     return result.ok === 1;
 };
@@ -789,30 +799,30 @@ ProjectsDAO.prototype.changeUnitPriceFileInfo = async function (projectId, chang
  * @param {Object} propertyData - 项目属性数据
  * @return {Promise}
  */
-ProjectsDAO.prototype.updateProjectProperty = async function(projectId, propertyData) {
+ProjectsDAO.prototype.updateProjectProperty = async function (projectId, propertyData) {
     projectId = parseInt(projectId);
     if (isNaN(projectId) || projectId <= 0 || propertyData.property === undefined || propertyData.data === undefined) {
         return false;
     }
     const updateData = {};
     updateData["property." + propertyData.property] = propertyData.data;
-    let result = await Projects.update({ID: projectId}, updateData);
+    let result = await Projects.update({ ID: projectId }, updateData);
 
     return result.ok === 1;
 };
 
 // CSL, 2018-01-11 获取指定ID节点(如单项工程、建设项目)下所有单位工程的各项汇总金额,用于报表计算汇总。
 ProjectsDAO.prototype.getSummaryFees = async function (ID) {
-    async function getProject(ID){
-        return await Projects.findOne({'ID': ID, deleteInfo: null}, need);
+    async function getProject(ID) {
+        return await Projects.findOne({ 'ID': ID, deleteInfo: null }, need);
     };
-    async function getChildrenDocs(IDs){
-        return await Projects.find({'ParentID': {"$in":IDs}, deleteInfo: null}, need);
+    async function getChildrenDocs(IDs) {
+        return await Projects.find({ 'ParentID': { "$in": IDs }, deleteInfo: null }, need);
     };
-    async function getEgrIDs(ID){
-        let _docs = await Projects.find({'ParentID': ID, deleteInfo: null}, ['ID', '-_id']);
+    async function getEgrIDs(ID) {
+        let _docs = await Projects.find({ 'ParentID': ID, deleteInfo: null }, ['ID', '-_id']);
         let arr = [];
-        for (let doc of _docs){
+        for (let doc of _docs) {
             arr.push(doc.ID);
         };
         return arr;
@@ -823,26 +833,26 @@ ProjectsDAO.prototype.getSummaryFees = async function (ID) {
     let _doc = await getProject(ID);
     if (!_doc) return _doc;
 
-    if (_doc.projType.sameText('Engineering')){
+    if (_doc.projType.sameText('Engineering')) {
         return await getChildrenDocs([ID]);
     }
-    else if (_doc.projType.sameText('Project')){
+    else if (_doc.projType.sameText('Project')) {
         let eIDs = await getEgrIDs(ID);
         return await getChildrenDocs(eIDs);
     }
-    else{
+    else {
         return _doc;
     };
 };
 
-ProjectsDAO.prototype.updateUnitFileToProject=async function(projectID,unitFile){
-    return await Projects.findOneAndUpdate({'ID':projectID},{'property.unitPriceFile':unitFile});
+ProjectsDAO.prototype.updateUnitFileToProject = async function (projectID, unitFile) {
+    return await Projects.findOneAndUpdate({ 'ID': projectID }, { 'property.unitPriceFile': unitFile });
 }
 
 ProjectsDAO.prototype.getBasicInfo = async function (projectID) {
     //获取建设项目
     let constructionProject = await pmFacade.getConstructionProject(projectID);
-    if(!constructionProject || !constructionProject.property || !constructionProject.property.basicInformation){
+    if (!constructionProject || !constructionProject.property || !constructionProject.property.basicInformation) {
         return null;
     }
     return constructionProject.property.basicInformation;
@@ -851,14 +861,14 @@ ProjectsDAO.prototype.getBasicInfo = async function (projectID) {
 //恢复默认系统设置
 ProjectsDAO.prototype.defaultSettings = async function (userID, compilation, projectID) {
     const compilationId = compilation._id;
-    let project = await Projects.findOne({ID: projectID});
-    if(!project){
+    let project = await Projects.findOne({ ID: projectID });
+    if (!project) {
         return false;
     }
     let cloneProperty = _.cloneDeep(project.property);
     let overWrite;
-    if(compilation.overWriteUrl && compilation.overWriteUrl!=""){
-        overWrite = require("../../.."+compilation.overWriteUrl);
+    if (compilation.overWriteUrl && compilation.overWriteUrl != "") {
+        overWrite = require("../../.." + compilation.overWriteUrl);
     }
     //关于计算
     let defaultCalcMode = overWrite && overWrite.defaultCalcMode || ((project.property.valuationType !== ValuationType.BOQ) ? 2 : 1);
@@ -872,12 +882,12 @@ ProjectsDAO.prototype.defaultSettings = async function (userID, compilation, pro
     //呈现选项
     cloneProperty.displaySetting = displaySetting;
     //列设置
-    let stdColLib = await mainColLibModel.findOne({ID: project.property.colLibID});
-    if(stdColLib){
-        await projSettingModel.update({projectID: projectID}, {$set: {main_tree_col: stdColLib.main_tree_col}});
+    let stdColLib = await mainColLibModel.findOne({ ID: project.property.colLibID });
+    if (stdColLib) {
+        await projSettingModel.update({ projectID: projectID }, { $set: { main_tree_col: stdColLib.main_tree_col } });
     }
     //系统选项
-    await optionModel.update({user_id: userID, compilation_id: compilationId}, {$set: {options: optionSetting}});
-    await Projects.update({ID: projectID}, {$set: {property: cloneProperty}});
+    await optionModel.update({ user_id: userID, compilation_id: compilationId }, { $set: { options: optionSetting } });
+    await Projects.update({ ID: projectID }, { $set: { property: cloneProperty } });
     return true;
 };

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

@@ -108,7 +108,7 @@
                       <div class="btn-group ml-2">
                           <a class="dropdown-toggle btn btn-light btn-sm" data-toggle="dropdown" href="#" id="moreMenuA" role="button" aria-haspopup="true" aria-expanded="false">更多</a>
                           <div class="dropdown-menu dropright" id="moreMenu">
-                            <% if((compilationName === '公路造价(2018)' || compilationName === '安徽养护(2018)' || compilationName === '广东公路造价(2018)' || compilationName === '浙江养护(2005)' || compilationName === '山东养护(2016)' || (compilationName === '广西养护(2020)')) && boqType) { %>
+                            <% if((compilationName === '公路造价(2018)' || compilationName === '安徽养护(2018)' || compilationName === '广东公路造价(2018)' || compilationName === '浙江养护(2005)' || compilationName === '山东养护(2016/2024)' || (compilationName === '广西养护(2020)')) && boqType) { %>
                                 <a class="dropdown-item" id="open-export-modal" href="javascript:void(0);"><i class="fa fa-code-fork"></i> 数据接口</a>
                                 <!-- <a class="dropdown-item" id="open-export-modal" href="javascript:void(0);" data-toggle="modal" data-target="#interface-export-modal"><i class="fa fa-code-fork"></i> 数据接口</a> -->
                             <% }%>

A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 685 - 206
web/building_saas/main/js/views/glj_view.js


+ 24 - 1
web/building_saas/main/js/views/importBills.js

@@ -401,5 +401,28 @@ const importBills = (function () {
     return rst;
   }
 
-  return { extactDatas };
+  // 获取需要删除的D
+  function getRemoveIDs(insertBills) {
+    const rBillIDs = [];
+    const rRationIDs = [];
+    const rst = { rBillIDs, rRationIDs };
+    if (!insertBills || !insertBills.length) {
+      return rst;
+    }
+    const flag = fixedFlag.ONE_SEVEN_BILLS;
+    const fixedNode = calcTools.getNodeByFlag(flag);
+    if (!fixedNode) {
+      return rst;
+    }
+    fixedNode.getPosterity().forEach(node => {
+      if (node.sourceType === 'bills') {
+        rBillIDs.push(node.data.ID);
+      } else {
+        rRationIDs.push(node.data.ID);
+      }
+    });
+    return rst;
+  }
+
+  return { extactDatas, getRemoveIDs };
 })();

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

@@ -1338,7 +1338,7 @@ var projectObj = {
       controller = this.mainController;
     let insertBillsName =
       project.projectInfo.property &&
-      [commonConstants.ValuationType.BOQ, commonConstants.ValuationType.BILL_BUDGET].includes(project.projectInfo.property.valuationType)
+        [commonConstants.ValuationType.BOQ, commonConstants.ValuationType.BILL_BUDGET].includes(project.projectInfo.property.valuationType)
         ? "插入清单"
         : "插入项目节"; //右键“插入清单”改文字为“插入项目节”,工程量清单中保持不变。
     $.contextMenu({
@@ -3248,7 +3248,9 @@ $("#importConfirm").click(function () {
     if (importBillsData.length === 0) {
       throw "excel无有效数据";
     }
-    let compressData = LZString.compressToUTF16(JSON.stringify(importBillsData));
+    debugger;
+    const removeData = importBills.getRemoveIDs(importBillsData);
+    let compressData = LZString.compressToUTF16(JSON.stringify({ insertData: importBillsData, removeData }));
     formData.append("compressData", compressData);
     let eDate = +new Date();
     console.log(`解析excel数据时间:${eDate - sDate}`);

+ 24 - 0
web/building_saas/pm/html/project-management.html

@@ -475,6 +475,30 @@
         </div>
     </div>
 </div>
+<!-- 停止新建 -->
+<div class="modal fade" id="stop-create-dialog" data-backdrop="static">
+    <div class="modal-dialog" role="document">
+        <div class="modal-content">
+            <div class="modal-header">
+                <h5 class="modal-title">提示</h5>
+                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
+                    <span aria-hidden="true">&times;</span>
+                </button>
+            </div>
+            <div class="modal-body">
+                <p>尊敬的用户:</p>
+                <p>请使用<a href="https://dsk.smartcost.com.cn/">大司空云计价</a>编制新项目,现版本已停止新建项目。</p>
+                <p>请联系当地客服免费升级账号:</p>
+                <p>当地服务热线:<a id="stop-create-contact" href="javascript:void(0);">联系</a>当地客服</p>
+                <p>全国服务热线:0756-3850888,企业QQ:800003850</p>
+            </div>
+            <div class="modal-footer">
+                <a href="javascript:void(0);" class="btn btn-primary" data-dismiss="modal" id="stop-create-confirm">确定</a>
+                <button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
+            </div>
+        </div>
+    </div>
+</div>
 <!--弹出重命名-->
 <div class="modal fade" id="rename-dialog" data-backdrop="static">
     <div class="modal-dialog" role="document">

A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 4889 - 3735
web/building_saas/pm/js/pm_newMain.js


+ 46 - 33
web/building_saas/standard_interface/index.js

@@ -9,7 +9,7 @@
  * 注意:导出脚本必须有一个“entry”方法挂载在“INTERFACE_EXPORT”对象上。 eg: INTERFACE_EXPORT = { entry: () => void }
  * entry方法返回的结果必须为[{ data, exportKind,(导出类型,招、投标、控制价) fileName(文件名) }]
  * 其中data为xml的object形式:
- * xml: 
+ * xml:
  * <JingJiBiao Xmbh="001">
  *   <ZhaoBiaoXx Zbr="vian">
  *   </ZhaoBiaoXx>
@@ -19,11 +19,11 @@
  *   name: 'JingJiBiao',
  *   attrs: [{ name: 'xmbh', value: '001' }],
  *   children: [
- *      { 
+ *      {
  *        name: 'ZhaoBiaoXx',
  *        attrs: [{ name: 'Zbr', value: 'vian' }],
  *        children: []
- *      }  
+ *      }
  *   ]
  * }
  */
@@ -33,47 +33,56 @@ let INTERFACE_EXPORT = {};
 let INTERFACE_IMPORT = {};
 
 const STD_INTERFACE = (() => {
-  'use strict';
+  "use strict";
 
   // 根据地区配置,初始化地区选项
   function initInterfaceAreas($parentAreas, $subAreas) {
     const connectedAreas = Object.keys(INTERFACE_CONFIG);
     const parentMap = {};
-    connectedAreas.forEach(connectedArea => {
-      const areas = connectedArea.split('@');
-      if ((COMPILATION_NAME === '安徽养护(2018)' && areas[0] !== '安徽') ||
-        (COMPILATION_NAME === '广东公路造价(2018)' && areas[0] !== '广东') ||
-        (COMPILATION_NAME === '浙江养护(2005)' && areas[0] !== '浙江') ||
-        (COMPILATION_NAME === '广西养护(2020)' && areas[0] !== '广西')
-        ) {
+    connectedAreas.forEach((connectedArea) => {
+      const areas = connectedArea.split("@");
+      if (
+        (COMPILATION_NAME === "安徽养护(2018)" && areas[0] !== "安徽") ||
+        (COMPILATION_NAME === "广东公路造价(2018)" && areas[0] !== "广东") ||
+        (COMPILATION_NAME === "浙江养护(2005)" && areas[0] !== "浙江") ||
+        (COMPILATION_NAME === "广西养护(2020)" && areas[0] !== "广西")
+      ) {
         return;
       }
-      if (COMPILATION_NAME.includes('山东养护(2016)')) {
-        if (areas[0].includes('山东')) (parentMap[areas[0]] || (parentMap[areas[0]] = [])).push(areas[1]);
+      if (COMPILATION_NAME.includes("山东养护(2016/2024)")) {
+        if (areas[0].includes("山东"))
+          (parentMap[areas[0]] || (parentMap[areas[0]] = [])).push(areas[1]);
       } else {
         (parentMap[areas[0]] || (parentMap[areas[0]] = [])).push(areas[1]);
       }
     });
-    const parentAreasHtml = Object
-      .keys(parentMap)
-      .reduce((acc, area) => acc += `<option value="${area}">${area}</option>`, '');
+    const parentAreasHtml = Object.keys(parentMap).reduce(
+      (acc, area) => (acc += `<option value="${area}">${area}</option>`),
+      ""
+    );
     $parentAreas.html(parentAreasHtml);
-    const subAreasHtml = parentMap[Object.keys(parentMap)[0]].reduce((acc, area) => acc += `<option value="${area}">${area}</option>`, '');
+    const subAreasHtml = parentMap[Object.keys(parentMap)[0]].reduce(
+      (acc, area) => (acc += `<option value="${area}">${area}</option>`),
+      ""
+    );
     $subAreas.html(subAreasHtml);
     // 父级地区变更,子地区选项更新
     $parentAreas.change(function () {
-      if (typeof EXPORT_VIEW !== 'undefined') {
+      if (typeof EXPORT_VIEW !== "undefined") {
         EXPORT_VIEW.resetState(); // 清空导出接口缓存
       }
       const curArea = $(this).val();
-      const subAreasHtml = parentMap[curArea].reduce((acc, area) => acc += `<option value="${area}">${area}</option>`, '');
+      const subAreasHtml = parentMap[curArea].reduce(
+        (acc, area) => (acc += `<option value="${area}">${area}</option>`),
+        ""
+      );
       $subAreas.html(subAreasHtml);
     });
     $subAreas.change(function () {
-      if (typeof EXPORT_VIEW !== 'undefined') {
+      if (typeof EXPORT_VIEW !== "undefined") {
         EXPORT_VIEW.resetState(); // 清空导出接口缓存
       }
-    })
+    });
   }
 
   /**
@@ -86,37 +95,42 @@ const STD_INTERFACE = (() => {
    */
   function loadScript(path) {
     return new Promise((resolve, reject) => {
-      const scriptID = 'interface-script';
-      const body = document.getElementsByTagName('body')[0];
+      const scriptID = "interface-script";
+      const body = document.getElementsByTagName("body")[0];
       // 移除原来的
       const orgScript = document.getElementById(scriptID);
       if (orgScript) {
         body.removeChild(orgScript);
       }
       // 增加新的
-      const script = document.createElement('script');
+      const script = document.createElement("script");
       script.src = path;
-      script.type = 'text/javascript';
+      script.type = "text/javascript";
       script.id = scriptID;
       body.appendChild(script);
-      script.onload = script.onreadystatechange = function () { // ie、ff触发事件不同,都写上
-        if (!this.readyState || this.readyState === 'loaded' || this.readyState === 'complete') {
+      script.onload = script.onreadystatechange = function () {
+        // ie、ff触发事件不同,都写上
+        if (
+          !this.readyState ||
+          this.readyState === "loaded" ||
+          this.readyState === "complete"
+        ) {
           script.onload = script.onreadystatechange = null;
           resolve();
         }
       };
       script.onerror = function () {
-        reject('script加载失败。');
+        reject("script加载失败。");
       };
     });
   }
 
   const ScriptType = {
-    EXPORT: 'export',
-    IMPORT: 'import',
+    EXPORT: "export",
+    IMPORT: "import",
   };
 
-  let curArea = '';
+  let curArea = "";
   /**
    * 根据地区和脚本类型加载脚本
    * @param {String} area - 地区选项 eg: '安徽省@马鞍山'
@@ -145,5 +159,4 @@ const STD_INTERFACE = (() => {
     ScriptType,
     loadScriptByArea,
   };
-
-})();
+})();