serviceManage.jsx 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548
  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, DatePicker, Checkbox ,Modal, Upload ,Popconfirm} from 'antd';
  6. import NewService from "./addService.jsx";
  7. import moment from 'moment';
  8. import '../../userMangagement.less';
  9. import {intentProgress,transactionProgress,contractProgress,projectProgress,orderType, orderStage, orderState,paymentState, projectState,orderChannel, approvedState, lock,paymentMethod,transactionChannel} from '../../../../dataDic.js';
  10. import {getProjectState,getOrderType,getOrderStage,getOrderState,getPaymentState,getOrderChannel,getApprovedState,getLock,getPaymentMethod,getTransactionChannel} from '../../../../tools.js';
  11. const ServiceManage=Form.create()(React.createClass({
  12. loadData(pageNo,depart) {
  13. this.state.data = [];
  14. this.setState({
  15. loading: true
  16. });
  17. let departArr=depart!=undefined?depart:this.state.departmentArr;
  18. let depIdList=[];
  19. if(this.state.departmenttSearch=='all'||this.state.departmenttSearch==undefined){
  20. departArr.map(function(item){
  21. depIdList.push(item.id)
  22. })
  23. }
  24. depIdList.shift();
  25. let depNoList=depIdList.join(',')
  26. $.ajax({
  27. method: "post",
  28. dataType: "json",
  29. crossDomain: false,
  30. url: globalConfig.context + '/api/admin/order/listDepServiceOrder',
  31. data: {
  32. pageNo: pageNo || 1,
  33. pageSize: this.state.pagination.pageSize,
  34. buyerName:this.state.customerName,
  35. depIds:this.state.departmenttSearch=='all'||this.state.departmenttSearch==undefined?depNoList:this.state.departmenttSearch,//部门
  36. salesmanName:this.state.orderPersonSearch,//负责人
  37. startDate: this.state.releaseDate[0],
  38. endDate: this.state.releaseDate[1],
  39. projectStage:this.state.projectProgress,
  40. liquidationStatus:this.state.settlementState, //结算
  41. orderStatus:this.state.orderStatusSearch,
  42. orderChannel:this.state.orderChannel,
  43. intention:this.state.intentOrder?1:0,
  44. formal:this.state.formalOrder?1:0
  45. },
  46. success: function (data) {
  47. let theArr = [];
  48. if (!data.data) {
  49. if (data.error && data.error.length) {
  50. message.warning(data.error[0].message);
  51. };
  52. } else {
  53. for (let i = 0; i < data.data.list.length; i++) {
  54. let thisdata = data.data.list[i];
  55. theArr.push({
  56. key: i,
  57. id: thisdata.id,
  58. orderNo: thisdata.orderNo,//订单编号
  59. orderType:thisdata.orderType,//订单类型
  60. orderStatus:thisdata.orderStatus,
  61. liquidationStatus:thisdata.liquidationStatus,
  62. createTime:thisdata.createTime,
  63. buyerName:thisdata.buyerName,
  64. signTotalAmount:thisdata.signTotalAmount,
  65. projectStage:thisdata.projectStage,
  66. approval:thisdata.approval,
  67. orderChannel:thisdata.orderChannel,
  68. salesmanName:thisdata.salesmanName,
  69. active:thisdata.active,
  70. departmentName:thisdata.departmentName,
  71. salesmanName:thisdata.salesmanName,
  72. financeName:thisdata.financeName,
  73. technicianName:thisdata.technicianName,
  74. });
  75. };
  76. this.state.pagination.current = data.data.pageNo;
  77. this.state.pagination.total = data.data.totalCount;
  78. };
  79. if(!data.data.list.length){
  80. this.state.pagination.current=0
  81. this.state.pagination.total=0
  82. }
  83. this.setState({
  84. pageNo:pageNo,
  85. dataSource: theArr,
  86. pagination: this.state.pagination,
  87. selectedRowKeys:[],
  88. signBillVisible:false
  89. });
  90. }.bind(this),
  91. }).always(function () {
  92. this.setState({
  93. loading: false
  94. });
  95. }.bind(this));
  96. },
  97. //部门
  98. departmentList() {
  99. this.setState({
  100. loading: true
  101. });
  102. $.ajax({
  103. method: "post",
  104. dataType: "json",
  105. crossDomain: false,
  106. url: globalConfig.context + "/api/admin/order/selectMyDeps",
  107. data: {
  108. },
  109. success: function(data) {
  110. let thedata = data.data;
  111. let theArr=[];
  112. if(!thedata) {
  113. if(data.error && data.error.length) {
  114. message.warning(data.error[0].message);
  115. };
  116. thedata = {};
  117. }else{
  118. thedata.map(function(item,index){
  119. theArr.push({
  120. key:index,
  121. name:item.name,
  122. id:item.id,
  123. depNo:item.depNo
  124. })
  125. })
  126. }
  127. theArr.unshift({
  128. id:'all',
  129. name:'所有部门'
  130. })
  131. this.setState({
  132. departmentArr:theArr,
  133. })
  134. this.loadData('1',theArr);
  135. }.bind(this),
  136. }).always(function() {
  137. this.setState({
  138. loading: false
  139. });
  140. }.bind(this));
  141. },
  142. getInitialState() {
  143. return {
  144. datauser:{},
  145. selectedRowKeys: [],
  146. releaseDate: [],
  147. signBillState:false,
  148. signBillVisible:false,
  149. selectedRows: [],
  150. searchMore: true,
  151. loading: false,
  152. intentOrder:true,
  153. formalOrder:true,
  154. pagination: {
  155. defaultCurrent: 1,
  156. defaultPageSize: 10,
  157. showQuickJumper: true,
  158. pageSize: 10,
  159. onChange: function (page) {
  160. this.loadData(page);
  161. }.bind(this),
  162. showTotal: function (total) {
  163. return '共' + total + '条数据';
  164. }
  165. },
  166. columns: [
  167. {
  168. title: '订单编号',
  169. dataIndex: 'orderNo',
  170. key: 'orderNo'
  171. }, {
  172. title: '订单类型',
  173. dataIndex: 'orderType',
  174. key: 'orderType',
  175. render:text=>{return getOrderType(text)}
  176. }, {
  177. title: '下单时间',
  178. dataIndex: 'createTime',
  179. key: 'createTime'
  180. },{
  181. title: '订单客户',
  182. dataIndex: 'buyerName',
  183. key: 'buyerName',
  184. render:(text)=>{
  185. return (text.length>9?text.substr(0,9)+'...':text)
  186. }
  187. }, {
  188. title: '实际下单金额',
  189. dataIndex: 'signTotalAmount',
  190. key: 'signTotalAmount'
  191. },{
  192. title: '结算状态',
  193. dataIndex: 'liquidationStatus',
  194. key: 'liquidationStatus',
  195. render:text=>{return getPaymentState(text)}
  196. },{
  197. title: '项目状态',
  198. dataIndex: 'projectStage',
  199. key: 'projectStage',
  200. render:text=>{return getProjectState(text)}
  201. }, {
  202. title: '是否特批',
  203. dataIndex: 'approval',
  204. key: 'approval',
  205. render:text=>{return text?'已特批':'未特批'}
  206. },{
  207. title: '订单渠道',
  208. dataIndex: 'orderChannel',
  209. key: 'orderChannel',
  210. render:text=>{return getOrderChannel(text)}
  211. },{
  212. title: '部门机构',
  213. dataIndex: 'departmentName',
  214. key: 'departmentName'
  215. },{
  216. title: '订单负责人',
  217. dataIndex: 'salesmanName',
  218. key: 'salesmanName'
  219. },
  220. {
  221. title: '财务负责人',
  222. dataIndex: 'financeName',
  223. key: 'financeName'
  224. },
  225. {
  226. title: '项目负责人',
  227. dataIndex: 'technicianName',
  228. key: 'technicianName'
  229. },
  230. {
  231. title: '操作',
  232. dataIndex: 'active',
  233. key: 'active',
  234. render: (text, record, index) => {
  235. return <div>
  236. {text.confirmIntention&&<Popconfirm title={'请确认您是否受理来自【'+record.buyerName+'】发起的服务意向订单?'} onConfirm={(e)=>{this.admissibleOrderOk(record)}} onCancel={(e)=>{this.admissibleOrderCancel(record)}} okText="同意" cancelText="拒绝">
  237. <Button style={{marginRight:'5px'}} onClick={(e) =>{ e.stopPropagation()}} type="primary">受理意向</Button>
  238. </Popconfirm>}
  239. {text.applySign&&<Button style={{marginRight:'5px'}} onClick={(e) =>{ e.stopPropagation(),this.signBill(record)}} type="primary">签单</Button> }
  240. {text.applyForCancel&&<Popconfirm title={'请确认您是否取消客户【'+record.buyerName+'】的服务订单,订单取消将导致业务终止!'} onConfirm={(e)=>{this.cancelOrder(record)}} okText="确认" cancelText="取消">
  241. <Button style={{marginRight:'5px'}} onClick={(e) =>{ e.stopPropagation()}} type="danger">取消订单</Button>
  242. </Popconfirm>}
  243. {text.applyRevoke&&<Popconfirm title={'请确认您是否作废客户【'+record.buyerName+'】的服务订单,订单作废将导致订单失效!'} onConfirm={(e)=>{this.scrapOrder(record)}} okText="确认" cancelText="取消">
  244. <Button style={{marginRight:'5px'}} onClick={(e) =>{ e.stopPropagation()}} type="danger">作废</Button>
  245. </Popconfirm>}
  246. {text.applyLock &&<Popconfirm title={'请确认您是否锁定客户【'+record.buyerName+'】的服务订单,订单锁定将导致订单暂停!'} onConfirm={(e)=>{this.lockOrder(record)}} okText="确认" cancelText="取消">
  247. <Button style={{marginRight:'5px'}} onClick={(e) =>{ e.stopPropagation()}} type="danger">锁定<Icon type="lock" /></Button>
  248. </Popconfirm>}
  249. {text.applyUnLock&&<Popconfirm title={'请确认您是否解锁客户【'+record.buyerName+'】的服务订单,订单解锁将导致订单正常!'} onConfirm={(e)=>{this.unlockOrder(record)}} okText="确认" cancelText="取消">
  250. <Button style={{marginRight:'5px'}} onClick={(e) =>{ e.stopPropagation()}} type="primary">解锁<Icon type="unlock" /></Button>
  251. </Popconfirm>}
  252. </div>
  253. }
  254. }
  255. ],
  256. dataSource: [],
  257. };
  258. },
  259. //受理订单
  260. admissibleOrderOk(e){
  261. this.admissibleOrder(e,true)
  262. },
  263. admissibleOrderCancel(e){
  264. this.admissibleOrder(e,false)
  265. },
  266. admissibleOrder(record,index) {
  267. this.setState({
  268. signBillVisible:false,
  269. selectedRowKeys: [],
  270. loading: true,
  271. userDetaile:false
  272. });
  273. $.ajax({
  274. method: "POST",
  275. dataType: "json",
  276. crossDomain: false,
  277. url: globalConfig.context + '/api/admin/order/confirmIntention',
  278. data: {
  279. orderNo:record.orderNo,
  280. confirm:index
  281. }
  282. }).done(function (data) {
  283. if (!data.error.length) {
  284. message.success('操作成功!');
  285. this.setState({
  286. loading: false,
  287. showDesc:false
  288. });
  289. } else {
  290. message.warning(data.error[0].message);
  291. this.setState({
  292. showDesc:true
  293. })
  294. };
  295. this.loadData(this.state.pageNo);
  296. }.bind(this));
  297. },
  298. //取消订单
  299. cancelOrder(e){
  300. this.operation(e,'cancelOrder')
  301. },
  302. //作废订单
  303. scrapOrder(e){
  304. this.operation(e,'scrapOrder')
  305. },
  306. //锁定订单
  307. lockOrder(e){
  308. this.operation(e,'lockOrder')
  309. },
  310. //解锁订单
  311. unlockOrder(e){
  312. this.operation(e,'unlockOrder')
  313. },
  314. //签单
  315. signBill(ids){
  316. this.setState({
  317. uid:ids,
  318. signBillVisible:true
  319. })
  320. },
  321. componentWillMount() {
  322. this.departmentList()
  323. },
  324. tableRowClick(record, index) {
  325. this.state.userDetaile=true;
  326. this.state.datauser = record;
  327. this.setState({
  328. signBillVisible:false,
  329. signBillState:true,
  330. showDesc: true
  331. });
  332. },
  333. //列表各种骚操作
  334. operation(record,index) {
  335. let api;
  336. switch(index){
  337. case 'cancelOrder': //取消订单
  338. api='/api/quxiaodingdan';
  339. break;
  340. case 'scrapOrder': //作废订单
  341. api='/api/zuofeidingdan';
  342. break;
  343. case 'lockOrder': //锁定订单
  344. api='/api/suodingdingdan';
  345. break;
  346. case 'unlockOrder': //解锁订单
  347. api='/api/jiesuodingdan';
  348. break;
  349. default:
  350. return false;
  351. }
  352. this.setState({
  353. selectedRowKeys: [],
  354. loading: true,
  355. showDesc:false
  356. });
  357. $.ajax({
  358. method: "POST",
  359. dataType: "json",
  360. crossDomain: false,
  361. url: globalConfig.context + api,
  362. data: {
  363. orderNo:record.orderNo,
  364. confirm:''
  365. }
  366. }).done(function (data) {
  367. if (!data.error.length) {
  368. message.success('操作成功!');
  369. this.setState({
  370. loading: false,
  371. });
  372. } else {
  373. message.warning(data.error[0].message);
  374. };
  375. this.loadData(this.state.pageNo);
  376. }.bind(this));
  377. },
  378. addClick() {
  379. this.state.userDetaile=false;
  380. this.setState({
  381. signBillVisible:false,
  382. showDesc: true
  383. });
  384. },
  385. closeDesc(e, s) {
  386. this.state.userDetaile=false;
  387. this.state.showDesc = e;
  388. if (s) {
  389. this.loadData(this.state.pageNo);
  390. };
  391. },
  392. searchSwitch() {
  393. this.setState({
  394. signBillVisible:false,
  395. searchMore: !this.state.searchMore
  396. });
  397. },
  398. search() {
  399. this.setState({
  400. signBillVisible:false
  401. })
  402. this.loadData();
  403. },
  404. reset() {
  405. this.setState({
  406. signBillVisible:false
  407. })
  408. this.state.customerName = '';
  409. this.state.orderPersonSearch = '';
  410. this.state.departmenttSearch = undefined;
  411. this.state.releaseDate[0] = undefined;
  412. this.state.releaseDate[1] = undefined;
  413. this.state.projectProgress = undefined;
  414. this.state.settlementState = undefined;
  415. this.state.orderStatusSearch = undefined;
  416. this.state.orderChannel = undefined;
  417. this.state.formalOrder = true;
  418. this.state.intentOrder = true;
  419. this.loadData();
  420. },
  421. render() {
  422. const FormItem = Form.Item;
  423. const formItemLayout = {
  424. labelCol: { span: 8 },
  425. wrapperCol: { span: 14 },
  426. };
  427. const rowSelection = {
  428. selectedRowKeys: this.state.selectedRowKeys,
  429. onChange: (selectedRowKeys, selectedRows) => {
  430. this.setState({
  431. selectedRows: selectedRows.slice(-1),
  432. selectedRowKeys: selectedRowKeys.slice(-1)
  433. });
  434. },
  435. onSelectAll: (selected, selectedRows, changeRows) => {
  436. this.setState({
  437. selectedRowKeys:[]
  438. })
  439. },
  440. };
  441. const hasSelected = this.state.selectedRowKeys.length > 0;
  442. const { RangePicker } = DatePicker;
  443. let departmentArr = this.state.departmentArr || [];
  444. return (
  445. <div className="user-content" >
  446. <div className="content-title">
  447. <span style={{fontSize:'16px'}}>部门科技服务订单</span>
  448. <div className="user-search">
  449. <Input placeholder="客户名称" style={{width:'150px'}}
  450. value={this.state.customerName}
  451. onChange={(e) => { this.setState({ customerName: e.target.value }); }} />
  452. <RangePicker
  453. value={[this.state.releaseDate[0] ? moment(this.state.releaseDate[0]) : null,
  454. this.state.releaseDate[1] ? moment(this.state.releaseDate[1]) : null]}
  455. onChange={(data, dataString) => { this.setState({ releaseDate: dataString }); }} />
  456. <Select placeholder="部门机构" style={{width:'150px',marginLeft:'10px'}}
  457. value={this.state.departmenttSearch}
  458. onChange={(e) => { this.setState({ departmenttSearch: e }) }}>
  459. {
  460. departmentArr.map(function (item) {
  461. return <Select.Option key={item.id} >{item.name}</Select.Option>
  462. })
  463. }
  464. </Select>
  465. <Input placeholder="订单负责人" style={{width:'150px'}}
  466. value={this.state.orderPersonSearch}
  467. onChange={(e) => { this.setState({ orderPersonSearch: e.target.value }); }} />
  468. <Button type="primary" onClick={this.search} style={{marginLeft:'10px'}}>搜索<Icon type="search" /></Button>
  469. <Button onClick={this.reset}>重置 <Icon type="reload" /></Button>
  470. <span style={{marginLeft:'10px',marginRight:'20px'}}>更多搜索<Switch defaultChecked={false} onChange={this.searchSwitch} /></span>
  471. </div>
  472. <div className='clearfix' style={{marginTop:'5px'}}>
  473. <div className="search-more" style={this.state.searchMore ? { display: 'none' } : {}}>
  474. <Checkbox checked={this.state.intentOrder} onChange={(e)=>{this.setState({intentOrder:!this.state.intentOrder})}}>意向订单</Checkbox>
  475. <Checkbox checked={this.state.formalOrder} onChange={(e)=>{this.setState({formalOrder:!this.state.formalOrder})}}>正式订单</Checkbox>
  476. <Select placeholder="订单状态"
  477. style={{ width: 150 ,marginRight:'10px'}}
  478. value={this.state.orderStatusSearch}
  479. onChange={(e) => { this.setState({ orderStatusSearch: e }) }}>
  480. {
  481. orderState.map(function (item) {
  482. return <Select.Option key={item.value} >{item.key}</Select.Option>
  483. })
  484. }
  485. </Select>
  486. <Select placeholder="结算状态"
  487. style={{ width: 150 ,marginRight:'10px'}}
  488. value={this.state.settlementState}
  489. onChange={(e) => { this.setState({ settlementState: e }) }}>
  490. {
  491. paymentState.map(function (item) {
  492. return <Select.Option key={item.value} >{item.key}</Select.Option>
  493. })
  494. }
  495. </Select>
  496. <Select placeholder="项目进度"
  497. style={{ width: 150 ,marginRight:'10px'}}
  498. value={this.state.projectProgress}
  499. onChange={(e) => { this.setState({ projectProgress: e }) }}>
  500. {
  501. projectState.map(function (item) {
  502. return <Select.Option key={item.value} >{item.key}</Select.Option>
  503. })
  504. }
  505. </Select>
  506. <Select placeholder="订单渠道"
  507. style={{ width: 150 }}
  508. value={this.state.orderChannel}
  509. onChange={(e) => { this.setState({ orderChannel: e }) }}>
  510. {
  511. orderChannel.map(function (item) {
  512. return <Select.Option key={item.value} >{item.key}</Select.Option>
  513. })
  514. }
  515. </Select>
  516. </div>
  517. </div>
  518. <div className="patent-table">
  519. <Spin spinning={this.state.loading}>
  520. <Table columns={this.state.columns}
  521. dataSource={this.state.dataSource}
  522. rowSelection={rowSelection}
  523. pagination={this.state.pagination}
  524. onRowClick={this.tableRowClick} />
  525. </Spin>
  526. </div>
  527. <NewService
  528. uid={this.state.uid}
  529. signBillVisible={this.state.signBillVisible}
  530. signBillState={this.state.signBillState}
  531. operation={this.operation}
  532. admissibleOrder={this.admissibleOrder}
  533. userDetaile={this.state.userDetaile}
  534. datauser={this.state.datauser}
  535. showDesc={this.state.showDesc}
  536. closeDesc={this.closeDesc} />
  537. </div >
  538. </div>
  539. );
  540. }
  541. }));
  542. export default ServiceManage;