Browse Source

增加权限

develop
fuguobin 9 months ago
parent
commit
c2f906eb3f
  1. 2
      src/api/dataVisual/index.ts
  2. 4
      src/mock/routes.json
  3. 8
      src/store/modules/permission.ts
  4. 4
      src/types/auto-imports.d.ts
  5. 52
      src/views/dashboard/index.vue

2
src/api/dataVisual/index.ts

@ -27,7 +27,7 @@ export function getrealTime(queryParams: any) {
*/ */
export function getTempChart(queryParams: any) { export function getTempChart(queryParams: any) {
return request({ return request({
url: '/dc/heatSourceScreen/heatExchangeStation/temperature/history/Data', url: '/dc/heatSourceScreen/heatExchangeStation/temperature/history/data',
method: 'get', method: 'get',
params: queryParams params: queryParams
}); });

4
src/mock/routes.json

@ -8,7 +8,7 @@
"title": "监控系统", "title": "监控系统",
"icon": "multi_level", "icon": "multi_level",
"hidden": false, "hidden": false,
"roles": ["biadmin"], "roles": ["biadmin", "1bigscreen"],
"keepAlive": true "keepAlive": true
}, },
"children": [ "children": [
@ -68,7 +68,7 @@
"title": "换热站监控", "title": "换热站监控",
"icon": "document", "icon": "document",
"hidden": false, "hidden": false,
"roles": ["biadmin"], "roles": ["biadmin", "1bigscreen"],
"keepAlive": true "keepAlive": true
} }
} }

8
src/store/modules/permission.ts

