mentoswzq 5 years ago
parent
commit
f8d067aa5f

+ 1 - 1
js/component/manageCenter/financialManage/distribute/approvedOutsourcing.jsx

@@ -2241,7 +2241,7 @@ const approvedOutsourcing = React.createClass({
     });
   },
   checkOk() {
-    if (this.state.checkData.trim() == "") {
+    if (this.state.checkData == "" || this.state.checkData == undefined) {
       message.warning("请填写审核内容");
       return;
     }

+ 1 - 1
js/component/manageCenter/financialManage/distribute/shouKuang.jsx

@@ -1536,7 +1536,7 @@ const ShouKuang = React.createClass({
     });
   },
   checkOk() {
-    if (this.state.checkData.trim() == "") {
+    if (this.state.checkData == "" || this.state.checkData == undefined) {
       message.warning("请填写审核内容");
       return;
     }

+ 0 - 3
js/component/manageCenter/order/orderNew/changeComponent/changeApply.js

@@ -643,9 +643,6 @@ class ChangeApply extends Component {
     if (moneyVerify(this.state.data.totalAmount)) {
       return false;
     }
-    if (moneyVerify(this.state.data.settlementAmount)) {
-      return false;
-    }
     if (moneyVerify(this.state.data.changeAmount)) {
       return false;
     }

+ 1 - 1
js/component/manageCenter/order/orderNew/changeComponent/proAndCuiList.jsx

@@ -306,7 +306,7 @@ const ProAndCuiList = React.createClass({
       <div
         style={{
           display:
-            proArr && proArr.length && cuiArr && cuiArr.length
+            proArr && proArr.length
               ? "block"
               : "none"
         }}

+ 254 - 55
js/component/manageCenter/project/project/outsourceTaskAssignment.jsx

@@ -1,8 +1,9 @@
 import React from "react";
 import $ from "jquery/src/ajax";
 import "@/manageCenter/financialManage/distribute/public.less";
-import { Button, Form, Input, Select, Spin, Table, message, Modal,Tabs } from "antd";
+import { Button, Form, Input, Select, Spin, Table, message, Modal,Tabs, Tag } from "antd";
 import Assign from "@/manageCenter/publicComponent/assign";
+import ResolutionDetail from "@/resolutionDetail";
 import {
   getProcessStatus,
   getLiquidationStatus,
@@ -13,6 +14,7 @@ import {
   ShowModal
 } from "@/tools";
 import ShowModalDiv from "@/showModal.jsx";
+import ResolutionPro from "../task/resolutionPro";
 const FormItem = Form.Item;
 const {TabPane} = Tabs
 const OutsourceTaskAssignment = React.createClass({
@@ -49,8 +51,13 @@ const OutsourceTaskAssignment = React.createClass({
         } else {
           for (let i = 0; i < data.data.list.length; i++) {
             let thisdata = data.data.list[i];
+            if (thisdata.splitList) {
+              thisdata.splitList.forEach(item => {
+                item.key = item.id;
+              });
+            }
             theArr.push({
-              key: i,
+              key: thisdata.id,
               orderNo: thisdata.orderNo, //订单编号
               id: thisdata.id, //任务ID
               taskName: thisdata.taskName, //名称
@@ -61,7 +68,9 @@ const OutsourceTaskAssignment = React.createClass({
               taskDate: thisdata.taskDate, //分配时间
               commodityQuantity: thisdata.commodityQuantity, //数量
               userName: thisdata.userName, //用户名
-              depName: thisdata.depName //部门名称
+              depName: thisdata.depName, //部门名称
+              splitStatus: thisdata.splitStatus, //拆分状态
+              splitList: thisdata.splitList
             });
           }
         }
@@ -167,6 +176,7 @@ const OutsourceTaskAssignment = React.createClass({
                 <Button
                   type="primary"
                   style={{ margin: "0 10px" }}
+                  disabled={record.splitStatus == 1 ? true : false}
                   onClick={e => {
                     e.stopPropagation(), this.evaluate(record, "咨询师经理");
                   }}
@@ -176,12 +186,32 @@ const OutsourceTaskAssignment = React.createClass({
                 <Button
                   type="primary"
                   style={{ margin: "0 10px" }}
+                  disabled={record.splitStatus == 1 ? true : false}
                   onClick={e => {
                     e.stopPropagation(), this.evaluate(record, "咨询师");
                   }}
                 >
                   分配任务
                 </Button>
+                {record.splitStatus == 0 ? (
+                  <Button
+                    type="primary"
+                    style={{ margin: "0 10px" }}
+                    onClick={e => {
+                      e.stopPropagation();
+                      this.setState({
+                        resolutionVisible: true,
+                        resolutionName: record.taskName,
+                        resolutionNumber: record.commodityQuantity,
+                        resolutionId: record.id
+                      });
+                    }}
+                  >
+                    拆分项目
+                  </Button>
+                ) : (
+                  ""
+                )}
               </div>
             );
           }
@@ -203,7 +233,27 @@ const OutsourceTaskAssignment = React.createClass({
         {
           title: "项目数量",
           dataIndex: "commodityQuantity",
-          key: "commodityQuantity"
+          key: "commodityQuantity",
+          render: (text, record) => {
+            if (record.splitStatus == 1) {
+              return (
+                <span>
+                  {text}{" "}
+                  <Tag
+                    color="#108ee9"
+                    onClick={e => {
+                      e.stopPropagation();
+                      this.showRes(record);
+                    }}
+                  >
+                    已拆
+                  </Tag>
+                </span>
+              );
+            } else {
+              return text;
+            }
+          }
         },
         {
           title: "金额(万元)",
@@ -237,7 +287,8 @@ const OutsourceTaskAssignment = React.createClass({
           }
         }
       ],
-      dataSourceX: []
+      dataSourceX: [],
+      resVisible: false
     };
   },
   /* 分派 */
@@ -267,6 +318,18 @@ const OutsourceTaskAssignment = React.createClass({
     this.xiangqing(record.orderNo);
     this.xiangmu(record.orderNo);
   },
+  // 拆分详细
+  showRes(record) {
+    this.setState({
+      resVisible: true,
+      resRecord: record
+    });
+  },
+  resCancel() {
+    this.setState({
+      resVisible: false
+    });
+  },
   //订单详情
   xiangqing(orderNos) {
     $.ajax({
@@ -360,7 +423,8 @@ const OutsourceTaskAssignment = React.createClass({
               taskComment: thisdata.taskComment, //任务说明
               contacts: thisdata.contacts, //联系人
               contactsMobile: thisdata.contactsMobile, //联系人电话
-              taskStatus: thisdata.taskStatus //是否分配
+              taskStatus: thisdata.taskStatus, //是否分配
+              splitStatus: thisdata.splitStatus
             });
           }
         }
@@ -381,7 +445,7 @@ const OutsourceTaskAssignment = React.createClass({
     this.setState({
       visible: false
     });
-    this.reset();
+    this.loadData();
   },
   visitOk() {
     this.setState({
@@ -478,7 +542,124 @@ const OutsourceTaskAssignment = React.createClass({
       }.bind(this)
     );
   },
+  resolutionCancel() {
+    this.setState({
+      resolutionVisible: false
+    });
+  },
   render() {
+    const expandedRowRender = e => {
+      const data = e.splitList;
+      let columns = [];
+      if (e.splitList instanceof Array && e.splitList.length) {
+        columns = [
+          {
+            title: "任务编号",
+            dataIndex: "id",
+            key: "id"
+          },
+          {
+            title: "任务名称",
+            dataIndex: "taskName",
+            key: "taskName"
+          },
+          {
+            title: "订单编号",
+            dataIndex: "orderNo",
+            key: "orderNo"
+          },
+          {
+            title: "业务类别",
+            dataIndex: "cname",
+            key: "cname"
+          },
+          {
+            title: "客户名称",
+            dataIndex: "userName",
+            key: "userName"
+          },
+          {
+            title: "项目状态",
+            dataIndex: "projectStatus",
+            key: "projectStatus",
+            render: text => {
+              return getProjectStatus(text);
+            }
+          },
+          {
+            title: "分配时间",
+            dataIndex: "taskDate",
+            key: "taskDate"
+          },
+          {
+            title: "任务数量",
+            dataIndex: "commodityQuantity",
+            key: "commodityQuantity"
+          },
+          {
+            title: "订单部门",
+            dataIndex: "depName",
+            key: "depName"
+          },
+          {
+            title: "拆分操作人",
+            dataIndex: "splitAname",
+            key: "splitAname"
+          },
+          {
+            title: "拆分时间人",
+            dataIndex: "splitTimes",
+            key: "splitTimes"
+          },
+          {
+            title: "操作",
+            dataIndex: "caozuo",
+            key: "caouzo",
+            render: (text, record) => {
+              return (
+                <div>
+                  <Button
+                    type="primary"
+                    style={{ margin: "0 10px" }}
+                    disabled={record.distributeSign == 1 ? true : false}
+                    onClick={e => {
+                      e.stopPropagation(), this.evaluate(record, "咨询师经理");
+                    }}
+                  >
+                    转交
+                  </Button>
+                  <Button
+                    type="primary"
+                    style={{ margin: "0 10px" }}
+                    disabled={record.distributeSign == 1 ? true : false}
+                    onClick={e => {
+                      e.stopPropagation(), this.evaluate(record, "咨询师");
+                    }}
+                  >
+                    分配任务
+                  </Button>
+                </div>
+              );
+            }
+          }
+        ];
+        return (
+          <Table
+            columns={columns}
+            dataSource={data}
+            pagination={false}
+            onRowClick={this.tableRowClick.bind(this)}
+          />
+        );
+      } else {
+        columns = [];
+        return (
+          <p style={{ fontWeight: "bold", color: "red", textAlign: "center" }}>
+            此项目暂未拆分
+          </p>
+        );
+      }
+    };
     const rowSelection = {
       selectedRowKeys: this.state.selectedRowKeys,
       onChange: (selectedRowKeys, selectedRows) => {
@@ -495,56 +676,73 @@ const OutsourceTaskAssignment = React.createClass({
     let departmentArr = this.state.departmentArr || [];
     return (
       <div className="user-content">
+        {this.state.resVisible ? (
+          <ResolutionDetail
+            cancel={this.resCancel}
+            detail={this.state.resRecord}
+            visible={this.state.resVisible}
+            id={this.state.resRecord.orderNo}
+          />
+        ) : (
+          ""
+        )}
+        <ResolutionPro
+          resolutionVisible={this.state.resolutionVisible}
+          number={this.state.resolutionNumber}
+          name={this.state.resolutionName}
+          cancel={this.resolutionCancel}
+          id={this.state.resolutionId}
+          loadData={this.loadData}
+        />
         <ShowModalDiv ShowModal={this.state.showModal} />
         <div className="content-title">
           <span>外包任务派单</span>
         </div>
-        <Tabs
-          defaultActiveKey="1"
-          onChange={this.callback}
-          className="test">
-             <TabPane tab="搜索" key="1">
-        <div className="user-search">
-          <Input
-            placeholder="客户名称"
-            value={this.state.nameSearch}
-            style={{marginLeft:10}}
-            onChange={e => {
-              this.setState({ nameSearch: e.target.value });
-            }}
-          />
-          <Input
-            placeholder="订单编号"
-            value={this.state.orderNoSearch}
-            onChange={e => {
-              this.setState({ orderNoSearch: e.target.value });
-            }}
-          />
-          <Input
-            placeholder="任务编号"
-            value={this.state.taskNoSearch}
-            onChange={e => {
-              this.setState({ taskNoSearch: e.target.value });
-            }}
-          />
-          <Select
-            placeholder="选择部门"
-            style={{ width: 150, marginRight: "10px" }}
-            value={this.state.departmenttSearch}
-            onChange={e => {
-              this.setState({ departmenttSearch: e });
-            }}
-          >
-            {departmentArr.map(function(item) {
-              return <Select.Option key={item.id}>{item.name}</Select.Option>;
-            })}
-          </Select>
-          <Button type="primary" onClick={this.search}>
-            搜索
-          </Button>
-          <Button onClick={this.reset}>重置</Button>
+        <Tabs defaultActiveKey="1" onChange={this.callback} className="test">
+          <TabPane tab="搜索" key="1">
+            <div className="user-search">
+              <Input
+                placeholder="客户名称"
+                value={this.state.nameSearch}
+                style={{ marginLeft: 10 }}
+                onChange={e => {
+                  this.setState({ nameSearch: e.target.value });
+                }}
+              />
+              <Input
+                placeholder="订单编号"
+                value={this.state.orderNoSearch}
+                onChange={e => {
+                  this.setState({ orderNoSearch: e.target.value });
+                }}
+              />
+              <Input
+                placeholder="任务编号"
+                value={this.state.taskNoSearch}
+                onChange={e => {
+                  this.setState({ taskNoSearch: e.target.value });
+                }}
+              />
+              <Select
+                placeholder="选择部门"
+                style={{ width: 150, marginRight: "10px" }}
+                value={this.state.departmenttSearch}
+                onChange={e => {
+                  this.setState({ departmenttSearch: e });
+                }}
+              >
+                {departmentArr.map(function(item) {
+                  return (
+                    <Select.Option key={item.id}>{item.name}</Select.Option>
+                  );
+                })}
+              </Select>
+              <Button type="primary" onClick={this.search}>
+                搜索
+              </Button>
+              <Button onClick={this.reset}>重置</Button>
 
-          {/* <span>更多搜索<Switch defaultChecked={false} onChange={this.searchSwitch.bind(this)} /></span>
+              {/* <span>更多搜索<Switch defaultChecked={false} onChange={this.searchSwitch.bind(this)} /></span>
                     <div className="search-more" style={this.state.searchMore ? { display: 'none' } : {}}>
                         <span>订单时间 :</span>
                         <RangePicker
@@ -552,15 +750,16 @@ const OutsourceTaskAssignment = React.createClass({
                             this.state.releaseDate[1] ? moment(this.state.releaseDate[1]) : null]}
                             onChange={(data, dataString) => { this.setState({ releaseDate: dataString }); }} />
                     </div> */}
-        </div>
-        </TabPane>
+            </div>
+          </TabPane>
         </Tabs>
         <div className="patent-table">
           <Spin spinning={this.state.loading}>
             <Table
               columns={this.state.columns}
               dataSource={this.state.dataSource}
-              rowSelection={rowSelection}
+              expandedRowRender={expandedRowRender}
+              // rowSelection={rowSelection}
               pagination={this.state.pagination}
               onRowClick={this.tableRowClick.bind(this)}
               bordered

BIN
js/component/manageCenter/project/task/example.png


+ 1 - 0
js/component/manageCenter/project/task/myTaskCount.jsx

@@ -769,6 +769,7 @@ const MyTaskCount = Form.create()(
       this.state.departmenttList = []
       this.state.cid = []
       this.state.contractNoSearch = ""
+      this.state.outsourceSearch = [];
       this.loadData(this.state.page);
     },
     resets() {

+ 195 - 77
js/component/manageCenter/project/task/resolutionPro.jsx

@@ -1,5 +1,17 @@
 import React from "react";
-import { Spin, Button, Tabs, Table, message, Modal,Input,Tag } from "antd";
+import {
+  Spin,
+  Button,
+  Tabs,
+  Table,
+  message,
+  Modal,
+  Input,
+  Tag,
+  Popconfirm
+} from "antd";
+import img from "./example.png"
+import $ from "jquery/src/ajax";
 
 const ResolutionPro = React.createClass({
   getInitialState() {
@@ -26,6 +38,23 @@ const ResolutionPro = React.createClass({
     this.setState({
       visible: nextProps.resolutionVisible
     });
+    const arr = [
+      {
+        name: "子项目1",
+        number: 0
+      },
+      {
+        name: "子项目2",
+        number: 0
+      },
+      {
+        name: "子项目3",
+        number: 0
+      }
+    ];
+    this.setState({
+      proArr: arr
+    });
   },
   handleOk() {
     const arr = [
@@ -48,7 +77,6 @@ const ResolutionPro = React.createClass({
     });
   },
   addPro() {
-
     const obj = {
         name: "子项目" + (this.state.proArr.length + 1),
         number: 0
@@ -59,7 +87,7 @@ const ResolutionPro = React.createClass({
     })
   },
   deletePro() {
-    if(this.state.proArr.length == 1) {
+    if(this.state.proArr.length == 2) {
         message.warning("不能继续删除子项目!")
         return
     }
@@ -68,84 +96,174 @@ const ResolutionPro = React.createClass({
         proArr: this.state.proArr
     })
   },
+  submit() {
+    const arr = this.state.proArr
+    const numArr = []
+    arr.forEach(item => {
+      let num = +item.number
+      if(num != 0) {
+        numArr.push(num);
+      }
+    });
+    let sum = 0
+    numArr.forEach( item => {
+      sum += item
+    })
+    if(sum != this.props.number) {
+      message.warning("拆分数量总和与原项目数量不匹配,请重新填写数量!")
+      return
+    }
+    let str = numArr.join(",")
+    this.setState({
+      loading: true
+    });
+    $.ajax({
+      method: "post",
+      dataType: "json",
+      crossDomain: false,
+      url: globalConfig.context + "/api/admin/orderProject/addSplitProject",
+      data: {
+        tid: this.props.id,
+        splitList: str
+      },
+      success: function(data) {
+        let thedata = data.data;
+        if (!thedata) {
+          if (data.error && data.error.length) {
+            message.warning(data.error[0].message);
+          }
+          thedata = {};
+        } else {
+          message.success("拆分成功!")
+          this.props.cancel()
+          this.props.loadData()
+        }
+      }.bind(this)
+    }).always(
+      function() {
+        this.setState({
+          loading: false
+        });
+      }.bind(this)
+    );
+  },
+  changeNum() {
+    let sum = 0
+    this.state.proArr.forEach(item => {
+      sum += (+item.number)
+    })
+    return sum
+  },
   render() {
     return (
-      <Modal
-        style={{ position: "relative" }}
-        title="拆分项目"
-        visible={this.state.visible}
-        onCancel={this.handleOk}
-        footer={null}
-        destroyOnClose={true}
-      >
-        <div>当前项目名称:专利</div>
-        <div>当前项目数量:80</div>
-        <div>
-          选项:
-          <Button type="primary" onClick={this.addPro}>
-            +增加子项目
-          </Button>
-          <Button
-            type="primary"
-            style={{ marginLeft: 10 }}
-            onClick={this.deletePro}
-          >
-            -删除子项目
-          </Button>
-        </div>
-        {this.state.proArr.map((item, index) => {
-          return (
-            <div style={{ display: "inline-block" }}>
-              <span style={{ display: "block" }}>{item.name}</span>
-              <Input
-                value={item.number}
-                style={{ width: 40 }}
-                onBlur={e => {
-                    if(e.target.value.trim() == "") {
-                        this.state.proArr[index].number = 0
+      <div>
+        <Modal
+          style={{ position: "relative" }}
+          title="拆分项目"
+          visible={this.state.visible}
+          onCancel={this.props.cancel}
+          footer={null}
+          destroyOnClose={true}
+        >
+          <div style={{ marginBottom: 10 }}>
+            当前项目名称:{this.props.name}
+          </div>
+          <div style={{ marginBottom: 10 }}>
+            当前项目数量:{this.props.number}
+          </div>
+          <div style={{ marginBottom: 10 }}>
+            选项:
+            <Button type="primary" onClick={this.addPro}>
+              +增加子项目
+            </Button>
+            <Button
+              type="primary"
+              style={{ marginLeft: 10 }}
+              onClick={this.deletePro}
+            >
+              -删除子项目
+            </Button>
+          </div>
+          <div style={{ width: "250px", marginBottom: "10px" }}>
+            {this.state.proArr.map((item, index) => {
+              return (
+                <div style={{ display: "inline-block" }}>
+                  <span style={{ display: "block" }}>{item.name}</span>
+                  <Input
+                    value={item.number}
+                    style={{ width: 40 }}
+                    onBlur={e => {
+                      if (e.target.value.trim() == "") {
+                        this.state.proArr[index].number = 0;
                         this.setState({
-                            proArr: this.state.proArr
-                        })
-                    }
-                }}
-                onChange={e => {
-                  const reg = /^[0-9]\d*$/
-                  if(!reg.test(+e.target.value)) {
-                      return
-                  }
-                  this.state.proArr[index].number = e.target.value;
-                  this.setState(
-                    {
-                      proArr: this.state.proArr
-                    },
-                    () => {
-                      console.log(this.state.proArr);
-                    }
-                  );
-                }}
-              />
-              <span color={"#2db7f5"} style={{ marginLeft: 5 }}>
-                {index == this.state.proArr.length - 1 ? "=" : "+"}
-              </span>
-              <span style={{ marginLeft: 5 }}>
-                {index == this.state.proArr.length - 1 ? "80" : ""}
+                          proArr: this.state.proArr
+                        });
+                      }
+                    }}
+                    onChange={e => {
+                      const reg = /^[0-9]\d*$/;
+                      if (!reg.test(+e.target.value)) {
+                        return;
+                      }
+                      this.state.proArr[index].number = e.target.value;
+                      this.setState(
+                        {
+                          proArr: this.state.proArr
+                        },
+                        () => {
+                          console.log(this.state.proArr);
+                        }
+                      );
+                    }}
+                  />
+                  <span color={"#2db7f5"} style={{ marginLeft: 5 }}>
+                    {index == this.state.proArr.length - 1 ? "=" : "+"}
+                  </span>
+                  <span style={{ marginLeft: 5 }}>
+                    {index == this.state.proArr.length - 1
+                      ? this.changeNum()
+                      : ""}
+                  </span>
+                </div>
+              );
+            })}
+          </div>
+          <img
+            src={img}
+            style={{
+              position: "absolute",
+              width: "150px",
+              right: "20px",
+              top: "50%",
+              transform: "translateY(-50%)"
+            }}
+          />
+          <p style={{ color: "red" }}>各子项目相加需等于当前项目数量!</p>
+          <Popconfirm
+            placement="top"
+            title={
+              <span style={{ color: "red", fontWeight: 900 }}>
+                系统提示:请确定将当前项目数量按选项,进行拆分,拆分为子项目后,不可修改!!!
               </span>
-            </div>
-          );
-        })}
-        <p style={{ color: "red" }}>各子项目相加需等于当前项目数量!</p>
-        <Button
-          type="primary"
-          style={{
-            position: "relative",
-            left: "50%",
-            bottom: -20,
-            transform: "translate(-50%, -50%)"
-          }}
-        >
-          确认拆分
-        </Button>
-      </Modal>
+            }
+            onConfirm={this.submit}
+            okText="确定"
+            cancelText="取消"
+          >
+            <Button
+              type="primary"
+              style={{
+                position: "relative",
+                left: "50%",
+                bottom: -20,
+                transform: "translate(-50%, -50%)"
+              }}
+            >
+              确认拆分
+            </Button>
+          </Popconfirm>
+        </Modal>
+      </div>
     );
   }
 });

+ 250 - 82
js/component/manageCenter/project/task/taskAssignment.jsx

@@ -1,8 +1,9 @@
 import React from "react";
 import $ from "jquery/src/ajax";
 import "@/manageCenter/financialManage/distribute/public.less";
-import { Button, Form, Input, Select, Spin, Table, message, Modal, Tabs } from "antd";
+import { Button, Form, Input, Select, Spin, Table, message, Modal, Tabs, Tag } from "antd";
 import Assign from "@/manageCenter/publicComponent/assign";
+import ResolutionDetail from "@/resolutionDetail"
 import {
   getProcessStatus,
   getLiquidationStatus,
@@ -49,8 +50,13 @@ const Task = React.createClass({
         } else {
           for (let i = 0; i < data.data.list.length; i++) {
             let thisdata = data.data.list[i];
+            if(thisdata.splitList) {
+              thisdata.splitList.forEach(item => {
+                item.key = item.id
+              });
+            }
             theArr.push({
-              key: i,
+              key: thisdata.id,
               orderNo: thisdata.orderNo, //订单编号
               id: thisdata.id, //任务ID
               taskName: thisdata.taskName, //名称
@@ -62,7 +68,8 @@ const Task = React.createClass({
               commodityQuantity: thisdata.commodityQuantity, //数量
               userName: thisdata.userName, //用户名
               depName: thisdata.depName, //部门名称
-              splitStatus: thisdata.splitStatus //拆分状态
+              splitStatus: thisdata.splitStatus, //拆分状态
+              splitList: thisdata.splitList
             });
           }
         }
@@ -168,10 +175,8 @@ const Task = React.createClass({
                 <Button
                   type="primary"
                   style={{ margin: "0 10px" }}
+                  disabled={record.splitStatus == 1 ? true : false}
                   onClick={e => {
-                    this.setState({
-                      resolutionVisible: false
-                    })
                     e.stopPropagation(), this.evaluate(record, "咨询师经理");
                   }}
                 >
@@ -180,33 +185,32 @@ const Task = React.createClass({
                 <Button
                   type="primary"
                   style={{ margin: "0 10px" }}
+                  disabled={record.splitStatus == 1 ? true : false}
                   onClick={e => {
-                    this.setState({
-                      resolutionVisible: false
-                    });
                     e.stopPropagation(), this.evaluate(record, "咨询师");
                   }}
                 >
                   分配任务
                 </Button>
-                {
-                  record.splitStatus == 0 ? (
-                    <Button
-                  type="primary"
-                  style={{ margin: "0 10px" }}
-                  onClick={e => {
-                    e.stopPropagation();
-                    this.setState({
-                      resolutionVisible: true
-                    });
-                  }}
-                >
-                  拆分项目
-                </Button>
-                  ) : (
-                    ""
-                  )
-                }
+                {record.splitStatus == 0 ? (
+                  <Button
+                    type="primary"
+                    style={{ margin: "0 10px" }}
+                    onClick={e => {
+                      e.stopPropagation();
+                      this.setState({
+                        resolutionVisible: true,
+                        resolutionName: record.taskName,
+                        resolutionNumber: record.commodityQuantity,
+                        resolutionId: record.id
+                      });
+                    }}
+                  >
+                    拆分项目
+                  </Button>
+                ) : (
+                  ""
+                )}
               </div>
             );
           }
@@ -229,7 +233,24 @@ const Task = React.createClass({
         {
           title: "项目数量",
           dataIndex: "commodityQuantity",
-          key: "commodityQuantity"
+          key: "commodityQuantity",
+          render: (text, record) => {
+            if (record.splitStatus == 1) {
+              return (
+                <span>
+                  {text}{" "}
+                  <Tag color="#108ee9" onClick={e => {
+                    e.stopPropagation()
+                    this.showRes(record)
+                  }}>
+                    已拆
+                  </Tag>
+                </span>
+              );
+            } else {
+              return text;
+            }
+          }
         },
         {
           title: "金额(万元)",
@@ -263,7 +284,8 @@ const Task = React.createClass({
           }
         }
       ],
-      dataSourceX: []
+      dataSourceX: [],
+      resVisible: false
     };
   },
   /* 分派 */
@@ -288,11 +310,23 @@ const Task = React.createClass({
   tableRowClick(record) {
     this.state.RowData = record;
     this.setState({
-      visible: true
+      visible: true,
     });
     this.xiangqing(record.orderNo);
     this.xiangmu(record.orderNo);
   },
+  // 拆分详细
+  showRes(record) {
+    this.setState({
+      resVisible: true,
+      resRecord: record
+    })
+  },
+  resCancel() {
+    this.setState({
+      resVisible: false
+    })
+  },
   //订单详情
   xiangqing(orderNos) {
     $.ajax({
@@ -386,7 +420,8 @@ const Task = React.createClass({
               taskComment: thisdata.taskComment, //任务说明
               contacts: thisdata.contacts, //联系人
               contactsMobile: thisdata.contactsMobile, //联系人电话
-              taskStatus: thisdata.taskStatus //是否分配
+              taskStatus: thisdata.taskStatus, //是否分配
+              splitStatus: thisdata.splitStatus 
             });
           }
         }
@@ -407,7 +442,7 @@ const Task = React.createClass({
     this.setState({
       visible: false
     });
-    this.reset();
+    this.loadData();
   },
   visitOk() {
     this.setState({
@@ -504,7 +539,124 @@ const Task = React.createClass({
       }.bind(this)
     );
   },
+  resolutionCancel() {
+    this.setState({
+      resolutionVisible: false
+    })
+  },
   render() {
+    const expandedRowRender = (e) => {
+      const data = e.splitList
+      let columns = []
+    if (e.splitList instanceof Array && e.splitList.length) {
+      columns = [
+        {
+          title: "任务编号",
+          dataIndex: "id",
+          key: "id"
+        },
+        {
+          title: "任务名称",
+          dataIndex: "taskName",
+          key: "taskName"
+        },
+        {
+          title: "订单编号",
+          dataIndex: "orderNo",
+          key: "orderNo"
+        },
+        {
+          title: "业务类别",
+          dataIndex: "cname",
+          key: "cname"
+        },
+        {
+          title: "客户名称",
+          dataIndex: "userName",
+          key: "userName"
+        },
+        {
+          title: "项目状态",
+          dataIndex: "projectStatus",
+          key: "projectStatus",
+          render: text => {
+            return getProjectStatus(text);
+          }
+        },
+        {
+          title: "分配时间",
+          dataIndex: "taskDate",
+          key: "taskDate"
+        },
+        {
+          title: "任务数量",
+          dataIndex: "commodityQuantity",
+          key: "commodityQuantity"
+        },
+        {
+          title: "订单部门",
+          dataIndex: "depName",
+          key: "depName"
+        },
+        {
+          title: "拆分操作人",
+          dataIndex: "splitAname",
+          key: "splitAname"
+        },
+        {
+          title: "拆分时间人",
+          dataIndex: "splitTimes",
+          key: "splitTimes"
+        },
+        {
+          title: "操作",
+          dataIndex: "caozuo",
+          key: "caouzo",
+          render: (text, record) => {
+            return (
+              <div>
+                <Button
+                  type="primary"
+                  style={{ margin: "0 10px" }}
+                  disabled={record.distributeSign == 1 ? true : false}
+                  onClick={e => {
+                    e.stopPropagation(), this.evaluate(record, "咨询师经理");
+                  }}
+                >
+                  转交
+                </Button>
+                <Button
+                  type="primary"
+                  style={{ margin: "0 10px" }}
+                  disabled={record.distributeSign == 1 ? true : false}
+                  onClick={e => {
+                    e.stopPropagation(), this.evaluate(record, "咨询师");
+                  }}
+                >
+                  分配任务
+                </Button>
+              </div>
+            );
+          }
+        }
+      ];
+      return (
+        <Table
+          columns={columns}
+          dataSource={data}
+          pagination={false}
+          onRowClick={this.tableRowClick.bind(this)}
+        />
+      );
+    } else {
+      columns = [];
+      return (
+        <p style={{ fontWeight: "bold", color: "red", textAlign: "center" }}>
+          此项目暂未拆分
+        </p>
+      );
+    }
+  }
     const rowSelection = {
       selectedRowKeys: this.state.selectedRowKeys,
       onChange: (selectedRowKeys, selectedRows) => {
@@ -521,56 +673,72 @@ const Task = React.createClass({
     let departmentArr = this.state.departmentArr || [];
     return (
       <div className="user-content">
-        <ResolutionPro  resolutionVisible={this.state.resolutionVisible} />
+        {
+          this.state.resVisible ? (
+            <ResolutionDetail
+              cancel={this.resCancel}
+              detail={this.state.resRecord}
+              visible={this.state.resVisible}
+              id={this.state.resRecord.orderNo}
+            />
+          ) : ("")
+        }
+        <ResolutionPro
+          resolutionVisible={this.state.resolutionVisible}
+          number={this.state.resolutionNumber}
+          name={this.state.resolutionName}
+          cancel={this.resolutionCancel}
+          id={this.state.resolutionId}
+          loadData={this.loadData}
+        />
         <ShowModalDiv ShowModal={this.state.showModal} />
         <div className="content-title">
           <span>任务派单</span>
         </div>
-        <Tabs
-          defaultActiveKey="1"
-          onChange={this.callback}
-          className="test">
-             <TabPane tab="搜索" key="1">
-        <div className="user-search">
-          <Input
-            placeholder="客户名称"
-            value={this.state.nameSearch}
-            style={{marginLeft:10}}
-            onChange={e => {
-              this.setState({ nameSearch: e.target.value });
-            }}
-          />
-          <Input
-            placeholder="订单编号"
-            value={this.state.orderNoSearch}
-            onChange={e => {
-              this.setState({ orderNoSearch: e.target.value });
-            }}
-          />
-          <Input
-            placeholder="任务编号"
-            value={this.state.taskNoSearch}
-            onChange={e => {
-              this.setState({ taskNoSearch: e.target.value });
-            }}
-          />
-          <Select
-            placeholder="选择部门"
-            style={{ width: 150, marginRight: "10px" }}
-            value={this.state.departmenttSearch}
-            onChange={e => {
-              this.setState({ departmenttSearch: e });
-            }}
-          >
-            {departmentArr.map(function(item) {
-              return <Select.Option key={item.id}>{item.name}</Select.Option>;
-            })}
-          </Select>
-          <Button type="primary" onClick={this.search}>
-            搜索
-          </Button>
-          <Button onClick={this.reset}>重置</Button>
-          {/* <span>更多搜索<Switch defaultChecked={false} onChange={this.searchSwitch.bind(this)} /></span>
+        <Tabs defaultActiveKey="1" onChange={this.callback} className="test">
+          <TabPane tab="搜索" key="1">
+            <div className="user-search">
+              <Input
+                placeholder="客户名称"
+                value={this.state.nameSearch}
+                style={{ marginLeft: 10 }}
+                onChange={e => {
+                  this.setState({ nameSearch: e.target.value });
+                }}
+              />
+              <Input
+                placeholder="订单编号"
+                value={this.state.orderNoSearch}
+                onChange={e => {
+                  this.setState({ orderNoSearch: e.target.value });
+                }}
+              />
+              <Input
+                placeholder="任务编号"
+                value={this.state.taskNoSearch}
+                onChange={e => {
+                  this.setState({ taskNoSearch: e.target.value });
+                }}
+              />
+              <Select
+                placeholder="选择部门"
+                style={{ width: 150, marginRight: "10px" }}
+                value={this.state.departmenttSearch}
+                onChange={e => {
+                  this.setState({ departmenttSearch: e });
+                }}
+              >
+                {departmentArr.map(function(item) {
+                  return (
+                    <Select.Option key={item.id}>{item.name}</Select.Option>
+                  );
+                })}
+              </Select>
+              <Button type="primary" onClick={this.search}>
+                搜索
+              </Button>
+              <Button onClick={this.reset}>重置</Button>
+              {/* <span>更多搜索<Switch defaultChecked={false} onChange={this.searchSwitch.bind(this)} /></span>
                     <div className="search-more" style={this.state.searchMore ? { display: 'none' } : {}}>
                         <span>订单时间 :</span>
                         <RangePicker
@@ -578,16 +746,16 @@ const Task = React.createClass({
                             this.state.releaseDate[1] ? moment(this.state.releaseDate[1]) : null]}
                             onChange={(data, dataString) => { this.setState({ releaseDate: dataString }); }} />
                     </div> */}
-        </div>
-        </TabPane>
+            </div>
+          </TabPane>
         </Tabs>
-
         <div className="patent-table">
           <Spin spinning={this.state.loading}>
             <Table
               columns={this.state.columns}
               dataSource={this.state.dataSource}
-              rowSelection={rowSelection}
+              expandedRowRender={expandedRowRender}
+              // rowSelection={rowSelection}
               pagination={this.state.pagination}
               onRowClick={this.tableRowClick.bind(this)}
               bordered

File diff suppressed because it is too large
+ 1861 - 1491
js/component/manageCenter/project/task/taskCount.jsx


+ 105 - 0
js/component/resolutionDetail.jsx

@@ -0,0 +1,105 @@
+import React from "react";
+import { Spin, Button, Tabs, Table, message, Modal } from "antd";
+import $ from "jquery/src/ajax";
+
+const ResolutionDetail = React.createClass({
+  getInitialState() {
+    return {
+      visible: false,
+      columns: [
+        {
+          title: "子项目名称",
+          dataIndex: "taskName",
+          key: "taskName"
+        },
+        {
+          title: "子项目数量",
+          dataIndex: "commodityQuantity",
+          key: "commodityQuantity"
+        },
+        {
+          title: "拆分操作人",
+          dataIndex: "splitAname",
+          key: "splitAname"
+        },
+        {
+          title: "拆分时间人",
+          dataIndex: "splitTimes",
+          key: "splitTimes"
+        }
+      ]
+    };
+  },
+  componentWillReceiveProps(nextProps) {
+    this.setState({
+      visible: nextProps.visible
+    });
+  },
+  componentWillMount() {
+    this.loadData();
+  },
+  loadData() {
+    this.setState({
+      loading: true
+    });
+    $.ajax({
+      method: "get",
+      dataType: "json",
+      crossDomain: false,
+      url: globalConfig.context + "/api/admin/orderProject/splitProjectList",
+      data: {
+        tid: this.props.detail.id
+      },
+      success: function(data) {
+        let thedata = data.data;
+        let theArr = [];
+        if (!thedata) {
+          if (data.error && data.error.length) {
+            message.warning(data.error[0].message);
+          }
+        } else {
+          this.setState({
+            dataSource: thedata
+          });
+        }
+      }.bind(this)
+    }).always(
+      function() {
+        this.setState({
+          loading: false
+        });
+      }.bind(this)
+    );
+  },
+  render() {
+    return (
+      <Modal
+        style={{ position: "relative" }}
+        title="拆分记录"
+        visible={this.props.visible}
+        onCancel={this.props.cancel}
+        footer={null}
+        key={"chaifen"}
+        destroyOnClose={true}
+      >
+        <div>
+          <div>当前项目名称:{this.props.detail.commodityName}</div>
+          <div>
+            当前项目数量:
+            {this.props.detail.commodityQuantity}
+          </div>
+          <div>拆分项目列表:</div>
+          <Table
+            columns={this.state.columns}
+            dataSource={this.state.dataSource}
+            size="small"
+            pagination={false}
+            bordered
+          />
+        </div>
+      </Modal>
+    );
+  }
+});
+
+export default ResolutionDetail;