projectManage.jsx 22 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, Modal, Upload ,Popconfirm,DatePicker} from 'antd';
  6. import MySettlementDetaile from "./projectManageDetaile.jsx";
  7. import moment from 'moment';
  8. import '../userMangagement.less';
  9. import {projectState,orderState} from '../../../../dataDic.js';
  10. import {getProjectState,getOrderState,getOrderType,getPaymentState,getApprovedState} from '../../../../tools.js';
  11. const ProjectOrder=Form.create()(React.createClass({
  12. loadData(pageNo) {
  13. this.setState({
  14. loading: true
  15. });
  16. $.ajax({
  17. method: "post",
  18. dataType: "json",
  19. crossDomain: false,
  20. url: globalConfig.context + '/api/admin/techproject/listProject',
  21. data: {
  22. pageNo: pageNo || 1,
  23. pageSize: this.state.pagination.pageSize,
  24. setUpStartDate: this.state.releaseDate[0],
  25. setUpEndDate: this.state.releaseDate[1],
  26. depId:this.state.departmentt,
  27. orderStartDate: this.state.releaseDateOrder[0],
  28. orderEndDate: this.state.releaseDateOrder[1],
  29. buyerName:this.state.buyerNameSearch,//客户名称
  30. orderStatus:this.state.orderStatusSearch, //订单状态
  31. salesmanName:this.state.salesmanNameSearch,//订单负责人
  32. financeLeaderSearch:this.state.financeLeaderSearch,//财务负责人
  33. orderNo:this.state.orderNoSearch,//订单编号
  34. deletedSign:this.state.deleteSignSearch,//锁定激活
  35. serialNumber:this.state.serialNumberSearch //项目编号
  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. serialNumber: thisdata.serialNumber,
  50. signDate:thisdata.signDate,
  51. buyerName:thisdata.buyerName,
  52. projectType:thisdata.projectType,
  53. projectStatus:thisdata.projectStatus,
  54. deleteSign:thisdata.deletedSign,
  55. orderNo:thisdata.orderNo,
  56. orderTime:thisdata.orderTime,
  57. orderStatus:thisdata.orderStatus,
  58. liquidationStatus:thisdata.liquidationStatus,
  59. approval:thisdata.approval,
  60. buyerType:thisdata.buyerType,
  61. salesmanName:thisdata.salesmanName,
  62. departmentName:thisdata.departmentName,
  63. });
  64. };
  65. this.state.pagination.current = data.data.pageNo;
  66. this.state.pagination.total = data.data.totalCount;
  67. };
  68. if(!data.data.list.length){
  69. this.state.pagination.current=0
  70. this.state.pagination.total=0
  71. }
  72. this.setState({
  73. pageNo:pageNo,
  74. newProject:false,
  75. dataSource: theArr,
  76. pagination: this.state.pagination,
  77. selectedRowKeys:[]
  78. });
  79. }.bind(this),
  80. }).always(function () {
  81. this.setState({
  82. loading: false
  83. });
  84. }.bind(this));
  85. },
  86. getInitialState() {
  87. return {
  88. datauser:{},
  89. selectedRowKeys: [],
  90. selectedRows: [],
  91. searchMore: true,
  92. releaseDate: [],
  93. releaseDateOrder:[],
  94. projectState:false,
  95. newProject:false,
  96. loading: false,
  97. KnotState:true,
  98. distributionVisible:false,
  99. visible:false,
  100. showDesc:false,
  101. pagination: {
  102. defaultCurrent: 1,
  103. defaultPageSize: 10,
  104. showQuickJumper: true,
  105. pageSize: 10,
  106. onChange: function (page) {
  107. this.loadData(page);
  108. }.bind(this),
  109. showTotal: function (total) {
  110. return '共' + total + '条数据';
  111. }
  112. },
  113. columns: [
  114. {
  115. title: '项目编号',
  116. dataIndex: 'serialNumber',
  117. key: 'serialNumber'
  118. },{
  119. title: '立项时间',
  120. dataIndex: 'signDate',
  121. key: 'signDate'
  122. },{
  123. title: '客户名称',
  124. dataIndex: 'buyerName',
  125. key: 'buyerName'
  126. },{
  127. title: '客户类型',
  128. dataIndex: 'buyerProvince',
  129. key: 'buyerProvince',
  130. render:(text)=>{return text?'单位客户':'个人客户'}
  131. },{
  132. title: '业务品类',
  133. dataIndex: 'projectType',
  134. key: 'projectType',
  135. render:(text)=>{return getOrderType(text) }
  136. },{
  137. title: '项目状态',
  138. dataIndex: 'projectStatus',
  139. key: 'projectStatus',
  140. render:(text)=>{return getProjectState(text) }
  141. },{
  142. title: '订单编号',
  143. dataIndex: 'orderNo',
  144. key: 'orderNo',
  145. },{
  146. title: '下单时间',
  147. dataIndex: 'orderTime',
  148. key: 'orderTime',
  149. },{
  150. title: '订单状态',
  151. dataIndex: 'orderStatus',
  152. key: 'orderStatus',
  153. render:(text)=>{return getOrderState(text) }
  154. },{
  155. title: '订单负责人',
  156. dataIndex: 'salesmanName',
  157. key: 'salesmanName',
  158. },{
  159. title: '订单部门',
  160. dataIndex: 'departmentName',
  161. key: 'departmentName',
  162. },{
  163. title: '结算状态',
  164. dataIndex: 'liquidationStatus',
  165. key: 'liquidationStatus',
  166. render:(text)=>{return getPaymentState(text) }
  167. },{
  168. title: '是否特批',
  169. dataIndex: 'approval',
  170. key: 'approval',
  171. render:(text)=>{return getApprovedState(text) }
  172. },{
  173. title: '操作',
  174. dataIndex: 'rr',
  175. key: 'rr',
  176. render:(text,record,index)=>{
  177. return (
  178. <div>
  179. {record.projectStatus==2||record.projectStatus==5?<Button style={{marginRight:'5px'}} type="primary" onClick={(e) =>{ e.stopPropagation(),this.Knot(record)}}>项目管理</Button>:''}
  180. {record.projectStatus==2&&<Button style={{marginRight:'5px'}} type="primary" onClick={(e) =>{ e.stopPropagation(),this.Knots(record)}}>结项</Button>}
  181. {record.projectStatus==1||record.projectStatus==5?<Popconfirm title={'您将作废项目【'+record.roleName+'】,系统将自动同步作废项目任务及项目资料单,请确认'} onConfirm={(e)=>{this.scrapOrder(record)}} okText="确认" cancelText="取消">
  182. <Button style={{marginRight:'5px'}} onClick={(e) =>{ e.stopPropagation()}} type="danger">作废</Button>
  183. </Popconfirm>:''}
  184. </div>
  185. )
  186. }
  187. }
  188. ],
  189. queryColumns: [
  190. {
  191. title: '项目编号',
  192. dataIndex: 'serialNumber',
  193. key: 'serialNumber'
  194. },{
  195. title: '立项时间',
  196. dataIndex: 'signDate',
  197. key: 'signDate'
  198. },{
  199. title: '客户名称',
  200. dataIndex: 'buyerName',
  201. key: 'buyerName'
  202. },{
  203. title: '客户类型',
  204. dataIndex: 'buyerType',
  205. key: 'buyerType',
  206. render:(text)=>{return text?'单位客户':'个人客户'}
  207. },{
  208. title: '业务品类',
  209. dataIndex: 'projectType',
  210. key: 'projectType',
  211. render:(text)=>{return getOrderType(text) }
  212. },{
  213. title: '项目状态',
  214. dataIndex: 'projectStatus',
  215. key: 'projectStatus',
  216. render:(text)=>{return getProjectState(text) }
  217. },{
  218. title: '订单编号',
  219. dataIndex: 'orderNo',
  220. key: 'orderNo',
  221. },{
  222. title: '下单时间',
  223. dataIndex: 'orderTime',
  224. key: 'orderTime',
  225. },{
  226. title: '订单状态',
  227. dataIndex: 'orderStatus',
  228. key: 'orderStatus',
  229. render:(text)=>{return getOrderState(text) }
  230. },{
  231. title: '订单负责人',
  232. dataIndex: 'salesmanName',
  233. key: 'salesmanName',
  234. },{
  235. title: '订单部门',
  236. dataIndex: 'departmentName',
  237. key: 'departmentName',
  238. },{
  239. title: '结算状态',
  240. dataIndex: 'liquidationStatus',
  241. key: 'liquidationStatus',
  242. render:(text)=>{return getPaymentState(text) }
  243. },{
  244. title: '是否特批',
  245. dataIndex: 'approval',
  246. key: 'approval',
  247. render:(text)=>{return getApprovedState(text) }
  248. }
  249. ],
  250. dataSource: [],
  251. };
  252. },
  253. //结项
  254. Knots(record){
  255. this.setState({
  256. signComment:'',
  257. contractId:record.id,
  258. serial:record.serialNumber,
  259. buyerName:record.buyerName,
  260. KnotState:false,
  261. signBillVisible:true
  262. })
  263. },
  264. //部门
  265. departmentList() {
  266. this.setState({
  267. loading: true
  268. });
  269. $.ajax({
  270. method: "post",
  271. dataType: "json",
  272. crossDomain: false,
  273. url: globalConfig.context + "/api/admin/organization/selectSuperId",
  274. data: {
  275. },
  276. success: function(data) {
  277. let thedata = data.data;
  278. let theArr=[];
  279. if(!thedata) {
  280. if(data.error && data.error.length) {
  281. message.warning(data.error[0].message);
  282. };
  283. thedata = {};
  284. }else{
  285. thedata.map(function(item,index){
  286. theArr.push({
  287. key:index,
  288. name:item.name,
  289. id:item.id,
  290. depNo:item.depNo
  291. })
  292. })
  293. }
  294. this.setState({
  295. departmentArr:theArr,
  296. })
  297. }.bind(this),
  298. }).always(function() {
  299. this.setState({
  300. loading: false
  301. });
  302. }.bind(this));
  303. },
  304. //作废项目
  305. scrapOrder(record){
  306. this.setState({
  307. loading: true
  308. });
  309. $.ajax({
  310. method: "POST",
  311. dataType: "json",
  312. crossDomain: false,
  313. url: globalConfig.context +'/api/zuofei',
  314. data: {
  315. id:record.id,
  316. }
  317. }).done(function(data) {
  318. this.setState({
  319. loading: false
  320. });
  321. if(!data.error.length) {
  322. message.success('操作成功!');
  323. this.loadData(this.state.pageNo);
  324. } else {
  325. message.warning(data.error[0].message);
  326. }
  327. }.bind(this));
  328. },
  329. //创建项目
  330. addClick() {
  331. this.setState({
  332. newProject:true,
  333. signBillVisible:false,
  334. showDesc: false
  335. });
  336. },
  337. componentWillMount() {
  338. this.loadData();
  339. this.departmentList()
  340. },
  341. //项目管理
  342. Knot(record){
  343. this.state.userDetaile=true;
  344. this.state.datauser = record;
  345. this.setState({
  346. projectState:true,
  347. newProject:false,
  348. showDesc: true
  349. });
  350. },
  351. noProject(){
  352. this.setState({
  353. signBillVisible:false
  354. })
  355. },
  356. closeDesc(e, s) {
  357. this.state.userDetaile=false;
  358. this.state.showDesc = e;
  359. if (s) {
  360. this.loadData(this.state.pageNo);
  361. };
  362. },
  363. noProject(){
  364. this.setState({
  365. signBillVisible:false
  366. })
  367. },
  368. //结项
  369. projectSubmit(e){
  370. e.preventDefault();
  371. this.setState({
  372. loading: true
  373. });
  374. $.ajax({
  375. method: "get",
  376. dataType: "json",
  377. crossDomain: false,
  378. url: globalConfig.context +'/api/admin/techproject/revokeOrComplete' ,
  379. data: {
  380. contractId:this.state.contractId,
  381. operatorType:1,
  382. completeComment:this.state.signComment,
  383. }
  384. }).done(function(data) {
  385. this.setState({
  386. loading: false
  387. });
  388. if(!data.error.length) {
  389. message.success('结项成功!');
  390. this.noProject();
  391. this.loadData(this.state.pageNo);
  392. } else {
  393. message.warning(data.error[0].message);
  394. }
  395. }.bind(this));
  396. },
  397. searchSwitch() {
  398. this.setState({
  399. newProject:false,
  400. searchMore: !this.state.searchMore
  401. });
  402. },
  403. search() {
  404. this.loadData();
  405. },
  406. tableRowClick(record, index) {
  407. this.state.userDetaile=true;
  408. this.state.datauser = record;
  409. this.setState({
  410. projectState:false,
  411. newProject:false,
  412. showDesc: true
  413. });
  414. },
  415. reset() {
  416. this.state.buyerNameSearch='';
  417. this.state.serialNumberSearch='';
  418. this.state.releaseDate[0] = undefined;
  419. this.state.releaseDate[1] = undefined;
  420. this.state.releaseDateOrder[0] = undefined;
  421. this.state.releaseDateOrder[1] = undefined;
  422. this.state.departmentt=undefined;
  423. this.state.orderStatusSearch = undefined;
  424. this.state.salesmanNameSearch = '';
  425. this.state.orderNoSearch='';
  426. this.state.deleteSignSearch=undefined;
  427. this.loadData();
  428. },
  429. render() {
  430. const FormItem = Form.Item;
  431. const formItemLayout = {
  432. labelCol: { span: 8 },
  433. wrapperCol: { span: 14 },
  434. };
  435. const { RangePicker } = DatePicker;
  436. const rowSelection = {
  437. selectedRowKeys: this.state.selectedRowKeys,
  438. onChange: (selectedRowKeys, selectedRows) => {
  439. this.setState({
  440. selectedRows: selectedRows.slice(-1),
  441. selectedRowKeys: selectedRowKeys.slice(-1)
  442. });
  443. },
  444. onSelectAll: (selected, selectedRows, changeRows) => {
  445. this.setState({
  446. selectedRowKeys:[]
  447. })
  448. },
  449. };
  450. const hasSelected = this.state.selectedRowKeys.length > 0;
  451. let departmentArr = this.state.departmentArr || [];
  452. return (
  453. <div className="user-content" >
  454. <div className="content-title">
  455. <span style={{fontSize:'16px'}}>{this.props.queryProject?'项目查询':'项目管理'}</span>
  456. <div className="user-search">
  457. <Input placeholder="客户名称" style={{width:'150px'}}
  458. value={this.state.buyerNameSearch}
  459. onChange={(e) => { this.setState({ buyerNameSearch: e.target.value }); }} />
  460. <span style={{fontSize:'14px',marginRight:'5px'}}>立项时间:</span>
  461. <RangePicker
  462. value={[this.state.releaseDate[0] ? moment(this.state.releaseDate[0]) : null,
  463. this.state.releaseDate[1] ? moment(this.state.releaseDate[1]) : null]}
  464. onChange={(data, dataString) => { this.setState({ releaseDate: dataString }); }} />
  465. <Button type="primary" onClick={this.search} style={{marginLeft:'10px'}}>搜索</Button>
  466. <Button onClick={this.reset}>重置</Button>
  467. <span style={{marginLeft:'10px',marginRight:'20px'}}>更多搜索<Switch defaultChecked={false} onChange={this.searchSwitch} /></span>
  468. {this.props.queryProject?'':<Button type="primary" className="addButton" onClick={this.addClick} >创建项目<Icon type="plus" /></Button>}
  469. </div>
  470. <div className='clearfix' style={{marginTop:'5px'}}>
  471. <div className="search-more" style={this.state.searchMore ? { display: 'none' } : {}}>
  472. <Input placeholder="订单编号" style={{width:'150px',marginRight:'10px'}}
  473. value={this.state.orderNoSearch}
  474. onChange={(e) => { this.setState({ orderNoSearch: e.target.value }); }} />
  475. <Input placeholder="项目编号" style={{width:'150px',marginRight:'10px'}}
  476. value={this.state.serialNumberSearch}
  477. onChange={(e) => { this.setState({ serialNumberSearch: e.target.value }); }} />
  478. <Select placeholder="选择部门" style={{width:'150px'}}
  479. value={this.state.departmentt}
  480. onChange={(e) => { this.setState({ departmentt: e }) }}>
  481. {
  482. departmentArr.map(function (item) {
  483. return <Select.Option key={item.id} >{item.name}</Select.Option>
  484. })
  485. }
  486. </Select>
  487. <Input placeholder="订单负责人" style={{width:'150px',margin:'10px'}}
  488. value={this.state.salesmanNameSearch}
  489. onChange={(e) => { this.setState({ salesmanNameSearch: e.target.value }); }} />
  490. <span style={{fontSize:'14px',marginRight:'5px'}}>订单时间:</span>
  491. <RangePicker
  492. value={[this.state.releaseDateOrder[0] ? moment(this.state.releaseDateOrder[0]) : null,
  493. this.state.releaseDateOrder[1] ? moment(this.state.releaseDateOrder[1]) : null]}
  494. onChange={(data, dataString) => { this.setState({ releaseDateOrder: dataString }); }} />
  495. </div>
  496. </div>
  497. <div className="patent-table">
  498. <Spin spinning={this.state.loading}>
  499. <Table columns={this.props.queryProject?this.state.queryColumns:this.state.columns}
  500. dataSource={this.state.dataSource}
  501. rowSelection={rowSelection}
  502. pagination={this.state.pagination}
  503. onRowClick={this.tableRowClick}
  504. />
  505. </Spin>
  506. </div>
  507. <MySettlementDetaile
  508. queryProject={this.props.queryProject}
  509. departmentArr={this.state.departmentArr}
  510. projectState={this.state.projectState}
  511. newProject={this.state.newProject}
  512. userDetaile={this.state.userDetaile}
  513. datauser={this.state.datauser}
  514. showDesc={this.state.showDesc}
  515. closeDesc={this.closeDesc} />
  516. </div >
  517. <Modal maskClosable={false} visible={this.state.signBillVisible}
  518. onOk={this.noProject} onCancel={this.noProject}
  519. width='800px'
  520. title='项目结项'
  521. footer=''
  522. className="admin-desc-content">
  523. <Form layout="horizontal" onSubmit={this.projectSubmit} id="demand-form">
  524. <Spin spinning={this.state.loading}>
  525. <div className="clearfix">
  526. <FormItem className="half-item"
  527. {...formItemLayout}
  528. label="项目编号" >
  529. <span>{this.state.serial}</span>
  530. </FormItem>
  531. <FormItem className="half-item"
  532. {...formItemLayout}
  533. label="客户名称" >
  534. <span>{this.state.buyerName}</span>
  535. </FormItem>
  536. <div className='clearfix'>
  537. <FormItem
  538. labelCol={{ span: 4 }}
  539. wrapperCol={{ span: 16 }}
  540. label="结项说明" >
  541. <Input type="textarea" placeholder="请输入备注" rows={4} value={this.state.signComment}
  542. onChange={(e)=>{this.setState({signComment:e.target.value})}}/>
  543. </FormItem>
  544. </div>
  545. </div>
  546. <FormItem wrapperCol={{ span: 12, offset: 4 }} className="half-middle">
  547. <Button className="submitSave" type="primary" htmlType="submit">确定结项</Button>
  548. <Button className="submitSave" type="ghost" onClick={this.noProject}>返回</Button>
  549. </FormItem>
  550. </Spin>
  551. </Form >
  552. </Modal>
  553. </div>
  554. );
  555. }
  556. }));
  557. export default ProjectOrder;