Explorar o código

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

zhangweicheng hai 4 semanas
pai
achega
4ff18d67ae

+ 24 - 17
modules/all_models/tpl_tree_node.js

@@ -19,27 +19,34 @@ let Schema = mongoose.Schema;
 // });
 
 let TplNodeSchema = new Schema({
-    nodeType: Number,   //节点类型:树节点(枝) 或 模板节点(叶), 统一结构
-    ID: Number,         //template节点ID,只有在nodeType是模板节点有效
-    refId: Number,      //引用报表模板id (引用 collection: rpt_templates)
-    name: String,       //显示名称
-    released: Boolean,  //是否已发布
-    items: []           //子节点
+  nodeType: Number, //节点类型:树节点(枝) 或 模板节点(叶), 统一结构
+  ID: Number, //template节点ID,只有在nodeType是模板节点有效
+  refId: Number, //引用报表模板id (引用 collection: rpt_templates)
+  name: String, //显示名称
+  released: Boolean, //是否已发布
+  items: [], //子节点
 });
 
 let RptTplTreeSchema = new Schema({
-    compilationId: String,      //编办的ObjectId
-    // engineerId: Number,         //工程专业Id(参考 /modules/common/const/engineering.js)
-    userId: String,             //用户名的object_id串
-    properties: [],             //这是一个预留的属性,假定未来还会有不同的划分细节(如:招标/投标/清单 ... etc)
-    name: String,               //显示名称
-    released: Boolean,          //是否已发布
-    isDeleted: Boolean,         //删除标记
-    flags: Schema.Types.Mixed,  //额外标记集合(这些标记可能会影响到前端显示,如‘计税方式’等)
-    items: []                   //TplNodeSchema entity
+  compilationId: String, //编办的ObjectId
+  // engineerId: Number,         //工程专业Id(参考 /modules/common/const/engineering.js)
+  userId: String, //用户名的object_id串
+  properties: [], //这是一个预留的属性,假定未来还会有不同的划分细节(如:招标/投标/清单 ... etc)
+  name: String, //显示名称
+  released: Boolean, //是否已发布
+  isDeleted: Boolean, //删除标记
+  flags: Schema.Types.Mixed, //额外标记集合(这些标记可能会影响到前端显示,如‘计税方式’等)
+  UUID: String,
+  items: [], //TplNodeSchema entity
 });
-RptTplTreeSchema.statics.findAndModify = function (query, sort, doc, options, callback) {
-    return this.collection.findAndModify(query, sort, doc, options, callback);
+RptTplTreeSchema.statics.findAndModify = function (
+  query,
+  sort,
+  doc,
+  options,
+  callback
+) {
+  return this.collection.findAndModify(query, sort, doc, options, callback);
 };
 
 mongoose.model("rpt_tpl_tree", RptTplTreeSchema, "rpt_tpl_tree");

+ 9 - 0
modules/bills_lib/controllers/bills_lib_controllers.js

@@ -168,6 +168,15 @@ module.exports = {
             callback(req, res, err, message, datas);
         });
     },
