enterpriseProjectQuery.jsx 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618
  1. import React,{Component} from 'react';
  2. import {Button, DatePicker, Input, message, Select, Spin, Table, Tabs} from "antd";
  3. import {ChooseList} from "../../order/orderNew/chooseList";
  4. import $ from "jquery/src/ajax";
  5. import {
  6. ShowModal,
  7. getProjectName,
  8. download,
  9. } from "@/tools";
  10. import moment from "moment";
  11. import ProjectDetails from "../summary/projectDetails";
  12. const {TabPane} = Tabs;
  13. const { RangePicker } = DatePicker;
  14. const { Option } = Select;
  15. class EnterpriseProjectQuery extends Component{
  16. constructor(props) {
  17. super(props);
  18. this.state={
  19. visible: false,
  20. dataSource: [],
  21. departmentArr: [],
  22. page: 1,
  23. pagination: {
  24. defaultCurrent: 1,
  25. defaultPageSize: 10,
  26. showQuickJumper: true,
  27. pageSize: 10,
  28. onChange: function (page) {
  29. this.loadData(page);
  30. }.bind(this),
  31. showTotal: function (total) {
  32. return "共" + total + "条数据";
  33. },
  34. },
  35. columns: [
  36. {
  37. title: "序号",
  38. dataIndex: "id",
  39. key: "id",
  40. },
  41. {
  42. title: "派单时间",
  43. dataIndex: "taskDistributionTime",
  44. key: "taskDistributionTime",
  45. },
  46. {
  47. title: "派单省份",
  48. dataIndex: "provinceName",
  49. key: "provinceName",
  50. },
  51. {
  52. title: '订单部门',
  53. dataIndex: 'depName',
  54. key: 'depName',
  55. render:(text)=>{
  56. return (text&&text.length>8?text.substr(0,8)+'...':text)
  57. }
  58. },
  59. {
  60. title: "营销员",
  61. dataIndex: "salesmanName",
  62. key: "salesmanName",
  63. },
  64. {
  65. title: "合同编号",
  66. dataIndex: "contractNo",
  67. key: "contractNo",
  68. },
  69. {
  70. title: "订单编号",
  71. dataIndex: "orderNo",
  72. key: "orderNo",
  73. },
  74. {
  75. title: "签单客户",
  76. dataIndex: "userName",
  77. key: "userName",
  78. },
  79. {
  80. title: "项目类型",
  81. dataIndex: "cname",
  82. key: "cname",
  83. },
  84. {
  85. title: "项目名称",
  86. dataIndex: "commodityName",
  87. key: "commodityName",
  88. },
  89. {
  90. title: "数量",
  91. dataIndex: "commodityQuantity",
  92. key: "commodityQuantity",
  93. },
  94. {
  95. title: "负责部门",
  96. dataIndex: "techDepName",
  97. key: "techDepName",
  98. },
  99. {
  100. title: "咨询师/咨询经理",
  101. dataIndex: "techName",
  102. key: "techName",
  103. },
  104. {
  105. title: "项目状态",
  106. dataIndex: "projectStatus",
  107. key: "projectStatus",
  108. render:(value)=>(
  109. getProjectName(parseInt(value))
  110. )
  111. },
  112. {
  113. title: "项目金额",
  114. dataIndex: "commodityPrice",
  115. key: "commodityPrice",
  116. },
  117. {
  118. title: "特别说明",
  119. dataIndex: "specialComment",
  120. key: "specialComment",
  121. },
  122. ],
  123. releaseDate:[],
  124. searchOrderNo: '',
  125. searchContractNo: '',
  126. searchEnterpriseName: '',
  127. declarationBatch: '',
  128. projectSituation: '',
  129. projectAmount: '',
  130. depId:'',
  131. thchDepId:'',
  132. projectType: '',
  133. projectStatus: '',
  134. contactsOption: [],
  135. contactsOptionData: [],
  136. }
  137. this.changeList = this.changeList.bind(this);
  138. this.resetAll = this.resetAll.bind(this);
  139. this.exportPending = this.exportPending.bind(this);
  140. }
  141. changeList(arr) {
  142. const newArr = [];
  143. this.state.columns.forEach(item => {
  144. arr.forEach(val => {
  145. if (val === item.title) {
  146. newArr.push(item);
  147. }
  148. });
  149. });
  150. this.setState({
  151. changeList: newArr
  152. });
  153. }
  154. loadData(pageNo) {
  155. this.setState({
  156. loading: true,
  157. });
  158. $.ajax({
  159. method: "get",
  160. dataType: "json",
  161. crossDomain: false,
  162. url: globalConfig.context + "/api/admin/orderProject/managerSelect",
  163. data: {
  164. pageNo: pageNo || 1,
  165. pageSize: this.state.pagination.pageSize || 10,
  166. startTime: this.state.releaseDate.length > 0 ? this.state.releaseDate[0]: undefined, //开始时间
  167. endTime: this.state.releaseDate.length > 0 ? this.state.releaseDate[1]: undefined, //结束时间
  168. depId: this.state.depId || undefined,//部门ID
  169. techDepId: this.state.thchDepId || undefined,//责任部门ID
  170. cid: this.state.projectStatus || undefined,//项目类别
  171. projectType: typeof this.state.projectType === 'number' ? this.state.projectType : undefined,//项目分类
  172. orderNo: this.state.searchOrderNo || undefined,//订单编号
  173. contractNo: this.state.searchContractNo || undefined,//合同编号
  174. name: this.state.searchEnterpriseName || undefined,//企业名称
  175. declarationBatch: this.state.declarationBatch || undefined,//申报批次
  176. // projectSituation: typeof this.state.projectSituation === 'number' ? this.state.projectSituation : undefined,//项目分类
  177. commodityPrice: this.state.projectAmount || undefined,//项目金额
  178. },
  179. success: function (data) {
  180. ShowModal(this);
  181. let theArr = [];
  182. if (!data.data || !data.data.list) {
  183. if (data.error && data.error.length) {
  184. message.warning(data.error[0].message);
  185. }
  186. } else {
  187. for (let i = 0; i < data.data.list.length; i++) {
  188. let thisdata = data.data.list[i];
  189. theArr.push(thisdata);
  190. }
  191. this.state.pagination.current = data.data.pageNo;
  192. this.state.pagination.total = data.data.totalCount;
  193. if (data.data && data.data.list && !data.data.list.length) {
  194. this.state.pagination.current = 0;
  195. this.state.pagination.total = 0;
  196. }
  197. this.setState({
  198. dataSource: theArr,
  199. page: data.data.pageNo,
  200. pagination: this.state.pagination,
  201. });
  202. }
  203. }.bind(this),
  204. }).always(
  205. function () {
  206. this.setState({
  207. loading: false,
  208. });
  209. }.bind(this)
  210. );
  211. }
  212. //部门
  213. departmentList() {
  214. this.setState({
  215. departmentListloading: true,
  216. });
  217. $.ajax({
  218. method: "get",
  219. dataType: "json",
  220. crossDomain: false,
  221. url: globalConfig.context + "/api/admin/organization/selectSuperId",
  222. data: {},
  223. success: function (data) {
  224. let thedata = data.data;
  225. let theArr = [];
  226. if (!thedata) {
  227. if (data.error && data.error.length) {
  228. message.warning(data.error[0].message);
  229. }
  230. thedata = {};
  231. } else {
  232. thedata.map(function (item, index) {
  233. theArr.push({
  234. key: index,
  235. name: item.name,
  236. id: item.id,
  237. });
  238. });
  239. }
  240. this.setState({
  241. departmentArr: theArr,
  242. });
  243. }.bind(this),
  244. }).always(
  245. function () {
  246. this.setState({
  247. departmentListloading: false,
  248. });
  249. }.bind(this)
  250. );
  251. }
  252. resetAll() {
  253. this.setState({
  254. releaseDate: [],
  255. searchOrderNo: '',
  256. searchContractNo: '',
  257. searchEnterpriseName: '',
  258. declarationBatch: '',
  259. projectSituation: '',
  260. projectAmount: '',
  261. projectType: '',
  262. depId:'',
  263. thchDepId:'',
  264. projectStatus:'',
  265. },()=>{
  266. this.loadData();
  267. })
  268. }
  269. //项目类别
  270. selectSuperId() {
  271. $.ajax({
  272. method: "get",
  273. dataType: "json",
  274. crossDomain: false,
  275. url: globalConfig.context + "/api/admin/ProjectSize/getAllCname",
  276. data: {
  277. flag: 0
  278. },
  279. success: function(data) {
  280. let theArr = [];
  281. let thedata = data.data;
  282. if (!thedata) {
  283. if (data.error && data.error.length) {
  284. message.warning(data.error[0].message);
  285. }
  286. }
  287. for (let i = 0; i < data.data.length; i++) {
  288. let theData = data.data[i];
  289. theArr.push(
  290. <Select.Option value={theData.id} key={theData.cname}>
  291. {theData.cname}
  292. </Select.Option>
  293. );
  294. }
  295. this.setState({
  296. contactsOption: theArr,
  297. contactsOptionData: data.data,
  298. });
  299. }.bind(this)
  300. }).always(
  301. );
  302. }
  303. exportPending() {
  304. $.ajax({
  305. method: "get",
  306. dataType: "json",
  307. crossDomain: false,
  308. url: globalConfig.context + "/api/admin/orderProject/exportManagerSelect",
  309. data: {
  310. pageNo: 1,
  311. pageSize: 99999,
  312. startTime: this.state.releaseDate.length > 0 ? this.state.releaseDate[0]: undefined, //开始时间
  313. endTime: this.state.releaseDate.length > 0 ? this.state.releaseDate[1]: undefined, //结束时间
  314. depId: this.state.depId || undefined,//部门ID
  315. techDepId: this.state.thchDepId || undefined,//责任部门ID
  316. cid: this.state.projectStatus || undefined,//项目类别
  317. projectType: typeof this.state.projectType === 'number' ? this.state.projectType : undefined,//项目分类
  318. orderNo: this.state.searchOrderNo || undefined,//订单编号
  319. contractNo: this.state.searchContractNo || undefined,//合同编号
  320. name: this.state.searchEnterpriseName || undefined,//企业名称
  321. declarationBatch: this.state.declarationBatch || undefined,//申报批次
  322. commodityPrice: this.state.projectAmount || undefined,//项目金额
  323. },
  324. success: function (data) {
  325. ShowModal(this);
  326. if (data.error && data.error.length) {
  327. message.warning(data.error[0].message);
  328. } else {
  329. download(data.data,true);
  330. }
  331. }.bind(this),
  332. }).always(
  333. function () {
  334. this.setState({
  335. loading: false,
  336. });
  337. }.bind(this)
  338. );
  339. }
  340. componentDidMount() {
  341. this.departmentList();
  342. this.selectSuperId();
  343. this.loadData();
  344. }
  345. render() {
  346. return (
  347. <div className="user-content">
  348. <div className="content-title">
  349. <span>企业项目派单查询</span>
  350. </div>
  351. <Tabs defaultActiveKey="1" onChange={this.callback} className="test">
  352. <TabPane tab="搜索" key="1">
  353. <div className="user-search" style={{
  354. marginTop:'10px',
  355. marginLeft:'10px',
  356. marginRight:'10px'
  357. }}>
  358. <Input
  359. placeholder="订单编号"
  360. style={{ width: 100,marginRight:'10px',marginBottom:'10px' }}
  361. value={this.state.searchOrderNo}
  362. onChange={e => {
  363. this.setState({ searchOrderNo: e.target.value });
  364. }}
  365. />
  366. <Input
  367. placeholder="合同编号"
  368. style={{ width: 100,marginRight:'10px',marginBottom:'10px' }}
  369. value={this.state.searchContractNo}
  370. onChange={e => {
  371. this.setState({ searchContractNo: e.target.value });
  372. }}
  373. />
  374. <Input
  375. placeholder="企业名称"
  376. style={{ width: 100,marginRight:'10px',marginBottom:'10px' }}
  377. value={this.state.searchEnterpriseName}
  378. onChange={e => {
  379. this.setState({ searchEnterpriseName: e.target.value });
  380. }}
  381. />
  382. <span style={{display:"inline-block"}}>
  383. <span style={{marginRight:'10px',marginBottom:'10px'}}>项目类别 :</span>
  384. <Select
  385. value={this.state.projectStatus || undefined}
  386. placeholder="请选择项目类别"
  387. notFoundContent="未获取到上级品类列表"
  388. style={{ width: 100,marginRight:'10px',marginBottom:'10px' }}
  389. onChange={(e) => {
  390. let infor = this.state.contactsOptionData.filter((v)=>v.id === e);
  391. this.setState({
  392. projectStatus: e,
  393. })
  394. }}
  395. >
  396. {this.state.contactsOption}
  397. </Select>
  398. </span>
  399. <span style={{display:"inline-block"}}>
  400. <span style={{marginRight:'10px',marginBottom:'10px'}}>项目分类 :</span>
  401. <Select
  402. value={typeof this.state.projectType === 'number' ? this.state.projectType : undefined}
  403. placeholder="请选择项目分类"
  404. style={{ width: 100,marginRight:'10px',marginBottom:'10px' }}
  405. onChange={(e) => {
  406. this.setState({
  407. projectType: e,
  408. })
  409. }}
  410. >
  411. {/*0通用 1专利 2软著 3审计 4双软 5高新*/}
  412. <Option value={0}>通用</Option>
  413. <Option value={1}>专利</Option>
  414. <Option value={2}>软著</Option>
  415. <Option value={3}>审计</Option>
  416. <Option value={4}>双软</Option>
  417. <Option value={5}>高新</Option>
  418. <Option value={6}>商标</Option>
  419. </Select>
  420. </span>
  421. <span style={{display: "inline-block",marginRight:'10px',marginBottom:'10px'}}>
  422. <Spin spinning={this.state.departmentListloading}>
  423. <span>订单部门:</span>
  424. <Select
  425. placeholder="请选择部门"
  426. style={{ width: 200,marginRight:'10px',marginLeft:'10px',marginBottom:'10px' }}
  427. value={this.state.depId || undefined}
  428. onChange={e => {
  429. this.setState({ depId: e });
  430. }}
  431. >
  432. {
  433. this.state.departmentArr.map(function (item) {
  434. return <Select.Option key={item.id} value={item.id}>{item.name}</Select.Option>
  435. })
  436. }
  437. </Select>
  438. </Spin>
  439. </span>
  440. <span style={{display: "inline-block",marginRight:'10px',marginBottom:'10px'}}>
  441. <span>负责部门:</span>
  442. <Select
  443. placeholder="请选择部门"
  444. style={{ width: 200,marginRight:'10px',marginLeft:'10px',marginBottom:'10px' }}
  445. value={this.state.thchDepId || undefined}
  446. onChange={e => {
  447. this.setState({ thchDepId: e });
  448. }}
  449. >
  450. {
  451. this.state.departmentArr.map(function (item) {
  452. return <Select.Option key={item.id} value={item.id}>{item.name}</Select.Option>
  453. })
  454. }
  455. </Select>
  456. </span>
  457. <span style={{display:"inline-block"}}>
  458. <span style={{marginRight:'10px',marginBottom:'10px'}}>申报批次 :</span>
  459. <Select
  460. value={this.state.declarationBatch || undefined}
  461. placeholder="请选择批次"
  462. style={{ width: 100,marginRight:'10px',marginBottom:'10px' }}
  463. onChange={(e) => {
  464. this.setState({
  465. declarationBatch: e,
  466. });
  467. }}
  468. >
  469. <Option value={1}>第一批</Option>
  470. <Option value={2}>第二批</Option>
  471. <Option value={3}>第三批</Option>
  472. <Option value={4}>第四批</Option>
  473. </Select>
  474. </span>
  475. <span style={{display:"inline-block"}}>
  476. <span style={{marginRight:'10px',marginBottom:'10px'}}>项目金额 :</span>
  477. <Select
  478. value={this.state.projectAmount || undefined}
  479. placeholder="请选择项目金额"
  480. style={{ width: 100,marginRight:'10px',marginBottom:'10px' }}
  481. onChange={(e) => {
  482. this.setState({
  483. projectAmount: e,
  484. });
  485. }}
  486. >
  487. <Option value={1}>0~0.5万</Option>
  488. <Option value={2}>0.5~1万</Option>
  489. <Option value={3}>1~2万</Option>
  490. <Option value={4}>2~5万</Option>
  491. <Option value={5}>5~10万</Option>
  492. <Option value={6}>10~30万</Option>
  493. <Option value={7}>30~50万</Option>
  494. <Option value={8}>50~80万</Option>
  495. <Option value={9}>80万上</Option>
  496. </Select>
  497. </span>
  498. {/*<span style={{display:"inline-block"}}>*/}
  499. {/* <span style={{marginRight:'10px',marginBottom:'10px'}}>项目情况 :</span>*/}
  500. {/* <Select*/}
  501. {/* value={typeof this.state.projectSituation === 'number' ? this.state.projectSituation : undefined}*/}
  502. {/* placeholder="请选择项目情况"*/}
  503. {/* style={{ width: 200,marginRight:'10px',marginBottom:'10px' }}*/}
  504. {/* onChange={(e) => {*/}
  505. {/* this.setState({*/}
  506. {/* projectSituation: e,*/}
  507. {/* });*/}
  508. {/* }}*/}
  509. {/* >*/}
  510. {/* <Option value={0}>未开始</Option>*/}
  511. {/* <Option value={1}>进行中</Option>*/}
  512. {/* <Option value={2}>已暂停</Option>*/}
  513. {/* <Option value={3}>已驳回(专利、软著项目编写)</Option>*/}
  514. {/* <Option value={4}>已完成</Option>*/}
  515. {/* <Option value={5}>项目已完成 已退单</Option>*/}
  516. {/* <Option value={6}>项目未完成 已退单</Option>*/}
  517. {/* </Select>*/}
  518. {/*</span>*/}
  519. <span style={{display:"inline-block"}}>
  520. <span style={{marginRight:'10px',marginBottom:'10px'}}>派单时间 :</span>
  521. <RangePicker
  522. style={{marginRight:'10px',marginBottom:'10px'}}
  523. value={[
  524. this.state.releaseDate[0]
  525. ? moment(this.state.releaseDate[0])
  526. : null,
  527. this.state.releaseDate[1]
  528. ? moment(this.state.releaseDate[1])
  529. : null,
  530. ]}
  531. onChange={(data, dataString) => {
  532. this.setState({ releaseDate: dataString });
  533. }}
  534. />
  535. </span>
  536. <Button type="primary" onClick={()=>{this.loadData();}} style={{marginRight:'10px',marginBottom:'10px'}}>搜索</Button>
  537. <Button onClick={this.resetAll} style={{marginRight:'10px',marginBottom:'10px'}}>重置</Button>
  538. </div>
  539. </TabPane>
  540. <TabPane tab="更改表格显示数据" key="2">
  541. <div style={{ marginLeft: 10 }}>
  542. <ChooseList
  543. columns={this.state.columns}
  544. changeFn={this.changeList}
  545. changeList={this.state.changeList}
  546. top={55}
  547. margin={11}
  548. />
  549. </div>
  550. </TabPane>
  551. <TabPane tab="导出EXCEL" key="3">
  552. <Button type="primary" style={{margin: '10px'}} onClick={this.exportPending}>导出</Button>
  553. </TabPane>
  554. </Tabs>
  555. <div className="patent-table">
  556. <Spin spinning={this.state.loading}>
  557. <Table
  558. scroll={{ x: 1200, y: 0 }}
  559. columns={
  560. this.state.changeList
  561. ? this.state.changeList
  562. : this.state.columns
  563. }
  564. dataSource={this.state.dataSource}
  565. pagination={this.state.pagination}
  566. style={{
  567. cursor: 'pointer',
  568. }}
  569. onRowClick={(record)=>{
  570. this.setState({
  571. projectdetailsId: record.id,
  572. projectdetailsOrderNo: record.orderNo,
  573. commodityName: record.commodityName,
  574. visible: true,
  575. })
  576. }}
  577. bordered
  578. size="middle"
  579. />
  580. </Spin>
  581. </div>
  582. {this.state.visible ? <ProjectDetails
  583. visible={this.state.visible}
  584. id={this.state.projectdetailsId}
  585. orderNo={this.state.projectdetailsOrderNo}
  586. taskName={this.state.commodityName}
  587. visitOk={()=>{
  588. this.setState({
  589. visible: false,
  590. });
  591. }}
  592. visitCancel={()=>{
  593. this.setState({
  594. visible: false,
  595. });
  596. }}
  597. /> : null}
  598. </div>
  599. )
  600. }
  601. }
  602. export default EnterpriseProjectQuery;