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

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

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