+    transferRecharge: async function (req, res) {
+        try {
+            let data = JSON.parse(req.body.data);
+            await billsLibDao.transferRecharge(data.billsLibId);
+            callback(req, res, 0, 'success', null);
+        } catch (error) {
+            callback(req, res, 1, error.message, null);
+        }
+    },
     getJobContent: function (req, res) {
         let data = JSON.parse(req.body.data);
         billsLibDao.getJobContent(data, function (err, message, jobs) {

+ 3 - 0
modules/bills_lib/controllers/bills_permissionController.js

@@ -69,6 +69,9 @@ class billsPermContr extends baseController {
     isUsed(req, res) {
         billsController.isUsed(req, res);
     }
+    transferRecharge(req, res) {
+        billsController.transferRecharge(req, res);
+    }
     /*
      * 导入标准清单(确定节点结构:深度数组)
      * */

+ 18 - 0
modules/bills_lib/models/bills_lib_interfaces.js

@@ -13,6 +13,7 @@ let moment = require("moment");
 let billsGuidanceLib = mongoose.model("std_billsGuidance_lib");
 const engLibModel = mongoose.model("engineering_lib");
 let uuid = require("uuid");
+let _ = require("lodash");
 let billsLibDao = function () { };
 
 billsLibDao.prototype.copyLib = async function (userName, libName, fromLibId) {
@@ -2570,6 +2571,23 @@ billsLibDao.prototype.isUsed = function (data, callback) {
   }
 };
 
+// 计算规则转移补注
+billsLibDao.prototype.transferRecharge = async function (billsLibId) {
+  const bills = await Bills.find({ billsLibId }).lean('-_id ID recharge ruleText');
+  const bulks = [];
+  bills.forEach(bill => {
+    if (bill.ruleText) {
+      bulks.push({ updateOne: { filter: { ID: bill.ID }, update: { $set: { recharge: `<p>${bill.ruleText}</p>`, ruleText: '' } } } });
+    }
+  });
+  const chunks = _.chunk(bulks, 1000);
+  for (const chunk of chunks) {
+    if (chunk.length) {
+      await Bills.bulkWrite(chunk);
+    }
+  }
+};
+
 //--------------JobContent------------------
 
 billsLibDao.prototype.getJobContent = function (gJobData, callback) {

+ 1 - 0
modules/bills_lib/routes/bills_lib_routes.js

@@ -60,6 +60,7 @@ module.exports = function (app) {
     billsRouter.post('/pasteRel', billsContr.auth, billsContr.init, billsContr.pasteRel);
     billsRouter.post("/deleteBills", billsContr.auth, billsContr.init, billsContr.deleteBills);
     billsRouter.post("/isUsed", billsContr.auth, billsContr.init, billsContr.isUsed);
+    billsRouter.post("/transferRecharge", billsContr.auth, billsContr.init, billsContr.transferRecharge);
 
     billsRouter.post("/getJobContent", jobsContr.auth, jobsContr.init, jobsContr.getJobContent);
     billsRouter.post("/createJobContent", jobsContr.auth, jobsContr.init, jobsContr.createJobContent);

+ 23 - 0
modules/common/const/bills_fixed.js

@@ -228,6 +228,22 @@ if (process.env.NODE_ENV.indexOf('hw') !== -1) {
         ADD_REQ_LAND: 198,
         // 国有土地
         NATIONAL_LAND: 199,
+        // 竣(交)工验收试验检测费
+        COMPLETION_DETECTION: 200,
+        // 预可、工可编制费
+        PRE_PERMIT_COMPILATION: 201,
+        // 水土保持评估费
+        SOLID_WATER_ASSESSMENT: 202,
+        // 地质灾害危险性评价费
+        GEO_DISASTER_RISK: 203,
+        // 节能评估费
+        ENERGY_CONSERVATION: 204,
+        // 社会稳定风险评估费
+        SOCIAL_STABILITY: 205,
+        // 建设项目其他费设置
+        CONSTRUCTION_OTHER_SETTING: 206
+
+
     };
 }
 
@@ -301,6 +317,13 @@ const fixedFlagList = [
     { name: '招标费用', value: fixedFlag.INVITATION },
     { name: '补征地', value: fixedFlag.ADD_REQ_LAND },
     { name: '国有土地', value: fixedFlag.NATIONAL_LAND },
+    { name: '竣(交)工验收试验检测费', value: fixedFlag.COMPLETION_DETECTION },
+    { name: '预可、工可编制费', value: fixedFlag.PRE_PERMIT_COMPILATION },
+    { name: '水土保持评估费', value: fixedFlag.SOLID_WATER_ASSESSMENT },
+    { name: '地质灾害危险性评价费', value: fixedFlag.GEO_DISASTER_RISK },
+    { name: '节能评估费', value: fixedFlag.ENERGY_CONSERVATION },
+    { name: '社会稳定风险评估费', value: fixedFlag.SOCIAL_STABILITY },
+    { name: '建设项目其他费设置', value: fixedFlag.CONSTRUCTION_OTHER_SETTING },
 ];
 
 export { fixedFlag as default, fixedFlagList as List };

+ 6 - 6
modules/ration_repository/models/ration_item.js

@@ -42,7 +42,7 @@ async function getIDMapping(counterName, data) {
 
 // 拷贝分类树
 async function copyClassData(sourceLibID, targetLibID) {
-    const sourceClassData = await stdRationSectionBackupModel.find({ rationRepId: sourceLibID }, '-_id').lean();
+    const sourceClassData = await stdRationSectionModel.find({ rationRepId: sourceLibID }, '-_id').lean();
     const IDMapping = await getIDMapping(counter.moduleName.rationTree, sourceClassData);
     const insertData = sourceClassData.map(item => ({
         ...item,
@@ -59,7 +59,7 @@ async function copyClassData(sourceLibID, targetLibID) {
 
 // 拷贝子目换算
 async function copyCoeData(sourceLibID, targetLibID) {
-    const sourceCoeData = await stdCoeBackupModel.find({ libID: sourceLibID }, '-_id').lean();
+    const sourceCoeData = await stdCoeModel.find({ libID: sourceLibID }, '-_id').lean();
     const IDMapping = await getIDMapping(counter.moduleName.coeList, sourceCoeData);
     const insertData = sourceCoeData.map(item => ({
         ...item,
@@ -75,11 +75,11 @@ async function copyCoeData(sourceLibID, targetLibID) {
 
 // 拷贝定额库
 rationItemDAO.prototype.copyLib = async function (sourceLibID, targetLibID, sourceGLJLibID, targetGLJLibID) {
-    const sourceRationData = await rationItemBackupModel.find({ rationRepId: sourceLibID }, '-_id').lean();
+    const sourceRationData = await rationItemModel.find({ rationRepId: sourceLibID }, '-_id').lean();
     const rationIDMapping = await getIDMapping(counter.moduleName.rations, sourceRationData);
     const classIDMapping = await copyClassData(sourceLibID, targetLibID);
     const coeIDMapping = await copyCoeData(sourceLibID, targetLibID);
-    const sourceGLJData = await stdGLJItemModelBackup.find({ repositoryId: sourceGLJLibID }, '-_id code ID').lean();
+    const sourceGLJData = await stdGLJItemModel.find({ repositoryId: sourceGLJLibID }, '-_id code ID').lean();
     const sourceGLJCodeMapping = {};
     sourceGLJData.forEach(glj => sourceGLJCodeMapping[glj.code] = glj.ID);
     const targetGLJData = await stdGLJItemModel.find({ repositoryId: targetGLJLibID }, '-_id code ID').lean();
@@ -115,7 +115,7 @@ rationItemDAO.prototype.copyLib = async function (sourceLibID, targetLibID, sour
 }
 
 rationItemDAO.prototype.handleGLJCode = async function (rationLibID, gljLibID) {
-    const rations = await _rationItemModelBackup.find({ rationRepId: rationLibID }, 'ID rationGljList').lean();
+    const rations = await rationItemModel.find({ rationRepId: rationLibID }, 'ID rationGljList').lean();
     const gljs = await stdGLJItemModel.find({ repositoryId: gljLibID }, 'ID code').lean();
     const gljMap = {};
     gljs.forEach(glj => gljMap[glj.ID] = glj.code);
@@ -134,7 +134,7 @@ rationItemDAO.prototype.handleGLJCode = async function (rationLibID, gljLibID) {
         }
     });
     if (bulks.length) {
-        await _rationItemModelBackup.bulkWrite(bulks);
+        await rationItemModel.bulkWrite(bulks);
     }
 }
 

+ 1 - 1
modules/std_glj_lib/controllers/viewsController.js

@@ -33,7 +33,7 @@ class ViewsController extends BaseController {
             let absoluteUrl = compilation.overWriteUrl ? req.app.locals.rootDir + compilation.overWriteUrl : req.app.locals.rootDir;
             overWriteUrl = fs.existsSync(absoluteUrl) && fs.statSync(absoluteUrl).isFile() ? compilation.overWriteUrl : null;
         }
-        // await gljDao.copyLib(7,24); //UAT 部颁2018 -> 部颁2018计价标准
+        // await gljDao.copyLib(37, 58); //UAT 部颁2018 -> 部颁2018计价标准
         // await gljDao.copyLib(7,25); //PROD 部颁2018 -> 部颁2018计价标准
         // await gljDao.copyLib(7,26); //PROD 部颁2018 -> 河南养护工料机库2022
 

+ 2 - 2
modules/std_glj_lib/models/gljModel.js

@@ -95,7 +95,7 @@ class GljDao extends OprDao {
     }
 
     async copyClassData(sourceLibID, targetLibID) {
-        const sourceClassData = await gljClassModelBackup.find({ repositoryId: sourceLibID }, '-_id').lean();
+        const sourceClassData = await gljClassModel.find({ repositoryId: sourceLibID }, '-_id').lean();
         const insertData = sourceClassData.map(item => ({
             ...item,
             repositoryId: targetLibID
@@ -106,7 +106,7 @@ class GljDao extends OprDao {
     }
 
     async copyGLJData(sourceLibID, targetLibID) {
-        const sourceGLJData = await gljModelBackup.find({ repositoryId: sourceLibID }, '-_id').lean();
+        const sourceGLJData = await gljModel.find({ repositoryId: sourceLibID }, '-_id').lean();
         const IDMapping = {};
         const countData = await counter.counterDAO.getIDAfterCount(counter.moduleName.GLJ, sourceGLJData.length);
         const countIdx = countData.sequence_value - (sourceGLJData.length - 1);

+ 12 - 12
web/maintain/bills_lib/scripts/bills_lib_ajax.js

@@ -15,7 +15,7 @@ var mainAjax = {
           $option.val(result.data[i]._id);
           $("#compilationSels").append($option); //
         }
-        $("#compilationSels").on("change", function () {});
+        $("#compilationSels").on("change", function () { });
       },
     });
   },
@@ -189,7 +189,7 @@ var billsAjax = {
         if (!result.error) {
           $(".navbar-text").append(
             "<a href='stdBillsmain'>清单规则</a><i class='fa fa-angle-right fa-fw'></i>" +
-              result.data[0].billsLibName
+            result.data[0].billsLibName
           );
         }
       },
@@ -394,7 +394,7 @@ var billsAjax = {
         }),
       },
       dataType: "json",
-      success: function (result) {},
+      success: function (result) { },
     });
   },
   updateSectionInfo: function (data, callback) {
@@ -424,7 +424,7 @@ var billsAjax = {
         }),
       },
       dataType: "json",
-      success: function (result) {},
+      success: function (result) { },
     });
   },
   updateSerialNo: function (billsLibId, billsId, updateArr, field, callback) {
@@ -527,7 +527,7 @@ var billsAjax = {
         }),
       },
       dataType: "json",
-      success: function (result) {},
+      success: function (result) { },
     });
   },
   pasteRel: function (
@@ -627,7 +627,7 @@ var jobsAjax = {
         }),
       },
       dataType: "json",
-      success: function (result) {},
+      success: function (result) { },
     });
   },
   deleteJobContent: function (lastOperator, billsLibId, ids) {
@@ -642,7 +642,7 @@ var jobsAjax = {
         }),
       },
       dataType: "json",
