projectManage.jsx 23 KB

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