sichuanman.jsx 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495
  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. $.ajax({
  263. method: "POST",
  264. dataType: "json",
  265. crossDomain: false,
  266. url: globalConfig.context + ( this.state.addState?"/open/api/addDemand":"/open/api/updateDemand"),
  267. data: {
  268. id:this.state.id,//需求ID
  269. Pname: this.state.Pname,//企业名称
  270. province: this.state.ProvinceCity?this.state.ProvinceCity[0]:"",//省
  271. city: this.state.ProvinceCity?this.state.ProvinceCity[1]:"",//市
  272. publisherName: this.state.publisherName,//联系人
  273. telephone: this.state.telephone,//联系方式
  274. email: this.state.email,//企业邮箱
  275. address: this.state.address,//详细地址
  276. Pintroduce: this.state.pintroduce,//企业简介
  277. remarks: this.state.remarks,//企业情况
  278. feature:this.state.feature,//企业特征
  279. introduce: this.state.introduce,//人才需求
  280. type:1,//需求类型
  281. investmentCost: this.state.investmentCost,//经费投入
  282. }
  283. }).done(function (data) {
  284. if (!data.error.length) {
  285. message.success(this.state.addState?'新建成功!':"修改成功!");
  286. this.setState({
  287. visible: false,
  288. });
  289. this.loadData();
  290. } else {
  291. message.warning(data.error[0].message);
  292. };
  293. this.setState({
  294. loading: false,
  295. });
  296. }.bind(this));
  297. }
  298. componentWillMount() {
  299. this.loadData(1);
  300. }
  301. resets(){
  302. this.state.name = '',//需求名称
  303. this.state.industry = undefined,//行业
  304. this.state.investmentCost = '',//经费投入
  305. this.state.reserveButtUnit = '',//拟对接单位
  306. this.state.reserveButtMode = '',//拟对接方式
  307. this.state.reserveSolveMode = '',//拟解决方式
  308. this.state.publisherName = '',//联系人
  309. this.state.telephone = '',//联系方式
  310. this.state.summary = '',
  311. this.state.introduce = '',//需求内容
  312. this.state.Pname = '',//企业名称
  313. this.state.nature = undefined,//企业特质
  314. this.state.feature = '',//企业特征
  315. this.state.ProvinceCity =undefined,//省
  316. this.state.zipCode = '',//邮政编码
  317. this.state.legalPerson = '',//法人名称
  318. this.state.website = '',//企业网址
  319. this.state.email = '',//企业邮箱
  320. this.state.Pintroduce = ''//企业简介
  321. this.state.address = ''//企业简介
  322. }
  323. render() {
  324. console.log(this.state.ProvinceCity);
  325. const rowSelection = {
  326. selectedRowKeys: this.state.selectedRowKeys,
  327. onChange: (selectedRowKeys, selectedRows) => {
  328. this.setState({
  329. selectedRows: selectedRows.slice(-1),
  330. selectedRowKeys: selectedRowKeys.slice(-1)
  331. });
  332. }
  333. };
  334. const formItemLayout = {
  335. labelCol: { span: 6 },
  336. wrapperCol: { span: 12 }
  337. };
  338. return (
  339. <div className="user-content">
  340. <div className="content-title">
  341. <span className="title">四川人才需求</span>
  342. <div className="patent-addNew">
  343. <Button type="primary" onClick={this.add.bind(this)}>
  344. 发布人才需求<Icon type="plus" />
  345. </Button>
  346. </div>
  347. </div>
  348. <div className="user-search">
  349. <Input
  350. placeholder="企业名称"
  351. value={this.state.seachOrgName}
  352. className="searchInp"
  353. onChange={(e) => {
  354. this.setState({ seachOrgName: e.target.value });
  355. }}
  356. style={{ width: 120 }}
  357. />
  358. <Button type="primary" onClick={this.search.bind(this)} className="interval">
  359. 搜索
  360. </Button>
  361. <Button onClick={this.reset.bind(this)} className="interval">
  362. 重置
  363. </Button>
  364. </div>
  365. <div className="patent-table">
  366. <Spin spinning={this.state.loading}>
  367. <Table
  368. columns={this.state.columns}
  369. dataSource={this.state.dataSource}
  370. rowSelection={rowSelection}
  371. pagination={this.state.pagination}
  372. onRowClick={this.tableRowClick.bind(this)}
  373. />
  374. </Spin>
  375. </div>
  376. <Modal
  377. title={this.state.addState ? '新建人才需求' : '人才需求详情'}
  378. visible={this.state.visible}
  379. width="900px"
  380. onOk={this.handleOk.bind(this)}
  381. onCancel={this.handleCancel.bind(this)}
  382. okText="保存"
  383. cancelText="取消"
  384. >
  385. <Form layout="horizontal" id="demand-form">
  386. <Spin spinning={this.state.loading}>
  387. <div className="clearfix">
  388. <FormItem
  389. className="half-item"
  390. {...formItemLayout}
  391. label={
  392. <span>
  393. <strong style={{ color: '#f00' }}>*</strong>企业名称
  394. </span>
  395. }
  396. >
  397. <Input
  398. placeholder="企业名称"
  399. value={this.state.Pname}
  400. onChange={(e) => {
  401. this.setState({ Pname: e.target.value });
  402. }}
  403. />
  404. </FormItem>
  405. <FormItem className="half-item"
  406. {...formItemLayout}
  407. label="企业所在地"
  408. >
  409. <Cascader options={citySelect()} placeholder="选择城市" value={this.state.ProvinceCity}
  410. onChange={(e) => {this.setState({ ProvinceCity: e })}}
  411. />
  412. </FormItem>
  413. <FormItem className="half-item" {...formItemLayout} label="联系人">
  414. <Input
  415. placeholder="联系人"
  416. value={this.state.publisherName}
  417. onChange={(e) => {
  418. this.setState({ publisherName: e.target.value });
  419. }}
  420. />
  421. </FormItem>
  422. <FormItem className="half-item" {...formItemLayout} label="联系人电话">
  423. <Input
  424. placeholder="联系人电话"
  425. value={this.state.telephone}
  426. onChange={(e) => {
  427. this.setState({ telephone: e.target.value });
  428. }}
  429. />
  430. </FormItem>
  431. <FormItem className="half-item" {...formItemLayout} label="电子邮件">
  432. <Input
  433. placeholder="电子邮件"
  434. value={this.state.email}
  435. onChange={(e) => {
  436. this.setState({ email: e.target.value });
  437. }}
  438. />
  439. </FormItem>
  440. <FormItem className="half-item" {...formItemLayout} label="详细地址">
  441. <Input
  442. placeholder="详细地址"
  443. value={this.state.address}
  444. onChange={(e) => {
  445. this.setState({ address: e.target.value });
  446. }}
  447. />
  448. </FormItem>
  449. <div className="clearfix">
  450. <FormItem labelCol={{ span: 3 }} wrapperCol={{ span: 18 }} label="企业简介">
  451. <Input type="textarea" rows={4} placeholder="企业简介" value={this.state.pintroduce}
  452. onChange={(e) => { this.setState({ pintroduce: e.target.value }) }} style={{width:'95%'}}/>
  453. </FormItem>
  454. </div>
  455. <div className="clearfix" style={{marginTop:"10px"}}>
  456. <FormItem labelCol={{ span: 3 }} wrapperCol={{ span: 18 }} label="企业情况">
  457. <Input type="textarea" rows={4} placeholder="企业在行业中情况" value={this.state.remarks}
  458. onChange={(e) => { this.setState({ remarks: e.target.value }) }} style={{width:'95%'}}/>
  459. </FormItem>
  460. </div>
  461. <div className="clearfix" style={{marginTop:"10px"}}>
  462. <FormItem labelCol={{ span: 3 }} wrapperCol={{ span: 18 }} label="产品概述">
  463. <Input type="textarea" rows={4} placeholder="产品概述" value={this.state.feature}
  464. onChange={(e) => { this.setState({ feature: e.target.value }) }} style={{width:'95%'}}/>
  465. </FormItem>
  466. </div>
  467. <div className="clearfix" style={{marginTop:"10px"}}>
  468. <FormItem labelCol={{ span: 3 }} wrapperCol={{ span: 18 }} label="人才需求概述">
  469. <Input type="textarea" rows={4} placeholder="人才需求概述" value={this.state.introduce}
  470. onChange={(e) => { this.setState({ introduce: e.target.value }) }} style={{width:'95%'}}/>
  471. </FormItem>
  472. </div>
  473. <div className="clearfix" style={{marginTop:"10px"}}>
  474. <FormItem labelCol={{ span: 3 }} wrapperCol={{ span: 18 }} label="待遇">
  475. <Input type="textarea" rows={4} placeholder="待遇" value={this.state.investmentCost}
  476. onChange={(e) => { this.setState({ investmentCost: e.target.value }) }} style={{width:'95%'}}/>
  477. </FormItem>
  478. </div>
  479. </div>
  480. </Spin>
  481. </Form>
  482. </Modal>
  483. </div>
  484. );
  485. }
  486. }
  487. export default Achievement;