serviceManage.jsx 22 KB

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