Browse Source

优化代码

develop
fuguobin 11 months ago
parent
commit
78913feba2
  1. 2
      src/directive/permission/index.ts
  2. 5
      src/utils/useStorage.ts
  3. 2
      src/views/dataScreen/devicemanage/components/main.vue
  4. 1
      src/views/dataScreen/screen/components/main.vue
  5. 1
      src/views/monitoring/components/header.vue
  6. 2
      src/views/monitoring/devicemanage/components/main.vue
  7. 1
      src/views/monitoring/screen/components/main.vue

2
src/directive/permission/index.ts

@ -8,7 +8,6 @@ export const hasPerm: Directive = {
mounted(el: HTMLElement, binding: DirectiveBinding) {
// 「超级管理员」拥有所有的按钮权限
const { roles, perms } = useUserStoreHook();
debugger;
if (roles.includes('ROOT')) {
return true;
}
@ -18,7 +17,6 @@ export const hasPerm: Directive = {
const requiredPerms = value; // DOM绑定需要的按钮权限标识
const hasPerm = perms?.some(perm => {
debugger;
return requiredPerms.includes(perm);
});

5
src/utils/useStorage.ts

@ -20,7 +20,6 @@ const getItem = (key: string, storageType: StorageType): any => {
try {
const storage = getStorage(storageType);
const item = storage.getItem(key);
debugger
if (item) {
return JSON.parse(item);
}
@ -69,7 +68,7 @@ const initializeStorage = (storageType: StorageType): void => {
const storage = getStorage(storageType);
const keys = Object.keys(storage);
storageData.value = keys.map((key) => ({
storageData.value = keys.map(key => ({
key,
value: getItem(key, storageType)
}));
@ -89,7 +88,7 @@ const useStorage = (storageType: StorageType) => {
const removeUseStorage = (key: string) => {
removeItem(key, storageType);
const index = storageData.value.findIndex((item) => item.key === key);
const index = storageData.value.findIndex(item => item.key === key);
if (index !== -1) {
storageData.value.splice(index, 1);
}

2
src/views/dataScreen/devicemanage/components/main.vue

@ -372,7 +372,6 @@ onUnmounted(() => {
// const arr = infoData.value[0].header_main
// const obj=arr.find((item: any) => item.id === id)
// const lable=obj!=undefined?`${obj.label}:${obj.value}`:''
// debugger
// return lable;
// };
@ -381,7 +380,6 @@ onUnmounted(() => {
// const arr = infoData.value[0].header_main
// const obj = arr.find((item: any) => item.id === id)
// const lable = obj != undefined ? `${obj.label}:${obj.value}` : ''
// debugger
// return lable;
// };
// });

1
src/views/dataScreen/screen/components/main.vue

@ -306,7 +306,6 @@ mitt.on('tableMessage', (res: any) => {
// }
// res.data.map((item: any) => {
// console.log(item)
// debugger
// const index = tableData.value.findIndex((obj) => obj.id === item.id);
// if (index !== -1) {
// tableData.value.splice(index, 1, res.data);

1
src/views/monitoring/components/header.vue

@ -258,7 +258,6 @@ mitt.on('waringMessage', res => {
// console.log(item.deviceName, item.alertSwitch);
if (item.alertSwitch === '1') {
// alarmRef.value.play();
// debugger;
// if (alarmRef.value) {
// //
// alarmRef.value.addEventListener('canplay', () => {

2
src/views/monitoring/devicemanage/components/main.vue

@ -372,7 +372,6 @@ onUnmounted(() => {
// const arr = infoData.value[0].header_main
// const obj=arr.find((item: any) => item.id === id)
// const lable=obj!=undefined?`${obj.label}:${obj.value}`:''
// debugger
// return lable;
// };
@ -381,7 +380,6 @@ onUnmounted(() => {
// const arr = infoData.value[0].header_main
// const obj = arr.find((item: any) => item.id === id)
// const lable = obj != undefined ? `${obj.label}:${obj.value}` : ''
// debugger
// return lable;
// };
// });

1
src/views/monitoring/screen/components/main.vue

@ -315,7 +315,6 @@ mitt.on('tableMessage', (res: any) => {
// }
// res.data.map((item: any) => {
// console.log(item)
// debugger
// const index = tableData.value.findIndex((obj) => obj.id === item.id);
// if (index !== -1) {
// tableData.value.splice(index, 1, res.data);

Loading…
Cancel
Save