refactor: ♻️ 代码规范优化
This commit is contained in:
@@ -74,9 +74,7 @@ module.exports = {
|
|||||||
breaklineNumber: 100,
|
breaklineNumber: 100,
|
||||||
breaklineChar: "|",
|
breaklineChar: "|",
|
||||||
skipQuestions: [],
|
skipQuestions: [],
|
||||||
issuePrefixes: [
|
issuePrefixes: [{ value: "closed", name: "closed: ISSUES has been processed" }],
|
||||||
{ value: "closed", name: "closed: ISSUES has been processed" },
|
|
||||||
],
|
|
||||||
customIssuePrefixAlign: "top",
|
customIssuePrefixAlign: "top",
|
||||||
emptyIssuePrefixAlias: "skip",
|
emptyIssuePrefixAlias: "skip",
|
||||||
customIssuePrefixAlias: "custom",
|
customIssuePrefixAlias: "custom",
|
||||||
|
|||||||
@@ -586,6 +586,7 @@ cols.value.forEach((item) => {
|
|||||||
fields.push(item.prop);
|
fields.push(item.prop);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const enum ExportsOriginEnum {
|
const enum ExportsOriginEnum {
|
||||||
CURRENT = "current",
|
CURRENT = "current",
|
||||||
SELECTED = "selected",
|
SELECTED = "selected",
|
||||||
@@ -950,7 +951,7 @@ function exportPageData(formData: IObject = {}) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 浏览器保存文件
|
// 浏览器保存文件
|
||||||
function saveXlsx(fileData: BlobPart, fileName: string) {
|
function saveXlsx(fileData: any, fileName: string) {
|
||||||
const fileType =
|
const fileType =
|
||||||
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8";
|
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8";
|
||||||
|
|
||||||
|
|||||||
@@ -69,7 +69,7 @@
|
|||||||
<slot
|
<slot
|
||||||
:name="item.slotName ?? item.prop"
|
:name="item.slotName ?? item.prop"
|
||||||
:prop="item.prop"
|
:prop="item.prop"
|
||||||
:formData="formData"
|
:form-data="formData"
|
||||||
:attrs="item.attrs"
|
:attrs="item.attrs"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
@@ -137,11 +137,11 @@ function getFormData(key?: string) {
|
|||||||
// 设置表单值
|
// 设置表单值
|
||||||
function setFormData(data: IObject) {
|
function setFormData(data: IObject) {
|
||||||
for (const key in formData) {
|
for (const key in formData) {
|
||||||
if (formData.hasOwnProperty(key) && key in data) {
|
if (Object.prototype.hasOwnProperty.call(formData, key) && key in data) {
|
||||||
formData[key] = data[key];
|
formData[key] = data[key];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (data?.hasOwnProperty(props.pk)) {
|
if (Object.prototype.hasOwnProperty.call(data, props.pk)) {
|
||||||
formData[props.pk] = data[props.pk];
|
formData[props.pk] = data[props.pk];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -90,7 +90,7 @@
|
|||||||
<slot
|
<slot
|
||||||
:name="item.slotName ?? item.prop"
|
:name="item.slotName ?? item.prop"
|
||||||
:prop="item.prop"
|
:prop="item.prop"
|
||||||
:formData="formData"
|
:form-data="formData"
|
||||||
:attrs="item.attrs"
|
:attrs="item.attrs"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
@@ -208,7 +208,7 @@
|
|||||||
<slot
|
<slot
|
||||||
:name="item.slotName ?? item.prop"
|
:name="item.slotName ?? item.prop"
|
||||||
:prop="item.prop"
|
:prop="item.prop"
|
||||||
:formData="formData"
|
:form-data="formData"
|
||||||
:attrs="item.attrs"
|
:attrs="item.attrs"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
@@ -294,11 +294,11 @@ function getFormData(key?: string) {
|
|||||||
// 设置表单值
|
// 设置表单值
|
||||||
function setFormData(data: IObject) {
|
function setFormData(data: IObject) {
|
||||||
for (const key in formData) {
|
for (const key in formData) {
|
||||||
if (formData.hasOwnProperty(key) && key in data) {
|
if (Object.prototype.hasOwnProperty.call(formData, key) && key in data) {
|
||||||
formData[key] = data[key];
|
formData[key] = data[key];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (data?.hasOwnProperty(pk)) {
|
if (Object.prototype.hasOwnProperty.call(data, pk)) {
|
||||||
formData[pk] = data[pk];
|
formData[pk] = data[pk];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -143,7 +143,7 @@
|
|||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref, reactive, computed } from "vue";
|
import { ref, reactive, computed } from "vue";
|
||||||
import { onClickOutside, useResizeObserver } from "@vueuse/core";
|
import { useResizeObserver } from "@vueuse/core";
|
||||||
import type { FormInstance, PopoverProps, TableInstance } from "element-plus";
|
import type { FormInstance, PopoverProps, TableInstance } from "element-plus";
|
||||||
|
|
||||||
// 对象类型
|
// 对象类型
|
||||||
@@ -157,7 +157,7 @@ export interface ISelectConfig<T = any> {
|
|||||||
// popover组件属性
|
// popover组件属性
|
||||||
popover?: Partial<Omit<PopoverProps, "visible" | "v-model:visible">>;
|
popover?: Partial<Omit<PopoverProps, "visible" | "v-model:visible">>;
|
||||||
// 列表的网络请求函数(需返回promise)
|
// 列表的网络请求函数(需返回promise)
|
||||||
indexAction: (queryParams: T) => Promise<any>;
|
indexAction: (_queryParams: T) => Promise<any>;
|
||||||
// 主键名(跨页选择必填,默认为id)
|
// 主键名(跨页选择必填,默认为id)
|
||||||
pk?: string;
|
pk?: string;
|
||||||
// 多选
|
// 多选
|
||||||
@@ -284,7 +284,7 @@ const selectedItems = ref<IObject[]>([]);
|
|||||||
const confirmText = computed(() => {
|
const confirmText = computed(() => {
|
||||||
return selectedItems.value.length > 0 ? `已选(${selectedItems.value.length})` : "确 定";
|
return selectedItems.value.length > 0 ? `已选(${selectedItems.value.length})` : "确 定";
|
||||||
});
|
});
|
||||||
function handleSelect(selection: any[], row: any) {
|
function handleSelect(selection: any[], _row: any) {
|
||||||
if (isMultiple || selection.length === 0) {
|
if (isMultiple || selection.length === 0) {
|
||||||
// 多选
|
// 多选
|
||||||
selectedItems.value = selection;
|
selectedItems.value = selection;
|
||||||
|
|||||||
@@ -192,7 +192,11 @@ const handleSuccess = (fileInfo: FileInfo) => {
|
|||||||
modelValue.value = [...modelValue.value, fileInfo.url];
|
modelValue.value = [...modelValue.value, fileInfo.url];
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleError = (error: any) => {
|
/**
|
||||||
|
* 上传失败
|
||||||
|
*/
|
||||||
|
const handleError = (_error: any) => {
|
||||||
|
console.error(_error);
|
||||||
ElMessage.error("上传失败");
|
ElMessage.error("上传失败");
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -223,8 +227,8 @@ function handleDownload(file: UploadUserFile) {
|
|||||||
color: var(--el-text-color-regular);
|
color: var(--el-text-color-regular);
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
opacity: 0.75;
|
opacity: 0.75;
|
||||||
transition: opacity var(--el-transition-duration);
|
|
||||||
transform: translateY(-50%);
|
transform: translateY(-50%);
|
||||||
|
transition: opacity var(--el-transition-duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
:deep(.el-upload-list) {
|
:deep(.el-upload-list) {
|
||||||
|
|||||||
@@ -169,7 +169,7 @@ function handleUpload(options: UploadRequestOptions) {
|
|||||||
/**
|
/**
|
||||||
* 上传文件超出限制
|
* 上传文件超出限制
|
||||||
*/
|
*/
|
||||||
function handleExceed(files: File[], uploadFiles: UploadUserFile[]) {
|
function handleExceed() {
|
||||||
ElMessage.warning("最多只能上传" + props.limit + "张图片");
|
ElMessage.warning("最多只能上传" + props.limit + "张图片");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -67,12 +67,12 @@ const isMobile = computed(() => appStore.device === DeviceEnum.MOBILE);
|
|||||||
margin: 10px 0;
|
margin: 10px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.dark .navbar__right > *:hover {
|
|
||||||
background: rgb(255 255 255 / 20%);
|
|
||||||
}
|
|
||||||
|
|
||||||
.layout-top .navbar__right > *,
|
.layout-top .navbar__right > *,
|
||||||
.layout-mix .navbar__right > * {
|
.layout-mix .navbar__right > * {
|
||||||
color: #fff;
|
color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.dark .navbar__right > *:hover {
|
||||||
|
color: #ccc;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -149,10 +149,10 @@ function resolvePath(routePath: string) {
|
|||||||
|
|
||||||
& > span {
|
& > span {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
|
visibility: hidden;
|
||||||
width: 0;
|
width: 0;
|
||||||
height: 0;
|
height: 0;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
visibility: hidden;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -178,10 +178,10 @@ function resolvePath(routePath: string) {
|
|||||||
.el-sub-menu {
|
.el-sub-menu {
|
||||||
& > .el-sub-menu__title > span {
|
& > .el-sub-menu__title > span {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
|
visibility: hidden;
|
||||||
width: 0;
|
width: 0;
|
||||||
height: 0;
|
height: 0;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
visibility: hidden;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
<template>
|
<template>
|
||||||
<div :class="{ 'has-logo': sidebarLogo }">
|
<div :class="{ 'has-logo': sidebarLogo }">
|
||||||
<!-- 混合 -->
|
<!-- 混合布局 -->
|
||||||
<div v-if="isMixLayout" class="flex w-full">
|
<div v-if="layout == LayoutEnum.MIX" class="flex w-full">
|
||||||
<SidebarLogo v-if="sidebarLogo" :collapse="isSidebarCollapsed" />
|
<SidebarLogo v-if="sidebarLogo" :collapse="isSidebarCollapsed" />
|
||||||
<SidebarMixTopMenu class="flex-1" />
|
<SidebarMixTopMenu class="flex-1" />
|
||||||
<NavbarRight />
|
<NavbarRight />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 顶部 || 左侧 -->
|
<!-- 顶部布局 || 左侧布局 -->
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<SidebarLogo v-if="sidebarLogo" :collapse="isSidebarCollapsed" />
|
<SidebarLogo v-if="sidebarLogo" :collapse="isSidebarCollapsed" />
|
||||||
<el-scrollbar>
|
<el-scrollbar>
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
</el-scrollbar>
|
</el-scrollbar>
|
||||||
|
|
||||||
<!-- 顶部导航 -->
|
<!-- 顶部导航 -->
|
||||||
<NavbarRight v-if="isTopLayout" />
|
<NavbarRight v-if="layout == LayoutEnum.TOP" />
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -33,8 +33,6 @@ const permissionStore = usePermissionStore();
|
|||||||
const sidebarLogo = computed(() => settingsStore.sidebarLogo);
|
const sidebarLogo = computed(() => settingsStore.sidebarLogo);
|
||||||
const layout = computed(() => settingsStore.layout);
|
const layout = computed(() => settingsStore.layout);
|
||||||
|
|
||||||
const isMixLayout = computed(() => layout.value === LayoutEnum.MIX);
|
|
||||||
const isTopLayout = computed(() => layout.value === LayoutEnum.TOP);
|
|
||||||
const isSidebarCollapsed = computed(() => !appStore.sidebar.opened);
|
const isSidebarCollapsed = computed(() => !appStore.sidebar.opened);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -187,25 +187,17 @@ function isAffix(tag: TagView) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function isFirstView() {
|
function isFirstView() {
|
||||||
try {
|
|
||||||
return (
|
return (
|
||||||
selectedTag.value.path === "/dashboard" ||
|
selectedTag.value.path === "/dashboard" ||
|
||||||
selectedTag.value.fullPath === tagsViewStore.visitedViews[1].fullPath
|
selectedTag.value.fullPath === tagsViewStore.visitedViews[1]?.fullPath
|
||||||
);
|
);
|
||||||
} catch (err) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function isLastView() {
|
function isLastView() {
|
||||||
try {
|
|
||||||
return (
|
return (
|
||||||
selectedTag.value.fullPath ===
|
selectedTag.value.fullPath ===
|
||||||
tagsViewStore.visitedViews[tagsViewStore.visitedViews.length - 1].fullPath
|
tagsViewStore.visitedViews[tagsViewStore.visitedViews.length - 1]?.fullPath
|
||||||
);
|
);
|
||||||
} catch (err) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function refreshSelectedTag(view: TagView) {
|
function refreshSelectedTag(view: TagView) {
|
||||||
|
|||||||
@@ -21,8 +21,8 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div :class="{ hasTagsView: showTagsView }" class="main-container">
|
<div :class="{ hasTagsView: isShowTagsView }" class="main-container">
|
||||||
<TagsView v-if="showTagsView" />
|
<TagsView v-if="isShowTagsView" />
|
||||||
<AppMain />
|
<AppMain />
|
||||||
<Settings v-if="defaultSettings.showSettings" />
|
<Settings v-if="defaultSettings.showSettings" />
|
||||||
<!-- 返回顶部 -->
|
<!-- 返回顶部 -->
|
||||||
@@ -33,9 +33,9 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 左侧和顶部布局 -->
|
<!-- 左侧和顶部布局 -->
|
||||||
<div v-else :class="{ hasTagsView: showTagsView }" class="main-container">
|
<div v-else :class="{ hasTagsView: isShowTagsView }" class="main-container">
|
||||||
<NavBar v-if="layout === LayoutEnum.LEFT" />
|
<NavBar v-if="layout === LayoutEnum.LEFT" />
|
||||||
<TagsView v-if="showTagsView" />
|
<TagsView v-if="isShowTagsView" />
|
||||||
<AppMain />
|
<AppMain />
|
||||||
<Settings v-if="defaultSettings.showSettings" />
|
<Settings v-if="defaultSettings.showSettings" />
|
||||||
<!-- 返回顶部 -->
|
<!-- 返回顶部 -->
|
||||||
@@ -62,7 +62,7 @@ const width = useWindowSize().width;
|
|||||||
const WIDTH_DESKTOP = 992; // 响应式布局容器固定宽度 大屏(>=1200px) 中屏(>=992px) 小屏(>=768px)
|
const WIDTH_DESKTOP = 992; // 响应式布局容器固定宽度 大屏(>=1200px) 中屏(>=992px) 小屏(>=768px)
|
||||||
const isMobile = computed(() => appStore.device === DeviceEnum.MOBILE);
|
const isMobile = computed(() => appStore.device === DeviceEnum.MOBILE);
|
||||||
const isOpenSidebar = computed(() => appStore.sidebar.opened);
|
const isOpenSidebar = computed(() => appStore.sidebar.opened);
|
||||||
const showTagsView = computed(() => settingsStore.tagsView); // 是否显示tagsView
|
const isShowTagsView = computed(() => settingsStore.tagsView); // 是否显示tagsView
|
||||||
const layout = computed(() => settingsStore.layout); // 布局模式 left top mix
|
const layout = computed(() => settingsStore.layout); // 布局模式 left top mix
|
||||||
const activeTopMenuPath = computed(() => appStore.activeTopMenuPath); // 顶部菜单激活path
|
const activeTopMenuPath = computed(() => appStore.activeTopMenuPath); // 顶部菜单激活path
|
||||||
const mixedLayoutLeftRoutes = computed(() => permissionStore.mixedLayoutLeftRoutes); // 混合布局左侧菜单
|
const mixedLayoutLeftRoutes = computed(() => permissionStore.mixedLayoutLeftRoutes); // 混合布局左侧菜单
|
||||||
@@ -245,9 +245,11 @@ watch(route, () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.hideSidebar {
|
.hideSidebar {
|
||||||
|
&.layout-left {
|
||||||
.main-container {
|
.main-container {
|
||||||
margin-left: $sidebar-width-collapsed;
|
margin-left: $sidebar-width-collapsed;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
&.layout-top {
|
&.layout-top {
|
||||||
.main-container {
|
.main-container {
|
||||||
@@ -280,7 +282,7 @@ watch(route, () => {
|
|||||||
&.mobile {
|
&.mobile {
|
||||||
.sidebar-container {
|
.sidebar-container {
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
transform: translate3d(-210px, 0, 0);
|
transform: translate3d(-$sidebar-width, 0, 0);
|
||||||
transition-duration: 0.3s;
|
transition-duration: 0.3s;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -291,13 +293,10 @@ watch(route, () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.mobile {
|
.mobile {
|
||||||
.main-container {
|
.layout-mix,
|
||||||
|
.layout-top,
|
||||||
|
.layout-left {
|
||||||
margin-left: 0;
|
margin-left: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.layout-top {
|
|
||||||
// 顶部模式全局变量修改
|
|
||||||
--el-menu-item-height: $navbar-height;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -25,8 +25,8 @@ body {
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB",
|
font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
|
||||||
"Microsoft YaHei", "微软雅黑", Arial, sans-serif;
|
"微软雅黑", Arial, sans-serif;
|
||||||
line-height: inherit;
|
line-height: inherit;
|
||||||
-moz-osx-font-smoothing: grayscale;
|
-moz-osx-font-smoothing: grayscale;
|
||||||
-webkit-font-smoothing: antialiased;
|
-webkit-font-smoothing: antialiased;
|
||||||
|
|||||||
@@ -44,7 +44,8 @@ service.interceptors.response.use(
|
|||||||
ElMessage.error(msg || "系统出错");
|
ElMessage.error(msg || "系统出错");
|
||||||
return Promise.reject(new Error(msg || "Error"));
|
return Promise.reject(new Error(msg || "Error"));
|
||||||
},
|
},
|
||||||
async (error: any) => {
|
async (error) => {
|
||||||
|
console.error("request error", error); // for debug
|
||||||
// 非 2xx 状态码处理 401、403、500 等
|
// 非 2xx 状态码处理 401、403、500 等
|
||||||
const { config, response } = error;
|
const { config, response } = error;
|
||||||
if (response) {
|
if (response) {
|
||||||
@@ -64,20 +65,21 @@ service.interceptors.response.use(
|
|||||||
|
|
||||||
export default service;
|
export default service;
|
||||||
|
|
||||||
// 刷新 Token 的锁
|
// 是否正在刷新标识,避免重复刷新
|
||||||
let isRefreshing = false;
|
let isRefreshing = false;
|
||||||
// 因 Token 过期导致失败的请求队列
|
// 因 Token 过期导致的请求等待队列
|
||||||
let requestsQueue: Array<() => void> = [];
|
const waitingQueue: Array<() => void> = [];
|
||||||
|
|
||||||
// 刷新 Token 处理
|
// 刷新 Token 处理
|
||||||
async function handleTokenRefresh(config: InternalAxiosRequestConfig) {
|
async function handleTokenRefresh(config: InternalAxiosRequestConfig) {
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
const requestCallback = () => {
|
// 封装需要重试的请求
|
||||||
|
const retryRequest = () => {
|
||||||
config.headers.Authorization = getToken();
|
config.headers.Authorization = getToken();
|
||||||
resolve(service(config));
|
resolve(service(config));
|
||||||
};
|
};
|
||||||
|
|
||||||
requestsQueue.push(requestCallback);
|
waitingQueue.push(retryRequest);
|
||||||
|
|
||||||
if (!isRefreshing) {
|
if (!isRefreshing) {
|
||||||
isRefreshing = true;
|
isRefreshing = true;
|
||||||
@@ -86,13 +88,13 @@ async function handleTokenRefresh(config: InternalAxiosRequestConfig) {
|
|||||||
useUserStoreHook()
|
useUserStoreHook()
|
||||||
.refreshToken()
|
.refreshToken()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
// Token 刷新成功,执行请求队列
|
// 依次重试队列中所有请求, 重试后清空队列
|
||||||
requestsQueue.forEach((callback) => callback());
|
waitingQueue.forEach((callback) => callback());
|
||||||
requestsQueue = [];
|
waitingQueue.length = 0;
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error: any) => {
|
||||||
console.log("handleTokenRefresh error", error);
|
console.log("handleTokenRefresh error", error);
|
||||||
// Token 刷新失败,清除用户数据并跳转到登录
|
// 刷新 Token 失败,跳转登录页
|
||||||
ElNotification({
|
ElNotification({
|
||||||
title: "提示",
|
title: "提示",
|
||||||
message: "您的会话已过期,请重新登录",
|
message: "您的会话已过期,请重新登录",
|
||||||
|
|||||||
@@ -437,7 +437,7 @@ interface TreeNode {
|
|||||||
}
|
}
|
||||||
const treeData = ref<TreeNode[]>([]);
|
const treeData = ref<TreeNode[]>([]);
|
||||||
|
|
||||||
const queryFormRef = ref(ElForm);
|
const queryFormRef = ref();
|
||||||
const queryParams = reactive<TablePageQuery>({
|
const queryParams = reactive<TablePageQuery>({
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
@@ -535,7 +535,6 @@ const initSort = () => {
|
|||||||
ghostClass: "sortable-ghost", //拖拽样式
|
ghostClass: "sortable-ghost", //拖拽样式
|
||||||
handle: ".sortable-handle", //拖拽区域
|
handle: ".sortable-handle", //拖拽区域
|
||||||
easing: "cubic-bezier(1, 0, 0, 1)",
|
easing: "cubic-bezier(1, 0, 0, 1)",
|
||||||
onStart: (item: any) => {},
|
|
||||||
|
|
||||||
// 结束拖动事件
|
// 结束拖动事件
|
||||||
onEnd: (item: any) => {
|
onEnd: (item: any) => {
|
||||||
|
|||||||
@@ -236,7 +236,6 @@ defineOptions({
|
|||||||
name: "Dashboard",
|
name: "Dashboard",
|
||||||
inheritAttrs: false,
|
inheritAttrs: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
import VisitTrend from "./components/visit-trend.vue";
|
import VisitTrend from "./components/visit-trend.vue";
|
||||||
|
|
||||||
import router from "@/router";
|
import router from "@/router";
|
||||||
|
|||||||
@@ -89,8 +89,8 @@ function back() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
&__return-home {
|
&__return-home {
|
||||||
display: block;
|
|
||||||
float: left;
|
float: left;
|
||||||
|
display: block;
|
||||||
width: 110px;
|
width: 110px;
|
||||||
height: 36px;
|
height: 36px;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
|
|||||||
@@ -268,7 +268,7 @@ import { Camera } from "@element-plus/icons-vue";
|
|||||||
|
|
||||||
const userProfile = ref<UserProfileVO>({});
|
const userProfile = ref<UserProfileVO>({});
|
||||||
|
|
||||||
enum DialogType {
|
const enum DialogType {
|
||||||
ACCOUNT = "account",
|
ACCOUNT = "account",
|
||||||
PASSWORD = "password",
|
PASSWORD = "password",
|
||||||
MOBILE = "mobile",
|
MOBILE = "mobile",
|
||||||
@@ -287,10 +287,10 @@ const mobileUpdateForm = reactive<MobileUpdateForm>({});
|
|||||||
const emailUpdateForm = reactive<EmailUpdateForm>({});
|
const emailUpdateForm = reactive<EmailUpdateForm>({});
|
||||||
|
|
||||||
const mobileCountdown = ref(0);
|
const mobileCountdown = ref(0);
|
||||||
const mobileTimer = ref<NodeJS.Timeout | null>(null);
|
const mobileTimer = ref();
|
||||||
|
|
||||||
const emailCountdown = ref(0);
|
const emailCountdown = ref(0);
|
||||||
const emailTimer = ref<NodeJS.Timeout | null>(null);
|
const emailTimer = ref();
|
||||||
|
|
||||||
// 修改密码校验规则
|
// 修改密码校验规则
|
||||||
const passwordChangeRules = {
|
const passwordChangeRules = {
|
||||||
@@ -466,6 +466,7 @@ const handleFileChange = async (event: Event) => {
|
|||||||
avatar: data.url,
|
avatar: data.url,
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
console.error("头像上传失败:" + error);
|
||||||
ElMessage.error("头像上传失败");
|
ElMessage.error("头像上传失败");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -137,8 +137,8 @@ defineOptions({
|
|||||||
|
|
||||||
import ConfigAPI, { ConfigPageVO, ConfigForm, ConfigPageQuery } from "@/api/system/config";
|
import ConfigAPI, { ConfigPageVO, ConfigForm, ConfigPageQuery } from "@/api/system/config";
|
||||||
|
|
||||||
const queryFormRef = ref(ElForm);
|
const queryFormRef = ref();
|
||||||
const dataFormRef = ref(ElForm);
|
const dataFormRef = ref();
|
||||||
|
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
const selectIds = ref<number[]>([]);
|
const selectIds = ref<number[]>([]);
|
||||||
|
|||||||
@@ -160,8 +160,8 @@ defineOptions({
|
|||||||
|
|
||||||
import DeptAPI, { DeptVO, DeptForm, DeptQuery } from "@/api/system/dept";
|
import DeptAPI, { DeptVO, DeptForm, DeptQuery } from "@/api/system/dept";
|
||||||
|
|
||||||
const queryFormRef = ref(ElForm);
|
const queryFormRef = ref();
|
||||||
const deptFormRef = ref(ElForm);
|
const deptFormRef = ref();
|
||||||
|
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
const selectIds = ref<number[]>([]);
|
const selectIds = ref<number[]>([]);
|
||||||
|
|||||||
@@ -144,8 +144,8 @@ const route = useRoute();
|
|||||||
|
|
||||||
const dictCode = ref(route.query.dictCode as string);
|
const dictCode = ref(route.query.dictCode as string);
|
||||||
|
|
||||||
const queryFormRef = ref(ElForm);
|
const queryFormRef = ref();
|
||||||
const dataFormRef = ref(ElForm);
|
const dataFormRef = ref();
|
||||||
|
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
const ids = ref<number[]>([]);
|
const ids = ref<number[]>([]);
|
||||||
|
|||||||
@@ -57,7 +57,7 @@
|
|||||||
link
|
link
|
||||||
size="small"
|
size="small"
|
||||||
icon="edit"
|
icon="edit"
|
||||||
@click.stop="handleEditClick(scope.row.id, scope.row.name)"
|
@click.stop="handleEditClick(scope.row.id)"
|
||||||
>
|
>
|
||||||
编辑
|
编辑
|
||||||
</el-button>
|
</el-button>
|
||||||
@@ -133,8 +133,8 @@ import DictAPI, { DictPageQuery, DictPageVO, DictForm } from "@/api/system/dict"
|
|||||||
|
|
||||||
import router from "@/router";
|
import router from "@/router";
|
||||||
|
|
||||||
const queryFormRef = ref(ElForm);
|
const queryFormRef = ref();
|
||||||
const dataFormRef = ref(ElForm);
|
const dataFormRef = ref();
|
||||||
|
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
const ids = ref<number[]>([]);
|
const ids = ref<number[]>([]);
|
||||||
@@ -198,7 +198,7 @@ function handleAddClick() {
|
|||||||
*
|
*
|
||||||
* @param id 字典ID
|
* @param id 字典ID
|
||||||
*/
|
*/
|
||||||
function handleEditClick(id: number, name: string) {
|
function handleEditClick(id: number) {
|
||||||
dialog.visible = true;
|
dialog.visible = true;
|
||||||
dialog.title = "修改字典";
|
dialog.title = "修改字典";
|
||||||
DictAPI.getFormData(id).then((data) => {
|
DictAPI.getFormData(id).then((data) => {
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ defineOptions({
|
|||||||
|
|
||||||
import LogAPI, { LogPageVO, LogPageQuery } from "@/api/system/log";
|
import LogAPI, { LogPageVO, LogPageQuery } from "@/api/system/log";
|
||||||
|
|
||||||
const queryFormRef = ref(ElForm);
|
const queryFormRef = ref();
|
||||||
|
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
const total = ref(0);
|
const total = ref(0);
|
||||||
|
|||||||
@@ -338,8 +338,8 @@ defineOptions({
|
|||||||
import MenuAPI, { MenuQuery, MenuForm, MenuVO } from "@/api/system/menu";
|
import MenuAPI, { MenuQuery, MenuForm, MenuVO } from "@/api/system/menu";
|
||||||
import { MenuTypeEnum } from "@/enums/MenuTypeEnum";
|
import { MenuTypeEnum } from "@/enums/MenuTypeEnum";
|
||||||
|
|
||||||
const queryFormRef = ref(ElForm);
|
const queryFormRef = ref();
|
||||||
const menuFormRef = ref(ElForm);
|
const menuFormRef = ref();
|
||||||
|
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
const dialog = reactive({
|
const dialog = reactive({
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ defineOptions({
|
|||||||
|
|
||||||
import NoticeAPI, { NoticePageVO, NoticePageQuery } from "@/api/system/notice";
|
import NoticeAPI, { NoticePageVO, NoticePageQuery } from "@/api/system/notice";
|
||||||
|
|
||||||
const queryFormRef = ref(ElForm);
|
const queryFormRef = ref();
|
||||||
const noticeDetailRef = ref();
|
const noticeDetailRef = ref();
|
||||||
|
|
||||||
const pageData = ref<NoticePageVO[]>([]);
|
const pageData = ref<NoticePageVO[]>([]);
|
||||||
|
|||||||
@@ -223,8 +223,8 @@ defineOptions({
|
|||||||
import NoticeAPI, { NoticePageVO, NoticeForm, NoticePageQuery } from "@/api/system/notice";
|
import NoticeAPI, { NoticePageVO, NoticeForm, NoticePageQuery } from "@/api/system/notice";
|
||||||
import UserAPI from "@/api/system/user";
|
import UserAPI from "@/api/system/user";
|
||||||
|
|
||||||
const queryFormRef = ref(ElForm);
|
const queryFormRef = ref();
|
||||||
const dataFormRef = ref(ElForm);
|
const dataFormRef = ref();
|
||||||
const noticeDetailRef = ref();
|
const noticeDetailRef = ref();
|
||||||
|
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
|
|||||||
@@ -211,9 +211,9 @@ defineOptions({
|
|||||||
import RoleAPI, { RolePageVO, RoleForm, RolePageQuery } from "@/api/system/role";
|
import RoleAPI, { RolePageVO, RoleForm, RolePageQuery } from "@/api/system/role";
|
||||||
import MenuAPI from "@/api/system/menu";
|
import MenuAPI from "@/api/system/menu";
|
||||||
|
|
||||||
const queryFormRef = ref(ElForm);
|
const queryFormRef = ref();
|
||||||
const roleFormRef = ref(ElForm);
|
const roleFormRef = ref();
|
||||||
const permTreeRef = ref<InstanceType<typeof ElTree>>();
|
const permTreeRef = ref();
|
||||||
|
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
const ids = ref<number[]>([]);
|
const ids = ref<number[]>([]);
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ const props = defineProps({
|
|||||||
});
|
});
|
||||||
|
|
||||||
const deptList = ref<OptionType[]>(); // 部门列表
|
const deptList = ref<OptionType[]>(); // 部门列表
|
||||||
const deptTreeRef = ref(ElTree); // 部门树
|
const deptTreeRef = ref(); // 部门树
|
||||||
const deptName = ref(); // 部门名称
|
const deptName = ref(); // 部门名称
|
||||||
|
|
||||||
const emits = defineEmits(["node-click"]);
|
const emits = defineEmits(["node-click"]);
|
||||||
|
|||||||
@@ -175,8 +175,9 @@ const handleUpload = async () => {
|
|||||||
invalidCount.value = result.invalidCount;
|
invalidCount.value = result.invalidCount;
|
||||||
validCount.value = result.validCount;
|
validCount.value = result.validCount;
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error: any) {
|
||||||
ElMessage.error("上传失败");
|
console.error(error);
|
||||||
|
ElMessage.error("上传失败:" + error);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -249,9 +249,8 @@ defineOptions({
|
|||||||
name: "User",
|
name: "User",
|
||||||
inheritAttrs: false,
|
inheritAttrs: false,
|
||||||
});
|
});
|
||||||
|
const queryFormRef = ref();
|
||||||
const queryFormRef = ref(ElForm);
|
const userFormRef = ref();
|
||||||
const userFormRef = ref(ElForm);
|
|
||||||
|
|
||||||
const queryParams = reactive<UserPageQuery>({
|
const queryParams = reactive<UserPageQuery>({
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
|
|||||||
Reference in New Issue
Block a user