sichuan.jsx 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580
  1. import React from 'react';
  2. import {
  3. Icon,
  4. Button,
  5. Input,
  6. Select,
  7. Spin,
  8. Checkbox,
  9. Cascader,
  10. Table,
  11. Form,
  12. Switch,
  13. message,
  14. DatePicker,
  15. Modal,
  16. Row,
  17. Col,
  18. InputNumber,
  19. notification
  20. } from 'antd';
  21. import ajax from 'jquery/src/ajax/xhr.js';
  22. import $ from 'jquery/src/ajax';
  23. //import axios from 'axios';
  24. import 'antd/dist/antd.css';
  25. const FormItem = Form.Item;
  26. import './sichuan.css';
  27. const { TextArea } = Input;
  28. class Achievement extends React.Component {
  29. constructor(props) {
  30. super(props);
  31. this.state = {
  32. loading:false,
  33. publishPages: [],
  34. visible: false,
  35. pagination: {
  36. defaultCurrent: 1,
  37. defaultPageSize: 10,
  38. showQuickJumper: true,
  39. pageSize: 10,
  40. onChange: function(page) {
  41. this.loadData(page);
  42. }.bind(this),
  43. showTotal: function(total) {
  44. return '共' + total + '条数据';
  45. }
  46. },
  47. columns: [
  48. {
  49. title: '成果编号',
  50. dataIndex: 'serialNumber',
  51. key: 'serialNumber'
  52. },
  53. {
  54. title: '成果名称',
  55. dataIndex: 'name',
  56. key: 'name'
  57. },
  58. {
  59. title: '关键字',
  60. dataIndex: 'keyword',
  61. key: 'keyword'
  62. },
  63. {
  64. title: '行业领域',
  65. dataIndex: 'auditStatus',
  66. key: 'auditStatus'
  67. },
  68. {
  69. title: '企业名称',
  70. dataIndex: 'createTime',
  71. key: 'createTime'
  72. },
  73. {
  74. title: '拟对接单位',
  75. dataIndex: 'releaseDate',
  76. key: 'releaseDate'
  77. },
  78. {
  79. title: '成果状态',
  80. dataIndex: 'releaseDate1',
  81. key: 'releaseDate1'
  82. },
  83. {
  84. title: '操作',
  85. dataIndex: 'caozuo',
  86. key: 'caozuo',
  87. render: (text, recard) => {
  88. return (
  89. <div className="btnRight">
  90. <Button
  91. style={{ marginRight: 10 }}
  92. type="primary"
  93. onClick={this.tableRowClick.bind(this)}
  94. >
  95. 修改
  96. </Button>
  97. <Button
  98. type="danger"
  99. onClick={(e) => {
  100. this.delectRow(recard);
  101. }}
  102. >
  103. 删除
  104. </Button>
  105. </div>
  106. );
  107. }
  108. }
  109. ]
  110. };
  111. }
  112. loadData(pageNo) {
  113. this.setState({
  114. page: pageNo,
  115. // loading: true
  116. });
  117. // axios.get('api/list',{
  118. // params:{
  119. // page:pageNo||1,
  120. // pageSize:10
  121. // }
  122. // })
  123. // .then(function(res) {
  124. // let theArr = [];
  125. // if (!data.data || !data.data.list) {
  126. // if (data.error && data.error.length) {
  127. // message.warning(data.error[0].message);
  128. // };
  129. // } else {
  130. // for (let i = 0; i < data.data.list.length; i++) {
  131. // let thisdata = data.data.list[i];
  132. // theArr.push({
  133. // key: i,
  134. // id: thisdata.id,
  135. // serialNumber: thisdata.serialNumber,
  136. // name: thisdata.name,
  137. // category:thisdata.category,
  138. // fieldA:thisdata.thisdata,
  139. // fieldB:thisdata.fieldB,
  140. // });
  141. // };
  142. // }
  143. // this.state.pagination.current = data.data.pageNo;
  144. // this.state.pagination.total = data.data.totalCount;
  145. // if(data.data&&data.data.list&&!data.data.list.length){
  146. // this.state.pagination.current=0
  147. // this.state.pagination.total=0
  148. // }
  149. // this.setState({
  150. // loading:false,
  151. // dataSource: theArr,
  152. // pagination: this.state.pagination
  153. // });
  154. // })
  155. // .catch(function(error) {
  156. // console.log(error);
  157. // });
  158. }
  159. //消息提示
  160. message(mess) {
  161. notification.open({
  162. message: '提示',
  163. description: mess,
  164. placement: 'bottomRight'
  165. });
  166. }
  167. //删除
  168. delectRow(recard) {
  169. this.setState({
  170. loading: true
  171. });
  172. // axios({
  173. // method:'get',
  174. // url:'api/sdas',
  175. // }).then(function(res) {
  176. // this.success('success');
  177. // this.setState({
  178. // loading: false
  179. // });
  180. // })
  181. // .catch(function(error) {
  182. // console.log(error);
  183. // });
  184. }
  185. details(recard){
  186. this.state({
  187. loading:true
  188. })
  189. }
  190. add() {
  191. this.setState({
  192. uid: '',
  193. visible: true,
  194. addState: true,
  195. name: '',
  196. introduce: '',
  197. industry: '',
  198. summary: '',
  199. ownerName: '',
  200. reserveButtMode: '',
  201. patentNumber: '',
  202. transferPrice: '',
  203. telephone: '',
  204. cname: ''
  205. });
  206. }
  207. search() {
  208. this.loadData(1);
  209. }
  210. reset() {
  211. this.state.nameSearch = '';
  212. this.state.keyword = '';
  213. this.loadData(1);
  214. }
  215. tableRowClick(record, index) {
  216. this.state.RowData = record;
  217. this.setState({
  218. visible: true,
  219. addState: false,
  220. uid: record.id
  221. });
  222. this.details(record)
  223. }
  224. handleOk() {
  225. this.handleSubmit();
  226. }
  227. handleCancel() {
  228. this.setState({
  229. visible: false
  230. });
  231. }
  232. handleSubmit() {
  233. if (!this.state.name || !this.state.introduce) {
  234. this.message('请填写带*项');
  235. return false;
  236. }
  237. this.setState({
  238. loading: true
  239. });
  240. let api = this.state.addState ? '/api/achievements' : '/api/update';
  241. // axios
  242. // .post(api, {
  243. // id: this.state.uid,
  244. // achievementDTO: {
  245. // name: this.state.name,
  246. // type: this.state.type,
  247. // industry: this.state.industry,
  248. // summary: this.state.summary,
  249. // introduce: this.state.introduce,
  250. // ownerName: this.state.ownerName,
  251. // reserveButtMode: this.state.reserveButtMode,
  252. // patentNumber: this.state.patentNumber,
  253. // transferPrice: this.state.transferPrice
  254. // },
  255. // publisherDTO: {
  256. // name: this.state.name,
  257. // telephone: this.state.telephone
  258. // }
  259. // })
  260. // .then(function(res) {
  261. // console.log(res);
  262. // this.message('success');
  263. // this.setState({
  264. // loading: false,
  265. // visible: false
  266. // });
  267. // this.loadData(1);
  268. // })
  269. // .catch(function(error) {
  270. // console.log(error);
  271. // });
  272. }
  273. componentWillMount() {
  274. this.loadData(1);
  275. }
  276. render() {
  277. const rowSelection = {
  278. selectedRowKeys: this.state.selectedRowKeys,
  279. onChange: (selectedRowKeys, selectedRows) => {
  280. this.setState({
  281. selectedRows: selectedRows.slice(-1),
  282. selectedRowKeys: selectedRowKeys.slice(-1)
  283. });
  284. }
  285. };
  286. const formItemLayout = {
  287. labelCol: { span: 6 },
  288. wrapperCol: { span: 12 }
  289. };
  290. this.state.dataSource = [ { id: 212, key: 1, name: 'liting' }, { key: 2, name: 'YouXi' } ];
  291. return (
  292. <div className="user-content">
  293. <div className="content-title">
  294. <span className="title">我的科技成果</span>
  295. <div className="patent-addNew">
  296. <Button type="primary" onClick={this.add.bind(this)}>
  297. 发布成果<Icon type="plus" />
  298. </Button>
  299. </div>
  300. </div>
  301. <div className="user-search">
  302. <Input
  303. placeholder="成果名称"
  304. value={this.state.name}
  305. className="searchInp"
  306. onChange={(e) => {
  307. this.setState({ name: e.target.value });
  308. }}
  309. style={{ width: 120 }}
  310. />
  311. <Input
  312. placeholder="关键字"
  313. value={this.state.keyword}
  314. onChange={(e) => {
  315. this.setState({ keyword: e.target.value });
  316. }}
  317. style={{ width: 120 }}
  318. />
  319. <Button type="primary" onClick={this.search.bind(this)} className="interval">
  320. 搜索
  321. </Button>
  322. <Button onClick={this.reset.bind(this)} className="interval">
  323. 重置
  324. </Button>
  325. </div>
  326. <div className="patent-table">
  327. <Spin spinning={this.state.loading}>
  328. <Table
  329. columns={this.state.columns}
  330. dataSource={this.state.dataSource}
  331. rowSelection={rowSelection}
  332. pagination={this.state.pagination}
  333. />
  334. </Spin>
  335. </div>
  336. <Modal
  337. title={this.state.addState ? '新建成果' : '查看成果'}
  338. visible={this.state.visible}
  339. width="900px"
  340. onOk={this.handleOk.bind(this)}
  341. onCancel={this.handleCancel.bind(this)}
  342. okText="保存"
  343. cancelText="取消"
  344. >
  345. <Form layout="horizontal" id="demand-form">
  346. <Spin spinning={this.state.loading}>
  347. <div className="clearfix">
  348. {!this.state.addState ? (
  349. <FormItem className="half-item" {...formItemLayout} label="成果编号">
  350. <span />
  351. </FormItem>
  352. ) : (
  353. ''
  354. )}
  355. <FormItem className="half-item" {...formItemLayout} label="专利编号">
  356. <Input
  357. placeholder="专利编号"
  358. value={this.state.patentNumber}
  359. onChange={(e) => {
  360. this.setState({ patentNumber: e.target.value });
  361. }}
  362. />
  363. </FormItem>
  364. <FormItem
  365. className="half-item"
  366. {...formItemLayout}
  367. label={
  368. <span>
  369. <strong style={{ color: '#f00' }}>*</strong>成果名称
  370. </span>
  371. }
  372. >
  373. <Input
  374. placeholder="成果名称."
  375. value={this.state.name}
  376. onChange={(e) => {
  377. this.setState({ name: e.target.value });
  378. }}
  379. />
  380. </FormItem>
  381. <FormItem className="half-item" {...formItemLayout} label="行业领域">
  382. <Select
  383. defaultValue={this.state.industry}
  384. onChange={(e) => {
  385. this.setState({ industry: e });
  386. }}
  387. placeholder="请选择"
  388. >
  389. <Select.Option value="0">先进制造与自动化</Select.Option>
  390. <Select.Option value="1">电子信息技术</Select.Option>
  391. <Select.Option value="2">新材料技术</Select.Option>
  392. <Select.Option value="3">生物与新药</Select.Option>
  393. <Select.Option value="4">资源与新环境</Select.Option>
  394. <Select.Option value="5">新能源</Select.Option>
  395. </Select>
  396. </FormItem>
  397. <FormItem className="half-item" {...formItemLayout} label="所有权人">
  398. <Input
  399. placeholder="所有权人"
  400. value={this.state.ownerName}
  401. onChange={(e) => {
  402. this.setState({ ownerName: e.target.value });
  403. }}
  404. />
  405. </FormItem>
  406. <FormItem className="half-item" {...formItemLayout} label="项目负责人">
  407. <Input
  408. placeholder="项目负责人"
  409. value={this.state.cname}
  410. onChange={(e) => {
  411. this.setState({ cname: e.target.value });
  412. }}
  413. />
  414. </FormItem>
  415. <FormItem className="half-item" {...formItemLayout} label="联系电话">
  416. <Input
  417. placeholder="联系电话"
  418. value={this.state.telephone}
  419. onChange={(e) => {
  420. this.setState({ telephone: e.target.value });
  421. }}
  422. />
  423. </FormItem>
  424. <div className="clearfix">
  425. <FormItem labelCol={{ span: 3 }} wrapperCol={{ span: 18 }} label="技术简称">
  426. <TextArea
  427. autosize={{ minRows: 4, maxRows: 10 }}
  428. placeholder="输入技术简称"
  429. value={this.state.summary}
  430. onChange={(e) => {
  431. this.setState({ summary: e.target.value });
  432. }}
  433. />
  434. </FormItem>
  435. <FormItem
  436. labelCol={{ span: 3 }}
  437. wrapperCol={{ span: 18 }}
  438. label={
  439. <span>
  440. <strong style={{ color: '#f00' }}>*</strong>技术成果内容
  441. </span>
  442. }
  443. style={{ margin: '10px 0px' }}
  444. >
  445. <TextArea
  446. autosize={{ minRows: 4, maxRows: 10 }}
  447. placeholder="输入技术成果内容"
  448. value={this.state.introduce}
  449. onChange={(e) => {
  450. this.setState({ introduce: e.target.value });
  451. }}
  452. />
  453. </FormItem>
  454. </div>
  455. <Row>
  456. <Col span={8} style={{ fontSize: 18 }}>
  457. 技术成果企业情况
  458. </Col>
  459. </Row>
  460. <div className="clearfix">
  461. <FormItem
  462. className="half-item"
  463. {...formItemLayout}
  464. label={
  465. <span>
  466. <strong style={{ color: '#f00' }}>*</strong>企业名称
  467. </span>
  468. }
  469. >
  470. <Input
  471. placeholder="企业名称."
  472. value={this.state.cname}
  473. onChange={(e) => {
  474. this.setState({ cname: e.target.value });
  475. }}
  476. />
  477. </FormItem>
  478. <FormItem className="half-item" {...formItemLayout} label="科技主管部门">
  479. <Input
  480. placeholder="科技主管部门."
  481. value={this.state.name}
  482. onChange={(e) => {
  483. this.setState({ name: e.target.value });
  484. }}
  485. />
  486. </FormItem>
  487. <FormItem className="half-item" {...formItemLayout} label="单位性质">
  488. <Select
  489. defaultValue={this.state.name}
  490. onChange={(e) => {
  491. this.setState({ name: e });
  492. }}
  493. placeholder="请选择"
  494. >
  495. <Select.Option value="0">国家行政企业</Select.Option>
  496. <Select.Option value="1">公私合作企业</Select.Option>
  497. <Select.Option value="2">中外合资企业</Select.Option>
  498. <Select.Option value="3">社会组织机构</Select.Option>
  499. <Select.Option value="4">国际组织机构</Select.Option>
  500. <Select.Option value="5">外资企业</Select.Option>
  501. <Select.Option value="6">私营企业</Select.Option>
  502. <Select.Option value="7">集体企业</Select.Option>
  503. <Select.Option value="8">国防军事企业</Select.Option>
  504. </Select>
  505. </FormItem>
  506. <FormItem className="half-item" {...formItemLayout} label="企业特征">
  507. <Input
  508. placeholder="企业特征"
  509. value={this.state.name}
  510. onChange={(e) => {
  511. this.setState({ name: e.target.value });
  512. }}
  513. />
  514. </FormItem>
  515. <FormItem className="half-item" {...formItemLayout} label="邮政编码">
  516. <Input
  517. placeholder="邮政编码"
  518. value={this.state.name}
  519. onChange={(e) => {
  520. this.setState({ name: e.target.value });
  521. }}
  522. />
  523. </FormItem>
  524. <div className="clearfix">
  525. <FormItem className="half-item" {...formItemLayout} label="法定代表人">
  526. <Input
  527. placeholder="法定代表人"
  528. value={this.state.name}
  529. onChange={(e) => {
  530. this.setState({ name: e.target.value });
  531. }}
  532. />
  533. </FormItem>
  534. <FormItem className="half-item" {...formItemLayout} label="电话">
  535. <Input
  536. placeholder="电话"
  537. value={this.state.name}
  538. onChange={(e) => {
  539. this.setState({ name: e.target.value });
  540. }}
  541. />
  542. </FormItem>
  543. <FormItem className="half-item" {...formItemLayout} label="企业网址">
  544. <Input
  545. placeholder="企业网址"
  546. value={this.state.name}
  547. onChange={(e) => {
  548. this.setState({ name: e.target.value });
  549. }}
  550. />
  551. </FormItem>
  552. <FormItem className="half-item" {...formItemLayout} label="E-Mail">
  553. <Input
  554. placeholder="E-Mail"
  555. value={this.state.name}
  556. onChange={(e) => {
  557. this.setState({ name: e.target.value });
  558. }}
  559. />
  560. </FormItem>
  561. </div>
  562. <div className="clearfix">
  563. <FormItem labelCol={{ span: 3 }} wrapperCol={{ span: 18 }} label="企业简介">
  564. <TextArea autosize={{ minRows: 4, maxRows: 10 }} placeholder="输入企业简介" />
  565. </FormItem>
  566. </div>
  567. </div>
  568. </div>
  569. </Spin>
  570. </Form>
  571. </Modal>
  572. </div>
  573. );
  574. }
  575. }
  576. export default Achievement;