sichuanman.jsx 16 KB

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