Browse Source

feat: 新建单位工程,工程专业按照项目类型过滤

vian 4 years ago
parent
commit
43d7af54ce
1 changed files with 40 additions and 3 deletions
  1. 40 3
      web/building_saas/pm/js/pm_newMain.js

+ 40 - 3
web/building_saas/pm/js/pm_newMain.js

@@ -39,6 +39,28 @@ const FileKind = {
     tender: 1, //投标
     bid: 2  //招标
 };
+
+// 概算类型,对应可用工程专业
+const budgetEngineeringListMap = {
+    [commonConstants.BudgetType.BUILDING]: [
+        '房屋建筑工程',
+        '装配式钢结构建筑工程',
+        '装饰工程',
+        '构筑物',
+        '市政工程',
+        '机械(爆破)土石方工程',
+        '人工土石方工程',
+        '围墙工程',
+        '幕墙工程',
+        '安装工程',
+        '市政安装工程',
+    ],
+    [commonConstants.BudgetType.RAIL]: [
+        '城市轨道交通工程',
+        '城市轨道交通安装工程'
+    ],
+};
+
 let curTaxType = 1; //1:"一般计税",2:"简易计税"
 let curBudgetType = commonConstants.BudgetType.BUILDING;
 let curValutionType = 'bill',   //计价方式默认只有清单计价
@@ -372,8 +394,9 @@ const projTreeObj = {
             name: '导入招投标接口文件',
             icon: 'fa-cloud-upload',
             visible: function () {
-                const names = ['重庆定额(2018)', '广东定额(2018)'];
-                return compilationData && names.includes(compilationData.name);
+                return false;
+                /* const names = ['重庆定额(2018)', '广东定额(2018)'];
+                return compilationData && names.includes(compilationData.name); */
             },
             callback: function () {
                 $('#importInterface').modal('show');
@@ -2089,6 +2112,15 @@ $(document).ready(function() {
         changeEngineering();
     });
 
+    // 选择项目类型
+    $("input[name='budgetType-tender']").click(function () {
+        curBudgetType = +$(this).val();
+        const engineeringList = getEngineeringList();
+        const engineeringHtml = getEngineeringHtml(engineeringList);
+        $("#tender-engineering").html(engineeringHtml);
+        changeEngineering();
+    });
+
     //选择计价规则
     $("#valuation").change(function () {
         curValuation = $(this).val();
@@ -3655,6 +3687,7 @@ function setProjOptions(projs, selected){
     if(projs.length > 0){
         let firstProj = selected && selected.data.projType === projectType.project ? selected: projs[0];
         curTaxType = firstProj.data.property.taxType || 1;
+        curBudgetType = firstProj.data.property.budgetType || commonConstants.BudgetType.BUILDING;
         if (firstProj.data.property.valuationType) {
             curValutionType = firstProj.data.property.valuationType;
         }
@@ -3675,6 +3708,7 @@ function setProjOptions(projs, selected){
             $proj.attr("href", "javascript:void(0);");
             $proj.click(function () {
                 curTaxType = projs[i].data.property.taxType || 1;
+                curBudgetType = projs[i].data.property.budgetType || commonConstants.BudgetType.BUILDING;;
                 if (projs[i].data.property.valuationType) {
                     curValutionType = projs[i].data.property.valuationType;
                 }
@@ -3877,6 +3911,7 @@ function AddTender() {
 
         //let valuation = $("#valuation").val();
         let valuation = curValuation;   //跟建设项目一样的计价规则
+        debugger;
 
         let engineeringName = $("#tender-engineering").val();
         if (!engineeringName || engineeringName === '') {
@@ -4355,10 +4390,12 @@ function getEngineeringHtml(engineeringList) {
     if (engineeringList.length <= 0) {
         return result;
     }
+    console.log(engineeringList);
     let engLibNames = [];
     for(let i = 0; i < engineeringList.length; i++){
         let tmp = engineeringList[i];
-        if(engLibNames.includes(tmp.lib.name)){
+        const validEngNames = budgetEngineeringListMap[curBudgetType];
+        if(engLibNames.includes(tmp.lib.name) || !validEngNames.includes(tmp.lib.name)){
            continue;
         }
         result += `<option ${i === 0 ? 'selected' : ''} value="${tmp.lib.name}">${tmp.lib.name}</option>`;