|
@@ -1,7 +1,7 @@
|
|
|
import React from "react";
|
|
|
import $ from "jquery/src/ajax";
|
|
|
import "react-quill/dist/quill.bubble.css";
|
|
|
-import moment from "moment";
|
|
|
+import {companyList, getCompanyName, getCompanyValueArray} from '../../common/configure';
|
|
|
import {
|
|
|
Form,
|
|
|
Icon,
|
|
@@ -19,7 +19,8 @@ import {
|
|
|
Radio,
|
|
|
TimePicker,
|
|
|
Tabs,
|
|
|
- Tag
|
|
|
+ Tag,
|
|
|
+ Checkbox, Tooltip
|
|
|
} from "antd";
|
|
|
import { areaSelect, getProvince } from "@/NewDicProvinceList"; //省市区
|
|
|
import {
|
|
@@ -40,7 +41,10 @@ const PicturesWall = React.createClass({
|
|
|
return {
|
|
|
previewVisible: false,
|
|
|
previewImage: "",
|
|
|
- fileList: []
|
|
|
+ fileList: [],
|
|
|
+ locations: [],
|
|
|
+ locationSearch:'',
|
|
|
+ indeterminate:false,
|
|
|
};
|
|
|
},
|
|
|
getDefaultProps() {
|
|
@@ -117,7 +121,8 @@ const AdvertisementList = Form.create()(
|
|
|
data: {
|
|
|
pageNo: pageNo || this.state.pagination.current || 1,
|
|
|
pageSize: this.state.pagination.pageSize,
|
|
|
- position: this.state.positionSearch
|
|
|
+ position: this.state.positionSearch,
|
|
|
+ location:this.state.locationSearch,
|
|
|
},
|
|
|
success: function(data) {
|
|
|
let theArr = [];
|
|
@@ -128,15 +133,8 @@ const AdvertisementList = 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,
|
|
|
- bannerUrl: thisdata.bannerUrl,
|
|
|
- sort: thisdata.sort,
|
|
|
- display: thisdata.display,
|
|
|
- position: thisdata.position
|
|
|
- });
|
|
|
+ thisdata.key = i + 1;
|
|
|
+ theArr.push(thisdata);
|
|
|
}
|
|
|
this.state.pagination.current = data.data.pageNo;
|
|
|
this.state.pagination.total = data.data.totalCount;
|
|
@@ -233,6 +231,29 @@ const AdvertisementList = Form.create()(
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
+ title: "公司",
|
|
|
+ dataIndex: "locations",
|
|
|
+ key: "locations",
|
|
|
+ render: r => {
|
|
|
+ let text = '';
|
|
|
+ r && r.map((v,i)=>(
|
|
|
+ text += (i === 0 ? '':',')+getCompanyName(v)
|
|
|
+ ))
|
|
|
+ return(
|
|
|
+ <Tooltip placement="top" title={text}>
|
|
|
+ {
|
|
|
+ r && r.map((v,i)=>(
|
|
|
+ i <= 2 ? (i === 0 ? '':',')+getCompanyName(v) : null
|
|
|
+ ))
|
|
|
+ }
|
|
|
+ {
|
|
|
+ r.length > 3 ? '.....' : null
|
|
|
+ }
|
|
|
+ </Tooltip>
|
|
|
+ )
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
title: "是否显示",
|
|
|
dataIndex: "display",
|
|
|
key: "display",
|
|
@@ -345,7 +366,10 @@ const AdvertisementList = Form.create()(
|
|
|
: [],
|
|
|
sortNumber: thisdata.sort,
|
|
|
display: thisdata.display,
|
|
|
- position: thisdata.position
|
|
|
+ position: thisdata.position,
|
|
|
+ locations: thisdata.locations,
|
|
|
+ checked:thisdata.locations.length === companyList.length,
|
|
|
+ indeterminate: thisdata.locations.length < companyList.length,
|
|
|
});
|
|
|
}.bind(this)
|
|
|
}).always(
|
|
@@ -449,6 +473,10 @@ const AdvertisementList = Form.create()(
|
|
|
message.warning("请填写广告标题");
|
|
|
return;
|
|
|
}
|
|
|
+ if(this.state.locations.length === 0){
|
|
|
+ message.warning("请选择公司");
|
|
|
+ return;
|
|
|
+ }
|
|
|
}
|
|
|
$.ajax({
|
|
|
method: "post",
|
|
@@ -458,6 +486,7 @@ const AdvertisementList = Form.create()(
|
|
|
id: record ? record.id : this.state.id,
|
|
|
sort: this.state.sortNumber,
|
|
|
display: display || this.state.display,
|
|
|
+ locations: this.state.locations.join(','),
|
|
|
position: this.state.position,
|
|
|
bannerUrl: this.state.bannerUrl
|
|
|
? this.state.bannerUrl[0].response.data
|
|
@@ -491,6 +520,10 @@ const AdvertisementList = Form.create()(
|
|
|
message.warning("请填写广告标题");
|
|
|
return;
|
|
|
}
|
|
|
+ if(this.state.locations.length === 0){
|
|
|
+ message.warning("请选择公司");
|
|
|
+ return;
|
|
|
+ }
|
|
|
$.ajax({
|
|
|
method: "post",
|
|
|
dataType: "json",
|
|
@@ -498,6 +531,7 @@ const AdvertisementList = Form.create()(
|
|
|
data: {
|
|
|
sort: this.state.sortNumber,
|
|
|
display: this.state.display,
|
|
|
+ locations: this.state.locations.join(','),
|
|
|
position: this.state.position,
|
|
|
bannerUrl: this.state.bannerUrl
|
|
|
? this.state.bannerUrl[0].response.data
|
|
@@ -511,6 +545,7 @@ const AdvertisementList = Form.create()(
|
|
|
message.warning(data.error[0].message);
|
|
|
}
|
|
|
} else {
|
|
|
+ message.warning('添加成功');
|
|
|
this.loadData();
|
|
|
this.cancelAdd();
|
|
|
}
|
|
@@ -531,13 +566,20 @@ const AdvertisementList = Form.create()(
|
|
|
title: undefined,
|
|
|
sortNumber: undefined,
|
|
|
display: 1,
|
|
|
- position: "0"
|
|
|
+ position: "0",
|
|
|
+ locations: [],
|
|
|
+ indeterminate: false,
|
|
|
+ checked:false,
|
|
|
});
|
|
|
},
|
|
|
//搜索部分的清零
|
|
|
reset() {
|
|
|
- this.state.positionSearch = undefined;
|
|
|
- this.loadData();
|
|
|
+ this.setState({
|
|
|
+ locationSearch: undefined,
|
|
|
+ positionSearch: undefined,
|
|
|
+ },()=>{
|
|
|
+ this.loadData();
|
|
|
+ })
|
|
|
},
|
|
|
imgOk() {
|
|
|
this.setState({
|
|
@@ -591,6 +633,22 @@ const AdvertisementList = Form.create()(
|
|
|
<Option value="5">关于科德</Option>
|
|
|
<Option value="6">联系我们</Option>
|
|
|
</Select>
|
|
|
+ <Select
|
|
|
+ placeholder="请选择公司"
|
|
|
+ style={{ width: 150 }}
|
|
|
+ value={this.state.locationSearch}
|
|
|
+ onChange={e => {
|
|
|
+ this.setState({
|
|
|
+ locationSearch: e
|
|
|
+ });
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ {
|
|
|
+ companyList.map((v)=>(
|
|
|
+ <Option key={v.value} value={v.value}>{v.label}</Option>
|
|
|
+ ))
|
|
|
+ }
|
|
|
+ </Select>
|
|
|
<Button
|
|
|
type="primary"
|
|
|
onClick={this.search}
|
|
@@ -628,7 +686,7 @@ const AdvertisementList = Form.create()(
|
|
|
title={this.state.flag ? "广告详情" : "新增广告"}
|
|
|
visible={this.state.editvisible}
|
|
|
onOk={this.edithandleCancel}
|
|
|
- width={"500px"}
|
|
|
+ width={"690px"}
|
|
|
onCancel={
|
|
|
this.state.flag ? this.edithandleCancel : this.cancelAdd
|
|
|
}
|
|
@@ -649,7 +707,6 @@ const AdvertisementList = Form.create()(
|
|
|
>
|
|
|
<Select
|
|
|
placeholder="请选择广告位置"
|
|
|
- style={{ width: 120 }}
|
|
|
value={this.state.position + ""}
|
|
|
onChange={e => {
|
|
|
this.setState({
|
|
@@ -701,23 +758,52 @@ const AdvertisementList = Form.create()(
|
|
|
</FormItem>
|
|
|
</div>
|
|
|
|
|
|
+ <div className="clearfix">
|
|
|
+ <FormItem
|
|
|
+ className="half-item"
|
|
|
+ labelCol={{ span: 8 }}
|
|
|
+ wrapperCol={{ span: 12 }}
|
|
|
+ label="是否显示"
|
|
|
+ >
|
|
|
+ <Radio.Group
|
|
|
+ onChange={e => {
|
|
|
+ this.setState({
|
|
|
+ display: e.target.value
|
|
|
+ });
|
|
|
+ }}
|
|
|
+ value={this.state.display}
|
|
|
+ >
|
|
|
+ <Radio value={1}>是</Radio>
|
|
|
+ <Radio value={0}>否</Radio>
|
|
|
+ </Radio.Group>
|
|
|
+ </FormItem>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div className="clearfix">
|
|
|
<FormItem
|
|
|
- className="half-item"
|
|
|
- labelCol={{ span: 8 }}
|
|
|
- wrapperCol={{ span: 12 }}
|
|
|
- label="是否显示"
|
|
|
+ className="half-item"
|
|
|
+ labelCol={{ span: 8 }}
|
|
|
+ wrapperCol={{ span: 14 }}
|
|
|
+ label="公司"
|
|
|
>
|
|
|
- <Radio.Group
|
|
|
- onChange={e => {
|
|
|
- this.setState({
|
|
|
- display: e.target.value
|
|
|
- });
|
|
|
- }}
|
|
|
- value={this.state.display}
|
|
|
- >
|
|
|
- <Radio value={1}>是</Radio>
|
|
|
- <Radio value={0}>否</Radio>
|
|
|
- </Radio.Group>
|
|
|
+ <Checkbox indeterminate={this.state.indeterminate} checked={this.state.checked} onChange={(e)=>{
|
|
|
+ this.setState({
|
|
|
+ locations: e.target.checked ? getCompanyValueArray():[],
|
|
|
+ indeterminate: false,
|
|
|
+ checked:e.target.checked
|
|
|
+ })
|
|
|
+ }}>全选</Checkbox>
|
|
|
+ <Checkbox.Group
|
|
|
+ options={companyList}
|
|
|
+ value={this.state.locations}
|
|
|
+ onChange={(e) => {
|
|
|
+ this.setState({
|
|
|
+ locations: e,
|
|
|
+ indeterminate: companyList.length > e.length,
|
|
|
+ checked: companyList.length === e.length
|
|
|
+ });
|
|
|
+ }}
|
|
|
+ />
|
|
|
</FormItem>
|
|
|
</div>
|
|
|
<div className="clearfix">
|