projecCount.jsx 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357
  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. invention,
  12. utilityModel,
  13. softWriting,
  14. otherTrademarks,
  15. } from './projecCountConfig';
  16. import {cityArr} from '@/dataDic.js';
  17. const {TabPane} = Tabs;
  18. const { RangePicker } = DatePicker;
  19. const { Option } = Select;
  20. class ProjecCount extends Component{
  21. constructor(props) {
  22. super(props);
  23. this.state={
  24. loading:false,
  25. changeList:[],
  26. columns: highTechColumns,
  27. pagination: {
  28. defaultCurrent: 1,
  29. defaultPageSize: 10,
  30. showQuickJumper: true,
  31. pageSize: 10,
  32. onChange: function(page) {
  33. this.loadData(page);
  34. }.bind(this),
  35. showTotal: function(total) {
  36. return "共" + total + "条数据";
  37. }
  38. },
  39. dataSource: [],
  40. releaseDate:[],
  41. searchOrderNo: '',
  42. searchContractNo: '',
  43. searchEnterpriseName: '',
  44. declarationBatch: '',
  45. projectType: 0,
  46. province: '',
  47. depId: '',
  48. departmentArr:[],
  49. }
  50. this.loadData = this.loadData.bind(this);
  51. this.resetAll = this.resetAll.bind(this);
  52. this.changeList = this.changeList.bind(this);
  53. this.departmentList = this.departmentList.bind(this);
  54. this.exportPending = this.exportPending.bind(this);
  55. }
  56. changeList(arr) {
  57. const newArr = [];
  58. this.state.columns.forEach(item => {
  59. arr.forEach(val => {
  60. if (val === item.title) {
  61. newArr.push(item);
  62. }
  63. });
  64. });
  65. this.setState({
  66. changeList: newArr
  67. });
  68. }
  69. loadData(pageNo) {
  70. this.state.data = [];
  71. this.setState({
  72. page: pageNo,
  73. loading: true
  74. });
  75. $.ajax({
  76. method: "get",
  77. dataType: "json",
  78. crossDomain: false,
  79. url: globalConfig.context + "/api/admin/newOrder/orderNewList",
  80. data: {
  81. pageNo: pageNo || 1,
  82. pageSize: this.state.pagination.pageSize,
  83. starTime: this.state.releaseDate[0], //开始时间
  84. endTime: this.state.releaseDate[1], //结束时间
  85. },
  86. success: function(data) {
  87. ShowModal(this);
  88. let theArr = [];
  89. if (!data.data || !data.data.list) {
  90. if (data.error && data.error.length) {
  91. message.warning(data.error[0].message);
  92. }
  93. } else {
  94. for (let i = 0; i < data.data.list.length; i++) {
  95. let thisdata = data.data.list[i];
  96. thisdata.key=i;
  97. theArr.push(thisdata);
  98. }
  99. }
  100. this.state.pagination.current = data.data.pageNo;
  101. this.state.pagination.total = data.data.totalCount;
  102. if (data.data && data.data.list && !data.data.list.length) {
  103. this.state.pagination.current = 0;
  104. this.state.pagination.total = 0;
  105. }
  106. this.setState({
  107. dataSource: theArr,
  108. pagination: this.state.pagination
  109. });
  110. }.bind(this)
  111. }).always(
  112. function() {
  113. this.setState({
  114. loading: false
  115. });
  116. }.bind(this)
  117. );
  118. }
  119. //部门
  120. departmentList() {
  121. $.ajax({
  122. method: "get",
  123. dataType: "json",
  124. crossDomain: false,
  125. url: globalConfig.context + "/api/admin/organization/selectSuperId",
  126. data: {},
  127. success: function (data) {
  128. let thedata = data.data;
  129. let theArr = [];
  130. if (!thedata) {
  131. if (data.error && data.error.length) {
  132. message.warning(data.error[0].message);
  133. }
  134. } else {
  135. thedata.map(function (item, index) {
  136. theArr.push({
  137. key: index,
  138. name: item.name,
  139. id: item.id,
  140. });
  141. });
  142. }
  143. this.setState({
  144. departmentArr: theArr,
  145. });
  146. }.bind(this),
  147. })
  148. }
  149. resetAll() {
  150. this.setState({
  151. releaseDate: [],
  152. searchOrderNo: '',
  153. searchContractNo: '',
  154. searchEnterpriseName: '',
  155. declarationBatch: '',
  156. province: '',
  157. depId: '',
  158. },()=>{
  159. this.loadData();
  160. })
  161. }
  162. exportPending() {
  163. window.open(globalConfig.context + "/api/admin/patent/exportPending")
  164. }
  165. componentWillMount() {
  166. this.loadData();
  167. this.departmentList();
  168. }
  169. render() {
  170. return (
  171. <div className="user-content">
  172. <div className="content-title">
  173. <span>项目统计</span>
  174. </div>
  175. <Tabs defaultActiveKey="1" className="test">
  176. <TabPane tab="搜索" key="1">
  177. <div className="user-search" style={{
  178. marginTop:'10px',
  179. marginLeft:'10px',
  180. marginRight:'10px'
  181. }}>
  182. <Input
  183. placeholder="订单编号"
  184. style={{ width: "150px",marginRight:'10px',marginBottom:'10px' }}
  185. value={this.state.searchOrderNo}
  186. onChange={e => {
  187. this.setState({ searchOrderNo: e.target.value });
  188. }}
  189. />
  190. <Input
  191. placeholder="合同编号"
  192. style={{ width: "150px",marginRight:'10px',marginBottom:'10px' }}
  193. value={this.state.searchContractNo}
  194. onChange={e => {
  195. this.setState({ searchContractNo: e.target.value });
  196. }}
  197. />
  198. <Input
  199. placeholder="企业名称"
  200. style={{ width: "150px",marginRight:'10px',marginBottom:'10px' }}
  201. value={this.state.searchEnterpriseName}
  202. onChange={e => {
  203. this.setState({ searchEnterpriseName: e.target.value });
  204. }}
  205. />
  206. <span style={{display:"inline-block"}}>
  207. <span style={{marginRight:'10px',marginBottom:'10px'}}>时报批次 :</span>
  208. <Select
  209. value={this.state.declarationBatch}
  210. placeholder="请选择批次"
  211. style={{ width: 200,marginRight:'10px',marginBottom:'10px' }}
  212. onChange={(e) => {
  213. this.setState({
  214. declarationBatch: e,
  215. });
  216. }}
  217. >
  218. <Option value={1}>第一批</Option>
  219. <Option value={2}>第二批</Option>
  220. <Option value={3}>第三批</Option>
  221. <Option value={4}>第四批</Option>
  222. </Select>
  223. </span>
  224. <span style={{display: "inline-block",marginRight:'10px',marginBottom:'10px'}}>
  225. <span>派单省份:</span>
  226. <Select
  227. placeholder="请选择省份"
  228. style={{ width: 200,marginRight:'10px',marginLeft:'10px',marginBottom:'10px' }}
  229. value={this.state.province}
  230. onChange={e => {
  231. this.setState({ province: e });
  232. }}
  233. >
  234. {cityArr.map(function(item) {
  235. return (
  236. <Select.Option key={item.value}>{item.key}</Select.Option>
  237. );
  238. })}
  239. </Select>
  240. </span>
  241. <span style={{display: "inline-block",marginRight:'10px',marginBottom:'10px'}}>
  242. <span>负责部门:</span>
  243. <Select
  244. placeholder="请选择部门"
  245. style={{ width: 200,marginRight:'10px',marginLeft:'10px',marginBottom:'10px' }}
  246. value={this.state.depId}
  247. onChange={e => {
  248. this.setState({ depId: e });
  249. }}
  250. >
  251. {
  252. this.state.departmentArr.map(function (item) {
  253. return <Select.Option key={item.id} value={item.id}>{item.name}</Select.Option>
  254. })
  255. }
  256. </Select>
  257. </span>
  258. <span style={{display:"inline-block"}}>
  259. <span style={{marginRight:'10px',marginBottom:'10px'}}>项目类别 :</span>
  260. <Select
  261. value={this.state.projectType}
  262. placeholder="请选择项目类别"
  263. style={{ width: 200,marginRight:'10px',marginBottom:'10px' }}
  264. onChange={(e) => {
  265. this.setState({
  266. columns:
  267. e === 0 ? highTechColumns :
  268. e === 1 ? invention :
  269. e === 2 ? utilityModel :
  270. e === 3 ? softWriting:
  271. e === 4 ? otherTrademarks : [],
  272. changeList: [],
  273. },()=>{
  274. this.resetAll();
  275. })
  276. this.setState({
  277. projectType: e,
  278. });
  279. }}
  280. >
  281. <Option value={0}>高新</Option>
  282. <Option value={1}>发明专利</Option>
  283. <Option value={2}>实用新型</Option>
  284. <Option value={3}>软件著作权</Option>
  285. <Option value={4}>其他商标</Option>
  286. </Select>
  287. </span>
  288. <span style={{display:"inline-block"}}>
  289. <span style={{marginRight:'10px',marginBottom:'10px'}}>派单时间 :</span>
  290. <RangePicker
  291. style={{marginRight:'10px',marginBottom:'10px'}}
  292. value={[
  293. this.state.releaseDate[0]
  294. ? moment(this.state.releaseDate[0])
  295. : null,
  296. this.state.releaseDate[1]
  297. ? moment(this.state.releaseDate[1])
  298. : null,
  299. ]}
  300. onChange={(data, dataString) => {
  301. this.setState({ releaseDate: dataString });
  302. }}
  303. />
  304. </span>
  305. <Button type="primary" onClick={this.loadData} style={{marginRight:'10px',marginBottom:'10px'}}>搜索</Button>
  306. <Button onClick={this.resetAll} style={{marginRight:'10px',marginBottom:'10px'}}>重置</Button>
  307. </div>
  308. </TabPane>
  309. <TabPane tab="更改表格显示数据" key="2">
  310. <div style={{ marginLeft: 10 }}>
  311. <ChooseList
  312. columns={this.state.columns}
  313. changeFn={this.changeList}
  314. changeList={this.state.changeList}
  315. top={55}
  316. margin={11}
  317. />
  318. </div>
  319. </TabPane>
  320. <TabPane tab="导出EXCEL" key="3">
  321. <Button type="primary" style={{margin: '10px'}} onClick={this.exportPending}>导出</Button>
  322. </TabPane>
  323. </Tabs>
  324. <div className="patent-table">
  325. <Spin spinning={this.state.loading}>
  326. <Table
  327. bordered
  328. size="middle"
  329. scroll={{ x: 2000, y: 0 }}
  330. columns={
  331. this.state.changeList.length > 0
  332. ? this.state.changeList
  333. : this.state.columns
  334. }
  335. dataSource={this.state.dataSource}
  336. pagination={this.state.pagination}
  337. />
  338. </Spin>
  339. </div>
  340. </div>
  341. )
  342. }
  343. }
  344. export default ProjecCount;