fix:不同角色跳转
This commit is contained in:
1 parent
5b4c94164c
commit
b736fef16a
9 files changed
+85
-16
No files matched your search
@@ -14,6 +14,7 @@ export const useUserInfo = defineStore('userInfo', {
|
||||
photo: '',
|
||||
time: 0,
|
||||
roles: [],
|
||||
roleCodes: [],
|
||||
authBtnList: [],
|
||||
},
|
||||
}),
|
||||
@@ -126,6 +127,7 @@ export const useUserInfo = defineStore('userInfo', {
|
||||
user: res.data.sysUser,
|
||||
time: new Date().getTime(),
|
||||
roles: res.data.roles,
|
||||
roleCodes: res.data.roleCodes,
|
||||
authBtnList: res.data.permissions,
|
||||
};
|
||||
this.userInfos = userInfo;
|
||||
|
||||
@@ -11,6 +11,19 @@ export const roleConstant = {
|
||||
DEVICE_ROLE: '400',
|
||||
}
|
||||
|
||||
export const roleCodeConstant = {
|
||||
// 交接班管理员
|
||||
WORKFORCE: "WORKFORCE",
|
||||
// 设备管理员
|
||||
DEVICE_MANAGE: "DEVICE_MANAGE",
|
||||
// 系统管理员
|
||||
SYSTEM_ADMIN: "SYSTEM_ADMIN",
|
||||
// 普通用户
|
||||
GENERAL_USER: "GENERAL_USER",
|
||||
// 管理员
|
||||
ROLE_ADMIN: "ROLE_ADMIN",
|
||||
}
|
||||
|
||||
/**
|
||||
* 打开大屏地址
|
||||
* @param url 大屏地址
|
||||
|
||||
@@ -222,10 +222,10 @@ function getDictByValue(value: any, tag: any) {
|
||||
function openReplayDialog(row: any) {
|
||||
const dateTime = row.capTime
|
||||
if (!dateTime) return
|
||||
// 获取dateTime前后30秒的时间
|
||||
// 获取dateTime前后15秒的时间
|
||||
const baseTime = new Date(dateTime)
|
||||
const startDateTime = new Date(baseTime.getTime() - 30 * 1000)
|
||||
const endDateTime = new Date(baseTime.getTime() + 30 * 1000)
|
||||
const startDateTime = new Date(baseTime.getTime() - 15 * 1000)
|
||||
const endDateTime = new Date(baseTime.getTime() + 15 * 1000)
|
||||
|
||||
const startTime = parseTime(startDateTime, '{y}-{m}-{d} {h}:{i}:{s}')
|
||||
const endTime = parseTime(endDateTime, '{y}-{m}-{d} {h}:{i}:{s}')
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
<el-table-column prop="groupName" label="设备" />
|
||||
<el-table-column label="设备">
|
||||
<el-table-column prop="deviceName" label="设备名" />
|
||||
<el-table-column prop="channelName" label="通道名" />
|
||||
<el-table-column prop="deviceIp" label="设备ip">
|
||||
<template #default="{ row }">
|
||||
<span>{{ row.deviceIp }}</span>
|
||||
|
||||
@@ -224,10 +224,10 @@ function getDictByValue(value: any, tag: any) {
|
||||
function openReplayDialog(row: any) {
|
||||
const dateTime = row.swingTime
|
||||
if (!dateTime) return
|
||||
// 获取dateTime前后30秒的时间
|
||||
// 获取dateTime前后15秒的时间
|
||||
const baseTime = new Date(dateTime)
|
||||
const startDateTime = new Date(baseTime.getTime() - 30 * 1000)
|
||||
const endDateTime = new Date(baseTime.getTime() + 30 * 1000)
|
||||
const startDateTime = new Date(baseTime.getTime() - 15 * 1000)
|
||||
const endDateTime = new Date(baseTime.getTime() + 15 * 1000)
|
||||
|
||||
const startTime = parseTime(startDateTime, '{y}-{m}-{d} {h}:{i}:{s}')
|
||||
const endTime = parseTime(endDateTime, '{y}-{m}-{d} {h}:{i}:{s}')
|
||||
|
||||
@@ -96,6 +96,14 @@
|
||||
<dict-tag :options="dh_door_open_type" :value="row.openType" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="设备" min-width="280">
|
||||
<template #default="{ row }">
|
||||
<div class="flex items-center justify-start">
|
||||
<span>{{ row.deviceName }}</span>
|
||||
<span v-if="row.channelName">{{ row.channelName }}</span>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="抓图图片" min-width="100">
|
||||
<template #default="{ row }">
|
||||
<preview-image width="50px" height="50px" v-if="row.parseRecordImage" :src="row.parseRecordImage" />
|
||||
|
||||
@@ -5,9 +5,11 @@
|
||||
<select-duty v-model="refreshForm.dutyId" autoFirst style="width: 250px;" />
|
||||
</com-title>
|
||||
<el-table v-if="tableHeaderList && tableHeaderList.length" style="padding-top: 10px;" :data="disposeDataList"
|
||||
v-loading="state.loading" border :cell-style="tableStyle.cellStyle"
|
||||
:header-cell-style="tableStyle.headerCellStyle" @sort-change="sortChangeHandle">
|
||||
<el-table-column v-for="(v, i) in tableHeaderList" width="110" :prop="v.prop" :label="v.label">
|
||||
v-loading="state.loading" border
|
||||
:cell-style="{ ...tableStyle.cellStyle, fontSize: '12px', padding: '8px 0 !important' }"
|
||||
:header-cell-style="{ ...tableStyle.headerCellStyle, fontSize: '12px', padding: '8px 0 !important' }"
|
||||
@sort-change="sortChangeHandle">
|
||||
<el-table-column v-for="(v, i) in tableHeaderList" :width="getWidth(v)" :prop="v.prop" :label="v.label">
|
||||
<el-table-column v-if="v.children && v.children.length" v-for="(v2, i2) in v.children" :prop="v2.prop"
|
||||
:label="v2.label" />
|
||||
</el-table-column>
|
||||
@@ -67,6 +69,13 @@ watch(
|
||||
},
|
||||
)
|
||||
|
||||
const getWidth = (v: any) => {
|
||||
if (v.children && v.children.length) {
|
||||
return 10
|
||||
}
|
||||
return 100
|
||||
}
|
||||
|
||||
const refresh = async (id: string) => {
|
||||
state.queryForm.dutyId = id
|
||||
if (!id) return
|
||||
@@ -130,4 +139,16 @@ const getsysDutyData = async (id: string) => {
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
<style lang="scss">
|
||||
.el-cell {
|
||||
padding: 0 !important;
|
||||
background: red !important;
|
||||
}
|
||||
|
||||
.el-table__cell {
|
||||
:deep(.el-cell) {
|
||||
padding: 0 !important;
|
||||
background: red !important;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -22,12 +22,30 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="dutyPlan">
|
||||
import { useTagsViewRoutes } from '/@/stores/tagsViewRoutes';
|
||||
|
||||
const CarList = defineAsyncComponent(() => import('./components/car-list.vue'));
|
||||
const DoorList = defineAsyncComponent(() => import('./components/door-list.vue'));
|
||||
const DutyTable = defineAsyncComponent(() => import('./components/duty-table.vue'));
|
||||
const VideoPay = defineAsyncComponent(() => import('./components/video-pay.vue'));
|
||||
|
||||
const stores = useTagsViewRoutes();
|
||||
|
||||
onBeforeMount(() => {
|
||||
const query: any = useRoute().query
|
||||
if (query && query.action == 'login') {
|
||||
stores.setCurrenFullscreen(true)
|
||||
}
|
||||
})
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
const query: any = useRoute().query
|
||||
if (query && query.action == 'login') {
|
||||
stores.setCurrenFullscreen(false)
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
@@ -67,7 +67,7 @@ import { useMessage } from '/@/hooks/message';
|
||||
import { Session, Local } from '/@/utils/storage';
|
||||
import { initBackEndControlRoutes } from '/@/router/backEnd';
|
||||
import { LoginTypeEnum } from '/@/api/login';
|
||||
import { openPlanUrl, roleConstant } from "/@/utils/plan"
|
||||
import { openPlanUrl, roleCodeConstant } from "/@/utils/plan"
|
||||
import { useUserInfo } from '/@/stores/userInfo';
|
||||
|
||||
// 引入组件
|
||||
@@ -119,14 +119,20 @@ const jumpAdminPanel = () => {
|
||||
console.log("userInfos", useUserInfoStore.userInfos);
|
||||
const isDev = import.meta.env.MODE == "development"
|
||||
const baseAdminUrl = isDev ? 'http://localhost:5173/device' : 'http://192.168.50.10:7001/device';
|
||||
|
||||
const roles = useUserInfoStore.userInfos?.roles ?? []
|
||||
if (!roles || !roles.length) {
|
||||
const roleCodes = useUserInfoStore.userInfos?.roleCodes ?? []
|
||||
if (!roleCodes || !roleCodes.length) {
|
||||
openPlanUrl(baseAdminUrl, true)
|
||||
return
|
||||
}
|
||||
if (roles.includes(roleConstant.CAMP_ROLE)) {
|
||||
|
||||
// 设备管理员 | 系统管理员
|
||||
if (roleCodes.includes(roleCodeConstant.DEVICE_MANAGE) || roleCodes.includes(roleCodeConstant.SYSTEM_ADMIN)) {
|
||||
openPlanUrl(baseAdminUrl, true)
|
||||
return
|
||||
}
|
||||
// 交接班管理员
|
||||
if (roleCodes.includes(roleCodeConstant.WORKFORCE)) {
|
||||
router.push({ path: "/duty/dutyPlan/index", query: { action: "login" } });
|
||||
return
|
||||
}
|
||||
openPlanUrl(baseAdminUrl, true)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user