diff --git a/src/directive/permission/index.ts b/src/directive/permission/index.ts index b8d0dee..5771274 100644 --- a/src/directive/permission/index.ts +++ b/src/directive/permission/index.ts @@ -8,6 +8,7 @@ export const hasPerm: Directive = { mounted(el: HTMLElement, binding: DirectiveBinding) { // 「超级管理员」拥有所有的按钮权限 const { roles, perms } = useUserStoreHook(); + debugger; if (roles.includes('ROOT')) { return true; } @@ -17,6 +18,7 @@ export const hasPerm: Directive = { const requiredPerms = value; // DOM绑定需要的按钮权限标识 const hasPerm = perms?.some(perm => { + debugger; return requiredPerms.includes(perm); }); @@ -24,9 +26,7 @@ export const hasPerm: Directive = { el.parentNode && el.parentNode.removeChild(el); } } else { - throw new Error( - "need perms! Like v-has-perm=\"['sys:user:add','sys:user:edit']\"" - ); + throw new Error("need perms! Like v-has-perm=\"['sys:user:add','sys:user:edit']\""); } } }; diff --git a/src/types/auto-imports.d.ts b/src/types/auto-imports.d.ts index 5742656..67e581d 100644 --- a/src/types/auto-imports.d.ts +++ b/src/types/auto-imports.d.ts @@ -2,7 +2,6 @@ export {} declare global { const EffectScope: typeof import('vue')['EffectScope'] - const ElForm: typeof import('element-plus/es')['ElForm'] const ElMessage: typeof import('element-plus/es')['ElMessage'] const ElMessageBox: typeof import('element-plus/es')['ElMessageBox'] const ElNotification: typeof import('element-plus/es')['ElNotification'] @@ -273,7 +272,6 @@ import { UnwrapRef } from 'vue' declare module 'vue' { interface ComponentCustomProperties { readonly EffectScope: UnwrapRef - readonly ElForm: UnwrapRef readonly ElMessage: UnwrapRef readonly ElMessageBox: UnwrapRef readonly ElNotification: UnwrapRef diff --git a/src/utils/index.ts b/src/utils/index.ts index 40c2fd1..2313c87 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -34,6 +34,35 @@ export function numberRandom(min: number, max: number) { return Math.floor(Math.random() * (max - min + 1) + min); } +/** + * 防抖 + */ +export function debounce(handle, delay) { + var timer = null; + return function () { + var _self = this, + _args = arguments; + clearTimeout(timer); + timer = setTimeout(function () { + handle.apply(_self, _args); + }, delay); + }; +} + +/** + * 节流 + */ +export function throttle(handler, wait) { + var lastTime = 0; + return function (e) { + var nowTime = new Date().getTime(); + if (nowTime - lastTime > wait) { + handler.apply(this, arguments); + lastTime = nowTime; + } + }; +} + /** * 值之间的过度 * @param {number} num 需要过度的数值 @@ -94,6 +123,31 @@ export function diffDays(date: any, otherDate: any) { return Math.ceil(Math.abs(date - otherDate) / (1000 * 60 * 60 * 24)); } +/** + * 计算当前之后一段时间 + * @param {Date} currentTime 当前时间 + * @param {string} type 类型:1:日,2:时,3:分,4:秒,5:月,6:年 + */ +export const endTime = (currentTime: any, type: string) => { + const today = new Date(currentTime); + switch (type) { + case '1': + return new Date(today.getTime() + 24 * 60 * 60 * 1000); + case '2': + return new Date(today.getTime() + 60 * 60 * 1000); + case '3': + return new Date(today.getTime() + 60 * 1000); + case '4': + return new Date(today.getTime() + 1000); + case '5': + return new Date(today.getTime() + 30 * 24 * 60 * 60 * 1000); + case '6': + return new Date(today.getTime() + 365 * 24 * 60 * 60 * 1000); + default: + return today; + } +}; + /** * 确认一个数字是奇数还是偶数 * @param {number} num 数字 diff --git a/src/views/details/index.vue b/src/views/details/index.vue index 4dcfe47..a8fc210 100644 --- a/src/views/details/index.vue +++ b/src/views/details/index.vue @@ -81,7 +81,7 @@ clearable collapse-tags collapse-tags-tooltip - placeholder="请选择分类" + placeholder="请选择参数分类" style="width: 150px" @change="classChange" > @@ -96,7 +96,7 @@ clearable collapse-tags collapse-tags-tooltip - placeholder="请选择参数" + placeholder="请选择曲线参数" @change="parameterChange" >
-
暂无数据
+
暂无数据