浏览代码

Merge branch 'master' of http://smartcost.f3322.net:3000/SmartCost/YangHuCost

TonyKang 6 年之前
父节点
当前提交
4bde0929e2
共有 32 个文件被更改,包括 655 次插入195 次删除
  1. 5 0
      modules/all_models/engineering_lib.js
  2. 0 4
      modules/all_models/project_glj.js
  3. 5 1
      modules/all_models/unit_price.js
  4. 1 0
      modules/all_models/unit_price_file.js
  5. 2 1
      modules/all_models/vehicle_vessel_tax_items.js
  6. 35 65
      modules/glj/controllers/glj_controller.js
  7. 80 3
      modules/glj/facade/glj_facade.js
  8. 42 15
      modules/glj/models/glj_list_model.js
  9. 7 3
      modules/glj/models/unit_price_model.js
  10. 3 0
      modules/glj/routes/glj_router.js
  11. 1 19
      modules/main/facade/ration_facade.js
  12. 1 1
      modules/pm/controllers/pm_controller.js
  13. 4 1
      modules/pm/models/project_model.js
  14. 53 29
      modules/ration_glj/facade/ration_glj_facade.js
  15. 11 1
      public/gljUtil.js
  16. 14 2
      public/web/common_ajax.js
  17. 7 0
      public/web/gljUtil.js
  18. 28 12
      public/web/slideResize.js
  19. 8 1
      web/building_saas/css/custom.css
  20. 13 0
      web/building_saas/css/main.css
  21. 55 27
      web/building_saas/glj/html/project_glj.html
  22. 2 1
      web/building_saas/js/global.js
  23. 1 0
      web/building_saas/main/html/main.html
  24. 4 0
      web/building_saas/main/js/main.js
  25. 31 1
      web/building_saas/main/js/models/project_glj.js
  26. 15 0
      web/building_saas/main/js/models/ration_glj.js
  27. 166 0
      web/building_saas/main/js/views/material_calc_view.js
  28. 50 4
      web/building_saas/main/js/views/project_glj_view.js
  29. 3 0
      web/building_saas/main/js/views/std_ration_lib.js
  30. 0 4
      web/building_saas/main/js/views/zmhs_view.js
  31. 1 0
      web/users/html/login.html
  32. 7 0
      web/users/js/login.js

+ 5 - 0
modules/all_models/engineering_lib.js

@@ -57,6 +57,11 @@ let modelSchema = {
         type: Schema.Types.Mixed,
         default: []
     },
+    //车船税文件
+    vvTax_lib: {
+        type: Schema.Types.Mixed,
+        default: []
+    },
     //设置人材机显示列
     glj_col:{
         showAdjustPrice:Boolean//是否显示调整价列

+ 0 - 4
modules/all_models/project_glj.js

@@ -104,10 +104,6 @@ let modelSchema = {
     },
     from:{type: String,default:'std'},//std, cpt  来自标准工料机库、补充工料机库
     //以下仅普通材料可用
-    grossWeightCoe: Number, //毛重系数
-    purchaseStorageRate: Number, //采购保管费率
-    offSiteTransportLossRate: Number, //场外运输损耗率
-    handlingLossRate: Number, //每增一次装卸损耗率
     ratio_data: Schema.Types.Mixed,
     remark:String
 };

+ 5 - 1
modules/all_models/unit_price.js

@@ -50,6 +50,10 @@ let modelSchema = {
     is_add:{
         type: Number,
         default: 0
-    }
+    },
+    grossWeightCoe: Number, //毛重系数
+    purchaseStorageRate: Number, //采购保管费率
+    offSiteTransportLossRate: Number, //场外运输损耗率
+    handlingLossRate: Number //每增一次装卸损耗率
 };
 mongoose.model(collectionName, new Schema(modelSchema, {versionKey: false, collection: collectionName}));

+ 1 - 0
modules/all_models/unit_price_file.js

@@ -23,6 +23,7 @@ let modelSchema = {
     user_id: String,
     // 顶层projectId
     root_project_id: Number,
+    vvTaxFileID:String,//车船税文件ID
     deleteInfo: deleteSchema
 };
 mongoose.model(collectionName, new Schema(modelSchema, {versionKey: false, collection: collectionName}));

+ 2 - 1
modules/all_models/vehicle_vessel_tax_items.js

