serviceManage.jsx 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532
  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&&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 getApprovedState(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,3)
  301. },
  302. //作废订单
  303. scrapOrder(e){
  304. this.operation(e,2)
  305. },
  306. //锁定订单
  307. lockOrder(e){
  308. this.operation(e,0)
  309. },
  310. //解锁订单
  311. unlockOrder(e){
  312. this.operation(e,1)
  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. //列表各种骚操作
  335. operation(record,index) {
  336. this.setState({
  337. selectedRowKeys: [],
  338. loading: true,
  339. showDesc:false
  340. });
  341. $.ajax({
  342. method: "get",
  343. dataType: "json",
  344. crossDomain: false,
  345. url: globalConfig.context + '/api/admin/order/lockOrRevokeOrder',
  346. data: {
  347. orderNo:record.orderNo,
  348. operatorType:index
  349. }
  350. }).done(function (data) {
  351. if (!data.error.length) {
  352. message.success('操作成功!');
  353. this.setState({
  354. loading: false,
  355. });
  356. } else {
  357. message.warning(data.error[0].message);
  358. };
  359. this.loadData(this.state.pageNo);
  360. }.bind(this));
  361. },
  362. addClick() {
  363. this.state.userDetaile=false;
  364. this.setState({
  365. signBillVisible:false,
  366. showDesc: true
  367. });
  368. },
  369. closeDesc(e, s) {
  370. this.state.userDetaile=false;
  371. this.state.showDesc = e;
  372. if (s) {
  373. this.loadData(this.state.pageNo);
  374. };
  375. },
  376. searchSwitch() {
  377. this.setState({
  378. signBillVisible:false,
  379. searchMore: !this.state.searchMore
  380. });
  381. },
  382. search() {
  383. this.setState({
  384. signBillVisible:false
  385. })
  386. this.loadData();
  387. },
  388. reset() {
  389. this.setState({
  390. signBillVisible:false
  391. })
  392. this.state.customerName = '';
  393. this.state.orderPersonSearch = '';
  394. this.state.departmenttSearch = undefined;
  395. this.state.releaseDate[0] = undefined;
  396. this.state.releaseDate[1] = undefined;
  397. this.state.projectProgress = undefined;
  398. this.state.settlementState = undefined;
  399. this.state.orderStatusSearch = undefined;
  400. this.state.orderChannel = undefined;
  401. this.state.formalOrder = true;
  402. this.state.intentOrder = true;
  403. this.loadData();
  404. },
  405. render() {
  406. const FormItem = Form.Item;
  407. const formItemLayout = {
  408. labelCol: { span: 8 },
  409. wrapperCol: { span: 14 },
  410. };
  411. const rowSelection = {
  412. selectedRowKeys: this.state.selectedRowKeys,
  413. onChange: (selectedRowKeys, selectedRows) => {
  414. this.setState({
  415. selectedRows: selectedRows.slice(-1),
  416. selectedRowKeys: selectedRowKeys.slice(-1)
  417. });
  418. },
  419. onSelectAll: (selected, selectedRows, changeRows) => {
  420. this.setState({
  421. selectedRowKeys:[]
  422. })
  423. },
  424. };
  425. const hasSelected = this.state.selectedRowKeys.length > 0;
  426. const { RangePicker } = DatePicker;
  427. let departmentArr = this.state.departmentArr || [];
  428. return (
  429. <div className="user-content" >
  430. <div className="content-title">
  431. <span style={{fontSize:'16px'}}>部门科技服务订单</span>
  432. <div className="user-search">
  433. <Input placeholder="客户名称" style={{width:'150px'}}
  434. value={this.state.customerName}
  435. onChange={(e) => { this.setState({ customerName: e.target.value }); }} />
  436. <RangePicker
  437. value={[this.state.releaseDate[0] ? moment(this.state.releaseDate[0]) : null,
  438. this.state.releaseDate[1] ? moment(this.state.releaseDate[1]) : null]}
  439. onChange={(data, dataString) => { this.setState({ releaseDate: dataString }); }} />
  440. <Select placeholder="部门机构" style={{width:'150px',marginLeft:'10px'}}
  441. value={this.state.departmenttSearch}
  442. onChange={(e) => { this.setState({ departmenttSearch: e }) }}>
  443. {
  444. departmentArr.map(function (item) {
  445. return <Select.Option key={item.id} >{item.name}</Select.Option>
  446. })
  447. }
  448. </Select>
  449. <Input placeholder="订单负责人" style={{width:'150px'}}
  450. value={this.state.orderPersonSearch}
  451. onChange={(e) => { this.setState({ orderPersonSearch: e.target.value }); }} />
  452. <Button type="primary" onClick={this.search} style={{marginLeft:'10px'}}>搜索<Icon type="search" /></Button>
  453. <Button onClick={this.reset}>重置 <Icon type="reload" /></Button>
  454. <span style={{marginLeft:'10px',marginRight:'20px'}}>更多搜索<Switch defaultChecked={false} onChange={this.searchSwitch} /></span>
  455. </div>
  456. <div className='clearfix' style={{marginTop:'5px'}}>
  457. <div className="search-more" style={this.state.searchMore ? { display: 'none' } : {}}>
  458. <Checkbox checked={this.state.intentOrder} onChange={(e)=>{this.setState({intentOrder:!this.state.intentOrder})}}>意向订单</Checkbox>
  459. <Checkbox checked={this.state.formalOrder} onChange={(e)=>{this.setState({formalOrder:!this.state.formalOrder})}}>正式订单</Checkbox>
  460. <Select placeholder="订单状态"
  461. style={{ width: 150 ,marginRight:'10px',marginBottom:'10px'}}
  462. value={this.state.orderStatusSearch}
  463. onChange={(e) => { this.setState({ orderStatusSearch: e }) }}>
  464. {
  465. orderState.map(function (item) {
  466. return <Select.Option key={item.value} >{item.key}</Select.Option>
  467. })
  468. }
  469. </Select>
  470. <Select placeholder="结算状态"
  471. style={{ width: 150 ,marginRight:'10px'}}
  472. value={this.state.settlementState}
  473. onChange={(e) => { this.setState({ settlementState: e }) }}>
  474. {
  475. paymentState.map(function (item) {
  476. return <Select.Option key={item.value} >{item.key}</Select.Option>
  477. })
  478. }
  479. </Select>
  480. <Select placeholder="项目进度"
  481. style={{ width: 150 ,marginRight:'10px'}}
  482. value={this.state.projectProgress}
  483. onChange={(e) => { this.setState({ projectProgress: e }) }}>
  484. {
  485. projectState.map(function (item) {
  486. return <Select.Option key={item.value} >{item.key}</Select.Option>
  487. })
  488. }
  489. </Select>
  490. <Select placeholder="订单渠道"
  491. style={{ width: 150 }}
  492. value={this.state.orderChannel}
  493. onChange={(e) => { this.setState({ orderChannel: e }) }}>
  494. {
  495. orderChannel.map(function (item) {
  496. return <Select.Option key={item.value} >{item.key}</Select.Option>
  497. })
  498. }
  499. </Select>
  500. </div>
  501. </div>
  502. <div className="patent-table">
  503. <Spin spinning={this.state.loading}>
  504. <Table columns={this.state.columns}
  505. dataSource={this.state.dataSource}
  506. rowSelection={rowSelection}
  507. pagination={this.state.pagination}
  508. onRowClick={this.tableRowClick} />
  509. </Spin>
  510. </div>
  511. <NewService
  512. uid={this.state.uid}
  513. signBillVisible={this.state.signBillVisible}
  514. signBillState={this.state.signBillState}
  515. operation={this.operation}
  516. admissibleOrder={this.admissibleOrder}
  517. userDetaile={this.state.userDetaile}
  518. datauser={this.state.datauser}
  519. showDesc={this.state.showDesc}
  520. closeDesc={this.closeDesc} />
  521. </div >
  522. </div>
  523. );
  524. }
  525. }));
  526. export default ServiceManage;