highTech.jsx 28 KB

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