taskAssignment.jsx 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  1. import React,{Component} from 'react';
  2. import ajax from 'jquery/src/ajax/xhr.js';
  3. import $ from 'jquery/src/ajax';
  4. import moment from 'moment';
  5. import '@/manageCenter/financialManage/distribute/public.less';
  6. import { Icon, Button,Form, Input, Select, Spin, Table, Switch, message, DatePicker, Modal } from 'antd';
  7. import OrderDesc from '@/manageCenter/financialManage/orderDetail/orderDesc'
  8. import Assign from '@/manageCenter/publicComponent/assign';
  9. import {getProcessStatus,getApproval} from '@/tools';
  10. const Task = React.createClass({
  11. loadData(pageNo) {
  12. this.state.data = [];
  13. this.setState({
  14. page:pageNo,
  15. loading: true
  16. });
  17. $.ajax({
  18. method: "post",
  19. dataType: "json",
  20. crossDomain: false,
  21. url: globalConfig.context + "/api/admin/order/listAllSettlement",
  22. data: {
  23. pageNo: pageNo || 1,
  24. pageSize: this.state.pagination.pageSize,
  25. buyerName: this.state.nameSearch,//客户名称
  26. orderNo:this.state.orderNoSearch,
  27. distribution:this.state.distribution, //是否分配
  28. startTime: this.state.releaseDate[0],
  29. endTime: this.state.releaseDate[1],
  30. },
  31. success: function (data) {
  32. let theArr = [];
  33. if (!data.data || !data.data.list) {
  34. if (data.error && data.error.length) {
  35. message.warning(data.error[0].message);
  36. };
  37. } else {
  38. for (let i = 0; i < data.data.list.length; i++) {
  39. let thisdata = data.data.list[i];
  40. theArr.push({
  41. key: i,
  42. orderNo: thisdata.orderNo,
  43. approval:thisdata.approval,
  44. orderType:thisdata.orderType,
  45. processStatus:thisdata.processStatus,
  46. signTotalAmount:thisdata.signTotalAmount,
  47. buyerName:thisdata.buyerName,
  48. sellerName:thisdata.sellerName,
  49. createTime:thisdata.createTime?(new Date(thisdata.createTime)).toLocaleString():'',
  50. signTime:thisdata.releaseDate?(new Date(thisdata.releaseDate)).toLocaleString():''
  51. });
  52. };
  53. }
  54. this.state.pagination.current = data.data.pageNo;
  55. this.state.pagination.total = data.data.totalCount;
  56. if(data.data&&data.data.list&&!data.data.list.length){
  57. this.state.pagination.current=0
  58. this.state.pagination.total=0
  59. }
  60. this.setState({
  61. dataSource: theArr,
  62. pagination: this.state.pagination
  63. });
  64. }.bind(this),
  65. }).always(function () {
  66. this.setState({
  67. loading: false
  68. });
  69. }.bind(this));
  70. },
  71. getInitialState() {
  72. return {
  73. searchMore: true,
  74. assignVisible:false,
  75. releaseDate: [],
  76. boHuivisible:false,
  77. selectedRowKeys: [],
  78. selectedRows: [],
  79. loading: false,
  80. pagination: {
  81. defaultCurrent: 1,
  82. defaultPageSize: 10,
  83. showQuickJumper: true,
  84. pageSize: 10,
  85. onChange: function (page) {
  86. this.loadData(page);
  87. }.bind(this),
  88. showTotal: function (total) {
  89. return '共' + total + '条数据';
  90. }
  91. },
  92. columns: [
  93. {
  94. title: '任务编号',
  95. dataIndex: 'orderNo1',
  96. key: 'orderNo1',
  97. }, {
  98. title: '任务名称',
  99. dataIndex: 'createTime',
  100. key: 'createTime',
  101. }, {
  102. title: '订单编号',
  103. dataIndex: 'orderNo',
  104. key: 'orderNo',
  105. },
  106. {
  107. title: '业务类别',
  108. dataIndex: 'buyerName2',
  109. key: 'buyerName2',
  110. },
  111. {
  112. title: '客户名称',
  113. dataIndex: 'buyerName',
  114. key: 'buyerName',
  115. },
  116. {
  117. title: '任务负责人',
  118. dataIndex: 'buyerName1',
  119. key: 'buyerName1',
  120. },
  121. {
  122. title: '任务状态',
  123. dataIndex: 'processStatus',
  124. key: 'processStatus',
  125. render: text => { return getProcessStatus(text)}
  126. },
  127. {
  128. title: '立项状态',
  129. dataIndex: 'approval',
  130. key: 'approval',
  131. render: text => { return getApproval(text)}
  132. },
  133. {
  134. title: '订单负责人',
  135. dataIndex: 'sellerName',
  136. key: 'sellerName'
  137. },
  138. {
  139. title: '公示状态',
  140. dataIndex: 'sellerName13',
  141. key: 'sellerName13',
  142. render: text => { return getApproval(text)}
  143. },
  144. {
  145. title: '分派时间',
  146. dataIndex: 'sellerName12',
  147. key: 'sellerName12'
  148. },
  149. {
  150. title: '任务数量',
  151. dataIndex: 'sellerName1',
  152. key: 'sellerName1'
  153. },
  154. {
  155. title:'操作',
  156. dataIndex: 'caozuo',
  157. key: 'caouzo',
  158. render:(text,recard)=>{
  159. return <div>
  160. <Button type="primary" style={{margin:'0 10px'}} onClick={(e)=>{e.stopPropagation(),this.evaluate(recard,0)}}>转交</Button>
  161. <Button type="primary" style={{margin:'0 10px'}} onClick={(e)=>{e.stopPropagation(),this.evaluate(recard,1)}}>分配任务</Button>
  162. </div>
  163. }
  164. }
  165. ],
  166. dataSource: [],
  167. searchTime: [,]
  168. }
  169. },
  170. /* 分派 */
  171. evaluate(recard,nub){
  172. this.state.assignData=recard;
  173. this.setState({
  174. nub,
  175. assignVisible:true
  176. })
  177. },
  178. componentWillMount() {
  179. this.loadData();
  180. },
  181. tableRowClick(record, index) {
  182. this.state.RowData = record;
  183. this.setState({
  184. showDesc: true,
  185. });
  186. },
  187. closeDesc(e, s) {
  188. this.state.showDesc = e;
  189. if (s) {
  190. this.loadData(this.state.page);
  191. };
  192. },
  193. closeAssign(e, s) {
  194. this.state.assignVisible = e;
  195. if (s) {
  196. this.loadData(this.state.page);
  197. };
  198. },
  199. search() {
  200. this.loadData();
  201. },
  202. reset() {
  203. this.state.nameSearch = '';
  204. this.state.releaseDate = [];
  205. this.state.orderNoSearch='';
  206. this.state.taskNoSearch='';
  207. this.state.distribution=undefined;
  208. this.loadData();
  209. },
  210. searchSwitch() {
  211. this.setState({
  212. searchMore: !this.state.searchMore
  213. });
  214. },
  215. render() {
  216. const rowSelection = {
  217. selectedRowKeys: this.state.selectedRowKeys,
  218. onChange: (selectedRowKeys, selectedRows) => {
  219. this.setState({
  220. selectedRows: selectedRows.slice(-1),
  221. selectedRowKeys: selectedRowKeys.slice(-1)
  222. });
  223. }
  224. };
  225. const hasSelected = this.state.selectedRowKeys.length > 0;
  226. const { RangePicker } = DatePicker;
  227. return ( <div className="user-content">
  228. <div className="content-title">
  229. <span>任务派单管理</span>
  230. </div>
  231. <div className="user-search">
  232. <Input placeholder="客户名称"
  233. value={this.state.nameSearch}
  234. onChange={(e) => { this.setState({ nameSearch: e.target.value }); }} />
  235. <Input placeholder="订单编号"
  236. value={this.state.orderNoSearch}
  237. onChange={(e) => { this.setState({ orderNoSearch: e.target.value }); }} />
  238. <Input placeholder="任务编号"
  239. value={this.state.taskNoSearch}
  240. onChange={(e) => { this.setState({ taskNoSearch: e.target.value }); }} />
  241. <Button type="primary" onClick={this.search}>搜索</Button>
  242. <Button onClick={this.reset}>重置</Button>
  243. {/* <span>更多搜索<Switch defaultChecked={false} onChange={this.searchSwitch.bind(this)} /></span>
  244. <div className="search-more" style={this.state.searchMore ? { display: 'none' } : {}}>
  245. <span>订单时间 :</span>
  246. <RangePicker
  247. value={[this.state.releaseDate[0] ? moment(this.state.releaseDate[0]) : null,
  248. this.state.releaseDate[1] ? moment(this.state.releaseDate[1]) : null]}
  249. onChange={(data, dataString) => { this.setState({ releaseDate: dataString }); }} />
  250. </div> */}
  251. </div>
  252. <div className="patent-table">
  253. <Spin spinning={this.state.loading}>
  254. <Table columns={this.state.columns}
  255. dataSource={this.state.dataSource}
  256. rowSelection={rowSelection}
  257. pagination={this.state.pagination}
  258. onRowClick={this.tableRowClick.bind(this)} />
  259. </Spin>
  260. </div>
  261. <OrderDesc
  262. data={this.state.RowData}
  263. showDesc={this.state.showDesc}
  264. closeDesc={this.closeDesc.bind(this)}
  265. />
  266. <Assign
  267. title="任务"
  268. selApi={this.state.nub?"/api/admin/financial/fenpei":'/api/admin/financial/zhuanjiao'}
  269. data={this.state.assignData}
  270. showDesc={this.state.assignVisible}
  271. closeDesc={this.closeAssign.bind(this)}
  272. />
  273. </div> )
  274. }
  275. })
  276. export default Task;