firmList.jsx 28 KB

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