@@ -15,8 +15,9 @@ const vehicleVesselTax = new Schema({
     ID: String,
     code: String,
     name: String,
-    spec: String,
+    specs: String,
     unit: String,
+    type: Number,
     vehicleVesselTax: Number, //车船税
     useTax: Number, //使用税
     useTaxMeasure: Number, //使用税计量吨

+ 35 - 65
modules/glj/controllers/glj_controller.js

@@ -15,10 +15,13 @@ let logger = require("../../../logs/log_helper").logger;
 let consts = require('../../main/models/project_consts');
 let glj_type_util = require('../../../public/cache/std_glj_type_util');
 let ration_glj_facade = require('../../ration_glj/facade/ration_glj_facade');
+let EngineeringLibModel = require("../../users/models/engineering_lib_model");
 let mongoose = require('mongoose');
 let ration = mongoose.model('ration');
 let projectModel = mongoose.model('projects');
 let _ = require('lodash');
+let glj_facade = require('../facade/glj_facade');
+let gljUtil = require('../../../public/gljUtil');
 
 
 const ProjectModel = require('../../pm/models/project_model').project;
@@ -190,10 +193,10 @@ class GLJController extends BaseController {
 
             let gljListModel = new GLJListModel();
             let result = await gljListModel.getCompositionList(projectGLJId, unitPriceFileId);
+
             if (result.length <= 0) {
                 throw '没有找到数据';
             }
-
             responseData.data = JSON.stringify(result);
         } catch (error) {
             console.log(error);
@@ -247,7 +250,6 @@ class GLJController extends BaseController {
             let mixRatioModel = new MixRatioModel();
             if(gljList.length > 0){
                 let [unitFileId,ext] = await ration_glj_facade.prepareExtData(gljList[0].project_id,request.session.sessionCompilation);
-                console.log(ext);
                 for(let g of gljList){
                     let newProjectGLJ = await projectGljModel.addList(g,unitFileId,ext);
                     let mixRatio = {
@@ -365,68 +367,7 @@ class GLJController extends BaseController {
             msg: ''
         };
         try {
-            let currentUnitPriceId = await ProjectModel.getUnitPriceFileId(projectId);
-            let unitPriceFileModel = new UnitPriceFileModel();
-
-            let insertData = null;
-            if (type > 0) {
-                let currentUnitPrice = await unitPriceFileModel.findDataByCondition({id: changeUnitPriceId});
-                if (currentUnitPrice === null) {
-                    throw '不存在对应单价文件';
-                }
-                // 获取当前项目的rootProjectId
-                let projectData = await ProjectModel.getProject(projectId);
-                let rootProjectId = projectData.property.rootProjectID !== undefined ? projectData.property.rootProjectID : 0;
-
-                insertData = JSON.parse(JSON.stringify(currentUnitPrice));
-                insertData.root_project_id = rootProjectId;
-                newName?insertData.name = newName:'';
-                insertData.user_id = insertData.user_id === undefined ? request.session.sessionUser.id : insertData.user_id;
-                delete insertData._id;
-                delete insertData.ID;
-            }
-            // 获取即将更改的单价文件信息
-            let targetUnitPriceFile = type === 0 ? await unitPriceFileModel.findDataByCondition({id: changeUnitPriceId}) :
-                await unitPriceFileModel.add(insertData);
-            if (targetUnitPriceFile === null) {
-                throw '没有找到对应的单价文件';
-            }
-
-            // 查找对应单价文件的项目工料机数据
-            let unitPriceModel = new UnitPriceModel();
-            if(type ===1){//从其它项目复制,则先复制一份数据。
-                let needCopyList = await unitPriceModel.findDataByCondition({unit_price_file_id: changeUnitPriceId}, null, false);
-                if(needCopyList){
-                    // 过滤mongoose格式
-                    needCopyList = JSON.stringify(needCopyList);
-                    needCopyList = JSON.parse(needCopyList);
-                    let copyList = [];
-                    for(let n of needCopyList){
-                        delete n._id;  // 删除原有id信息
-                        delete n.id;
-                        n.unit_price_file_id = targetUnitPriceFile.id;
-                        copyList.push(n);
-                    }
-                    copyList.length>0 ? await unitPriceModel.add(copyList):'';
-                }
-            }
-
-
-            let copyResult = await unitPriceModel.copyNotExist(currentUnitPriceId, targetUnitPriceFile.id,projectId);
-            // 复制成功后更改project数据
-            if (!copyResult) {
-                throw '复制数据失败';
-            }
-
-            let changeUnitPriceFileInfo = {
-                id: targetUnitPriceFile.id,
-                name: targetUnitPriceFile.name
-            };
-            let result = ProjectModel.changeUnitPriceFileInfo(projectId, changeUnitPriceFileInfo);
-            if (!result) {
-                throw '切换单价文件失败!';
-            }
-
+            responseData.unitFile = await glj_facade.changeUnitFile({projectID:projectId}, {id:changeUnitPriceId,name:newName},type,request.session.sessionUser.id);
         } catch (error) {
             console.log(error);
             responseData.err = 1;
@@ -436,6 +377,19 @@ class GLJController extends BaseController {
         response.json(responseData);
     }
 
+    async changeVvTaxFile(request, response){
+        let result={error:0};
+        try {
+            let data = JSON.parse(request.body.data);
+            await glj_facade.changeVvTaxFile(data);
+        }catch (err){
+            logger.err(err);
+            result.error=1;
+            result.message = err.message;
+        }
+        response.json(result);
+    }
+
     async checkUnitFileName(request, response){
         let result={
             error:0
@@ -782,6 +736,19 @@ class GLJController extends BaseController {
         res.json(result);
     }
 
+    async getVvTaxList(req,res){
+        let vvTxtList = [];
+        try {
+            let egnrModel = new EngineeringLibModel();
+            let egnr = await egnrModel.getEngineering(req.query.engineeringID);
+            vvTxtList = egnr.vvTax_lib;
+        }catch (err){
+            logger.err(err);
+        }
+        res.json(vvTxtList);
+
+    }
+
     async getProjectGLJsByProjectID(projectId){
         return await getGLJListByProjectID(projectId)
     }
@@ -829,13 +796,16 @@ async function getGLJListByProjectID(projectId){
         responseData.data.usedTenderList = usedTenderList;
         responseData.data.unitPriceMap = unitPriceMap;
         let gljTypeMap = glj_type_util.getStdGljTypeCacheObj().innerGljTypeObj;
+        let unitPriceFileModel = new UnitPriceFileModel();
+        let unitFileInfo =  await unitPriceFileModel.findDataByCondition({id: unitPriceFileId});
         responseData.data.constData = {
             materialIdList: gljListModel.materialIdList,
             ownCompositionTypes: gljListModel.ownCompositionTypes,
             roomId: unitPriceFileId,
             GLJTypeConst: JSON.stringify(GLJTypeConst),
             usedUnitPriceInfo: usedUnitPriceInfo,
-            gljTypeMap:gljTypeMap
+            gljTypeMap:gljTypeMap,
+            vvTaxFileID:unitFileInfo.vvTaxFileID
         };
     } catch (error) {
         console.log(error);

+ 80 - 3
modules/glj/facade/glj_facade.js

@@ -2,12 +2,24 @@
  * Created by zhang on 2019/1/2.
  */
 module.exports={ //先导出后require可以解决循环引用问题
-    changeUnitFile:changeUnitFile
+    changeUnitFile:changeUnitFile,
+    changeVvTaxFile:changeVvTaxFile,
+    addMixRatioForNew:addMixRatioForNew
 };
 
+const mongoose = require('mongoose');
 const ProjectModel = require('../../pm/models/project_model').project;
 import UnitPriceFileModel from "../models/unit_price_file_model";
 import UnitPriceModel from "../models/unit_price_model";
+import MixRatioModel from "../models/mix_ratio_model";
+import CounterModel from "../models/counter_model";
+import GLJListModel from '../../glj/models/glj_list_model';
+let std_glj_lib_gljList_model = mongoose.model('std_glj_lib_gljList');
+let ration_glj = require('../../ration_glj/facade/ration_glj_facade');
+
+let  vvTaxModel =  mongoose.model("std_vehicleVesselTax_items");
+let gljUtil = require('../../../public/gljUtil');
+let _ = require("lodash");
 
 async function changeUnitFile(projectData,unitFile,type,userID) {
     let projectId = projectData.projectID;
@@ -60,8 +72,6 @@ async function changeUnitFile(projectData,unitFile,type,userID) {
                 copyList.length>0 ? await unitPriceModel.add(copyList):'';
             }
         }
-
-
         let copyResult = await unitPriceModel.copyNotExist(currentUnitPriceId, targetUnitPriceFile.id,projectId);
         // 复制成功后更改project数据
         if (!copyResult) {
@@ -76,5 +86,72 @@ async function changeUnitFile(projectData,unitFile,type,userID) {
         if (!result) {
             throw '切换单价文件失败!';
         }
+        //处理车船税记录
+        await handleVvTaxForChang(targetUnitPriceFile.id,targetUnitPriceFile.vvTaxFileID);
         return changeUnitPriceFileInfo;
+}
+
+
+async function changeVvTaxFile(data){//对于车船税,现在只是在组成物表中插入信息,取项目工料机时虚拟一条车船况的记录。 因为车船税涉及到切换,清空,单价文件共用等复杂的情况,虚拟一条记录相对好一点。以后不合适可再修改
+    let unitFileID = data.unitFileID,newVvTaxFileID = data.newVvTaxFileID;
+    let unitPriceFileModel = new UnitPriceFileModel();
+    //先更新单价文件中车船税文件ID
+    await unitPriceFileModel.model.update({id:unitFileID},{vvTaxFileID:newVvTaxFileID});
+    await handleVvTaxForChang(unitFileID,newVvTaxFileID);
+}
+
+async function handleVvTaxForChang(unitFileID,newVvTaxFileID) {//切换车船税,选择共用的单价文件时调用
+    let mixRatioModel = new MixRatioModel();
+    if(!newVvTaxFileID || newVvTaxFileID == ''){//如果新的车船税ID为空,则删除组成物表中车船税的记录
+        await mixRatioModel.model.deleteMany({unit_price_file_id:unitFileID,code:'80CCS'});
+    }else {//如果是从空选择车船税或者是切换车船税,则要插入或修改车船税组成物信息
+        let vvTaxItems = await vvTaxModel.find({libID:newVvTaxFileID});
+        if(vvTaxItems.length <=0) return;
+        let allMixRatio = await mixRatioModel.model.find({unit_price_file_id:unitFileID});//先查出所有组成物
+        let mxiMap =  _.groupBy(allMixRatio,"connect_key");
+        let counterModel = new CounterModel();
+        let useMap = {},tasks = [];
+        for(let item of vvTaxItems){
+            let connect_key = gljUtil.getIndex(item);
+            if(mxiMap[connect_key]){//如果存在,说明要插入或更新车船税
+                let ccs = _.find(mxiMap[connect_key],{'code':'80CCS'});
+                if(ccs){//存在且不相等则更新
+                   if(ccs.consumption != item.vehicleVesselTax)  tasks.push({updateOne: {filter: {id: ccs.id}, update: {consumption: item.vehicleVesselTax}}});
+                }else {//不存在则插入
+                    let id = await counterModel.getId('mix_ratio');
+                    let newM = gljUtil.getBaseCCSMixRatio(unitFileID,item.vehicleVesselTax,connect_key);
+                    newM.id = id;
+                    tasks.push({insertOne: {document: newM}});
+                }
+                useMap[connect_key] = true;
+            }
+        }
+        //找出旧的车船税文件有的,新的车船税文件没有的,则删除该记录
+        for(let ckey in mxiMap){
+            if(useMap[ckey]) continue;
+            let deccs = _.find(mxiMap[ckey],{'code':'80CCS'});
+            if(deccs){
+                tasks.push( {deleteOne:{filter:{id: deccs.id}}});
+            }
+        }
+        if(tasks.length > 0) await mixRatioModel.model.bulkWrite(tasks);
+    }
+}
+
+//新增单价文件的同时,在项目工料机和空白的单价文件中先插入机械组成物等信息
+async function addMixRatioForNew(projectID,unitFileId,engineerID,ext){
+/*    1050001机械工	工日	机上人工/ 3003001	重油	kg	普通材料/ 3003002 汽油	93号	kg	普通材料
+    3003003	柴油	0号,-10号,-20号	kg	普通材料/  3003004	丙烷	kg	普通材料/ 3005001	煤	t	普通材料
+    3005002	电	kw·h	普通材料/  3005004	水	m3	普通材料/ 3005005	液化天然气	m3	普通材料
+     02JXF	折旧费	元	机械组成物/ 03WHF	检修费	元	机械组成物/    04ACFZF	维护费	元	机械组成物
+  05QT	安拆辅助费	元	机械组成物/ 80CCS	车船税	元	机械组成物*/
+    let mixCodes = ['1050001','3003001','3003002','3003003','3003004','3005001','3005002','3005004','3005005','02JXF','03WHF','04ACFZF','05QT','80CCS'];
+    let libID = await ration_glj.getGLJLibByEngineerID(engineerID);
+    let stdGljs = await std_glj_lib_gljList_model.find({'repositoryId':libID,'code':{'$in':mixCodes}});
+    let projectGljModel = new GLJListModel();
+    for (let glj of stdGljs){
+        let tem = {projectID:projectID};
+        ration_glj.setPropertyFromStd(tem,glj);
+        await projectGljModel.addList(ration_glj.getGLJSearchInfo(tem),unitFileId,ext);
+    }
 }

+ 42 - 15
modules/glj/models/glj_list_model.js

@@ -17,9 +17,12 @@ import MixRatioModel from "./mix_ratio_model";
 import GljModel from "../../complementary_glj_lib/models/gljModel";
 const ProjectModel = require('../../pm/models/project_model').project;
 const scMathUtil = require('../../../public/scMathUtil').getUtil();
+let gljUtil = require('../../../public/gljUtil');
 import decimal_facade from "../../main/facade/decimal_facade";
 let gljCollectionName = 'glj_list';
 let GLJSchemas = mongoose.model(gljCollectionName);
+let _ = require("lodash");
+let  vvTaxModel =  mongoose.model("std_vehicleVesselTax_items");
 
 class GLJListModel extends BaseModel {
 
@@ -118,10 +121,6 @@ class GLJListModel extends BaseModel {
                 if(this.ownCompositionTypes.indexOf(tmp.type)!=-1){
                     connect_keys.push(key);
                 }
-                /*if (tmp.type === GLJTypeConst.CONCRETE || tmp.type === GLJTypeConst.MORTAR ||
-                    tmp.type === GLJTypeConst.MIX_RATIO || tmp.type === GLJTypeConst.GENERAL_MACHINE|| tmp.type === GLJTypeConst.MAIN_MATERIAL){
-                    connect_keys.push(key);
-                }*/
             }
             // 查找组成物的消耗量
             let totalComposition = {};
@@ -407,6 +406,7 @@ class GLJListModel extends BaseModel {
             if(mixRatios&&mixRatios.length>0){
                 let newMixRatioData = [];
                 for(let m of mixRatios){
+                    if(m.code == '80CCS') continue; //忽略原来的组成物信息,重新查看有没有匹配的
                     let tem ={
                         consumption: m.consumption,
                         glj_id: m.glj_id,
@@ -420,6 +420,10 @@ class GLJListModel extends BaseModel {
                     };
                     newMixRatioData.push(tem);
                 }
+                if(glj.type == 301){//机械台班添加车船税
+                    let newM = await this.getCCSData(glj,unitPriceFileId);
+                    if(newM) newMixRatioData.push(newM);
+                }
                 mixInsertResult= await mixRatioModel.add(newMixRatioData);
             }
         }
@@ -526,6 +530,20 @@ class GLJListModel extends BaseModel {
 
         return index;
     }
+    //
+    async getCCSData(data,unitFileId){
+        let unitPriceFileModel = new UnitPriceFileModel();
+        let unitFileInfo =  await unitPriceFileModel.findDataByCondition({id: unitFileId});
+        if(unitFileInfo.vvTaxFileID && unitFileInfo.vvTaxFileID!=""){
+             let condition = {libID:unitFileInfo.vvTaxFileID,code:data.code,name:data.name,type:data.type,unit:data.unit,specs:data.specs};
+             let item =  await vvTaxModel.findOne(condition);
+             if(item){
+                 return gljUtil.getBaseCCSMixRatio(unitFileId,item.vehicleVesselTax,gljUtil.getIndex(data))
+             }
+        }
+        return null;
+    }
+
 
     /**
      * 工料机中组成物操作
@@ -566,13 +584,19 @@ class GLJListModel extends BaseModel {
                     connect_key: connect_key,
                     type: tmp.gljType,
                     code: tmp.code,
-                    specs:tmp.specs,
+                    specs:tmp.specs?tmp.specs:"",
                     name:tmp.name,
-                    unit:tmp.unit
+                    unit:tmp.unit?tmp.unit:''
                 };
                 mixRatioInsertData.push(mixRatioData);
             }
         }
+        //如果有车船税则加入到配合比表中 -- 先判断机械类型吧,所有都插入影响性能
+        if(data.type == 301){//如果是机械台班,看有没有车船税 - modifyGLJ方法里也会有添加组成物,修改这里逻辑时记得同步修改。
+            let newM = await this.getCCSData(data,unitPriceFileId);
+            if(newM) mixRatioInsertData.push(newM);
+        }
+
         // 插入配合比表
         // 因为有可能项目工料机与单价数据已存在,但配合比数据不存在,所以先插入配合比,后续判断如果存在项目工料机则可以省下数据库操作
         if(mixRatioInsertData.length>0){
@@ -596,17 +620,13 @@ class GLJListModel extends BaseModel {
                     project_id: projectId,
                     code: tmp.code,
                     name: tmp.name,
-                    specs: tmp.specs,
+                    specs: tmp.specs?tmp.specs:'',
                     unit: tmp.unit === undefined ? '' : tmp.unit,
                     type: tmp.gljType,
                     adjCoe:tmp.adjCoe,
                     original_code:tmp.code,
                     materialType: tmp.materialType,   //三材类别
                     materialCoe: tmp.materialCoe,
-                    grossWeightCoe:tmp.grossWeightCoe,
-                    purchaseStorageRate:tmp.purchaseStorageRate,
-                    offSiteTransportLossRate:tmp.offSiteTransportLossRate,
-                    handlingLossRate:tmp.handlingLossRate,
                     from:tmp.from
                 };
                 gljInsertData.push(gljData);
@@ -629,9 +649,13 @@ class GLJListModel extends BaseModel {
                 type: tmp.gljType,
                 short_name: tmp.shortName === undefined ? '' : tmp.shortName,
                 glj_id: tmp.ID,
-                specs: tmp.specs,
+                specs: tmp.specs?tmp.specs:'',
                 unit: tmp.unit === undefined ? '' : tmp.unit,
                 original_code:tmp.code,
+                grossWeightCoe:tmp.grossWeightCoe,
+                purchaseStorageRate:tmp.purchaseStorageRate,
+                offSiteTransportLossRate:tmp.offSiteTransportLossRate,
+                handlingLossRate:tmp.handlingLossRate
             };
             if(tmp.from=='cpt'){
                 unitPriceData.is_add = 1;
@@ -667,7 +691,6 @@ class GLJListModel extends BaseModel {
             if (projectGLJData.unit_price === null || allowType.indexOf(projectGLJData.unit_price.type) < 0) {
                 throw '找不到相关项目工料机';
             }
-
             // 查找对应的项目工料机数据配合比,单价数据
             let [gljData, mixRatioData,unitPriceData] = await this.getCompositionListByGLJ(projectGLJData, unitPriceFileId);
 
@@ -676,7 +699,6 @@ class GLJListModel extends BaseModel {
             }
 
             gljData = this.combineData(gljData, unitPriceData, [], mixRatioData);
-
             // 排序
             gljData.sort(function (a, b) {
                 return parseInt(a.code) - parseInt(b.code);
@@ -771,10 +793,15 @@ class GLJListModel extends BaseModel {
             let m_index = this.getIndex(tmp,['code','name','specs','unit','type']);
             mixRatioData[m_index]=tmp;
         }
+        //数组去重
+        codeList = _.uniq(codeList);
+        nameList = _.uniq(nameList);
+        specsList = _.uniq(specsList);
+        typeList=_.uniq(typeList);
+        unitList = _.uniq(unitList);
         // 查找对应的项目工料机数据
         let gcondition = {project_id: glj.project_id?glj.project_id:glj.projectID,code: {"$in": codeList}, name: {"$in": nameList},specs:{"$in": specsList},type:{"$in": typeList},unit:{"$in": unitList} };
         let gljData = await this.findDataByCondition(gcondition, {_id: 0}, false);
-
         // 查找对应的单价数据
         let unitPriceModel = new UnitPriceModel();
         let ucondition = { unit_price_file_id: unitPriceFileId,code: {"$in": codeList}, name: {"$in": nameList},specs:{"$in": specsList},type:{"$in": typeList},unit:{"$in": unitList}};

+ 7 - 3
modules/glj/models/unit_price_model.js

@@ -115,13 +115,17 @@ class UnitPriceModel extends BaseModel {
             market_price: data.market_price,
             unit_price_file_id: unitPriceFileId,
             name: data.name,
-            specs:data.specs,
+            specs:data.specs?data.specs:'',
             original_code:data.original_code,
-            unit:data.unit,
+            unit:data.unit?data.unit:'',
             type: data.type,
             short_name: data.shortName !== undefined ? data.shortName : '',
             glj_id: data.glj_id,
-            is_add:0
+            is_add:0,
+            grossWeightCoe:data.grossWeightCoe,
+            purchaseStorageRate:data.purchaseStorageRate,
+            offSiteTransportLossRate:data.offSiteTransportLossRate,
+            handlingLossRate:data.handlingLossRate
         };
         if(data.from=='cpt'){//如果是来自补充工料机,则都添加新增标记
             insertData.is_add=1;

+ 3 - 0
modules/glj/routes/glj_router.js

@@ -28,10 +28,13 @@ router.post('/batchUpdatePrices', gljController.init, gljController.batchUpdateP
 router.post('/batchUpdateGLJProperty', gljController.init, gljController.batchUpdateGLJProperty);
 router.post('/batchUpdateConsumption', gljController.init, gljController.batchUpdateConsumption);
 router.post('/modifyKeyValue',gljController.init, gljController.modifyKeyValue);
+router.post('/changeVvTaxFile',gljController.init, gljController.changeVvTaxFile);
 
+router.get('/getVvTaxList', gljController.init, gljController.getVvTaxList);
 router.get('/test', gljController.init, gljController.test);
 router.get('/testModify', gljController.init, gljController.testModify);
 router.get('/testDelete', gljController.init, gljController.delete);
 
+
 app.use('/glj',router);
 };

+ 1 - 19
modules/main/facade/ration_facade.js

@@ -432,25 +432,7 @@ async function addRationGLJ(std,newRation,compilation) {
                 }
             }
             if(std_glj){
-                newGLJ.name = std_glj.name;
-                newGLJ.code = std_glj.code;
-                newGLJ.original_code = std_glj.code;
-                newGLJ.unit = std_glj.unit;
-                newGLJ.specs = std_glj.specs;
-                newGLJ.model = std_glj.model;
-                newGLJ.basePrice = std_glj.basePrice;
-                newGLJ.marketPrice = std_glj.basePrice;
-                newGLJ.shortName = std_glj.shortName;
-                newGLJ.type = std_glj.gljType;
-                newGLJ.repositoryId = std_glj.repositoryId;
-                newGLJ.adjCoe = std_glj.adjCoe;
-                newGLJ.materialType = std_glj.materialType;
-                newGLJ.materialCoe = std_glj.materialCoe;
-                newGLJ.grossWeightCoe = std_glj.grossWeightCoe;
-                newGLJ.purchaseStorageRate = std_glj.purchaseStorageRate;
-                newGLJ.offSiteTransportLossRate = std_glj.offSiteTransportLossRate;
-                newGLJ.handlingLossRate = std_glj.handlingLossRate;
-                newGLJ.createType = 'normal';
+                ration_glj_facade.setPropertyFromStd(newGLJ,std_glj);
                 let info =  await ration_glj_facade.getInfoFromProjectGLJ(newGLJ,unitPriceFileId,ext);
                 newGLJ = ration_glj_facade.createNewRecord(info);
                 newRationGLJList.push(newGLJ);

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

@@ -77,7 +77,7 @@ module.exports = {
     },
     updateProjects: async function (req, res) {
         let data = JSON.parse(req.body.data);
-        await ProjectsData.updateUserProjects(req.session.sessionUser.id, req.session.sessionCompilation._id, req.session.sessionCompilation.name, data.updateData, function (err, message, data) {
+        await ProjectsData.updateUserProjects(req.session.sessionUser.id, req.session.sessionCompilation._id, req.session.sessionCompilation, data.updateData, function (err, message, data) {
             if (err === 0) {
                 callback(req, res, err, message, data);
             } else {

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

@@ -42,6 +42,7 @@ let labourCoeFacade = require('../../main/facade/labour_coe_facade');
 let calcProgramFacade = require('../../main/facade/calc_program_facade');
 let installationFacade = require('../../main/facade/installation_facade');
 let pmFacade = require('../facade/pm_facade');
+let gljFacade = require('../../glj/facade/glj_facade');
 let logger = require("../../../logs/log_helper").logger;
 let BillsModel = require("../../main/models/bills").model;
 let _ = require('lodash');
@@ -101,7 +102,7 @@ ProjectsDAO.prototype.getUserProject = function (userId, ProjId, callback) {
     });
 };
 
-ProjectsDAO.prototype.updateUserProjects = async function (userId, compilationId, compilationName, datas, callback) {
+ProjectsDAO.prototype.updateUserProjects = async function (userId, compilationId, compilation, datas, callback) {
     let data, project, updateLength = 0, hasError = false, deleteInfo = null, i, newProject;
     let updateAll = function (err) {
         if (!err) {
@@ -152,6 +153,8 @@ ProjectsDAO.prototype.updateUserProjects = async function (userId, compilationId
                         return;
                     }
                     data.updateData.property.unitPriceFile.id = addResult.id;
+                    //新增单价文件的同时,在项目工料机和空白的单价文件中先插入机械组成物等信息
+                    await gljFacade.addMixRatioForNew(data.updateData.ID,addResult.id,data.updateData.property.engineering_id,this.getExtendData(data.updateData.property,compilation));
                 }
                 if (data.updateData.projType === projectType.tender) {
                     //单价文件

+ 53 - 29
modules/ration_glj/facade/ration_glj_facade.js

@@ -2,6 +2,34 @@
  * Created by chen on 2017/6/29.
  */
 
+module.exports = {//先 exports再require 防止循环引用
+    save: save,
+    getData: getData,
+    deleteByRation: deleteByRation,
+    getQuantityByProjectGLJ: getQuantityByProjectGLJ,
+    getLibInfo: getLibInfo,
+    getGLJData: getGLJData,
+    getGLJDataByCodes:getGLJDataByCodes,
+    addGLJ: addGLJ,
+    deleteRationGLJ:deleteRationGLJ,
+    deleteGLJ:deleteGLJ,
+    insertAddTypeGLJ:insertAddTypeGLJ,
+    replaceGLJ: replaceGLJ,
+    replaceGLJByData:replaceGLJByData,
+    mReplaceGLJ: mReplaceGLJ,
+    updateRationGLJByEdit: updateRationGLJByEdit,
+    getGLJClass: getGLJClass,
+    insertGLJAsRation: insertGLJAsRation,
+    getRationTypeGLJQuantity:getRationTypeGLJQuantity,
+    getInfoFromProjectGLJ:getInfoFromProjectGLJ,
+    createNewRecord:createNewRecord,
+    getGLJSearchInfo:getGLJSearchInfo,
+    updateRationGLJFromDoc:updateRationGLJFromDoc,
+    getGLJLibByEngineerID:getGLJLibByEngineerID,
+    prepareExtData:prepareExtData,
+    setPropertyFromStd:setPropertyFromStd
+};
+
 let mongoose = require('mongoose');
 const uuidV1 = require('uuid/v1');
 let consts = require('../../main/models/project_consts')
@@ -32,33 +60,6 @@ let gljUtil = require('../../../public/gljUtil');
 
 
 
-module.exports = {
-    save: save,
-    getData: getData,
-    deleteByRation: deleteByRation,
-    getQuantityByProjectGLJ: getQuantityByProjectGLJ,
-    getLibInfo: getLibInfo,
-    getGLJData: getGLJData,
-    getGLJDataByCodes:getGLJDataByCodes,
-    addGLJ: addGLJ,
-    deleteRationGLJ:deleteRationGLJ,
-    deleteGLJ:deleteGLJ,
-    insertAddTypeGLJ:insertAddTypeGLJ,
-    replaceGLJ: replaceGLJ,
-    replaceGLJByData:replaceGLJByData,
-    mReplaceGLJ: mReplaceGLJ,
-    updateRationGLJByEdit: updateRationGLJByEdit,
-    getGLJClass: getGLJClass,
-    insertGLJAsRation: insertGLJAsRation,
-    getRationTypeGLJQuantity:getRationTypeGLJQuantity,
-    getInfoFromProjectGLJ:getInfoFromProjectGLJ,
-    createNewRecord:createNewRecord,
-    getGLJSearchInfo:getGLJSearchInfo,
-    updateRationGLJFromDoc:updateRationGLJFromDoc,
-    getGLJLibByEngineerID:getGLJLibByEngineerID,
-    prepareExtData:prepareExtData
-}
-
 let operationMap = {
     'ut_create': create_ration_glj,
     'ut_update': update_ration_glj,
@@ -589,8 +590,8 @@ function getGLJSearchInfo(ration_glj) {
         original_code: ration_glj.original_code,
         name: ration_glj.name,
         //shortName: ration_glj.shortName,
-        specs: ration_glj.specs,
-        unit: ration_glj.unit,
+        specs: ration_glj.specs?ration_glj.specs:'',
+        unit: ration_glj.unit?ration_glj.unit:'',
         type: ration_glj.subType ? ration_glj.subType : ration_glj.type,//如果有subType,则是通过插入定额级的工料机进来的
         model: ration_glj.model,
         type_of_work: ration_glj.subType ? ration_glj.subType : ration_glj.type,
@@ -624,6 +625,29 @@ async function prepareExtData(projectID,compilation) {
     return [unitFileId,ext];
 }
 
+function setPropertyFromStd(newGLJ,std_glj) {
+    newGLJ.GLJID = std_glj.ID;
+    newGLJ.name = std_glj.name;
+    newGLJ.code = std_glj.code;
+    newGLJ.original_code = std_glj.code;
+    newGLJ.unit = std_glj.unit;
+    newGLJ.specs = std_glj.specs;
+    newGLJ.model = std_glj.model;
+    newGLJ.basePrice = std_glj.basePrice;
+    newGLJ.marketPrice = std_glj.basePrice;
+    newGLJ.shortName = std_glj.shortName;
+    newGLJ.type = std_glj.gljType;
+    newGLJ.repositoryId = std_glj.repositoryId;
+    newGLJ.adjCoe = std_glj.adjCoe;
+    newGLJ.materialType = std_glj.materialType;
+    newGLJ.materialCoe = std_glj.materialCoe;
+    newGLJ.grossWeightCoe = std_glj.grossWeightCoe;
+    newGLJ.purchaseStorageRate = std_glj.purchaseStorageRate;
+    newGLJ.offSiteTransportLossRate = std_glj.offSiteTransportLossRate;
+    newGLJ.handlingLossRate = std_glj.handlingLossRate;
+    newGLJ.createType = 'normal';
+}
+
 
 async function addGLJ(rgList,compilation) {
     if (rgList.length <= 0) return {};

+ 11 - 1
public/gljUtil.js

@@ -20,7 +20,9 @@ module.exports = {
     isConcreteType:isConcreteType,
     isCommercialConcreteType:isCommercialConcreteType,
     getIndex:getIndex,
-    sortRationGLJ:sortRationGLJ
+    sortRationGLJ:sortRationGLJ,
+    getCCSProjectGLJ:getCCSProjectGLJ,
+    getBaseCCSMixRatio:getBaseCCSMixRatio
 };
 
 function calcProjectGLJQuantity(projectGLJDatas,rationGLJDatas,rationDatas,billsDatas,q_decimal) {
@@ -64,4 +66,12 @@ function isCommercialConcreteType(type){
 
 function sortRationGLJ(type) {
     return gljNodeUtil.sortRationGLJ(type);
+}
+
+function getCCSProjectGLJ(unitFileID,project_id) {
+    return gljNodeUtil.getCCSProjectGLJ(unitFileID,project_id);
+}
+
+function getBaseCCSMixRatio(unitFileID,consumption,connect_key) {
+    return gljNodeUtil.getBaseCCSMixRatio(unitFileID,consumption,connect_key)
 }

+ 14 - 2
public/web/common_ajax.js

@@ -188,7 +188,18 @@ async function ajaxPost(url, data) {
 
     });
 }
-
+async function ajaxGet(url,data){
+    return new Promise(function (resolve, reject) {
+        $.get(url,data,function (result,status) {
+            if(status == 'success'){
+                resolve(result);
+            }else {
+                reject(result);
+            }
+        },"json")
+    })
+   
+}
 
 /**
  * 在页面中任何嵌套层次的窗口中获取顶层窗口
@@ -206,6 +217,7 @@ function ajaxErrorInfo(jqXHR, textStatus, errorThrown) {
     if(textStatus == 'timeout'){
         alert('网络连接超时,请刷新您的网页。');
     }else {
-        alert('url: ' + url +' error ' + textStatus + " " + errorThrown);
+        alert('网络错误,请刷新您的网页。');
+        console.log(' error :' + textStatus + " " + errorThrown);
     }
 }

文件差异内容过多而无法显示
+ 7 - 0
public/web/gljUtil.js


+ 28 - 12
public/web/slideResize.js

@@ -17,18 +17,19 @@
 const SlideResize = (function() {
     //设置水平拖动条的宽度
     //@param {Object dom}resize滚动条
-    function setResizeWidth (resize) {
+    function setResizeWidth (resize,otherIndex) {
         const fixedWidth = 5;
         //滚动条节点 及 同层非滚动条节点的索引
         let bros = resize.parent().children();
-        let index = bros.index(resize),
-            otherIndex = index ? 0 : 1;
+       // let index = bros.index(resize),
+            otherIndex = otherIndex ? otherIndex : 1;
         const other = resize.parent().children(`:eq(${otherIndex})`);
         let resizeParentWidth = resize.parent().width();
         let resizeDecimalWidth = fixedWidth / resizeParentWidth,
             otherDecimalWidth = 1 - resizeDecimalWidth;
         if(bros.length > 2){ //当同层有多个子元素时,other 的宽度要排除其余的宽度
-            for(let i = 2; i< bros.length;i++){
+            for(let i = 1; i< bros.length;i++){
+                if(i == otherIndex) continue;
                 otherDecimalWidth = otherDecimalWidth - $(bros[i]).width()/resizeParentWidth
             }
         }
@@ -49,7 +50,7 @@ const SlideResize = (function() {
      * @param {Object}limit: min, max
      * @param {Function}callback 回调
      * */
-    function horizontalSlide(eleObj, limit, callback) {
+    function horizontalSlide(eleObj, limit, callback,otherIndex) {//otherIndex 材料计算,spread表格在最右加,要用这个来识别
         const triggerCBSize = 5;
         let drag = false,
             startPoint = 0,
@@ -79,12 +80,13 @@ const SlideResize = (function() {
                     rightPercentWidth = rightChange / eleObj.parent.width() * 100 + '%';
                 eleObj.left.css('width', leftPercentWidth);
                 eleObj.right.css('width', rightPercentWidth);
-                setResizeWidth(eleObj.resize);
-                mouseMoveCount += Math.abs(moveSize);
+                setResizeWidth(eleObj.resize,otherIndex);
+                callback();
+               /* mouseMoveCount += Math.abs(moveSize);
                 if (mouseMoveCount > triggerCBSize && callback) {
                     callback();
                     mouseMoveCount = 0;
-                }
+                }*/
             }
         });
         $('body').mouseup(function (e) {
@@ -100,7 +102,7 @@ const SlideResize = (function() {
         });
     }
 
-    function loadHorizonWidth(module, resizes, eles, callback) {
+    function loadHorizonWidth(module, resizes, eles, callback,otherIndex) {
         for (let ele of eles) {
             let cache = getLocalCache(`${module}${ele.attr('id')}Width`);
             if (cache) {
@@ -108,7 +110,7 @@ const SlideResize = (function() {
             }
         }
         for (let resize of resizes) {
-            setResizeWidth(resize);
+            setResizeWidth(resize,otherIndex);
         }
         if (callback) {
             callback();
@@ -157,7 +159,14 @@ const SlideResize = (function() {
                 //设置下部分div高度
                 eleObj.bottom.height(bottomChange);
                 //设置下部分div内spread高度
-                eleObj.bottomSpread.height(bottomChange - limit.notBottomSpread);
+                let notBottomHeight = limit.bottomNav?eval(limit.bottomNav):limit.notBottomSpread;
+                if(Array.isArray(eleObj.bottomSpread)){
+                    for(let b of eleObj.bottomSpread){
+                        b.height(bottomChange - notBottomHeight);
+                    }
+                }else {
+                    eleObj.bottomSpread.height(bottomChange - notBottomHeight);
+                }
                 mouseMoveCount += Math.abs(moveSize);
                 if (mouseMoveCount > triggerCBSize && callback) {
                     callback();
@@ -205,7 +214,14 @@ const SlideResize = (function() {
         eleObj.top.height(curTopHeight);
         eleObj.topSpread.height(curTopHeight - limit.notTopSpread);
         eleObj.bottom.height(curBottomHeight);
-        eleObj.bottomSpread.height(curBottomHeight - limit.notBottomSpread);
+        let notBottomHeight = limit.bottomNav?eval(limit.bottomNav):limit.notBottomSpread;
+        if(Array.isArray(eleObj.bottomSpread)){
+            for(let b of eleObj.bottomSpread){
+                b.height(curBottomHeight - notBottomHeight);
+            }
+        }else {
+            eleObj.bottomSpread.height(curBottomHeight - notBottomHeight);
+        }
         if (callback) {
             callback();
         }

+ 8 - 1
web/building_saas/css/custom.css

@@ -51,8 +51,15 @@ legend.legend{
     padding-left: 6px;
     padding-right: 6px;
     width: 98px;
+    float: left;
+    height: 100%;
+}
+.left {
+    float: left
+}
+.full-h{
+    height: 100%;
 }
-
 .filterType ul{
     width: 86px;
 }

+ 13 - 0
web/building_saas/css/main.css

@@ -367,6 +367,10 @@ a{
     height: 100%;
     border-left:1px solid #dee2e6 ;
 }
+.tn-nav,.cn-nav{
+    border-right:1px solid #dee2e6 ;
+    border-left:none;
+}
 .tn-nav > span{
     width:20px;
 }
@@ -397,6 +401,15 @@ a{
     border-right:1px solid #ccc;
     border-bottom:1px solid #ccc;
 }
+.cn-nav .nav-tabs .nav-link.active {
+    border:none;
+    background-color: #fff;
+    border-right:1px solid #fff;
+    margin-right:-1px;
+    border-top:1px solid #ccc;
+    border-left:1px solid #ccc;
+    border-bottom:1px solid #ccc;
+}
 .rn-nav .nav-tabs .nav-link span{
     display:none;
 }

+ 55 - 27
web/building_saas/glj/html/project_glj.html

@@ -8,47 +8,43 @@
         <label class="mx-2">使用单价文件:<span id="current-name"></span>(<label class="a_color" id="pop-used-list" data-original-title="" title="">与<span id="used-project-count">0</span>个单位工程同步</label>)
             <a class="btn btn-sm ml-1" href="#" data-toggle="modal" data-target="#change-unitFile"><i class="fa fa-exchange"></i> 选择其他</a>
             <a class="btn btn-sm ml-1" href="#" data-toggle="modal" data-target="#unitFile-save-as"><i class="fa fa-files-o"></i> 另存单独用</a></label>
-        <!--<div class="input-group input-group-sm mr-2">
-            <select class="form-control form-control-sm">
-                <option>车船税标准</option>
+        <div class="input-group input-group-sm mr-2">
+            <select class="form-control form-control-sm" id="vvTax">
+                <option value="">车船税标准</option>
                 <option>福建车船税标准(2012)</option>
             </select>
-        </div>-->
+        </div>
     </div>
 
 </div>
 
 <div class="container-fluid">
     <div class="row">
-        <div class="gl-side  filterType" id='filterType'>
-            <ul class="nav flex-column nav-pills mt-2 mb-2">
-                <li class="nav-item"><a class="nav-link active" href="#" id="ALL">所有工料机</a></li>
-
-              <!--  <li class="nav-item"><a class="nav-link" href="javascript:void(0)" id="FBFX">分部分项人材机</a></li>
-                <li class="nav-item"><a class="nav-link" href="javascript:void(0)" id="TECH">措施项目人材机</a></li>
-                <li class="nav-item"><a class="nav-link" href="javascript:void(0)" id="JGCL">甲供材料</a></li>
-                <li class="nav-item"><a class="nav-link" href="javascript:void(0)" id="ZGCL">暂估材料</a></li>
-                <li class="nav-item"><a class="nav-link" href="javascript:void(0)" id="SCHZ">三材汇总</a></li>
-                <li class="nav-item"><a class="nav-link" href="javascript:void(0)" id="ZYCL">主要材料</a></li>-->
-            </ul>
-        </div>
         <div class="main-content col p-0 " id="project-glj-main" style="overflow: hidden">
             <div class="top-content" id="projectGljTop" style="overflow: hidden;">
-                <div class="main-data-top" style="width: 100% " id="project_glj_sheet">
+                <div class="col-auto gl-side  filterType" id='filterType'>
+                    <ul class="nav flex-column nav-pills mt-2 mb-2">
+                        <li class="nav-item"><a class="nav-link active" href="#" id="ALL">所有工料机</a></li>
+
+                        <!--  <li class="nav-item"><a class="nav-link" href="javascript:void(0)" id="FBFX">分部分项人材机</a></li>
+                          <li class="nav-item"><a class="nav-link" href="javascript:void(0)" id="TECH">措施项目人材机</a></li>
+                          <li class="nav-item"><a class="nav-link" href="javascript:void(0)" id="JGCL">甲供材料</a></li>
+                          <li class="nav-item"><a class="nav-link" href="javascript:void(0)" id="ZGCL">暂估材料</a></li>
+                          <li class="nav-item"><a class="nav-link" href="javascript:void(0)" id="SCHZ">三材汇总</a></li>
+                          <li class="nav-item"><a class="nav-link" href="javascript:void(0)" id="ZYCL">主要材料</a></li>-->
+                    </ul>
                 </div>
+                <div class="main-data-top left" id="project_glj_sheet"></div>
             </div>
             <div class="resize-y" id="projectGljResize"></div>
             <div class="bottom-content" id="projectGljBottom">
-                <ul class="nav nav-tabs" role="tablist">
-                  <!--  <li class="nav-item">
-                        <a class="nav-link active" data-toggle="tab" data-name="ration_sheet" id="ration_link" href="#glj_de_div" role="tab">相关定额</a>
-                    </li>-->
-                   <!-- <li class="nav-item">
-                        <a class="nav-link active" data-toggle="tab" data-name="mix_ratio_sheet" id="mix_ratio_link" href="#ph_div" role="tab">组成物</a> 配合比、机械单价表合并
-                    </li>-->
-                   <!-- <li class="nav-item">
-                        <a class="nav-link" data-toggle="tab" data-name="machine_sheet" id="machine_ratio_link" href="#ph_div" role="tab">机械单价</a>
-                    </li>-->
+                <ul class="nav nav-tabs d-flex" role="tablist">
+                    <li class="nav-item">
+                       <!-- <a class="nav-link  show" id="calc-nav" data-toggle="tab" href="#mc" role="tab" aria-selected="true">材料计算</a>-->
+                    </li>
+                    <li class="nav-item">
+                        <a class="nav-link active" id="mixRatio-nav" data-toggle="tab" href="#ph_div" role="tab" aria-selected="false">组成物计算</a>
+                    </li>
                 </ul>
                 <!-- Tab panes -->
                 <div class="tab-content">
@@ -57,6 +53,38 @@
                             相关定额
                         </div>
                     </div>-->
+                    <div class="tab-pane container-fluid" id="mc" role="tabpanel">
+                        <div class="row">
+                            <div class="main-data-bottom ovf-hidden" id="materialCalcSheet" style="width: 55%"></div>
+                            <div class="main-data-bottom ovf-hidden full-h "  id="calcDiv" style="width: 45%">
+                                <div class="resize-x  ovf-hidden left full-h" id="mrResize"></div>
+                                <div class=" left full-h" style="width: 30px" >
+                                    <div class="rn-nav cn-nav d-flex align-items-start flex-column"id="calTab">
+                                        <ul class="nav nav-tabs">
+                                            <li class="nav-item"><a data-toggle="tab" href="#rnc-yf" role="tab" class="nav-link active">运费计算</a></li>
+                                            <li class="nav-item"><a data-toggle="tab" id="priceTab" href="#rnc-yj" role="tab" class="nav-link">原价计算</a></li>
+                                        </ul>
+                                    </div>
+                                </div>
+                                <div class=" left full-h" id="spreadTabDiv">
+                                    <div class="tab-content full-h">
+                                        <div class="tab-pane full-h active" id="rnc-yf">
+                                            <div class=" ovf-hidden full-h">
+                                                <div class="ovf-hidden full-h" id="freightSheet"></div>
+                                            </div>
+                                        </div>
+                                        <div class="tab-pane full-h" id="rnc-yj">
+                                            <div class="full-h ovf-hidden">
+                                                <div class="ovf-hidden full-h" id="priceSheet" style=""></div>
+                                            </div>
+                                        </div>
+                                    </div>
+                                </div>
+
+                            </div>
+
+                        </div>
+                 </div>
                     <div class="tab-pane active" id="ph_div" role="tabpanel">
                         <div class="main-data-bottom" id="mix_ratio_sheet" style="overflow:hidden">
                         </div>

+ 2 - 1
web/building_saas/js/global.js

@@ -32,7 +32,8 @@ function autoFlashHeight(){
     $(".form-view").height($(window).height()-headerHeight-ftoolsbarHeight);
     $(".form-list").height($(window).height()-headerHeight);
     $('#comments').find('textarea').height($('#comments').height() - 25);
-    $('#project-glj-main').width($(window).width()-($('.main-nav').width()+ 2)-($('.filterType').width()+12)-5); //2、12是padding宽度,width 是不算padding宽度的
+    $('#project-glj-main').width($(window).width()-($('.main-nav').width()+ 2));//-($('.filterType').width()+12)-5); //2、12是padding宽度,width 是不算padding宽度的
+    $('#project_glj_sheet').width($('#project-glj-main').width()-($('.filterType').width()+12)-1)//12是padding宽度,1是border宽度,width 是不算padding和border宽度的
     //typeof zmhs_obj === 'object' ? zmhs_obj.loadSideResize() : '';
 };
 

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

@@ -1952,6 +1952,7 @@
     <script type="text/javascript" src="/web/building_saas/main/js/views/project_property_labour_coe_view.js"></script>
     <script type="text/javascript" src="/web/building_saas/main/js/views/locate_view.js"></script>
     <script type="text/javascript" src="/web/building_saas/complementary_ration_lib/js/main.js"></script>
+    <script type="text/javascript" src="/web/building_saas/main/js/views/material_calc_view.js"></script>
     <script type="text/javascript" src="/public/web/storageUtil.js"></script>
     <!-- endinject -->
 

+ 4 - 0
web/building_saas/main/js/main.js

@@ -173,3 +173,7 @@ function show()
 window.onblur = function () {
   console.log("test")
 };*/
+//模态窗口可拖动设置
+/*$(document).on("show.bs.modal", ".modal", function(){
+    $(this).draggable();
+});*/

+ 31 - 1
web/building_saas/main/js/models/project_glj.js

@@ -18,7 +18,7 @@ function ProjectGLJ() {
  * @param {function} callback
  * @return {boolean}
  */
-ProjectGLJ.prototype.loadData = function (callback = null) {
+ProjectGLJ.prototype.loadData = function (callback = null,error=null) {
     let self = this;
     if (self.isLoading) {
         return false;
@@ -31,6 +31,7 @@ ProjectGLJ.prototype.loadData = function (callback = null) {
         data: {project_id: scUrlUtil.GetQueryString('project')},
         error: function () {
             // alert('数据传输错误');
+            if(error) error();
         },
         beforeSend: function () {
             self.isLoading = true;
@@ -40,6 +41,7 @@ ProjectGLJ.prototype.loadData = function (callback = null) {
             if (response.err === 1) {
                 let msg = response.msg !== undefined && response.msg !== '' ? response.msg : '读取人材机数据失败!';
                 alert(msg);
+                if(error) error();
                 return false;
             }
             self.datas = response.data;
@@ -54,6 +56,16 @@ ProjectGLJ.prototype.loadData = function (callback = null) {
     });
 };
 
+ProjectGLJ.prototype.synLoadData = function () {
+    return new Promise(function (resolve, reject) {
+        projectObj.project.projectGLJ.loadData(function (data) {
+            resolve(data)
+        },function () {
+            reject("获取工料机数据失败")
+        })
+    })
+}
+
 ProjectGLJ.prototype.loadToCache = function (data) {
     this.datas = data;
     projectObj.project.projectGLJ = this;
@@ -496,6 +508,7 @@ ProjectGLJ.prototype.getRatioData=function(id,callback){
 ProjectGLJ.prototype.changeFile = function (changeData,callback) {
     $.bootstrapLoading.start();
     CommonAjax.specialPost('/glj/change-file',changeData,function (response) {
+        projectObj.project.property.unitPriceFile = response.unitFile;
         projectObj.project.projectGLJ.loadData(function () {
             if(callback){
                 callback();
@@ -510,6 +523,23 @@ ProjectGLJ.prototype.changeFile = function (changeData,callback) {
     });
 };
 
+ProjectGLJ.prototype.changeVvTaxFile = async function (newVvTaxFileID,callback) {
+    $.bootstrapLoading.start();
+    try {
+        await ajaxPost("/glj/changeVvTaxFile",{unitFileID:projectObj.project.property.unitPriceFile.id,newVvTaxFileID:newVvTaxFileID});
+        await this.synLoadData();
+        projectGljObject.refreshDataSheet();
+        gljOprObj.refreshView();
+        projectObj.project.ration_glj.reCalcWhenVvTaxChange();
+        projectGljObject.onUnitFileChange();
+    }catch (err){
+        console.log(err);
+    }finally {
+        $.bootstrapLoading.end();
+    }
+};
+
+
 ProjectGLJ.prototype.addMixRatio = function(selections,callback){
     let gljList = [],allGLJ = gljOprObj.AllRecode;
     $("#glj_tree_div").modal('hide');

+ 15 - 0
web/building_saas/main/js/models/ration_glj.js

@@ -1029,6 +1029,21 @@ let ration_glj = {
                 project.calcProgram.calcAndSave(node);
             }
         };
+        ration_glj.prototype.reCalcWhenVvTaxChange = function () {
+            let rationIDs = [];
+            for(let g of this.datas){
+                if(g.type == gljType.GENERAL_MACHINE) rationIDs.push(g.rationID);
+            }
+            this.calcRationsByIDs(_.uniq(rationIDs))
+        };
+        ration_glj.prototype.calcRationsByIDs = function (rationIDs) {
+            let nodes = [];
+            for(let ID of rationIDs){
+                let node =  projectObj.project.mainTree.findNode(ID);
+                if(node) nodes.push(node)
+            }
+            project.calcProgram.calcNodesAndSave(nodes);
+        };
         return new ration_glj(project);
     }
 };

+ 166 - 0
web/building_saas/main/js/views/material_calc_view.js

@@ -0,0 +1,166 @@
+/**
+ * Created by zhang on 2019/3/11.
+ */
+materialCalcObj = {
+    moduleName:'materalCal',
+    materialSpread:null,
+    materialSheet:null,
+    materialDatas:[],
+    materialSetting:{
+        header:[
+            {headerName: "编号", headerWidth: 80, dataCode: "code", dataType: "String"},
+            {headerName: "名称", headerWidth: 100, dataCode: "name", dataType: "String"},
+            {headerName: "预算价", headerWidth: 70, dataCode: "marketPrice", hAlign: "right", dataType: "Number",validator:"number"},
+            {headerName: "供应地点", headerWidth: 100, dataCode: "unit", hAlign: "left", dataType: "String"},
+            {headerName: "原价", headerWidth: 45, dataCode: "originalPrice", hAlign: "center", dataType: "String"},
+            {headerName: "单位运费", headerWidth: 80, dataCode: "unitFreight", hAlign: "right", dataType: "Number",validator:"number"},//,decimalField:'glj.unitPrice'
+            {headerName: "单位毛重(吨)", headerWidth: 60, dataCode: "unitWeight", hAlign: "right", dataType: "Number"},//,decimalField:"glj.unitPrice"
+            {headerName: "装卸总次数", headerWidth: 50, dataCode: "totalLoadingTimes", hAlign: "right", dataType: "Number",validator:"number"},//,decimalField:"glj.unitPrice"
+            {headerName: "每增加一次装卸损耗率", headerWidth: 80, dataCode: "handlingLossRate", hAlign: "right", dataType: "Number",decimalField:"glj.quantity",validator:"number"},
+            {headerName: "场外运输损耗率", headerWidth: 60, dataCode: "offSiteTransportLossRate", hAlign: "right", dataType: "Number"},//,decimalField:"glj.unitPrice"
+            {headerName: "场外运输损耗", headerWidth: 60, dataCode: "offSiteTransportLoss", hAlign: "right", dataType: "Number"},//,decimalField:"glj.unitPrice"
+            {headerName: "采购及保管费率", headerWidth: 60, dataCode: "purchaseStorageRate", hAlign: "right", dataType: "Number"},//,decimalField:"glj.unitPrice"
+            {headerName: "采购及保管费", headerWidth: 60, dataCode: "purchaseStorage", hAlign: "right", dataType: "Number"},//,decimalField:"glj.unitPrice"
+            {headerName: "包装品回收价值", headerWidth: 60, dataCode: "packageRecoverValue", hAlign: "right", dataType: "Number"}//,decimalField:"glj.unitPrice"
+        ],
+        view: {
+            lockColumns: [0,1,2,3,4,5,6,7],
+            colHeaderHeight:45
+        }
+    },
+    freightSpread:null,
+    freightSheet:null,
+    freightDatas:[],
+    freightSetting:{
+        header:[
+            {headerName: "起讫地点", headerWidth: 80, dataCode: "start", dataType: "String"},
+            {headerName: "运输工具", headerWidth: 80, dataCode: "conveyance", dataType: "String"},
+            {headerName: "单位运价", headerWidth: 70, dataCode: "unitFreight", hAlign: "right", dataType: "Number",validator:"number"},
+            {headerName: "km运距", headerWidth: 50, dataCode: "kmDistance", hAlign: "left", dataType: "String"},
+            {headerName: "装卸费单价", headerWidth: 45, dataCode: "unitLoadingFee", hAlign: "center", dataType: "String"},
+            {headerName: "装卸次数", headerWidth: 80, dataCode: "loadingTimes", hAlign: "right", dataType: "Number",validator:"number"},//,decimalField:'glj.unitPrice'
+            {headerName: "其它费用", headerWidth: 60, dataCode: "otherFee", hAlign: "right", dataType: "Number"},//,decimalField:"glj.unitPrice"
+            {headerName: "运价增加率(%)", headerWidth: 80, dataCode: "freightIncreaseRate", hAlign: "right", dataType: "Number",validator:"number"},//,decimalField:"glj.unitPrice"
+            {headerName: "加权系数", headerWidth: 80, dataCode: "weightCoe", hAlign: "right", dataType: "Number",decimalField:"glj.quantity",validator:"number"},
+            {headerName: "计算式", headerWidth: 60, dataCode: "exp", hAlign: "right", dataType: "Number"},//,decimalField:"glj.unitPrice"
+        ],
+        view: {
+            lockColumns: [0,1,2,3,4,5,6,7],
+            colHeaderHeight:45
+        }
+    },
+    priceSpread:null,
+    priceSheet:null,
+    priceData:[],
+    priceSetting:{
+        header:[
+            {headerName: "供应地点", headerWidth: 80, dataCode: "start", dataType: "String"},
+            {headerName: "供应价", headerWidth: 70, dataCode: "unitFreight", hAlign: "right", dataType: "Number",validator:"number"},
+            {headerName: "加权系数", headerWidth: 80, dataCode: "loadingTimes", hAlign: "right", dataType: "Number",validator:"number"},//,decimalField:'glj.unitPrice'
+        ],
+        view: {
+            lockColumns: [0,1,2],
+            colHeaderHeight:45
+        }
+    },
+    initMaterialSpread:function () {
+        this.materialSpread = SheetDataHelper.createNewSpread($("#materialCalcSheet")[0]);
+        sheetCommonObj.spreadDefaultStyle(this.materialSpread);
+        this.materialSheet = this.materialSpread.getSheet(0);
+        sheetCommonObj.initSheet(this.materialSheet, this.materialSetting, 30);
+       /* this.materialSheet.bind(GC.Spread.Sheets.Events.EditEnded, this.onAssEditEnded);
+        this.materialSheet.bind(GC.Spread.Sheets.Events.RangeChanged, this.onAssRangeChanged);*/
+        this.materialSheet.name('material_calc');
+        if(projectReadOnly){
+            disableSpread(this.materialSpread);
+        }
+    },
+    initFreightSpread:function(){
+        this.freightSpread = SheetDataHelper.createNewSpread($("#freightSheet")[0]);
+        sheetCommonObj.spreadDefaultStyle(this.freightSpread);
+        this.freightSheet = this.freightSpread.getSheet(0);
+        sheetCommonObj.initSheet(this.freightSheet, this.freightSetting, 30);
+     /*   this.freightSheet.bind(GC.Spread.Sheets.Events.EditEnded, this.onAssEditEnded);
+        this.freightSheet.bind(GC.Spread.Sheets.Events.RangeChanged, this.onAssRangeChanged);*/
+        this.freightSheet.name('freight_calc');
+        if(projectReadOnly){
+            disableSpread(this.freightSpread);
+        }
+    },
+    initPriceSpread:function(){
+        this.priceSpread = SheetDataHelper.createNewSpread($("#priceSheet")[0]);
+        sheetCommonObj.spreadDefaultStyle(this.priceSpread);
+        this.priceSheet = this.priceSpread.getSheet(0);
+        sheetCommonObj.initSheet(this.priceSheet, this.priceSetting, 30);
+        /*   this.freightSheet.bind(GC.Spread.Sheets.Events.EditEnded, this.onAssEditEnded);
+         this.freightSheet.bind(GC.Spread.Sheets.Events.RangeChanged, this.onAssRangeChanged);*/
+        this.priceSheet.name('price_calc');
+        if(projectReadOnly){
+            disableSpread(this.priceSpread);
+        }
+    },
+    showFreightDatas:function () {
+        if(!$('#freightSheet').is(':visible')) return;
+        this.freightSheet.setRowCount(0);
+        sheetCommonObj.showData(this.freightSheet, this.freightSetting,this.freightDatas);
+    },
+    showMaterialCalcDatas:function(){
+        this.materialSheet.setRowCount(0);
+        sheetCommonObj.showData(this.materialSheet, this.materialSetting,this.materialDatas);
+        this.materialSheet.setRowCount(this.materialDatas.length);
+    },
+    showPriceDatas:function () {
+        if(!$('#priceSheet').is(':visible')) return;
+        this.priceSheet.setRowCount(0);
+        sheetCommonObj.showData(this.priceSheet, this.priceSetting,this.priceData);
+    },
+    showDatas:function(){
+        if(!$('#materialCalcSheet').is(':visible')) return;
+        if(!this.materialSpread) this.initMaterialSpread();
+        if(!this.freightSpread) this.initFreightSpread();
+        if(!this.priceSpread) this.initPriceSpread();
+        this.showMaterialCalcDatas();
+        this.showFreightDatas();
+        this.showPriceDatas();
+        projectGljObject.refreshSubViews();
+    },
+    getSideResize: function () {
+        let rg_sideResizeEles = {};
+        rg_sideResizeEles.eleObj = {
+            module: this.moduleName,
+            resize: $('#mrResize'),
+            parent: $('#projectGljBottom'),
+            left: $('#materialCalcSheet'),
+            right: $('#calcDiv')
+        };
+        rg_sideResizeEles.limit = {
+            min: 100,
+            max: `$('#projectGljBottom').width()-100`
+        };
+        return rg_sideResizeEles;
+    },
+    initTabWidth:function () {
+        if($("#mix_ratio_sheet").is(':visible')) return ;//如果是组成物计算界面,返回
+        let mr_sideResizeEles = this.getSideResize();
+        SlideResize.loadHorizonWidth(mr_sideResizeEles.eleObj.module,
+            [rg_sideResizeEles.eleObj.resize], [mr_sideResizeEles.eleObj.left, mr_sideResizeEles.eleObj.right],null,2);
+        $("#spreadTabDiv").width( $('#calcDiv').width() - mr_sideResizeEles.eleObj.resize.width() - 32)
+    }
+};
+$(function () {
+    $("#calc-nav").on('shown.bs.tab', function () {
+        materialCalcObj.initTabWidth();
+        projectGljObject.refreshSubViews();
+    });
+    $("#calTab ul li a").on('shown.bs.tab', function () {
+        materialCalcObj.showFreightDatas();
+        materialCalcObj.showPriceDatas();
+        projectGljObject.refreshSubViews();
+    });
+});
+
+let mr_sideResizeEles = materialCalcObj.getSideResize();
+SlideResize.horizontalSlide(mr_sideResizeEles.eleObj, mr_sideResizeEles.limit, function(){
+    $("#spreadTabDiv").width( $('#calcDiv').width() - mr_sideResizeEles.eleObj.resize.width() - 32);
+    projectGljObject.refreshSubViews();
+},2);

+ 50 - 4
web/building_saas/main/js/views/project_glj_view.js

@@ -644,7 +644,7 @@ projectGljObject={
     },
     displayTypeFilter:function (item) {
         let me = this;
-        if(item.quantity !== 0 && item.quantity !== '0'){//过滤掉消耗量为0的工料机
+        if(item.quantity !== 0 && item.quantity !== '0'&& item.code != '80CCS'){//过滤掉消耗量为0的工料机和车船税
             if(me.displayType == filterType.ALL){//所有工料机
                 return true;
             }else if(filterTypeArray.indexOf(me.displayType) != -1){//人工、材料、机械、主材、设备
@@ -1025,6 +1025,10 @@ projectGljObject={
                     callback: function (key, opt) {
                         let row = me.rightClickTarget.row;
                         me.deleteMixRatio(row);
+                    },
+                    visible: function(key, opt){
+                        let projectGLJ = projectGljObject.getProjectGLJSelected();
+                        return  projectGLJ && !gljUtil.isConcreteType(projectGLJ.type);
                     }
                 },
                 "addMixRatio":{
@@ -1037,6 +1041,10 @@ projectGljObject={
                     callback: function (key, opt) {
                         me.selectedProjectGLJ = projectGljObject.getProjectGLJSelected();
                         getGLJData('addMix');
+                    },
+                    visible: function(key, opt){
+                        let projectGLJ = projectGljObject.getProjectGLJSelected();
+                        return  projectGLJ && !gljUtil.isConcreteType(projectGLJ.type);
                     }
                 }
             }
@@ -1046,6 +1054,7 @@ projectGljObject={
         projectGljObject.unitPriceFileInit();
         projectGljObject.refreshDataSheet();
         gljOprObj.refreshView();
+        projectGljObject.initVvTax();
         projectObj.project.calcProgram.calcAllNodesAndSave(calcAllType.catAll,function () {
             if(socketObject.roomInfo){
                 let data ={
@@ -1090,6 +1099,28 @@ projectGljObject={
             htmlString += '<li class="nav-item li_sub"><a class="nav-link" href="javascript:void(0)" id="'+t.ID+'">'+t.text+'</a></li>';
         }
         $('#ALL').after(htmlString);
+    },
+    initVvTax:async function () {//初始化车船税选择
+        try {
+            let engineeringID = projectInfoObj.projectInfo.property.engineering_id;
+            let result =  await ajaxGet("/glj/getVvTaxList",{engineeringID:engineeringID});
+            let optionString = ` <option value="">车船税标准</option>`;
+            for(let r of result){
+                optionString += `<option value="${r.id}">${r.name}</option>`
+            }
+            $('#vvTax').empty();
+            $('#vvTax').html(optionString);
+            $('#vvTax').val(projectObj.project.projectGLJ.datas.constData.vvTaxFileID?projectObj.project.projectGLJ.datas.constData.vvTaxFileID:'');
+
+        }catch (e){
+            console.log(e)
+        }
+    },
+    refreshSubViews:function () {
+        if($("#mix_ratio_sheet").is(':visible')&&this.mixRatioSpread) this.mixRatioSpread.refresh();
+        if($('#materialCalcSheet').is(':visible')&&materialCalcObj.materialSpread) materialCalcObj.materialSpread.refresh();
+        if($('#freightSheet').is(':visible')&&materialCalcObj.freightSpread) materialCalcObj.freightSpread.refresh();
+        if($('#priceSheet').is(':visible')&&materialCalcObj.priceSpread) materialCalcObj.priceSpread.refresh();
     }
 };
 
@@ -1101,13 +1132,14 @@ function getProjectResizeEles() {
         top: $('#projectGljTop'),
         topSpread: $('#project_glj_sheet'),
         bottom: $('#projectGljBottom'),
-        bottomSpread: $('#mix_ratio_sheet')
+        bottomSpread: [$('#mix_ratio_sheet'),$('#materialCalcSheet'),$('#calcDiv')]
     };
     pojGljResizeEles.limit = {
         min: 150,
         max: `$(window).height()-$('.header').height()-$('#projectGljToolsBar').height()-150-5`,//5: resize.height()
         notTopSpread: 0,
         notBottomSpread: 0,
+        bottomNav:`$('#projectGljBottom ul').height()`,
         totalHeight: `$(window).height()-$('.header').height()-$('#projectGljToolsBar').height()-5`
     };
     return pojGljResizeEles;
@@ -1119,7 +1151,7 @@ function loadProjectGljSize() {
     let pojGljResizeEles = getProjectResizeEles();
     SlideResize.loadVerticalHeight(pojGljResizeEles.eleObj.module, pojGljResizeEles.eleObj, pojGljResizeEles.limit, function () {
         me.projectGljSpread?me.projectGljSpread.refresh():'';
-        me.mixRatioSpread?me.mixRatioSpread.refresh():'';
+        me.refreshSubViews()
     });
 }
 //从其他建设项目中复制中,建设项目的文件层次结构名称和顺序
@@ -1151,7 +1183,7 @@ $(function () {
     let pojGljResizeEles =  getProjectResizeEles();
     SlideResize.verticalSlide(pojGljResizeEles.eleObj, pojGljResizeEles.limit, function () {
         projectGljObject.projectGljSpread.refresh();
-        projectGljObject.mixRatioSpread?projectGljObject.mixRatioSpread.refresh():'';
+        projectGljObject.refreshSubViews();
     });
     $('#tab_project_glj').on('shown.bs.tab', function (e) {
         sessionStorage.setItem('mainTab', '#tab_project_glj');
@@ -1165,6 +1197,9 @@ $(function () {
         //projectObj.project.projectGLJ.calcQuantity(); 在工程量有更新的地方调用
         me.refreshDataSheet();
         loadProjectGljSize();
+        me.initVvTax();
+        materialCalcObj.initTabWidth();
+        materialCalcObj.showDatas();
     });
     /*  $('#ration_link').on('shown.bs.tab', function (e) {
      let me = projectGljObject;
@@ -1294,6 +1329,12 @@ $(function () {
             $(".option.copy").show();
         }
     });
+    $("#vvTax").change(function () {
+       let newVvTaxFileID = $(this).val();
+       console.log(newVvTaxFileID);
+        projectObj.project.projectGLJ.changeVvTaxFile(newVvTaxFileID);
+    });
+
     $("#unitFile-save-as").on('shown.bs.modal', function () {
         // 获取当前建设项数据
         $("#save-as-name").val(projectGljObject.usedUnitPriceInfo.name + '副本');
@@ -1376,6 +1417,11 @@ $(function () {
         me.displayType = filterType[this.id];
         me.refreshDataSheet();
     });
+
+    $("#mixRatio-nav").on('shown.bs.tab', function () {
+        projectGljObject.mixRatioSpread.refresh();
+    });
+
 });
 
 

+ 3 - 0
web/building_saas/main/js/views/std_ration_lib.js

@@ -216,6 +216,9 @@ var rationLibObj = {
             }
             //简化匹配到的定额名称
             for (let data of datas) {
+                if (!data.name) {
+                    continue;
+                }
                 //第一个空格前的字符串去进行匹配,没有则不匹配
                 let nameArr = data.name.split(' ');
                 if (nameArr.length <= 1) {

+ 0 - 4
web/building_saas/main/js/views/zmhs_view.js

@@ -577,8 +577,4 @@ let zmhs_obj = {
     }
 };
 
-/*let zmhsResize = zmhs_obj.getSideResize();
-SlideResize.horizontalSlide(zmhsResize.eleObj, zmhsResize.limit, function () {
-    zmhs_obj.refresh();
-});*/
 

+ 1 - 0
web/users/html/login.html

@@ -23,6 +23,7 @@
             </h1>
             <div class="form-group">
                 <input id="inputEmail" class="form-control " name="inputEmail" placeholder="通行账号 邮箱/手机" autofocus="" />
+                <small id="emailHelp" class="form-text text-danger"></small>
             </div>
             <div class="form-group">
                 <input id="inputPassword" class="form-control " name="inputPassword" placeholder="输入密码" type="password"/>

+ 7 - 0
web/users/js/login.js

@@ -130,6 +130,13 @@ $(document).ready(function () {
         cleanValidError($(this));
     });
 
+    $('#inputEmail').blur(function () {
+        let account = $("#inputEmail").val();
+        if(!/^1[3456789]\d{9}$/.test(account) && !/^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/.test(account)) {
+            $('#emailHelp').text('您输入的 邮箱/手机 格式不对');
+        }
+    });
+
     $(".form-control").on('input', function () {
         $('#hint').html('&nbsp;');
     });