serviceManage.jsx 24 KB

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