projectManage.jsx 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595
  1. import React from 'react';
  2. import ReactDom from 'react-dom';
  3. import ajax from 'jquery/src/ajax/xhr.js';
  4. import $ from 'jquery/src/ajax';
  5. import { Form,Radio, Icon, Button, Input, Select, Spin, Table, Switch, message, Modal, Upload ,Popconfirm,DatePicker} from 'antd';
  6. import MySettlementDetaile from "./projectManageDetaile.jsx";
  7. import moment from 'moment';
  8. import '../userMangagement.less';
  9. import {projectState,taskStatus,isLock,publishStatus} from '../../../../dataDic.js';
  10. import {getProjectState,getOrderState,getOrderType,getPaymentState,getTaskStatus,getPublishStatus,getLock} from '../../../../tools.js';
  11. const TaskManagement=Form.create()(React.createClass({
  12. loadData(pageNo) {
  13. this.setState({
  14. loading: true
  15. });
  16. $.ajax({
  17. method: "post",
  18. dataType: "json",
  19. crossDomain: false,
  20. url: globalConfig.context + '/api/admin/techproject/listTask',
  21. data: {
  22. pageNo: pageNo || 1,
  23. pageSize: this.state.pagination.pageSize,
  24. startDate: this.state.releaseDate[0],
  25. endDate: this.state.releaseDate[1],
  26. buyerName:this.state.buyerNameSearch,//客户名称
  27. taskStatus:this.state.orderStatusSearch, //订单状态
  28. projectNo:this.state.orderNoSearch,//订单编号
  29. deleteSign:this.state.deleteSign,//锁定激活
  30. categoryId:this.state.categoryIdSearch,
  31. deletedSign:this.state.deletedSign,
  32. taskReceiverName:this.state.salesmanNameSearch,
  33. publishStatus:this.state.publishStatus,//公示状态
  34. },
  35. success: function (data) {
  36. let theArr = [];
  37. if (!data.data) {
  38. if (data.error && data.error.length) {
  39. message.warning(data.error[0].message);
  40. };
  41. } else {
  42. for (let i = 0; i < data.data.list.length; i++) {
  43. let thisdata = data.data.list[i];
  44. theArr.push({
  45. key: i,
  46. taskId: thisdata.taskId,
  47. taskNo: thisdata.taskNo,
  48. commodityName:thisdata.commodityName,
  49. categoryName:thisdata.categoryName,
  50. buyerName:thisdata.buyerName,
  51. taskDistributionTimes:thisdata.taskDistributionTimes,
  52. deletedSign:thisdata.deletedSign,//项目的锁定
  53. deleteSign:thisdata.deleteSign,//项目任务的锁定
  54. taskStatus:thisdata.taskStatus,
  55. taskReceiverName:thisdata.taskReceiverName,
  56. projectNo:thisdata.projectNo,
  57. publishStatus:thisdata.publishStatus,//公示状态
  58. });
  59. };
  60. this.state.pagination.current = data.data.pageNo;
  61. this.state.pagination.total = data.data.totalCount;
  62. };
  63. if(!data.data.list.length){
  64. this.state.pagination.current=0
  65. this.state.pagination.total=0
  66. }
  67. this.setState({
  68. pageNo:pageNo,
  69. dataSource: theArr,
  70. pagination: this.state.pagination,
  71. selectedRowKeys:[]
  72. });
  73. }.bind(this),
  74. }).always(function () {
  75. this.setState({
  76. loading: false
  77. });
  78. }.bind(this));
  79. },
  80. //部门
  81. departmentList() {
  82. this.setState({
  83. loading: true
  84. });
  85. $.ajax({
  86. method: "get",
  87. dataType: "json",
  88. crossDomain: false,
  89. url: globalConfig.context + "/api/admin/organization/selectSuperId",
  90. data: {
  91. },
  92. success: function(data) {
  93. let thedata = data.data;
  94. let theArr=[];
  95. if(!thedata) {
  96. if(data.error && data.error.length) {
  97. message.warning(data.error[0].message);
  98. };
  99. thedata = {};
  100. }else{
  101. thedata.map(function(item,index){
  102. theArr.push({
  103. key:index,
  104. name:item.name,
  105. id:item.id,
  106. })
  107. })
  108. }
  109. this.setState({
  110. departmentArr:theArr,
  111. })
  112. }.bind(this),
  113. }).always(function() {
  114. this.setState({
  115. loading: false
  116. });
  117. }.bind(this));
  118. },
  119. getInitialState() {
  120. return {
  121. datauser:{},
  122. selectedRowKeys: [],
  123. selectedRows: [],
  124. searchMore: true,
  125. releaseDate: [],
  126. loading: false,
  127. visible:false,
  128. showDesc:false,
  129. pagination: {
  130. defaultCurrent: 1,
  131. defaultPageSize: 10,
  132. showQuickJumper: true,
  133. pageSize: 10,
  134. onChange: function (page) {
  135. this.loadData(page);
  136. }.bind(this),
  137. showTotal: function (total) {
  138. return '共' + total + '条数据';
  139. }
  140. },
  141. columns: [
  142. {
  143. title: '任务编号',
  144. dataIndex: 'taskNo',
  145. key: 'taskNo'
  146. },{
  147. title: '项目编号',
  148. dataIndex: 'projectNo',
  149. key: 'projectNo'
  150. },{
  151. title: '任务名称',
  152. dataIndex: 'commodityName',
  153. key: 'commodityName'
  154. },
  155. {
  156. title: '业务类别',
  157. dataIndex: 'categoryName',
  158. key: 'categoryName',
  159. },{
  160. title: '客户名称',
  161. dataIndex: 'buyerName',
  162. key: 'buyerName',
  163. }, {
  164. title: '任务负责人',
  165. dataIndex: 'taskReceiverName',
  166. key: 'taskReceiverName',
  167. },{
  168. title: '任务状态',
  169. dataIndex: 'taskStatus',
  170. key: 'taskStatus',
  171. render:(text)=>{return getTaskStatus(text) }
  172. },{
  173. title: '公示状态',
  174. dataIndex: 'publishStatus',
  175. key: 'publishStatus',
  176. render:(text)=>{
  177. {return getPublishStatus(text) }
  178. }
  179. },{
  180. title: '是否锁定',
  181. dataIndex: 'deleteSign',
  182. key: 'deleteSign',
  183. render:(text)=>{
  184. {return getLock(text) }
  185. }
  186. },{
  187. title: '任务创建时间',
  188. dataIndex: 'taskDistributionTimes',
  189. key: 'taskDistributionTimes',
  190. },{
  191. title: '操作',
  192. dataIndex: 'rr',
  193. key: 'rr',
  194. render:(text,record,index)=>{
  195. return (
  196. <div>
  197. {record.taskStatus<1&&<Popconfirm title={'请确认是否作废【'+record.commodityName+'】任务?'} onConfirm={(e)=>{this.startUp(record)}} okText="确认" cancelText="取消">
  198. <Button style={{marginRight:'5px'}} onClick={(e) =>{ e.stopPropagation()}} type="danger">删除</Button>
  199. </Popconfirm>}
  200. {record.taskStatus<1&&<Button style={{marginRight:'5px'}} onClick={(e) =>{ e.stopPropagation(),this.confirmDelet(record)}} type="primary">派单</Button>}
  201. </div>
  202. )
  203. }
  204. }
  205. ],
  206. userList:[
  207. {
  208. title: '用户编号',
  209. dataIndex: 'userNo',
  210. key: 'userNo'
  211. }, {
  212. title: '用户姓名',
  213. dataIndex: 'name',
  214. key: 'name'
  215. },{
  216. title: '部门机构',
  217. dataIndex: 'departmentName',
  218. key: 'departmentName'
  219. }, {
  220. title: '职务',
  221. dataIndex: 'position',
  222. key: 'position'
  223. },{
  224. title: '联系手机',
  225. dataIndex: 'mobile',
  226. key: 'mobile'
  227. }, {
  228. title: '操作',
  229. dataIndex: 'abc',
  230. key: 'abc',
  231. render:(text,record,index)=>{
  232. return (
  233. <Popconfirm title={'您确认将订单 【'+this.state.uname+'】 分配给【'+record.departmentName+'-'+record.name+'】?'} onConfirm={(e)=>{this.confirmSelect(record)}} okText="确认" cancelText="取消">
  234. <Button style={{marginRight:'5px'}} type="primary">选定</Button>
  235. </Popconfirm>
  236. )
  237. }
  238. }
  239. ],
  240. dataSource: [],
  241. };
  242. },
  243. //转交
  244. confirmDelet(index){
  245. this.setState({
  246. showDesc:false,
  247. taskIds:index.taskId,
  248. uname:index.commodityName,
  249. distributionVisible:true
  250. });
  251. this.departmentList()
  252. },
  253. distributionCancel(){
  254. this.setState({
  255. distributionVisible:false
  256. })
  257. },
  258. //分配对象列表
  259. contactList(){
  260. $.ajax({
  261. method: "get",
  262. dataType: "json",
  263. crossDomain: false,
  264. url: globalConfig.context + '/api/admin/superviser/adminList',
  265. data: {
  266. pageNo: 1,
  267. pageSize: 99,
  268. departmentId:this.state.departmenttList,
  269. name:this.state.financeNameSearch,
  270. },
  271. success: function (data) {
  272. let theArr = [];
  273. if (!data.data) {
  274. if (data.error && data.error.length) {
  275. message.warning(data.error[0].message);
  276. };
  277. } else {
  278. for (let i = 0; i < data.data.list.length; i++) {
  279. let thisdata = data.data.list[i];
  280. theArr.push({
  281. key: i,
  282. id: thisdata.id,
  283. userNo: thisdata.userNo,
  284. name:thisdata.name,
  285. departmentName:thisdata.departmentName,
  286. departmentId:thisdata.departmentId,
  287. position:thisdata.position,
  288. mobile:thisdata.mobile,
  289. });
  290. };
  291. };
  292. this.setState({
  293. distributionList: theArr,
  294. });
  295. }.bind(this),
  296. }).always(function () {
  297. this.setState({
  298. loading: false
  299. });
  300. }.bind(this));
  301. },
  302. //选定对象
  303. confirmSelect(record){
  304. this.setState({
  305. loading: true
  306. });
  307. $.ajax({
  308. method: "POST",
  309. dataType: "json",
  310. crossDomain: false,
  311. url: globalConfig.context + "/api/admin/techproject/distributionTask",
  312. data: {
  313. taskId:this.state.taskIds,
  314. taskReceiverId:record.id
  315. }
  316. }).done(function (data) {
  317. if (!data.error.length) {
  318. message.success('分派成功!');
  319. this.setState({
  320. loading: false,
  321. });
  322. this.distributionCancel();
  323. this.loadData(this.state.pageNo);
  324. } else {
  325. message.warning(data.error[0].message);
  326. };
  327. }.bind(this));
  328. },
  329. //业务类型
  330. businessList() {
  331. this.setState({
  332. loading: true
  333. });
  334. $.ajax({
  335. method: "get",
  336. dataType: "json",
  337. crossDomain: false,
  338. url: globalConfig.context + "/api/admin/order/getBusinessProjectCatalog",
  339. data: {
  340. },
  341. success: function(data) {
  342. let thedata = data.data;
  343. let theArr=[];
  344. if(!thedata) {
  345. if(data.error && data.error.length) {
  346. message.warning(data.error[0].message);
  347. };
  348. thedata = {};
  349. }else{
  350. thedata.map(function(item,index){
  351. theArr.push({
  352. key:index,
  353. name:item.cname,
  354. id:item.id,
  355. })
  356. })
  357. }
  358. this.setState({
  359. businessArr:theArr,
  360. })
  361. }.bind(this),
  362. }).always(function() {
  363. this.setState({
  364. loading: false
  365. });
  366. }.bind(this));
  367. },
  368. componentWillMount() {
  369. this.loadData();
  370. this.businessList()
  371. },
  372. //删除
  373. startUp(record){
  374. this.removeList(record)
  375. },
  376. removeList(record){
  377. this.setState({
  378. loading: true
  379. });
  380. $.ajax({
  381. method: "get",
  382. dataType: "json",
  383. crossDomain: false,
  384. url: globalConfig.context + '/api/admin/techproject/deleteProjectTask',
  385. data: {
  386. taskId:record.taskId
  387. }
  388. }).done(function(data) {
  389. this.setState({
  390. loading: false
  391. });
  392. if(!data.error.length) {
  393. message.success('操作成功!');
  394. this.loadData(this.state.pageNo)
  395. } else {
  396. message.warning(data.error[0].message);
  397. }
  398. }.bind(this));
  399. },
  400. //详情页面关闭时列表刷新
  401. closeShow(s){
  402. this.state.showDesc=s;
  403. this.loadData();
  404. },
  405. searchSwitch() {
  406. this.setState({
  407. searchMore: !this.state.searchMore
  408. });
  409. },
  410. search() {
  411. this.loadData();
  412. },
  413. tableRowClick(record, index) {
  414. this.state.datauser = record;
  415. this.setState({
  416. showDesc: true
  417. });
  418. },
  419. close(s){
  420. this.state.showDesc=s;
  421. },
  422. searchOrder(){
  423. this.contactList();
  424. },
  425. resetOrder(){
  426. this.state.departmenttList=undefined;
  427. this.state.financeNameSearch='';
  428. this.setState({
  429. distributionList:[]
  430. });
  431. },
  432. reset() {
  433. this.state.buyerNameSearch='';
  434. this.state.releaseDate[0] = undefined;
  435. this.state.releaseDate[1] = undefined;
  436. this.state.departmentt=undefined;
  437. this.state.orderStatusSearch = undefined;
  438. this.state.salesmanNameSearch = '';
  439. this.state.orderNoSearch='';
  440. this.state.deleteSignSearch=undefined;
  441. this.state.deletedSign=undefined;
  442. this.state.deleteSign=undefined;
  443. this.state.categoryIdSearch=undefined;
  444. this.state.publishStatus=undefined;
  445. this.loadData();
  446. },
  447. render() {
  448. const FormItem = Form.Item;
  449. const formItemLayout = {
  450. labelCol: { span: 8 },
  451. wrapperCol: { span: 14 },
  452. };
  453. const { RangePicker } = DatePicker;
  454. const rowSelection = {
  455. selectedRowKeys: this.state.selectedRowKeys,
  456. onChange: (selectedRowKeys, selectedRows) => {
  457. this.setState({
  458. selectedRows: selectedRows.slice(-1),
  459. selectedRowKeys: selectedRowKeys.slice(-1)
  460. });
  461. },
  462. onSelectAll: (selected, selectedRows, changeRows) => {
  463. this.setState({
  464. selectedRowKeys:[]
  465. })
  466. },
  467. };
  468. const hasSelected = this.state.selectedRowKeys.length > 0;
  469. let departmentArr = this.state.departmentArr || [];
  470. let businessArr = this.state.businessArr || []
  471. return (
  472. <div className="user-content" >
  473. <div className="content-title">
  474. <span style={{fontSize:'16px'}}>项目任务管理</span>
  475. <div className="user-search">
  476. <Input placeholder="客户名称" style={{width:'150px',marginRight:'10px'}}
  477. value={this.state.buyerNameSearch}
  478. onChange={(e) => { this.setState({ buyerNameSearch: e.target.value }); }} />
  479. <Input placeholder="项目编号" style={{width:'150px',marginRight:'10px'}}
  480. value={this.state.orderNoSearch}
  481. onChange={(e) => { this.setState({ orderNoSearch: e.target.value }); }} />
  482. <Select placeholder="任务状态"
  483. style={{ width: 150 ,marginRight:'10px'}}
  484. value={this.state.orderStatusSearch}
  485. onChange={(e) => { this.setState({ orderStatusSearch: e }) }}>
  486. {
  487. taskStatus.map(function (item) {
  488. return <Select.Option key={item.value} >{item.key}</Select.Option>
  489. })
  490. }
  491. </Select>
  492. <Select placeholder="公示状态"
  493. style={{ width: 150 ,marginRight:'10px'}}
  494. value={this.state.publishStatus}
  495. onChange={(e) => { this.setState({ publishStatus: e }) }}>
  496. {
  497. publishStatus.map(function (item) {
  498. return <Select.Option key={item.value} >{item.key}</Select.Option>
  499. })
  500. }
  501. </Select>
  502. <Select placeholder="业务类别"
  503. style={{ width: 150 ,marginRight:'10px'}}
  504. value={this.state.categoryIdSearch}
  505. onChange={(e) => { this.setState({ categoryIdSearch: e }) }}>
  506. {
  507. businessArr.map(function (item) {
  508. return <Select.Option key={item.id} >{item.name}</Select.Option>
  509. })
  510. }
  511. </Select>
  512. <Select placeholder="是否锁定"
  513. style={{ width: 150,marginRight:'10px' }}
  514. value={this.state.deleteSign}
  515. onChange={(e) => { this.setState({ deleteSign: e }) }}>
  516. {
  517. isLock.map(function (item) {
  518. return <Select.Option key={item.value} >{item.key}</Select.Option>
  519. })
  520. }
  521. </Select>
  522. <RangePicker
  523. value={[this.state.releaseDate[0] ? moment(this.state.releaseDate[0]) : null,
  524. this.state.releaseDate[1] ? moment(this.state.releaseDate[1]) : null]}
  525. onChange={(data, dataString) => { this.setState({ releaseDate: dataString }); }} />
  526. <Button type="primary" onClick={this.search} style={{marginLeft:'10px'}}>搜索</Button>
  527. <Button onClick={this.reset}>重置</Button>
  528. </div>
  529. <div className="patent-table">
  530. <Spin spinning={this.state.loading}>
  531. <Table columns={this.state.columns}
  532. dataSource={this.state.dataSource}
  533. rowSelection={rowSelection}
  534. pagination={this.state.pagination}
  535. onRowClick={this.tableRowClick}
  536. />
  537. </Spin>
  538. </div>
  539. <MySettlementDetaile
  540. close={this.close}
  541. datauser={this.state.datauser}
  542. showDesc={this.state.showDesc}
  543. closeShow={this.closeShow}
  544. />
  545. </div >
  546. <Modal maskClosable={false} visible={this.state.distributionVisible}
  547. onOk={this.distributionCancel} onCancel={this.distributionCancel}
  548. width='800px'
  549. title='派单'
  550. footer=''
  551. className="admin-desc-content">
  552. <Form layout="horizontal" onSubmit={this.handleSubmit} id="demand-form" style={{paddingBottom:'40px'}} >
  553. <Spin spinning={this.state.loading}>
  554. <div>
  555. <Select placeholder="订单部门"
  556. style={{ width: 150 ,marginRight:'10px',marginLeft:'10px'}}
  557. value={this.state.departmenttList}
  558. onChange={(e) => { this.setState({ departmenttList: e }) }}>
  559. {
  560. departmentArr.map(function (item) {
  561. return <Select.Option key={item.id} >{item.name}</Select.Option>
  562. })
  563. }
  564. </Select>
  565. <Input placeholder="任务负责人" style={{width:'150px',marginLeft:'10px'}}
  566. value={this.state.financeNameSearch}
  567. onChange={(e) => { this.setState({ financeNameSearch: e.target.value }); }} />
  568. <Button type="primary" onClick={this.searchOrder} style={{marginLeft:'10px',marginRight:'10px'}}>搜索</Button>
  569. <Button onClick={this.resetOrder}>重置</Button>
  570. </div>
  571. <div className="patent-table" style={{marginTop:'10px'}}>
  572. <Spin spinning={this.state.loading}>
  573. <Table columns={this.state.userList}
  574. dataSource={this.state.distributionList}
  575. pagination={false}
  576. />
  577. </Spin>
  578. </div>
  579. </Spin>
  580. </Form>
  581. </Modal>
  582. </div>
  583. );
  584. }
  585. }));
  586. export default TaskManagement;