serviceManage.jsx 22 KB

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