소스 검색

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

chenshilong 5 년 전
부모
커밋
160e727fc6

+ 4 - 0
modules/all_models/user.js

@@ -34,6 +34,10 @@ let upgrade = mongoose.Schema({
         type:String,
         default: '',
     },
+    lock: { // 锁信息 1:借出(借用);2:销售(购买);
+        type: Number,
+        default: 0,
+    }
 }, { _id: false })
 
 const userdList = mongoose.Schema({

+ 1 - 1
modules/users/controllers/boot_controller.js

@@ -32,7 +32,7 @@ class BootController extends BaseController {
             // 判断当前用户的是使用免费版还是专业版
             compilationVersion = await userModel.getVersionFromUpgrade(sessionUser.ssoId, compilationId);
             request.session.compilationVersion = compilationVersion.version;
-            request.session.sessionUser.compilationDeadline = compilationVersion.deadline;
+            request.session.sessionUser.compilationLock = compilationVersion.lock;
             request.session.sessionCompilation = compilationData;
             if(sessionUser.latest_used !== compilationId) userModel.updateLatestUsed(sessionUser.id,compilationId);
         }

+ 2 - 0
modules/users/controllers/cld_controller.js

@@ -110,6 +110,7 @@ class CLDController {
         let deadline = request.body.deadline || '';
         let status = parseInt(request.body.status);
         let smssend = parseInt(request.body.smssend);
+        let lock = parseInt(request.body.lock);// 0.默认、1.借出(借用)、2.销售(购买)
         try {
 
             let userModel = new UserModel();
@@ -136,6 +137,7 @@ class CLDController {
                 isUpgrade: status !== 2,
                 remark: '',
                 deadline: deadline,
+                lock: lock,
             };
 
             if (upgradeIndex === -1) {

+ 2 - 2
modules/users/controllers/login_controller.js

@@ -103,7 +103,7 @@ class LoginController {
                     // 判断当前用户的是使用免费版还是专业版
                     let compilationVersion = await userModel.getVersionFromUpgrade(sessionUser.ssoId, preferenceSetting.select_version);
                     request.session.compilationVersion = compilationVersion.version;
-                    request.session.sessionUser.compilationDeadline = compilationVersion.deadline;
+                    request.session.sessionUser.compilationLock = compilationVersion.lock;
                     request.session.sessionCompilation = compilationData;
                     if(request.session.sessionUser.latest_used !== preferenceSetting.select_version) await userModel.updateLatestUsed(request.session.sessionUser.id,preferenceSetting.select_version);
                 }
@@ -278,7 +278,7 @@ class LoginController {
                 // 判断当前用户的是使用免费版还是专业版
                 let compilationVersion = await userModel.getVersionFromUpgrade(sessionUser.ssoId, preferenceSetting.select_version);
                 request.session.compilationVersion = compilationVersion.version;
-                request.session.sessionUser.compilationDeadline = compilationVersion.deadline;
+                request.session.sessionUser.compilationLock = compilationVersion.lock;
                 request.session.sessionCompilation = compilationData;
                 if(request.session.sessionUser.latest_used !== preferenceSetting.select_version) await userModel.updateLatestUsed(request.session.sessionUser.id,preferenceSetting.select_version);
             }

+ 5 - 3
modules/users/controllers/user_controller.js

@@ -31,7 +31,7 @@ class UserController extends BaseController {
         let sessionUser = request.session.sessionUser;
 
         let userModel = new UserModel();
-        let userData = await userModel.findDataByName(sessionUser.username);
+        let userData = await userModel.findDataBySsoId(sessionUser.ssoId);
         userData = Object.keys(userData).length <= 0 ? [] : userData;
 
         let renderData = {
@@ -98,7 +98,7 @@ class UserController extends BaseController {
             // 获取当前用户信息
             let sessionUser = request.session.sessionUser;
             let userModel = new UserModel();
-            userData = await userModel.findDataByName(sessionUser.username);
+            userData = await userModel.findDataBySsoId(sessionUser.ssoId);
 
             let page = request.query.page === undefined ? 1 : request.query.page;
 
@@ -157,6 +157,8 @@ class UserController extends BaseController {
                     });
                     if (oneCompilationIndex !== -1) {
                         compilationList[oneCompilationIndex].isUpgrade = userUpgradeList[index].isUpgrade;
+                        compilationList[oneCompilationIndex].deadline = userUpgradeList[index].deadline;
+                        compilationList[oneCompilationIndex].lock = userUpgradeList[index].lock;
                     }
                 }
             }
@@ -241,7 +243,7 @@ class UserController extends BaseController {
                 let userModel = new UserModel();
                 let compilationVersion = await userModel.getVersionFromUpgrade(sessionUserData.ssoId, compilationData._id);
                 request.session.compilationVersion = compilationVersion.version;
-                request.session.sessionUser.compilationDeadline = compilationVersion.deadline;
+                request.session.sessionUser.compilationLock = compilationVersion.lock;
                 request.session.sessionCompilation = compilationData;
             }
         } catch (error) {

+ 4 - 4
modules/users/models/user_model.js

@@ -349,7 +349,7 @@ class UserModel extends BaseModel {
     async getVersionFromUpgrade(ssoId, compilationId) {
         let title = config[process.env.NODE_ENV].title?config[process.env.NODE_ENV].title:"纵横公路养护云造价";
         let version = title+'(学习版)';//'纵横公路养护造价(免费云版)'; 2019-03-28 需求修改,听说不知道多久的以后还会改回来--勿删!!!!!
-        let deadline = '';
+        let lock = 0;
         let userData = await this.findDataBySsoId(ssoId);
         if (userData.upgrade_list !== undefined) {
             let compilationInfo = userData.upgrade_list.find(function (item) {
@@ -357,12 +357,12 @@ class UserModel extends BaseModel {
             });
             if (compilationInfo !== undefined && compilationInfo.isUpgrade === true) {
                 version = title+'(专业版)';
-                if (compilationInfo.deadline !== undefined && compilationInfo.deadline !== '') {
-                    deadline = compilationInfo.deadline;
+                if (compilationInfo.lock !== undefined && compilationInfo.lock !== 0) {
+                    lock = compilationInfo.lock;
                 }
             }
         }
-        return {version: version, deadline: deadline};
+        return {version: version, lock: lock};
     }
 
     /**

BIN
web/building_saas/img/vip.png


BIN
web/building_saas/img/vip2.png


+ 1 - 1
web/building_saas/standard_interface/export/anhui_maanshan.js

@@ -65,7 +65,7 @@ INTERFACE_EXPORT = (() => {
         { name: 'Xmmc', value: projectName }, // 项目名称
         { name: 'Bzlx', value: '清单' }, // 项目编制类型
         { name: 'Jjyj', value: '【18清单】2018部颁清单计价依据' }, // 计价依据
-        { name: 'Xmqzzh', value: getValueByKey(information, 'startAndChainages') }, // 项目起止桩号
+        { name: 'Xmqzzh', value: getValueByKey(information, 'startEndChainages') }, // 项目起止桩号
         { name: 'Jsdw', value: getValueByKey(information, 'constructingUnits') }, // 建设单位
         { name: 'Czzt', value: czzt[exportKind] }, // 操作状态:招标、投标、招标控制,即导出接口时,所选的文件类型
         { name: 'Jsfs', value: taxModeMap[getValueByKey(information, 'taxMode')] || '1', type: TYPE.INT }, // 计税方式,默认1。1=一般计税 2=简易计税

+ 59 - 53
web/building_saas/standard_interface/export/guangdong_zhongshan.js

@@ -744,9 +744,11 @@ INTERFACE_EXPORT = (() => {
       let feature = tenderProject.property.projectFeature ? tenderProject.property.projectFeature : [];
       let totalItem = null;
       let proItem = null; //暂列金额项
+      let safeItem = null;
       for (let b of bills) {
         if (b.flagsIndex && b.flagsIndex.fixed && b.flagsIndex.fixed.flag == fixedFlag.TOTAL_COST) totalItem = b;
         if (b.flagsIndex && b.flagsIndex.fixed && b.flagsIndex.fixed.flag == fixedFlag.PROVISIONAL) proItem = b;
+        if(b.code == "102-3" && b.name=="安全生产费") safeItem = b;
       }
 
       const attrs = [{
@@ -758,8 +760,11 @@ INTERFACE_EXPORT = (() => {
           value: totalItem.feesIndex && totalItem.feesIndex.common && totalItem.feesIndex.common.tenderTotalFee ? totalItem.feesIndex.common.tenderTotalFee : 0,
         },
       ];
+      //输出控制价、投标文件时,取调价后的标段总造价。
+      //输出招标文件时,取0
+      if (isBidInvitation) attrs[1].value = 0;
       Element.call(this, "EprjInfo", attrs);
-      this.children.push(new SummaryOfCost(totalItem, proItem,feature));
+      this.children.push(new SummaryOfCost(totalItem, proItem,safeItem,feature));
       this.children.push(new MakeInfo(tenderProject));
       this.children.push(new Params(tenderProject));
       this.children.push(new getBillsItems(tenderProject));
@@ -909,6 +914,7 @@ INTERFACE_EXPORT = (() => {
             if (data.quantityCoe["machine"]) MechRatio = data.quantityCoe["machine"];
           }
 
+          //fail: { hint: '错误提示', type: '提示所属(基本就是单位工程名称)' }
           const attrs = [{
               name: "ListCode",
               value: data.code,
@@ -995,7 +1001,7 @@ INTERFACE_EXPORT = (() => {
             },
             {
               name: "FomulaCode",
-              value: "",
+              value: ""
             },
           ];
 
@@ -1202,18 +1208,18 @@ INTERFACE_EXPORT = (() => {
           function CostStructure(item) {
             let CostStructure = new emptyElement('CostStructure');
             for (let f of cpFeeTypes) {
-              if (item.feesIndex && item.feesIndex[f.type] && itemFeeMap[f.type]) CostStructure.children.push(new CostItem(item.feesIndex[f.type]));
+              if(itemFeeMap[f.type]) CostStructure.children.push(new CostItem(item,f.type))
             }
-
-            function CostItem(fee) {
+            if (CostStructure.children.length == 0) CostStructure.children.push(new CostItem({},""))
+            function CostItem(item,type) {
               const attrs = [{
                 name: "ItemNo",
-                value: itemFeeMap[fee.fieldName],
+                value: itemFeeMap[type],
               }, {
                 name: 'Sum',
                 value: 0 //fee.tenderTotalFee
               }]
-              if (isBidSubmission) attrs[1].value = fee.tenderTotalFee;
+              if (isBidSubmission && item.feesIndex && item.feesIndex[type]) attrs[1].value = item.feesIndex[type].tenderTotalFee;
               Element.call(this, "CostItem", attrs);
             }
             return CostStructure;
@@ -1228,36 +1234,36 @@ INTERFACE_EXPORT = (() => {
       let feature = tenderProject.property.projectFeature ? tenderProject.property.projectFeature : [];
       let featrueMap = {};
       for (let f of feature) {
-        featrueMap[f.dispName] = f;
+        featrueMap[f.key] = f;
       }
       let BuildType = "";
-      if (featrueMap["建设性质"] == 0) BuildType = "新建";
-      if (featrueMap["建设性质"] == 1) BuildType = "改(扩)建";
+      if (featrueMap["buildType"] == 0) BuildType = "新建";
+      if (featrueMap["buildType"] == 1) BuildType = "改(扩)建";
       let Terrain = "";
-      if (featrueMap["地形类别"] == 0) Terrain = "平原微丘陵区";
-      if (featrueMap["地形类别"] == 1) Terrain = "山岭重丘陵区";
+      if (featrueMap["terrainCategory"] == 0) Terrain = "平原微丘陵区";
+      if (featrueMap["terrainCategory"] == 1) Terrain = "山岭重丘陵区";
       let DesignSpeed = "";
-      if (featrueMap["设计时速"] == 0) DesignSpeed = "高速公路";
-      if (featrueMap["设计时速"] == 1) DesignSpeed = "一级公路";
-      if (featrueMap["设计时速"] == 2) DesignSpeed = "二级公路";
-      if (featrueMap["设计时速"] == 3) DesignSpeed = "三级公路";
-      if (featrueMap["设计时速"] == 4) DesignSpeed = "四级公路";
+      if (featrueMap["designSpeed"] == 0) DesignSpeed = "高速公路";
+      if (featrueMap["designSpeed"] == 1) DesignSpeed = "一级公路";
+      if (featrueMap["designSpeed"] == 2) DesignSpeed = "二级公路";
+      if (featrueMap["designSpeed"] == 3) DesignSpeed = "三级公路";
+      if (featrueMap["designSpeed"] == 4) DesignSpeed = "四级公路";
       let Structure = "";
-      if (featrueMap["路面结构"] == 0) Structure = "沥青路面";
-      if (featrueMap["路面结构"] == 1) Structure = "水泥混凝土路面";
-      if (featrueMap["路面结构"] == 2) Structure = "其他类型路面";
+      if (featrueMap["structure"] == 0) Structure = "沥青路面";
+      if (featrueMap["structure"] == 1) Structure = "水泥混凝土路面";
+      if (featrueMap["structure"] == 2) Structure = "其他类型路面";
 
       const attrs = [{
           name: "PrjArea",
-          value: featrueMap["工程所在地"] ? featrueMap["工程所在地"].value : "",
+          value: featrueMap["projAddress"] ? featrueMap["projAddress"].value : "",
         },
         {
           name: "StartPileNo",
-          value: featrueMap["起点桩号"] ? featrueMap["起点桩号"].value : "",
+          value: featrueMap["startStation"] ? featrueMap["startStation"].value : "",
         },
         {
           name: "EndPileNo",
-          value: featrueMap["终点桩号"] ? featrueMap["终点桩号"].value : "",
+          value: featrueMap["endingStation"] ? featrueMap["endingStation"].value : "",
         },
         {
           name: "BuildType",
@@ -1269,7 +1275,7 @@ INTERFACE_EXPORT = (() => {
         },
         {
           name: "RoadGrade",
-          value: featrueMap["公路等级"] ? featrueMap["公路等级"].value : "",
+          value: featrueMap["roadGrade"] ? featrueMap["roadGrade"].value : "",
         },
         {
           name: "DesignSpeed",
@@ -1281,41 +1287,41 @@ INTERFACE_EXPORT = (() => {
         },
         {
           name: "SubgradeWidth",
-          value: featrueMap["路基宽度"] ? featrueMap["路基宽度"].value : "",
+          value: featrueMap["subgradeWidth"] ? featrueMap["subgradeWidth"].value : "",
         },
         {
           name: "RoadLength",
-          value: featrueMap["路线长度"] ? featrueMap["路线长度"].value : "",
+          value: featrueMap["roadLength"] ? featrueMap["roadLength"].value : "",
         },
         {
           name: "BridgeLength",
-          value: featrueMap["桥梁长度"] ? featrueMap["桥梁长度"].value : "",
+          value: featrueMap["bridgeLength"] ? featrueMap["bridgeLength"].value : "",
         },
         {
           name: "TunnelLength",
-          value: featrueMap["隧道长度"] ? featrueMap["隧道长度"].value : "",
+          value: featrueMap["tunnelLength"] ? featrueMap["tunnelLength"].value : "",
         },
         {
           name: "BriTunRate",
-          value: featrueMap["桥隧比"] ? featrueMap["桥隧比"].value : "",
+          value: featrueMap["briTunRate"] ? featrueMap["briTunRate"].value : "",
         },
         {
           name: "InterchangeNum",
-          value: featrueMap["互通式立交数"] ? featrueMap["互通式立交数"].value : "",
+          value: featrueMap["interchangeNum"] ? featrueMap["interchangeNum"].value : "",
         },
         {
           name: "StubLengths",
-          value: featrueMap["支线、联络线长度"] ? featrueMap["支线、联络线长度"].value : "",
+          value: featrueMap["stubLengths"] ? featrueMap["stubLengths"].value : "",
         },
         {
           name: "LaneLength",
-          value: featrueMap["辅道、连接线长度"] ? featrueMap["辅道、连接线长度"].value : "",
+          value: featrueMap["laneLength"] ? featrueMap["laneLength"].value : "",
         },
       ];
       Element.call(this, "Params", attrs);
     }
 
-    function SummaryOfCost(totalItem, proItem,feature) {
+    function SummaryOfCost(totalItem, proItem,safeItem,feature) {
       let attrs = [{
           name: "TenderSumLimit",
           value: totalItem.feesIndex && totalItem.feesIndex.common && totalItem.feesIndex.common.tenderTotalFee ? totalItem.feesIndex.common.tenderTotalFee : 0,
@@ -1330,7 +1336,7 @@ INTERFACE_EXPORT = (() => {
         },
         {
           name: "CostForHSE",
-          value: 0,
+          value: safeItem&&safeItem.feesIndex && safeItem.feesIndex.common && safeItem.feesIndex.common.tenderTotalFee ? safeItem.feesIndex.common.tenderTotalFee : 0,
         },
         {
           name: "ProvisionalSums",
@@ -1357,8 +1363,8 @@ INTERFACE_EXPORT = (() => {
         dispName: "基本信息",
       });
       for (let i of baseInfo.items) {
-        let key = i.dispName;
-        if (i.dispName == "编制日期") key = "编制时间";
+        let key = i.key;
+        //if (i.dispName == "编制日期") key = "编制时间";
         baseMap[key] = i;
       }
 
@@ -1368,71 +1374,71 @@ INTERFACE_EXPORT = (() => {
         },
         {
           name: "Manage",
-          value: baseMap["建设单位"] ? baseMap["建设单位"].value : "",
+          value: baseMap["constructingUnits"] ? baseMap["constructingUnits"].value : "",
         },
         {
           name: "Designer",
-          value: baseMap["设计单位"] ? baseMap["设计单位"].value : "",
+          value: baseMap["designUnits"] ? baseMap["designUnits"].value : "",
         },
         {
           name: "Compile",
-          value: baseMap["编制单位"] ? baseMap["编制单位"].value : "",
+          value: baseMap["establishUnit"] ? baseMap["establishUnit"].value : "",
         },
         {
           name: "CompileApprover",
-          value: baseMap["编制人"] ? baseMap["编制人"].value : "",
+          value: baseMap["tenderCompiler"] ? baseMap["tenderCompiler"].value : "",
         },
         {
           name: "CompileCertNo",
-          value: baseMap["编制人证书号"] ? baseMap["编制人证书号"].value : "",
+          value: baseMap["authorNo"] ? baseMap["authorNo"].value : "",
         },
         {
           name: "CompileDate",
-          value: baseMap["编制时间"] ? baseMap["编制时间"].value : "",
+          value: baseMap["establishDate"] ? baseMap["establishDate"].value : "",
         },
         {
           name: "Review",
-          value: baseMap["复核单位"] ? baseMap["复核单位"].value : "",
+          value: baseMap["reviewUnit"] ? baseMap["reviewUnit"].value : "",
         },
         {
           name: "ReviewApprover",
-          value: baseMap["复核人"] ? baseMap["复核人"].value : "",
+          value: baseMap["tenderExaminer"] ? baseMap["tenderExaminer"].value : "",
         },
         {
           name: "ReviewCertNo",
-          value: baseMap["复核人证书"] ? baseMap["复核人证书"].value : "",
+          value: baseMap["certificateReviewer"] ? baseMap["certificateReviewer"].value : "",
         },
         {
           name: "ReviewDate",
-          value: baseMap["复核日期"] ? baseMap["复核日期"].value : "",
+          value: baseMap["reviewTime"] ? baseMap["reviewTime"].value : "",
         },
         {
           name: "Examine",
-          value: baseMap["审核单位"] ? baseMap["审核单位"].value : "",
+          value: baseMap["auditUnit"] ? baseMap["auditUnit"].value : "",
         },
         {
           name: "ExamineApprover",
-          value: baseMap["审核人"] ? baseMap["审核人"].value : "",
+          value: baseMap["auditor"] ? baseMap["auditor"].value : "",
         },
         {
           name: "ExamineCertNo",
-          value: baseMap["审核人证书"] ? baseMap["审核人证书"].value : "",
+          value: baseMap["auditorNo"] ? baseMap["auditorNo"].value : "",
         },
         {
           name: "ExamineDate",
-          value: baseMap["审核日期"] ? baseMap["审核日期"].value : "",
+          value: baseMap["reviewTime"] ? baseMap["reviewTime"].value : "",
         },
         {
           name: "CompileExplain",
-          value: baseMap["编制说明"] ? baseMap["编制说明"].value : "",
+          value: baseMap["preparationInstructions"] ? baseMap["preparationInstructions"].value : "",
         },
         {
           name: "ExamineExplain",
-          value: baseMap["审核说明"] ? baseMap["审核说明"].value : "",
+          value: baseMap["auditInstructions"] ? baseMap["auditInstructions"].value : "",
         },
         {
           name: "ProjectExplain",
-          value: baseMap["工程说明"] ? baseMap["工程说明"].value : "",
+          value: baseMap["auditInstructions"] ? baseMap["auditInstructions"].value : "",
         },
       ];
       if (isControl || isBidInvitation) { //招标、招标控制价文件,则以下的8、12~18则不输出

+ 1 - 1
web/building_saas/standard_interface/import/anhui_maanshan.js

@@ -31,7 +31,7 @@ INTERFACE_IMPORT = (() => {
       const info = [
         { key: 'projNum', value: getValue(projectSrc, ['_Xmbh']) },
         { key: 'projType', value: getValue(projectSrc, ['_Bzlx']) },
-        { key: 'startAndChainages', value: getValue(projectSrc, ['_Xmqzzh']) },
+        { key: 'startEndChainages', value: getValue(projectSrc, ['_Xmqzzh']) },
         { key: 'constructingUnits', value: getValue(projectSrc, ['_Jsdw']) },
         { key: 'taxMode', value: getValue(projectSrc, ['_Jsfs']) },
         { key: 'tendereeName', value: getValue(projectSrc, ['ZhaoBiaoXx', '_Zbr']) },

+ 138 - 0
web/building_saas/standard_interface/import/guangdong_zhongshan.js

@@ -0,0 +1,138 @@
+/*
+ * @Descripttion: 安徽马鞍山导入接口
+ * @Author: vian
+ * @Date: 2020-09-09 11:51:15
+ */
+
+// INTERFACE_EXPORT =,必须这么写,这样才能在导入时动态加载脚本后,覆盖前端代码
+INTERFACE_IMPORT = (() => {
+  'use strict';
+  /**
+   * 
+   * @param {String} areaKey - 地区标识,如:'安徽@马鞍山',有些地区的接口只是取值上有不同,共有一个接口脚本, 需要通过地区标识确定一些特殊处理
+   * @param {Object} xmlObj - xml经过x2js转换后的xml对象
+   * @return {Object} - 返回的格式需要统一,具体参考函数内返回的内容。返回的内容会经过一系列的统一处理形成可入库的数据。
+   */
+  async function entry(areaKey, xmlObj) {
+    const {
+      UTIL: {
+        getValue,
+        arrayValue,
+        getBool,
+        extractItemsRecur,
+      }
+    } = INTERFACE_EXPORT_BASE;
+    let info = [];
+    let tenders = [];
+    let CprjInfo = getValue(xmlObj, ['CprjInfo']);
+    let EprjInfos = arrayValue(CprjInfo, ["EprjInfo"]);
+    if (EprjInfos.length > 0) { 
+      let MakeInfo = EprjInfos[0].MakeInfo;
+      let Params = EprjInfos[0].Params;
+      info = [
+        { key: 'constructingUnits', value: getValue(MakeInfo, ['_Manage']) },
+        { key: 'designUnits', value: getValue(MakeInfo, ['_Designer']) },
+        { key: 'establishUnit', value: getValue(MakeInfo, ['_Compile']) },
+        { key: 'tenderCompiler', value: getValue(MakeInfo, ['_CompileApprover']) },
+        { key: 'authorNo', value: getValue(MakeInfo, ['_CompileCertNo']) },
+        { key: 'establishDate', value: getValue(MakeInfo, ['_CompileDate']) },
+        { key: 'tenderExaminer', value: getValue(MakeInfo, ['_ReviewApprover']) },
+        { key: 'certificateReviewer', value: getValue(MakeInfo, ['_ReviewCertNo']) },
+        { key: 'reviewTime', value: getValue(MakeInfo, ['_ReviewDate']) },
+        { key: 'startAndChainages', value: getValue(Params, ['_StartPileNo'])},
+        { key: 'endChainages', value: getValue(Params, ['_EndPileNo']) },  
+      ]
+      for (let t of EprjInfos) { 
+        tenders.push(setupTender(t))
+      }
+
+
+    }
+
+    function setupTender(EprjInfo) { 
+      let tender = {};
+      let Params = EprjInfo.Params;
+      tender.name = EprjInfo._Name;
+      tender.bills = [];
+      tender.bidEvaluationList = [];
+      tender.evaluationList = [];
+      let terrainCategory = "";
+      if (getValue(Params, ['_Terrain']) == '平原微丘陵区') terrainCategory = 0;
+      if (getValue(Params, ['_Terrain']) == '山岭重丘陵区') terrainCategory = 0;
+      tender.feature = [
+        { key: 'projLocation', value: getValue(Params, ['_PrjArea']) },
+        { key: 'buildType', value: getValue(Params, ['_BuildType']) },// --todo
+        { key: 'terrainCategory', value: terrainCategory },
+        { key: 'establishDate', value: getValue(Params, ['_RoadGrade']) },// --todo
+        { key: 'tenderExaminer', value: getValue(Params, ['_DesignSpeed']) },// --todo
+        { key: 'pavementStructure', value: getValue(Params, ['_Structure']) },// --todo
+        { key: 'subgradeWidth', value: getValue(Params, ['_SubgradeWidth']) },
+        { key: 'routeLength', value: getValue(Params, ['_RoadLength']) },// --todo
+        { key: 'bridgeLength', value: getValue(Params, ['_BridgeLength']) },
+        { key: 'tunnelLength', value: getValue(Params, ['_TunnelLength']) },// --todo
+        { key: 'bridgeTunnelProportion', value: getValue(Params, ['_BriTunRate']) },// --todo
+        { key: 'interchangeNo', value: getValue(Params, ['_InterchangeNum']) },// --todo
+        { key: 'lineContactLineLength', value: getValue(Params, ['_StubLengths']) },// --todo
+        { key: 'auxiliaryContactLineLength', value: getValue(Params, ['_LaneLength']) },// --todo
+      ]
+      const items = arrayValue(EprjInfo, ['Items', 'Item']);
+      for (let i of items) { 
+        tender.bills.push(setupBills(i));
+      }
+      const BidEvaluationMainMaterial = arrayValue(EprjInfo, ['BidEvaluationMainMaterial']);
+      for (let b of BidEvaluationMainMaterial) { 
+        tender.bidEvaluationList.push(setUpBidEvaluation(b))
+      }
+      
+      return tender;
+    }
+
+
+    function setupBills(item) { 
+      let bill = {
+        code: item._ListCode,
+        name: item._ListName,
+        unit: item._Unit,
+        quantity: item._Num,
+        remark: item._Remarks,
+        jobContentText: item._Content,
+        specialProvisional: '',
+        children: []
+      }
+      if (item._ProvisionalType == '0') bill.specialProvisional = '材料';
+      if (item._ProvisionalType == '1') bill.specialProvisional = '工程设备';
+      if (item._ProvisionalType == '2') bill.specialProvisional = '工程设备';
+      if (item.Item && item.Item.length > 0) { 
+        for (let i of item.Item) { 
+          bill.children.push(setupBills(i))
+        }
+      }
+      return bill;
+    }
+
+    function setUpBidEvaluation(b) { 
+      return {
+        code: b._Code,
+        name: b._Name,
+        specs: b.Specification,
+        unit: b._Unit,
+        market_price: b._Price,
+        quantity: b._Quantity,
+        remark:b._Remark
+      }
+    }
+    
+
+    return {
+      name: CprjInfo._CprjName,
+      info,
+      tenders,
+    };
+
+  }
+
+  return {
+    entry
+  };
+
+})();

+ 7 - 7
web/common/html/header.html

@@ -41,13 +41,13 @@
             </li>
             <% if (!versionName.includes('学习')) {%>
             <li class="nav-item">
-              <a href="/user/buy" target="_blank">
-                  <% if (sessionUser.compilationDeadline !== '') { %>
-                  <img src="/web/building_saas/img/vip2.png" data-toggle="tooltip" data-placement="bottom" data-original-title="年限版用户">
-                  <% } else { %>
-                  <img src="/web/building_saas/img/vip.png" data-toggle="tooltip" data-placement="bottom" data-original-title="专业版用户">
-                  <% } %>
-              </a>
+                <a href="/user/buy" target="_blank">
+                    <% if (sessionUser.compilationLock === 1) { %>
+                    <img width="38" src="/web/building_saas/img/vip2.png" data-toggle="tooltip" data-placement="bottom" data-original-title="借用">
+                    <% } else if (sessionUser.compilationLock === 2) { %>
+                    <img width="38" src="/web/building_saas/img/vip.png" data-toggle="tooltip" data-placement="bottom" data-original-title="购买">
+                    <% } %>
+                </a>
             </li>
             <% } %>
             <% if (action === 'index' && controller === 'main') {%>

+ 4 - 4
web/users/html/login-sms.html

@@ -35,10 +35,10 @@
                     <strong>登录失败</strong> <span id="message"></span>
                 </div>
             </div>
-            <div class="form-group">
-                <div id="captcha-box"></div>
-            </div>
-            <div class="form-group btn-area" style="display: none;">
+            <!--<div class="form-group">-->
+                <!--<div id="captcha-box"></div>-->
+            <!--</div>-->
+            <div class="form-group btn-area">
                 <button id="login" type="button" class="btn btn-primary btn-block">登录</button>
             </div>
         </form>

+ 4 - 4
web/users/html/login.html

@@ -46,10 +46,10 @@
                     <strong>登录失败</strong> <span id="message"></span>
                 </div>
             </div>
-            <div class="form-group">
-                <div id="captcha-box"></div>
-            </div>
-            <div class="form-group btn-area" style="display: none">
+            <!--<div class="form-group">-->
+                <!--<div id="captcha-box"></div>-->
+            <!--</div>-->
+            <div class="form-group btn-area">
                 <button type="button" id="login" class="btn btn-primary btn-block">登录</button>
             </div>
             <div class="pt-1 d-flex justify-content-between">

+ 23 - 22
web/users/html/user-buy.html

@@ -75,46 +75,47 @@
                             </div>
                             <div class="col-sm-5 mb-5">
                                 <div class="card pro-version">
-                                  <div class=" card-body">
-                                    <h3 class="card-title">
-                                      专业版
-                                        <img src="/web/building_saas/img/vip.png" data-toggle="tooltip" data-placement="bottom" data-original-title="专业版用户">
-                                        <img src="/web/building_saas/img/vip2.png" data-toggle="tooltip" data-placement="bottom" data-original-title="年限版用户">
-                                    </h3>
-                                      <!--<p class="card-text">-->
-                                      <!--<ul class="pl-3">
-                                          <li>创建单位工程无限制</li>
-                                          <li>报表无水印</li>
-                                      </ul>-->
-                                      <!--</p>-->
-                                  </div>
+                                    <div class="card-body d-flex justify-content-between">
+                                        <h3 class="card-title">专业版</h3>
+                                        <div>
+                                            <div class="d-inline-block mr-3">
+                                                <img width="24" src="/web/building_saas/img/vip.png">购买
+                                            </div>
+                                            <div class="d-inline-block">
+                                                <img width="24" src="/web/building_saas/img/vip2.png">借用
+                                            </div>
+                                        </div>
+                                        <!--<p class="card-text">-->
+                                        <!--&lt;!&ndash;<ul class="pl-3">-->
+                                        <!--<li>创建单位工程无限制</li>-->
+                                        <!--<li>报表无水印</li>-->
+                                        <!--</ul>&ndash;&gt;-->
+                                        <!--</p>-->
+                                    </div>
                                     <ul class="list-group list-group-flush">
                                         <% if (compilationList.length > 0) {%>
                                         <% compilationList.forEach(function(compilation) { %>
                                         <li class="list-group-item d-flex justify-content-between">
                                             <div class="col-6">
                                                 <%= compilation.name %>
-                                                <% if (compilation.isUpgrade !== undefined && compilation.isUpgrade === true && compilation.deadline !== undefined && compilation.deadline !== '') { %>
-                                                <img src="/web/building_saas/img/vip2.png" data-toggle="tooltip" data-placement="bottom" data-original-title="年限版用户">
-                                                <% } else if (compilation.isUpgrade !== undefined && compilation.isUpgrade === true && (compilation.deadline === undefined || compilation.deadline === '')) { %>
-                                                <img src="/web/building_saas/img/vip.png" data-toggle="tooltip" data-placement="bottom" data-original-title="专业版用户">
+                                                <% if (compilation.lock !== undefined && compilation.lock === 1) { %>
+                                                <img width="38" src="/web/building_saas/img/vip2.png" data-toggle="tooltip" data-placement="bottom" data-original-title="借用">
+                                                <% } else if (compilation.lock !== undefined && compilation.lock === 2) { %>
+                                                <img width="38" src="/web/building_saas/img/vip.png" data-toggle="tooltip" data-placement="bottom" data-original-title="购买">
                                                 <% } %>
                                             </div>
                                             <div class="ml-auto text-right">
                                                 <% if (compilation.isUpgrade === undefined || compilation.isUpgrade !== true) { %>
                                                 <a href="javascript:void(0);" class="btn btn-primary btn-sm getcategory" data-upgrade="<%= compilation.isUpgrade %>" data-category="<%= compilation.categoryID %>">立即激活</a>
+                                                <% if (compilation.deadline !== undefined && compilation.deadline !== '') { %><span class="d-block text-danger">已到期:<%= compilation.deadline %></span><% } %>
                                                 <% } else { %>
                                                 <a href="javascript:void(0);" class="btn btn-outline-secondary btn-sm getcategory" data-title="<%= compilation.name %>" data-upgrade="<%= compilation.isUpgrade %>" data-category="<%= compilation.categoryID %>"><i class="fa fa-check"></i> 已激活</a>
-                                                <% if (compilation.deadline !== undefined && compilation.deadline !== '') { %><span class="d-block text-muted">期:<%= compilation.deadline %></span><% } %>
+                                                <% if (compilation.deadline !== undefined && compilation.deadline !== '') { %><span class="d-block text-muted">期:<%= compilation.deadline %></span><% } %>
                                                 <% } %>
                                             </div>
                                         </li>
                                         <% }) %>
                                         <% } %>
-                                        <!--<li class="list-group-item d-flex justify-content-between">-->
-                                        <!--重庆(2015)-->
-                                        <!--<a class="btn btn-outline-secondary btn-sm" href="activ2" data-toggle="modal" data-target="#activ2"><i class="fa fa-check"></i> 已激活</a>-->
-                                        <!--</li>-->
                                     </ul>
                                 </div>
                             </div>

+ 154 - 102
web/users/js/login.js

@@ -9,42 +9,42 @@ $(document).ready(function () {
     let referer = scUrlUtil.GetQueryString('referer');
 
     // 载入时先获取相关参数
-    $.ajax({
-        url: '/captcha',
-        type: 'get',
-        data: '',
-        timeout: 5000,
-        error: function() {
-            $("#captcha-box").html('验证码加载失败');
-        },
-        beforeSend: function() {
-            $("#captcha-box").html('正在加载验证码');
-        },
-        success: function(response) {
-            $("#captcha-box").html('');
-            if (response.success === 0) {
-                alert('验证码初始化失败!');
-                return false;
-            }
+    // $.ajax({
+    //     url: '/captcha',
+    //     type: 'get',
+    //     data: '',
+    //     timeout: 5000,
+    //     error: function() {
+    //         $("#captcha-box").html('验证码加载失败');
+    //     },
+    //     beforeSend: function() {
+    //         $("#captcha-box").html('正在加载验证码');
+    //     },
+    //     success: function(response) {
+    //         $("#captcha-box").html('');
+    //         if (response.success === 0) {
+    //             alert('验证码初始化失败!');
+    //             return false;
+    //         }
+    //
+    //         initGeetest({
+    //             // 以下配置参数来自服务端 SDK
+    //             gt: response.gt,
+    //             challenge: response.challenge,
+    //             offline: !response.success,
+    //             new_captcha: response.new_captcha,
+    //             width: '100%'
+    //         }, handler);
+    //     }
+    // });
 
-            initGeetest({
-                // 以下配置参数来自服务端 SDK
-                gt: response.gt,
-                challenge: response.challenge,
-                offline: !response.success,
-                new_captcha: response.new_captcha,
-                width: '100%'
-            }, handler);
-        }
-    });
-
-    const handler = function(captchaObj) {
-        captchaObj.appendTo('#captcha-box');
-        captchaObj.onSuccess(function () {
-            $(".btn-area").slideDown("fast");
-            // $('#login').click();
-            // captchaObj.getValidate();
-        });
+    // const handler = function(captchaObj) {
+    //     captchaObj.appendTo('#captcha-box');
+    //     captchaObj.onSuccess(function () {
+    //         $(".btn-area").slideDown("fast");
+    //         // $('#login').click();
+    //         // captchaObj.getValidate();
+    //     });
 
         $("#login").click(function () {
             if (!valid()) {
@@ -53,14 +53,14 @@ $(document).ready(function () {
             if ($('#changeLogin').attr('data-status') === 'user') {
                 let account = $("#inputEmail").val();
                 if(/^1[3456789]\d{9}$/.test(account) || /^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/.test(account)) {
-                    login(captchaObj);
+                    login();
                 } else {
                     $('#emailHelp').text('您输入的 邮箱/手机 格式不对');
                 }
             } else {
                 let account = $("#mobileLogin").val();
                 if(/^1[3456789]\d{9}$/.test(account)) {
-                    login(captchaObj);
+                    login();
                 } else {
                     $('#phoneHelp').text('您输入的 手机 格式不对');
                 }
@@ -142,7 +142,7 @@ $(document).ready(function () {
                 }
             })
         });
-    };
+    // };
 
     $("input").blur(function () {
         cleanError();
@@ -265,73 +265,125 @@ $(document).ready(function () {
     });
 });
 
-function login(captchaObj) {
-    $('#login').attr('disabled', true);
-    let geetest_challenge = $('input[name="geetest_challenge"]').val();
-    let geetest_validate = $('input[name="geetest_validate"]').val();
-    let geetest_seccode = $('input[name="geetest_seccode"]').val();
+function login() {
+    $.ajax({
+        url: '/captcha?t='+ (new Date()).getTime(),
+        type: 'get',
+        dataType: 'json',
+        timeout: 5000,
+        error: function() {
+            // $("#captcha-box").html('验证码加载失败');
+        },
+        beforeSend: function() {
+            // $("#captcha-box").html('正在加载验证码');
+        },
+        success: function(response) {
+            // $("#captcha-box").html('');
+            if (response.success === 0) {
+                alert('验证码初始化失败!');
+                return false;
+            }
 
-    const postData = {
-        geetest_challenge: geetest_challenge,
-        geetest_validate: geetest_validate,
-        geetest_seccode: geetest_seccode,
-    };
-    if ($('#changeLogin').attr('data-status') === 'user') {
-        let account = $("#inputEmail").val();
-        let pw = $("#inputPassword").val();
-        postData.account = account;
-        postData.pw = pw;
-    } else {
-        let mobile = $('#mobileLogin').val();
-        let code = $("#codeLogin").val();
-        postData.mobile = mobile;
-        postData.code = code;
-    }
+            initGeetest({
+                // 以下配置参数来自服务端 SDK
+                gt: response.gt,
+                challenge: response.challenge,
+                offline: !response.success,
+                new_captcha: response.new_captcha,
+                // width: '100%',
+                product: "bind"
+            }, function (catpchaObj) {
+                catpchaObj.onReady(function () {
+                    catpchaObj.verify();
+                }).onClose(function () {
+                }).onSuccess(function () {
+                    /* 延迟到动画结束后再alert */
+                    var lastUTC = new Date(), duration = 1100;
 
-    $.ajax({
-        url: '/login',
-        type: 'post',
-        data: postData,
-        success: function (response) {
-            if (response.error === 0) {
-                // $('#phonepass').modal('hide');
-                const url = response.last_page !== null && response.last_page !== undefined && response.last_page !== '' ?
-                    response.last_page : '/pm';
-                if (response.login_ask === 0) {
-                    location.href = url;
-                } else {
-                    response.compilation_list = response.compilation_list === undefined || response.compilation_list === '' ?
-                        null : JSON.parse(response.compilation_list);
-                    if (response.compilation_list === null || response.compilation_list.length <= 0) {
-                        location.href = url;
-                        return false;
+                    function _alert(msg) {
+                        var elapsed = new Date() - lastUTC;
+                        if (elapsed >= duration) {
+                            return alert(msg)
+                        }
+                        setTimeout(function () {
+                            alert(msg)
+                        }, duration - elapsed);
                     }
-                    console.log(response.compilation_list);
-                    setVersion(response.compilation_list);
-                    $('#ver').modal('show');
-                }
-            } else if(response.error === 2) {
-                // $('#phonepass').modal('hide');
-                // captchaObj.reset();
-                $('#check_ssoId').val(response.ssoId);
-                $('#phone').modal('show');
-                $('#login').removeAttr('disabled');
-            } else if(response.error === 3) {
-                // captchaObj.reset();
-                $('#phonepass').modal('show');
-                $('#mobileLogin').val(response.data);
-                $('#login').removeAttr('disabled');
-            } else {
-                // $('#phonepass').modal('hide');
-                let msg = response.msg !== undefined ? response.msg : '未知错误';
-                showError(msg, $("input"));
-                $('#login').removeAttr('disabled');
-                // captchaObj.reset();
-            }
-        },
-        error: function (result) {
-            showError('内部程序错误', null);
-            $('#login').removeAttr('disabled');
+
+                    var result = catpchaObj.getValidate();
+                    if (!result) {
+                        return alert('请完成验证');
+                    }
+                    $('#login').attr('disabled', true);
+                    // let geetest_challenge = $('input[name="geetest_challenge"]').val();
+                    // let geetest_validate = $('input[name="geetest_validate"]').val();
+                    // let geetest_seccode = $('input[name="geetest_seccode"]').val();
+
+                    const postData = {
+                        geetest_challenge: result.geetest_challenge,
+                        geetest_validate: result.geetest_validate,
+                        geetest_seccode: result.geetest_seccode,
+                    };
+                    if ($('#changeLogin').attr('data-status') === 'user') {
+                        let account = $("#inputEmail").val();
+                        let pw = $("#inputPassword").val();
+                        postData.account = account;
+                        postData.pw = pw;
+                    } else {
+                        let mobile = $('#mobileLogin').val();
+                        let code = $("#codeLogin").val();
+                        postData.mobile = mobile;
+                        postData.code = code;
+                    }
+
+                    $.ajax({
+                        url: '/login',
+                        type: 'post',
+                        data: postData,
+                        success: function (response) {
+                            if (response.error === 0) {
+                                // $('#phonepass').modal('hide');
+                                const url = response.last_page !== null && response.last_page !== undefined && response.last_page !== '' ?
+                                    response.last_page : '/pm';
+                                if (response.login_ask === 0) {
+                                    location.href = url;
+                                } else {
+                                    response.compilation_list = response.compilation_list === undefined || response.compilation_list === '' ?
+                                        null : JSON.parse(response.compilation_list);
+                                    if (response.compilation_list === null || response.compilation_list.length <= 0) {
+                                        location.href = url;
+                                        return false;
+                                    }
+                                    console.log(response.compilation_list);
+                                    setVersion(response.compilation_list);
+                                    $('#ver').modal('show');
+                                }
+                            } else if (response.error === 2) {
+                                // $('#phonepass').modal('hide');
+                                // captchaObj.reset();
+                                $('#check_ssoId').val(response.ssoId);
+                                $('#phone').modal('show');
+                                $('#login').removeAttr('disabled');
+                            } else if (response.error === 3) {
+                                // captchaObj.reset();
+                                $('#phonepass').modal('show');
+                                $('#mobileLogin').val(response.data);
+                                $('#login').removeAttr('disabled');
+                            } else {
+                                // $('#phonepass').modal('hide');
+                                let msg = response.msg !== undefined ? response.msg : '未知错误';
+                                showError(msg, $("input"));
+                                $('#login').removeAttr('disabled');
+                                // captchaObj.reset();
+                            }
+                        },
+                        error: function (result) {
+                            showError('内部程序错误', null);
+                            $('#login').removeAttr('disabled');
+                        }
+                    });
+                })
+            });
         }
     });
 }