Commit 790b67d1 authored by 皮倩雯's avatar 皮倩雯

fix: 'web配置关联角色增加多选,角色管理新增默认分组'

parent c1facb6f
Pipeline #44182 skipped with stages
......@@ -85,8 +85,10 @@ const RoalChoose = props => {
};
// 复选框监听事件
const selectChange = (e, index, value) => {
console.log(plainOptions);
let list = JSON.parse(JSON.stringify(plainOptions));
list[index].isChecked = e.target.checked;
console.log(list);
// 存储勾选角色或站点信息
if (e.target.checked) {
// 存储已选角色或站点的默认承办人
......@@ -106,6 +108,9 @@ const RoalChoose = props => {
delArr.set(value.id, selected.get(value.id));
selected.delete(value.id);
}
console.log(list);
console.log(selected);
console.log(list);
setDelArr(delArr);
setSelected(selected);
setPlainOptions(list);
......
......@@ -42,7 +42,7 @@ const VectorData = props => {
return (
<>
<Spin tip="loading..." spinning={treeLoading}>
<div style={{ height: '780px', overflow: 'scroll' }}>
<div>
<div className={styles.tileBtn}>
<Button
type="primary"
......@@ -53,22 +53,24 @@ const VectorData = props => {
新增
</Button>
</div>
<div className={styles.cardsList}>
{tileData && tileData.length
? tileData.map((item, index) => {
return (
<div
className={styles.cardItem}
key={index}
span={5}
offset={2}
style={{ marginBottom: '1rem' }}
>
<Cards item={item} deletebaseMaps={onDeletebaseMap} />
</div>
);
})
: ''}
<div style={{ height: '700px', overflow: 'scroll' }}>
<div className={styles.cardsList}>
{tileData && tileData.length
? tileData.map((item, index) => {
return (
<div
className={styles.cardItem}
key={index}
span={5}
offset={2}
style={{ marginBottom: '1rem' }}
>
<Cards item={item} deletebaseMaps={onDeletebaseMap} />
</div>
);
})
: ''}
</div>
</div>
<AddModal
visible={visible}
......
......@@ -17,11 +17,11 @@ import AddModal from './AddModal';
const VectorData = props => {
const [treeLoading, setTreeLoading] = useState(false); // 弹窗显示
const [schemename, setSchemename] = useState([]);
const [record, setRecord] = useState({}); //选中关联角色的方案名
const [record, setRecord] = useState({}); // 选中关联角色的方案名
const [webCurrent, setWebCurrent] = useState(0); // web列表下标
const [handCurrent, setHandCurrent] = useState(0); // hand列表下标
const [webData, setWebData] = useState([]); // web数据
const [handData, setHandData] = useState([]); //手持数据
const [handData, setHandData] = useState([]); // 手持数据
const [visible, setVisible] = useState(false); // 弹窗
const [flag, setFlag] = useState(0); // 更新list
const [handStatus, setHandStatus] = useState([]); // 更新状态
......@@ -416,6 +416,7 @@ const VectorData = props => {
columns={columns}
dataSource={webData}
bordered
style={{ height: 'calc(100vh - 230px)' }}
pagination={{
showTotal: (total, range) => `第${range[0]}-${range[1]} 条/共 ${total} 条`,
defaultPageSize: 8,
......@@ -424,7 +425,7 @@ const VectorData = props => {
},
}}
rowKey={(record, index) => record.scheme.schemename}
scroll={{ y: 600 }}
scroll={{ y: 300 }}
/>
</div>
{/* <Divider orientation="left"><div className={styles.divider}>手持 <PlusOutlined
......
......@@ -46,7 +46,7 @@ const VectorData = props => {
return (
<>
<Spin tip="loading..." spinning={treeLoading}>
<div>
<div style={{ height: '780px', overflow: 'scroll' }}>
<div className={styles.tileBtn}>
<Button
type="primary"
......
......@@ -250,7 +250,7 @@ const ProjectManage = props => {
};
const onTypeChange = value => {
if (value == '全部') {
setCurrentType('');
setCurrentType('全部');
GetMessageList({ pageIndex, pageSize: 10 });
} else {
GetMessageList({
......@@ -264,7 +264,7 @@ const ProjectManage = props => {
};
const onNameChange = value => {
if (value == '全部') {
setCurrentName('');
setCurrentName('全部');
GetMessageList({ pageIndex, pageSize: 10 });
} else {
GetMessageList({
......
......@@ -253,7 +253,11 @@ const TemplateManage = () => {
const placeholder = '请输入模板名称';
const handleSearch = value => {
setValue(value);
getTemplateList({ queryInfo: value });
if (currentType == '全部') {
getTemplateList({ queryInfo: value });
} else {
getTemplateList({ queryInfo: value, tempType: currentType });
}
setShowSearchStyle(true);
};
const handleReset = () => {
......@@ -267,7 +271,7 @@ const TemplateManage = () => {
};
const handleSelectType = value => {
if (value === '全部') {
setCurrentType('');
setCurrentType('全部');
getTemplateList();
} else {
getTemplateList({ tempType: value });
......
.formStyle{
.formStyle {
margin-bottom: 40px;
padding-bottom: 30px;
}
.rolebox{
.rolebox {
display: flex;
justify-content: space-between;
flex-wrap: nowrap;
}
\ No newline at end of file
}
.cardItemData {
display: flex;
justify-content: space-around;
width: 100%;
padding: 1rem;
border: 1px solid #b5b8c8;
margin-bottom: 1rem;
overflow-x: scroll;
}
.divBox {
// display: flex;
width: 100%;
flex-wrap: wrap;
border: 1px solid #c2cdfd;
border-radius: 5px;
margin-top: 20px;
min-height: 50px;
padding: 0 10px 10px 20px;
.ant-checkbox-wrapper {
background-color: #fff;
}
.topCheckbox {
height: 20px;
margin: -10px 0 0 0px;
line-height: 20px;
}
.topCheckbox > label :hover {
font-weight: 600;
}
.checkdiv {
display: flex;
flex-wrap: wrap;
// margin-left: 20px;
// justify-content: space-between;
}
}
.boe {
border: 1px solid #d9d9d9;
width: 93%;
margin-left: 3%;
}
......@@ -35,6 +35,7 @@ const MiniMenu = props => {
const [menuID, setMenuID] = useState(''); // 选中的树ID
const [nodeType, setNodeType] = useState(''); // 选中的节点类型
const [info, setInfo] = useState({});
const [infoAll, setInfoAll] = useState({});
const [importOrExportVisible, setImportOrExportVisible] = useState(false); // 导入导出弹窗
const [addVisible, setAddVisible] = useState(false); // 新增弹窗
const [addTwoVisible, setAddTwoVisible] = useState(false); // 编辑弹窗
......@@ -46,6 +47,8 @@ const MiniMenu = props => {
const [modalLoading, setModalLoading] = useState(false);
const [submitLoading, setSubmitLoading] = useState(false);
const [newTreeList, setNewTreeList] = useState([]);
const [checkList, setCheckList] = useState([]);
const [flagg, setFlagg] = useState(0);
const [menuList, setMenuList] = useState([]); // 菜单树
......@@ -141,7 +144,26 @@ const MiniMenu = props => {
.then(res => {
setLoading(false);
if (res.code === 0) {
setInfo({ ...res.data });
let infoList = res.data.relatedRoleList.map(item => ({
groupName: item.groupName,
isChecked: item.isChecked,
list: item.list,
checkedList: new Set([]),
}));
setInfo(infoList);
setInfoAll({ ...res.data });
let data = new Set();
infoList.map(item => {
if (item.isChecked == true) {
data.add(item.groupName);
}
item.list.map(i => {
if (i.related) {
item.checkedList.add(i.relatedRoleCode);
}
});
});
setCheckList(data);
} else {
notification.error({
message: '提示',
......@@ -285,8 +307,9 @@ const MiniMenu = props => {
setLoading(true);
let baseUrl = handleGeturl(prop.imageUrl);
let obj = { ...prop, baseUrl };
console.log(obj);
if (nodeType === 1) {
obj.relatedRoleList = String(roleList) || '';
// obj.relatedRoleList = roleList || '';
editWebMenu({
_dc: Date.now(),
menuID: Number(menuID),
......@@ -295,7 +318,6 @@ const MiniMenu = props => {
})
.then(res => {
setLoading(false);
if (res.code === 0) {
// setFlag(flag + 1);
getTree();
......@@ -331,7 +353,6 @@ const MiniMenu = props => {
})
.then(res => {
setLoading(false);
if (res.code === 0) {
// setFlag(flag + 1);
getTree();
......@@ -357,14 +378,15 @@ const MiniMenu = props => {
}
};
const valueCallback = val => {
let arr = [...val];
let arr2 = [];
arr.map(item => {
if (item.related) {
arr2.push(item.relatedRoleCode);
}
});
setRoleList(arr2);
console.log(val);
// let arr = [...val];
// let arr2 = [];
// arr.map(item => {
// if (item.related) {
// arr2.push(item.relatedRoleCode);
// }
// });
setRoleList(val.toString());
};
// 返回拖拽完毕后的信息
const loop = (data, key, parentID, callback) => {
......@@ -612,6 +634,8 @@ const MiniMenu = props => {
<EditForm
nodeType={nodeType}
info={info}
infoAll={infoAll}
checkList={checkList}
configFiles={configFiles}
productList={productList}
submitCallback={editSubmitCallback}
......
......@@ -65,6 +65,7 @@ const SiteManage = () => {
const [mulu, setMulu] = useState(true); // 展示目录
const [siteList, setSiteList] = useState([]);
const [disFlag, setDisFlag] = useState(false);
// const [childData, setChildData] = useState({visibleValue:''})
// 点击树的回调
const handleTreeSelect = (e, treenode) => {
......@@ -114,10 +115,34 @@ const SiteManage = () => {
getRoleGroupList({ userID: '1' }).then(res => {
setSpinLoading(false);
if (res.code === 0) {
console.log(res.data.roleList);
res.data.roleList.map((i, j) => {
console.log(i);
if (i.child.length == 0) {
let childData = { visibleTitle: '默认分组', roleList: [] };
childData.visibleValue = i.visibleValue;
i.child.push(childData);
} else {
let arr = [];
i.child.map(k => {
arr.push(k.visibleTitle);
// if (k.visibleTitle != '默认分组') {
// console.log(11);
// let childData = { visibleTitle: '默认分组', roleList: [] };
// childData.visibleValue = i.visibleValue;
// i.child.push(childData);
// }
});
if (arr.indexOf('默认分组') == -1) {
let childData = { visibleTitle: '默认分组', roleList: [] };
childData.visibleValue = i.visibleValue;
i.child.push(childData);
}
}
});
console.log(res.data.roleList);
const { roleList } = res.data;
let arr = transTree(roleList);
console.log(roleList);
console.log(arr);
setTreeData(arr);
}
});
......@@ -198,6 +223,7 @@ const SiteManage = () => {
// 树形数据转换;
const transTree = val => {
let arr = val;
console.log(arr);
let newArr = [];
// 提取child里面的数组
let arr2 = arr.filter(item => {
......@@ -273,7 +299,7 @@ const SiteManage = () => {
/>
</Tooltip>
)}
{i.groupflag && (
{i.groupflag && i.groupflag != '默认分组' && (
<Tooltip title="编辑分组" className={styles.fs}>
<EditOutlined
style={{ fontSize: '16px', color: '#1890FF' }}
......@@ -338,7 +364,7 @@ const SiteManage = () => {
/>
</Tooltip>
)}
{itemRole.groupflag && (
{itemRole.groupflag && itemRole.groupflag != '默认分组' && (
<Tooltip title="编辑分组" className={styles.fs}>
<EditOutlined
style={{ fontSize: '16px', color: '#1890FF' }}
......@@ -387,7 +413,7 @@ const SiteManage = () => {
/>
</Tooltip>
)}
{item.groupflag && (
{item.groupflag && item.groupflag != '默认分组' && (
<Tooltip title="编辑分组" className={styles.fs}>
<EditOutlined
style={{ fontSize: '16px', color: '#1890FF' }}
......
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