Commit ff7acd7e authored by 皮倩雯's avatar 皮倩雯

fix: '消息平台界面优化'

parent d8bf27eb
Pipeline #64821 passed with stages
...@@ -79,7 +79,7 @@ const AddModal = props => { ...@@ -79,7 +79,7 @@ const AddModal = props => {
width="700px" width="700px"
destroyOnClose destroyOnClose
maskClosable={false} maskClosable={false}
centered={true} centered
cancelText="取消" cancelText="取消"
okText="确认" okText="确认"
{...props} {...props}
...@@ -101,7 +101,7 @@ const AddModal = props => { ...@@ -101,7 +101,7 @@ const AddModal = props => {
<Radio value="大">大(3)</Radio> <Radio value="大">大(3)</Radio>
<Radio value="中">中(4)</Radio> <Radio value="中">中(4)</Radio>
<Radio value="小">小(5)</Radio> <Radio value="小">小(5)</Radio>
<Radio value="较小">较小(6)</Radio> {/* <Radio value="较小">较小(6)</Radio> */}
</Radio.Group> </Radio.Group>
</Item> </Item>
{/* <Item label="模板" name="officeTmpl"> {/* <Item label="模板" name="officeTmpl">
......
...@@ -370,14 +370,17 @@ const DatabaseInitialization = props => { ...@@ -370,14 +370,17 @@ const DatabaseInitialization = props => {
GetDbChangeFirst(kk); GetDbChangeFirst(kk);
// 有License的情况下首次进入展示数据 // 有License的情况下首次进入展示数据
// if (res.data.IsAuthorize) { // if (res.data.IsAuthorize) {
if (res.data.Product) { console.log(res.data.Product);
if (res.data.Product.length > 0) {
let aa = []; let aa = [];
let gg = []; let gg = [];
res.data.Product.map(i => { res.data.Product.map(i => {
if (i.status == 1) { if (i.name !== null) {
gg.push(i.name); if (i.status == 1) {
gg.push(i.name);
}
aa.push(i.name);
} }
aa.push(i.name);
}); });
if (aa.length > 0) { if (aa.length > 0) {
let dd = []; let dd = [];
...@@ -401,11 +404,19 @@ const DatabaseInitialization = props => { ...@@ -401,11 +404,19 @@ const DatabaseInitialization = props => {
setProduct(arr); setProduct(arr);
setKeepValue(arr); setKeepValue(arr);
} }
console.log(aa);
let newArr = Array.from(new Set(aa)); let newArr = Array.from(new Set(aa));
setKeepStatus(gg); setKeepStatus(gg);
setKeepProduct(newArr); console.log(newArr);
setKeepCode(newArr); if (newArr.length > 0) {
setValue(newArr); setKeepProduct(newArr);
setKeepCode(newArr);
setValue(newArr);
} else {
setKeepProduct([]);
setKeepCode([]);
setValue([]);
}
} }
setKeepDb(res.data); setKeepDb(res.data);
setIsAuthorize(res.data.IsAuthorize); setIsAuthorize(res.data.IsAuthorize);
...@@ -538,14 +549,16 @@ const DatabaseInitialization = props => { ...@@ -538,14 +549,16 @@ const DatabaseInitialization = props => {
setkeepNa(''); setkeepNa('');
setkeepCo(''); setkeepCo('');
} }
if (res.data.Product) { if (res.data.Product.length > 0) {
let aa = []; let aa = [];
let gg = []; let gg = [];
res.data.Product.map(i => { res.data.Product.map(i => {
if (i.status == 1) { if (i.name !== null) {
gg.push(i.name); if (i.status == 1) {
gg.push(i.name);
}
aa.push(i.name);
} }
aa.push(i.name);
}); });
if (aa.length > 0) { if (aa.length > 0) {
let dd = []; let dd = [];
...@@ -573,6 +586,7 @@ const DatabaseInitialization = props => { ...@@ -573,6 +586,7 @@ const DatabaseInitialization = props => {
let newArr = Array.from(new Set(aa)); let newArr = Array.from(new Set(aa));
// 当前数据库已存在和上一个已存在数据库值重新赋值 // 当前数据库已存在和上一个已存在数据库值重新赋值
if (newArr.length > 0) { if (newArr.length > 0) {
console.log(newArr);
setKeepProduct(newArr); setKeepProduct(newArr);
setKeepStatus(gg); setKeepStatus(gg);
setKeepCode(newArr); setKeepCode(newArr);
...@@ -604,15 +618,18 @@ const DatabaseInitialization = props => { ...@@ -604,15 +618,18 @@ const DatabaseInitialization = props => {
GetDbProduct({ ...obj, password: Encrypt(obj.password) }).then(res => { GetDbProduct({ ...obj, password: Encrypt(obj.password) }).then(res => {
setCardLoading(false); setCardLoading(false);
if (res.code === 0) { if (res.code === 0) {
if (res.data.Product) { if (res.data.Product.length > 0) {
let aa = []; let aa = [];
let gg = []; let gg = [];
res.data.Product.map(i => { res.data.Product.map(i => {
if (i.status == 1) { if (i.name !== null) {
gg.push(i.name); if (i.status == 1) {
gg.push(i.name);
}
aa.push(i.name);
} }
aa.push(i.name);
}); });
// 后端返回出局的分组名可能发生改变,前端处理数据展示新分组名
if (aa.length > 0) { if (aa.length > 0) {
let dd = []; let dd = [];
aa.map(i => { aa.map(i => {
...@@ -638,6 +655,7 @@ const DatabaseInitialization = props => { ...@@ -638,6 +655,7 @@ const DatabaseInitialization = props => {
let newArr = Array.from(new Set(aa)); let newArr = Array.from(new Set(aa));
// 当前数据库已存在和上一个已存在数据库值重新赋值 // 当前数据库已存在和上一个已存在数据库值重新赋值
if (newArr.length > 0) { if (newArr.length > 0) {
console.log(newArr);
setKeepProduct(newArr); setKeepProduct(newArr);
setKeepStatus(gg); setKeepStatus(gg);
setKeepCode(newArr); setKeepCode(newArr);
...@@ -683,7 +701,7 @@ const DatabaseInitialization = props => { ...@@ -683,7 +701,7 @@ const DatabaseInitialization = props => {
doInitLog(); doInitLog();
NewInitAddDataBase({ ...obj, productSetting, password: Encrypt(obj.password) }).then(res => { NewInitAddDataBase({ ...obj, productSetting, password: Encrypt(obj.password) }).then(res => {
if (res.code === 0) { if (res.code === 0) {
GetDbChangeAppend(); GetDbChangeAppend(); // 刷星已初始化的产品勾选
setMsg('未检测到可用License'); setMsg('未检测到可用License');
setfirstColor('green'); setfirstColor('green');
...@@ -704,6 +722,7 @@ const DatabaseInitialization = props => { ...@@ -704,6 +722,7 @@ const DatabaseInitialization = props => {
} }
setTotalProduct(res.data.productPackageSumCount); setTotalProduct(res.data.productPackageSumCount);
setSimpleProduct(res.data.productPackageCount); setSimpleProduct(res.data.productPackageCount);
// 给平台管理员赋值所有菜单权限
SetAdminMenuToRole().then(resdata => { SetAdminMenuToRole().then(resdata => {
if (resdata.code === 0) { if (resdata.code === 0) {
setLastColor('green'); setLastColor('green');
...@@ -759,15 +778,6 @@ const DatabaseInitialization = props => { ...@@ -759,15 +778,6 @@ const DatabaseInitialization = props => {
setSimpleProduct(res.data.productPackageCount); setSimpleProduct(res.data.productPackageCount);
setLastColor('green'); setLastColor('green');
setKeepLast(''); setKeepLast('');
// SetAdminMenuToRole().then(resdata => {
// if (resdata.code === 0) {
// setLastColor('green');
// setKeepLast('');
// } else {
// setLastColor('red');
// setKeepLast(res.data.msg);
// }
// });
} else { } else {
setDataResult(res.msg); setDataResult(res.msg);
setFinish(true); setFinish(true);
......
...@@ -15,6 +15,7 @@ import { ...@@ -15,6 +15,7 @@ import {
Tooltip, Tooltip,
Spin, Spin,
notification, notification,
Tag,
} from 'antd'; } from 'antd';
import { import {
PlusCircleOutlined, PlusCircleOutlined,
...@@ -63,6 +64,7 @@ const ProjectManage = props => { ...@@ -63,6 +64,7 @@ const ProjectManage = props => {
const [value, setValue] = useState(''); const [value, setValue] = useState('');
const [pushTestMsg, setPushTestMsg] = useState(''); const [pushTestMsg, setPushTestMsg] = useState('');
const [currentPage, setCurrentPage] = useState(1); const [currentPage, setCurrentPage] = useState(1);
const [nameList, setNameList] = useState([]);
const columns = [ const columns = [
{ {
title: '方案名称', title: '方案名称',
...@@ -95,11 +97,19 @@ const ProjectManage = props => { ...@@ -95,11 +97,19 @@ const ProjectManage = props => {
</div> </div>
), ),
}, },
{
title: '消息标题',
dataIndex: 'Title',
align: 'center',
key: 'Title',
render: (text, record) => <div>{text === null || !text ? '-' : text}</div>,
},
{ {
title: '方案类型', title: '方案类型',
dataIndex: 'type', dataIndex: 'type',
align: 'center', align: 'center',
key: 'type', key: 'type',
width: 200,
render: (text, record) => <div>{text === null || !text ? '-' : text}</div>, render: (text, record) => <div>{text === null || !text ? '-' : text}</div>,
}, },
{ {
...@@ -116,52 +126,69 @@ const ProjectManage = props => { ...@@ -116,52 +126,69 @@ const ProjectManage = props => {
cursor: 'pointer', cursor: 'pointer',
}, },
}), }),
render: (text, record) => ( render: (text, record) => {
<span> console.log(text);
{text === null || !text ? ( let arr = text;
'-' if (text) {
) : ( let list = new Set(text.split(','));
<Tooltip placement="topLeft" title={text}> console.log(list);
{text} let data = Array.from(list); // 将类数组转化为真数组
</Tooltip> console.log(data);
)} arr = data.toString();
</span> }
), return (
}, <span>
{ {arr === null || !arr ? (
title: '推送组', '-'
dataIndex: 'receive_person', ) : (
key: 'receive_person', <Tooltip placement="topLeft" title={arr}>
align: 'center', {arr}
ellipsis: true, </Tooltip>
onCell: () => ({ )}
style: { </span>
maxWidth: 150, );
overflow: 'hidden', },
whiteSpace: 'nowrap',
textOverflow: 'ellipsis',
cursor: 'pointer',
},
}),
render: (text, record) => (
<span>
{text === null || !text ? (
'-'
) : (
<Tooltip placement="topLeft" title={text}>
{text}
</Tooltip>
)}
</span>
),
}, },
// {
// title: '推送组',
// dataIndex: 'receive_person',
// key: 'receive_person',
// align: 'center',
// ellipsis: true,
// onCell: () => ({
// style: {
// maxWidth: 150,
// overflow: 'hidden',
// whiteSpace: 'nowrap',
// textOverflow: 'ellipsis',
// cursor: 'pointer',
// },
// }),
// render: (text, record) => (
// <span>
// {text === null || !text ? (
// '-'
// ) : (
// <Tooltip placement="topLeft" title={text}>
// {text}
// </Tooltip>
// )}
// </span>
// ),
// },
{ {
title: '是否启用', title: '是否启用',
dataIndex: 'is_use', dataIndex: 'is_use',
align: 'center', align: 'center',
key: 'is_use', key: 'is_use',
width: '100px', width: '100px',
render: (text, record) => <div>{text === '0' ? '否' : '是'}</div>, // render: (text, record) => <div>{text === '0' ? '否' : '是'}</div>,
render: record => {
if (record === '1') {
return <Tag color="success"></Tag>;
}
return <Tag color="processing"></Tag>;
},
}, },
{ {
title: '操作', title: '操作',
...@@ -233,7 +260,7 @@ const ProjectManage = props => { ...@@ -233,7 +260,7 @@ const ProjectManage = props => {
setCurrentTempalte(record); setCurrentTempalte(record);
history.push({ history.push({
pathname: `/platform/schemeDetail`, pathname: `/platform/schemeDetail`,
state: { template: record, currentPage }, state: { template: record, currentPage, nameList },
}); });
// handleShowModal("editVisible", true) // handleShowModal("editVisible", true)
}; };
...@@ -301,7 +328,7 @@ const ProjectManage = props => { ...@@ -301,7 +328,7 @@ const ProjectManage = props => {
// handleShowModal("addVisible", true) // handleShowModal("addVisible", true)
history.push({ history.push({
pathname: `/platform/schemeDetail`, pathname: `/platform/schemeDetail`,
state: { template: {} }, state: { template: {}, nameList },
}); });
}; };
const onTypeChange = value => { const onTypeChange = value => {
...@@ -366,9 +393,12 @@ const ProjectManage = props => { ...@@ -366,9 +393,12 @@ const ProjectManage = props => {
GetMessageConfigList(params).then(res => { GetMessageConfigList(params).then(res => {
setTreeLoading(false); setTreeLoading(false);
if (res.code === 0) { if (res.code === 0) {
console.log(res.data);
let mesList = []; let mesList = [];
let nameArr = [];
if (res.code === 0) { if (res.code === 0) {
res.data.MessageConfigModels.map(item => { res.data.MessageConfigModels.map(item => {
nameArr.push(item.MessageConfig.MsgType);
mesList.push({ mesList.push({
name: item.MessageConfig.MsgType, name: item.MessageConfig.MsgType,
type: item.MessageConfig.ThemeName, type: item.MessageConfig.ThemeName,
...@@ -379,7 +409,7 @@ const ProjectManage = props => { ...@@ -379,7 +409,7 @@ const ProjectManage = props => {
item, item,
}); });
}); });
setNameList(nameArr);
setDataList(mesList); setDataList(mesList);
} }
} else { } else {
......
...@@ -61,9 +61,9 @@ const EditModal = props => { ...@@ -61,9 +61,9 @@ const EditModal = props => {
const [plan, setPlan] = useState(''); const [plan, setPlan] = useState('');
const [isStart, setIsStart] = useState(false); const [isStart, setIsStart] = useState(false);
const [IISConfig, setIISConfig] = useState(null); const [IISConfig, setIISConfig] = useState(null);
const [isUse, setIsUse] = useState('1'); const [isUse, setIsUse] = useState(null);
const [btnType, setBtnType] = useState('自定义'); const [btnType, setBtnType] = useState('自定义');
const { template, confirmModal, currentPage } = props.location.state; const { template, confirmModal, currentPage, nameList } = props.location.state;
const [currentTrench, setCurrentTrench] = useState({ const [currentTrench, setCurrentTrench] = useState({
isMessageShow: false, isMessageShow: false,
isAPPShow: false, isAPPShow: false,
...@@ -186,7 +186,7 @@ const EditModal = props => { ...@@ -186,7 +186,7 @@ const EditModal = props => {
setIm(template.WebIcon ? template.WebIcon : ''); setIm(template.WebIcon ? template.WebIcon : '');
setPlan(template.MsgType); setPlan(template.MsgType);
setBtnType(template.type); setBtnType(template.type);
setIsUse(template.IsStarted); setIsUse(template.IsStarted === null ? '0' : template.IsStarted);
setCurrentTrench({ setCurrentTrench({
isAPPShow: !!(template.PushMode && template.PushMode.split(',').indexOf('平台弹框') > -1), isAPPShow: !!(template.PushMode && template.PushMode.split(',').indexOf('平台弹框') > -1),
isWXShow: !!(template.PushMode && template.PushMode.split(',').indexOf('公众号推送') > -1), isWXShow: !!(template.PushMode && template.PushMode.split(',').indexOf('公众号推送') > -1),
...@@ -199,7 +199,7 @@ const EditModal = props => { ...@@ -199,7 +199,7 @@ const EditModal = props => {
), ),
}); });
} else { } else {
// setIsUse('1'); setIsUse('1');
setType('add'); setType('add');
setImageUrl(''); setImageUrl('');
setIm(''); setIm('');
...@@ -319,11 +319,11 @@ const EditModal = props => { ...@@ -319,11 +319,11 @@ const EditModal = props => {
push_mode.push('平台弹框'); push_mode.push('平台弹框');
} }
break; break;
case 'isWEBShow': // case 'isWEBShow':
if (currentTrench[key]) { // if (currentTrench[key]) {
push_mode.push('平台弹框'); // push_mode.push('平台弹框');
} // }
break; // break;
case 'isWXShow': case 'isWXShow':
if (currentTrench[key]) { if (currentTrench[key]) {
push_mode.push('公众号推送'); push_mode.push('公众号推送');
...@@ -503,7 +503,12 @@ const EditModal = props => { ...@@ -503,7 +503,12 @@ const EditModal = props => {
}; };
const onTypeChange = (value, type) => { const onTypeChange = (value, type) => {
let data = { ...currentTrench }; let data = { ...currentTrench };
data[type] = value; if (type === 'isWEBShow' || type === 'isAPPShow') {
data.isWEBShow = value;
data.isAPPShow = value;
} else {
data[type] = value;
}
setCurrentTrench(data); setCurrentTrench(data);
}; };
// 推送组选择角色 // 推送组选择角色
...@@ -709,6 +714,22 @@ const EditModal = props => { ...@@ -709,6 +714,22 @@ const EditModal = props => {
required: true, required: true,
message: '请输入方案名称', message: '请输入方案名称',
}, },
{
validator: (rule, value) => {
let aa = form.getFieldValue().name;
if (!template.ThemeName && nameList.indexOf(aa) != -1) {
return Promise.reject('方案名称重复');
}
if (
template.ThemeName &&
nameList.indexOf(aa) != -1 &&
aa != template.name
) {
return Promise.reject('方案名称重复');
}
return Promise.resolve();
},
},
]} ]}
> >
<Input <Input
...@@ -720,7 +741,7 @@ const EditModal = props => { ...@@ -720,7 +741,7 @@ const EditModal = props => {
</Item> </Item>
</Col> </Col>
<Col span={12}> <Col span={12}>
<Item label="消息标题" name="Title" labelCol={{ span: 6 }}> <Item label="消息标题" name="Title" labelCol={{ span: 5 }}>
<Input placeholder="请输入标题" style={{ width: '25rem' }} /> <Input placeholder="请输入标题" style={{ width: '25rem' }} />
</Item> </Item>
</Col> </Col>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment