sichuan.jsx 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688
  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. } from 'antd';
  20. import { citySelect, provinceList ,areaSelect} from '@/NewDicProvinceList';
  21. import {demandProfile} from '../../../dataDic.js';
  22. import ajax from 'jquery/src/ajax/xhr.js';
  23. import $ from 'jquery/src/ajax';
  24. //import axios from 'axios';
  25. import 'antd/dist/antd.css';
  26. const FormItem = Form.Item;
  27. import './sichuan.css';
  28. const { TextArea } = Input;
  29. const CheckboxGroup = Checkbox.Group;
  30. class Achievement extends React.Component {
  31. loadData(pageNo) {
  32. this.setState({
  33. page: pageNo,
  34. loading: true
  35. });
  36. $.ajax({
  37. method: "get",
  38. dataType: "json",
  39. crossDomain: false,
  40. url: globalConfig.context + "/open/api/demandList",
  41. data: {
  42. pageNo: pageNo || 1,
  43. pageSize: this.state.pagination.pageSize,
  44. type:0,
  45. orgName:this.state.seachName,//企业名称
  46. name:this.state.seachNames,//需求名称
  47. reserveButtUnit:this.state.seachReserveButtUnit,//对接单位
  48. },
  49. success: function (data) {
  50. let theArr = [];
  51. if (!data.data || !data.data.list) {
  52. if (data.error && data.error.length) {
  53. message.warning(data.error[0].message);
  54. };
  55. } else {
  56. for (let i = 0; i < data.data.list.length; i++) {
  57. let thisdata = data.data.list[i];
  58. theArr.push({
  59. key: i,
  60. id: thisdata.id,//需求编号
  61. name: thisdata.name,//需求名称
  62. industry: thisdata.industry,//行业
  63. reserveButtUnit:thisdata.reserveButtUnit,//对接单位
  64. orgName:thisdata.orgName,//企业名称
  65. });
  66. };
  67. this.state.pagination.current = data.data.pageNo;
  68. this.state.pagination.total = data.data.totalCount;
  69. };
  70. this.setState({
  71. dataSource: theArr,
  72. pagination: this.state.pagination
  73. });
  74. }.bind(this),
  75. }).always(function () {
  76. this.setState({
  77. loading: false
  78. });
  79. }.bind(this));
  80. }
  81. constructor(props) {
  82. super(props);
  83. this.state = {
  84. loading:false,
  85. publishPages: [],
  86. nature:'',
  87. visible: false,
  88. pagination: {
  89. defaultCurrent: 1,
  90. defaultPageSize: 10,
  91. showQuickJumper: true,
  92. pageSize: 10,
  93. onChange: function(page) {
  94. this.loadData(page);
  95. }.bind(this),
  96. showTotal: function(total) {
  97. return '共' + total + '条数据';
  98. }
  99. },
  100. columns: [
  101. {
  102. title: '需求名称',
  103. dataIndex: 'name',
  104. key: 'name'
  105. },
  106. {
  107. title: '行业领域',
  108. dataIndex: 'industry',
  109. key: 'industry'
  110. },
  111. {
  112. title: '企业名称',
  113. dataIndex: 'orgName',
  114. key: 'orgName'
  115. },
  116. {
  117. title: '拟对接单位',
  118. dataIndex: 'reserveButtUnit',
  119. key: 'reserveButtUnit'
  120. },
  121. {
  122. title: '操作',
  123. dataIndex: 'caozuo',
  124. key: 'caozuo',
  125. render: (text, recard) => {
  126. return (
  127. <div className="btnRight">
  128. <Button
  129. type="danger"
  130. onClick={(e) => {
  131. e.stopPropagation();
  132. this.delectRow(recard);
  133. }}
  134. >
  135. 删除
  136. </Button>
  137. </div>
  138. );
  139. }
  140. }
  141. ]
  142. };
  143. }
  144. //删除
  145. delectRow(recard) {
  146. $.ajax({
  147. method: "get",
  148. dataType: "json",
  149. crossDomain: false,
  150. url: globalConfig.context + "/open/api/delectDemand",
  151. data: {
  152. id:recard.id
  153. },
  154. success: function (data) {
  155. if (!data.error.length) {
  156. message.success('删除成功!');
  157. this.setState({
  158. loading: false,
  159. });
  160. this.loadData();
  161. } else {
  162. message.warning(data.error[0].message);
  163. };
  164. }.bind(this),
  165. }).always(function () {
  166. this.setState({
  167. loading: false
  168. });
  169. }.bind(this));
  170. }
  171. details(recard){
  172. this.state({
  173. loading:true
  174. })
  175. }
  176. add() {
  177. this.setState({
  178. id:"",
  179. uid: '',
  180. visible: true,
  181. addState: true,
  182. name: '',
  183. introduce: '',
  184. industry: '',
  185. summary: [],
  186. ownerName: '',
  187. reserveButtMode: '',
  188. patentNumber: '',
  189. transferPrice: '',
  190. telephone: '',
  191. cname: ''
  192. });
  193. }
  194. search() {
  195. this.loadData(1);
  196. }
  197. reset() {
  198. this.state.seachName = '';
  199. this.state.seachNames = '';
  200. this.state.seachReserveButtUnit = '';
  201. this.loadData(1);
  202. }
  203. tableRowClick(record, index) {
  204. this.setState({
  205. visible: true,
  206. addState: false,
  207. id:record.id,
  208. });
  209. $.ajax({
  210. method: "get",
  211. dataType: "json",
  212. crossDomain: false,
  213. url: globalConfig.context + "/open/api/demandDetails",
  214. data: {
  215. id: record.id,//需求名称
  216. }
  217. }).done(function (data) {
  218. if (!data.error.length) {
  219. let thisData=data.data;
  220. let ProvinceCityArr = [];
  221. let ProvinceS =thisData.province? parseInt(thisData.province):""; //省
  222. let citys = thisData.city?parseInt(thisData.city):"";//市
  223. ProvinceCityArr.push(ProvinceS, citys);
  224. this.setState({
  225. id:thisData.id,
  226. name: thisData.name,//需求名称
  227. industry:(thisData.industry||thisData.industry==0)?thisData.industry.toString():undefined,//行业
  228. investmentCost: thisData.investmentCost,//经费投入
  229. reserveButtUnit: thisData.reserveButtUnit,//拟对接单位
  230. reserveButtMode: (thisData.reserveButtMode||thisData.reserveButtMode==0)?thisData.reserveButtMode.toString():undefined,//拟对接方式
  231. reserveSolveMode:(thisData.reserveSolveMode||thisData.reserveSolveMode==0)?thisData.reserveSolveMode.toString():undefined ,//拟解决方式
  232. publisherName: thisData.publisherName,//联系人
  233. telephone: thisData.telephone,//联系方式
  234. summary: thisData.summary?thisData.summary.split(","):[],//需求项目概况this.state.shehui?this.state.shehui.join(","):undefined
  235. introduce: thisData.introduce,//需求内容
  236. Pname: thisData.pname,//企业名称
  237. nature: thisData.nature,//企业特质
  238. feature: thisData.feature,//企业特征
  239. ProvinceCity:ProvinceCityArr[0]!=null?ProvinceCityArr:undefined,//地区
  240. zipCode: thisData.zipCode,//邮政编码
  241. legalPerson: thisData.legalPerson,//法人名称
  242. website: thisData.website,//企业网址
  243. email: thisData.email,//企业邮箱
  244. pintroduce:thisData.pintroduce,//企业简介
  245. });
  246. } else {
  247. message.warning(data.error[0].message);
  248. };
  249. this.setState({
  250. loading: false,
  251. });
  252. }.bind(this));
  253. }
  254. handleOk() {
  255. this.handleSubmit();
  256. }
  257. handleCancel() {
  258. this.resets();
  259. this.setState({
  260. visible: false
  261. });
  262. }
  263. handleSubmit() {
  264. this.setState({
  265. loading: true
  266. });
  267. if(!this.state.name){
  268. message.warning("需求名称必须填写");
  269. this.setState({
  270. loading: false
  271. });
  272. return;
  273. }
  274. if(this.state.ProvinceCity.length==0){
  275. message.warning("地区必须选择");
  276. this.setState({
  277. loading: false
  278. });
  279. return;
  280. }
  281. $.ajax({
  282. method: "POST",
  283. dataType: "json",
  284. crossDomain: false,
  285. url: globalConfig.context +( this.state.addState?"/open/api/addDemand":"/open/api/updateDemand"),
  286. data: {
  287. id:this.state.id,//需求ID
  288. name: this.state.name,//需求名称
  289. type:0,//需求类型
  290. industry:this.state.industry,//行业
  291. investmentCost: this.state.investmentCost,//经费投入
  292. reserveButtUnit: this.state.reserveButtUnit,//拟对接单位
  293. reserveButtMode: this.state.reserveButtMode,//拟对接方式
  294. reserveSolveMode: this.state.reserveSolveMode,//拟解决方式
  295. publisherName: this.state.publisherName,//联系人
  296. telephone: this.state.telephone,//联系方式
  297. summary: this.state.summary?this.state.summary.join(","):undefined,//需求项目概况this.state.shehui?this.state.shehui.join(","):undefined
  298. introduce: this.state.introduce,//需求内容
  299. pname: this.state.Pname,//企业名称
  300. nature: this.state.nature,//企业特质
  301. feature: this.state.feature,//企业特征
  302. province: this.state.ProvinceCity?this.state.ProvinceCity[0]:"",//省
  303. city: this.state.ProvinceCity?this.state.ProvinceCity[1]:"",//市
  304. zipCode: this.state.zipCode,//邮政编码
  305. legalPerson: this.state.legalPerson,//法人名称
  306. website: this.state.website,//企业网址
  307. email: this.state.email,//企业邮箱
  308. pintroduce: this.state.pintroduce,//企业简介
  309. }
  310. }).done(function (data) {
  311. if (!data.error.length) {
  312. message.success(this.state.addState?'新建成功!':"修改成功!");
  313. this.setState({
  314. visible: false,
  315. });
  316. this.loadData();
  317. this.resets();
  318. } else {
  319. message.warning(data.error[0].message);
  320. };
  321. this.setState({
  322. loading: false,
  323. });
  324. }.bind(this));
  325. }
  326. resets(){
  327. this.state.name = '',//需求名称
  328. this.state.industry = undefined,//行业
  329. this.state.investmentCost = '',//经费投入
  330. this.state.reserveButtUnit = '',//拟对接单位
  331. this.state.reserveButtMode = '',//拟对接方式
  332. this.state.reserveSolveMode = '',//拟解决方式
  333. this.state.publisherName = '',//联系人
  334. this.state.telephone = '',//联系方式
  335. this.state.summary = '',
  336. this.state.introduce = '',//需求内容
  337. this.state.Pname = '',//企业名称
  338. this.state.nature = undefined,//企业特质
  339. this.state.feature = '',//企业特征
  340. this.state.ProvinceCity =undefined,//省
  341. this.state.zipCode = '',//邮政编码
  342. this.state.legalPerson = '',//法人名称
  343. this.state.website = '',//企业网址
  344. this.state.email = '',//企业邮箱
  345. this.state.pintroduce = ''//企业简介
  346. }
  347. componentWillMount() {
  348. this.loadData(1);
  349. }
  350. render() {
  351. const url="https://api.qrserver.com/v1/create-qr-code/?data=http://"+window.location.host+"/open/demandDetails?id="+this.state.id+"&size=100x100"
  352. const rowSelection = {
  353. selectedRowKeys: this.state.selectedRowKeys,
  354. onChange: (selectedRowKeys, selectedRows) => {
  355. this.setState({
  356. selectedRows: selectedRows.slice(-1),
  357. selectedRowKeys: selectedRowKeys.slice(-1)
  358. });
  359. }
  360. };
  361. const formItemLayout = {
  362. labelCol: { span: 6 },
  363. wrapperCol: { span: 12 }
  364. };
  365. return (
  366. <div className="user-content">
  367. <div className="content-title">
  368. <span className="title">四川科技需求</span>
  369. <div className="patent-addNew">
  370. <Button type="primary" onClick={this.add.bind(this)}>
  371. 发布需求<Icon type="plus" />
  372. </Button>
  373. </div>
  374. </div>
  375. <div className="user-search">
  376. <Input
  377. placeholder="需求名称"
  378. value={this.state.seachNames}
  379. className="searchInp"
  380. onChange={(e) => {
  381. this.setState({ seachNames: e.target.value });
  382. }}
  383. style={{ width: 120 }}
  384. />
  385. <Input
  386. placeholder="企业名称"
  387. value={this.state.seachName}
  388. className="searchInp"
  389. onChange={(e) => {
  390. this.setState({ seachName: e.target.value });
  391. }}
  392. style={{ width: 120 }}
  393. />
  394. <Input
  395. placeholder="对接单位"
  396. value={this.state.seachReserveButtUnit}
  397. onChange={(e) => {
  398. this.setState({ seachReserveButtUnit: e.target.value });
  399. }}
  400. style={{ width: 120 }}
  401. />
  402. <Button type="primary" onClick={this.search.bind(this)} className="interval">
  403. 搜索
  404. </Button>
  405. <Button onClick={this.reset.bind(this)} className="interval">
  406. 重置
  407. </Button>
  408. </div>
  409. <div className="patent-table">
  410. <Spin spinning={this.state.loading}>
  411. <Table
  412. columns={this.state.columns}
  413. dataSource={this.state.dataSource}
  414. rowSelection={rowSelection}
  415. pagination={this.state.pagination}
  416. onRowClick={this.tableRowClick.bind(this)}
  417. />
  418. </Spin>
  419. </div>
  420. <Modal
  421. title={this.state.addState ? '新建需求' : '需求详情'}
  422. visible={this.state.visible}
  423. width="900px"
  424. onOk={this.handleOk.bind(this)}
  425. onCancel={this.handleCancel.bind(this)}
  426. okText="保存"
  427. cancelText="取消"
  428. >
  429. <Form layout="horizontal" id="demand-form">
  430. <Spin spinning={this.state.loading}>
  431. <div className="clearfix">
  432. <div className="clearfix">
  433. <FormItem
  434. className="half-item"
  435. {...formItemLayout}
  436. label={
  437. <span>
  438. <strong style={{ color: '#f00' }}>*</strong>需求名称
  439. </span>
  440. }
  441. >
  442. <Input
  443. placeholder="需求名称"
  444. value={this.state.name}
  445. onChange={(e) => {
  446. this.setState({ name: e.target.value });
  447. }}
  448. />
  449. </FormItem>
  450. <FormItem className="half-item" {...formItemLayout} label="行业领域">
  451. <Select
  452. value={this.state.industry}
  453. onChange={(e) => {
  454. this.setState({ industry: e });
  455. }}
  456. placeholder="请选择"
  457. >
  458. <Select.Option value="1">先进制造与自动化</Select.Option>
  459. <Select.Option value="2">电子信息技术</Select.Option>
  460. <Select.Option value="3">新材料技术</Select.Option>
  461. <Select.Option value="4">生物与新药</Select.Option>
  462. <Select.Option value="5">资源与新环境</Select.Option>
  463. <Select.Option value="6">新能源</Select.Option>
  464. </Select>
  465. </FormItem>
  466. <FormItem className="half-item" {...formItemLayout} label="经费投入计划">
  467. <Input
  468. placeholder="经费投入计划"
  469. value={this.state.investmentCost}
  470. onChange={(e) => {
  471. this.setState({ investmentCost: e.target.value });
  472. }}
  473. />
  474. </FormItem>
  475. <FormItem className="half-item" {...formItemLayout} label="拟对接单位">
  476. <Input
  477. placeholder="拟对接单位"
  478. value={this.state.reserveButtUnit}
  479. onChange={(e) => {
  480. this.setState({ reserveButtUnit: e.target.value });
  481. }}
  482. />
  483. </FormItem>
  484. <FormItem className="half-item" {...formItemLayout} label="拟对接方式">
  485. <Select
  486. value={this.state.reserveButtMode}
  487. onChange={(e) => {
  488. this.setState({ reserveButtMode: e });
  489. }}
  490. placeholder="请选择对接方式"
  491. >
  492. <Select.Option value="0">直接对接</Select.Option>
  493. <Select.Option value="1">技术合作</Select.Option>
  494. </Select>
  495. </FormItem>
  496. <FormItem className="half-item" {...formItemLayout} label="拟合作方式">
  497. <Select
  498. value={this.state.reserveSolveMode}
  499. onChange={(e) => {
  500. this.setState({ reserveSolveMode: e });
  501. }}
  502. placeholder="请选择解决方式"
  503. >
  504. <Select.Option value="0">技术转让</Select.Option>
  505. <Select.Option value="1">技术入股</Select.Option>
  506. <Select.Option value="2">合作实施</Select.Option>
  507. <Select.Option value="3">委托开发</Select.Option>
  508. </Select>
  509. </FormItem>
  510. <FormItem className="half-item" {...formItemLayout} label="项目负责人">
  511. <Input
  512. placeholder="项目负责人"
  513. value={this.state.publisherName}
  514. onChange={(e) => {
  515. this.setState({ publisherName: e.target.value });
  516. }}
  517. />
  518. </FormItem>
  519. <FormItem className="half-item" {...formItemLayout} label="联系电话">
  520. <Input
  521. placeholder="联系电话"
  522. value={this.state.telephone}
  523. onChange={(e) => {
  524. this.setState({ telephone: e.target.value });
  525. }}
  526. />
  527. </FormItem>
  528. </div>
  529. <FormItem
  530. labelCol={{ span: 3 }}
  531. wrapperCol={{ span: 18 }}
  532. label="需求项目概况"
  533. >
  534. <CheckboxGroup options={demandProfile} value={this.state.summary} onChange={(e)=>{this.setState({summary:e})}} />
  535. </FormItem>
  536. <div className="clearfix">
  537. <FormItem
  538. labelCol={{ span: 3 }}
  539. wrapperCol={{ span: 18 }}
  540. label={
  541. <span>
  542. <strong style={{ color: '#f00' }}>*</strong>需求内容
  543. </span>
  544. }
  545. style={{ margin: '10px 0px' }}
  546. >
  547. <TextArea
  548. autosize={{ minRows: 4, maxRows: 10 }}
  549. placeholder="输入需求内容"
  550. value={this.state.introduce}
  551. onChange={(e) => {
  552. this.setState({ introduce: e.target.value });
  553. }}
  554. />
  555. </FormItem>
  556. </div>
  557. <Row>
  558. <Col span={8} style={{ fontSize: 18 }}>
  559. 技术成果企业情况
  560. </Col>
  561. </Row>
  562. <div className="clearfix">
  563. <FormItem
  564. className="half-item"
  565. {...formItemLayout}
  566. label={
  567. <span>
  568. <strong style={{ color: '#f00' }}>*</strong>企业名称
  569. </span>
  570. }
  571. >
  572. <Input
  573. placeholder="企业名称"
  574. value={this.state.Pname}
  575. onChange={(e) => {
  576. this.setState({ Pname: e.target.value });
  577. }}
  578. />
  579. </FormItem>
  580. <FormItem className="half-item" {...formItemLayout} label="单位性质">
  581. <Select
  582. value={this.state.nature}
  583. onChange={(e) => {
  584. this.setState({ nature: e });
  585. }}
  586. placeholder="请选择单位性质"
  587. >
  588. <Select.Option value="1">国家行政企业</Select.Option>
  589. <Select.Option value="2">公私合作企业</Select.Option>
  590. <Select.Option value="3">中外合资企业</Select.Option>
  591. <Select.Option value="4">社会组织机构</Select.Option>
  592. <Select.Option value="5">国际组织机构</Select.Option>
  593. <Select.Option value="6">外资企业</Select.Option>
  594. <Select.Option value="7">私营企业</Select.Option>
  595. <Select.Option value="8">集体企业</Select.Option>
  596. <Select.Option value="9">国防军事企业</Select.Option>
  597. </Select>
  598. </FormItem>
  599. <FormItem className="half-item" {...formItemLayout} label="企业特征">
  600. <Input
  601. placeholder="企业特征"
  602. value={this.state.feature}
  603. onChange={(e) => {
  604. this.setState({ feature: e.target.value });
  605. }}
  606. />
  607. </FormItem>
  608. <FormItem className="half-item"
  609. {...formItemLayout}
  610. label={
  611. <span>
  612. <strong style={{ color: '#f00' }}>*</strong>企业所在地
  613. </span>
  614. }
  615. >
  616. <Cascader options={citySelect()} value={this.state.ProvinceCity} placeholder="选择城市"
  617. onChange={(e,pre) => { this.setState({ ProvinceCity: e }) }} />
  618. </FormItem>
  619. <FormItem className="half-item" {...formItemLayout} label="邮政编码">
  620. <Input
  621. placeholder="邮政编码"
  622. value={this.state.zipCode}
  623. onChange={(e) => {
  624. this.setState({ zipCode: e.target.value });
  625. }}
  626. />
  627. </FormItem>
  628. <FormItem className="half-item" {...formItemLayout} label="法定代表人">
  629. <Input
  630. placeholder="法定代表人"
  631. value={this.state.legalPerson}
  632. onChange={(e) => {
  633. this.setState({ legalPerson: e.target.value });
  634. }}
  635. />
  636. </FormItem>
  637. <FormItem className="half-item" {...formItemLayout} label="企业网址">
  638. <Input
  639. placeholder="企业网址"
  640. value={this.state.website}
  641. onChange={(e) => {
  642. this.setState({ website: e.target.value });
  643. }}
  644. />
  645. </FormItem>
  646. <FormItem className="half-item" {...formItemLayout} label="E-Mail">
  647. <Input
  648. placeholder="E-Mail"
  649. value={this.state.email}
  650. onChange={(e) => {
  651. this.setState({ email: e.target.value });
  652. }}
  653. />
  654. </FormItem>
  655. </div>
  656. <div className="clearfix">
  657. <FormItem labelCol={{ span: 3 }} wrapperCol={{ span: 19 }} label="企业简介">
  658. <Input type="textarea" rows={4} placeholder="企业简介" value={this.state.pintroduce}
  659. onChange={(e) => { this.setState({ pintroduce: e.target.value }) }} style={{width:'95%'}}/>
  660. </FormItem>
  661. </div>
  662. {!this.state.addState&&<div className="clearfix" style={{marginTop:"10px"}}>
  663. <FormItem labelCol={{ span: 3 }} wrapperCol={{ span: 19 }} label="二维码">
  664. <img src={url} style={{width:"100px",height:"100px"}}/>
  665. </FormItem>
  666. </div>
  667. }
  668. </div>
  669. </Spin>
  670. </Form>
  671. </Modal>
  672. </div>
  673. );
  674. }
  675. }
  676. export default Achievement;