-      success: function (result) {},
+      success: function (result) { },
     });
   },
   pasteJobs: function (lastOperator, billsLibId, pasteDatas, callback) {
@@ -782,7 +782,7 @@ var designsAjax = {
         }),
       },
       dataType: "json",
-      success: function (result) {},
+      success: function (result) { },
     });
   },
   deleteDesignContent: function (lastOperator, billsLibId, ids) {
@@ -797,7 +797,7 @@ var designsAjax = {
         }),
       },
       dataType: "json",
-      success: function (result) {},
+      success: function (result) { },
     });
   },
   pasteDesigns: function (lastOperator, billsLibId, pasteDatas, callback) {
@@ -941,7 +941,7 @@ var itemsAjax = {
         }),
       },
       dataType: "json",
-      success: function (result) {},
+      success: function (result) { },
     });
   },
   updateValue: function (
@@ -966,7 +966,7 @@ var itemsAjax = {
         }),
       },
       dataType: "json",
-      success: function (reslut) {},
+      success: function (reslut) { },
     });
   },
   deleteItemCharacter: function (lastOperator, billsLibId, ids) {
@@ -981,7 +981,7 @@ var itemsAjax = {
         }),
       },
       dataType: "json",
-      success: function (result) {},
+      success: function (result) { },
     });
   },
   pasteItems: function (lastOperator, billsLibId, pasteDatas, callback) {

+ 21 - 0
web/maintain/bills_lib/scripts/db_controller.js

@@ -259,6 +259,17 @@ const pasteBlock = async (controller) => {
   $.bootstrapLoading.end();
 }
 
+// 计算规则转移补注
+const transferRecharge = async () => {
+  try {
+    $.bootstrapLoading.end();
+    await ajaxPost('/stdBillsEditor/transferRecharge', { billsLibId });
+    window.location.reload();
+  } catch (error) {
+    alert(error.message);
+  }
+  $.bootstrapLoading.end();
+}
 
 // 右键
 const onContextmenuOpr = (workBook, controller) => {
@@ -306,6 +317,16 @@ const onContextmenuOpr = (workBook, controller) => {
                 pasteBlock(controller);
               },
             },
+            handleRecharge: {
+              name: "计算规则转移补注",
+              disabled: function () {
+                return locked;
+              },
+              icon: "fa-exchange",
+              callback: function (key, opt) {
+                transferRecharge();
+              },
+            },
           },
         };
       } else {

+ 2 - 0
web/maintain/report/html/rpt_tpl_dtl_info.html

@@ -136,6 +136,8 @@
                         <option value="complexConstructMultiple">各阶段项目对比(3个建设项目,多对多对多)</option>
                         <option value="complexSelfConstructMultiple">各阶段项目对比(当前建设项目对本阶段对其他阶段)</option>
                         <option value="businessSummary">多个业务汇总</option>
+                        <option value="changeProjectSummary">变更业务对比汇总</option>
+                        <option value="changeProjectGljSummary">变更业务工料机对比汇总</option>
                     </select>
                     <label class="form-check-label" id="outputDesignDataBar" style="display: none;">
                         <input onchange="zTreeOprObj.onChangeFlag('outputDesignData', this)"  id="outputDesignData" type="checkbox">输出设计清单

+ 27 - 3
web/maintain/report/js/rpt_tpl_main.js

@@ -26,7 +26,6 @@ const valuationSelectorMap = {
   valuationSelector_changeBudget: "变更预算",
   valuationSelector_settlement: "结算",
 };
-
 let rptTplObj = {
   iniPage: function () {
     zTreeOprObj.getCompilationList();
@@ -190,6 +189,7 @@ let zTreeOprObj = {
         isDeleted: topNode.isDeleted,
         items: me.private_build_items(topNode.items, excludeNode),
         name: topNode.name,
+        UUID: topNode.UUID,
       };
     }
     return rst;
@@ -209,6 +209,7 @@ let zTreeOprObj = {
         released: isReleased,
         items: me.private_build_items(subNode.items, null),
         name: subNode.name,
+        UUID: subNode.UUID,
       };
       if (subNode.hasOwnProperty("flags")) {
         rst.flags = subNode.flags;
@@ -217,6 +218,17 @@ let zTreeOprObj = {
     return rst;
   },
 
+  generateRandomString() {
+    const charset =
+      "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
+    let randomString = "";
+    for (let i = 0; i < 10; i++) {
+      const randomIndex = Math.floor(Math.random() * charset.length);
+      randomString += charset[randomIndex];
+    }
+    return randomString;
+  },
+
   private_build_items: function (items, excludeNode) {
     let me = this,
       itemRst = null;
@@ -234,11 +246,14 @@ let zTreeOprObj = {
           ir.name = item.name;
           ir.ID = item.ID;
           ir.released = isReleased;
+          ir.UUID =
+            item.UUID ||
+            `${new Date().getTime()}_${this.generateRandomString()}`;
           if (item.hasOwnProperty("flags")) {
             ir.flags = item.flags;
           }
           // 同类表(associateRefIds)处理
-          if (item.hasOwnProperty('associateRefIds')) {
+          if (item.hasOwnProperty("associateRefIds")) {
             ir.associateRefIds = item.associateRefIds;
           }
           ir.items = me.private_build_items(item.items);
@@ -253,7 +268,12 @@ let zTreeOprObj = {
     let me = zTreeOprObj,
       sObj = $("#" + treeNode.tId + IDMark_Span);
 
-    if (treeNode.editNameFlag || $("#addBtn_" + treeNode.tId).length > 0 || treeNode.nodeType === RT.NodeType.TEMPLATE) return;
+    if (
+      treeNode.editNameFlag ||
+      $("#addBtn_" + treeNode.tId).length > 0 ||
+      treeNode.nodeType === RT.NodeType.TEMPLATE
+    )
+      return;
     if (treeNode.level === 0) {
       let addStr =
         "<span class='button star' id='addBtn_" +
@@ -1279,6 +1299,10 @@ let zTreeOprObj = {
                   $("#element_sumLv_flags")[0].selectedIndex = 15;
                 else if (sumLvType === "businessSummary")
                   $("#element_sumLv_flags")[0].selectedIndex = 16;
+                else if (sumLvType === "changeProjectSummary")
+                  $("#element_sumLv_flags")[0].selectedIndex = 17;
+                else if (sumLvType === "changeProjectGljSummary")
+                  $("#element_sumLv_flags")[0].selectedIndex = 18;
                 else {
                   $("#element_sumLv_flags")[0].selectedIndex = 0;
                 }