lcw
This commit is contained in:
@ -620,7 +620,7 @@ export const idCardNoLogin = (data) => {
|
|||||||
method: "POST",
|
method: "POST",
|
||||||
data
|
data
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
// 通过身份证号获取会话信息
|
// 通过身份证号获取会话信息
|
||||||
export const getSessionForSfzh = (params) => {
|
export const getSessionForSfzh = (params) => {
|
||||||
return request({
|
return request({
|
||||||
@ -636,7 +636,7 @@ export const idCardNoLoginPcs = (data) => {
|
|||||||
method: "POST",
|
method: "POST",
|
||||||
data
|
data
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
// 通过身份证号获取会话信息
|
// 通过身份证号获取会话信息
|
||||||
export const getSessionForSfzhPcs = (params) => {
|
export const getSessionForSfzhPcs = (params) => {
|
||||||
return request({
|
return request({
|
||||||
|
|||||||
@ -1,8 +1,19 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-menu class="el-menu-vertical-demo" :collapse="!$store.getters.sidebarOpened" :default-active="activeMenu"
|
<el-menu
|
||||||
:unique-opened="true" background-color="rgba(0, 0, 0, 0)" :text-color="$store.getters.cssVar.menuText"
|
class="el-menu-vertical-demo"
|
||||||
:active-text-color="$store.getters.cssVar.menuActiveText" router>
|
:collapse="!$store.getters.sidebarOpened"
|
||||||
<SideBarItem v-for="item in routes" :key="item.path" :route="item"></SideBarItem>
|
:default-active="activeMenu"
|
||||||
|
:unique-opened="true"
|
||||||
|
background-color="rgba(0, 0, 0, 0)"
|
||||||
|
:text-color="$store.getters.cssVar.menuText"
|
||||||
|
:active-text-color="$store.getters.cssVar.menuActiveText"
|
||||||
|
router
|
||||||
|
>
|
||||||
|
<SideBarItem
|
||||||
|
v-for="item in routes"
|
||||||
|
:key="item.path"
|
||||||
|
:route="item"
|
||||||
|
></SideBarItem>
|
||||||
</el-menu>
|
</el-menu>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -11,27 +22,62 @@ import { computed } from "vue";
|
|||||||
import { useRouter, useRoute } from "vue-router";
|
import { useRouter, useRoute } from "vue-router";
|
||||||
import { useStore } from "vuex";
|
import { useStore } from "vuex";
|
||||||
import { filterRoutes, generateMenus } from "@/utils/route";
|
import { filterRoutes, generateMenus } from "@/utils/route";
|
||||||
|
import { getItem } from "@/utils/storage";
|
||||||
import SideBarItem from "./SideBarItem.vue";
|
import SideBarItem from "./SideBarItem.vue";
|
||||||
const store = useStore();
|
const store = useStore();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const EXCLUDE_NAMES = [
|
||||||
|
"warningLists",
|
||||||
|
"behaviorWarnings",
|
||||||
|
"identityWarnings",
|
||||||
|
"combinedWarnings",
|
||||||
|
"DeploymentAreas",
|
||||||
|
"mpvPeos",
|
||||||
|
"myControls"
|
||||||
|
];
|
||||||
|
const filterRoutesByMenusPermission = (routes, menusSet) => {
|
||||||
|
return routes.reduce((result, route) => {
|
||||||
|
const children = Array.isArray(route.children)
|
||||||
|
? filterRoutesByMenusPermission(route.children, menusSet)
|
||||||
|
: [];
|
||||||
|
const routeName = route.name ? `${route.name}` : "";
|
||||||
|
const selfMatched = routeName && menusSet.has(routeName);
|
||||||
|
if (selfMatched || children.length > 0) {
|
||||||
|
result.push({ ...route, children });
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}, []);
|
||||||
|
};
|
||||||
const routes = computed(() => {
|
const routes = computed(() => {
|
||||||
const fRoutes = filterRoutes(router.getRoutes());
|
const fRoutes = filterRoutes(router.getRoutes());
|
||||||
|
const data = fRoutes.filter((item) => !EXCLUDE_NAMES.includes(item.name));
|
||||||
|
const menusPermission = getItem("menusPermission");
|
||||||
|
console.log(JSON.parse(localStorage.getItem("menusPermission")));
|
||||||
|
console.log(
|
||||||
|
router.getRoutes().map((r) => ({ name: r.name, path: r.path })),
|
||||||
|
"xxx"
|
||||||
|
);
|
||||||
|
// menusPermission 里存的 name
|
||||||
|
router
|
||||||
|
.getRoutes()
|
||||||
|
.filter((r) => r.path === "/")
|
||||||
|
.map((r) => ({
|
||||||
|
name: r.name,
|
||||||
|
path: r.path,
|
||||||
|
children: r.children?.map((c) => ({ name: c.name, path: c.path }))
|
||||||
|
}));
|
||||||
|
console.log(JSON.parse(localStorage.getItem("menusPermission")));
|
||||||
|
const menusSet = new Set(
|
||||||
|
Array.isArray(menusPermission)
|
||||||
|
? menusPermission.map((item) => `${item}`)
|
||||||
|
: []
|
||||||
|
);
|
||||||
|
console.log(menusSet);
|
||||||
|
|
||||||
const data = fRoutes.filter(item => {
|
const permissionFiltered = menusSet.size
|
||||||
if (item.name != "warningLists"
|
? filterRoutesByMenusPermission(data, menusSet)
|
||||||
&& item.name != "behaviorWarnings"
|
: data;
|
||||||
&& item.name != "identityWarnings"
|
return generateMenus(permissionFiltered);
|
||||||
&& item.name != "combinedWarnings"
|
|
||||||
&& item.name != "DeploymentAreas"
|
|
||||||
&& item.name != "mpvPeos"
|
|
||||||
&& item.name != "myControls") {
|
|
||||||
return item;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
console.log(data);
|
|
||||||
|
|
||||||
return generateMenus(data);
|
|
||||||
});
|
});
|
||||||
if (!store.getters.token) {
|
if (!store.getters.token) {
|
||||||
router.push("/login");
|
router.push("/login");
|
||||||
|
|||||||
@ -15,10 +15,9 @@
|
|||||||
node-key="id"
|
node-key="id"
|
||||||
show-checkbox
|
show-checkbox
|
||||||
default-expand-all
|
default-expand-all
|
||||||
:check-strictly="true"
|
:check-strictly="false"
|
||||||
@check="checkeTree"
|
@check="handleCheck"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<div class="dialog-footer">
|
<div class="dialog-footer">
|
||||||
@ -32,7 +31,7 @@
|
|||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ElMessage } from "element-plus";
|
import { ElMessage } from "element-plus";
|
||||||
import { defineProps, watch, ref, onMounted, nextTick } from "vue";
|
import { defineProps, watch, ref } from "vue";
|
||||||
import {
|
import {
|
||||||
saveRoleMenuInfo,
|
saveRoleMenuInfo,
|
||||||
getRoleMenuIds,
|
getRoleMenuIds,
|
||||||
@ -48,17 +47,31 @@ const props = defineProps({
|
|||||||
required: true
|
required: true
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
const form = ref({});
|
|
||||||
|
|
||||||
const emits = defineEmits(["update:modelValue", "updateRole"]);
|
const emits = defineEmits(["update:modelValue", "updateRole"]);
|
||||||
const closed = () => {
|
const closed = () => {
|
||||||
emits("update:modelValue", false);
|
emits("update:modelValue", false);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 实时记录选中状态
|
||||||
|
const currentCheckedKeys = ref([]);
|
||||||
|
const currentHalfCheckedKeys = ref([]);
|
||||||
|
|
||||||
|
// 勾选事件,实时记录完全选中 + 半选父节点
|
||||||
|
const handleCheck = (data, checkInfo) => {
|
||||||
|
currentCheckedKeys.value = checkInfo.checkedKeys;
|
||||||
|
currentHalfCheckedKeys.value = checkInfo.halfCheckedKeys;
|
||||||
|
};
|
||||||
|
|
||||||
|
// 提交时合并完全选中 + 半选父节点
|
||||||
const onComfirm = () => {
|
const onComfirm = () => {
|
||||||
|
const checkedKeys = treeRef.value.getCheckedKeys();
|
||||||
|
const halfCheckedKeys = treeRef.value.getHalfCheckedKeys();
|
||||||
|
const submitKeys = [...checkedKeys, ...halfCheckedKeys];
|
||||||
|
|
||||||
let params = {
|
let params = {
|
||||||
roleId: Number(props.roleId),
|
roleId: Number(props.roleId),
|
||||||
menuIds: treeRef.value.getCheckedKeys().map((item) => Number(item))
|
menuIds: submitKeys.map((item) => Number(item))
|
||||||
};
|
};
|
||||||
saveRoleMenuInfo(params).then((res) => {
|
saveRoleMenuInfo(params).then((res) => {
|
||||||
ElMessage.success("操作成功");
|
ElMessage.success("操作成功");
|
||||||
@ -69,41 +82,23 @@ const onComfirm = () => {
|
|||||||
//所有权限
|
//所有权限
|
||||||
const allPermission = ref([]);
|
const allPermission = ref([]);
|
||||||
const getPermissionList = async () => {
|
const getPermissionList = async () => {
|
||||||
const res = await getMenuTree({ssxt:'sgxt'});
|
const res = await getMenuTree({ ssxt: "sgxt" });
|
||||||
allPermission.value = res;
|
allPermission.value = res;
|
||||||
};
|
};
|
||||||
getPermissionList();
|
getPermissionList();
|
||||||
|
|
||||||
const treeRef = ref(null);
|
const treeRef = ref(null);
|
||||||
//属性结构配置
|
|
||||||
const defaultProps = {
|
const defaultProps = {
|
||||||
children: "sysMenuList",
|
children: "sysMenuList",
|
||||||
label: "menuName"
|
label: "menuName"
|
||||||
};
|
};
|
||||||
//当前角色权限
|
|
||||||
|
//当前角色权限回显
|
||||||
const getRolePermission = async () => {
|
const getRolePermission = async () => {
|
||||||
const checkedKeys = await getRoleMenuIds(props.roleId);
|
const checkedKeys = await getRoleMenuIds(props.roleId);
|
||||||
treeRef.value.setCheckedKeys(checkedKeys);
|
treeRef.value.setCheckedKeys(checkedKeys);
|
||||||
};
|
};
|
||||||
|
|
||||||
// 选中子节点,默认选中父节点
|
|
||||||
const checkeTree = (data) => {
|
|
||||||
let thisNode = treeRef.value.getNode(data.id); // 获取当前节点
|
|
||||||
const keys = treeRef.value.getCheckedKeys(); // 获取已勾选节点的key值
|
|
||||||
if (thisNode.checked) {
|
|
||||||
// 当前节点若被选中
|
|
||||||
for (let i = thisNode.level; i > 1; i--) {
|
|
||||||
// 判断是否有父级节点
|
|
||||||
if (!thisNode.parent.checked) {
|
|
||||||
// 父级节点未被选中,则将父节点替换成当前节点,往上继续查询,并将此节点key存入keys数组
|
|
||||||
thisNode = thisNode.parent;
|
|
||||||
// keys.push(thisNode.data.id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
treeRef.value.setCheckedKeys(keys); // 将所有keys数组的节点全选中
|
|
||||||
};
|
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => props.roleId,
|
() => props.roleId,
|
||||||
(val) => {
|
(val) => {
|
||||||
|
|||||||
@ -294,7 +294,7 @@ const dialogFormVisible = ref(false);
|
|||||||
const formLabelWidth = "140px";
|
const formLabelWidth = "140px";
|
||||||
// 获取数据的方法
|
// 获取数据的方法
|
||||||
const getListData = async () => {
|
const getListData = async () => {
|
||||||
const params = listQuery.value;
|
const params = { ...listQuery.value, ssxt: "sgxt" };
|
||||||
params.current = params.page;
|
params.current = params.page;
|
||||||
const res = await getRoleList(params);
|
const res = await getRoleList(params);
|
||||||
tableData.value = res?.records;
|
tableData.value = res?.records;
|
||||||
@ -360,7 +360,8 @@ const onSave = () => {
|
|||||||
}
|
}
|
||||||
buttonLoading.value = true;
|
buttonLoading.value = true;
|
||||||
updateSysRole({
|
updateSysRole({
|
||||||
...dialogForm.value
|
...dialogForm.value,
|
||||||
|
ssxt: "sgxt"
|
||||||
})
|
})
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
dialogFormVisible.value = false;
|
dialogFormVisible.value = false;
|
||||||
@ -382,7 +383,8 @@ const onAdd = () => {
|
|||||||
}
|
}
|
||||||
buttonLoading.value = true;
|
buttonLoading.value = true;
|
||||||
addSysRole({
|
addSysRole({
|
||||||
...dialogForm.value
|
...dialogForm.value,
|
||||||
|
ssxt: "sgxt"
|
||||||
})
|
})
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
dialogFormVisible.value = false;
|
dialogFormVisible.value = false;
|
||||||
@ -424,7 +426,7 @@ const allocationUser = (row) => {
|
|||||||
};
|
};
|
||||||
// 高度计算
|
// 高度计算
|
||||||
const tabHeightFn = () => {
|
const tabHeightFn = () => {
|
||||||
tableHeight.value = window.innerHeight - searchBox.value.offsetHeight - 240;
|
tableHeight.value = window.innerHeight - searchBox.value.offsetHeight - 240;
|
||||||
};
|
};
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
tabHeightFn();
|
tabHeightFn();
|
||||||
|
|||||||
@ -3,19 +3,28 @@
|
|||||||
<!-- <el-checkbox-group v-model="userRoleTitleList">
|
<!-- <el-checkbox-group v-model="userRoleTitleList">
|
||||||
<el-checkbox v-for="item in allRoleList" :key="item.id" :label="item.roleName" />
|
<el-checkbox v-for="item in allRoleList" :key="item.id" :label="item.roleName" />
|
||||||
</el-checkbox-group>-->
|
</el-checkbox-group>-->
|
||||||
<el-table max-height="380px" ref="multipleTableRef" :data="allRoleList" style="width: 100%"
|
<el-table
|
||||||
@selection-change="handleSelectionChange">
|
max-height="380px"
|
||||||
|
ref="multipleTableRef"
|
||||||
|
:data="allRoleList"
|
||||||
|
style="width: 100%"
|
||||||
|
@selection-change="handleSelectionChange"
|
||||||
|
>
|
||||||
<el-table-column type="selection" width="55" />
|
<el-table-column type="selection" width="55" />
|
||||||
<el-table-column property="orderNo" label="角色编号" />
|
<el-table-column property="orderNo" label="角色编号" />
|
||||||
<el-table-column property="roleName" label="角色名称" />
|
<el-table-column property="roleName" label="角色名称" />
|
||||||
<el-table-column prop="xtZhxgsj" label="更新时间">
|
<el-table-column prop="xtZhxgsj" label="更新时间">
|
||||||
<template #default="{ row }">{{ $filters.dateFilter(row.xtZhxgsj) }}</template>
|
<template #default="{ row }">{{
|
||||||
|
$filters.dateFilter(row.xtZhxgsj)
|
||||||
|
}}</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<div class="dialog-footer">
|
<div class="dialog-footer">
|
||||||
<el-button @click="closed">取消</el-button>
|
<el-button @click="closed">取消</el-button>
|
||||||
<el-button type="primary" :loading="buttonLoading" @click="onComfirm">保存</el-button>
|
<el-button type="primary" :loading="buttonLoading" @click="onComfirm"
|
||||||
|
>保存</el-button
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
@ -39,13 +48,13 @@ const props = defineProps({
|
|||||||
required: true
|
required: true
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
const buttonLoading = ref(false)
|
const buttonLoading = ref(false);
|
||||||
const emits = defineEmits(["update:modelValue", "updateRole"]);
|
const emits = defineEmits(["update:modelValue", "updateRole"]);
|
||||||
const closed = () => {
|
const closed = () => {
|
||||||
emits("update:modelValue", false);
|
emits("update:modelValue", false);
|
||||||
};
|
};
|
||||||
|
|
||||||
const multipleTableRef = ref(null)
|
const multipleTableRef = ref(null);
|
||||||
|
|
||||||
const multipleSelection = ref([]);
|
const multipleSelection = ref([]);
|
||||||
const handleSelectionChange = (val) => {
|
const handleSelectionChange = (val) => {
|
||||||
@ -83,30 +92,31 @@ const getUserRoles = async () => {
|
|||||||
const res = await getUserRoleList(Number(props.userId));
|
const res = await getUserRoleList(Number(props.userId));
|
||||||
userRoleTitleList.value = res.map((item) => item.id);
|
userRoleTitleList.value = res.map((item) => item.id);
|
||||||
const hx = [];
|
const hx = [];
|
||||||
allRoleList.value.forEach(item => {
|
allRoleList.value.forEach((item) => {
|
||||||
if (userRoleTitleList.value.includes(item.id)) {
|
if (userRoleTitleList.value.includes(item.id)) {
|
||||||
hx.push(item)
|
hx.push(item);
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
toggleSelection(hx)
|
toggleSelection(hx);
|
||||||
};
|
};
|
||||||
|
|
||||||
const toggleSelection = (rows) => {
|
const toggleSelection = (rows) => {
|
||||||
if (rows) {
|
if (rows) {
|
||||||
rows.forEach((row) => {
|
rows.forEach((row) => {
|
||||||
multipleTableRef.value.toggleRowSelection(row, true)
|
multipleTableRef.value.toggleRowSelection(row, true);
|
||||||
})
|
});
|
||||||
} else {
|
} else {
|
||||||
multipleTableRef.value.clearSelection()
|
multipleTableRef.value.clearSelection();
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
//所有角色
|
//所有角色
|
||||||
const allRoleList = ref([]);
|
const allRoleList = ref([]);
|
||||||
const getAllRoleList = async () => {
|
const getAllRoleList = async () => {
|
||||||
const params = {
|
const params = {
|
||||||
page: 1,
|
page: 1,
|
||||||
size: 999
|
size: 999,
|
||||||
|
ssxt: "sgxt"
|
||||||
};
|
};
|
||||||
const res = await getRoleList(params);
|
const res = await getRoleList(params);
|
||||||
allRoleList.value = res?.records;
|
allRoleList.value = res?.records;
|
||||||
@ -123,5 +133,4 @@ watch(
|
|||||||
);
|
);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style></style>
|
||||||
</style>
|
|
||||||
|
|||||||
@ -8,9 +8,9 @@ function resolve(dir) {
|
|||||||
// const serverHost = "http://192.168.2.206:8006"//线上
|
// const serverHost = "http://192.168.2.206:8006"//线上
|
||||||
// const serverHost = "http://192.168.191.75:8006"//周
|
// const serverHost = "http://192.168.191.75:8006"//周
|
||||||
// const serverHost = "http://192.168.212.75:8016"//周
|
// const serverHost = "http://192.168.212.75:8016"//周
|
||||||
// const serverHost = "http://192.168.1.98:8006"//毛毛
|
const serverHost = "http://192.168.1.162:8006"; //毛毛
|
||||||
// const serverHost = "http:// 192.168.1.45:8006"; //线上
|
// const serverHost = "http:// 192.168.1.45:8006"; //线上
|
||||||
const serverHost = "http://47.108.232.77:9537"; //线上
|
// const serverHost = "http://47.108.232.77:9537"; //线上
|
||||||
module.exports = {
|
module.exports = {
|
||||||
// configureWebpack: {
|
// configureWebpack: {
|
||||||
// resolve: {
|
// resolve: {
|
||||||
|
|||||||
Reference in New Issue
Block a user