zhongzewei преди 6 години
родител
ревизия
0ce76044a5

+ 4 - 0
modules/pm/controllers/pm_controller.js

@@ -23,6 +23,7 @@ const userModel = mongoose.model('user');
 let config = require("../../../config/config.js");
 const optionModel = mongoose.model('options');
 const stdBillsGuidanceLibModel = mongoose.model('std_billsGuidance_lib');
+const fs = require('fs');
 
 //统一回调函数
 let callback = function(req, res, err, message, data){
@@ -262,10 +263,13 @@ module.exports = {
         let rationValuation = sessionCompilation.ration_valuation !== undefined ?
             sessionCompilation.ration_valuation : [];
         rationValuation = await engineeringLibModel.getLib(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 renderData = {
             userAccount: request.session.userAccount,
             userID: request.session.sessionUser.id,
             compilationData: JSON.stringify(sessionCompilation),
+            overWriteUrl: overWriteUrl,
             billValuation: JSON.stringify(billValuation),
             rationValuation: JSON.stringify(rationValuation),
             engineeringList: JSON.stringify(engineering.List),

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

@@ -713,11 +713,11 @@ async function getFullPath(projectID) {
     }
 }
 
-async function getProjectFeature(libID,engineerName){
+async function getProjectFeature(libID,feeStandardName){
     let lib = await featureLibModel.findOne({'ID':libID})
     if(lib){
         let eng = _.find(lib.feature,{'key':'engineering'})
-        if(eng) eng.value = engineerName;
+        if(eng) eng.value = feeStandardName;
         return lib.feature;
     }else {
         return [];

+ 1 - 1
modules/pm/models/project_model.js

@@ -170,7 +170,7 @@ ProjectsDAO.prototype.updateUserProjects = async function (userId, compilationId
                     //工程特征
                     if(data.updateData.property.featureLibID){
                         //工程专业显示费用定额的名称
-                        data.updateData.property.projectFeature = await pmFacade.getProjectFeature(data.updateData.property.featureLibID, compilationName);
+                        data.updateData.property.projectFeature = await pmFacade.getProjectFeature(data.updateData.property.featureLibID, data.updateData.property.feeStandardName);
                     }
                     /*projectFeature[0]['value'] = data.updateData.property.engineeringName || '';
                     data.updateData.property.projectFeature = projectFeature;*/

+ 1 - 0
server.js

@@ -26,6 +26,7 @@ cfgCacheUtil.setupDftCache();
 
 let app = express();
 let _rootDir = __dirname;
+app.locals.rootDir = _rootDir;
 log.use(app);
 app.use(express.static(_rootDir));
 

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

@@ -440,6 +440,13 @@
                         </div>
                     </div>
                     <span class="form-text text-danger" id="valuation-info" style="display: none;">请选择计价规则</span>
+                    <div class="form-group row" id="regionDiv" style="display: none;">
+                        <label for="staticEmail" class="col-auto col-form-label col-form-label-sm">地&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;区</label>
+                        <div class="col">
+                            <select class="form-control  form-control-sm" id="regionSels">
+                            </select>
+                        </div>
+                    </div>
                     <div class="form-group row">
                         <label for="staticEmail" class="col-auto col-form-label col-form-label-sm">工程专业</label>
                         <div class="col">
@@ -684,6 +691,9 @@
 <script type="text/javascript" src="/lib/ztree/jquery.ztree.excheck.js"></script>
 <script src="/lib/jquery-contextmenu/jquery.contextMenu.min.js"></script>
 <!-- endinject -->
+<% if (overWriteUrl != undefined) { %>
+    <script type="text/javascript" src="<%= overWriteUrl%>"></script>
+<% } %>
 
 </body>
 <script type="text/javascript">

+ 25 - 2
web/building_saas/pm/js/pm_newMain.js

@@ -5,7 +5,6 @@
  * @date 2017/8/22
  * @version
  */
-//todo: 全部、分享、回收站树统一
 let Tree = null;//
 let movetoZTree = null;
 let copytoZTree = null;
@@ -30,6 +29,12 @@ let taxTypeMap = {
     2:"简易计税"
 };
 
+/*
+* 地区,同一费用定额下不同地区有不同单价,则新建单位工程时需要选择地区项
+* 地区项为空的时候,前端不显示该下拉项,地区的赋值覆盖在over_write相关文件中
+* */
+let regions = [];
+
 function isDef(v) {
     return typeof v !== 'undefined' && v !== null;
 }
@@ -1308,6 +1313,15 @@ $(document).ready(function() {
         return rst;
     }
 
+    //设置地区选项
+    function setRegionOpts (regions) {
+        $('#regionDiv').find('select').empty();
+        for(let region of regions){
+            let $opt = $(`<option value = "${region}">${region}</option>`);
+            $('#regionDiv').find('select').append($opt);
+        }
+    }
+
     // 新增单位工程弹层改变
     $('#add-tender-dialog').on('show.bs.modal', function() {
         //clear info
@@ -1324,6 +1338,11 @@ $(document).ready(function() {
         let projs = getProjs(selected);
         setProjOptions(projs, selected);
         $($("input[name='valuation_type']")[0]).click();
+        //设置地区选项
+        if(regions.length > 0){
+            setRegionOpts(regions);
+            $('#regionDiv').show();
+        }
         setTimeout(function () {
             $('#tender-name')[0].focus();
         }, 300);
@@ -2431,6 +2450,8 @@ function AddTender() {
 
         };
         let selectedItem = projTreeObj.tree.selected;
+        //地区
+        let region = $('#regionDiv').find('select').val() || '';
         let tenderInfo = {
             valuation: valuation,
             valuationType: valuationType,
@@ -2440,13 +2461,15 @@ function AddTender() {
             projectEngineering:libs.projectEngineering,//单位工程默认取费专业(造价书中插入量价、工料机时用)
             engineering_id: libs._id,
             engineeringName: engineeringName,
+            feeStandardName: feeName,
             unitPriceFile: {name: unitPriceFileObj.name, id: unitPriceFileObj.id},
             feeFile: {name: feeFileObj.name, id: feeFileObj.id},
             calcProgram: {name: calcProgramName, id: calcProgram},
             taxType:taxType,
             templateLibID:templateLibID,
             colLibID:colLibID,
-            featureLibID:featureLibID
+            featureLibID:featureLibID,
+            region: region
         };
         AddTenderItems(selectedItem, projName, engName, tenderName, tenderInfo, callback);
 

+ 21 - 1
web/over_write/js/chongqing_2018.js

@@ -289,7 +289,27 @@ if(typeof figureClassTemplate !== 'undefined'){
 if(typeof $ !== 'undefined' && $('#cbClassList')){
     $('#cbClassList').find('li:eq(5)').remove();
 }
-
+//测试地区============
+/*if(typeof regions !== 'undefined') {
+    regions = [
+        '兰州',
+        '定西',
+        '天水',
+        '平凉',
+        '庆阳',
+        '武威',
+        '金昌',
+        '张掖',
+        '酒泉',
+        '甘矿',
+        '嘉峪关',
+        '临夏',
+        '合作',
+        '武都',
+        '白银',
+    ];
+}*/
+//==============
 
 
 

+ 30 - 0
web/over_write/js/gansu_2013.js

@@ -0,0 +1,30 @@
+'use strict';
+
+/**
+ *
+ *
+ * @author Zhong
+ * @date 2018/10/11
+ * @version
+ */
+
+if(typeof region !== 'undefined') {
+    region = [
+        '兰州',
+        '定西',
+        '天水',
+        '平凉',
+        '庆阳',
+        '武威',
+        '金昌',
+        '张掖',
+        '酒泉',
+        '甘矿',
+        '嘉峪关',
+        '临夏',
+        '合作',
+        '武都',
+        '白银',
+    ];
+    console.log(region);
+}