sichuanman.jsx 17 KB

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