Forráskód Böngészése

修复删除子任务后高新会员类型联动的问题

dev01 2 hónapja%!(EXTRA string=óta)
szülő
commit
9159514943
1 módosított fájl, 51 hozzáadás és 12 törlés
  1. 51 12
      js/component/common/projectOperation/newEditProject.jsx

+ 51 - 12
js/component/common/projectOperation/newEditProject.jsx

@@ -70,6 +70,42 @@ class newEditProject extends Component {
     this.setValue();
   }
 
+  /**
+   * 获取高新会员勾选类型
+   * @param {Array} checkTypeList 当前勾选的列表
+   * @returns {Array} newCheckType
+   */
+  getCheckTypeList(checkTypeList) {
+    let newCheckType = [];
+    // 高新会员
+    let htMember = 0;
+    // 加计扣除
+    let additionalDeduction = 0;
+    // 研发补助
+    let rdAwardsubsidy = 0;
+    checkTypeList.map(item => {
+      if (item.htMember == 1) {
+        htMember = 1;
+      }
+      if (item.additionalDeduction == 1) {
+        additionalDeduction = 1;
+      }
+      if (item.rdAwardsubsidy == 1) {
+        rdAwardsubsidy = 1;
+      }
+    });
+    if (htMember) {
+      newCheckType.push(1);
+    }
+    if (additionalDeduction) {
+      newCheckType.push(2);
+    }
+    if (rdAwardsubsidy) {
+      newCheckType.push(3);
+    }
+    return newCheckType;
+  }
+
   setValue() {
     const { dataInfor, children = "splitList", type = "", readOnly } = this.props;
     if (!(dataInfor && Object.keys(dataInfor).length > 0)) { return; }
@@ -114,18 +150,18 @@ class newEditProject extends Component {
         }
       }
     }
-    let newCheckType = []
-    if (dataInfor.projectType == 1) {
-      if (dataInfor.htMember == 1) {
-        newCheckType.push(1)
-      }
-      if (dataInfor.additionalDeduction == 1) {
-        newCheckType.push(2)
-      }
-      if (dataInfor.rdAwardsubsidy == 1) {
-        newCheckType.push(3)
-      }
-    }
+    let newCheckType = this.getCheckTypeList([dataInfor]);
+    // if (dataInfor.projectType == 1) {
+    //   if (dataInfor.htMember == 1) {
+    //     newCheckType.push(1)
+    //   }
+    //   if (dataInfor.additionalDeduction == 1) {
+    //     newCheckType.push(2)
+    //   }
+    //   if (dataInfor.rdAwardsubsidy == 1) {
+    //     newCheckType.push(3)
+    //   }
+    // }
     this.setState({
       jid: dataInfor.id, //项目ID
       kid: dataInfor.commodityId, //商品ID
@@ -402,9 +438,12 @@ class newEditProject extends Component {
           for (var j = 0; j < splList.length; j++) {
             splList[j].type != 3 && hlist.push(splList[j].serviceYear)
           }
+          let newCheckType = this.getCheckTypeList(splList);
+
           this.setState({
             splitList: splList,
             histYear: hlist,
+            checkType: newCheckType,
           })
         } else {
           message.warning(data.error[0].message);