Browse Source

bug调整

dev01 1 month ago
parent
commit
9e6ea18b0e

+ 83 - 12
js/component/common/projectOperation/newAddProject.jsx

@@ -278,6 +278,19 @@ class NewAddProject extends Component {
       }
     }
 
+    let flag = true;
+    let errorText = '';
+    for (let i=0; i<this.state.subProList.length; i++) {
+      if (!this.state.subProList[i].serviceYear) {
+        flag = false;
+        errorText = "派单年份不能为空!"
+      }
+    }
+    if (!flag) {
+      message.warning(errorText);
+      return;
+    }
+
     let sonList = this.state.subProList.map(item => {
       if (this.state.projectType == 1) {
         item.htMember = item.newCheck.includes(1) ? 1 : 0
@@ -716,6 +729,22 @@ class NewAddProject extends Component {
     return [...new Set(newCheckType)]
   }
 
+  calcNewCheckType(list) {
+    let newCheckType = [];
+    list.map(item => {
+      if (item.htMember == 1) {
+        newCheckType.push(1);
+      }
+      if (item.additionalDeduction == 1) {
+        newCheckType.push(2)
+      }
+      if (item.rdAwardsubsidy == 1) {
+        newCheckType.push(3)
+      }
+    });
+    return newCheckType;
+  }
+
   render() {
     let newOptions = this.state.customerArr.map((group, index) => (
       <Select.Option key={index} value={group.bname}>
@@ -1466,13 +1495,30 @@ class NewAddProject extends Component {
               }
               { this.state.subProList.map((item, idx) => {
                 return (
-                  <div>
+                  <div style={{margin: '15px 0'}}>
                     <FormItem
                       className="half-item"
                       {...formItemLayout}
-                      label="本次派单"
+                      label="派单年份"
                     >
-                      { item.serviceYear }
+                      <Select
+                        placeholder="请选择本次派单年份"
+                        style={{ width: "200px" }}
+                        value={item.serviceYear}
+                        onChange={(e) => {
+                          item.serviceYear = e;
+                          this.setState({ subProList: this.state.subProList });
+                        }}
+                      >
+                        {this.state.serviceLife.map(year => {
+                          return (
+                            <Select.Option key={year} disabled={this.state.subProList.some(item => item.serviceYear == year)}>
+                              {year}
+                            </Select.Option>
+                          );
+                        })}
+                      </Select>
+                      {<span className="mandatory">*</span>}
                     </FormItem>
                     <FormItem
                       className="half-item"
@@ -1509,8 +1555,12 @@ class NewAddProject extends Component {
                             value={item.newCheck}
                             onChange={e => {
                               item.newCheck = e;
+                              item.htMember = item.newCheck.includes(1) ? 1 : 0
+                              item.additionalDeduction = item.newCheck.includes(2) ? 1 : 0;
+                              item.rdAwardsubsidy = item.newCheck.includes(3) ? 1 : 0;
                               this.setState({
-                                subProList: this.state.subProList
+                                subProList: this.state.subProList,
+                                checkType: this.calcNewCheckType(this.state.subProList), // 临时显示
                               })
                             }}
                           />
@@ -1593,6 +1643,26 @@ class NewAddProject extends Component {
                   </div>
                 )
               }) }
+              { this.state.subProList.length < this.state.serviceLife.length &&
+                <div className="clearfix">
+                  <FormItem
+                    wrapperCol={{ span: 19, offset: 8 }}
+                    className="half-middle"
+                  >
+                    <Button
+                      type="primary"
+                      onClick={() => {
+                        const { subProList } = this.state;
+                        subProList.push({});
+                        this.setState({ subProList });
+                      }}
+                    >
+                      + 添加本次派单
+                    </Button>
+                    <span style={{ color: "#61BBE2", marginLeft: 10 }}>请填写本次派单的年份,派单表示立即安排人员开始相关的工作!!!</span>
+                  </FormItem>
+                </div>
+              }
               {/* {
                 this.state.splitList.length < this.state.yearSum &&
                 <div
@@ -1814,12 +1884,13 @@ class NewAddProject extends Component {
 
               const { subProList } = this.state;
 
+
               if (this.state.isGive == 0) {
                 this.state.addyear.map(year => {
                   slist.push(year)
-                  if (!subProList.some(item => item.serviceYear == year)) {
-                    subProList.push({ serviceYear: year, newCheck: [] });
-                  }
+                  // if (!subProList.some(item => item.serviceYear == year)) {
+                  //   subProList.push({ serviceYear: year, newCheck: [] });
+                  // }
                 })
                 // slist.push(this.state.addyear)
               } else if (this.state.isGive == 1) {
@@ -1827,17 +1898,17 @@ class NewAddProject extends Component {
                 // slist.push(newYear)
                 this.state.addyear.map(year => {
                   slist.push(year + "(赠)")
-                  if (!subProList.some(item => item.serviceYear == year)) {
-                    subProList.push({ serviceYear: year + "(赠)", newCheck: [] });
-                  }
+                  // if (!subProList.some(item => item.serviceYear == year)) {
+                  //   subProList.push({ serviceYear: year + "(赠)", newCheck: [] });
+                  // }
                 })
               }
-              console.log(subProList)
+
               this.setState({
                 serviceLife: slist,
                 yearSum: slist.length.toString(),
                 addYears: false,
-                subProList,
+                // subProList,
                 addForm: true
               })
             }}

+ 4 - 4
js/component/common/projectOperation/newEditProject.jsx

@@ -229,21 +229,21 @@ class newEditProject extends Component {
     const updatedList = this.getUpdatedSubProject();
     let subLen = updatedList.length;
     if (subLen === 0) {
-      this.saveParentProject();
+      this.saveParentProject(text);
     }
 
     updatedList.map((item) => this.handleUpdateSubProject(item, () => {
       subLen -= 1;
       if (subLen === 0) {
-        this.saveParentProject();
+        this.saveParentProject(text);
       }
     }, () => {
       subLen -= 1;
-      this.saveParentProject();
+      this.saveParentProject(text);
     }));
   }
 
-  saveParentProject() {
+  saveParentProject(text) {
     const { type = "", dataInfor } = this.props
     if (isNaN(parseFloat(this.state.commodityPrice))) {
       message.warning("请输入正确的金额!");

+ 2 - 2
js/component/manageCenter/customer/NEW/crm/customerProfile.jsx

@@ -206,7 +206,7 @@ const IntentionCustomer = Form.create()(React.createClass({
         dataIndex: 'operate',
         key: 'operate',
         width: 120,
-        render: text => {
+        render: (text, record) => {
           return (
             <div>
               <Button
@@ -214,7 +214,7 @@ const IntentionCustomer = Form.create()(React.createClass({
                   e.stopPropagation();
                   this.setState({
                     visible: true,
-                    uid: text
+                    uid: record.id
                   })
                 }} type="primary" style={{ marginLeft: '10px' }}>主营日志</Button>
             </div>

+ 17 - 7
js/component/manageCenter/customer/NEW/publicCustomer/publicCustomer.jsx

@@ -355,6 +355,17 @@ const QueryCustomer = React.createClass({
           })
         }
 
+        let nature = [];
+        if (!!obj.nature) {
+          nature.push(obj.nature);
+        }
+        if (!!obj.enterpriseNature) {
+          nature.push(obj.enterpriseNature);
+        }
+        if (!!obj.listedNature) {
+          nature.push(obj.listedNature);
+        }
+
         this.setState({
           loading: false,
           verification: true,
@@ -369,7 +380,7 @@ const QueryCustomer = React.createClass({
           businessScope: !!obj.businessScope ? obj.businessScope.split(',') : [],
           selectCooperationProjects: selectCooperationProjects,
           level: obj.level,
-          nature: obj.nature,
+          nature,
           natureOther: obj.natureOther,
         });
       } else {
@@ -523,11 +534,10 @@ const QueryCustomer = React.createClass({
         message.error("请填写正确的联系人,且至少包含一个汉字");
         return false;
       }
-      if (/.*[\u4e00-\u9fa5]+.*$/.test(values.position)) {
-      } else {
+      if (!!values.content && /.*[\u4e00-\u9fa5]+.*$/.test(values.position)) {
         message.error("请填写正确的职位,且至少包含一个汉字");
         return false;
-      };
+      }
       if (!values.ProvinceCity[1]) {
         message.warning('请选择地区');
         return false;
@@ -819,7 +829,7 @@ const QueryCustomer = React.createClass({
                         {...formItemLayout}
                         label="职位" >
                         {getFieldDecorator('position', {
-                          rules: [{ required: true, message: '此项为必填项!' }],
+                          rules: [{ required: this.state.verificationMyUser != 1, message: '此项为必填项!' }],
                           initialValue: this.state.position
                         })(
                           <Input placeholder="联系人职位" />
@@ -981,7 +991,7 @@ const QueryCustomer = React.createClass({
                       </FormItem>
                     </div>
                     {
-                      this.state.nature == 0 &&
+                      this.state.nature && this.state.nature.length && this.state.nature[0] === 0 ?
                       <div className="clearfix">
                         <FormItem
                           className="mid-item"
@@ -998,7 +1008,7 @@ const QueryCustomer = React.createClass({
                             }}
                           />
                         </FormItem>
-                      </div>
+                      </div> : null
                     }
                   </div>
                   <FormItem wrapperCol={{ span: 12, offset: 6 }}>

+ 15 - 5
js/component/manageCenter/customer/NEW/query/queryCutomer.jsx

@@ -466,6 +466,17 @@ const QueryCustomer = React.createClass({
           })
         }
 
+        let nature = [];
+        if (!!obj.nature) {
+          nature.push(obj.nature);
+        }
+        if (!!obj.enterpriseNature) {
+          nature.push(obj.enterpriseNature);
+        }
+        if (!!obj.listedNature) {
+          nature.push(obj.listedNature);
+        }
+
         this.setState({
           loading: false,
           verification: true,
@@ -480,7 +491,7 @@ const QueryCustomer = React.createClass({
           businessScope: !!obj.businessScope ? obj.businessScope.split(',') : [],
           selectCooperationProjects: selectCooperationProjects,
           level: obj.level,
-          nature: obj.nature,
+          nature,
           natureOther: obj.natureOther,
         });
       } else {
@@ -519,11 +530,10 @@ const QueryCustomer = React.createClass({
         message.error("请填写正确的联系人,且至少包含一个汉字");
         return false;
       }
-      if (/.*[\u4e00-\u9fa5]+.*$/.test(values.position)) {
-      } else {
+      if (!!values.position && /.*[\u4e00-\u9fa5]+.*$/.test(values.position)) {
         message.error("请填写正确的职位,且至少包含一个汉字");
         return false;
-      };
+      }
       if (!values.ProvinceCity[1]) {
         message.warning('请选择地区');
         return false;
@@ -996,7 +1006,7 @@ const QueryCustomer = React.createClass({
                         {...formItemLayout}
                         label="职位" >
                         {getFieldDecorator('position', {
-                          rules: [{ required: true, message: '此项为必填项!' }],
+                          rules: [{ required: this.state.verificationMyUser != 1, message: '此项为必填项!' }],
                           initialValue: this.state.position
                         })(
                           <Input placeholder="联系人职位" />

+ 34 - 27
js/component/manageCenter/set/userManagementS/newUser.jsx

@@ -77,8 +77,8 @@ const Newuser = Form.create()(React.createClass({
       Business: [{ reviewerName: "", reviewerId: "" }], // 公出审核
       Coorder: [{ reviewerName: "", reviewerId: "" }],  // 协单审核
 
-      superiorList: [], // 上级主管
-      publicCarbonCopyList: [], // 公出抄送
+      superiorList: [{ superior: '', superiorId: '' }], // 上级主管
+      publicCarbonCopyList: [{ publicCarbonCopy: "", publicCarbonCopyName: "" }], // 公出抄送
     };
   },
   getDefaultProps() {
@@ -102,10 +102,10 @@ const Newuser = Form.create()(React.createClass({
         return false;
       };
     }
-    if (!this.state.theTypes && !this.state.superiorId) {
-      message.warning('请输入正确的上级主管');
-      return false;
-    };
+    // if (!this.state.theTypes && !this.state.superiorId) {
+    //   message.warning('请输入正确的上级主管');
+    //   return false;
+    // };
     if (!this.state.superiorList.length) {
       message.warning('请输入正确的上级主管');
       return false;
@@ -114,27 +114,28 @@ const Newuser = Form.create()(React.createClass({
       let text = '';
       for (let i=0; i<this.state.superiorList.length; i++) {
         let superiorItem = this.state.superiorList[i];
-        if (!superiorItem.superiorId) {
-          text = `第${idx}行请输入正确的上级主管`;
-          flag = false;
-          continue;
-        } else if (this.state.Business.some(item => item.reviewerId == superiorItem.superiorId)) {
-          text = `上级主管【${superiorItem.superior}】在公出审核人员中存在`;
-          flag = false;
-          continue;
-        } else if (this.state.Coorder.some(item => item.reviewerId == superiorItem.superiorId)) {
-          text = `上级主管【${superiorItem.superior}】在协单审核人员中存在`;
-          flag = false;
-          continue;
-        } else if (this.state.managerId == superiorItem.superiorId) {
-          text = `上级主管【${superiorItem.superior}】在经理审核人员中存在`;
-          flag = false;
-          continue;
-        } else if (this.state.publicCarbonCopyList.some(item => item.publicCarbonCopy == superiorItem.superiorId)) {
-          text = `上级主管【${superiorItem.superior}】在公出抄送人员中存在`;
+        if (superiorItem.superior && !superiorItem.superiorId) {
+          text = `第${i + 1}行请输入正确的上级主管`;
           flag = false;
           continue;
         }
+        // else if (this.state.Business.some(item => item.reviewerId == superiorItem.superiorId)) {
+        //   text = `上级主管【${superiorItem.superior}】在公出审核人员中存在`;
+        //   flag = false;
+        //   continue;
+        // } else if (this.state.Coorder.some(item => item.reviewerId == superiorItem.superiorId)) {
+        //   text = `上级主管【${superiorItem.superior}】在协单审核人员中存在`;
+        //   flag = false;
+        //   continue;
+        // } else if (this.state.managerId == superiorItem.superiorId) {
+        //   text = `上级主管【${superiorItem.superior}】在经理审核人员中存在`;
+        //   flag = false;
+        //   continue;
+        // } else if (this.state.publicCarbonCopyList.some(item => item.publicCarbonCopy == superiorItem.superiorId)) {
+        //   text = `上级主管【${superiorItem.superior}】在公出抄送人员中存在`;
+        //   flag = false;
+        //   continue;
+        // }
       }
       if (!flag) {
         message.warning(text);
@@ -151,7 +152,7 @@ const Newuser = Form.create()(React.createClass({
       for (let i=0; i<this.state.publicCarbonCopyList.length; i++) {
         let item = this.state.publicCarbonCopyList[i];
         if (item.publicCarbonCopyName && !item.publicCarbonCopy) {
-          text = `第${i}行请输入正确的公出抄送人员`;
+          text = `第${i + 1}行请输入正确的公出抄送人员`;
           flag = false;
           continue;
         }
@@ -188,6 +189,12 @@ const Newuser = Form.create()(React.createClass({
     this.setState({
       loading: true
     });
+
+    let superReviewerArr = this.state.superiorList;
+    let uniqueSuperArr = [...new Set(superReviewerArr.map(JSON.stringify))].map(JSON.parse);
+
+    let carbonCopyReviewerArr = this.state.publicCarbonCopyList;
+    let uniqueCarbonCopyReviewerArr = [...new Set(carbonCopyReviewerArr.map(JSON.stringify))].map(JSON.parse);
     $.ajax({
       method: "POST",
       dataType: "json",
@@ -222,8 +229,8 @@ const Newuser = Form.create()(React.createClass({
         }),
         publicReviewerIds: getNewArray(this.state.Business, "reviewerId").toString(),// 公出审核
         assistReviewerIds: getNewArray(this.state.Coorder, "reviewerId").toString(),// 协单审核
-        superReviewerIds: this.state.superiorList.map(item => item.superiorId).join(','), // 上级主管
-        carbonCopyReviewerIds: this.state.publicCarbonCopyList.map(item => item.publicCarbonCopy).join(',') // 公出推送
+        superReviewerIds: uniqueSuperArr.map(item => item.superiorId).join(','), // 上级主管
+        carbonCopyReviewerIds: uniqueCarbonCopyReviewerArr.map(item => item.publicCarbonCopy).join(',') // 公出推送
       }
     }).done(function (data) {
       this.setState({

+ 0 - 1
js/component/project.jsx

@@ -157,7 +157,6 @@ const project = React.createClass({
               <Tooltip title={text}>
                 <div
                   style={{
-                    width: 100,
                     overflow: "hidden",
                     whiteSpace: "nowrap",
                     textOverflow: "ellipsis",