projectOrder.jsx 15 KB

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