Browse Source

完成第三方信息功能

mentoswzq 4 years ago
parent
commit
be5cd2fb28
2 changed files with 396 additions and 122 deletions
  1. 292 46
      js/component/manageCenter/project/task/myTask.jsx
  2. 104 76
      js/component/tools.js

+ 292 - 46
js/component/manageCenter/project/task/myTask.jsx

@@ -33,6 +33,8 @@ import { ChooseList } from "../../order/orderNew/chooseList";
 import OrderRiZi from "@/orderRiZi.jsx";
 import "./table.less";
 import {
+  getMaterialStatus,
+  getUrgentStatus,
   getProcessStatus,
   getApproval,
   getTaskStatus,
@@ -207,6 +209,8 @@ const Task = React.createClass({
   },
   getInitialState() {
     return {
+      thirdMaterial: 0,
+      thirdUrgent: 0,
       thirdCompanyName: "",
       thirdUnitPrice: "",
       thirdQuantity: 1,
@@ -220,6 +224,7 @@ const Task = React.createClass({
       jiedianNew: [],
       timeVisible: false,
       ThirdListVisible: false,
+      PayNodeVisible: false, //新增付款节点
       searchMore: true,
       assignVisible: false,
       releaseDate: [],
@@ -660,6 +665,22 @@ const Task = React.createClass({
           },
         },
         {
+          title: "材料",
+          dataIndex: "material",
+          key: "material",
+          render: (text, record) => {
+            return getMaterialStatus(text);
+          },
+        },
+        {
+          title: "加急",
+          dataIndex: "urgent",
+          key: "urgent",
+          render: (text, record) => {
+            return getUrgentStatus(text);
+          },
+        },
+        {
           title: "备注",
           dataIndex: "remarks",
           key: "remarks",
@@ -1514,7 +1535,8 @@ const Task = React.createClass({
       message.warning("请选择类型");
       return;
     }
-    if (this.state.type == 1) {//专利
+    if (this.state.type == 1) {
+      //专利
       if (!this.state.patentType) {
         message.warning("请选择专利类型");
         return;
@@ -1523,7 +1545,7 @@ const Task = React.createClass({
         message.warning("请选择专利类型名称");
         return;
       }
-      if (this.state.patentNameType==3) {
+      if (this.state.patentNameType == 3) {
         if (!this.state.patentName) {
           message.warning("请填写专利名称");
           return;
@@ -1944,6 +1966,13 @@ const Task = React.createClass({
       ThirdListVisible: true,
     });
   },
+  // 新增支付节点
+  addPayNode() {
+    console.log('dianji')
+    this.setState({
+      PayNodeVisible: true,
+    });
+  },
   // 自动计算总金额
   calculatedAmount() {
     let currentTotalPrice;
@@ -1992,11 +2021,13 @@ const Task = React.createClass({
   },
   // 保存供应商信息
   handleCancelq() {
-    let api
-    if(this.state.ThirdId){//修改
-      api='/api/admin/company/updateCompany'
-    }else{//新增
-      api='/api/admin/company/addCompany'
+    let api;
+    if (this.state.ThirdId) {
+      //修改
+      api = "/api/admin/company/updateCompany";
+    } else {
+      //新增
+      api = "/api/admin/company/addCompany";
     }
     this.setState({
       loading: true,
@@ -2007,12 +2038,14 @@ const Task = React.createClass({
       dataType: "json",
       crossDomain: false,
       data: {
-        id:this.state.ThirdId,//id
+        id: this.state.ThirdId, //id
         tid: this.state.tid, //订单编号
         companyName: this.state.thirdCompanyName, //第三方名称
         unitPrice: this.state.thirdUnitPrice, //单价
         quantity: this.state.thirdQuantity, //数量
         totalAmount: this.state.currentTotalPrice, //总价
+        material: this.state.thirdMaterial, //材料
+        urgent: this.state.thirdUrgent, //加急
         remarks: this.state.thirdRemarks,
       },
     }).done(
@@ -2023,7 +2056,7 @@ const Task = React.createClass({
         if (!data.error.length) {
           message.success("保存成功!");
           this.setState({
-            ThirdId:"",
+            ThirdId: "",
             ThirdListVisible: false,
             thirdCompanyName: "", //第三方名称
             thirdUnitPrice: "", //单价
@@ -2042,53 +2075,56 @@ const Task = React.createClass({
   // 取消
   handleCancelclose() {
     this.setState({
+      PayNodeVisible: false,
       ThirdListVisible: false,
       thirdCompanyName: "", //第三方名称
       thirdUnitPrice: "", //单价
       thirdQuantity: 1, //数量
       currentTotalPrice: "", //总价
       thirdRemarks: "",
-      ThirdId:"",
+      ThirdId: "",
     });
   },
   // 删除供应商信息
   confirmDeletNew(index) {
-       this.setState({
-        loading: true,
-        ThirdListVisible: false,
-      });
-      $.ajax({
-        url: globalConfig.context + "/api/admin/company/deleteCompany",
-        method: "post",
-        data: {
-          id: index.id,
-        },
-      }).done(
-        function (data) {
-          this.setState({
-            loading: false,
-          });
-          if (!data.error.length) {
-            message.success("删除成功!");
-            this.thirdTable(this.state.tid);
-          } else {
-            message.warning(data.error[0].message);
-          }
-        }.bind(this)
-      );
+    this.setState({
+      loading: true,
+      ThirdListVisible: false,
+    });
+    $.ajax({
+      url: globalConfig.context + "/api/admin/company/deleteCompany",
+      method: "post",
+      data: {
+        id: index.id,
+      },
+    }).done(
+      function (data) {
+        this.setState({
+          loading: false,
+        });
+        if (!data.error.length) {
+          message.success("删除成功!");
+          this.thirdTable(this.state.tid);
+        } else {
+          message.warning(data.error[0].message);
+        }
+      }.bind(this)
+    );
   },
   //点击供应商详情
-    tableRowClickOne(record) {
-      this.setState({
-        ThirdListVisible: true,
-        ThirdId:record.id,//供应商id
-        thirdCompanyName: record.companyName, //第三方名称
-        thirdUnitPrice: record.unitPrice, //单价
-        thirdQuantity: record.quantity, //数量
-        currentTotalPrice:record.totalAmount, //总价
-        thirdRemarks: record.remarks,
-      });
-    },
+  tableRowClickOne(record) {
+    this.setState({
+      ThirdListVisible: true,
+      ThirdId: record.id, //供应商id
+      thirdCompanyName: record.companyName, //第三方名称
+      thirdUnitPrice: record.unitPrice, //单价
+      thirdQuantity: record.quantity, //数量
+      currentTotalPrice: record.totalAmount, //总价
+      thirdMaterial: record.material, //有无材料
+      thirdUrgent: record.urgent, //加急情况
+      thirdRemarks: record.remarks,
+    });
+  },
   render() {
     const dataSources = this.state.customerArr || [];
     console.log(dataSources);
@@ -3265,7 +3301,8 @@ const Task = React.createClass({
                   {/* 第三方信息专利 */}
                   <div
                     style={{
-                      display: this.state.type == 1 ? "block" : "none",
+                      // display: this.state.type == 1 ? "block" : "none",
+                      display: this.state.type == 1 ? "block" : "block",
                     }}
                   >
                     <span
@@ -3302,7 +3339,8 @@ const Task = React.createClass({
                   <div
                     className="clearfix"
                     style={{
-                      display: this.state.type == 1 ? "block" : "none",
+                      // display: this.state.type == 1 ? "block" : "none",
+                      display: this.state.type == 1 ? "block" : "block",
                     }}
                   >
                     <Spin spinning={this.state.loading}>
@@ -3324,6 +3362,41 @@ const Task = React.createClass({
                       </Form>
                     </Spin>
                   </div>
+                  <div
+                    style={{
+                      // display: this.state.type == 1 ? "block" : "none",
+                      display: this.state.type == 1 ? "block" : "block",
+                    }}
+                  >
+                    <span
+                      style={{
+                        marginLeft: "50px",
+                        fontSize: "18px",
+                      }}
+                    >
+                      付款节点
+                    </span>
+                    <span
+                      style={{
+                        display: "inline-block",
+                        marginLeft: 10,
+                        color: "red",
+                      }}
+                    ></span>
+                    <Button
+                      type="primary"
+                      onClick={(e) => {
+                        this.addPayNode();
+                      }}
+                      style={{
+                        float: "right",
+                        marginRight: "50px",
+                        marginBottom: "15px",
+                      }}
+                    >
+                      +新增付款节点
+                    </Button>
+                  </div>
                   <div className="clearfix">
                     <FormItem
                       className="half-item"
@@ -4757,6 +4830,60 @@ const Task = React.createClass({
                   </FormItem>
                 </div>
                 <div className="clearfix">
+                  <FormItem {...formItemLayout} label="材料">
+                    <Select
+                      value={getMaterialStatus(this.state.thirdMaterial)}
+                      onChange={(val) => {
+                        this.setState({
+                          thirdMaterial: val,
+                        });
+                      }}
+                      style={{ width: "220px" }}
+                      defaultValue="0"
+                    >
+                      <Option value="1">有材料</Option>
+                      <Option value="0">无材料</Option>
+                    </Select>
+                    <span className="mandatory">*</span>
+                  </FormItem>
+                </div>
+                <div className="clearfix">
+                  <FormItem {...formItemLayout} label="加急">
+                    {/* <Input
+                      value={this.state.thirdQuantity}
+                      placeholder="请输入数量(必填项)"
+                      required="required"
+                      onBlur={this.calculatedAmount}
+                      onChange={(e) => {
+                        this.setState({
+                          thirdQuantity: e.target.value,
+                        });
+                      }}
+                      style={{ width: "220px" }}
+                    /> */}
+                    <Select
+                      value={getUrgentStatus(this.state.thirdUrgent)}
+                      onChange={(val) => {
+                        this.setState({
+                          thirdUrgent: val,
+                        });
+                      }}
+                      style={{ width: "220px" }}
+                      defaultValue="0"
+                    >
+                      <Option value="0">无加急</Option>
+                      <Option value="1">加急3天</Option>
+                      <Option value="2">加急4天</Option>
+                      <Option value="3">加急5-10天</Option>
+                      <Option value="4">加急11-15天</Option>
+                      <Option value="5">加急16-20天</Option>
+                      <Option value="6">加急21-25天</Option>
+                      <Option value="7">加急26-30天</Option>
+                    </Select>
+                    <span className="mandatory">*</span>
+                  </FormItem>
+                </div>
+                <div className="clearfix">
                   <FormItem
                     style={{ height: "auto" }}
                     labelCol={{ span: 4 }}
@@ -4783,7 +4910,126 @@ const Task = React.createClass({
                       className="cancel"
                       type="primary"
                       onClick={this.handleCancelq}
+                      style={{ marginLeft: "300px" }}
+                      htmlType="submit"
+                    >
+                      保存
+                    </Button>
+                    <Button
+                      className="cancel"
+                      type="ghost"
+                      onClick={this.handleCancelclose}
                       style={{ marginLeft: "50px" }}
+                    >
+                      取消
+                    </Button>
+                  </div>
+                </div>
+              </div>
+            </Spin>
+          </Form>
+        </Modal>
+
+        <Modal
+          visible={this.state.PayNodeVisible}
+          onCancel={this.handleCancelclose}
+          width={800}
+          title="新增付款节点"
+          footer=""
+          // width={1300}
+          className="admin-desc-content"
+        >
+          <Form
+            layout="horizontal"
+            // onSubmit={this.handleSubmit1}
+            // id="demand-form"
+            style={{ paddingBottom: "40px" }}
+          >
+            <Spin spinning={this.state.loading}>
+              <div className="clearfix">
+                <div className="clearfix">
+                  <FormItem {...formItemLayout} label="供应商名称">
+                    <AutoComplete
+                      className="certain-category-search"
+                      dropdownClassName="certain-category-search-dropdown"
+                      dropdownMatchSelectWidth={false}
+                      dropdownStyle={{ width: 220 }}
+                      style={{ width: "220px" }}
+                      dataSource={options}
+                      placeholder="请输入供应商名称"
+                      value={this.state.thirdCompanyName}
+                      onChange={this.httpChange}
+                      filterOption={true}
+                      onBlur={this.blurChange}
+                      onSelect={this.selectAuto}
+                      required="required"
+                    ></AutoComplete>
+                    <span className="mandatory">*</span>
+                  </FormItem>
+                </div>
+                <div className="clearfix">
+                  <FormItem {...formItemLayout} label="付款科目">
+                    <Input
+                      value={this.state.thirdUnitPrice}
+                      placeholder="请选择付款科目(必填项)"
+                      required="required"
+                      onBlur={this.calculatedAmount}
+                      onChange={(e) => {
+                        this.setState({
+                          thirdUnitPrice: e.target.value,
+                        });
+                      }}
+                      style={{ width: "220px" }}
+                    />
+                    <span className="mandatory">*</span>
+                  </FormItem>
+                </div>
+                <div className="clearfix">
+                  <FormItem {...formItemLayout} label="付款时间">
+                    <Input
+                      value={this.state.thirdQuantity}
+                      placeholder="请输入数量(必填项)"
+                      required="required"
+                      onBlur={this.calculatedAmount}
+                      onChange={(e) => {
+                        this.setState({
+                          thirdQuantity: e.target.value,
+                        });
+                      }}
+                      style={{ width: "220px" }}
+                    />
+                    <span className="mandatory">*</span>
+                  </FormItem>
+                </div>
+                <div className="clearfix">
+                  <FormItem {...formItemLayout} label="数量">
+                    <Input
+                      value={this.state.thirdQuantity}
+                      placeholder="请输入数量(必填项)"
+                      required="required"
+                      onBlur={this.calculatedAmount}
+                      onChange={(e) => {
+                        this.setState({
+                          thirdQuantity: e.target.value,
+                        });
+                      }}
+                      style={{ width: "220px" }}
+                    />
+                    <span className="mandatory">*</span>
+                  </FormItem>
+                </div>
+                <div className="clearfix">
+                  <FormItem {...formItemLayout} label="总价(万元)">
+                    <span>{this.state.currentTotalPrice}</span>
+                  </FormItem>
+                </div>
+                <div className="clearfix">
+                  <div className="addSave" style={{ marginTop: "15px" }}>
+                    <Button
+                      className="cancel"
+                      type="primary"
+                      onClick={this.handleCancelq}
+                      style={{ marginLeft: "300px" }}
                       htmlType="submit"
                     >
                       保存

+ 104 - 76
js/component/tools.js

@@ -121,8 +121,8 @@ module.exports = {
           name: name,
           url: url + item,
           response: {
-            data: item
-          }
+            data: item,
+          },
         });
       });
     }
@@ -333,10 +333,10 @@ module.exports = {
   downloadFile: function (path, fileName) {
     window.open(
       globalConfig.context +
-      "/open/downloadFile?path=" +
-      path +
-      "&fileName=" +
-      fileName
+        "/open/downloadFile?path=" +
+        path +
+        "&fileName=" +
+        fileName
     );
   },
   techDownloadFile: function (url, id) {
@@ -352,13 +352,13 @@ module.exports = {
     if (type) {
       window.open(
         globalConfig.context +
-        url +
-        "?id=" +
-        id +
-        "&sign=" +
-        sign +
-        "&type=" +
-        type
+          url +
+          "?id=" +
+          id +
+          "&sign=" +
+          sign +
+          "&type=" +
+          type
       );
     }
   },
@@ -373,20 +373,20 @@ module.exports = {
       dataType: "json",
       crossDomain: false,
       url: globalConfig.context + "/open/html/json/vacations" + theYear,
-      success: data => {
+      success: (data) => {
         if (data) {
           ccccc(data);
         }
-      }
+      },
     });
   },
   getInUrgentTime(date, inUrgent, vocations) {
     if (vocations && vocations.length) {
       let now = new Date(date);
-      for (var i = 1; i <= inUrgent;) {
+      for (var i = 1; i <= inUrgent; ) {
         now.setDate(now.getDate() + 1);
         let thebool = true;
-        vocations.map(item => {
+        vocations.map((item) => {
           if (item == getKey(now)) {
             thebool = false;
           }
@@ -443,7 +443,7 @@ module.exports = {
             </Select.Option>
           );
         }
-      }
+      },
     });
     return theOption;
   },
@@ -470,7 +470,7 @@ module.exports = {
             </Select.Option>
           );
         }
-      }
+      },
     });
     return theOption;
   },
@@ -491,7 +491,7 @@ module.exports = {
           callback(data.data);
         }
         callback(data.data);
-      }
+      },
     });
   },
   //保存高企培育资料完成情况
@@ -505,7 +505,7 @@ module.exports = {
         id: id,
         uid: uid,
         sign: sign,
-        status: status
+        status: status,
       },
       success: function (data) {
         if (!data.data) {
@@ -514,7 +514,7 @@ module.exports = {
           }
           return;
         }
-      }
+      },
     });
   },
   //获取window.location.search传的值
@@ -546,7 +546,7 @@ module.exports = {
       url: globalConfig.context + "/api/admin/preview/" + url,
       data: {
         id: id,
-        sign: sign
+        sign: sign,
       },
       success: function (data) {
         if (!data.data) {
@@ -556,30 +556,30 @@ module.exports = {
         }
         callback(
           "https://view.officeapps.live.com/op/view.aspx?src=" +
-          encodeURIComponent(
-            location.origin +
-            globalConfig.context +
-            "/open/preview?" +
-            data.data
-          )
+            encodeURIComponent(
+              location.origin +
+                globalConfig.context +
+                "/open/preview?" +
+                data.data
+            )
         );
         console.log(
           "https://view.officeapps.live.com/op/view.aspx?src=" +
-          (location.origin +
-            globalConfig.context +
-            "/open/preview?" +
-            data.data)
+            (location.origin +
+              globalConfig.context +
+              "/open/preview?" +
+              data.data)
         );
         console.log(
           "https://view.officeapps.live.com/op/view.aspx?src=" +
-          encodeURIComponent(
-            location.origin +
-            globalConfig.context +
-            "/open/preview?" +
-            data.data
-          )
+            encodeURIComponent(
+              location.origin +
+                globalConfig.context +
+                "/open/preview?" +
+                data.data
+            )
         );
-      }
+      },
     });
   },
   //预览接口
@@ -591,7 +591,7 @@ module.exports = {
       url: globalConfig.context + "/api/admin/customer/" + url,
       data: {
         id: id,
-        sign: sign
+        sign: sign,
       },
       success: function (data) {
         if (!data.data) {
@@ -601,30 +601,30 @@ module.exports = {
         }
         callback(
           "https://view.officeapps.live.com/op/view.aspx?src=" +
-          encodeURIComponent(
-            location.origin +
-            globalConfig.context +
-            "/open/preview?" +
-            data.data
-          )
+            encodeURIComponent(
+              location.origin +
+                globalConfig.context +
+                "/open/preview?" +
+                data.data
+            )
         );
         console.log(
           "https://view.officeapps.live.com/op/view.aspx?src=" +
-          (location.origin +
-            globalConfig.context +
-            "/open/preview?" +
-            data.data)
+            (location.origin +
+              globalConfig.context +
+              "/open/preview?" +
+              data.data)
         );
         console.log(
           "https://view.officeapps.live.com/op/view.aspx?src=" +
-          encodeURIComponent(
-            location.origin +
-            globalConfig.context +
-            "/open/preview?" +
-            data.data
-          )
+            encodeURIComponent(
+              location.origin +
+                globalConfig.context +
+                "/open/preview?" +
+                data.data
+            )
         );
-      }
+      },
     });
   },
   //获取企业规模
@@ -645,13 +645,13 @@ module.exports = {
     for (let i = 0; i < companyType.length; i++) {
       companyTypeList.push({
         value: companyType[i].value,
-        label: companyType[i].label
+        label: companyType[i].label,
       });
       if (companyType[i].children) {
         for (let j = 0; j < companyType[i].children.length; j++) {
           companyTypeList.push({
             value: companyType[i].children[j].value,
-            label: companyType[i].children[j].label
+            label: companyType[i].children[j].label,
           });
         }
       }
@@ -1628,11 +1628,11 @@ module.exports = {
   getApproval: function (e, flag) {
     if (flag) {
       if (e == 0) {
-        return "非特批"
+        return "非特批";
       } else if (e == 1) {
-        return "特批"
+        return "特批";
       } else {
-        return "未知"
+        return "未知";
       }
     }
     if (e || e == 0) {
@@ -1665,6 +1665,35 @@ module.exports = {
     }
   },
 
+  //第三方信息状态----是否有材料
+
+  getMaterialStatus: function (val) {
+    if (val == 0) {
+      return "无材料";
+    } else if (val == 1) {
+      return "有材料";
+    }
+  },
+  //第三方信息状态----加急
+  getUrgentStatus: function (val) {
+    if (val == 0) {
+      return "无加急";
+    } else if (val == 1) {
+      return "加急3天";
+    } else if (val == 2) {
+      return "加急4天";
+    } else if (val == 3) {
+      return "加急5-10天";
+    } else if (val == 4) {
+      return "加急11-15天";
+    } else if (val == 5) {
+      return "加急16-20天";
+    } else if (val == 6) {
+      return "加急21-25天";
+    } else if (val == 7) {
+      return "加急26-30天";
+    }
+  },
   //审核状态
   getStatus: function (val) {
     if (val == 0) {
@@ -1812,7 +1841,7 @@ module.exports = {
   //开票状态
   getInvoiceStatus: function (e, record) {
     if (record && record.approval == 1) {
-      return "特批待审核"
+      return "特批待审核";
     } else {
       if (e || e == 0) {
         let str = e.toString();
@@ -1825,7 +1854,6 @@ module.exports = {
         return theType;
       }
     }
-
   },
   getApprovalA: function (e) {
     if (e || e == 0) {
@@ -1879,11 +1907,11 @@ module.exports = {
       num = "通过";
     } else if (status == 3) {
       num = "驳回";
-      return num + "到" + str
+      return num + "到" + str;
     } else if (status == 4) {
       num = "完成";
-    } else if(status == 5) {
-      num = "取消变更"
+    } else if (status == 5) {
+      num = "取消变更";
     }
     if (pro == 7 && status == 2) {
       return "订单变更退票中";
@@ -1935,13 +1963,13 @@ module.exports = {
   },
   moneyVerify(e) {
     if (!/^\d{1,3}(,?\d{3})*(\.\d{1,4})?$/.test(e)) {
-      message.warning("输入金额不符合规范")
-      return true
+      message.warning("输入金额不符合规范");
+      return true;
     }
   },
   // 消息提醒函数接口
   ShowModal(fn) {
-    let flag = true
+    let flag = true;
     $.ajax({
       method: "get",
       dataType: "json",
@@ -1952,11 +1980,11 @@ module.exports = {
         if (data.data != 0) {
           console.log(data);
           fn.setState({
-            showModal: true
+            showModal: true,
           });
         }
-      }
-    })
+      },
+    });
     // return flag
   },
   getType(e) {
@@ -1974,6 +2002,6 @@ module.exports = {
   changeColor(e) {
     return (
       <span style={{ color: "red", fontWeight: 900, fontSize: 16 }}>{e}</span>
-    )
-  }
+    );
+  },
 };