highTech.jsx 29 KB

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