sichuanman.jsx 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510
  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:1,
  45. orgName:this.state.seachOrgName,//企业名称
  46. },
  47. success: function (data) {
  48. let theArr = [];
  49. if (!data.data || !data.data.list) {
  50. if (data.error && data.error.length) {
  51. message.warning(data.error[0].message);
  52. };
  53. } else {
  54. for (let i = 0; i < data.data.list.length; i++) {
  55. let thisdata = data.data.list[i];
  56. theArr.push({
  57. key: i,
  58. id: thisdata.id,//需求ID
  59. name:thisdata.orgName,//企业名称
  60. contacts:thisdata.contacts,//联系人
  61. address:thisdata.address,//详细地址
  62. telephone:thisdata.telephone,//联系电话
  63. });
  64. };
  65. this.state.pagination.current = data.data.pageNo;
  66. this.state.pagination.total = data.data.totalCount;
  67. };
  68. this.setState({
  69. dataSource: theArr,
  70. pagination: this.state.pagination
  71. });
  72. }.bind(this),
  73. }).always(function () {
  74. this.setState({
  75. loading: false
  76. });
  77. }.bind(this));
  78. }
  79. constructor(props) {
  80. super(props);
  81. this.state = {
  82. loading:false,
  83. publishPages: [],
  84. visible: false,
  85. pagination: {
  86. defaultCurrent: 1,
  87. defaultPageSize: 10,
  88. showQuickJumper: true,
  89. pageSize: 10,
  90. onChange: function(page) {
  91. this.loadData(page);
  92. }.bind(this),
  93. showTotal: function(total) {
  94. return '共' + total + '条数据';
  95. }
  96. },
  97. columns: [
  98. {
  99. title: '企业名称',
  100. dataIndex: 'name',
  101. key: 'name'
  102. },{
  103. title: '联系人',
  104. dataIndex: 'contacts',
  105. key: 'contacts'
  106. },{
  107. title: '联系方式',
  108. dataIndex: 'telephone',
  109. key: 'telephone'
  110. },{
  111. title: '详细地址',
  112. dataIndex: 'address',
  113. key: 'address'
  114. },
  115. {
  116. title: '操作',
  117. dataIndex: 'caozuo',
  118. key: 'caozuo',
  119. render: (text, recard) => {
  120. return (
  121. <div className="btnRight">
  122. <Button
  123. type="danger"
  124. onClick={(e) => {
  125. e.stopPropagation();
  126. this.delectRow(recard);
  127. }}
  128. >
  129. 删除
  130. </Button>
  131. </div>
  132. );
  133. }
  134. }
  135. ]
  136. };
  137. }
  138. //删除
  139. delectRow(recard) {
  140. $.ajax({
  141. method: "get",
  142. dataType: "json",
  143. crossDomain: false,
  144. url: globalConfig.context + "/open/api/delectDemand",
  145. data: {
  146. id:recard.id
  147. },
  148. success: function (data) {
  149. if (!data.error.length) {
  150. message.success('删除成功!');
  151. this.setState({
  152. loading: false,
  153. });
  154. this.loadData();
  155. } else {
  156. message.warning(data.error[0].message);
  157. };
  158. }.bind(this),
  159. }).always(function () {
  160. this.setState({
  161. loading: false
  162. });
  163. }.bind(this));
  164. }
  165. details(recard){
  166. this.state({
  167. loading:true
  168. })
  169. }
  170. add() {
  171. this.setState({
  172. uid: '',
  173. visible: true,
  174. addState: true,
  175. name: '',
  176. introduce: '',
  177. industry: '',
  178. summary: '',
  179. ownerName: '',
  180. reserveButtMode: '',
  181. patentNumber: '',
  182. transferPrice: '',
  183. telephone: '',
  184. cname: ''
  185. });
  186. }
  187. search() {
  188. this.loadData(1);
  189. }
  190. reset() {
  191. this.state.seachOrgName = '';
  192. this.loadData(1);
  193. }
  194. tableRowClick(record, index) {
  195. this.setState({
  196. visible: true,
  197. addState: false,
  198. id:record.id,
  199. });
  200. $.ajax({
  201. method: "get",
  202. dataType: "json",
  203. crossDomain: false,
  204. url: globalConfig.context + "/open/api/demandDetails",
  205. data: {
  206. id: record.id,//需求名称
  207. }
  208. }).done(function (data) {
  209. if (!data.error.length) {
  210. let thisData=data.data;
  211. let ProvinceCityArr = [];
  212. let ProvinceS =thisData.province? parseInt(thisData.province):""; //省
  213. let citys = thisData.city?parseInt(thisData.city):"";//市
  214. ProvinceCityArr.push(ProvinceS, citys);
  215. this.setState({
  216. id:thisData.id,
  217. Pname: thisData.pname,//企业名称
  218. ProvinceCity:ProvinceCityArr[0]!=null?ProvinceCityArr:undefined,//地区
  219. address: thisData.address,//详细地址
  220. publisherName: thisData.publisherName,//联系人
  221. telephone: thisData.telephone,//联系方式
  222. email: thisData.email,//企业邮箱
  223. feature: thisData.feature,//企业特征
  224. introduce: thisData.introduce,//需求内容
  225. investmentCost: thisData.investmentCost,//经费投入
  226. pintroduce:thisData.pintroduce,//企业简介
  227. remarks:thisData.remarks,//企业
  228. // name: thisData.name,//需求名称
  229. // industry:(thisData.industry||thisData.industry==0)?thisData.industry.toString():undefined,//行业
  230. // reserveButtUnit: thisData.reserveButtUnit,//拟对接单位
  231. // reserveButtMode: (thisData.reserveButtMode||thisData.reserveButtMode==0)?thisData.reserveButtMode.toString():undefined,//拟对接方式
  232. // reserveSolveMode:(thisData.reserveSolveMode||thisData.reserveSolveMode==0)?thisData.reserveSolveMode.toString():undefined ,//拟解决方式
  233. // summary: thisData.summary?thisData.summary.split(","):[],//需求项目概况this.state.shehui?this.state.shehui.join(","):undefined
  234. // nature: thisData.nature,//企业特质
  235. // zipCode: thisData.zipCode,//邮政编码
  236. // legalPerson: thisData.legalPerson,//法人名称
  237. // website: thisData.website,//企业网址
  238. });
  239. } else {
  240. message.warning(data.error[0].message);
  241. };
  242. this.setState({
  243. loading: false,
  244. });
  245. }.bind(this));
  246. }
  247. handleOk() {
  248. this.handleSubmit();
  249. }
  250. handleCancel() {
  251. this.setState({
  252. visible: false
  253. });
  254. this.resets();
  255. }
  256. handleSubmit() {
  257. this.setState({
  258. loading: true
  259. });
  260. if(!this.state.Pname){
  261. message.warning("企业名称必须填写");
  262. this.setState({
  263. loading: false
  264. });
  265. return;
  266. }
  267. if(!this.state.ProvinceCity||this.state.ProvinceCity.length==0||this.state.ProvinceCity[0]==""){
  268. message.warning("地区必须选择");
  269. this.setState({
  270. loading: false
  271. });
  272. return;
  273. }
  274. $.ajax({
  275. method: "POST",
  276. dataType: "json",
  277. crossDomain: false,
  278. url: globalConfig.context + ( this.state.addState?"/open/api/addDemand":"/open/api/updateDemand"),
  279. data: {
  280. id:this.state.id,//需求ID
  281. Pname: this.state.Pname,//企业名称
  282. province: this.state.ProvinceCity?this.state.ProvinceCity[0]:"",//省
  283. city: this.state.ProvinceCity?this.state.ProvinceCity[1]:"",//市
  284. publisherName: this.state.publisherName,//联系人
  285. telephone: this.state.telephone,//联系方式
  286. email: this.state.email,//企业邮箱
  287. address: this.state.address,//详细地址
  288. Pintroduce: this.state.pintroduce,//企业简介
  289. remarks: this.state.remarks,//企业情况
  290. feature:this.state.feature,//企业特征
  291. introduce: this.state.introduce,//人才需求
  292. type:1,//需求类型
  293. investmentCost: this.state.investmentCost,//经费投入
  294. }
  295. }).done(function (data) {
  296. if (!data.error.length) {
  297. message.success(this.state.addState?'新建成功!':"修改成功!");
  298. this.setState({
  299. visible: false,
  300. });
  301. this.loadData();
  302. this.resets();
  303. } else {
  304. message.warning(data.error[0].message);
  305. };
  306. this.setState({
  307. loading: false,
  308. });
  309. }.bind(this));
  310. }
  311. componentWillMount() {
  312. this.loadData(1);
  313. }
  314. resets(){
  315. this.state.Pname= '',//企业名称
  316. this.state.ProvinceCity= undefined,//省
  317. this.state.publisherName= '',//联系人
  318. this.state.telephone= '',//联系方式
  319. this.state.email= '',//企业邮箱
  320. this.state.address= '',//详细地址
  321. this.state.pintroduce= '',//企业简介
  322. this.state.remarks= '',//企业情况
  323. this.state.feature= '',//企业特征
  324. this.state.introduce= '',//人才需求
  325. this.state.investmentCost= ''//经费投入
  326. }
  327. render() {
  328. const url="https://api.qrserver.com/v1/create-qr-code/?data=http://"+window.location.host+"/open/demandDetails?id="+this.state.id+"&size=100x100"
  329. const rowSelection = {
  330. selectedRowKeys: this.state.selectedRowKeys,
  331. onChange: (selectedRowKeys, selectedRows) => {
  332. this.setState({
  333. selectedRows: selectedRows.slice(-1),
  334. selectedRowKeys: selectedRowKeys.slice(-1)
  335. });
  336. }
  337. };
  338. const formItemLayout = {
  339. labelCol: { span: 6 },
  340. wrapperCol: { span: 12 }
  341. };
  342. return (
  343. <div className="user-content">
  344. <div className="content-title">
  345. <span className="title">四川人才需求</span>
  346. <div className="patent-addNew">
  347. <Button type="primary" onClick={this.add.bind(this)}>
  348. 发布人才需求<Icon type="plus" />
  349. </Button>
  350. </div>
  351. </div>
  352. <div className="user-search">
  353. <Input
  354. placeholder="企业名称"
  355. value={this.state.seachOrgName}
  356. className="searchInp"
  357. onChange={(e) => {
  358. this.setState({ seachOrgName: e.target.value });
  359. }}
  360. style={{ width: 120 }}
  361. />
  362. <Button type="primary" onClick={this.search.bind(this)} className="interval">
  363. 搜索
  364. </Button>
  365. <Button onClick={this.reset.bind(this)} className="interval">
  366. 重置
  367. </Button>
  368. </div>
  369. <div className="patent-table">
  370. <Spin spinning={this.state.loading}>
  371. <Table
  372. columns={this.state.columns}
  373. dataSource={this.state.dataSource}
  374. rowSelection={rowSelection}
  375. pagination={this.state.pagination}
  376. onRowClick={this.tableRowClick.bind(this)}
  377. />
  378. </Spin>
  379. </div>
  380. <Modal
  381. title={this.state.addState ? '新建人才需求' : '人才需求详情'}
  382. visible={this.state.visible}
  383. width="900px"
  384. onOk={this.handleOk.bind(this)}
  385. onCancel={this.handleCancel.bind(this)}
  386. okText="保存"
  387. cancelText="取消"
  388. >
  389. <Form layout="horizontal" id="demand-form">
  390. <Spin spinning={this.state.loading}>
  391. <div className="clearfix">
  392. <FormItem
  393. className="half-item"
  394. {...formItemLayout}
  395. label={
  396. <span>
  397. <strong style={{ color: '#f00' }}>*</strong>企业名称
  398. </span>
  399. }
  400. >
  401. <Input
  402. placeholder="企业名称"
  403. value={this.state.Pname}
  404. onChange={(e) => {
  405. this.setState({ Pname: e.target.value });
  406. }}
  407. />
  408. </FormItem>
  409. <FormItem className="half-item"
  410. {...formItemLayout}
  411. label={
  412. <span>
  413. <strong style={{ color: '#f00' }}>*</strong>企业所在地
  414. </span>
  415. }
  416. >
  417. <Cascader options={citySelect()} placeholder="选择城市" value={this.state.ProvinceCity}
  418. onChange={(e) => {this.setState({ ProvinceCity: e })}}
  419. />
  420. </FormItem>
  421. <FormItem className="half-item" {...formItemLayout} label="联系人">
  422. <Input
  423. placeholder="联系人"
  424. value={this.state.publisherName}
  425. onChange={(e) => {
  426. this.setState({ publisherName: e.target.value });
  427. }}
  428. />
  429. </FormItem>
  430. <FormItem className="half-item" {...formItemLayout} label="联系人电话">
  431. <Input
  432. placeholder="联系人电话"
  433. value={this.state.telephone}
  434. onChange={(e) => {
  435. this.setState({ telephone: e.target.value });
  436. }}
  437. />
  438. </FormItem>
  439. <FormItem className="half-item" {...formItemLayout} label="电子邮件">
  440. <Input
  441. placeholder="电子邮件"
  442. value={this.state.email}
  443. onChange={(e) => {
  444. this.setState({ email: e.target.value });
  445. }}
  446. />
  447. </FormItem>
  448. <FormItem className="half-item" {...formItemLayout} label="详细地址">
  449. <Input
  450. placeholder="详细地址"
  451. value={this.state.address}
  452. onChange={(e) => {
  453. this.setState({ address: e.target.value });
  454. }}
  455. />
  456. </FormItem>
  457. <div className="clearfix">
  458. <FormItem labelCol={{ span: 3 }} wrapperCol={{ span: 18 }} label="企业简介">
  459. <Input type="textarea" rows={4} placeholder="企业简介" value={this.state.pintroduce}
  460. onChange={(e) => { this.setState({ pintroduce: e.target.value }) }} style={{width:'95%'}}/>
  461. </FormItem>
  462. </div>
  463. <div className="clearfix" style={{marginTop:"10px"}}>
  464. <FormItem labelCol={{ span: 3 }} wrapperCol={{ span: 18 }} label="企业情况">
  465. <Input type="textarea" rows={4} placeholder="企业在行业中情况" value={this.state.remarks}
  466. onChange={(e) => { this.setState({ remarks: e.target.value }) }} style={{width:'95%'}}/>
  467. </FormItem>
  468. </div>
  469. <div className="clearfix" style={{marginTop:"10px"}}>
  470. <FormItem labelCol={{ span: 3 }} wrapperCol={{ span: 18 }} label="产品概述">
  471. <Input type="textarea" rows={4} placeholder="产品概述" value={this.state.feature}
  472. onChange={(e) => { this.setState({ feature: e.target.value }) }} style={{width:'95%'}}/>
  473. </FormItem>
  474. </div>
  475. <div className="clearfix" style={{marginTop:"10px"}}>
  476. <FormItem labelCol={{ span: 3 }} wrapperCol={{ span: 18 }} label="人才需求概述">
  477. <Input type="textarea" rows={4} placeholder="人才需求概述" value={this.state.introduce}
  478. onChange={(e) => { this.setState({ introduce: e.target.value }) }} style={{width:'95%'}}/>
  479. </FormItem>
  480. </div>
  481. <div className="clearfix" style={{marginTop:"10px"}}>
  482. <FormItem labelCol={{ span: 3 }} wrapperCol={{ span: 18 }} label="待遇">
  483. <Input type="textarea" rows={4} placeholder="待遇" value={this.state.investmentCost}
  484. onChange={(e) => { this.setState({ investmentCost: e.target.value }) }} style={{width:'95%'}}/>
  485. </FormItem>
  486. </div>
  487. {!this.state.addState&&<div className="clearfix" style={{marginTop:"10px"}}>
  488. <FormItem labelCol={{ span: 3 }} wrapperCol={{ span: 19 }} label="二维码">
  489. <img src={url} style={{width:"100px",height:"100px"}}/>
  490. </FormItem>
  491. </div>
  492. }
  493. </div>
  494. </Spin>
  495. </Form>
  496. </Modal>
  497. </div>
  498. );
  499. }
  500. }
  501. export default Achievement;