serviceManage.jsx 23 KB

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