Commit f12f5277 authored by 邓超's avatar 邓超

fix: 修改消息平台卡片样式,修改用户管理权限问题

parent dcbbb04c
Pipeline #39814 passed with stages
in 21 minutes 12 seconds
......@@ -20,6 +20,8 @@ const ListCardItem = props => {
const [checkList, setCheckList] = useState([]); // 复选框列表选中的值
const [defaultList, setDefaultList] = useState([]); // 默认的选项
const [submitArr, setSubmitArr] = useState([]); // 提交的数组
const authority = JSON.parse(localStorage.getItem('panda-oms-authority'));
// const submitArr = [];
useEffect(() => {
......@@ -136,7 +138,12 @@ const ListCardItem = props => {
return null;
}
return (
<>
<div
style={{
display:
OUName === '运维管理' && authority[1] !== 'super' ? 'none' : 'block',
}}
>
<div className={`${styles.divBox}`}>
<div className={styles.topCheckbox}>
<Checkbox
......@@ -162,7 +169,7 @@ const ListCardItem = props => {
)}
</div>
</div>
</>
</div>
);
};
......
......@@ -119,7 +119,7 @@ const AddModal = props => {
Group: pramData.Group || '',
Shape,
ExceptionEvent: pramData.ExceptionEvent || '',
RowSpan: pramData.RowSpan || 0,
RowSpan: Number(pramData.RowSpan) || 0,
ColSpan: pramData.ColSpan || 0,
ReadOnly: pramData.ReadOnly || false,
EditableLater: pramData.EditableLater || false,
......
......@@ -319,7 +319,7 @@ const ProjectManage = () => {
};
const pagenation = {
showTotal: (total, range) => `共 ${total} 条`,
showTotal: (total, range) => `${range[0]}-${range[1]} 条/${total} 条`,
pageSizeOptions: [10, 20, 50, 100],
defaultPageSize: 10,
showQuickJumper: true,
......@@ -407,6 +407,7 @@ const ProjectManage = () => {
onCancel={() => handleShowModal('addVisible', false)}
confirmModal={bddModal}
/>
{/* 推送测试模块 */}
<PushTest
visible={visibleParams.pushTestVisible}
onCancel={() => handleShowModal('pushTestVisible', false)}
......
......@@ -13,7 +13,7 @@ const CardCheck = props => {
return ref.current;
};
const { cardMsg, callback, checkList } = props;
const [checkedList, setCheckedList] = useState([]);
const [checkedList, setCheckedList] = useState([]); // 选中列表
const [indeterminate, setIndeterminate] = useState(false);
const [checkAll, setCheckAll] = useState(false);
const [plainOptions, setPlainOptions] = useState([]);
......@@ -61,11 +61,13 @@ const CardCheck = props => {
callback(checkedList, newCheckList);
}
}, [checkedList]);
// 单选监听
const onChange = list => {
setCheckedList(list);
setIndeterminate(!!list.length && list.length < plainOptions.length);
setCheckAll(list.length === plainOptions.length);
};
// 全选监听
const onCheckAllChange = e => {
setCheckedList(
e.target.checked ? plainOptions.map(item => item.value) : [],
......@@ -74,7 +76,7 @@ const CardCheck = props => {
setCheckAll(e.target.checked);
};
return (
<div className={styles.divBox}>
<div className={styles.checkContent}>
<div className={styles.topCheckbox}>
<Checkbox
indeterminate={indeterminate}
......@@ -84,7 +86,7 @@ const CardCheck = props => {
{cardMsg.groupName}
</Checkbox>
</div>
<div className={styles.bottomCheckbox} style={{ marginTop: '10px' }}>
<div className={styles.bottomCheckbox}>
<CheckboxGroup
options={plainOptions}
value={checkedList}
......
......@@ -32,81 +32,104 @@ const PushTest = props => {
});
// 监听分页
const paginationChange = (page, pageSizes) => {
// 分页时清空复选框
setCurrentPage(page);
setPageSize(pageSizes);
let username = form.getFieldValue('username');
getData(username, page, pageSizes);
};
const onFinish = () => {
if (pushTestMsg.ThemeName)
TestPush({
theme: pushTestMsg.ThemeName,
msgType: pushTestMsg.MsgType,
tousers: checkList,
pushPath: pushTestMsg.item.AgentConfig
? pushTestMsg.item.AgentConfig.Url
: '',
msgTypeId: pushTestMsg.ID.toString(),
}).then(res => {
TestPush({
theme: pushTestMsg.ThemeName,
msgType: pushTestMsg.MsgType,
tousers: checkList,
pushPath: pushTestMsg.item.AgentConfig
? pushTestMsg.item.AgentConfig.Url
: '',
msgTypeId: pushTestMsg.ID.toString(),
})
.then(res => {
if (res.code === 0) {
confirmModal();
message.success('测试推送成功');
} else {
message.error(res.msg);
}
})
.catch(() => {
message.error('网络异常,请稍后再试');
});
};
// 搜索
const onSearch = () => {
let username = form.getFieldValue('username');
setCurrentPage(1);
getData(username, 1, pageSize);
};
// 重置
const onReset = () => {
setCurrentPage(1);
getData('', 1, pageSize);
form.setFieldsValue({ username: '' });
};
// 获取数据
const getData = (username, page, pageSizes) => {
setLoading(true);
GetGroupUserTree({
key: username,
pageSize: pageSizes,
PageIndex: page,
}).then(res => {
setTotal(res.data.count);
let list = res.data.data.map(item => {
let indeterminate = false;
let checkedList = [];
let checkAll = false;
let options = item.users.map(val => {
checkList.forEach(ele => {
if (val.userId === ele) {
checkedList.push(ele);
})
.then(res => {
setLoading(false);
if (res.code === 0) {
setTotal(res.data.count);
// 数据处理成checkbox组件需要得形式
let list = res.data.data.map(item => {
let indeterminate = false;
let checkedList = [];
let checkAll = false;
let options = item.users.map(val => {
checkList.forEach(ele => {
if (val.userId === ele) {
checkedList.push(ele);
}
});
return {
label: val.userName,
value: val.userId,
};
});
console.log(item.groupName, '名称');
console.log(checkList, '所有选择得列表');
console.log(checkedList, '当前组件勾选');
if (
checkedList.length === options.length &&
checkedList.length > 0
) {
checkAll = true;
}
if (checkedList.length < options.length && checkedList.length > 0) {
indeterminate = true;
}
return {
groupName: item.groupName,
groupId: item.groupId,
indeterminate,
checkAll,
checkedList,
plainOptions: options,
};
});
return {
label: val.userName,
value: val.userId,
};
});
console.log(item.groupName, '名称');
console.log(checkList, '所有选择得列表');
console.log(checkedList, '当前组件勾选');
if (checkedList.length === options.length && checkedList.length > 0) {
checkAll = true;
}
if (checkedList.length < options.length && checkedList.length > 0) {
indeterminate = true;
setAllist(list);
} else {
message.error(res.msg);
}
return {
groupName: item.groupName,
groupId: item.groupId,
indeterminate,
checkAll,
checkedList,
plainOptions: options,
};
})
.catch(() => {
setLoading(false);
message.error('网络异常,请稍后再试');
});
setAllist(list);
setLoading(false);
});
};
return (
<>
......@@ -120,12 +143,12 @@ const PushTest = props => {
destroyOnClose
centered
>
<div className="searchHeader">
{/* 头部搜索框 */}
<div className={styles.searchHeader}>
<Form form={form} layout="inline">
<Form.Item name="username">
<Input placeholder="请输入用户名称" />
</Form.Item>
<Form.Item>
<Button
type="primary"
......@@ -135,40 +158,35 @@ const PushTest = props => {
>
搜索
</Button>
<Button
type="primary"
htmlType="submit"
onClick={() => {
setCurrentPage(1);
getData('', 1, pageSize);
form.setFieldsValue({ username: '' });
}}
>
<Button type="primary" htmlType="submit" onClick={onReset}>
重置
</Button>
</Form.Item>
</Form>
</div>
{/* 复选框模块 */}
<Spin spinning={loading}>
<div
className="checkContainer"
style={{ height: '500px', overflowY: 'scroll', margin: '20px 0' }}
>
<div className={styles.checkContainer}>
{allList.map((item, index) => (
<div className={styles.checkBoxContent} key={item.groupId}>
<CardCheck
cardMsg={item}
cardIndex={index}
callback={(val, i) => checkCallBack(val, i)}
callback={(val, newCheckList) =>
checkCallBack(val, newCheckList)
}
checkList={checkList}
/>
</div>
))}
</div>
</Spin>
{/* 分页 */}
<Pagination
total={total}
showTotal={item => `共 ${item} 条`}
showTotal={(totals, range) =>
`第${range[0]}-${range[1]} 条/共 ${totals} 条`
}
defaultPageSize={pageSize}
defaultCurrent={1}
current={currentPage}
......
.divBox {
.checkContainer {
height: 500px;
overflow-y: scroll;
margin: 20px 0;
padding-right: 5px;
}
.checkContent {
display: flex;
width: 100%;
flex-direction: column;
......@@ -20,6 +26,7 @@
font-weight: 600;
}
.bottomCheckbox {
margin-top: 10px;
.ant-checkbox-group-item {
min-width: 150px !important;
}
......
......@@ -472,7 +472,7 @@ const EditModal = props => {
label="模板"
labelAlign="left"
name="app_template"
labelCol={{ span: 2 }}
labelCol={{ span: 3 }}
>
<Select
style={{ width: '97%' }}
......@@ -489,7 +489,7 @@ const EditModal = props => {
label="功能路径"
name="app_path"
labelAlign="left"
labelCol={{ span: 2 }}
labelCol={{ span: 3 }}
>
<TextArea
rows={4}
......@@ -515,7 +515,7 @@ const EditModal = props => {
label="模板"
name="wx_template"
labelAlign="left"
labelCol={{ span: 3 }}
labelCol={{ span: 4 }}
>
<Select
style={{ width: '97%' }}
......@@ -532,7 +532,7 @@ const EditModal = props => {
label="H5路由"
name="h5_path"
labelAlign="left"
labelCol={{ span: 3 }}
labelCol={{ span: 4 }}
>
<Input
style={{ width: '97%' }}
......@@ -544,7 +544,7 @@ const EditModal = props => {
label="小程序路由"
name="miniprogram_path"
labelAlign="left"
labelCol={{ span: 3 }}
labelCol={{ span: 4 }}
>
<Input
style={{ width: '97%' }}
......@@ -568,7 +568,7 @@ const EditModal = props => {
<Item
label="模板"
name="web_template"
labelCol={{ span: 2 }}
labelCol={{ span: 3 }}
labelAlign="left"
>
<Select
......@@ -586,7 +586,7 @@ const EditModal = props => {
label="功能路径"
name="web_path"
labelAlign="left"
labelCol={{ span: 2 }}
labelCol={{ span: 3 }}
>
<TextArea
rows={4}
......
......@@ -34,10 +34,11 @@
display: flex;
flex-direction:row;
flex-wrap: wrap;
justify-content: space-between;
justify-content: flex-start;
.trench_card{
margin-top: 1rem;
width: 49.2%;
margin-right: 0.5rem;
width: 32%;
border-width: 1px;
border-color: #EEEEEE;
border-style: solid;
......
......@@ -312,7 +312,7 @@ const UserManage = () => {
</Tooltip>
</>
)}
<Tooltip title="用户鉴权">
{/* <Tooltip title="用户鉴权">
<Popconfirm
placement="bottomRight"
title={
......@@ -340,7 +340,7 @@ const UserManage = () => {
style={{ fontSize: '16px', color: '#1890ff' }}
/>
</Popconfirm>
</Tooltip>
</Tooltip> */}
<Tooltip title="删除用户">
<Popconfirm
placement="bottomRight"
......
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