firmList.jsx 30 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000
  1. import React from "react";
  2. import $ from "jquery/src/ajax";
  3. import "react-quill/dist/quill.bubble.css";
  4. import moment from "moment";
  5. import "../authentication/techDemand.less";
  6. import {
  7. Form,
  8. Icon,
  9. Button,
  10. Input,
  11. Select,
  12. Table,
  13. message,
  14. DatePicker,
  15. Modal,
  16. Upload,
  17. Popconfirm,
  18. Tabs,
  19. Tag, Checkbox, Tooltip
  20. } from "antd";
  21. import {
  22. splitUrl,
  23. beforeUploadFile,
  24. getPicPath
  25. } from "@/tools.js";
  26. import Editors from "@/richTextEditors";
  27. import SpinContainer from "../../SpinContainer";
  28. import { companyList, getCompanyName, getCompanyValueArray } from "../../common/configure"; //富文本编辑器
  29. // 上传文件
  30. const PicturesWall = React.createClass({
  31. getInitialState() {
  32. return {
  33. previewVisible: false,
  34. previewImage: "",
  35. fileList: [],
  36. };
  37. },
  38. getDefaultProps() {
  39. return {
  40. changeClick: this.modifyChange
  41. };
  42. },
  43. handleCancel() {
  44. this.setState({ previewVisible: false });
  45. },
  46. handlePreview(file) {
  47. this.setState({
  48. previewImage: file.url || file.thumbUrl,
  49. previewVisible: true
  50. });
  51. },
  52. handleChange(info) {
  53. let fileList = info.fileList;
  54. this.setState({ fileList });
  55. this.props.fileList(fileList);
  56. },
  57. componentWillReceiveProps(nextProps) {
  58. this.setState({
  59. fileList: nextProps.pictureUrl
  60. })
  61. },
  62. // 删除绑定的图片
  63. async onRemove(info) {
  64. const { id, } = this.props
  65. let name = info.response.data
  66. let remove = new Promise(function (resolve, reject) {
  67. Modal.confirm({
  68. title: '操作确认',
  69. content: '是否确认删除?',
  70. okText: '确定',
  71. cancelText: '取消',
  72. onOk() {
  73. $.ajax({
  74. method: "post",
  75. dataType: "json",
  76. crossDomain: false,
  77. url: globalConfig.context + '/api/admin/news/deleteFile',
  78. data: {
  79. id, // 新闻id
  80. fileName: name
  81. }
  82. }).done(function (data) {
  83. if (!data.error.length) {
  84. resolve(true);
  85. } else {
  86. };
  87. }.bind(this));
  88. },
  89. onCancel() {
  90. resolve(false)
  91. },
  92. })
  93. });
  94. return await remove;
  95. },
  96. render() {
  97. const { previewVisible, previewImage, fileList } = this.state;
  98. // 点击上传
  99. const uploadButton = (
  100. <div>
  101. <Icon type="plus" />
  102. <div className="ant-upload-text">点击上传</div>
  103. </div>
  104. );
  105. return (
  106. //上传组件
  107. <div style={{ display: "inline-block" }}>
  108. <Upload
  109. beforeUpload={beforeUploadFile}
  110. // action={globalConfig.context + "/api/admin/militaryEnterprises/uploadPicture"}
  111. action={globalConfig.context + "/api/admin/news/uploadFile"}
  112. data={{ id: this.props.id, sign: "enterprises_pucture" }}
  113. listType="picture-card"
  114. fileList={fileList}
  115. onPreview={this.handlePreview}
  116. onChange={this.handleChange}
  117. onRemove={this.onRemove}
  118. >
  119. {fileList && fileList.length >= 1 ? null : uploadButton}
  120. </Upload>
  121. <Modal
  122. maskClosable={false}
  123. visible={previewVisible}
  124. footer={null}
  125. onCancel={e => {
  126. this.setState({ previewVisible: false });
  127. }}
  128. >
  129. <img alt="" style={{ width: "100%" }} src={previewImage} />
  130. </Modal>
  131. </div>
  132. );
  133. }
  134. });
  135. //主体
  136. const FirmList = Form.create()(
  137. React.createClass({
  138. // 初始化数据
  139. loadData(pageNo) {
  140. this.state.data = [];
  141. this.setState({
  142. loading: true,
  143. page: pageNo
  144. });
  145. //发送请求
  146. $.ajax({
  147. method: "get",
  148. dataType: "json",
  149. crossDomain: false,
  150. url: globalConfig.context + "/api/admin/news/listNews",
  151. data: {
  152. pageNo: pageNo || this.state.pagination.current || 1,
  153. pageSize: this.state.pagination.pageSize,
  154. title: this.state.titleSearch,
  155. location: this.state.locationSearch,
  156. },
  157. success: function (data) {
  158. let theArr = [];
  159. if (!data.data || !data.data.list) {
  160. if (data.error && data.error.length) {
  161. message.warning(data.error[0].message);
  162. }
  163. } else {
  164. for (let i = 0; i < data.data.list.length; i++) {
  165. let thisdata = data.data.list[i];
  166. thisdata.key = i + 1
  167. theArr.push(thisdata);
  168. }
  169. this.state.pagination.current = data.data.pageNo;
  170. this.state.pagination.total = data.data.totalCount;
  171. }
  172. this.setState({
  173. dataSource: theArr,
  174. pagination: this.state.pagination
  175. });
  176. }.bind(this)
  177. }).always(
  178. function () {
  179. this.setState({
  180. loading: false
  181. });
  182. }.bind(this)
  183. );
  184. },
  185. //声明状态
  186. getInitialState() {
  187. return {
  188. step: 0,
  189. loading: false,
  190. flag: true,
  191. editorState: null,
  192. locations: [],
  193. indeterminate: false,
  194. activeKey: "1",
  195. timesArr: [],
  196. ProvinceCity: [],
  197. ProvinceCityC: [],
  198. totalData: {
  199. mark: false
  200. },
  201. imgWidth: "width: 200px",
  202. logoUrl: [],
  203. pagination: {
  204. defaultCurrent: 1,
  205. defaultPageSize: 10,
  206. showQuickJumper: true,
  207. pageSize: 10,
  208. onChange: function (page) {
  209. this.loadData(page);
  210. this.setState({
  211. selectedRowKeys: []
  212. });
  213. }.bind(this),
  214. showTotal: function (total) {
  215. return "共" + total + "条数据";
  216. }
  217. },
  218. //数据类型
  219. columns: [
  220. {
  221. title: "序号",
  222. dataIndex: "key",
  223. key: "key"
  224. },
  225. {
  226. title: "新闻分类",
  227. dataIndex: "type",
  228. key: "type",
  229. render: text => {
  230. if (text == 0) {
  231. return "公司新闻";
  232. } else if (text == 1) {
  233. return "行业新闻";
  234. }
  235. }
  236. },
  237. {
  238. title: "新闻标题",
  239. dataIndex: "title",
  240. key: "title",
  241. render: text => {
  242. return text.length >= 8 ? text.substring(0, 8) + "..." : text;
  243. }
  244. },
  245. {
  246. title: "排序",
  247. dataIndex: "sort",
  248. key: "sort"
  249. },
  250. {
  251. title: "是否首页",
  252. dataIndex: "status",
  253. key: "status",
  254. render: s => {
  255. return s ? (
  256. <Tag color="#87d068">是</Tag>
  257. ) : (
  258. <Tag color="#f50">否</Tag>
  259. );
  260. }
  261. },
  262. {
  263. title: "新闻缩率图",
  264. dataIndex: "pictureUrl",
  265. key: "pictureUrl",
  266. render: url => {
  267. let path = getPicPath(globalConfig.avatarUploadHost, url);
  268. return (
  269. <div style={{ textAlign: "center" }}>
  270. <img src={path} style={{ width: "100px", height: 50 }} />
  271. <Button
  272. className="buttonimg"
  273. style={{ marginLeft: 10 }}
  274. onClick={e => {
  275. e.stopPropagation();
  276. this.maximg(path);
  277. }}
  278. >
  279. 查看大图
  280. </Button>
  281. </div>
  282. );
  283. }
  284. },
  285. {
  286. title: "公司",
  287. dataIndex: "locations",
  288. key: "locations",
  289. width: 150,
  290. render: r => {
  291. let text = '';
  292. r && r.map((v, i) => (
  293. text += (i === 0 ? '' : ',') + getCompanyName(v)
  294. ))
  295. return (
  296. <Tooltip placement="top" title={text}>
  297. {
  298. r && r.map((v, i) => (
  299. i <= 2 ? (i === 0 ? '' : ',') + getCompanyName(v) : null
  300. ))
  301. }
  302. {
  303. r.length > 3 ? '.....' : null
  304. }
  305. </Tooltip>
  306. )
  307. }
  308. },
  309. {
  310. title: "发布状态",
  311. dataIndex: "releaseStatus",
  312. key: "releaseStatus",
  313. render: text => {
  314. return text ? "是" : "否";
  315. }
  316. },
  317. // {
  318. // title: "置顶",
  319. // dataIndex: "topNumber",
  320. // key: "topNumber",
  321. // render: text => {
  322. // return text ? "否" : "是";
  323. // }
  324. // },
  325. {
  326. title: "操作",
  327. dataIndex: "operate",
  328. key: "operate",
  329. render: (text, record, index) => {
  330. return (
  331. <div>
  332. <Button
  333. type="primary"
  334. style={{ marginLeft: "10px" }}
  335. onClick={() => {
  336. this.setState({
  337. flag: true
  338. });
  339. this.edit(record);
  340. }}
  341. >
  342. 编辑
  343. </Button>
  344. <Popconfirm
  345. title="您确定删除该新闻吗?"
  346. onConfirm={() => this.confirm(record.id)}
  347. onCancel={this.cancel}
  348. okText="是"
  349. cancelText="否"
  350. >
  351. <Button
  352. type="danger"
  353. style={{ marginLeft: "10px" }}
  354. onClick={e => {
  355. e.stopPropagation();
  356. }}
  357. >
  358. 删除
  359. </Button>
  360. </Popconfirm>
  361. <Button
  362. type="primary"
  363. style={{ marginLeft: "10px" }}
  364. onClick={e => {
  365. e.stopPropagation();
  366. if (record.status) {
  367. this.toTop(record, 0);
  368. } else {
  369. this.toTop(record, 1);
  370. }
  371. }}
  372. >
  373. {record.status ? "从首页撤下" : "推荐至首页"}
  374. </Button>
  375. </div>
  376. );
  377. }
  378. },
  379. {
  380. title: "发布时间",
  381. dataIndex: "releaseTimeConvert",
  382. key: "releaseTimeConvert"
  383. }
  384. ],
  385. //数据列表
  386. dataSource: []
  387. };
  388. },
  389. // 新增新闻按钮
  390. add() {
  391. this.setState({
  392. editvisible: true,
  393. flag: false
  394. });
  395. },
  396. nextStep() {
  397. if (!this.state.locations || this.state.locations.length === 0) {
  398. message.warning('请选择公司');
  399. return;
  400. }
  401. $.ajax({
  402. method: "post",
  403. dataType: "json",
  404. crossDomain: false,
  405. url: globalConfig.context + "/api/admin/news/addNews",
  406. data: {
  407. title: this.state.title, // 新闻标题
  408. publisher: this.state.publisher, // 新闻发布人
  409. type: this.state.type, // 新闻分类
  410. sort: this.state.sort, //
  411. locations: this.state.locations.join(','), // 发布公司
  412. releaseStatus: 0, // 保存
  413. status: 0,
  414. releaseTimes: this.state.time
  415. },
  416. success: function (data) {
  417. if (data.error && data.error.length) {
  418. message.warning(data.error[0].message);
  419. } else {
  420. // message.success('操作成功');
  421. this.setState({
  422. step: 1,
  423. id: data.data.id,
  424. })
  425. }
  426. }.bind(this)
  427. }).always(
  428. function () {
  429. this.setState({
  430. loading: false
  431. });
  432. }.bind(this)
  433. );
  434. },
  435. // 推荐置顶
  436. toTop(record, num) {
  437. $.ajax({
  438. method: "post",
  439. dataType: "json",
  440. crossDomain: false,
  441. url: globalConfig.context + "/api/admin/news/updateNews",
  442. data: {
  443. id: record.id,
  444. status: num
  445. },
  446. success: function (data) {
  447. let theArr = [];
  448. if (data.error && data.error.length) {
  449. message.warning(data.error[0].message);
  450. } else {
  451. this.loadData();
  452. }
  453. }.bind(this)
  454. }).always(
  455. function () {
  456. this.setState({
  457. loading: false
  458. });
  459. }.bind(this)
  460. );
  461. },
  462. //编辑按钮操作
  463. tableRowClick(record) {
  464. this.setState({
  465. editvisible: true,
  466. flag: true,
  467. }, () => {
  468. this.edit(record);
  469. });
  470. },
  471. edit(record, index) {
  472. this.setState({
  473. editvisible: true,
  474. loading: true
  475. });
  476. $.ajax({
  477. method: "get",
  478. dataType: "json",
  479. crossDomain: false,
  480. url: globalConfig.context + "/api/admin/news/selectNews",
  481. data: {
  482. id: record.id
  483. },
  484. success: function (data) {
  485. let theArr = [];
  486. if (data.error && data.error.length) {
  487. message.warning(data.error[0].message);
  488. } else {
  489. let thisdata = data.data;
  490. this.setState({
  491. id: thisdata.id,
  492. title: thisdata.title,
  493. publisher: thisdata.publisher,
  494. type: thisdata.type,
  495. pictureUrl: thisdata.pictureUrl
  496. ? splitUrl(
  497. thisdata.pictureUrl,
  498. ",",
  499. globalConfig.avatarUploadHost
  500. )
  501. : [],
  502. sort: thisdata.sort,
  503. checked: thisdata.locations.length === companyList.length,
  504. indeterminate: thisdata.locations.length < companyList.length,
  505. locations: thisdata.locations,
  506. editorcontext: thisdata.content,
  507. releaseStatus: thisdata.releaseStatus,
  508. time: thisdata.releaseTimeConvert
  509. ? thisdata.releaseTimeConvert
  510. : thisdata.createTimeConvert
  511. });
  512. window.setTimeout(() => {
  513. console.log(this.state);
  514. }, 100);
  515. }
  516. }.bind(this)
  517. }).always(
  518. function () {
  519. this.setState({
  520. loading: false
  521. });
  522. }.bind(this)
  523. );
  524. },
  525. getOrgCodeUrl(e) {
  526. this.setState({ pictureUrl: e });
  527. },
  528. // 新增新闻
  529. addNew(flag) {
  530. if (!this.state.locations || this.state.locations.length === 0) {
  531. message.warning('请选择公司');
  532. return;
  533. }
  534. if (!this.state.pictureUrl || this.state.pictureUrl.length === 0) {
  535. message.warning('请选择新闻大图');
  536. return;
  537. }
  538. $.ajax({
  539. method: "post",
  540. dataType: "json",
  541. crossDomain: false,
  542. url: globalConfig.context + "/api/admin/news/updateNews",
  543. data: {
  544. id: this.state.id,
  545. title: this.state.title,
  546. publisher: this.state.publisher,
  547. type: this.state.type,
  548. pictureUrl: this.state.pictureUrl && this.state.pictureUrl[0]
  549. ? this.state.pictureUrl[0].response.data
  550. : undefined,
  551. sort: this.state.sort,
  552. locations: this.state.locations.join(','),
  553. content: this.state.editorcontext,
  554. status: this.state.status,
  555. releaseTimes: this.state.time,
  556. releaseStatus: flag
  557. },
  558. success: function (data) {
  559. let theArr = [];
  560. if (data.error && data.error.length) {
  561. message.warning(data.error[0].message);
  562. } else {
  563. message.success('操作成功');
  564. this.loadData();
  565. this.handleCancelEdit();
  566. }
  567. }.bind(this)
  568. }).always(
  569. function () {
  570. this.setState({
  571. loading: false
  572. });
  573. }.bind(this)
  574. );
  575. },
  576. //表单内容改变时候触发
  577. change(key, e, f) {
  578. if (f === undefined) {
  579. this.state.totalData[key] = e;
  580. this.setState({
  581. totalData: this.state.totalData
  582. });
  583. } else if (typeof f === "function") {
  584. this.state.totalData[key] = e;
  585. this.setState(
  586. {
  587. totalData: this.state.totalData
  588. },
  589. f
  590. );
  591. }
  592. },
  593. // 关闭模态框
  594. handleCancelEdit() {
  595. this.setState({
  596. editvisible: false
  597. });
  598. this.addReset();
  599. },
  600. //点击大图
  601. maximg(url) {
  602. this.setState({
  603. imgeditvisible: true,
  604. maximg: url
  605. });
  606. },
  607. componentWillMount() {
  608. this.loadData();
  609. },
  610. //确认要删除吗
  611. confirm(id) {
  612. $.ajax({
  613. method: "post",
  614. dataType: "json",
  615. crossDomain: false,
  616. url: globalConfig.context + "/api/admin/news/deleteNews",
  617. data: {
  618. id
  619. },
  620. success: function (data) {
  621. let theArr = [];
  622. if (data.error && data.error.length) {
  623. message.warning(data.error[0].message);
  624. } else {
  625. this.loadData();
  626. }
  627. }.bind(this)
  628. }).always(
  629. function () {
  630. this.setState({
  631. loading: false
  632. });
  633. }.bind(this)
  634. );
  635. },
  636. imghandleCancel() {
  637. this.setState({
  638. imgeditvisible: false
  639. });
  640. },
  641. //取消删除
  642. cancel() {
  643. console.log("我取消删除了");
  644. },
  645. async submitContent() {
  646. // 在编辑器获得焦点时按下ctrl+s会执行此方法
  647. // 编辑器内容提交到服务端之前,可直接调用editorState.toHTML()来获取HTML格式的内容
  648. const htmlContent = this.state.editorState.toHTML();
  649. const result = await saveEditorContent(htmlContent);
  650. },
  651. //新增框的清零
  652. addReset() {
  653. this.setState({
  654. pictureUrl: [],
  655. title: undefined,
  656. publisher: undefined,
  657. type: undefined,
  658. sort: undefined,
  659. locations: [],
  660. editorcontext: "",
  661. time: undefined,
  662. indeterminate: false,
  663. checked: false,
  664. });
  665. },
  666. //搜索部分的清零
  667. reset() {
  668. this.setState({
  669. locationSearch: '',
  670. titleSearch: undefined,
  671. }, () => {
  672. this.loadData();
  673. })
  674. },
  675. render() {
  676. const FormItem = Form.Item;
  677. const rowSelection = {
  678. selectedRowKeys: this.state.selectedRowKeys,
  679. onChange: (selectedRowKeys, selectedRows) => {
  680. this.setState({
  681. selectedRows: selectedRows.slice(-1),
  682. selectedRowKeys: selectedRowKeys.slice(-1)
  683. });
  684. }
  685. };
  686. let data = this.state.totalData;
  687. const { TextArea } = Input; //文本域
  688. const { TabPane } = Tabs; //标签页
  689. const { MonthPicker, RangePicker, WeekPicker } = DatePicker; //日期输入框
  690. const { editorState } = this.state;
  691. return (
  692. <div className="user-content">
  693. <div className="content-title">
  694. <span>新闻列表</span>
  695. <div className="user-search">
  696. <Input
  697. placeholder="请输入新闻标题"
  698. style={{
  699. width: "150px",
  700. marginRight: "10px",
  701. marginBottom: "10px"
  702. }}
  703. value={this.state.titleSearch}
  704. onChange={e => {
  705. this.setState({ titleSearch: e.target.value });
  706. }}
  707. />
  708. <Select
  709. placeholder="请选择公司"
  710. style={{ width: 150 }}
  711. value={this.state.locationSearch}
  712. onChange={e => {
  713. this.setState({
  714. locationSearch: e
  715. });
  716. }}
  717. >
  718. {
  719. companyList.map((v) => (
  720. <Select.Option key={v.value} value={v.value}>{v.label}</Select.Option>
  721. ))
  722. }
  723. </Select>
  724. <Button
  725. type="primary"
  726. onClick={e => {
  727. this.loadData();
  728. }}
  729. style={{ marginRight: "10px" }}
  730. >
  731. 搜索
  732. </Button>
  733. <Button onClick={this.reset} style={{ marginRight: "10px" }}>
  734. 重置
  735. </Button>
  736. <Button
  737. type="primary"
  738. onClick={this.add}
  739. style={{ marginLeft: "100px" }}
  740. >
  741. 新增新闻
  742. </Button>
  743. </div>
  744. {/* 新闻表单 */}
  745. <div className="patent-table">
  746. <SpinContainer spinning={this.state.loading}>
  747. <Table
  748. columns={this.state.columns}
  749. dataSource={this.state.dataSource}
  750. pagination={this.state.pagination}
  751. onRowClick={this.tableRowClick}
  752. bordered
  753. size="small"
  754. ellipsis="true"
  755. />
  756. </SpinContainer>
  757. </div>
  758. </div>
  759. {/* 模块框 */}
  760. <div className="patent-desc">
  761. <Modal
  762. className="customeDetails"
  763. title={this.state.flag ? "新闻详情" : "新增新闻"}
  764. width="1000px"
  765. maskClosable={false}
  766. onCancel={this.handleCancelEdit}
  767. visible={this.state.editvisible}
  768. footer=""
  769. >
  770. <SpinContainer spinning={this.state.loading}>
  771. <div className="clearfix">
  772. <FormItem
  773. className="half-item"
  774. labelCol={{ span: 8 }}
  775. wrapperCol={{ span: 12 }}
  776. label="新闻标题"
  777. >
  778. <Input
  779. placeholder="请输入新闻标题"
  780. value={this.state.title}
  781. onChange={e => {
  782. this.setState({
  783. title: e.target.value
  784. });
  785. }}
  786. style={{ width: "240px" }}
  787. />
  788. </FormItem>
  789. <FormItem
  790. className="half-item"
  791. labelCol={{ span: 8 }}
  792. wrapperCol={{ span: 12 }}
  793. label="新闻类别"
  794. >
  795. <Select
  796. style={{ width: 120 }}
  797. placeholder="请选择新闻类型"
  798. value={
  799. this.state.type == 1
  800. ? "行业新闻"
  801. : this.state.type == 0
  802. ? "公司新闻"
  803. : []
  804. }
  805. onChange={e => {
  806. this.setState({
  807. type: e
  808. });
  809. }}
  810. >
  811. <Option value="0">公司新闻</Option>
  812. <Option value="1">行业新闻</Option>
  813. </Select>
  814. </FormItem>
  815. <FormItem
  816. className="half-item"
  817. labelCol={{ span: 8 }}
  818. wrapperCol={{ span: 12 }}
  819. label="新闻发布人"
  820. >
  821. <Input
  822. placeholder="请输入新闻发布人"
  823. value={this.state.publisher}
  824. onChange={e => {
  825. this.setState({
  826. publisher: e.target.value
  827. });
  828. }}
  829. style={{ width: "240px" }}
  830. />
  831. </FormItem>
  832. <FormItem
  833. className="half-item"
  834. labelCol={{ span: 8 }}
  835. wrapperCol={{ span: 12 }}
  836. label="发布时间"
  837. >
  838. <DatePicker
  839. placeholder="请输入发布时间"
  840. format="YYYY-MM-DD HH:mm:ss"
  841. showTime
  842. value={this.state.time ? moment(this.state.time) : null}
  843. onChange={(e, f) => {
  844. this.setState({ time: f });
  845. }}
  846. style={{ width: "240px" }}
  847. />
  848. </FormItem>
  849. <FormItem
  850. className="half-item"
  851. labelCol={{ span: 8 }}
  852. wrapperCol={{ span: 12 }}
  853. label="排序"
  854. >
  855. <Input
  856. placeholder="请输入排序"
  857. value={this.state.sort}
  858. onChange={e => {
  859. this.setState({
  860. sort: e.target.value
  861. });
  862. }}
  863. style={{ width: "240px" }}
  864. />
  865. </FormItem>
  866. <FormItem
  867. className="half-item"
  868. labelCol={{ span: 8 }}
  869. wrapperCol={{ span: 12 }}
  870. label="公司"
  871. >
  872. <Checkbox indeterminate={this.state.indeterminate} checked={this.state.checked} onChange={(e) => {
  873. this.setState({
  874. locations: e.target.checked ? getCompanyValueArray() : [],
  875. indeterminate: false,
  876. checked: e.target.checked
  877. })
  878. }}>全选</Checkbox>
  879. <Checkbox.Group
  880. options={companyList}
  881. value={this.state.locations}
  882. onChange={(e) => {
  883. this.setState({
  884. locations: e,
  885. indeterminate: companyList.length > e.length,
  886. checked: companyList.length === e.length
  887. });
  888. }}
  889. />
  890. </FormItem>
  891. </div>
  892. {
  893. !this.state.flag && this.state.step == 0 &&
  894. <div className="clearfix" style={{ display: "flex", justifyContent: "center" }}>
  895. <Button
  896. type="primary"
  897. size="large"
  898. onClick={e => {
  899. this.nextStep(0);
  900. }}
  901. style={{
  902. margin: "20px auto"
  903. }}
  904. >
  905. 下一步
  906. </Button>
  907. </div>
  908. }
  909. {
  910. ((!this.state.flag && this.state.step == 1) || this.state.flag) &&
  911. <div>
  912. <div className="clearfix">
  913. <FormItem
  914. labelCol={{ span: 4 }}
  915. wrapperCol={{ span: 18 }}
  916. onCancel={this.handleCancel}
  917. label="新闻大图"
  918. >
  919. <PicturesWall
  920. id={this.state.id}
  921. fileList={this.getOrgCodeUrl}
  922. pictureUrl={this.state.pictureUrl}
  923. />
  924. <p>建议尺寸:345X200 图片建议:要清晰。</p>
  925. </FormItem>
  926. </div>
  927. <div className="clearfix">
  928. <FormItem
  929. labelCol={{ span: 4 }}
  930. wrapperCol={{ span: 18 }}
  931. label="企业简介"
  932. >
  933. <Editors
  934. textContent={this.state.editorcontext}
  935. uploadUrl={"/api/admin/news/uploadFile"}
  936. uploadId={this.state.id}
  937. globalConfig={globalConfig.uploadPath}
  938. placeholder="业务项目客户基本条件"
  939. handleRichText={value => {
  940. this.setState({ editorcontext: value });
  941. }}
  942. />
  943. </FormItem>
  944. </div>
  945. <div className="clearfix">
  946. <Button
  947. type="primary"
  948. size="large"
  949. onClick={e => {
  950. this.addNew(0);
  951. }}
  952. style={{
  953. float: "right",
  954. marginRight: "80px",
  955. marginTop: "20px"
  956. }}
  957. >
  958. 保存
  959. </Button>
  960. <Button
  961. type="primary"
  962. size="large"
  963. onClick={e => {
  964. this.addNew(1);
  965. }}
  966. style={{
  967. float: "right",
  968. marginRight: "20px",
  969. marginTop: "20px"
  970. }}
  971. >
  972. 保存并发布
  973. </Button>
  974. </div>
  975. </div>
  976. }
  977. </SpinContainer>
  978. </Modal>
  979. <Modal
  980. visible={this.state.imgeditvisible}
  981. onCancel={this.imghandleCancel}
  982. onOk={this.imgOk}
  983. >
  984. <img style={{ width: "100%" }} src={this.state.maximg} />
  985. </Modal>
  986. </div>
  987. </div>
  988. );
  989. }
  990. })
  991. );
  992. export default FirmList;