|
@@ -20,7 +20,7 @@ import {
|
|
|
Radio,
|
|
|
TimePicker,
|
|
|
Tabs,
|
|
|
- Tag
|
|
|
+ Tag, Checkbox
|
|
|
} from "antd";
|
|
|
import { areaSelect, getProvince } from "@/NewDicProvinceList"; //省市区
|
|
|
import {
|
|
@@ -33,7 +33,8 @@ import {
|
|
|
getPicPath
|
|
|
} from "@/tools.js";
|
|
|
import Editors from "@/richTextEditors";
|
|
|
-import SpinContainer from "../../SpinContainer"; //富文本编辑器
|
|
|
+import SpinContainer from "../../SpinContainer";
|
|
|
+import {companyList, getCompanyName, getCompanyValueArray} from "../../common/configure"; //富文本编辑器
|
|
|
|
|
|
// 上传文件
|
|
|
const PicturesWall = React.createClass({
|
|
@@ -41,7 +42,9 @@ const PicturesWall = React.createClass({
|
|
|
return {
|
|
|
previewVisible: false,
|
|
|
previewImage: "",
|
|
|
- fileList: this.props.pictureUrl
|
|
|
+ fileList: this.props.pictureUrl,
|
|
|
+ locations: [],
|
|
|
+ indeterminate: false,
|
|
|
};
|
|
|
},
|
|
|
getDefaultProps() {
|
|
@@ -64,8 +67,6 @@ const PicturesWall = React.createClass({
|
|
|
this.props.fileList(fileList);
|
|
|
},
|
|
|
componentWillReceiveProps(nextProps) {
|
|
|
- this.state.fileList = nextProps.pictureUrl;
|
|
|
- console.log(nextProps.pictureUrl);
|
|
|
},
|
|
|
render() {
|
|
|
const { previewVisible, previewImage, fileList } = this.state;
|
|
@@ -124,7 +125,8 @@ const FirmList = Form.create()(
|
|
|
data: {
|
|
|
pageNo: pageNo || this.state.pagination.current || 1,
|
|
|
pageSize: this.state.pagination.pageSize,
|
|
|
- title: this.state.titleSearch
|
|
|
+ title: this.state.titleSearch,
|
|
|
+ location: this.state.locationSearch,
|
|
|
},
|
|
|
success: function(data) {
|
|
|
let theArr = [];
|
|
@@ -135,19 +137,8 @@ const FirmList = Form.create()(
|
|
|
} else {
|
|
|
for (let i = 0; i < data.data.list.length; i++) {
|
|
|
let thisdata = data.data.list[i];
|
|
|
- theArr.push({
|
|
|
- key: i + 1,
|
|
|
- id: thisdata.id,
|
|
|
- title: thisdata.title,
|
|
|
- publisher: thisdata.publisher,
|
|
|
- type: thisdata.type,
|
|
|
- pictureUrl: thisdata.pictureUrl,
|
|
|
- sort: thisdata.sort,
|
|
|
- releaseStatus: thisdata.releaseStatus,
|
|
|
- releaseTimeConvert: thisdata.releaseTimeConvert,
|
|
|
- status: thisdata.status,
|
|
|
- content: thisdata.content
|
|
|
- });
|
|
|
+ thisdata.key = i + 1
|
|
|
+ theArr.push(thisdata);
|
|
|
}
|
|
|
this.state.pagination.current = data.data.pageNo;
|
|
|
this.state.pagination.total = data.data.totalCount;
|
|
@@ -263,6 +254,18 @@ const FirmList = Form.create()(
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
+ title: "公司",
|
|
|
+ dataIndex: "locations",
|
|
|
+ key: "locations",
|
|
|
+ render: r => {
|
|
|
+ return(
|
|
|
+ r && r.map((v)=>(
|
|
|
+ <Tag>{getCompanyName(v)}</Tag>
|
|
|
+ ))
|
|
|
+ )
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
title: "发布状态",
|
|
|
dataIndex: "releaseStatus",
|
|
|
key: "releaseStatus",
|
|
@@ -379,9 +382,11 @@ const FirmList = Form.create()(
|
|
|
//编辑按钮操作
|
|
|
tableRowClick(record) {
|
|
|
this.setState({
|
|
|
- editvisible: true
|
|
|
+ editvisible: true,
|
|
|
+ flag: true,
|
|
|
+ },()=>{
|
|
|
+ this.edit(record);
|
|
|
});
|
|
|
- this.edit(record);
|
|
|
},
|
|
|
edit(record, index) {
|
|
|
this.setState({
|
|
@@ -415,6 +420,8 @@ const FirmList = Form.create()(
|
|
|
)
|
|
|
: [],
|
|
|
sort: thisdata.sort,
|
|
|
+ indeterminate: thisdata.locations ? thisdata.locations.length === companyList.length : false,
|
|
|
+ locations: thisdata.locations,
|
|
|
editorcontext: thisdata.content,
|
|
|
releaseStatus: thisdata.releaseStatus,
|
|
|
time: thisdata.releaseTimeConvert
|
|
@@ -439,6 +446,14 @@ const FirmList = Form.create()(
|
|
|
},
|
|
|
// 新增新闻
|
|
|
addNew(flag) {
|
|
|
+ if(!this.state.locations || this.state.locations.length === 0 ){
|
|
|
+ message.warning('请选择公司');
|
|
|
+ return ;
|
|
|
+ }
|
|
|
+ if(!this.state.pictureUrl || this.state.pictureUrl.length === 0){
|
|
|
+ message.warning('请选择新闻大图');
|
|
|
+ return ;
|
|
|
+ }
|
|
|
if (this.state.flag) {
|
|
|
$.ajax({
|
|
|
method: "post",
|
|
@@ -454,16 +469,18 @@ const FirmList = Form.create()(
|
|
|
? this.state.pictureUrl[0].response.data
|
|
|
: undefined,
|
|
|
sort: this.state.sort,
|
|
|
+ locations: this.state.locations.join(','),
|
|
|
content: this.state.editorcontext,
|
|
|
status: this.state.status,
|
|
|
releaseTimes: this.state.time,
|
|
|
- releaseStatus: flag ? flag : undefined
|
|
|
+ releaseStatus: flag
|
|
|
},
|
|
|
success: function(data) {
|
|
|
let theArr = [];
|
|
|
if (data.error && data.error.length) {
|
|
|
message.warning(data.error[0].message);
|
|
|
} else {
|
|
|
+ message.success('操作成功');
|
|
|
this.loadData();
|
|
|
this.handleCancelEdit();
|
|
|
}
|
|
@@ -487,16 +504,17 @@ const FirmList = Form.create()(
|
|
|
type: this.state.type,
|
|
|
pictureUrl: this.state.pictureUrl[0].response.data,
|
|
|
sort: this.state.sort,
|
|
|
+ locations: this.state.locations.join(','),
|
|
|
content: this.state.editorcontext,
|
|
|
- releaseStatus: flag ? flag : undefined,
|
|
|
+ releaseStatus: flag,
|
|
|
status: 0,
|
|
|
releaseTimes: this.state.time
|
|
|
},
|
|
|
success: function(data) {
|
|
|
- let theArr = [];
|
|
|
if (data.error && data.error.length) {
|
|
|
message.warning(data.error[0].message);
|
|
|
} else {
|
|
|
+ message.success('操作成功');
|
|
|
this.loadData();
|
|
|
this.handleCancelEdit();
|
|
|
}
|
|
@@ -593,14 +611,20 @@ const FirmList = Form.create()(
|
|
|
publisher: undefined,
|
|
|
type: undefined,
|
|
|
sort: undefined,
|
|
|
+ locations: [],
|
|
|
editorcontext: "",
|
|
|
- time: undefined
|
|
|
+ time: undefined,
|
|
|
+ indeterminate: false,
|
|
|
});
|
|
|
},
|
|
|
//搜索部分的清零
|
|
|
reset() {
|
|
|
- this.state.titleSearch = undefined;
|
|
|
- this.loadData();
|
|
|
+ this.setState({
|
|
|
+ locationSearch: '',
|
|
|
+ titleSearch: undefined,
|
|
|
+ },()=>{
|
|
|
+ this.loadData();
|
|
|
+ })
|
|
|
},
|
|
|
|
|
|
render() {
|
|
@@ -636,6 +660,22 @@ const FirmList = Form.create()(
|
|
|
this.setState({ titleSearch: e.target.value });
|
|
|
}}
|
|
|
/>
|
|
|
+ <Select
|
|
|
+ placeholder="请选择公司"
|
|
|
+ style={{ width: 150 }}
|
|
|
+ value={this.state.locationSearch}
|
|
|
+ onChange={e => {
|
|
|
+ this.setState({
|
|
|
+ locationSearch: e
|
|
|
+ });
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ {
|
|
|
+ companyList.map((v)=>(
|
|
|
+ <Select.Option key={v.value} value={v.value}>{v.title}</Select.Option>
|
|
|
+ ))
|
|
|
+ }
|
|
|
+ </Select>
|
|
|
<Button
|
|
|
type="primary"
|
|
|
onClick={e => {
|
|
@@ -681,11 +721,6 @@ const FirmList = Form.create()(
|
|
|
visible={this.state.editvisible}
|
|
|
footer=""
|
|
|
>
|
|
|
- <Form
|
|
|
- layout="horizontal"
|
|
|
- onSubmit={this.edithandleSubmit}
|
|
|
- id="demand-form"
|
|
|
- >
|
|
|
<SpinContainer spinning={this.state.loading}>
|
|
|
<div className="clearfix">
|
|
|
<FormItem
|
|
@@ -783,6 +818,26 @@ const FirmList = Form.create()(
|
|
|
style={{ width: "240px" }}
|
|
|
/>
|
|
|
</FormItem>
|
|
|
+ <FormItem
|
|
|
+ className="half-item"
|
|
|
+ labelCol={{ span: 8 }}
|
|
|
+ wrapperCol={{ span: 12 }}
|
|
|
+ label="公司"
|
|
|
+ >
|
|
|
+ <Checkbox.Group value={this.state.locations} onChange={e => {
|
|
|
+ this.setState({
|
|
|
+ locations: e.indexOf(undefined) === -1 ? e : getCompanyValueArray(),
|
|
|
+ indeterminate: e.indexOf(undefined) !== -1
|
|
|
+ });
|
|
|
+ }}>
|
|
|
+ <Checkbox indeterminate={this.state.indeterminate}>全选</Checkbox>
|
|
|
+ {
|
|
|
+ companyList.map((v)=>(
|
|
|
+ <Checkbox key={v.value} value={v.value}>{v.title}</Checkbox>
|
|
|
+ ))
|
|
|
+ }
|
|
|
+ </Checkbox.Group>
|
|
|
+ </FormItem>
|
|
|
</div>
|
|
|
<div className="clearfix">
|
|
|
<FormItem
|
|
@@ -846,7 +901,6 @@ const FirmList = Form.create()(
|
|
|
</Button>
|
|
|
</div>
|
|
|
</SpinContainer>
|
|
|
- </Form>
|
|
|
</Modal>
|
|
|
<Modal
|
|
|
visible={this.state.imgeditvisible}
|