firmList.jsx 28 KB

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