@ -89,10 +89,10 @@ export const usePermissionStore = defineStore('permission', () => {
.then(({ data: asyncRoutes }) => { .then(({ data: asyncRoutes }) => {
// 根据角色获取有访问权限的路由 // 根据角色获取有访问权限的路由
// if (asyncRoutes.length === 0) { // if (asyncRoutes.length === 0) {
const routesArr = routesData.data; const routesArr = routesData.data;
const accessedRoutes = filterAsyncRoutes(routesArr, roles); const accessedRoutes = filterAsyncRoutes(routesArr, roles);
setRoutes(accessedRoutes); setRoutes(accessedRoutes);
resolve(accessedRoutes); resolve(accessedRoutes);
// } else { // } else {
// const accessedRoutes = filterAsyncRoutes(asyncRoutes, roles); // const accessedRoutes = filterAsyncRoutes(asyncRoutes, roles);
// setRoutes(accessedRoutes); // setRoutes(accessedRoutes);

4
src/types/auto-imports.d.ts

@ -2,9 +2,11 @@
export {} export {}
declare global { declare global {
const EffectScope: typeof import('vue')['EffectScope'] const EffectScope: typeof import('vue')['EffectScope']
const ElForm: typeof import('element-plus/es')['ElForm']
const ElMessage: typeof import('element-plus/es')['ElMessage'] const ElMessage: typeof import('element-plus/es')['ElMessage']
const ElMessageBox: typeof import('element-plus/es')['ElMessageBox'] const ElMessageBox: typeof import('element-plus/es')['ElMessageBox']
const ElNotification: typeof import('element-plus/es')['ElNotification'] const ElNotification: typeof import('element-plus/es')['ElNotification']
const NEllipsis: typeof import('naive-ui')['NEllipsis']
const asyncComputed: typeof import('@vueuse/core')['asyncComputed'] const asyncComputed: typeof import('@vueuse/core')['asyncComputed']
const autoResetRef: typeof import('@vueuse/core')['autoResetRef'] const autoResetRef: typeof import('@vueuse/core')['autoResetRef']
const computed: typeof import('vue')['computed'] const computed: typeof import('vue')['computed']
@ -271,9 +273,11 @@ import { UnwrapRef } from 'vue'
declare module 'vue' { declare module 'vue' {
interface ComponentCustomProperties { interface ComponentCustomProperties {
readonly EffectScope: UnwrapRef<typeof import('vue')['EffectScope']> readonly EffectScope: UnwrapRef<typeof import('vue')['EffectScope']>
readonly ElForm: UnwrapRef<typeof import('element-plus/es')['ElForm']>
readonly ElMessage: UnwrapRef<typeof import('element-plus/es')['ElMessage']> readonly ElMessage: UnwrapRef<typeof import('element-plus/es')['ElMessage']>
readonly ElMessageBox: UnwrapRef<typeof import('element-plus/es')['ElMessageBox']> readonly ElMessageBox: UnwrapRef<typeof import('element-plus/es')['ElMessageBox']>
readonly ElNotification: UnwrapRef<typeof import('element-plus/es')['ElNotification']> readonly ElNotification: UnwrapRef<typeof import('element-plus/es')['ElNotification']>
readonly NEllipsis: UnwrapRef<typeof import('naive-ui')['NEllipsis']>
readonly asyncComputed: UnwrapRef<typeof import('@vueuse/core')['asyncComputed']> readonly asyncComputed: UnwrapRef<typeof import('@vueuse/core')['asyncComputed']>
readonly autoResetRef: UnwrapRef<typeof import('@vueuse/core')['autoResetRef']> readonly autoResetRef: UnwrapRef<typeof import('@vueuse/core')['autoResetRef']>
readonly computed: UnwrapRef<typeof import('vue')['computed']> readonly computed: UnwrapRef<typeof import('vue')['computed']>

52
src/views/dashboard/index.vue

@ -98,7 +98,7 @@ const isCurrentRoute = ref(true);
const userStore = useUserStore(); const userStore = useUserStore();
const duration = 5000; const duration = 5000;
const userNumber = ref(2800); const userNumber = ref(2800);
// const notice = ref({}); const notice = ref({});
// const vsitsNumber = transitionNum(720, 5000); // const vsitsNumber = transitionNum(720, 5000);
const currentTime = useDateFormat(useNow(), 'YYYY-MM-DD HH:mm:ss'); const currentTime = useDateFormat(useNow(), 'YYYY-MM-DD HH:mm:ss');
const hoursNow = useNow().value.getHours(); const hoursNow = useNow().value.getHours();
@ -177,32 +177,32 @@ const timePeriod = computed(() => {
onMounted(() => { onMounted(() => {
getWeatherData(); getWeatherData();
// socket.initialize(wsUrl); // socket.initialize(wsUrl);
// const webVersion = sessionStorage.getItem('webVersion'); const webVersion = sessionStorage.getItem('webVersion');
// if (webVersion != '' && webVersion != null) { if (webVersion != '' && webVersion != null) {
// const version = JSON.parse(webVersion); const version = JSON.parse(webVersion);
// notice.value = ElNotification({ notice.value = ElNotification({
// title: version.noticeTitle, title: version.noticeTitle,
// dangerouslyUseHTMLString: true, dangerouslyUseHTMLString: true,
// customClass: 'notice', customClass: 'notice',
// duration: 0, duration: 0,
// message: version.noticeContent.replace(/\n/g, '<br>'), message: version.noticeContent.replace(/\n/g, '<br>'),
// onClose: () => { onClose: () => {
// noticeCloce(version.noticeId); noticeCloce(version.noticeId);
// } }
// }); });
// } }
}); });
// function noticeCloce(id: any) { function noticeCloce(id: any) {
// // //
// const params = { const params = {
// versionId: id versionId: id
// }; };
// userVersionRelation(params).then((res: any) => { userVersionRelation(params).then((res: any) => {
// if (res.code === 200) { if (res.code === 200) {
// console.log(''); console.log('更新日志关闭!');
// } }
// }); });
// } }
function getWeatherData() { function getWeatherData() {
// //
getWeather().then((res: any) => { getWeather().then((res: any) => {

Loading…
Cancel
Save