projectManage.jsx 23 KB

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