Переглянути джерело

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

TonyKang 4 роки тому
батько
коміт
6645bdaa53

Різницю між файлами не показано, бо вона завелика
+ 21 - 2
config/config.js


+ 3 - 1
config/db/db_manager.js

@@ -48,7 +48,9 @@ module.exports = {
     },
     connect:function (env="local") {
         var config = require("../config.js");
-        var dbURL = 'mongodb://' + config[env].server + ":" + config[env].port + '/scConstruct';
+        let dbname = 'scConstruct';
+        if(config[env].dbname) dbname = config[env].dbname;
+        var dbURL = 'mongodb://' + config[env].server + ":" + config[env].port + '/'+dbname;
         if(config[env].dbURL){
             mg.connect(config[env].dbURL,{connectTimeoutMS: 100000,useMongoClient: true});
         } else if(config[env].options){

+ 6 - 2
modules/common/const/bills_type.js

@@ -11,13 +11,17 @@ const typeFlag = {
     //分项
     FX: 3,
     //清单    
-    BILLS: 4
+    BILLS: 4,
+    CS : 6, // 分类
+    DT : 7 // 费用明细
 }
 const typeFlagList = [
     {name: '大项费用', value: typeFlag.DXFY},
     {name: '分部', value: typeFlag.FB},
     {name: '分项', value: typeFlag.FX},
-    {name: '清单', value: typeFlag.BILLS}
+    {name: '清单', value: typeFlag.BILLS},
+    {name: '分类', value: typeFlag.CS},
+    {name: '费用明细', value: typeFlag.DT}
 ];
 
 export {typeFlag as default, typeFlagList as List};

+ 3 - 0
modules/users/controllers/login_controller.js

@@ -14,6 +14,7 @@ import crypto from "crypto";
 import Test1Model from "../../../test/models/test1_model";
 import Test2Model from "../../../test/models/test2_model";
 import Test3Model from "../../../test/models/test3_model";
+let config = require("../../../config/config.js");
 
 class LoginController extends BaseController {
 
@@ -25,8 +26,10 @@ class LoginController extends BaseController {
      * @return {void|Mixed}
      */
     index(request, response) {
+        let title =  config[process.env.NODE_ENV].title?config[process.env.NODE_ENV].title:'养护云版';
         let renderData = {
             layout: false,
+            title:title
         };
         let managerSessionData = request.session.managerData;
         if (managerSessionData !== undefined) {

+ 11 - 0
modules/users/models/engineering_lib_model.js

@@ -10,6 +10,7 @@ import BaseModel from "../../common/base/base_model";
 import CompilationModel from "./compilation_model";
 let stdRationLibModel = mongoose.model("std_ration_lib_map");
 import {default as EngineeringConst, List as EngineeringList} from "../../common/const/engineering";
+const billsGuidanceLibModel = mongoose.model('std_billsGuidance_lib');
 
 class EngineeringLibModel extends BaseModel {
     /**
@@ -114,6 +115,16 @@ class EngineeringLibModel extends BaseModel {
         let result = false;
         data = this.filterLibData(data);
         try {
+            // 处理清单指引
+            if (data.billsGuidance_lib && data.billsGuidance_lib.length) {
+                const billsGuidanceLibIDs = data.billsGuidance_lib.map(item => item.id);
+                const billsGuidanceLibs = await billsGuidanceLibModel.find({ ID: { $in: billsGuidanceLibIDs } }, '-_id ID type').lean();
+                const libTypeMap = {};
+                billsGuidanceLibs.forEach(lib => libTypeMap[lib.ID] = lib.type);
+                data.billsGuidance_lib.forEach(lib => {
+                    lib.type = libTypeMap[lib.id] || 1;
+                });
+            }
             let engineeringLib = await this.findDataByCondition({_id:engineerId});
             if(engineeringLib){
                 // 存在则直接更新

+ 7 - 1
operation.js

@@ -81,9 +81,11 @@ app.use(function (req, res, next) {
 
 //加载路由文件
 fileUtils.getGlobbedFiles('./modules/**/routes/*.js').forEach(function(modelPath) {
+    console.log(modelPath);
     require(path.resolve(modelPath))(app);
 });
 
+
 app.use(function(req, res, next) {
     res.status(404).send('404 Error');
 });
@@ -131,6 +133,10 @@ schedule.scheduleJob({hour: 0, minute: 1}, function(){
 //     })
 // });
 
-app.listen(6080, function () {
+
+let startPort = 6080;
+if(config[process.env.NODE_ENV].startPort) startPort = config[process.env.NODE_ENV].startPort;
+console.log(startPort);
+app.listen(startPort, function () {
     console.log("server started!");
 });

+ 1 - 1
web/users/views/login/index.html

@@ -19,7 +19,7 @@
 <body class="loginbody">
 <div class="wraplogin">
     <div class="loginTop">
-        <a title="返回首页" href="#">建筑造价后台</a>
+        <a title="返回首页" href="#"><%= title %>后台</a>
     </div>
     <div class="loginItem  center-block">
         <div class="loginForm">