settlementManagement.jsx 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513
  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, Modal, Upload ,Popconfirm} from 'antd';
  6. import ManagementDetaile from "./managementDetaile.jsx";
  7. import moment from 'moment';
  8. import '../userMangagement.less';
  9. import {lvl,intentProgress,transactionProgress,contractProgress,projectProgress} from '../../../dataDic.js';
  10. import {getIntentProgress,getTransactionProgress,getContractProgress,getProjectProgress} from '../../../tools.js';
  11. console.log(adminData.name)
  12. const SettlementManage=Form.create()(React.createClass({
  13. loadData(pageNo) {
  14. this.state.data = [];
  15. this.setState({
  16. loading: true
  17. });
  18. $.ajax({
  19. method: "post",
  20. dataType: "json",
  21. crossDomain: false,
  22. url: globalConfig.context + '/api/admin/roles',
  23. data: {
  24. pageNo: pageNo || 1,
  25. pageSize: this.state.pagination.pageSize,
  26. customerName:this.state.customerName,
  27. startDate: this.state.releaseDate[0],
  28. endDate: this.state.releaseDate[1],
  29. transactionProgress:this.state.transactionProgress,
  30. contractProgress:this.state.contractProgress,
  31. projectProgress:this.state.projectProgress,
  32. settlementState:this.state.settlementState,
  33. orderStatus:this.state.orderStatus,
  34. approved:this.state.approved,
  35. orderChannel:this.state.orderChannel
  36. },
  37. success: function (data) {
  38. let theArr = [];
  39. if (!data.data) {
  40. if (data.error && data.error.length) {
  41. message.warning(data.error[0].message);
  42. };
  43. } else {
  44. for (let i = 0; i < data.data.list.length; i++) {
  45. let thisdata = data.data.list[i];
  46. theArr.push({
  47. key: i,
  48. id: thisdata.id,
  49. roleName: thisdata.roleName,
  50. creater:thisdata.creater,
  51. createTime:thisdata.createTimez,
  52. });
  53. };
  54. this.state.pagination.current = data.data.pageNo;
  55. this.state.pagination.total = data.data.totalCount;
  56. };
  57. if(!data.data.list.length){
  58. this.state.pagination.current=0
  59. this.state.pagination.total=0
  60. }
  61. this.setState({
  62. dataSource: theArr,
  63. pagination: this.state.pagination,
  64. selectedRowKeys:[]
  65. });
  66. }.bind(this),
  67. }).always(function () {
  68. this.setState({
  69. loading: false
  70. });
  71. }.bind(this));
  72. },
  73. getInitialState() {
  74. return {
  75. datauser:{},
  76. selectedRowKeys: [],
  77. releaseDate: [],
  78. selectedRows: [],
  79. searchMore: true,
  80. loading: false,
  81. editState:false,
  82. distributionVisible:false,
  83. visible:false,
  84. showDesc:false,
  85. pagination: {
  86. defaultCurrent: 1,
  87. defaultPageSize: 10,
  88. showQuickJumper: true,
  89. pageSize: 10,
  90. onChange: function (page) {
  91. this.loadData(page);
  92. }.bind(this),
  93. showTotal: function (total) {
  94. return '共' + total + '条数据';
  95. }
  96. },
  97. distributionPagination: {
  98. defaultCurrent: 1,
  99. defaultPageSize: 10,
  100. showQuickJumper: true,
  101. pageSize: 10,
  102. onChange: function (page) {
  103. this.contactList(page);
  104. }.bind(this),
  105. showTotal: function (total) {
  106. return '共' + total + '条数据';
  107. }
  108. },
  109. columns: [
  110. {
  111. title: '订单编号',
  112. dataIndex: 'roleName',
  113. key: 'roleName'
  114. }, {
  115. title: '订单类型',
  116. dataIndex: 'creater',
  117. key: 'creater'
  118. }, {
  119. title: '下单时间',
  120. dataIndex: 'creater7',
  121. key: 'creater7'
  122. },{
  123. title: '订单客户',
  124. dataIndex: 'roleName1',
  125. key: 'roleName1'
  126. }, {
  127. title: '实际下单金额',
  128. dataIndex: 'creater1',
  129. key: 'creater1'
  130. }, {
  131. title: '订单状态',
  132. dataIndex: 'createTime1',
  133. key: 'createTime1',
  134. render:(text)=>{return getIntentProgress(text) }
  135. },{
  136. title: '结算状态',
  137. dataIndex: 'roleName2',
  138. key: 'roleName2',
  139. render:(text)=>{return getTransactionProgress(text) }
  140. }, {
  141. title: '项目状态',
  142. dataIndex: 'creater2',
  143. key: 'creater2',
  144. render:(text)=>{return getContractProgress(text) }
  145. }, {
  146. title: '是否特批',
  147. dataIndex: 'creatu',
  148. key: 'creatu',
  149. render:(text)=>{return getProjectProgress(text) }
  150. },{
  151. title: '订单部门',
  152. dataIndex: 'cre1',
  153. key: 'cre1',
  154. render:(text)=>{return getProjectProgress(text) }
  155. },{
  156. title: '订单负责人',
  157. dataIndex: 'cre2',
  158. key: 'cre2',
  159. render:(text)=>{return getProjectProgress(text) }
  160. },{
  161. title: '财务负责人',
  162. dataIndex: 'cre3',
  163. key: 'cre3',
  164. render:(text)=>{return getProjectProgress(text) }
  165. },{
  166. title: '项目负责人',
  167. dataIndex: 'cre4',
  168. key: 'cre4',
  169. render:(text)=>{return getProjectProgress(text) }
  170. },{
  171. title: '操作',
  172. dataIndex: 'operation',
  173. key: 'operation',
  174. render: (text, record, index) => {
  175. return <div>
  176. <Button style={{marginRight:'5px'}} onClick={(e) =>{ e.stopPropagation(),this.confirmDelet(record)}} type="primary">派单</Button>
  177. <Popconfirm title={'订单结算编辑用于特殊情况下处理订单结算状态,请慎用!'} onConfirm={(e)=>{this.edit(record)}} okText="知悉,去编辑" cancelText="暂不编辑">
  178. <Button style={{marginRight:'5px'}} type="primary" onClick={(e) =>{ e.stopPropagation() }}>编辑</Button>
  179. </Popconfirm>
  180. </div>
  181. }
  182. }
  183. ],
  184. userList:[
  185. {
  186. title: '用户编号',
  187. dataIndex: 'roleName',
  188. key: 'roleName'
  189. }, {
  190. title: '用户姓名',
  191. dataIndex: 'creater',
  192. key: 'creater'
  193. },{
  194. title: '部门机构',
  195. dataIndex: 'roleName1',
  196. key: 'roleName1'
  197. }, {
  198. title: '职务',
  199. dataIndex: 'creater1',
  200. key: 'creater1'
  201. },{
  202. title: '联系手机',
  203. dataIndex: 'roleName2',
  204. key: 'roleName2'
  205. }, {
  206. title: '操作',
  207. dataIndex: 'abc',
  208. key: 'abc',
  209. render:(text,record,index)=>{
  210. return (
  211. <Popconfirm title={'您确认将此订单 【'+ record.roleName+'】 分配给【'+record.roleName+'-'+record.roleName+'】进行业务跟进?'} onConfirm={(e)=>{this.confirmSelect(record)}} okText="确认" cancelText="取消">
  212. <Button style={{marginRight:'5px'}} type="primary">选定</Button>
  213. </Popconfirm>
  214. )
  215. }
  216. }
  217. ],
  218. dataSource: [],
  219. };
  220. },
  221. //操作分配
  222. confirmDelet(index){
  223. this.setState({
  224. userDetaile:false,
  225. distributionVisible:true
  226. });
  227. this.contactList(1,index.id)
  228. },
  229. distributionCancel(){
  230. this.setState({
  231. distributionVisible:false
  232. })
  233. },
  234. distributionOk(){
  235. this.setState({
  236. distributionVisible:false
  237. })
  238. },
  239. //分配对象列表
  240. contactList(pageNo,orderId){
  241. $.ajax({
  242. method: "post",
  243. dataType: "json",
  244. crossDomain: false,
  245. url: globalConfig.context + '/api/admin/roles',
  246. data: {
  247. pageNo: pageNo || 1,
  248. pageSize: this.state.distributionPagination.pageSize,
  249. },
  250. success: function (data) {
  251. let theArr = [];
  252. if (!data.data) {
  253. if (data.error && data.error.length) {
  254. message.warning(data.error[0].message);
  255. };
  256. } else {
  257. for (let i = 0; i < data.data.list.length; i++) {
  258. let thisdata = data.data.list[i];
  259. theArr.push({
  260. key: i,
  261. id: thisdata.id,
  262. roleName: thisdata.roleName,
  263. creater:thisdata.creater,
  264. createTime:thisdata.createTimez,
  265. uid:orderId,
  266. });
  267. };
  268. this.state.distributionPagination.current = data.data.pageNo;
  269. this.state.distributionPagination.total = data.data.totalCount;
  270. };
  271. if(!data.data.list.length){
  272. this.state.distributionPagination.current=0
  273. this.state.distributionPagination.total=0
  274. }
  275. this.setState({
  276. distributionList: theArr,
  277. pagination: this.state.distributionPagination,
  278. });
  279. }.bind(this),
  280. }).always(function () {
  281. this.setState({
  282. loading: false
  283. });
  284. }.bind(this));
  285. },
  286. //选定对象
  287. confirmSelect(record){
  288. this.setState({
  289. loading: true
  290. });
  291. $.ajax({
  292. method: "POST",
  293. dataType: "json",
  294. crossDomain: false,
  295. url: globalConfig.context + "",
  296. data: {
  297. id:record.id,
  298. uid:record.uid
  299. }
  300. }).done(function (data) {
  301. if (!data.error.length) {
  302. message.success('分配成功');
  303. this.setState({
  304. loading: false,
  305. });
  306. this.distributionOk();
  307. } else {
  308. message.warning(data.error[0].message);
  309. };
  310. this.loadData();
  311. }.bind(this));
  312. },
  313. //取编辑
  314. edit(record){
  315. this.setState({
  316. showDesc: true,
  317. userDetaile:true,
  318. datauser:record,
  319. editState:true
  320. });
  321. },
  322. componentWillMount() {
  323. this.loadData();
  324. },
  325. tableRowClick(record, index) {
  326. this.state.userDetaile=true;
  327. this.state.datauser = record;
  328. this.setState({
  329. editState:false,
  330. showDesc: true
  331. });
  332. },
  333. closeDesc(e, s) {
  334. this.state.userDetaile=false;
  335. this.state.showDesc = e;
  336. if (s) {
  337. this.loadData();
  338. };
  339. },
  340. searchSwitch() {
  341. this.setState({
  342. searchMore: !this.state.searchMore
  343. });
  344. },
  345. search() {
  346. this.loadData();
  347. },
  348. //分配时搜索
  349. searchOrder() {
  350. this.contactList();
  351. },
  352. //分配时重置
  353. resetOrder() {
  354. this.contactList();
  355. },
  356. reset() {
  357. this.state.customerName='';
  358. this.state.releaseDate[0] = undefined;
  359. this.state.releaseDate[1] = undefined;
  360. this.state.transactionProgress = undefined;
  361. this.state.contractProgress = undefined;
  362. this.state.projectProgress = undefined;
  363. this.state.settlementState = undefined;
  364. this.state.orderStatus = undefined;
  365. this.state.approved = undefined;
  366. this.state.orderChannel = undefined;
  367. this.loadData();
  368. },
  369. render() {
  370. const rowSelection = {
  371. selectedRowKeys: this.state.selectedRowKeys,
  372. onChange: (selectedRowKeys, selectedRows) => {
  373. this.setState({
  374. selectedRows: selectedRows.slice(-1),
  375. selectedRowKeys: selectedRowKeys.slice(-1)
  376. });
  377. },
  378. onSelectAll: (selected, selectedRows, changeRows) => {
  379. this.setState({
  380. selectedRowKeys:[]
  381. })
  382. },
  383. };
  384. const hasSelected = this.state.selectedRowKeys.length > 0;
  385. const { RangePicker } = DatePicker;
  386. return (
  387. <div className="user-content" >
  388. <div className="content-title">
  389. <span style={{fontSize:'16px'}}>结算订单管理</span>
  390. <div className="user-search">
  391. <Input placeholder="客户名称" style={{width:'150px'}}
  392. value={this.state.customerName}
  393. onChange={(e) => { this.setState({ customerName: e.target.value }); }} />
  394. <RangePicker
  395. value={[this.state.releaseDate[0] ? moment(this.state.releaseDate[0]) : null,
  396. this.state.releaseDate[1] ? moment(this.state.releaseDate[1]) : null]}
  397. onChange={(data, dataString) => { this.setState({ releaseDate: dataString }); }} />
  398. <Select placeholder="订单部门"
  399. style={{ width: 150 ,marginRight:'10px',marginLeft:'10px'}}
  400. value={this.state.orderStatus}
  401. onChange={(e) => { this.setState({ orderStatus: e }) }}>
  402. {
  403. lvl.map(function (item) {
  404. return <Select.Option key={item.value} >{item.key}</Select.Option>
  405. })
  406. }
  407. </Select>
  408. <Input placeholder="订单负责人" style={{width:'150px'}}
  409. value={this.state.customerName}
  410. onChange={(e) => { this.setState({ customerName: e.target.value }); }} />
  411. <Select placeholder="财务负责人"
  412. style={{ width: 150 ,marginRight:'10px'}}
  413. value={this.state.orderStatus}
  414. onChange={(e) => { this.setState({ orderStatus: e }) }}>
  415. {
  416. lvl.map(function (item) {
  417. return <Select.Option key={item.value} >{item.key}</Select.Option>
  418. })
  419. }
  420. </Select>
  421. <Button type="primary" onClick={this.search} style={{marginLeft:'10px'}}>搜索</Button>
  422. <Button onClick={this.reset}>重置</Button>
  423. <span style={{marginLeft:'10px',marginRight:'20px'}}>更多搜索<Switch defaultChecked={false} onChange={this.searchSwitch} /></span>
  424. </div>
  425. <div className='clearfix' style={{marginTop:'5px'}}>
  426. <div className="search-more" style={this.state.searchMore ? { display: 'none' } : {}}>
  427. <Select placeholder="订单状态"
  428. style={{ width: 150 ,marginRight:'10px'}}
  429. value={this.state.orderStatus}
  430. onChange={(e) => { this.setState({ orderStatus: e }) }}>
  431. {
  432. lvl.map(function (item) {
  433. return <Select.Option key={item.value} >{item.key}</Select.Option>
  434. })
  435. }
  436. </Select>
  437. <Select placeholder="订单渠道"
  438. style={{ width: 150,marginRight:'10px' }}
  439. value={this.state.orderChannel}
  440. onChange={(e) => { this.setState({ orderChannel: e }) }}>
  441. {
  442. lvl.map(function (item) {
  443. return <Select.Option key={item.value} >{item.key}</Select.Option>
  444. })
  445. }
  446. </Select>
  447. <Select placeholder="订单类型"
  448. style={{ width: 150 }}
  449. value={this.state.orderChannel}
  450. onChange={(e) => { this.setState({ orderChannel: e }) }}>
  451. {
  452. lvl.map(function (item) {
  453. return <Select.Option key={item.value} >{item.key}</Select.Option>
  454. })
  455. }
  456. </Select>
  457. </div>
  458. </div>
  459. <div className="patent-table">
  460. <Spin spinning={this.state.loading}>
  461. <Table columns={this.state.columns}
  462. dataSource={this.state.dataSource}
  463. rowSelection={rowSelection}
  464. pagination={this.state.pagination}
  465. onRowClick={this.tableRowClick} />
  466. </Spin>
  467. </div>
  468. <ManagementDetaile
  469. editState={this.state.editState}
  470. confirmDelet={this.confirmDelet}
  471. userDetaile={this.state.userDetaile}
  472. datauser={this.state.datauser}
  473. showDesc={this.state.showDesc}
  474. closeDesc={this.closeDesc} />
  475. </div >
  476. <Modal maskClosable={false} visible={this.state.distributionVisible}
  477. onOk={this.distributionOk} onCancel={this.distributionCancel}
  478. width='800px'
  479. title='分派财务订单'
  480. footer=''
  481. className="admin-desc-content">
  482. <Form layout="horizontal" onSubmit={this.handleSubmit} id="demand-form" style={{paddingBottom:'40px'}} >
  483. <Spin spinning={this.state.loading}>
  484. <div>
  485. <Input placeholder="部门名称" style={{width:'150px'}}
  486. value={this.state.customerName}
  487. onChange={(e) => { this.setState({ customerName: e.target.value }); }} />
  488. <Input placeholder="财务负责人" style={{width:'150px',marginLeft:'10px'}}
  489. value={this.state.customerName}
  490. onChange={(e) => { this.setState({ customerName: e.target.value }); }} />
  491. <Button type="primary" onClick={this.searchOrder} style={{marginLeft:'10px',marginRight:'10px'}}>搜索</Button>
  492. <Button onClick={this.resetOrder}>重置</Button>
  493. </div>
  494. <div className="patent-table" style={{marginTop:'10px'}}>
  495. <Spin spinning={this.state.loading}>
  496. <Table columns={this.state.userList}
  497. dataSource={this.state.distributionList}
  498. pagination={this.state.distributionPagination}
  499. />
  500. </Spin>
  501. </div>
  502. </Spin>
  503. </Form>
  504. </Modal>
  505. </div>
  506. );
  507. }
  508. }));
  509. export default SettlementManage;