projectOrder.jsx 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400
  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} from 'antd';
  6. import MySettlementDetaile from "./projectOrderDetaile.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. const ProjectOrder=Form.create()(React.createClass({
  12. loadData(pageNo) {
  13. this.state.data = [];
  14. this.setState({
  15. loading: true
  16. });
  17. $.ajax({
  18. method: "post",
  19. dataType: "json",
  20. crossDomain: false,
  21. url: globalConfig.context + '/api/admin/roles',
  22. data: {
  23. pageNo: pageNo || 1,
  24. pageSize: this.state.pagination.pageSize,
  25. customerNameSearch:this.state.customerNameSearch,//客户名称
  26. approvedSearch:this.state.approvedSearch, //是否特批
  27. orderStatusSearch:this.state.orderStatusSearch, //订单状态
  28. orderDepartmentSearch:this.state.orderDepartmentSearch, //订单部门
  29. orderLeaderSearch:this.state.orderLeaderSearch,//订单负责人
  30. financeLeaderSearch:this.state.financeLeaderSearch,//财务负责人
  31. },
  32. success: function (data) {
  33. let theArr = [];
  34. if (!data.data) {
  35. if (data.error && data.error.length) {
  36. message.warning(data.error[0].message);
  37. };
  38. } else {
  39. for (let i = 0; i < data.data.list.length; i++) {
  40. let thisdata = data.data.list[i];
  41. theArr.push({
  42. key: i,
  43. id: thisdata.id,
  44. roleName: thisdata.roleName,
  45. creater:thisdata.creater,
  46. createTime:thisdata.createTimez,
  47. });
  48. };
  49. this.state.pagination.current = data.data.pageNo;
  50. this.state.pagination.total = data.data.totalCount;
  51. };
  52. if(!data.data.list.length){
  53. this.state.pagination.current=0
  54. this.state.pagination.total=0
  55. }
  56. this.setState({
  57. dataSource: theArr,
  58. pagination: this.state.pagination,
  59. selectedRowKeys:[]
  60. });
  61. }.bind(this),
  62. }).always(function () {
  63. this.setState({
  64. loading: false
  65. });
  66. }.bind(this));
  67. },
  68. getInitialState() {
  69. return {
  70. datauser:{},
  71. selectedRowKeys: [],
  72. selectedRows: [],
  73. searchMore: true,
  74. loading: false,
  75. KnotState:true,
  76. distributionVisible:false,
  77. visible:false,
  78. showDesc:false,
  79. pagination: {
  80. defaultCurrent: 1,
  81. defaultPageSize: 10,
  82. showQuickJumper: true,
  83. pageSize: 10,
  84. onChange: function (page) {
  85. this.loadData(page);
  86. }.bind(this),
  87. showTotal: function (total) {
  88. return '共' + total + '条数据';
  89. }
  90. },
  91. columns: [
  92. {
  93. title: '订单编号',
  94. dataIndex: 'roleName',
  95. key: 'roleName'
  96. },{
  97. title: '下单时间',
  98. dataIndex: 'creater7',
  99. key: 'creater7'
  100. },{
  101. title: '客户名称',
  102. dataIndex: 'roleName1',
  103. key: 'roleName1'
  104. },
  105. {
  106. title: '订单类型',
  107. dataIndex: 'creater1',
  108. key: 'creater1'
  109. }, {
  110. title: '订单状态',
  111. dataIndex: 'createTime1',
  112. key: 'createTime1',
  113. render:(text)=>{return getIntentProgress(text) }
  114. },{
  115. title: '结算状态',
  116. dataIndex: 'roleName2',
  117. key: 'roleName2',
  118. render:(text)=>{return getTransactionProgress(text) }
  119. }, {
  120. title: '是否特批',
  121. dataIndex: 'creater2',
  122. key: 'creater2',
  123. render:(text)=>{return getContractProgress(text) }
  124. },{
  125. title: '订单部门',
  126. dataIndex: 'creater77',
  127. key: 'creater77',
  128. render:(text)=>{return getContractProgress(text) }
  129. },{
  130. title: '订单负责人',
  131. dataIndex: 'creater9',
  132. key: 'creater9',
  133. },{
  134. title: '财务负责人',
  135. dataIndex: 'creater91',
  136. key: 'creater91',
  137. },{
  138. title: '操作',
  139. dataIndex: 'rr',
  140. key: 'rr',
  141. render:(text,record,index)=>{
  142. return (
  143. <div>
  144. <Button style={{marginRight:'5px'}} type="primary" onClick={(e) =>{ e.stopPropagation(),this.edit(record) }}>立项</Button>
  145. <Button style={{marginRight:'5px'}} type="primary" onClick={(e) =>{ e.stopPropagation(),this.Knot(record)}}>结项</Button>
  146. </div>
  147. )
  148. }
  149. }
  150. ],
  151. dataSource: [],
  152. };
  153. },
  154. componentWillMount() {
  155. this.loadData();
  156. },
  157. //立项
  158. edit(record) {
  159. this.setState({
  160. Kid:record.id,
  161. KnotState:true,
  162. signBillVisible:true
  163. })
  164. this.editData(record,1)
  165. },
  166. //结项
  167. Knot(record){
  168. this.setState({
  169. Kid:record.id,
  170. KnotState:false,
  171. signBillVisible:true
  172. })
  173. this.editData(record,0)
  174. },
  175. noProject(){
  176. this.setState({
  177. signBillVisible:false
  178. })
  179. },
  180. //立项。结项前数据获取
  181. editData(xhr,state){
  182. let api =state?'api/lixiang-shuju':'api/jiexiang-shuju';
  183. $.ajax({
  184. method: "POST",
  185. dataType: "json",
  186. crossDomain: false,
  187. url: globalConfig.context + '/api/1313',
  188. data: {
  189. id:xhr.id,
  190. },
  191. success: function (data) {
  192. if (!data.data) {
  193. if (data.error && data.error.length) {
  194. message.warning(data.error[0].message);
  195. };
  196. } else {
  197. };
  198. }.bind(this)},
  199. ).always(function () {
  200. this.setState({
  201. loading: false
  202. });
  203. }.bind(this));
  204. },
  205. //立项、结项保存操作
  206. projectSubmit(e){
  207. e.preventDefault();
  208. this.setState({
  209. loading: true
  210. });
  211. let api=this.state.KnotState?'/api/admin/lixiang':'/api/admin/jiexiang';
  212. $.ajax({
  213. method: "POST",
  214. dataType: "json",
  215. crossDomain: false,
  216. url: globalConfig.context +api ,
  217. data: {
  218. id:this.state.Kid,
  219. }
  220. }).done(function(data) {
  221. this.setState({
  222. loading: false
  223. });
  224. if(!data.error.length) {
  225. message.success('操作成功!');
  226. this.noProject();
  227. this.loadData();
  228. } else {
  229. message.warning(data.error[0].message);
  230. }
  231. }.bind(this));
  232. },
  233. closeDesc(e, s) {
  234. this.state.userDetaile=false;
  235. this.state.showDesc = e;
  236. if (s) {
  237. this.loadData();
  238. };
  239. },
  240. searchSwitch() {
  241. this.setState({
  242. searchMore: !this.state.searchMore
  243. });
  244. },
  245. search() {
  246. this.loadData();
  247. },
  248. tableRowClick(record, index) {
  249. this.state.userDetaile=true;
  250. this.state.datauser = record;
  251. this.setState({
  252. showDesc: true
  253. });
  254. },
  255. reset() {
  256. this.state.customerNameSearch='';
  257. this.state.approvedSearch = undefined;
  258. this.state.orderStatusSearch = undefined;
  259. this.state.orderDepartmentSearch = undefined;
  260. this.state.orderLeaderSearch = '';
  261. this.state.financeLeaderSearch = '';
  262. this.loadData();
  263. },
  264. render() {
  265. const FormItem = Form.Item;
  266. const formItemLayout = {
  267. labelCol: { span: 8 },
  268. wrapperCol: { span: 14 },
  269. };
  270. const rowSelection = {
  271. selectedRowKeys: this.state.selectedRowKeys,
  272. onChange: (selectedRowKeys, selectedRows) => {
  273. this.setState({
  274. selectedRows: selectedRows.slice(-1),
  275. selectedRowKeys: selectedRowKeys.slice(-1)
  276. });
  277. },
  278. onSelectAll: (selected, selectedRows, changeRows) => {
  279. this.setState({
  280. selectedRowKeys:[]
  281. })
  282. },
  283. };
  284. const hasSelected = this.state.selectedRowKeys.length > 0;
  285. return (
  286. <div className="user-content" >
  287. <div className="content-title">
  288. <span style={{fontSize:'16px'}}>立项订单</span>
  289. <div className="user-search">
  290. <Input placeholder="客户名称" style={{width:'150px'}}
  291. value={this.state.customerNameSearch}
  292. onChange={(e) => { this.setState({ customerNameSearch: e.target.value }); }} />
  293. <Select placeholder="是否特批"
  294. style={{ width: 150 ,marginRight:'10px'}}
  295. value={this.state.approvedSearch}
  296. onChange={(e) => { this.setState({ approvedSearch: e }) }}>
  297. <Select.Option value='0'>未特批</Select.Option>
  298. <Select.Option value='1'>已特批</Select.Option>
  299. </Select>
  300. <Select placeholder="订单状态"
  301. style={{ width: 150 ,marginRight:'10px'}}
  302. value={this.state.orderStatusSearch}
  303. onChange={(e) => { this.setState({ orderStatusSearch: e }) }}>
  304. {
  305. lvl.map(function (item) {
  306. return <Select.Option key={item.value} >{item.key}</Select.Option>
  307. })
  308. }
  309. </Select>
  310. <Button type="primary" onClick={this.search} style={{marginLeft:'10px'}}>搜索</Button>
  311. <Button onClick={this.reset}>重置</Button>
  312. <span style={{marginLeft:'10px',marginRight:'20px'}}>更多搜索<Switch defaultChecked={false} onChange={this.searchSwitch} /></span>
  313. </div>
  314. <div className='clearfix' style={{marginTop:'5px'}}>
  315. <div className="search-more" style={this.state.searchMore ? { display: 'none' } : {}}>
  316. <Select placeholder="订单部门"
  317. style={{ width: 150 ,marginRight:'10px'}}
  318. value={this.state.orderDepartmentSearch}
  319. onChange={(e) => { this.setState({ orderDepartmentSearch: e }) }}>
  320. {
  321. lvl.map(function (item) {
  322. return <Select.Option key={item.value} >{item.key}</Select.Option>
  323. })
  324. }
  325. </Select>
  326. <Input placeholder="订单负责人" style={{width:'150px',marginRight:'10px'}}
  327. value={this.state.orderLeaderSearch}
  328. onChange={(e) => { this.setState({ orderLeaderSearch: e.target.value }); }} />
  329. <Input placeholder="财物负责人" style={{width:'150px'}}
  330. value={this.state.financeLeaderSearch}
  331. onChange={(e) => { this.setState({ financeLeaderSearch: e.target.value }); }} />
  332. </div>
  333. </div>
  334. <div className="patent-table">
  335. <Spin spinning={this.state.loading}>
  336. <Table columns={this.state.columns}
  337. dataSource={this.state.dataSource}
  338. rowSelection={rowSelection}
  339. pagination={this.state.pagination}
  340. onRowClick={this.tableRowClick}
  341. />
  342. </Spin>
  343. </div>
  344. <MySettlementDetaile
  345. userDetaile={this.state.userDetaile}
  346. datauser={this.state.datauser}
  347. showDesc={this.state.showDesc}
  348. closeDesc={this.closeDesc} />
  349. </div >
  350. <Modal maskClosable={false} visible={this.state.signBillVisible}
  351. onOk={this.noProject} onCancel={this.noProject}
  352. width='800px'
  353. title={this.state.KnotState?'项目立项':'项目结项'}
  354. footer=''
  355. className="admin-desc-content">
  356. <Form layout="horizontal" onSubmit={this.projectSubmit} id="demand-form">
  357. <Spin spinning={this.state.loading}>
  358. <div className="clearfix">
  359. <FormItem className="half-item"
  360. {...formItemLayout}
  361. label="项目编号" >
  362. <span></span>
  363. </FormItem>
  364. <FormItem className="half-item"
  365. {...formItemLayout}
  366. label="客户名称" >
  367. <span></span>
  368. </FormItem>
  369. <FormItem className="half-item"
  370. {...formItemLayout}
  371. label={this.state.KnotState?"立项时间":'结项时间'}>
  372. <span></span>
  373. </FormItem>
  374. <div className='clearfix'>
  375. <FormItem
  376. labelCol={{ span: 4 }}
  377. wrapperCol={{ span: 16 }}
  378. label={this.state.KnotState?"立项说明":'结项说明'} >
  379. <Input type="textarea" placeholder="请输入备注" rows={4} value={this.state.introduction}
  380. onChange={(e)=>{this.setState({introduction:e.target.value})}}/>
  381. </FormItem>
  382. </div>
  383. </div>
  384. <FormItem wrapperCol={{ span: 12, offset: 4 }} className="half-middle">
  385. <Button className="submitSave" type="primary" htmlType="submit">{this.state.KnotState?"确定立项":'确定结项'}</Button>
  386. <Button className="submitSave" type="ghost" onClick={this.noProject}>返回</Button>
  387. </FormItem>
  388. </Spin>
  389. </Form >
  390. </Modal>
  391. </div>
  392. );
  393. }
  394. }));
  395. export default ProjectOrder;