firmList.jsx 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933
  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. width:150,
  254. render: r => {
  255. let text = '';
  256. r && r.map((v,i)=>(
  257. text += (i === 0 ? '':',')+getCompanyName(v)
  258. ))
  259. return(
  260. <Tooltip placement="top" title={text}>
  261. {
  262. r && r.map((v,i)=>(
  263. i <= 2 ? (i === 0 ? '':',')+getCompanyName(v) : null
  264. ))
  265. }
  266. {
  267. r.length > 3 ? '.....' : null
  268. }
  269. </Tooltip>
  270. )
  271. }
  272. },
  273. {
  274. title: "发布状态",
  275. dataIndex: "releaseStatus",
  276. key: "releaseStatus",
  277. render: text => {
  278. return text ? "是" : "否";
  279. }
  280. },
  281. // {
  282. // title: "置顶",
  283. // dataIndex: "topNumber",
  284. // key: "topNumber",
  285. // render: text => {
  286. // return text ? "否" : "是";
  287. // }
  288. // },
  289. {
  290. title: "操作",
  291. dataIndex: "operate",
  292. key: "operate",
  293. render: (text, record, index) => {
  294. return (
  295. <div>
  296. <Button
  297. type="primary"
  298. style={{ marginLeft: "10px" }}
  299. onClick={() => {
  300. this.setState({
  301. flag: true
  302. });
  303. this.edit(record);
  304. }}
  305. >
  306. 编辑
  307. </Button>
  308. <Popconfirm
  309. title="您确定删除该新闻吗?"
  310. onConfirm={() => this.confirm(record.id)}
  311. onCancel={this.cancel}
  312. okText="是"
  313. cancelText="否"
  314. >
  315. <Button
  316. type="danger"
  317. style={{ marginLeft: "10px" }}
  318. onClick={e => {
  319. e.stopPropagation();
  320. }}
  321. >
  322. 删除
  323. </Button>
  324. </Popconfirm>
  325. <Button
  326. type="primary"
  327. style={{ marginLeft: "10px" }}
  328. onClick={e => {
  329. e.stopPropagation();
  330. if (record.status) {
  331. this.toTop(record, 0);
  332. } else {
  333. this.toTop(record, 1);
  334. }
  335. }}
  336. >
  337. {record.status ? "从首页撤下" : "推荐至首页"}
  338. </Button>
  339. </div>
  340. );
  341. }
  342. },
  343. {
  344. title: "发布时间",
  345. dataIndex: "releaseTimeConvert",
  346. key: "releaseTimeConvert"
  347. }
  348. ],
  349. //数据列表
  350. dataSource: []
  351. };
  352. },
  353. // 新增新闻按钮
  354. add() {
  355. this.setState({
  356. editvisible: true,
  357. flag: false
  358. });
  359. },
  360. // 推荐置顶
  361. toTop(record, num) {
  362. $.ajax({
  363. method: "post",
  364. dataType: "json",
  365. crossDomain: false,
  366. url: globalConfig.context + "/api/admin/news/updateNews",
  367. data: {
  368. id: record.id,
  369. status: num
  370. },
  371. success: function(data) {
  372. let theArr = [];
  373. if (data.error && data.error.length) {
  374. message.warning(data.error[0].message);
  375. } else {
  376. this.loadData();
  377. }
  378. }.bind(this)
  379. }).always(
  380. function() {
  381. this.setState({
  382. loading: false
  383. });
  384. }.bind(this)
  385. );
  386. },
  387. //编辑按钮操作
  388. tableRowClick(record) {
  389. this.setState({
  390. editvisible: true,
  391. flag: true,
  392. },()=>{
  393. this.edit(record);
  394. });
  395. },
  396. edit(record, index) {
  397. this.setState({
  398. editvisible: true,
  399. loading: true
  400. });
  401. $.ajax({
  402. method: "get",
  403. dataType: "json",
  404. crossDomain: false,
  405. url: globalConfig.context + "/api/admin/news/selectNews",
  406. data: {
  407. id: record.id
  408. },
  409. success: function(data) {
  410. let theArr = [];
  411. if (data.error && data.error.length) {
  412. message.warning(data.error[0].message);
  413. } else {
  414. let thisdata = data.data;
  415. this.setState({
  416. id: thisdata.id,
  417. title: thisdata.title,
  418. publisher: thisdata.publisher,
  419. type: thisdata.type,
  420. pictureUrl: thisdata.pictureUrl
  421. ? splitUrl(
  422. thisdata.pictureUrl,
  423. ",",
  424. globalConfig.avatarUploadHost
  425. )
  426. : [],
  427. sort: thisdata.sort,
  428. checked:thisdata.locations.length === companyList.length,
  429. indeterminate: thisdata.locations.length < companyList.length,
  430. locations: thisdata.locations,
  431. editorcontext: thisdata.content,
  432. releaseStatus: thisdata.releaseStatus,
  433. time: thisdata.releaseTimeConvert
  434. ? thisdata.releaseTimeConvert
  435. : thisdata.createTimeConvert
  436. });
  437. window.setTimeout(() => {
  438. console.log(this.state);
  439. }, 100);
  440. }
  441. }.bind(this)
  442. }).always(
  443. function() {
  444. this.setState({
  445. loading: false
  446. });
  447. }.bind(this)
  448. );
  449. },
  450. getOrgCodeUrl(e) {
  451. this.setState({ pictureUrl: e });
  452. },
  453. // 新增新闻
  454. addNew(flag) {
  455. if(!this.state.locations || this.state.locations.length === 0 ){
  456. message.warning('请选择公司');
  457. return ;
  458. }
  459. if(!this.state.pictureUrl || this.state.pictureUrl.length === 0){
  460. message.warning('请选择新闻大图');
  461. return ;
  462. }
  463. if (this.state.flag) {
  464. $.ajax({
  465. method: "post",
  466. dataType: "json",
  467. crossDomain: false,
  468. url: globalConfig.context + "/api/admin/news/updateNews",
  469. data: {
  470. id: this.state.id,
  471. title: this.state.title,
  472. publisher: this.state.publisher,
  473. type: this.state.type,
  474. pictureUrl: this.state.pictureUrl
  475. ? this.state.pictureUrl[0].response.data
  476. : undefined,
  477. sort: this.state.sort,
  478. locations: this.state.locations.join(','),
  479. content: this.state.editorcontext,
  480. status: this.state.status,
  481. releaseTimes: this.state.time,
  482. releaseStatus: flag
  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. message.success('操作成功');
  490. this.loadData();
  491. this.handleCancelEdit();
  492. }
  493. }.bind(this)
  494. }).always(
  495. function() {
  496. this.setState({
  497. loading: false
  498. });
  499. }.bind(this)
  500. );
  501. } else {
  502. $.ajax({
  503. method: "post",
  504. dataType: "json",
  505. crossDomain: false,
  506. url: globalConfig.context + "/api/admin/news/addNews",
  507. data: {
  508. title: this.state.title,
  509. publisher: this.state.publisher,
  510. type: this.state.type,
  511. pictureUrl: this.state.pictureUrl[0].response.data,
  512. sort: this.state.sort,
  513. locations: this.state.locations.join(','),
  514. content: this.state.editorcontext,
  515. releaseStatus: flag,
  516. status: 0,
  517. releaseTimes: this.state.time
  518. },
  519. success: function(data) {
  520. if (data.error && data.error.length) {
  521. message.warning(data.error[0].message);
  522. } else {
  523. message.success('操作成功');
  524. this.loadData();
  525. this.handleCancelEdit();
  526. }
  527. }.bind(this)
  528. }).always(
  529. function() {
  530. this.setState({
  531. loading: false
  532. });
  533. }.bind(this)
  534. );
  535. }
  536. },
  537. //表单内容改变时候触发
  538. change(key, e, f) {
  539. if (f === undefined) {
  540. this.state.totalData[key] = e;
  541. this.setState({
  542. totalData: this.state.totalData
  543. });
  544. } else if (typeof f === "function") {
  545. this.state.totalData[key] = e;
  546. this.setState(
  547. {
  548. totalData: this.state.totalData
  549. },
  550. f
  551. );
  552. }
  553. },
  554. // 关闭模态框
  555. handleCancelEdit() {
  556. this.setState({
  557. editvisible: false
  558. });
  559. this.addReset();
  560. },
  561. //点击大图
  562. maximg(url) {
  563. this.setState({
  564. imgeditvisible: true,
  565. maximg: url
  566. });
  567. },
  568. componentWillMount() {
  569. this.loadData();
  570. },
  571. //确认要删除吗
  572. confirm(id) {
  573. $.ajax({
  574. method: "post",
  575. dataType: "json",
  576. crossDomain: false,
  577. url: globalConfig.context + "/api/admin/news/deleteNews",
  578. data: {
  579. id
  580. },
  581. success: function(data) {
  582. let theArr = [];
  583. if (data.error && data.error.length) {
  584. message.warning(data.error[0].message);
  585. } else {
  586. this.loadData();
  587. }
  588. }.bind(this)
  589. }).always(
  590. function() {
  591. this.setState({
  592. loading: false
  593. });
  594. }.bind(this)
  595. );
  596. },
  597. imghandleCancel() {
  598. this.setState({
  599. imgeditvisible: false
  600. });
  601. },
  602. //取消删除
  603. cancel() {
  604. console.log("我取消删除了");
  605. },
  606. async submitContent() {
  607. // 在编辑器获得焦点时按下ctrl+s会执行此方法
  608. // 编辑器内容提交到服务端之前,可直接调用editorState.toHTML()来获取HTML格式的内容
  609. const htmlContent = this.state.editorState.toHTML();
  610. const result = await saveEditorContent(htmlContent);
  611. },
  612. //新增框的清零
  613. addReset() {
  614. this.setState({
  615. pictureUrl: [],
  616. title: undefined,
  617. publisher: undefined,
  618. type: undefined,
  619. sort: undefined,
  620. locations: [],
  621. editorcontext: "",
  622. time: undefined,
  623. indeterminate: false,
  624. checked:false,
  625. });
  626. },
  627. //搜索部分的清零
  628. reset() {
  629. this.setState({
  630. locationSearch: '',
  631. titleSearch: undefined,
  632. },()=>{
  633. this.loadData();
  634. })
  635. },
  636. render() {
  637. const FormItem = Form.Item;
  638. const rowSelection = {
  639. selectedRowKeys: this.state.selectedRowKeys,
  640. onChange: (selectedRowKeys, selectedRows) => {
  641. this.setState({
  642. selectedRows: selectedRows.slice(-1),
  643. selectedRowKeys: selectedRowKeys.slice(-1)
  644. });
  645. }
  646. };
  647. let data = this.state.totalData;
  648. const { TextArea } = Input; //文本域
  649. const { TabPane } = Tabs; //标签页
  650. const { MonthPicker, RangePicker, WeekPicker } = DatePicker; //日期输入框
  651. const { editorState } = this.state;
  652. return (
  653. <div className="user-content">
  654. <div className="content-title">
  655. <span>新闻列表</span>
  656. <div className="user-search">
  657. <Input
  658. placeholder="请输入新闻标题"
  659. style={{
  660. width: "150px",
  661. marginRight: "10px",
  662. marginBottom: "10px"
  663. }}
  664. value={this.state.titleSearch}
  665. onChange={e => {
  666. this.setState({ titleSearch: e.target.value });
  667. }}
  668. />
  669. <Select
  670. placeholder="请选择公司"
  671. style={{ width: 150 }}
  672. value={this.state.locationSearch}
  673. onChange={e => {
  674. this.setState({
  675. locationSearch: e
  676. });
  677. }}
  678. >
  679. {
  680. companyList.map((v)=>(
  681. <Select.Option key={v.value} value={v.value}>{v.label}</Select.Option>
  682. ))
  683. }
  684. </Select>
  685. <Button
  686. type="primary"
  687. onClick={e => {
  688. this.loadData();
  689. }}
  690. style={{ marginRight: "10px" }}
  691. >
  692. 搜索
  693. </Button>
  694. <Button onClick={this.reset} style={{ marginRight: "10px" }}>
  695. 重置
  696. </Button>
  697. <Button
  698. type="primary"
  699. onClick={this.add}
  700. style={{ marginLeft: "100px" }}
  701. >
  702. 新增新闻
  703. </Button>
  704. </div>
  705. {/* 新闻表单 */}
  706. <div className="patent-table">
  707. <SpinContainer spinning={this.state.loading}>
  708. <Table
  709. columns={this.state.columns}
  710. dataSource={this.state.dataSource}
  711. pagination={this.state.pagination}
  712. onRowClick={this.tableRowClick}
  713. bordered
  714. size="small"
  715. ellipsis="true"
  716. />
  717. </SpinContainer>
  718. </div>
  719. </div>
  720. {/* 模块框 */}
  721. <div className="patent-desc">
  722. <Modal
  723. className="customeDetails"
  724. title={this.state.flag ? "新闻详情" : "新增新闻"}
  725. width="1000px"
  726. onCancel={this.handleCancelEdit}
  727. visible={this.state.editvisible}
  728. footer=""
  729. >
  730. <SpinContainer spinning={this.state.loading}>
  731. <div className="clearfix">
  732. <FormItem
  733. className="half-item"
  734. labelCol={{ span: 8 }}
  735. wrapperCol={{ span: 12 }}
  736. label="新闻标题"
  737. >
  738. <Input
  739. placeholder="请输入新闻标题"
  740. value={this.state.title}
  741. onChange={e => {
  742. this.setState({
  743. title: e.target.value
  744. });
  745. }}
  746. style={{ width: "240px" }}
  747. />
  748. </FormItem>
  749. <FormItem
  750. className="half-item"
  751. labelCol={{ span: 8 }}
  752. wrapperCol={{ span: 12 }}
  753. label="新闻类别"
  754. >
  755. <Select
  756. style={{ width: 120 }}
  757. placeholder="请选择新闻类型"
  758. value={
  759. this.state.type == 1
  760. ? "行业新闻"
  761. : this.state.type == 0
  762. ? "公司新闻"
  763. : []
  764. }
  765. onChange={e => {
  766. this.setState({
  767. type: e
  768. });
  769. }}
  770. >
  771. <Option value="0">公司新闻</Option>
  772. <Option value="1">行业新闻</Option>
  773. </Select>
  774. </FormItem>
  775. <FormItem
  776. className="half-item"
  777. labelCol={{ span: 8 }}
  778. wrapperCol={{ span: 12 }}
  779. label="新闻发布人"
  780. >
  781. <Input
  782. placeholder="请输入新闻发布人"
  783. value={this.state.publisher}
  784. onChange={e => {
  785. this.setState({
  786. publisher: e.target.value
  787. });
  788. }}
  789. style={{ width: "240px" }}
  790. />
  791. </FormItem>
  792. <FormItem
  793. className="half-item"
  794. labelCol={{ span: 8 }}
  795. wrapperCol={{ span: 12 }}
  796. label="发布时间"
  797. >
  798. <DatePicker
  799. placeholder="请输入发布时间"
  800. format="YYYY-MM-DD HH:mm:ss"
  801. showTime
  802. value={this.state.time ? moment(this.state.time) : null}
  803. onChange={(e, f) => {
  804. this.setState({ time: f });
  805. console.log(e, f);
  806. }}
  807. style={{ width: "240px" }}
  808. />
  809. </FormItem>
  810. <FormItem
  811. className="half-item"
  812. labelCol={{ span: 8 }}
  813. wrapperCol={{ span: 12 }}
  814. label="排序"
  815. >
  816. <Input
  817. placeholder="请输入排序"
  818. value={this.state.sort}
  819. onChange={e => {
  820. this.setState({
  821. sort: e.target.value
  822. });
  823. }}
  824. style={{ width: "240px" }}
  825. />
  826. </FormItem>
  827. <FormItem
  828. className="half-item"
  829. labelCol={{ span: 8 }}
  830. wrapperCol={{ span: 12 }}
  831. label="公司"
  832. >
  833. <Checkbox indeterminate={this.state.indeterminate} checked={this.state.checked} onChange={(e)=>{
  834. this.setState({
  835. locations: e.target.checked ? getCompanyValueArray():[],
  836. indeterminate: false,
  837. checked:e.target.checked
  838. })
  839. }}>全选</Checkbox>
  840. <Checkbox.Group
  841. options={companyList}
  842. value={this.state.locations}
  843. onChange={(e) => {
  844. this.setState({
  845. locations: e,
  846. indeterminate: companyList.length > e.length,
  847. checked: companyList.length === e.length
  848. });
  849. }}
  850. />
  851. </FormItem>
  852. </div>
  853. <div className="clearfix">
  854. <FormItem
  855. labelCol={{ span: 4 }}
  856. wrapperCol={{ span: 18 }}
  857. onCancel={this.handleCancel}
  858. label="新闻大图"
  859. >
  860. <PicturesWall
  861. fileList={this.getOrgCodeUrl}
  862. pictureUrl={this.state.pictureUrl}
  863. />
  864. <p>建议尺寸:345X200 图片建议:要清晰。</p>
  865. </FormItem>
  866. </div>
  867. <div className="clearfix">
  868. <FormItem
  869. labelCol={{ span: 4 }}
  870. wrapperCol={{ span: 18 }}
  871. label="企业简介"
  872. >
  873. <Editors
  874. textContent={this.state.editorcontext}
  875. uploadUrl={"/api/admin/news/uploadFile"}
  876. globalConfig={globalConfig.uploadPath}
  877. placeholder="业务项目客户基本条件"
  878. handleRichText={value => {
  879. this.setState({ editorcontext: value });
  880. }}
  881. />
  882. </FormItem>
  883. </div>
  884. <div className="clearfix">
  885. <Button
  886. type="primary"
  887. size="large"
  888. onClick={e => {
  889. this.addNew(0);
  890. }}
  891. style={{
  892. float: "right",
  893. marginRight: "80px",
  894. marginTop: "20px"
  895. }}
  896. >
  897. 保存
  898. </Button>
  899. <Button
  900. type="primary"
  901. size="large"
  902. onClick={e => {
  903. this.addNew(1);
  904. }}
  905. style={{
  906. float: "right",
  907. marginRight: "20px",
  908. marginTop: "20px"
  909. }}
  910. >
  911. 保存并发布
  912. </Button>
  913. </div>
  914. </SpinContainer>
  915. </Modal>
  916. <Modal
  917. visible={this.state.imgeditvisible}
  918. onCancel={this.imghandleCancel}
  919. onOk={this.imgOk}
  920. >
  921. <img style={{ width: "100%" }} src={this.state.maximg} />
  922. </Modal>
  923. </div>
  924. </div>
  925. );
  926. }
  927. })
  928. );
  929. export default FirmList;