highTech.jsx 24 KB

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