mirror of
https://github.com/fastapiadmin/FastapiAdmin.git
synced 2026-09-21 20:55:14 +00:00
@@ -287,7 +287,7 @@ class Settings(BaseSettings):
|
||||
def ASYNC_DB_URI(self) -> str:
|
||||
"""获取异步数据库连接"""
|
||||
if self.DATABASE_TYPE == "mysql":
|
||||
return f"mysql+asyncmy://{self.DATABASE_USER}:{quote_plus(self.DATABASE_PASSWORD)}@{self.DATABASE_HOST}:{self.DATABASE_PORT}/{self.DATABASE_NAME}?charset='utf8mb4'"
|
||||
return f"mysql+asyncmy://{self.DATABASE_USER}:{quote_plus(self.DATABASE_PASSWORD)}@{self.DATABASE_HOST}:{self.DATABASE_PORT}/{self.DATABASE_NAME}?charset=utf8mb4"
|
||||
elif self.DATABASE_TYPE == "postgresql":
|
||||
return f"postgresql+asyncpg://{self.DATABASE_USER}:{quote_plus(self.DATABASE_PASSWORD)}@{self.DATABASE_HOST}:{self.DATABASE_PORT}/{self.DATABASE_NAME}"
|
||||
elif self.DATABASE_TYPE == "sqlite":
|
||||
@@ -299,7 +299,7 @@ class Settings(BaseSettings):
|
||||
def DB_URI(self) -> str:
|
||||
"""获取同步数据库连接"""
|
||||
if self.DATABASE_TYPE == "mysql":
|
||||
return f"mysql+pymysql://{self.DATABASE_USER}:{quote_plus(self.DATABASE_PASSWORD)}@{self.DATABASE_HOST}:{self.DATABASE_PORT}/{self.DATABASE_NAME}?charset='utf8mb4'"
|
||||
return f"mysql+pymysql://{self.DATABASE_USER}:{quote_plus(self.DATABASE_PASSWORD)}@{self.DATABASE_HOST}:{self.DATABASE_PORT}/{self.DATABASE_NAME}?charset=utf8mb4"
|
||||
elif self.DATABASE_TYPE == "postgresql":
|
||||
return f"postgresql+psycopg2://{self.DATABASE_USER}:{quote_plus(self.DATABASE_PASSWORD)}@{self.DATABASE_HOST}:{self.DATABASE_PORT}/{self.DATABASE_NAME}"
|
||||
elif self.DATABASE_TYPE == "sqlite":
|
||||
|
||||
@@ -838,9 +838,9 @@
|
||||
"icon": "setting",
|
||||
"order": 8,
|
||||
"permission": "system:param:query",
|
||||
"route_name": "Config",
|
||||
"route_path": "/system/config",
|
||||
"component_path": "system/config/index",
|
||||
"route_name": "Params",
|
||||
"route_path": "/system/param",
|
||||
"component_path": "system/param/index",
|
||||
"status": true,
|
||||
"keep_alive": true,
|
||||
"hidden": false,
|
||||
|
||||
+108
-105
File diff suppressed because one or more lines are too long
+719
-706
File diff suppressed because it is too large
Load Diff
@@ -26,7 +26,7 @@ const GencodeAPI = {
|
||||
return request<ApiResponse>({
|
||||
url: `${API_PATH}/import`,
|
||||
method: 'post',
|
||||
data: { table_names }
|
||||
params: { table_names }
|
||||
})
|
||||
},
|
||||
|
||||
@@ -48,7 +48,7 @@ const GencodeAPI = {
|
||||
},
|
||||
|
||||
// 修改代码生成信息
|
||||
updateGenTable(table_id: number, body: GenTableUpdateSchema) {
|
||||
updateGenTable(table_id: number, body: GenTableSchema) {
|
||||
return request<ApiResponse>({
|
||||
url: `${API_PATH}/update/${table_id}`,
|
||||
method: 'put',
|
||||
@@ -57,11 +57,11 @@ const GencodeAPI = {
|
||||
},
|
||||
|
||||
// 删除表数据
|
||||
deleteTable(tableIds: number[]) {
|
||||
deleteTable(data: GenTableDeleteSchema) {
|
||||
return request<ApiResponse>({
|
||||
url: `${API_PATH}/delete`,
|
||||
method: 'delete',
|
||||
data: tableIds
|
||||
data: data
|
||||
})
|
||||
},
|
||||
|
||||
@@ -118,10 +118,6 @@ export interface TablePageQuery extends PageQuery {
|
||||
table_name?: string;
|
||||
/** 表描述 */
|
||||
table_comment?: string;
|
||||
/** 开始时间 */
|
||||
start_time?: string;
|
||||
/** 结束时间 */
|
||||
end_time?: string;
|
||||
}
|
||||
|
||||
/** 数据表分页对象 */
|
||||
@@ -132,14 +128,12 @@ export interface TablePageVO {
|
||||
/** 表描述 */
|
||||
table_comment: string;
|
||||
|
||||
/** 存储引擎 */
|
||||
engine: string;
|
||||
/** 数据库名称 */
|
||||
database_name: string;
|
||||
|
||||
/** 字符集排序规则 */
|
||||
table_collation: string;
|
||||
/** 表单类型 */
|
||||
table_type: string;
|
||||
|
||||
/** 创建时间 */
|
||||
create_time: string;
|
||||
}
|
||||
|
||||
/** 代码生成表输出对象 */
|
||||
@@ -194,18 +188,18 @@ export interface GenTableOutVO {
|
||||
crud?: boolean;
|
||||
}
|
||||
|
||||
/** 代码生成表更新模型 */
|
||||
export interface GenTableUpdateSchema extends GenTableOutVO {
|
||||
/** 代码生成业务表模型 */
|
||||
export interface GenTableSchema extends GenTableOutVO {
|
||||
/** 主键信息 */
|
||||
pk_column?: GenTableColumnUpdateSchema;
|
||||
pk_column?: GenTableColumnOutSchema;
|
||||
/** 子表信息 */
|
||||
sub_table?: GenTableUpdateSchema;
|
||||
sub_table?: GenTableSchema;
|
||||
/** 表列信息 */
|
||||
columns: GenTableColumnUpdateSchema[];
|
||||
columns: GenTableColumnOutSchema[];
|
||||
}
|
||||
|
||||
/** 代码生成表列更新模型 */
|
||||
export interface GenTableColumnUpdateSchema {
|
||||
/** 代码生成业务表列模型 */
|
||||
export interface GenTableColumnSchema {
|
||||
/** 主键 */
|
||||
id?: number;
|
||||
/** 归属表编号 */
|
||||
@@ -244,6 +238,12 @@ export interface GenTableColumnUpdateSchema {
|
||||
dict_type: string;
|
||||
/** 排序 */
|
||||
sort?: number;
|
||||
/** 功能描述 */
|
||||
description?: string;
|
||||
}
|
||||
|
||||
/** 代码生成业务表列输出模型 */
|
||||
export interface GenTableColumnOutSchema extends GenTableColumnSchema {
|
||||
/** 字段大写形式 */
|
||||
cap_python_field?: string;
|
||||
/** 是否主键 */
|
||||
@@ -268,12 +268,18 @@ export interface GenTableColumnUpdateSchema {
|
||||
usable_column?: boolean;
|
||||
}
|
||||
|
||||
/** 删除代码生成业务表模型 */
|
||||
export interface GenTableDeleteSchema {
|
||||
/** 需要删除的代码生成业务表ID列表 */
|
||||
table_ids: number[];
|
||||
}
|
||||
|
||||
/** 表详情查询结果 */
|
||||
export interface GenTableDetailResult {
|
||||
/** 表信息 */
|
||||
info: GenTableOutVO;
|
||||
/** 表列信息 */
|
||||
rows: GenTableColumnUpdateSchema[];
|
||||
rows: GenTableColumnOutSchema[];
|
||||
/** 所有表信息 */
|
||||
tables: GenTableOutVO[];
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
<el-scrollbar>
|
||||
<div :class="{ hidden: hidden }" class="pagination">
|
||||
<el-pagination
|
||||
v-show="total>0"
|
||||
v-model:current-page="currentPage"
|
||||
v-model:page-size="pageSize"
|
||||
:background="background"
|
||||
|
||||
@@ -95,7 +95,7 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useI18n } from "vue-i18n";
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
import { useRouter } from "vue-router";
|
||||
|
||||
import { DeviceEnum } from "@/enums/settings/device.enum";
|
||||
import { useAppStore, useSettingsStore, useUserStore, useLockStore } from "@/store";
|
||||
@@ -111,7 +111,7 @@ import Notification from "@/components/Notification/index.vue";
|
||||
import LockDialog from './LockDialog.vue'
|
||||
import LockPage from './LockPage.vue'
|
||||
import Guide from '@/components/Guide/index.vue'
|
||||
import ConfigInfoDrawer from "@/views/system/config/components/ConfigInfoDrawer.vue"
|
||||
import ConfigInfoDrawer from "@/views/system/param/components/ConfigInfoDrawer.vue"
|
||||
|
||||
|
||||
const { t } = useI18n();
|
||||
@@ -119,7 +119,6 @@ const appStore = useAppStore();
|
||||
const settingStore = useSettingsStore();
|
||||
const userStore = useUserStore();
|
||||
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
|
||||
// 是否为桌面设备
|
||||
@@ -225,7 +224,6 @@ function logout() {
|
||||
lockScroll: false,
|
||||
}).then(() => {
|
||||
userStore.logout().then(() => {
|
||||
// router.push(`/login?redirect=${route.fullPath}`);
|
||||
router.push(`/login`);
|
||||
});
|
||||
}).catch(() => {
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<router-link
|
||||
v-for="tag in displayedViews" :key="tag.fullPath"
|
||||
:class="['tags-item', { active: tagsViewStore.isActive(tag) }]" :to="{ path: tag.path, query: tag.query }"
|
||||
@click="handleTabClick(tag)"
|
||||
@click="router.push({path: tag.fullPath, query: tag.query})"
|
||||
@click.middle="handleMiddleClick(tag)">
|
||||
<!-- 为所有标签添加右键菜单 -->
|
||||
<el-dropdown
|
||||
@@ -343,10 +343,10 @@ const updateCurrentTag = () => {
|
||||
/**
|
||||
* 处理标签点击
|
||||
*/
|
||||
const handleTabClick = (tag: TagView) => {
|
||||
// 设置标签切换来源为标签容器点击
|
||||
tagSwitchSource.value = 'tab';
|
||||
};
|
||||
// const handleTabClick = (tag: TagView) => {
|
||||
// // 设置标签切换来源为标签容器点击
|
||||
// tagSwitchSource.value = 'tab';
|
||||
// };
|
||||
|
||||
/**
|
||||
* 处理中键点击
|
||||
@@ -386,13 +386,14 @@ const handleScroll = (event: WheelEvent) => {
|
||||
* 刷新标签
|
||||
*/
|
||||
const refreshSelectedTag = (tag: TagView | null) => {
|
||||
if (!tag) return;
|
||||
// 总是使用当前路由对应的标签
|
||||
const currentTag = routePathMap.value.get(route.path);
|
||||
if (!currentTag) return;
|
||||
// const currentTag = routePathMap.value.get(route.path);
|
||||
// if (!currentTag) return;
|
||||
|
||||
tagsViewStore.delCachedView(currentTag);
|
||||
tagsViewStore.delCachedView(tag);
|
||||
nextTick(() => {
|
||||
router.replace("/redirect" + currentTag.fullPath);
|
||||
router.replace("/redirect" + tag.fullPath);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -4,7 +4,8 @@ import { useAppStore } from "@/store";
|
||||
import { DeviceEnum } from "@/enums/settings/device.enum";
|
||||
|
||||
/**
|
||||
* 布局响应式处理逻辑
|
||||
* 设备检测和响应式处理
|
||||
* 监听屏幕尺寸变化,自动调整设备类型和侧边栏状态
|
||||
*/
|
||||
export function useLayoutResponsive() {
|
||||
const appStore = useAppStore();
|
||||
@@ -13,16 +14,19 @@ export function useLayoutResponsive() {
|
||||
// 定义响应式断点
|
||||
const WIDTH_DESKTOP = 992; // 桌面设备断点 (>=992px)
|
||||
|
||||
// 计算设备类型
|
||||
const isDesktop = computed(() => width.value >= WIDTH_DESKTOP);
|
||||
const isMobile = computed(() => appStore.device === DeviceEnum.MOBILE);
|
||||
|
||||
// 设置当前设备类型并调整侧边栏状态
|
||||
watchEffect(() => {
|
||||
const isDesktop = width.value >= WIDTH_DESKTOP;
|
||||
const deviceType = isDesktop ? DeviceEnum.DESKTOP : DeviceEnum.MOBILE;
|
||||
const deviceType = isDesktop.value ? DeviceEnum.DESKTOP : DeviceEnum.MOBILE;
|
||||
|
||||
// 更新设备类型
|
||||
appStore.toggleDevice(deviceType);
|
||||
|
||||
// 根据设备类型调整侧边栏状态
|
||||
if (isDesktop) {
|
||||
if (isDesktop.value) {
|
||||
appStore.openSideBar();
|
||||
} else {
|
||||
appStore.closeSideBar();
|
||||
@@ -30,7 +34,7 @@ export function useLayoutResponsive() {
|
||||
});
|
||||
|
||||
return {
|
||||
isDesktop: computed(() => width.value >= WIDTH_DESKTOP),
|
||||
isMobile: computed(() => appStore.device === DeviceEnum.MOBILE),
|
||||
isDesktop,
|
||||
isMobile,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
<script setup lang="ts">
|
||||
import { useLayout } from "../composables/useLayout";
|
||||
import { useLayoutResponsive } from "../composables/useLayoutResponsive";
|
||||
import { defaultSettings } from "@/settings";
|
||||
import { useSettingsStore } from "@/store";
|
||||
|
||||
const settingStore = useSettingsStore();
|
||||
|
||||
@@ -109,31 +109,30 @@ function resolvePath(routePath: string) {
|
||||
}
|
||||
|
||||
if (routePath.startsWith("/")) {
|
||||
return routePath;
|
||||
return activeTopMenuPath.value + routePath;
|
||||
}
|
||||
return `${routePath}`;
|
||||
return `${activeTopMenuPath.value}/${routePath}`;
|
||||
}
|
||||
|
||||
// 优化后的路由监听逻辑,仅在顶级路径实际变化时更新菜单
|
||||
let prevTopMenuPath = '';
|
||||
|
||||
watch(
|
||||
() => route.path,
|
||||
(newPath) => {
|
||||
// 获取顶级路径
|
||||
const topMenuPath =
|
||||
newPath.split("/").filter(Boolean).length > 1 ? newPath.match(/^\/[^/]+/)?.[0] || "/" : "/";
|
||||
const topMenuPath = newPath.split("/").filter(Boolean).length > 1 ? newPath.match(/^\/[^/]+/)?.[0] || "/" : "/";
|
||||
|
||||
// 如果当前路径属于当前激活的顶部菜单
|
||||
if (newPath.startsWith(activeTopMenuPath.value)) {
|
||||
// no-op
|
||||
}
|
||||
|
||||
// 仅在顶级路径实际变化时才执行更新
|
||||
if (topMenuPath !== prevTopMenuPath) {
|
||||
prevTopMenuPath = topMenuPath;
|
||||
|
||||
else if (topMenuPath !== activeTopMenuPath.value) {
|
||||
// 主动更新顶部菜单和左侧菜单
|
||||
const appStore = useAppStore();
|
||||
const permissionStore = usePermissionStore();
|
||||
|
||||
appStore.activeTopMenu(topMenuPath);
|
||||
permissionStore.updateSideMenu(topMenuPath);
|
||||
permissionStore.setMixLayoutSideMenus(topMenuPath);
|
||||
}
|
||||
},
|
||||
{ immediate: true }
|
||||
|
||||
@@ -16,23 +16,8 @@
|
||||
</el-icon>
|
||||
<span class="status-text">{{ connectionStatusText }}</span>
|
||||
</div>
|
||||
<el-button
|
||||
v-if="messages.length > 0"
|
||||
text
|
||||
@click="clearCurrentChat"
|
||||
v-hasPerm="['ai:mcp:clear']"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>
|
||||
清空对话
|
||||
</el-button>
|
||||
<el-button
|
||||
text
|
||||
@click="toggleConnection"
|
||||
v-hasPerm="['ai:mcp:connection']"
|
||||
>
|
||||
<el-icon><Setting /></el-icon>
|
||||
{{ isConnected ? '断开连接' : '重新连接' }}
|
||||
</el-button>
|
||||
<el-button v-if="messages.length > 0" v-hasPerm="['ai:mcp:clear']" text :icon="Delete" @click="clearCurrentChat">清空对话</el-button>
|
||||
<el-button v-hasPerm="['ai:mcp:connection']" text :icon="Setting" @click="toggleConnection">{{ isConnected ? '断开连接' : '重新连接' }}</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -100,12 +85,8 @@
|
||||
<div v-else class="message-text" v-html="formatMessage(message.content)"></div>
|
||||
</div>
|
||||
<div v-if="!message.loading" class="message-actions">
|
||||
<el-button text size="small" @click="copyMessage(message.content)">
|
||||
<el-icon><CopyDocument /></el-icon>
|
||||
</el-button>
|
||||
<el-button v-if="message.type === 'assistant'" text size="small">
|
||||
<el-icon><RefreshLeft /></el-icon>
|
||||
</el-button>
|
||||
<el-button text size="small" :icon="CopyDocument" @click="copyMessage(message.content)"></el-button>
|
||||
<el-button v-if="message.type === 'assistant'" text size="small" :icon="RefreshLeft"></el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -324,7 +305,7 @@ const sendMessage = async () => {
|
||||
// 发送消息到 WebSocket
|
||||
if (ws?.readyState === WebSocket.OPEN) {
|
||||
const payload = {
|
||||
message: message,
|
||||
message,
|
||||
timestamp: Date.now()
|
||||
}
|
||||
ws.send(JSON.stringify(payload))
|
||||
@@ -405,26 +386,6 @@ const scrollToBottom = () => {
|
||||
})
|
||||
}
|
||||
|
||||
// 格式化时间
|
||||
const formatTime = (timestamp: number) => {
|
||||
const date = new Date(timestamp)
|
||||
const now = new Date()
|
||||
|
||||
if (date.toDateString() === now.toDateString()) {
|
||||
return date.toLocaleTimeString('zh-CN', {
|
||||
hour: '2-digit',
|
||||
minute: '2-digit'
|
||||
})
|
||||
} else {
|
||||
return date.toLocaleString('zh-CN', {
|
||||
month: '2-digit',
|
||||
day: '2-digit',
|
||||
hour: '2-digit',
|
||||
minute: '2-digit'
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// 格式化消息内容
|
||||
const formatMessage = (content: string) => {
|
||||
if (!content) return ''
|
||||
|
||||
@@ -55,16 +55,28 @@
|
||||
<!-- 功能区域 -->
|
||||
<div class="data-table__toolbar">
|
||||
<div class="data-table__toolbar--actions">
|
||||
<el-row :gutter="10">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" icon="delete" :disabled="selectIds.length === 0" @click="handleDelete(selectIds)">批量删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" icon="delete" @click="handleClearLog">清空日志</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
<div class="data-table__toolbar--tools">
|
||||
<el-row :gutter="10">
|
||||
<el-col :span="1.5">
|
||||
<el-tooltip content="导出">
|
||||
<el-button type="warning" icon="download" circle @click="handleExport" />
|
||||
</el-tooltip>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-tooltip content="刷新">
|
||||
<el-button type="default" icon="refresh" circle @click="handleRefresh" />
|
||||
</el-tooltip>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -36,10 +36,8 @@
|
||||
</el-form-item>
|
||||
<!-- 查询、重置、展开/收起按钮 -->
|
||||
<el-form-item class="search-buttons">
|
||||
<el-button type="primary" icon="search" @click="handleQuery" v-hasPerm="['app:job:query']"
|
||||
>查询</el-button
|
||||
>
|
||||
<el-button icon="refresh" @click="handleResetQuery" v-hasPerm="['app:job:query']">重置</el-button>
|
||||
<el-button v-hasPerm="['app:job:query']" type="primary" icon="search" @click="handleQuery">查询</el-button>
|
||||
<el-button v-hasPerm="['app:job:query']" icon="refresh" @click="handleResetQuery">重置</el-button>
|
||||
<!-- 展开/收起 -->
|
||||
<template v-if="isExpandable">
|
||||
<el-link
|
||||
@@ -79,44 +77,56 @@
|
||||
<!-- 功能区域 -->
|
||||
<div class="data-table__toolbar">
|
||||
<div class="data-table__toolbar--actions">
|
||||
<el-row :gutter="10">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
v-hasPerm="['app:job:create']"
|
||||
type="success"
|
||||
icon="plus"
|
||||
@click="handleOpenDialog('create')"
|
||||
v-hasPerm="['app:job:create']"
|
||||
>新增</el-button
|
||||
>
|
||||
>新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
v-hasPerm="['app:job:delete']"
|
||||
type="danger"
|
||||
icon="delete"
|
||||
:disabled="selectIds.length === 0"
|
||||
@click="handleDelete(selectIds)"
|
||||
v-hasPerm="['app:job:delete']"
|
||||
>批量删除</el-button
|
||||
>
|
||||
>批量删除</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
<div class="data-table__toolbar--tools">
|
||||
<el-row :gutter="10">
|
||||
<el-col :span="1.5">
|
||||
<el-tooltip content="导出">
|
||||
<el-button
|
||||
v-hasPerm="['app:job:export']"
|
||||
type="warning"
|
||||
icon="download"
|
||||
circle
|
||||
@click="handleExport"
|
||||
v-hasPerm="['app:job:export']"
|
||||
/>
|
||||
</el-tooltip>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-tooltip content="清除">
|
||||
<el-button type="danger" icon="delete" circle @click="handleClear" v-hasPerm="['app:job:clear']" />
|
||||
<el-button v-hasPerm="['app:job:clear']" type="danger" icon="delete" circle @click="handleClear"/>
|
||||
</el-tooltip>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-tooltip content="刷新">
|
||||
<el-button
|
||||
v-hasPerm="['app:job:refresh']"
|
||||
type="primary"
|
||||
icon="refresh"
|
||||
circle
|
||||
@click="handleRefresh"
|
||||
v-hasPerm="['app:job:refresh']"
|
||||
/>
|
||||
</el-tooltip>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -212,41 +222,41 @@
|
||||
详情
|
||||
</el-button>
|
||||
<el-button
|
||||
v-hasPerm="['app:job:update']"
|
||||
type="primary"
|
||||
size="small"
|
||||
link
|
||||
icon="edit"
|
||||
@click="handleOpenDialog('update', scope.row.id)"
|
||||
v-hasPerm="['app:job:update']"
|
||||
>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
v-hasPerm="['app:job:delete']"
|
||||
type="danger"
|
||||
size="small"
|
||||
link
|
||||
icon="delete"
|
||||
@click="handleDelete([scope.row.id])"
|
||||
v-hasPerm="['app:job:delete']"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
<el-dropdown trigger="click" v-hasPerm="['app:job:status']">
|
||||
<el-button type="warning" size="small" link icon="ArrowDown"
|
||||
>更多</el-button
|
||||
>
|
||||
<el-dropdown v-hasPerm="['app:job:status']" trigger="click">
|
||||
<el-button type="warning" size="small" link icon="ArrowDown">更多</el-button>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item
|
||||
icon="Check"
|
||||
@click="handleOption(scope.row.id, 1)"
|
||||
>暂停</el-dropdown-item
|
||||
>
|
||||
暂停
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item
|
||||
icon="CircleClose"
|
||||
@click="handleOption(scope.row.id, 2)"
|
||||
>恢复</el-dropdown-item
|
||||
>
|
||||
恢复
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
@@ -560,15 +570,8 @@
|
||||
<div class="dialog-footer">
|
||||
<!-- 详情弹窗不需要确定按钮的提交逻辑 -->
|
||||
<el-button @click="handleCloseDialog">取消</el-button>
|
||||
<el-button
|
||||
v-if="dialogVisible.type !== 'detail'"
|
||||
type="primary"
|
||||
@click="handleSubmit"
|
||||
>确定</el-button
|
||||
>
|
||||
<el-button v-else type="primary" @click="handleCloseDialog" v-hasPerm="['app:job:detail']"
|
||||
>确定</el-button
|
||||
>
|
||||
<el-button v-if="dialogVisible.type !== 'detail'" type="primary" @click="handleSubmit">确定</el-button>
|
||||
<el-button v-else v-hasPerm="['app:job:detail']" type="primary" @click="handleCloseDialog" >确定</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
@@ -37,7 +37,6 @@ const loading = ref(true);
|
||||
|
||||
// 从路由参数获取应用信息
|
||||
const appUrl = computed(() => route.query.url as string);
|
||||
const appId = computed(() => route.query.appId as string);
|
||||
const appName = computed(() => route.query.appName as string);
|
||||
|
||||
// iframe加载完成
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
<el-input v-model="queryFormData.creator" placeholder="请输入创建人" clearable style="width: 150px" />
|
||||
</el-form-item>
|
||||
<el-form-item class="search-buttons">
|
||||
<el-button type="primary" icon="search" @click="handleQuery" v-hasPerm="['application:myapp:query']">查询</el-button>
|
||||
<el-button icon="refresh" @click="handleResetQuery" v-hasPerm="['application:myapp:query']">重置</el-button>
|
||||
<el-button v-hasPerm="['application:myapp:query']" type="primary" icon="search" @click="handleQuery">查询</el-button>
|
||||
<el-button v-hasPerm="['application:myapp:query']" icon="refresh" @click="handleResetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
@@ -28,7 +28,7 @@
|
||||
<template #header>
|
||||
<div class="card-header">
|
||||
<span>应用市场</span>
|
||||
<el-button type="primary" icon="plus" @click="handleCreateApp" v-hasPerm="['application:myapp:create']">
|
||||
<el-button v-hasPerm="['application:myapp:create']" type="primary" icon="plus" @click="handleCreateApp">
|
||||
创建应用
|
||||
</el-button>
|
||||
</div>
|
||||
@@ -76,8 +76,8 @@
|
||||
/>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item command="edit" icon="Edit" v-hasPerm="['application:myapp:update']">编辑</el-dropdown-item>
|
||||
<el-dropdown-item command="delete" icon="Delete" divided v-hasPerm="['application:myapp:delete']">删除</el-dropdown-item>
|
||||
<el-dropdown-item v-hasPerm="['application:myapp:update']" command="edit" icon="Edit">编辑</el-dropdown-item>
|
||||
<el-dropdown-item v-hasPerm="['application:myapp:delete']" command="delete" icon="Delete" divided>删除</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
@@ -103,24 +103,24 @@
|
||||
|
||||
<div class="app-card-actions">
|
||||
<el-button
|
||||
v-hasPerm="['application:myapp:open_external']"
|
||||
type="primary"
|
||||
icon="Link"
|
||||
size="small"
|
||||
:disabled="!app.status"
|
||||
class="action-btn"
|
||||
@click="openAppExternal(app.access_url)"
|
||||
v-hasPerm="['application:myapp:open_external']"
|
||||
>
|
||||
外部打开
|
||||
</el-button>
|
||||
<el-button
|
||||
v-hasPerm="['application:myapp:open_internal']"
|
||||
type="default"
|
||||
icon="View"
|
||||
size="small"
|
||||
:disabled="!app.status"
|
||||
class="action-btn"
|
||||
@click="openAppInternal(app)"
|
||||
v-hasPerm="['application:myapp:open_internal']"
|
||||
>
|
||||
内部打开
|
||||
</el-button>
|
||||
|
||||
@@ -62,36 +62,28 @@
|
||||
<!-- 功能区域 -->
|
||||
<div class="data-table__toolbar">
|
||||
<div class="data-table__toolbar--actions">
|
||||
<el-button type="success" icon="plus" @click="handleOpenDialog('create')" v-hasPerm="['workflow:operator:create']">新增</el-button>
|
||||
<el-button type="danger" icon="delete" :disabled="selectIds.length === 0" @click="handleDelete(selectIds)" v-hasPerm="['workflow:operator:delete']">批量删除</el-button>
|
||||
<el-button v-hasPerm="['workflow:operator:create']" type="success" icon="plus" @click="handleOpenDialog('create')">新增</el-button>
|
||||
<el-button v-hasPerm="['workflow:operator:delete']" type="danger" icon="delete" :disabled="selectIds.length === 0" @click="handleDelete(selectIds)">批量删除</el-button>
|
||||
<el-dropdown trigger="click">
|
||||
<el-button type="default" :disabled="selectIds.length === 0" icon="ArrowDown" v-hasPerm="['workflow:operator:status']">更多</el-button>
|
||||
<el-button v-hasPerm="['workflow:operator:status']" type="default" :disabled="selectIds.length === 0" icon="ArrowDown">更多</el-button>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item icon="Check" @click="handleMoreClick(true)">批量启用</el-dropdown-item>
|
||||
<el-dropdown-item icon="CircleClose"
|
||||
@click="handleMoreClick(false)">批量停用</el-dropdown-item>
|
||||
<el-dropdown-item icon="CircleClose" @click="handleMoreClick(false)">批量停用</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
</div>
|
||||
<div class="data-table__toolbar--tools">
|
||||
<el-tooltip content="导入">
|
||||
<el-button type="info" icon="upload" circle @click="handleOpenImportDialog" v-hasPerm="['workflow:operator:import']" />
|
||||
</el-tooltip>
|
||||
<el-tooltip content="导出">
|
||||
<el-button type="warning" icon="download" circle @click="handleExport" v-hasPerm="['workflow:operator:export']" />
|
||||
</el-tooltip>
|
||||
<el-tooltip content="刷新">
|
||||
<el-button type="primary" icon="refresh" circle @click="handleRefresh" v-hasPerm="['workflow:operator:refresh']" />
|
||||
<el-button v-hasPerm="['workflow:operator:refresh']" type="warning" icon="refresh" circle @click="handleRefresh"/>
|
||||
</el-tooltip>
|
||||
<el-tooltip content="列表筛选">
|
||||
<el-dropdown trigger="click">
|
||||
<el-button type="default" icon="operation" circle v-hasPerm="['workflow:operator:filter']" />
|
||||
<el-button v-hasPerm="['workflow:operator:filter']" type="default" icon="operation" circle/>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item v-for="column in tableColumns" :key="column.prop"
|
||||
:command="column">
|
||||
<el-dropdown-item v-for="column in tableColumns" :key="column.prop" :command="column">
|
||||
<el-checkbox v-model="column.show">
|
||||
{{ column.label }}
|
||||
</el-checkbox>
|
||||
@@ -104,56 +96,45 @@
|
||||
</div>
|
||||
|
||||
<!-- 表格区域:工作流列表 -->
|
||||
<el-table ref="dataTableRef" v-loading="loading" :data="pageTableData" highlight-current-row
|
||||
class="data-table__content" height="450" border stripe @selection-change="handleSelectionChange">
|
||||
<el-table ref="dataTableRef" v-loading="loading" :data="pageTableData" highlight-current-row class="data-table__content" height="450" border stripe @selection-change="handleSelectionChange">
|
||||
<template #empty>
|
||||
<el-empty :image-size="80" description="暂无数据" />
|
||||
</template>
|
||||
<el-table-column v-if="tableColumns.find(col => col.prop === 'selection')?.show" type="selection"
|
||||
min-width="55" align="center" />
|
||||
<el-table-column v-if="tableColumns.find(col => col.prop === 'index')?.show" fixed label="序号"
|
||||
min-width="60">
|
||||
<el-table-column v-if="tableColumns.find(col => col.prop === 'selection')?.show" type="selection" min-width="55" align="center" />
|
||||
<el-table-column v-if="tableColumns.find(col => col.prop === 'index')?.show" fixed label="序号" min-width="60">
|
||||
<template #default="scope">
|
||||
{{ (queryFormData.page_no - 1) * queryFormData.page_size + scope.$index + 1 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column v-if="tableColumns.find(col => col.prop === 'name')?.show" label="名称"
|
||||
prop="name" min-width="140" />
|
||||
<el-table-column v-if="tableColumns.find(col => col.prop === 'status')?.show" label="状态" prop="status"
|
||||
min-width="80">
|
||||
<el-table-column v-if="tableColumns.find(col => col.prop === 'name')?.show" label="名称" prop="name" min-width="140" />
|
||||
<el-table-column v-if="tableColumns.find(col => col.prop === 'status')?.show" label="状态" prop="status" min-width="80">
|
||||
<template #default="scope">
|
||||
<el-tag :type="scope.row.status === true ? 'success' : 'danger'">
|
||||
{{ scope.row.status === true ? "启用" : "停用" }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column v-if="tableColumns.find(col => col.prop === 'description')?.show" label="描述"
|
||||
prop="description" min-width="140" />
|
||||
<el-table-column v-if="tableColumns.find(col => col.prop === 'created_at')?.show" label="创建时间"
|
||||
prop="created_at" min-width="180" sortable />
|
||||
<el-table-column v-if="tableColumns.find(col => col.prop === 'updated_at')?.show" label="更新时间"
|
||||
prop="updated_at" min-width="180" sortable />
|
||||
<el-table-column v-if="tableColumns.find(col => col.prop === 'creator')?.show" key="creator" label="创建人"
|
||||
min-width="100">
|
||||
<el-table-column v-if="tableColumns.find(col => col.prop === 'description')?.show" label="描述" prop="description" min-width="140" />
|
||||
<el-table-column v-if="tableColumns.find(col => col.prop === 'created_at')?.show" label="创建时间" prop="created_at" min-width="180" sortable />
|
||||
<el-table-column v-if="tableColumns.find(col => col.prop === 'updated_at')?.show" label="更新时间" prop="updated_at" min-width="180" sortable />
|
||||
<el-table-column v-if="tableColumns.find(col => col.prop === 'creator')?.show" key="creator" label="创建人" min-width="100">
|
||||
<template #default="scope">
|
||||
{{ scope.row.creator?.name }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column v-if="tableColumns.find(col => col.prop === 'operation')?.show" fixed="right"
|
||||
label="操作" align="center" min-width="200">
|
||||
<el-table-column v-if="tableColumns.find(col => col.prop === 'operation')?.show" fixed="right" label="操作" align="center" min-width="200">
|
||||
<template #default="scope">
|
||||
<el-button type="info" size="small" link icon="document" @click="handleOpenDialog('detail', scope.row.id)" v-hasPerm="['workflow:operator:detail']">详情</el-button>
|
||||
<el-button type="primary" size="small" link icon="edit" @click="handleOpenDialog('update', scope.row.id)" v-hasPerm="['workflow:operator:update']">编辑</el-button>
|
||||
<el-button type="danger" size="small" link icon="delete" @click="handleDelete([scope.row.id])" v-hasPerm="['workflow:operator:delete']">删除</el-button>
|
||||
<el-button v-hasPerm="['workflow:operator:detail']" type="info" size="small" link icon="document" @click="handleOpenDialog('detail', scope.row.id)">详情</el-button>
|
||||
<el-button v-hasPerm="['workflow:operator:update']" type="primary" size="small" link icon="edit" @click="handleOpenDialog('update', scope.row.id)">编辑</el-button>
|
||||
<el-button v-hasPerm="['workflow:operator:delete']" type="danger" size="small" link icon="delete" @click="handleDelete([scope.row.id])">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<!-- 分页区域 -->
|
||||
<template #footer>
|
||||
<pagination v-model:total="total" v-model:page="queryFormData.page_no"
|
||||
v-model:limit="queryFormData.page_size" @pagination="loadingData" />
|
||||
<pagination v-model:total="total" v-model:page="queryFormData.page_no" v-model:limit="queryFormData.page_size" @pagination="loadingData" />
|
||||
</template>
|
||||
</el-card>
|
||||
|
||||
@@ -186,8 +167,7 @@
|
||||
</template>
|
||||
<!-- 新增、编辑表单 -->
|
||||
<template v-else>
|
||||
<el-form ref="dataFormRef" :model="formData" :rules="rules" label-suffix=":" label-width="auto"
|
||||
label-position="right">
|
||||
<el-form ref="dataFormRef" :model="formData" :rules="rules" label-suffix=":" label-width="auto" label-position="right">
|
||||
<el-form-item label="名称" prop="name">
|
||||
<el-input v-model="formData.name" placeholder="请输入名称" :maxlength="50" />
|
||||
</el-form-item>
|
||||
@@ -202,8 +182,7 @@
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="描述" prop="description">
|
||||
<el-input v-model="formData.description" :rows="4" :maxlength="100" show-word-limit
|
||||
type="textarea" placeholder="请输入描述" />
|
||||
<el-input v-model="formData.description" :rows="4" :maxlength="100" show-word-limit type="textarea" placeholder="请输入描述" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</template>
|
||||
@@ -212,34 +191,25 @@
|
||||
<div class="dialog-footer">
|
||||
<!-- 详情弹窗不需要确定按钮的提交逻辑 -->
|
||||
<el-button @click="handleCloseDialog">取消</el-button>
|
||||
<el-button v-if="dialogVisible.type !== 'detail'" type="primary"
|
||||
@click="handleSubmit">确定</el-button>
|
||||
<el-button v-if="dialogVisible.type !== 'detail'" type="primary" @click="handleSubmit">确定</el-button>
|
||||
<el-button v-else type="primary" @click="handleCloseDialog">确定</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 用户导入 -->
|
||||
<ImportModal v-model="importDialogVisible" title="导入数据" @import-success="handleQuery()" @download-template="handleDownloadTemplate" @upload="handleUpload" />
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
defineOptions({
|
||||
name: "Example",
|
||||
name: "Workflow",
|
||||
inheritAttrs: false,
|
||||
});
|
||||
|
||||
import { ref, reactive, onMounted } from "vue";
|
||||
import { ElMessage } from "element-plus";
|
||||
import { ResultEnum } from "@/enums/api/result.enum";
|
||||
import ExampleAPI, { ExampleTable, ExampleForm, ExamplePageQuery } from "@/api/generator/demo";
|
||||
import ImportModal from "@/components/Upload/ImportModal.vue";
|
||||
import DatePicker from "@/components/DatePicker/index.vue";
|
||||
|
||||
const emit = defineEmits(['import-success']);
|
||||
|
||||
const queryFormRef = ref();
|
||||
const dataFormRef = ref();
|
||||
const total = ref(0);
|
||||
@@ -313,9 +283,6 @@ const rules = reactive({
|
||||
status: [{ required: true, message: "请选择状态", trigger: "blur" }],
|
||||
});
|
||||
|
||||
// 导入弹窗显示状态
|
||||
const importDialogVisible = ref(false);
|
||||
|
||||
// 列表刷新
|
||||
async function handleRefresh() {
|
||||
await loadingData();
|
||||
@@ -460,87 +427,6 @@ async function handleDelete(ids: number[]) {
|
||||
});
|
||||
}
|
||||
|
||||
// 导出
|
||||
async function handleExport() {
|
||||
ElMessageBox.confirm('是否确认导出当前系统配置?', '警告', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(async () => {
|
||||
let downloadUrl = '';
|
||||
try {
|
||||
loading.value = true;
|
||||
|
||||
const response = await ExampleAPI.exportExample(queryFormData);
|
||||
const fileData = response.data;
|
||||
const fileName = decodeURI(response.headers["content-disposition"].split(";")[1].split("=")[1]);
|
||||
const fileType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8";
|
||||
|
||||
const blob = new Blob([fileData], { type: fileType });
|
||||
downloadUrl = window.URL.createObjectURL(blob);
|
||||
|
||||
const downloadLink = document.createElement("a");
|
||||
downloadLink.href = downloadUrl;
|
||||
downloadLink.download = fileName;
|
||||
|
||||
document.body.appendChild(downloadLink);
|
||||
downloadLink.click();
|
||||
|
||||
document.body.removeChild(downloadLink);
|
||||
} catch (error: any) {
|
||||
// 错误信息已经在响应拦截器中处理并显示
|
||||
console.error('导出失败:', error);
|
||||
} finally {
|
||||
if (downloadUrl) {
|
||||
window.URL.revokeObjectURL(downloadUrl);
|
||||
}
|
||||
loading.value = false;
|
||||
}
|
||||
}).catch(() => {
|
||||
ElMessageBox.close();
|
||||
});
|
||||
}
|
||||
|
||||
// 处理上传
|
||||
const handleUpload = async (formData: FormData, file: File) => {
|
||||
try {
|
||||
const response = await ExampleAPI.importExample(formData);
|
||||
if (response.data.code === ResultEnum.SUCCESS) {
|
||||
ElMessage.success(`${response.data.msg},${response.data.data}`);
|
||||
emit('import-success');
|
||||
}
|
||||
} catch (error: any) {
|
||||
console.error(error);
|
||||
}
|
||||
};
|
||||
|
||||
// 下载导入模板
|
||||
const handleDownloadTemplate = () => {
|
||||
ExampleAPI.downloadTemplate().then((response: any) => {
|
||||
const fileData = response.data;
|
||||
const fileName = decodeURI(response.headers['content-disposition'].split('; ')[1].split('=')[1]);
|
||||
const fileType = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8';
|
||||
|
||||
const blob = new Blob([fileData], { type: fileType });
|
||||
const downloadUrl = window.URL.createObjectURL(blob);
|
||||
|
||||
const downloadLink = document.createElement('a');
|
||||
downloadLink.href = downloadUrl;
|
||||
downloadLink.download = fileName;
|
||||
|
||||
document.body.appendChild(downloadLink);
|
||||
downloadLink.click();
|
||||
|
||||
document.body.removeChild(downloadLink);
|
||||
window.URL.revokeObjectURL(downloadUrl);
|
||||
});
|
||||
};
|
||||
|
||||
// 打开导入弹窗
|
||||
function handleOpenImportDialog() {
|
||||
importDialogVisible.value = true;
|
||||
}
|
||||
|
||||
// 批量启用/停用
|
||||
async function handleMoreClick(status: boolean) {
|
||||
if (selectIds.value.length) {
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
|
||||
<el-upload
|
||||
ref="uploadRef"
|
||||
class="el-upload"
|
||||
v-model:file-list="fileList"
|
||||
class="el-upload"
|
||||
name="file"
|
||||
:show-file-list="false"
|
||||
:before-upload="handleBeforeUpload"
|
||||
@@ -36,7 +36,7 @@
|
||||
@change="handleFileChange"
|
||||
>
|
||||
<template #trigger>
|
||||
<el-button type="primary" :icon="Camera" class="upload-trigger" v-hasPerm="['system:user:update']"/>
|
||||
<el-button v-hasPerm="['system:user:update']" type="primary" :icon="Camera" class="upload-trigger"/>
|
||||
</template>
|
||||
</el-upload>
|
||||
</div>
|
||||
@@ -145,7 +145,7 @@
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
<el-button type="primary" :loading="infoSubmitting" icon="edit" @click="handleSave" v-hasPerm="['system:user:update']">保存更改</el-button>
|
||||
<el-button v-hasPerm="['system:user:update']" type="primary" :loading="infoSubmitting" icon="edit" @click="handleSave">保存更改</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
@@ -185,7 +185,7 @@
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
<el-button type="primary" :loading="passwordChanging" icon="edit" @click="handlePasswordChange" v-hasPerm="['current:profile:change_password']">更新密码</el-button>
|
||||
<el-button v-hasPerm="['current:profile:change_password']" type="primary" :loading="passwordChanging" icon="edit" @click="handlePasswordChange">更新密码</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
@@ -198,12 +198,12 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import type { FormInstance, UploadRequestOptions, UploadFile } from 'element-plus'
|
||||
import type { FormInstance, UploadRequestOptions, UploadFile, ElUpload } from 'element-plus'
|
||||
import UserAPI, { type InfoFormState, type PasswordFormState } from '@/api/system/user';
|
||||
import { useUserStore, useDictStore } from "@/store";
|
||||
import { useUserStoreHook } from "@/store/modules/user.store";
|
||||
import { Camera } from '@element-plus/icons-vue';
|
||||
import { ElUpload, ElMessage } from 'element-plus';
|
||||
import { ElMessage } from 'element-plus';
|
||||
import { useI18n } from "vue-i18n";
|
||||
import { nextTick } from 'vue';
|
||||
import router from "@/router";
|
||||
|
||||
@@ -3,34 +3,34 @@
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="表名称" prop="tableName">
|
||||
<el-input placeholder="请输入仓库名称" v-model="info.tableName" />
|
||||
<el-input v-model="info.table_name" placeholder="请输入仓库名称"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="表描述" prop="tableComment">
|
||||
<el-input placeholder="请输入" v-model="info.tableComment" />
|
||||
<el-input v-model="info.table_comment" placeholder="请输入"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="实体类名称" prop="className">
|
||||
<el-input placeholder="请输入" v-model="info.className" />
|
||||
<el-input v-model="info.class_name" placeholder="请输入"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="作者" prop="functionAuthor">
|
||||
<el-input placeholder="请输入" v-model="info.functionAuthor" />
|
||||
<el-input v-model="info.function_author" placeholder="请输入"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input type="textarea" :rows="3" v-model="info.remark"></el-input>
|
||||
<el-input v-model="info.remark" type="textarea" :rows="3"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
<script setup lang="ts">
|
||||
defineProps({
|
||||
info: {
|
||||
type: Object,
|
||||
@@ -40,9 +40,9 @@ defineProps({
|
||||
|
||||
// 表单校验
|
||||
const rules = ref({
|
||||
tableName: [{ required: true, message: "请输入表名称", trigger: "blur" }],
|
||||
tableComment: [{ required: true, message: "请输入表描述", trigger: "blur" }],
|
||||
className: [{ required: true, message: "请输入实体类名称", trigger: "blur" }],
|
||||
functionAuthor: [{ required: true, message: "请输入作者", trigger: "blur" }]
|
||||
table_name: [{ required: true, message: "请输入表名称", trigger: "blur" }],
|
||||
table_comment: [{ required: true, message: "请输入表描述", trigger: "blur" }],
|
||||
class_name: [{ required: true, message: "请输入实体类名称", trigger: "blur" }],
|
||||
function_author: [{ required: true, message: "请输入作者", trigger: "blur" }]
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<template>
|
||||
<!-- 创建表 -->
|
||||
<el-dialog title="创建表" v-model="visible" width="800px" top="5vh" append-to-body>
|
||||
<el-dialog v-model="visible" title="创建表" width="800px" top="5vh" append-to-body>
|
||||
<span>创建表语句(支持多个建表语句):</span>
|
||||
<el-input type="textarea" :rows="10" placeholder="请输入文本" v-model="content"></el-input>
|
||||
<el-input v-model="content" type="textarea" :rows="10" placeholder="请输入文本"></el-input>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button type="primary" @click="handleImportTable">确 定</el-button>
|
||||
@@ -12,12 +12,12 @@
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
<script setup lang="ts">
|
||||
import GencodeAPI from "@/api/generator/gencode";
|
||||
import { ElMessage } from 'element-plus';
|
||||
|
||||
const visible = ref(false);
|
||||
const content = ref("");
|
||||
const { proxy } = getCurrentInstance();
|
||||
const emit = defineEmits(["ok"]);
|
||||
|
||||
/** 显示弹框 */
|
||||
@@ -28,12 +28,12 @@ function show() {
|
||||
/** 导入按钮操作 */
|
||||
function handleImportTable() {
|
||||
if (content.value === "") {
|
||||
proxy.$modal.msgError("请输入建表语句");
|
||||
ElMessage.error("请输入建表语句");
|
||||
return;
|
||||
}
|
||||
GencodeAPI.createTable({ sql: content.value }).then(res => {
|
||||
proxy.$modal.msgSuccess(res.msg);
|
||||
if (res.code === 200) {
|
||||
GencodeAPI.createTable(content.value).then(res => {
|
||||
ElMessage.success(res.data.msg || "创建成功");
|
||||
if (res.data.code === 200) {
|
||||
visible.value = false;
|
||||
emit("ok");
|
||||
}
|
||||
|
||||
@@ -48,22 +48,22 @@
|
||||
|
||||
<el-table-column label="插入" min-width="5%">
|
||||
<template #default="scope">
|
||||
<el-checkbox true-label="1" false-label="0" v-model="scope.row.isInsert"></el-checkbox>
|
||||
<el-checkbox v-model="scope.row.isInsert" true-label="1" false-label="0"></el-checkbox>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="编辑" min-width="5%">
|
||||
<template #default="scope">
|
||||
<el-checkbox true-label="1" false-label="0" v-model="scope.row.isEdit"></el-checkbox>
|
||||
<el-checkbox v-model="scope.row.isEdit" true-label="1" false-label="0"></el-checkbox>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="列表" min-width="5%">
|
||||
<template #default="scope">
|
||||
<el-checkbox true-label="1" false-label="0" v-model="scope.row.isList"></el-checkbox>
|
||||
<el-checkbox v-model="scope.row.isList" true-label="1" false-label="0"></el-checkbox>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="查询" min-width="5%">
|
||||
<template #default="scope">
|
||||
<el-checkbox true-label="1" false-label="0" v-model="scope.row.isQuery"></el-checkbox>
|
||||
<el-checkbox v-model="scope.row.isQuery" true-label="1" false-label="0"></el-checkbox>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="查询方式" min-width="10%">
|
||||
@@ -82,12 +82,12 @@
|
||||
</el-table-column>
|
||||
<el-table-column label="必填" min-width="5%">
|
||||
<template #default="scope">
|
||||
<el-checkbox true-label="1" false-label="0" v-model="scope.row.isRequired"></el-checkbox>
|
||||
<el-checkbox v-model="scope.row.isRequired" true-label="1" false-label="0"></el-checkbox>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="唯一" min-width="5%">
|
||||
<template #default="scope">
|
||||
<el-checkbox true-label="1" false-label="0" v-model="scope.row.isUnique"></el-checkbox>
|
||||
<el-checkbox v-model="scope.row.isUnique" true-label="1" false-label="0"></el-checkbox>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="显示类型" min-width="12%">
|
||||
@@ -122,7 +122,12 @@
|
||||
</el-table>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="生成信息" name="genInfo">
|
||||
<gen-info-form ref="genInfo" :info="info" :tables="tables" />
|
||||
<!-- 将GenTableSchema类型转换为GenInfo类型 -->
|
||||
<gen-info-form
|
||||
ref="genInfo"
|
||||
:info="convertToGenInfo(info)"
|
||||
:tables="tables"
|
||||
/>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
<el-form label-width="100px">
|
||||
@@ -134,74 +139,96 @@
|
||||
</el-card>
|
||||
</template>
|
||||
|
||||
<script setup name="GenEdit">
|
||||
<script setup lang="ts" name="GenEdit">
|
||||
import GencodeAPI from "@/api/generator/gencode";
|
||||
import { optionselect as getDictOptionselect } from "@/api/system/dict/type";
|
||||
import basicInfoForm from "./components/basicInfoForm";
|
||||
import genInfoForm from "./components/genInfoForm";
|
||||
import DictAPI from "@/api/system/dict";
|
||||
import { ElMessage } from 'element-plus';
|
||||
import router from '@/router';
|
||||
import type { GenTableSchema, GenTableDetailResult } from '@/api/generator/gencode';
|
||||
|
||||
const route = useRoute();
|
||||
const { proxy } = getCurrentInstance();
|
||||
const basicInfoRef = ref();
|
||||
const genInfoRef = ref();
|
||||
|
||||
const activeName = ref("columnInfo");
|
||||
const tableHeight = ref(document.documentElement.scrollHeight - 245 + "px");
|
||||
const tables = ref([]);
|
||||
const columns = ref([]);
|
||||
const dictOptions = ref([]);
|
||||
const info = ref({});
|
||||
const tables = ref<Array<any>>([]);
|
||||
const columns = ref<Array<any>>([]);
|
||||
const dictOptions = ref<Array<any>>([]);
|
||||
const info = ref<GenTableSchema>({} as GenTableSchema);
|
||||
|
||||
/**
|
||||
* 将对象转换为GenInfo类型
|
||||
*/
|
||||
function convertToGenInfo(tableSchema: any): any {
|
||||
if (!tableSchema) {
|
||||
return {};
|
||||
}
|
||||
return {
|
||||
tplCategory: tableSchema.tpl_category,
|
||||
tplWebType: tableSchema.tpl_web_type,
|
||||
packageName: tableSchema.package_name,
|
||||
moduleName: tableSchema.module_name,
|
||||
businessName: tableSchema.business_name,
|
||||
functionName: tableSchema.function_name,
|
||||
genType: tableSchema.gen_type,
|
||||
parentMenuId: tableSchema.parent_menu_id,
|
||||
genPath: tableSchema.gen_path,
|
||||
subTableName: tableSchema.sub_table_name,
|
||||
subTableFkName: tableSchema.sub_table_fk_name,
|
||||
treeCode: tableSchema.tree_code,
|
||||
treeParentCode: tableSchema.tree_parent_code,
|
||||
treeName: tableSchema.tree_name
|
||||
};
|
||||
}
|
||||
|
||||
/** 提交按钮 */
|
||||
function submitForm() {
|
||||
const basicForm = proxy.$refs.basicInfo.$refs.basicInfoForm;
|
||||
const genForm = proxy.$refs.genInfo.$refs.genInfoForm;
|
||||
Promise.all([basicForm, genForm].map(getFormPromise)).then(res => {
|
||||
const validateResult = res.every(item => !!item);
|
||||
if (validateResult) {
|
||||
// 简化表单验证逻辑
|
||||
const genTable = Object.assign({}, info.value);
|
||||
genTable.columns = columns.value;
|
||||
genTable.params = {
|
||||
treeCode: info.value.treeCode,
|
||||
treeName: info.value.treeName,
|
||||
treeParentCode: info.value.treeParentCode,
|
||||
parentMenuId: info.value.parentMenuId
|
||||
};
|
||||
GencodeAPI.updateGenTable(genTable).then(res => {
|
||||
proxy.$modal.msgSuccess(res.msg);
|
||||
if (res.code === 200) {
|
||||
genTable.tree_code = info.value.tree_code;
|
||||
genTable.tree_name = info.value.tree_name;
|
||||
genTable.tree_parent_code = info.value.tree_parent_code;
|
||||
genTable.parent_menu_id = info.value.parent_menu_id;
|
||||
|
||||
// 确保id存在且为number类型
|
||||
if (info.value && info.value.id !== undefined) {
|
||||
GencodeAPI.updateGenTable(Number(info.value.id), genTable).then((res: any) => {
|
||||
ElMessage.success(res.data.message || "更新成功");
|
||||
if (res.data.code === 200) {
|
||||
close();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
proxy.$modal.msgError("表单校验未通过,请重新检查提交内容");
|
||||
ElMessage.error("表ID不存在,无法更新");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function getFormPromise(form) {
|
||||
return new Promise(resolve => {
|
||||
form.validate(res => {
|
||||
resolve(res);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function close() {
|
||||
const obj = { path: "/tool/gen", query: { t: Date.now(), pageNum: route.query.pageNum } };
|
||||
proxy.$tab.closeOpenPage(obj);
|
||||
const pageNum = route.query.page_no || route.query.pageNum;
|
||||
router.push({ path: "/tool/gen", query: { t: Date.now(), page_no: pageNum } });
|
||||
}
|
||||
|
||||
(() => {
|
||||
const tableId = route.params && route.params.tableId;
|
||||
if (tableId) {
|
||||
// 获取表详细信息
|
||||
GencodeAPI.getGenTable(tableId).then(res => {
|
||||
columns.value = res.data.rows;
|
||||
info.value = res.data.info;
|
||||
tables.value = res.data.tables;
|
||||
GencodeAPI.getGenTableDetail(Number(tableId)).then(res => {
|
||||
if (res.data && res.data.data) {
|
||||
columns.value = res.data.data.rows || [];
|
||||
// 确保info包含所有必要的字段,特别是columns
|
||||
const tableInfo = res.data.data.info || {};
|
||||
info.value = {
|
||||
...tableInfo,
|
||||
columns: columns.value
|
||||
};
|
||||
tables.value = res.data.data.tables || [];
|
||||
}
|
||||
});
|
||||
/** 查询字典下拉列表 */
|
||||
GencodeAPI.getDictOptionselect().then(response => {
|
||||
dictOptions.value = response.data;
|
||||
DictAPI.getDictTypeOptionselect().then((response: any) => {
|
||||
dictOptions.value = response.data.data || [];
|
||||
});
|
||||
}
|
||||
})();
|
||||
|
||||
@@ -102,7 +102,7 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" v-if="info.genType == '1'">
|
||||
<el-col v-if="info.genType == '1'" :span="24">
|
||||
<el-form-item prop="genPath">
|
||||
<template #label>
|
||||
自定义路径
|
||||
@@ -119,7 +119,7 @@
|
||||
</el-button>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item @click="info.genPath = '/'">恢复默认的生成基础路径</el-dropdown-item>
|
||||
<el-dropdown-item @click="handleResetGenPath">恢复默认的生成基础路径</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
@@ -142,7 +142,7 @@
|
||||
</template>
|
||||
<el-select v-model="info.treeCode" placeholder="请选择">
|
||||
<el-option
|
||||
v-for="(column, index) in info.columns"
|
||||
v-for="(column, index) in info.columns || []"
|
||||
:key="index"
|
||||
:label="column.columnName + ':' + column.columnComment"
|
||||
:value="column.columnName"
|
||||
@@ -160,7 +160,7 @@
|
||||
</template>
|
||||
<el-select v-model="info.treeParentCode" placeholder="请选择">
|
||||
<el-option
|
||||
v-for="(column, index) in info.columns"
|
||||
v-for="(column, index) in info.columns || []"
|
||||
:key="index"
|
||||
:label="column.columnName + ':' + column.columnComment"
|
||||
:value="column.columnName"
|
||||
@@ -178,7 +178,7 @@
|
||||
</template>
|
||||
<el-select v-model="info.treeName" placeholder="请选择">
|
||||
<el-option
|
||||
v-for="(column, index) in info.columns"
|
||||
v-for="(column, index) in info.columns || []"
|
||||
:key="index"
|
||||
:label="column.columnName + ':' + column.columnComment"
|
||||
:value="column.columnName"
|
||||
@@ -202,10 +202,11 @@
|
||||
</template>
|
||||
<el-select v-model="info.subTableName" placeholder="请选择" @change="subSelectChange">
|
||||
<el-option
|
||||
v-for="(table, index) in tables"
|
||||
v-for="(table, index) in tables || []"
|
||||
:key="index"
|
||||
:label="table.tableName + ':' + table.tableComment"
|
||||
:value="table.tableName"
|
||||
:label="(table.tableName || '') + ':' + (table.tableComment || '')"
|
||||
:value="table.tableName || ''"
|
||||
:disabled="!table.tableName"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
@@ -234,21 +235,78 @@
|
||||
</el-form>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { listMenu } from "@/api/system/menu";
|
||||
<script setup lang="ts">
|
||||
import MenuAPI from "@/api/system/menu";
|
||||
import { ref, computed, onMounted, watch } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
|
||||
const subColumns = ref([]);
|
||||
const menuOptions = ref([]);
|
||||
const { proxy } = getCurrentInstance();
|
||||
const subColumns = ref<Array<{ columnName: string; columnComment: string }>>([]);
|
||||
const menuOptions = ref<Array<{ id: number; menuId: number; menuName: string; parent_id: number; children: Array<any> }>>([]);
|
||||
const router = useRouter();
|
||||
|
||||
const props = defineProps({
|
||||
info: {
|
||||
type: Object,
|
||||
default: null
|
||||
// 定义类型接口
|
||||
interface TableColumn {
|
||||
columnName: string;
|
||||
columnComment: string;
|
||||
}
|
||||
|
||||
interface TableInfo {
|
||||
tableName?: string;
|
||||
tableComment?: string;
|
||||
columns?: TableColumn[];
|
||||
}
|
||||
|
||||
interface GenInfo {
|
||||
tplCategory?: string;
|
||||
tplWebType?: string;
|
||||
packageName?: string;
|
||||
moduleName?: string;
|
||||
businessName?: string;
|
||||
functionName?: string;
|
||||
genType?: string;
|
||||
parentMenuId?: number;
|
||||
genPath?: string;
|
||||
subTableName?: string;
|
||||
subTableFkName?: string;
|
||||
columns?: TableColumn[];
|
||||
treeCode?: string;
|
||||
treeParentCode?: string;
|
||||
treeName?: string;
|
||||
}
|
||||
|
||||
const props = defineProps<{
|
||||
info?: GenInfo;
|
||||
tables?: TableInfo[];
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'update:info', value: GenInfo): void;
|
||||
}>();
|
||||
|
||||
// 使用computed创建一个安全的info对象,确保所有属性都有默认值
|
||||
const info = computed<GenInfo>({
|
||||
get() {
|
||||
return {
|
||||
tplCategory: '',
|
||||
tplWebType: 'element-plus',
|
||||
packageName: '',
|
||||
moduleName: '',
|
||||
businessName: '',
|
||||
functionName: '',
|
||||
genType: '0',
|
||||
parentMenuId: undefined,
|
||||
genPath: '',
|
||||
subTableName: '',
|
||||
subTableFkName: '',
|
||||
columns: [],
|
||||
treeCode: '',
|
||||
treeParentCode: '',
|
||||
treeName: '',
|
||||
...props.info
|
||||
};
|
||||
},
|
||||
tables: {
|
||||
type: Array,
|
||||
default: null
|
||||
set(newValue: GenInfo) {
|
||||
emit('update:info', newValue);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -261,45 +319,105 @@ const rules = ref({
|
||||
functionName: [{ required: true, message: "请输入生成功能名", trigger: "blur" }]
|
||||
});
|
||||
|
||||
function subSelectChange(value) {
|
||||
props.info.subTableFkName = "";
|
||||
function subSelectChange() {
|
||||
emit('update:info', {
|
||||
...info.value,
|
||||
subTableFkName: ""
|
||||
});
|
||||
}
|
||||
|
||||
function tplSelectChange(value) {
|
||||
function tplSelectChange(value: string) {
|
||||
if (value !== "sub") {
|
||||
props.info.subTableName = "";
|
||||
props.info.subTableFkName = "";
|
||||
emit('update:info', {
|
||||
...info.value,
|
||||
subTableName: "",
|
||||
subTableFkName: ""
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function setSubTableColumns(value) {
|
||||
for (var item in props.tables) {
|
||||
const name = props.tables[item].tableName;
|
||||
if (value === name) {
|
||||
subColumns.value = props.tables[item].columns;
|
||||
function setSubTableColumns(value?: string) {
|
||||
if (!value || !props.tables) {
|
||||
subColumns.value = [];
|
||||
return;
|
||||
}
|
||||
|
||||
for (const item of props.tables) {
|
||||
if (item.tableName === value && item.columns) {
|
||||
subColumns.value = item.columns;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 恢复默认生成路径的方法
|
||||
function handleResetGenPath() {
|
||||
emit('update:info', {
|
||||
...info.value,
|
||||
genPath: '/'
|
||||
});
|
||||
}
|
||||
|
||||
/** 查询菜单下拉树结构 */
|
||||
function getMenuTreeselect() {
|
||||
listMenu().then(response => {
|
||||
menuOptions.value = proxy.handleTree(response.data, "menuId");
|
||||
MenuAPI.getMenuList().then((response: any) => {
|
||||
// 简单的树形结构处理逻辑
|
||||
function buildTree(data: any[], idField: string): any[] {
|
||||
const result: any[] = [];
|
||||
const map: Record<string, any> = {};
|
||||
|
||||
// 构建id映射
|
||||
data.forEach(item => {
|
||||
map[item[idField]] = item;
|
||||
item.children = [];
|
||||
// 转换属性名以匹配tree-select的期望格式
|
||||
if (item.id !== undefined) {
|
||||
item.menuId = item.id;
|
||||
}
|
||||
if (item.menu_name !== undefined) {
|
||||
item.menuName = item.menu_name;
|
||||
}
|
||||
});
|
||||
|
||||
// 构建树
|
||||
data.forEach(item => {
|
||||
if (item.parent_id === 0 || !map[item.parent_id]) {
|
||||
result.push(item);
|
||||
} else {
|
||||
map[item.parent_id].children.push(item);
|
||||
}
|
||||
});
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
if (response && response.data && response.data.data) {
|
||||
menuOptions.value = buildTree(response.data.data, "id");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getMenuTreeselect();
|
||||
})
|
||||
// 初始化时检查tplWebType是否为空
|
||||
if (!props.info?.tplWebType) {
|
||||
emit('update:info', {
|
||||
...info.value,
|
||||
tplWebType: "element-plus"
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
watch(() => props.info.subTableName, val => {
|
||||
watch(() => props.info?.subTableName, (val) => {
|
||||
setSubTableColumns(val);
|
||||
});
|
||||
|
||||
watch(() => props.info.tplWebType, val => {
|
||||
if (val === '') {
|
||||
props.info.tplWebType = "element-plus";
|
||||
watch(() => props.info?.tplWebType, (val) => {
|
||||
if (val === '' || val === undefined) {
|
||||
emit('update:info', {
|
||||
...info.value,
|
||||
tplWebType: "element-plus"
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<template>
|
||||
<!-- 导入表 -->
|
||||
<el-dialog title="导入表" v-model="visible" width="800px" top="5vh" append-to-body>
|
||||
<el-form :model="queryParams" ref="queryRef" :inline="true">
|
||||
<el-dialog v-model="visible" title="导入表" width="800px" top="5vh" append-to-body>
|
||||
<el-form ref="queryRef" :model="queryFormData" :inline="true">
|
||||
<el-form-item label="表名称" prop="tableName">
|
||||
<el-input
|
||||
v-model="queryParams.tableName"
|
||||
v-model="queryFormData.table_name"
|
||||
placeholder="请输入表名称"
|
||||
clearable
|
||||
style="width: 180px"
|
||||
@@ -13,7 +13,7 @@
|
||||
</el-form-item>
|
||||
<el-form-item label="表描述" prop="tableComment">
|
||||
<el-input
|
||||
v-model="queryParams.tableComment"
|
||||
v-model="queryFormData.table_comment"
|
||||
placeholder="请输入表描述"
|
||||
clearable
|
||||
style="width: 180px"
|
||||
@@ -26,18 +26,25 @@
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-row>
|
||||
<el-table @row-click="clickRow" ref="table" :data="dbTableList" @selection-change="handleSelectionChange" height="260px">
|
||||
<el-table ref="table" :data="dbTableList" height="300px" @row-click="clickRow" @selection-change="handleSelectionChange">
|
||||
<template #empty>
|
||||
<el-empty :image-size="80" description="暂无数据" />
|
||||
</template>
|
||||
<el-table-column type="selection" width="55"></el-table-column>
|
||||
<el-table-column prop="tableName" label="表名称" :show-overflow-tooltip="true"></el-table-column>
|
||||
<el-table-column prop="tableComment" label="表描述" :show-overflow-tooltip="true"></el-table-column>
|
||||
<el-table-column prop="createTime" label="创建时间"></el-table-column>
|
||||
<el-table-column prop="updateTime" label="更新时间"></el-table-column>
|
||||
<el-table-column label="序号" type="index" min-width="55" align="center" fixed>
|
||||
<template #default="scope">
|
||||
<span>{{(queryFormData.page_no - 1) * queryFormData.page_size + scope.$index + 1}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="database_name" label="数据库名称" :show-overflow-tooltip="true"></el-table-column>
|
||||
<el-table-column prop="table_name" label="表名称" :show-overflow-tooltip="true"></el-table-column>
|
||||
<el-table-column prop="table_comment" label="表描述" :show-overflow-tooltip="true"></el-table-column>
|
||||
<el-table-column prop="table_type" label="表类型"></el-table-column>
|
||||
</el-table>
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
v-model:page="queryFormData.page_no"
|
||||
v-model:limit="queryFormData.page_size"
|
||||
:total="total"
|
||||
v-model:page="queryParams.pageNum"
|
||||
v-model:limit="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</el-row>
|
||||
@@ -50,20 +57,22 @@
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
<script setup lang="ts">
|
||||
import GencodeAPI from "@/api/generator/gencode";
|
||||
import { ElMessage } from 'element-plus';
|
||||
|
||||
const total = ref(0);
|
||||
const visible = ref(false);
|
||||
const tables = ref([]);
|
||||
const dbTableList = ref([]);
|
||||
const { proxy } = getCurrentInstance();
|
||||
const tables = ref<Array<string>>([]);
|
||||
const dbTableList = ref<Array<any>>([]);
|
||||
const queryRef = ref();
|
||||
const table = ref();
|
||||
|
||||
const queryParams = reactive({
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
tableName: undefined,
|
||||
tableComment: undefined
|
||||
const queryFormData = reactive({
|
||||
page_no: 1,
|
||||
page_size: 10,
|
||||
table_name: undefined,
|
||||
table_comment: undefined
|
||||
});
|
||||
|
||||
const emit = defineEmits(["ok"]);
|
||||
@@ -75,32 +84,35 @@ function show() {
|
||||
}
|
||||
|
||||
/** 单击选择行 */
|
||||
function clickRow(row) {
|
||||
proxy.$refs.table.toggleRowSelection(row);
|
||||
function clickRow(row: any) {
|
||||
table.value?.toggleRowSelection(row);
|
||||
}
|
||||
|
||||
/** 多选框选中数据 */
|
||||
function handleSelectionChange(selection) {
|
||||
tables.value = selection.map(item => item.tableName);
|
||||
function handleSelectionChange(selection: Array<any>) {
|
||||
tables.value = selection.map(item => item.table_name);
|
||||
}
|
||||
|
||||
/** 查询表数据 */
|
||||
function getList() {
|
||||
GencodeAPI.listDbTable(queryParams).then(res => {
|
||||
dbTableList.value = res.rows;
|
||||
total.value = res.total;
|
||||
GencodeAPI.listDbTable(queryFormData).then(res => {
|
||||
console.log(res.data);
|
||||
dbTableList.value = res.data.data.items;
|
||||
total.value = res.data.data.total;
|
||||
});
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
function handleQuery() {
|
||||
queryParams.pageNum = 1;
|
||||
queryFormData.page_no = 1;
|
||||
getList();
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
function resetQuery() {
|
||||
proxy.resetForm("queryRef");
|
||||
if (queryRef.value) {
|
||||
queryRef.value.resetFields();
|
||||
}
|
||||
handleQuery();
|
||||
}
|
||||
|
||||
@@ -108,12 +120,13 @@ function resetQuery() {
|
||||
function handleImportTable() {
|
||||
const tableNames = tables.value.join(",");
|
||||
if (tableNames == "") {
|
||||
proxy.$modal.msgError("请选择要导入的表");
|
||||
ElMessage.error("请选择要导入的表");
|
||||
return;
|
||||
}
|
||||
GencodeAPI.importTable({ tables: tableNames }).then(res => {
|
||||
proxy.$modal.msgSuccess(res.msg);
|
||||
if (res.code === 200) {
|
||||
// 因为tables.value已经是string[]类型了,直接传入
|
||||
GencodeAPI.importTable(tables.value).then((res: any) => {
|
||||
ElMessage.success(res.data.message);
|
||||
if (res.data.code === 200) {
|
||||
visible.value = false;
|
||||
emit("ok");
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<div class="app-container">
|
||||
<!-- 搜索区域 -->
|
||||
<div class="search-container">
|
||||
<el-form v-show="showSearch" ref="queryRef" :model="queryFormData" :inline="true" label-suffix=":">
|
||||
<el-form ref="queryRef" :model="queryFormData" :inline="true" label-suffix=":">
|
||||
<el-form-item label="表名称" prop="table_name">
|
||||
<el-input
|
||||
v-model="queryFormData.table_name"
|
||||
@@ -32,8 +32,8 @@
|
||||
></el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button v-hasPermi="['generator:gencode:query']" type="primary" icon="Sesearcharch" @click="handleQuery">搜索</el-button>
|
||||
<el-button v-hasPermi="['generator:gencode:query']" icon="refresh" @click="resetQuery">重置</el-button>
|
||||
<el-button v-hasPerm="['generator:gencode:query']" type="primary" icon="search" @click="handleQuery">查询</el-button>
|
||||
<el-button v-hasPerm="['generator:gencode:query']" icon="refresh" @click="handleRefresh">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
@@ -57,79 +57,68 @@
|
||||
<el-row :gutter="10">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
v-hasPermi="['generator:gencode:code']"
|
||||
v-hasPerm="['generator:gencode:create']"
|
||||
type="primary"
|
||||
plain
|
||||
icon="Plus"
|
||||
@click="openCreateTable"
|
||||
>创建</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
v-hasPerm="['generator:gencode:update']"
|
||||
type="success"
|
||||
plain
|
||||
icon="Edit"
|
||||
:disabled="single"
|
||||
@click="handleEditTable"
|
||||
>修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
v-hasPerm="['generator:gencode:delete']"
|
||||
type="danger"
|
||||
plain
|
||||
icon="Delete"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
v-hasPerm="['generator:gencode:import']"
|
||||
type="info"
|
||||
plain
|
||||
icon="Upload"
|
||||
@click="openImportTable"
|
||||
>导入</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
v-hasPerm="['generator:gencode:code']"
|
||||
type="warning"
|
||||
plain
|
||||
icon="Download"
|
||||
:disabled="multiple"
|
||||
@click="handleGenTable"
|
||||
>生成</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="Plus"
|
||||
@click="openCreateTable"
|
||||
v-hasRole="['admin']"
|
||||
>创建</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="info"
|
||||
plain
|
||||
icon="Upload"
|
||||
@click="openImportTable"
|
||||
v-hasPermi="['generator:gencode:import']"
|
||||
>导入</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="Edit"
|
||||
:disabled="single"
|
||||
@click="handleEditTable"
|
||||
v-hasPermi="['generator:gencode:update']"
|
||||
>修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="Delete"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['generator:gencode:delete']"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
<div class="data-table__toolbar--tools">
|
||||
<el-row :gutter="10">
|
||||
<el-col :span="1.5">
|
||||
<el-tooltip content="导入">
|
||||
<el-button type="info" icon="upload" circle @click="handleOpenImportDialog" v-hasPerm="['demo:example:import']" />
|
||||
</el-tooltip>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-tooltip content="导出">
|
||||
<el-button type="warning" icon="download" circle @click="handleExport" v-hasPerm="['demo:example:export']" />
|
||||
</el-tooltip>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-tooltip content="刷新">
|
||||
<el-button type="primary" icon="refresh" circle @click="handleRefresh" v-hasPerm="['demo:example:refresh']" />
|
||||
<el-button v-hasPerm="['demo:example:refresh']" type="primary" icon="refresh" circle @click="handleRefresh"/>
|
||||
</el-tooltip>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-tooltip content="列表筛选">
|
||||
<el-dropdown trigger="click">
|
||||
<el-button type="default" icon="operation" circle v-hasPerm="['demo:example:filter']" />
|
||||
<el-button v-hasPerm="['demo:example:filter']" type="default" icon="operation" circle/>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item v-for="column in tableColumns" :key="column.prop"
|
||||
:command="column">
|
||||
<el-dropdown-item v-for="column in tableColumns" :key="column.prop" :command="column">
|
||||
<el-checkbox v-model="column.show">
|
||||
{{ column.label }}
|
||||
</el-checkbox>
|
||||
@@ -140,7 +129,6 @@
|
||||
</el-tooltip>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -187,19 +175,19 @@
|
||||
<el-table-column label="操作" align="center" width="330" class-name="small-padding fixed-width">
|
||||
<template #default="scope">
|
||||
<el-tooltip content="预览" placement="top">
|
||||
<el-button link type="primary" icon="View" @click="handlePreview(scope.row)" v-hasPermi="['generator:gencode:query']"></el-button>
|
||||
<el-button v-hasPerm="['generator:gencode:query']" link type="primary" icon="View" @click="handlePreview(scope.row)"></el-button>
|
||||
</el-tooltip>
|
||||
<el-tooltip content="编辑" placement="top">
|
||||
<el-button link type="primary" icon="Edit" @click="handleEditTable(scope.row)" v-hasPermi="['generator:gencode:update']"></el-button>
|
||||
<el-button v-hasPerm="['generator:gencode:update']" link type="primary" icon="Edit" @click="handleEditTable(scope.row)"></el-button>
|
||||
</el-tooltip>
|
||||
<el-tooltip content="删除" placement="top">
|
||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['generator:gencode:delete']"></el-button>
|
||||
<el-button v-hasPerm="['generator:gencode:delete']" link type="primary" icon="Delete" @click="handleDelete(scope.row)"></el-button>
|
||||
</el-tooltip>
|
||||
<el-tooltip content="同步" placement="top">
|
||||
<el-button link type="primary" icon="Refresh" @click="handleSynchDb(scope.row)" v-hasPermi="['generator:gencode:edit']"></el-button>
|
||||
<el-button v-hasPerm="['generator:gencode:edit']" link type="primary" icon="Refresh" @click="handleSynchDb(scope.row)"></el-button>
|
||||
</el-tooltip>
|
||||
<el-tooltip content="生成代码" placement="top">
|
||||
<el-button link type="primary" icon="Download" @click="handleGenTable(scope.row)" v-hasPermi="['generator:gencode:code']"></el-button>
|
||||
<el-button v-hasPerm="['generator:gencode:code']" link type="primary" icon="Download" @click="handleGenTable(scope.row)"></el-button>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@@ -208,7 +196,6 @@
|
||||
<!-- 分页区域 -->
|
||||
<template #footer>
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
v-model:total="total"
|
||||
v-model:page="queryFormData.page_no"
|
||||
v-model:limit="queryFormData.page_size"
|
||||
@@ -222,11 +209,11 @@
|
||||
<el-tabs v-model="preview.activeName">
|
||||
<el-tab-pane
|
||||
v-for="(value, key) in preview.data"
|
||||
:label="key.substring(key.lastIndexOf('/')+1,key.indexOf('.jinja2'))"
|
||||
:name="key.substring(key.lastIndexOf('/')+1,key.indexOf('.jinja2'))"
|
||||
:label="String(key).substring(String(key).lastIndexOf('/')+1,String(key).indexOf('.jinja2'))"
|
||||
:name="String(key).substring(String(key).lastIndexOf('/')+1,String(key).indexOf('.jinja2'))"
|
||||
:key="value"
|
||||
>
|
||||
<el-link :underline="false" icon="DocumentCopy" @click="() => navigator.clipboard.writeText(value).then(() => copyTextSuccess())" style="float:right"> 复制</el-link>
|
||||
<el-link :underline="false" icon="DocumentCopy" @click="() => handleCopyText(value)" style="float:right"> 复制</el-link>
|
||||
<pre>{{ value }}</pre>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
@@ -253,15 +240,14 @@ const route = useRoute();
|
||||
const importRef = ref();
|
||||
const createRef = ref();
|
||||
|
||||
const tableList = ref([]);
|
||||
const tableList = ref<Array<any>>([]);
|
||||
const loading = ref(true);
|
||||
const showSearch = ref(true);
|
||||
const ids = ref([]);
|
||||
const ids = ref<Array<number>>([]);
|
||||
const single = ref(true);
|
||||
const multiple = ref(true);
|
||||
const total = ref(0);
|
||||
const tableNames = ref([]);
|
||||
const dateRange = ref([]);
|
||||
const tableNames = ref<Array<string>>([]);
|
||||
const dateRange = ref<Array<string>>([]);
|
||||
const uniqueId = ref("");
|
||||
|
||||
|
||||
@@ -298,8 +284,8 @@ const { queryFormData, preview } = toRefs(data);
|
||||
|
||||
onActivated(() => {
|
||||
const time = route.query.t;
|
||||
if (time != null && time != uniqueId.value) {
|
||||
uniqueId.value = time;
|
||||
if (time != null && String(time) != uniqueId.value) {
|
||||
uniqueId.value = String(time);
|
||||
queryFormData.value.page_no = Number(route.query.page_no || 1);
|
||||
dateRange.value = [];
|
||||
loadingData();
|
||||
@@ -314,15 +300,9 @@ function loadingData() {
|
||||
...queryFormData.value
|
||||
};
|
||||
|
||||
// 如果有日期范围,添加到查询参数中
|
||||
if (dateRange.value && dateRange.value.length === 2) {
|
||||
queryParams.start_time = dateRange.value[0];
|
||||
queryParams.end_time = dateRange.value[1];
|
||||
}
|
||||
|
||||
GencodeAPI.listTable(queryParams).then(response => {
|
||||
tableList.value = response.rows;
|
||||
total.value = response.total;
|
||||
tableList.value = response.data.data.items;
|
||||
total.value = response.data.data.total;
|
||||
loading.value = false;
|
||||
});
|
||||
}
|
||||
@@ -334,32 +314,32 @@ function handleQuery() {
|
||||
}
|
||||
|
||||
/** 生成代码操作 */
|
||||
function handleGenTable(row) {
|
||||
function handleGenTable(row: any) {
|
||||
const tbNames = row?.table_name || tableNames.value;
|
||||
if (!tbNames || (Array.isArray(tbNames) && tbNames.length === 0)) {
|
||||
ElMessage.error("请选择要生成的数据");
|
||||
return;
|
||||
}
|
||||
|
||||
if (row?.genType === "1") {
|
||||
GencodeAPI.genCodeToPath(row.tableName).then(() => {
|
||||
ElMessage.success("成功生成到自定义路径:" + row.genPath);
|
||||
if (row?.gen_type === "1") {
|
||||
GencodeAPI.genCodeToPath(row.table_name).then(() => {
|
||||
ElMessage.success("成功生成到自定义路径:" + row.gen_path);
|
||||
});
|
||||
} else {
|
||||
GencodeAPI.batchGenCode(tbNames).then(response => {
|
||||
const blob = new Blob([response], { type: 'application/zip' });
|
||||
const url = window.URL.createObjectURL(blob);
|
||||
GencodeAPI.batchGenCode(tbNames).then((response: any) => {
|
||||
const blob = new Blob([response.data], { type: 'application/zip' });
|
||||
const url = URL.createObjectURL(blob);
|
||||
const link = document.createElement('a');
|
||||
link.href = url;
|
||||
link.download = 'code.zip';
|
||||
link.click();
|
||||
window.URL.revokeObjectURL(url);
|
||||
URL.revokeObjectURL(url);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/** 同步数据库操作 */
|
||||
function handleSynchDb(row) {
|
||||
function handleSynchDb(row: any) {
|
||||
const tableName = row.table_name;
|
||||
ElMessageBox.confirm(
|
||||
'确认要强制同步"' + tableName + '"表结构吗?',
|
||||
@@ -391,7 +371,7 @@ function openCreateTable() {
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
function resetQuery() {
|
||||
function handleRefresh() {
|
||||
dateRange.value = [];
|
||||
// 手动重置表单
|
||||
queryFormData.value = {
|
||||
@@ -404,8 +384,8 @@ function resetQuery() {
|
||||
}
|
||||
|
||||
/** 预览按钮 */
|
||||
function handlePreview(row) {
|
||||
GencodeAPI.previewTable(row.tableId).then(response => {
|
||||
function handlePreview(row: any) {
|
||||
GencodeAPI.previewTable(row.id).then(response => {
|
||||
preview.value.data = response.data;
|
||||
preview.value.open = true;
|
||||
preview.value.activeName = "do.py";
|
||||
@@ -417,23 +397,34 @@ function copyTextSuccess() {
|
||||
ElMessage.success("复制成功");
|
||||
}
|
||||
|
||||
/** 处理文本复制 */
|
||||
function handleCopyText(value: string) {
|
||||
if (window && window.navigator && window.navigator.clipboard) {
|
||||
window.navigator.clipboard.writeText(value).then(() => {
|
||||
copyTextSuccess();
|
||||
}).catch(() => {
|
||||
ElMessage.error("复制失败");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// 多选框选中数据
|
||||
function handleSelectionChange(selection) {
|
||||
ids.value = selection.map(item => item.tableId);
|
||||
tableNames.value = selection.map(item => item.table_name);
|
||||
function handleSelectionChange(selection: Array<any>) {
|
||||
ids.value = selection.map((item: any) => item.id);
|
||||
tableNames.value = selection.map((item: any) => item.table_name);
|
||||
single.value = selection.length != 1;
|
||||
multiple.value = !selection.length;
|
||||
}
|
||||
}
|
||||
|
||||
/** 修改按钮操作 */
|
||||
function handleEditTable(row) {
|
||||
const tableId = row.tableId || ids.value[0];
|
||||
/** 修改按钮操作 */
|
||||
function handleEditTable(row: any) {
|
||||
const tableId = row.id || ids.value[0];
|
||||
router.push({ path: "/tool/gen-edit/index/" + tableId, query: { page_no: queryFormData.value.page_no } });
|
||||
}
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
function handleDelete(row) {
|
||||
const tableIds = row?.tableId ? [row.tableId] : ids.value;
|
||||
/** 删除按钮操作 */
|
||||
function handleDelete(row: any) {
|
||||
const tableIds = row?.id ? [row.id] : ids.value;
|
||||
ElMessageBox.confirm(
|
||||
'是否确认删除表编号为"' + tableIds + '"的数据项?',
|
||||
'删除确认',
|
||||
@@ -443,12 +434,14 @@ function handleDelete(row) {
|
||||
type: 'warning'
|
||||
}
|
||||
).then(() => {
|
||||
return GencodeAPI.deleteTable(tableIds);
|
||||
return GencodeAPI.deleteTable({ table_ids: tableIds });
|
||||
}).then(() => {
|
||||
loadingData();
|
||||
ElMessage.success("删除成功");
|
||||
}).catch(() => {});
|
||||
}
|
||||
}
|
||||
|
||||
loadingData();
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
|
||||
@@ -22,12 +22,8 @@
|
||||
</el-form-item>
|
||||
<!-- 查询、重置、展开/收起按钮 -->
|
||||
<el-form-item class="search-buttons">
|
||||
<el-button type="primary" icon="search" @click="handleQuery" v-hasPerm="['generator:demo:query']">
|
||||
查询
|
||||
</el-button>
|
||||
<el-button icon="refresh" @click="handleResetQuery" v-hasPerm="['generator:demo:query']">
|
||||
重置
|
||||
</el-button>
|
||||
<el-button v-hasPerm="['generator:demo:query']" type="primary" icon="search" @click="handleQuery">查询</el-button>
|
||||
<el-button v-hasPerm="['generator:demo:query']" icon="refresh" @click="handleResetQuery">重置</el-button>
|
||||
<!-- 展开/收起 -->
|
||||
<template v-if="isExpandable">
|
||||
<el-link class="ml-3" type="primary" underline="never" @click="isExpand = !isExpand">
|
||||
@@ -62,37 +58,50 @@
|
||||
<!-- 功能区域 -->
|
||||
<div class="data-table__toolbar">
|
||||
<div class="data-table__toolbar--actions">
|
||||
<el-button type="success" icon="plus" @click="handleOpenDialog('create')" v-hasPerm="['generator:demo:create']">新增</el-button>
|
||||
<el-button type="danger" icon="delete" :disabled="selectIds.length === 0"
|
||||
@click="handleDelete(selectIds)" v-hasPerm="['generator:demo:delete']">批量删除</el-button>
|
||||
<el-row :gutter="10">
|
||||
<el-col :span="1.5">
|
||||
<el-button v-hasPerm="['generator:demo:create']" type="success" icon="plus" @click="handleOpenDialog('create')">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button v-hasPerm="['generator:demo:delete']" type="danger" icon="delete" :disabled="selectIds.length === 0" @click="handleDelete(selectIds)">批量删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-dropdown trigger="click">
|
||||
<el-button type="default" :disabled="selectIds.length === 0" icon="ArrowDown">更多</el-button>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item icon="Check" @click="handleMoreClick(true)" v-hasPerm="['generator:demo:batch_available']">批量启用</el-dropdown-item>
|
||||
<el-dropdown-item icon="CircleClose"
|
||||
@click="handleMoreClick(false)" v-hasPerm="['generator:demo:batch_available']">批量停用</el-dropdown-item>
|
||||
<el-dropdown-item v-hasPerm="['generator:demo:batch_available']" icon="Check" @click="handleMoreClick(true)">批量启用</el-dropdown-item>
|
||||
<el-dropdown-item v-hasPerm="['generator:demo:batch_available']" icon="CircleClose" @click="handleMoreClick(false)">批量停用</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
<div class="data-table__toolbar--tools">
|
||||
<el-row :gutter="10">
|
||||
<el-col :span="1.5">
|
||||
<el-tooltip content="导入">
|
||||
<el-button type="info" icon="upload" circle @click="handleOpenImportDialog" v-hasPerm="['generator:demo:import']" />
|
||||
<el-button v-hasPerm="['generator:demo:import']" type="info" icon="upload" circle @click="handleOpenImportDialog"/>
|
||||
</el-tooltip>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-tooltip content="导出">
|
||||
<el-button type="warning" icon="download" circle @click="handleExport" v-hasPerm="['generator:demo:export']" />
|
||||
<el-button v-hasPerm="['generator:demo:export']" type="warning" icon="download" circle @click="handleExport"/>
|
||||
</el-tooltip>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-tooltip content="刷新">
|
||||
<el-button type="primary" icon="refresh" circle @click="handleRefresh" v-hasPerm="['generator:demo:refresh']" />
|
||||
<el-button v-hasPerm="['generator:demo:refresh']" type="primary" icon="refresh" circle @click="handleRefresh"/>
|
||||
</el-tooltip>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-tooltip content="列表筛选">
|
||||
<el-dropdown trigger="click">
|
||||
<el-button type="default" icon="operation" circle v-hasPerm="['generator:demo:filter']" />
|
||||
<el-button v-hasPerm="['generator:demo:filter']" type="default" icon="operation" circle/>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item v-for="column in tableColumns" :key="column.prop"
|
||||
:command="column">
|
||||
<el-dropdown-item v-for="column in tableColumns" :key="column.prop" :command="column">
|
||||
<el-checkbox v-model="column.show">
|
||||
{{ column.label }}
|
||||
</el-checkbox>
|
||||
@@ -101,63 +110,61 @@
|
||||
</template>
|
||||
</el-dropdown>
|
||||
</el-tooltip>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 表格区域:系统配置列表 -->
|
||||
<el-table ref="dataTableRef" v-loading="loading" :data="pageTableData" highlight-current-row
|
||||
class="data-table__content" height="450" border stripe @selection-change="handleSelectionChange">
|
||||
<el-table
|
||||
ref="dataTableRef"
|
||||
v-loading="loading"
|
||||
:data="pageTableData"
|
||||
highlight-current-row
|
||||
class="data-table__content"
|
||||
height="450"
|
||||
border
|
||||
stripe
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
<template #empty>
|
||||
<el-empty :image-size="80" description="暂无数据" />
|
||||
</template>
|
||||
<el-table-column v-if="tableColumns.find(col => col.prop === 'selection')?.show" type="selection"
|
||||
min-width="55" align="center" />
|
||||
<el-table-column v-if="tableColumns.find(col => col.prop === 'index')?.show" fixed label="序号"
|
||||
min-width="60">
|
||||
<el-table-column v-if="tableColumns.find(col => col.prop === 'selection')?.show" type="selection" min-width="55" align="center" />
|
||||
<el-table-column v-if="tableColumns.find(col => col.prop === 'index')?.show" fixed label="序号" min-width="60">
|
||||
<template #default="scope">
|
||||
{{ (queryFormData.page_no - 1) * queryFormData.page_size + scope.$index + 1 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column v-if="tableColumns.find(col => col.prop === 'name')?.show" label="名称"
|
||||
prop="name" min-width="140" />
|
||||
<el-table-column v-if="tableColumns.find(col => col.prop === 'status')?.show" label="状态" prop="status"
|
||||
min-width="80">
|
||||
<el-table-column v-if="tableColumns.find(col => col.prop === 'name')?.show" label="名称" prop="name" min-width="140" />
|
||||
<el-table-column v-if="tableColumns.find(col => col.prop === 'status')?.show" label="状态" prop="status" min-width="80">
|
||||
<template #default="scope">
|
||||
<el-tag :type="scope.row.status === true ? 'success' : 'danger'">
|
||||
{{ scope.row.status === true ? "启用" : "停用" }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column v-if="tableColumns.find(col => col.prop === 'description')?.show" label="描述"
|
||||
prop="description" min-width="140" />
|
||||
<el-table-column v-if="tableColumns.find(col => col.prop === 'created_at')?.show" label="创建时间"
|
||||
prop="created_at" min-width="180" sortable />
|
||||
<el-table-column v-if="tableColumns.find(col => col.prop === 'updated_at')?.show" label="更新时间"
|
||||
prop="updated_at" min-width="180" sortable />
|
||||
<el-table-column v-if="tableColumns.find(col => col.prop === 'creator')?.show" key="creator" label="创建人"
|
||||
min-width="100">
|
||||
<el-table-column v-if="tableColumns.find(col => col.prop === 'description')?.show" label="描述" prop="description" min-width="140" />
|
||||
<el-table-column v-if="tableColumns.find(col => col.prop === 'created_at')?.show" label="创建时间" prop="created_at" min-width="180" sortable />
|
||||
<el-table-column v-if="tableColumns.find(col => col.prop === 'updated_at')?.show" label="更新时间" prop="updated_at" min-width="180" sortable />
|
||||
<el-table-column v-if="tableColumns.find(col => col.prop === 'creator')?.show" key="creator" label="创建人" min-width="100">
|
||||
<template #default="scope">
|
||||
{{ scope.row.creator?.name }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column v-if="tableColumns.find(col => col.prop === 'operation')?.show" fixed="right"
|
||||
label="操作" align="center" min-width="200">
|
||||
<el-table-column v-if="tableColumns.find(col => col.prop === 'operation')?.show" fixed="right" label="操作" align="center" min-width="200">
|
||||
<template #default="scope">
|
||||
<el-button type="info" size="small" link icon="document"
|
||||
@click="handleOpenDialog('detail', scope.row.id)" v-hasPerm="['generator:demo:detail']">详情</el-button>
|
||||
<el-button type="primary" size="small" link icon="edit"
|
||||
@click="handleOpenDialog('update', scope.row.id)" v-hasPerm="['generator:demo:update']">编辑</el-button>
|
||||
<el-button type="danger" size="small" link icon="delete"
|
||||
@click="handleDelete([scope.row.id])" v-hasPerm="['generator:demo:delete']">删除</el-button>
|
||||
<el-button v-hasPerm="['generator:demo:detail']" type="info" size="small" link icon="document" @click="handleOpenDialog('detail', scope.row.id)">详情</el-button>
|
||||
<el-button v-hasPerm="['generator:demo:update']" type="primary" size="small" link icon="edit" @click="handleOpenDialog('update', scope.row.id)">编辑</el-button>
|
||||
<el-button v-hasPerm="['generator:demo:delete']" type="danger" size="small" link icon="delete" @click="handleDelete([scope.row.id])">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<!-- 分页区域 -->
|
||||
<template #footer>
|
||||
<pagination v-model:total="total" v-model:page="queryFormData.page_no"
|
||||
v-model:limit="queryFormData.page_size" @pagination="loadingData" />
|
||||
<pagination v-model:total="total" v-model:page="queryFormData.page_no" v-model:limit="queryFormData.page_size" @pagination="loadingData" />
|
||||
</template>
|
||||
</el-card>
|
||||
|
||||
@@ -190,8 +197,7 @@
|
||||
</template>
|
||||
<!-- 新增、编辑表单 -->
|
||||
<template v-else>
|
||||
<el-form ref="dataFormRef" :model="formData" :rules="rules" label-suffix=":" label-width="auto"
|
||||
label-position="right">
|
||||
<el-form ref="dataFormRef" :model="formData" :rules="rules" label-suffix=":" label-width="auto" label-position="right">
|
||||
<el-form-item label="名称" prop="name">
|
||||
<el-input v-model="formData.name" placeholder="请输入名称" :maxlength="50" />
|
||||
</el-form-item>
|
||||
@@ -206,8 +212,7 @@
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="描述" prop="description">
|
||||
<el-input v-model="formData.description" :rows="4" :maxlength="100" show-word-limit
|
||||
type="textarea" placeholder="请输入描述" />
|
||||
<el-input v-model="formData.description" :rows="4" :maxlength="100" show-word-limit type="textarea" placeholder="请输入描述" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</template>
|
||||
@@ -216,8 +221,7 @@
|
||||
<div class="dialog-footer">
|
||||
<!-- 详情弹窗不需要确定按钮的提交逻辑 -->
|
||||
<el-button @click="handleCloseDialog">取消</el-button>
|
||||
<el-button v-if="dialogVisible.type !== 'detail'" type="primary"
|
||||
@click="handleSubmit" v-hasPerm="['generator:demo:submit']">确定</el-button>
|
||||
<el-button v-if="dialogVisible.type !== 'detail'" v-hasPerm="['generator:demo:create']" type="primary" @click="handleSubmit">确定</el-button>
|
||||
<el-button v-else type="primary" @click="handleCloseDialog">确定</el-button>
|
||||
</div>
|
||||
</template>
|
||||
@@ -400,7 +404,7 @@ async function handleOpenDialog(type: 'create' | 'update' | 'detail', id?: numbe
|
||||
Object.assign(formData, response.data.data);
|
||||
}
|
||||
} else {
|
||||
dialogVisible.title = "新增公告通知";
|
||||
dialogVisible.title = "新增示例";
|
||||
formData.id = undefined;
|
||||
}
|
||||
dialogVisible.visible = true;
|
||||
|
||||
@@ -29,12 +29,11 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, computed, onMounted, watch } from 'vue';
|
||||
import { ElMessage, ElMessageBox } from 'element-plus';
|
||||
import { ElMessage } from 'element-plus';
|
||||
import Palette from './components/Palette.vue';
|
||||
import Canvas from './components/Canvas.vue';
|
||||
import Inspector from './components/Inspector.vue';
|
||||
import { ComponentSchema, PageSchema, generateId } from './utils/schema';
|
||||
import { generateVueFile, exportAsFile, copyToClipboard } from './utils/serializer';
|
||||
import { ComponentSchema } from './utils/schema';
|
||||
|
||||
// 响应式数据
|
||||
const components = ref<ComponentSchema[]>([]);
|
||||
|
||||
+7
-8
@@ -124,7 +124,7 @@
|
||||
</el-tooltip>
|
||||
</div>
|
||||
<div>
|
||||
<el-button type="primary" link icon="RefreshRight" @click="refreshCacheNames" v-hasPerm="['monitor:cache:refresh']" />
|
||||
<el-button v-hasPerm="['monitor:cache:refresh']" type="primary" link icon="RefreshRight" @click="refreshCacheNames"/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -134,7 +134,7 @@
|
||||
</template>
|
||||
<el-table-column prop="cache_name" label="缓存名称" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<el-button type="primary" link @click="getCacheKeyList(row)" v-hasPerm="['monitor:cache:view']">{{ row.cache_name }}</el-button>
|
||||
<el-button v-hasPerm="['monitor:cache:view']" type="primary" link @click="getCacheKeyList(row)">{{ row.cache_name }}</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="remark" label="备注" show-overflow-tooltip />
|
||||
@@ -142,7 +142,7 @@
|
||||
<template #default="{ row }">
|
||||
<el-popconfirm class="box-item" :title="`确认删除缓存 ${row.cache_name} 吗?`" placement="top" @confirm="handleClearCacheName(row)">
|
||||
<template #reference>
|
||||
<el-button type="danger" size="small" link icon="delete" v-hasPerm="['monitor:cache:delete']" />
|
||||
<el-button v-hasPerm="['monitor:cache:delete']" type="danger" size="small" link icon="delete"/>
|
||||
</template>
|
||||
</el-popconfirm>
|
||||
</template>
|
||||
@@ -168,7 +168,7 @@
|
||||
</el-tooltip>
|
||||
</div>
|
||||
<div>
|
||||
<el-button type="primary" link icon="RefreshRight" @click="refreshCacheKeys" v-hasPerm="['monitor:cache:refresh']" />
|
||||
<el-button v-hasPerm="['monitor:cache:refresh']" type="primary" link icon="RefreshRight" @click="refreshCacheKeys"/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -178,15 +178,14 @@
|
||||
</template>
|
||||
<el-table-column prop="cacheKey" label="缓存键名" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<el-button type="primary" link @click="handleCacheValue(row.cacheKey)" v-hasPerm="['monitor:cache:detail']">{{ row.cacheKey
|
||||
}}</el-button>
|
||||
<el-button v-hasPerm="['monitor:cache:detail']" type="primary" link @click="handleCacheValue(row.cacheKey)">{{ row.cacheKey}}</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="60" align="center">
|
||||
<template #default="{ row }">
|
||||
<el-popconfirm class="box-item" :title="`确认删除键 ${row.cacheKey} 吗?`" placement="top" @confirm="handleClearCacheKey(row.cacheKey)">
|
||||
<template #reference>
|
||||
<el-button type="danger" size="small" link icon="delete" v-hasPerm="['monitor:cache:delete']" />
|
||||
<el-button v-hasPerm="['monitor:cache:delete']" type="danger" size="small" link icon="delete"/>
|
||||
</template>
|
||||
</el-popconfirm>
|
||||
</template>
|
||||
@@ -212,7 +211,7 @@
|
||||
</el-tooltip>
|
||||
</div>
|
||||
<div>
|
||||
<el-button type="danger" link icon="delete" @click="handleClearCacheAll" v-hasPerm="['monitor:cache:delete_all']">清理全部</el-button>
|
||||
<el-button v-hasPerm="['monitor:cache:delete_all']" type="danger" link icon="delete" @click="handleClearCacheAll">清理全部</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -15,8 +15,8 @@
|
||||
</el-form-item>
|
||||
<!-- 查询、重置、展开/收起按钮 -->
|
||||
<el-form-item class="search-buttons">
|
||||
<el-button type="primary" icon="search" @click="handleQuery" v-hasPerm="['monitor:online:query']">查询</el-button>
|
||||
<el-button icon="refresh" @click="handleResetQuery" v-hasPerm="['monitor:online:query']">重置</el-button>
|
||||
<el-button v-hasPerm="['monitor:online:query']" type="primary" icon="search" @click="handleQuery">查询</el-button>
|
||||
<el-button v-hasPerm="['monitor:online:query']" icon="refresh" @click="handleResetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
@@ -37,14 +37,22 @@
|
||||
<!-- 功能区域 -->
|
||||
<div class="data-table__toolbar">
|
||||
<div class="data-table__toolbar--actions">
|
||||
<el-button type="danger" icon="delete" @click="handleClear" v-hasPerm="['monitor:online:force_logout']">强退所有</el-button>
|
||||
<el-row :gutter="10">
|
||||
<el-col :span="1.5">
|
||||
<el-button v-hasPerm="['monitor:online:force_logout']" type="danger" icon="delete" @click="handleClear">强退所有</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
<div class="data-table__toolbar--tools">
|
||||
<el-row :gutter="10">
|
||||
<el-col :span="1.5">
|
||||
<el-tooltip content="刷新">
|
||||
<el-button type="primary" icon="refresh" circle @click="handleRefresh" v-hasPerm="['monitor:online:refresh']" />
|
||||
<el-button v-hasPerm="['monitor:online:refresh']" type="primary" icon="refresh" circle @click="handleRefresh"/>
|
||||
</el-tooltip>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-tooltip content="列表筛选">
|
||||
<el-dropdown trigger="click" v-hasPerm="['monitor:online:filter']">
|
||||
<el-dropdown v-hasPerm="['monitor:online:filter']" trigger="click">
|
||||
<el-button type="default" icon="operation" circle />
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
@@ -55,6 +63,8 @@
|
||||
</template>
|
||||
</el-dropdown>
|
||||
</el-tooltip>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -81,7 +91,7 @@
|
||||
<el-table-column v-if="tableColumns.find(col => col.prop === 'login_time')?.show" key="login_time" label="登录时间" prop="login_time" min-width="180" />
|
||||
<el-table-column v-if="tableColumns.find(col => col.prop === 'operation')?.show" key="operation" fixed="right" label="操作" min-width="100">
|
||||
<template #default="scope">
|
||||
<el-button type="danger" size="small" link icon="delete" @click="handleSubmit(scope.row.session_id)" v-hasPerm="['monitor:online:force_logout']">强退
|
||||
<el-button v-hasPerm="['monitor:online:force_logout']" type="danger" size="small" link icon="delete" @click="handleSubmit(scope.row.session_id)">强退
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
<el-input v-model="queryFormData.name" placeholder="请输入文件名或目录名" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item class="search-buttons">
|
||||
<el-button type="primary" icon="search" @click="handleQuery" v-hasPerm="['monitor:resource:query']">查询</el-button>
|
||||
<el-button icon="refresh" @click="handleResetQuery" v-hasPerm="['monitor:resource:query']">重置</el-button>
|
||||
<el-button v-hasPerm="['monitor:resource:query']" type="primary" icon="search" @click="handleQuery">查询</el-button>
|
||||
<el-button v-hasPerm="['monitor:resource:query']" icon="refresh" @click="handleResetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
@@ -29,33 +29,49 @@
|
||||
<!-- 功能区域 -->
|
||||
<div class="data-table__toolbar">
|
||||
<div class="data-table__toolbar--actions">
|
||||
<el-button type="success" icon="plus" @click="handleUpload" v-hasPerm="['monitor:resource:upload']">上传文件</el-button>
|
||||
<el-button type="primary" icon="folder-add" @click="handleCreateDir" v-hasPerm="['monitor:resource:create_dir']">新建文件夹</el-button>
|
||||
<el-button type="danger" icon="delete" :disabled="selectedItems.length === 0" @click="handleBatchDelete" v-hasPerm="['monitor:resource:delete']">批量删除</el-button>
|
||||
<el-row :gutter="10">
|
||||
<el-col :span="1.5">
|
||||
<el-button v-hasPerm="['monitor:resource:upload']" type="success" icon="plus" @click="handleUpload">上传文件</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button v-hasPerm="['monitor:resource:create_dir']" type="primary" icon="folder-add" @click="handleCreateDir">新建文件夹</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button v-hasPerm="['monitor:resource:delete']" type="danger" icon="delete" :disabled="selectedItems.length === 0" @click="handleBatchDelete">批量删除</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
<div class="data-table__toolbar--tools">
|
||||
<el-checkbox v-model="showHiddenFiles" @change="handleShowHiddenChange" v-hasPerm="['monitor:resource:show_hidden']">
|
||||
<el-row :gutter="10">
|
||||
<el-col :span="1.5">
|
||||
<el-checkbox v-model="showHiddenFiles" v-hasPerm="['monitor:resource:show_hidden']" @change="handleShowHiddenChange">
|
||||
显示隐藏文件
|
||||
</el-checkbox>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button-group>
|
||||
<el-button
|
||||
v-hasPerm="['monitor:resource:view_list']"
|
||||
:type="viewMode === 'list' ? 'primary' : ''"
|
||||
@click="viewMode = 'list'"
|
||||
v-hasPerm="['monitor:resource:view_list']"
|
||||
>
|
||||
<el-icon><List /></el-icon>
|
||||
</el-button>
|
||||
<el-button
|
||||
v-hasPerm="['monitor:resource:view_grid']"
|
||||
:type="viewMode === 'grid' ? 'primary' : ''"
|
||||
@click="viewMode = 'grid'"
|
||||
v-hasPerm="['monitor:resource:view_grid']"
|
||||
>
|
||||
<el-icon><Grid /></el-icon>
|
||||
</el-button>
|
||||
</el-button-group>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-tooltip content="刷新">
|
||||
<el-button type="primary" icon="refresh" circle @click="handleRefresh" v-hasPerm="['monitor:resource:refresh']" />
|
||||
<el-button v-hasPerm="['monitor:resource:refresh']" type="primary" icon="refresh" circle @click="handleRefresh"/>
|
||||
</el-tooltip>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -107,9 +123,9 @@
|
||||
<Document v-else />
|
||||
</el-icon>
|
||||
<span
|
||||
v-hasPerm="['monitor:resource:preview']"
|
||||
:class="{ 'file-name-clickable': true }"
|
||||
@click="handleFileNameClick(row)"
|
||||
v-hasPerm="['monitor:resource:preview']"
|
||||
>
|
||||
{{ row.name }}
|
||||
</span>
|
||||
@@ -131,19 +147,19 @@
|
||||
<template #default="{ row }">
|
||||
<el-button
|
||||
v-if="!row.is_dir"
|
||||
v-hasPerm="['monitor:resource:download']"
|
||||
type="success"
|
||||
size="small"
|
||||
link
|
||||
icon="download"
|
||||
@click="handleDownload(row)"
|
||||
v-hasPerm="['monitor:resource:download']"
|
||||
>
|
||||
下载
|
||||
</el-button>
|
||||
<el-button type="primary" size="small" link icon="edit" @click="handleRename(row)" v-hasPerm="['monitor:resource:rename']">
|
||||
<el-button v-hasPerm="['monitor:resource:rename']" type="primary" size="small" link icon="edit" @click="handleRename(row)">
|
||||
重命名
|
||||
</el-button>
|
||||
<el-button type="danger" size="small" link icon="delete" @click="handleDelete(row)" v-hasPerm="['monitor:resource:delete']">
|
||||
<el-button v-hasPerm="['monitor:resource:delete']" type="danger" size="small" link icon="delete" @click="handleDelete(row)">
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
@@ -211,7 +227,7 @@
|
||||
</el-upload>
|
||||
<template #footer>
|
||||
<el-button @click="uploadDialogVisible = false">取消</el-button>
|
||||
<el-button type="primary" :loading="uploading" @click="handleUploadConfirm" v-hasPerm="['monitor:resource:upload']">
|
||||
<el-button v-hasPerm="['monitor:resource:upload']" type="primary" :loading="uploading" @click="handleUploadConfirm">
|
||||
确定上传
|
||||
</el-button>
|
||||
</template>
|
||||
@@ -234,7 +250,7 @@
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="createDirDialogVisible = false">取消</el-button>
|
||||
<el-button type="primary" @click="handleCreateDirConfirm" v-hasPerm="['monitor:resource:create_dir']">确定</el-button>
|
||||
<el-button v-hasPerm="['monitor:resource:create_dir']" type="primary" @click="handleCreateDirConfirm">确定</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
@@ -255,7 +271,7 @@
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="renameDialogVisible = false">取消</el-button>
|
||||
<el-button type="primary" @click="handleRenameConfirm" v-hasPerm="['monitor:resource:rename']">确定</el-button>
|
||||
<el-button v-hasPerm="['monitor:resource:rename']" type="primary" @click="handleRenameConfirm">确定</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
|
||||
@@ -22,8 +22,8 @@
|
||||
</el-form-item>
|
||||
<!-- 查询、重置、展开/收起按钮 -->
|
||||
<el-form-item class="search-buttons">
|
||||
<el-button type="primary" icon="search" @click="handleQuery" v-hasPerm="['system:dept:query']">查询</el-button>
|
||||
<el-button icon="refresh" @click="handleResetQuery" v-hasPerm="['system:dept:query']">重置</el-button>
|
||||
<el-button v-hasPerm="['system:dept:query']" type="primary" icon="search" @click="handleQuery">查询</el-button>
|
||||
<el-button v-hasPerm="['system:dept:query']" icon="refresh" @click="handleResetQuery">重置</el-button>
|
||||
<!-- 展开/收起 -->
|
||||
<template v-if="isExpandable">
|
||||
<el-link class="ml-3" type="primary" underline="never" @click="isExpand = !isExpand">
|
||||
@@ -58,8 +58,14 @@
|
||||
<!-- 功能区域 -->
|
||||
<div class="data-table__toolbar">
|
||||
<div class="data-table__toolbar--actions">
|
||||
<el-row :gutter="10">
|
||||
<el-col :span="1.5">
|
||||
<el-button v-hasPerm="['system:dept:create']" type="success" icon="plus" @click="handleOpenDialog('create')">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button v-hasPerm="['system:dept:delete']" type="danger" icon="delete" :disabled="selectIds.length === 0" @click="handleDelete(selectIds)">批量删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-dropdown v-hasPerm="['system:dept:patch']" trigger="click">
|
||||
<el-button type="default" :disabled="selectIds.length === 0" icon="ArrowDown">更多</el-button>
|
||||
<template #dropdown>
|
||||
@@ -69,13 +75,19 @@
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
<div class="data-table__toolbar--tools">
|
||||
<el-row :gutter="10">
|
||||
<el-col :span="1.5">
|
||||
<el-tooltip content="刷新">
|
||||
<el-button type="primary" icon="refresh" circle @click="handleRefresh" v-hasPerm="['system:dept:refresh']" />
|
||||
<el-button v-hasPerm="['system:dept:refresh']" type="primary" icon="refresh" circle @click="handleRefresh"/>
|
||||
</el-tooltip>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-tooltip content="列表筛选">
|
||||
<el-dropdown trigger="click" v-hasPerm="['system:dept:filter']">
|
||||
<el-dropdown v-hasPerm="['system:dept:filter']" trigger="click">
|
||||
<el-button type="default" icon="operation" circle />
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
@@ -86,6 +98,8 @@
|
||||
</template>
|
||||
</el-dropdown>
|
||||
</el-tooltip>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -113,7 +127,7 @@
|
||||
<el-table-column v-if="tableColumns.find(col => col.prop === 'operation')?.show" fixed="right" label="操作" align="center" min-width="200">
|
||||
<template #default="scope">
|
||||
<el-button v-hasPerm="['system:dept:create']" type="success" size="small" link icon="plus" @click="handleOpenDialog('create', undefined, scope.row.id)">新增</el-button>
|
||||
<el-button type="info" size="small" link icon="document" @click="handleOpenDialog('detail', scope.row.id)" v-hasPerm="['system:dept:detail']">详情</el-button>
|
||||
<el-button v-hasPerm="['system:dept:detail']" type="info" size="small" link icon="document" @click="handleOpenDialog('detail', scope.row.id)">详情</el-button>
|
||||
<el-button v-hasPerm="['system:dept:update']" type="primary" size="small" link icon="edit" @click="handleOpenDialog('update', scope.row.id)">编辑</el-button>
|
||||
<el-button v-hasPerm="['system:dept:delete']" type="danger" size="small" link icon="delete" @click="handleDelete([scope.row.id])">删除</el-button>
|
||||
</template>
|
||||
@@ -172,8 +186,8 @@
|
||||
<div class="dialog-footer">
|
||||
<!-- 详情弹窗不需要确定按钮的提交逻辑 -->
|
||||
<el-button @click="handleCloseDialog">取消</el-button>
|
||||
<el-button v-if="dialogVisible.type !== 'detail'" type="primary" @click="handleSubmit" v-hasPerm="['system:dept:submit']">确定</el-button>
|
||||
<el-button v-else type="primary" @click="handleCloseDialog" v-hasPerm="['system:dept:detail']">确定</el-button>
|
||||
<el-button v-if="dialogVisible.type !== 'detail'" v-hasPerm="['system:dept:submit']" type="primary" @click="handleSubmit">确定</el-button>
|
||||
<el-button v-else v-hasPerm="['system:dept:detail']" type="primary" @click="handleCloseDialog">确定</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
@@ -59,9 +59,15 @@
|
||||
<!-- 功能区域 -->
|
||||
<div class="data-table__toolbar">
|
||||
<div class="data-table__toolbar--actions">
|
||||
<el-button type="success" icon="plus" @click="handleOpenDialog('create')" v-hasPerm="['system:dict_data:create']">新增</el-button>
|
||||
<el-button type="danger" icon="delete" :disabled="selectIds.length === 0" @click="handleDelete(selectIds)" v-hasPerm="['system:dict_data:delete']">批量删除</el-button>
|
||||
<el-dropdown trigger="click" v-hasPerm="['system:dict_data:patch']">
|
||||
<el-row :gutter="10">
|
||||
<el-col :span="1.5">
|
||||
<el-button v-hasPerm="['system:dict_data:create']" type="success" icon="plus" @click="handleOpenDialog('create')">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button v-hasPerm="['system:dict_data:delete']" type="danger" icon="delete" :disabled="selectIds.length === 0" @click="handleDelete(selectIds)">批量删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-dropdown v-hasPerm="['system:dict_data:patch']" trigger="click">
|
||||
<el-button type="default" :disabled="selectIds.length === 0" icon="ArrowDown">更多</el-button>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
@@ -70,14 +76,22 @@
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
<div class="data-table__toolbar--tools">
|
||||
<el-row :gutter="10">
|
||||
<el-col :span="1.5">
|
||||
<el-tooltip content="导出">
|
||||
<el-button type="warning" icon="download" circle @click="handleExport" v-hasPerm="['system:dict_data:export']" />
|
||||
<el-button v-hasPerm="['system:dict_data:export']" type="warning" icon="download" circle @click="handleExport"/>
|
||||
</el-tooltip>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-tooltip content="刷新">
|
||||
<el-button type="default" icon="refresh" circle @click="handleRefresh" />
|
||||
</el-tooltip>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -126,8 +140,8 @@
|
||||
<el-table-column fixed="right" label="操作" align="center" min-width="200">
|
||||
<template #default="scope">
|
||||
<el-button type="info" size="small" link icon="document" @click="handleOpenDialog('detail', scope.row.id)">详情</el-button>
|
||||
<el-button type="primary" size="small" link icon="edit" @click="handleOpenDialog('update', scope.row.id)" v-hasPerm="['system:dict_data:update']">编辑</el-button>
|
||||
<el-button type="danger" size="small" link icon="delete" @click="handleDelete([scope.row.id])" v-hasPerm="['system:dict_data:delete']">删除</el-button>
|
||||
<el-button v-hasPerm="['system:dict_data:update']" type="primary" size="small" link icon="edit" @click="handleOpenDialog('update', scope.row.id)">编辑</el-button>
|
||||
<el-button v-hasPerm="['system:dict_data:delete']" type="danger" size="small" link icon="delete" @click="handleDelete([scope.row.id])">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
</el-form-item>
|
||||
<!-- 查询、重置、展开/收起按钮 -->
|
||||
<el-form-item class="search-buttons">
|
||||
<el-button type="primary" icon="search" @click="handleQuery" v-hasPerm="['system:dict_type:query']">查询</el-button>
|
||||
<el-button icon="refresh" @click="handleResetQuery" v-hasPerm="['system:dict_type:query']">重置</el-button>
|
||||
<el-button v-hasPerm="['system:dict_type:query']" type="primary" icon="search" @click="handleQuery">查询</el-button>
|
||||
<el-button v-hasPerm="['system:dict_type:query']" icon="refresh" @click="handleResetQuery">重置</el-button>
|
||||
<!-- 展开/收起 -->
|
||||
<template v-if="isExpandable">
|
||||
<el-link class="ml-3" type="primary" underline="never" @click="isExpand = !isExpand">
|
||||
@@ -61,9 +61,15 @@
|
||||
<!-- 功能区域 -->
|
||||
<div class="data-table__toolbar">
|
||||
<div class="data-table__toolbar--actions">
|
||||
<el-button type="success" icon="plus" @click="handleOpenDialog('create')" v-hasPerm="['system:dict_type:create']">新增</el-button>
|
||||
<el-button type="danger" icon="delete" :disabled="selectIds.length === 0" @click="handleDelete(selectIds)" v-hasPerm="['system:dict_type:delete']">批量删除</el-button>
|
||||
<el-dropdown trigger="click" v-hasPerm="['system:dict_type:patch']">
|
||||
<el-row :gutter="10">
|
||||
<el-col :span="1.5">
|
||||
<el-button v-hasPerm="['system:dict_type:create']" type="success" icon="plus" @click="handleOpenDialog('create')">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button v-hasPerm="['system:dict_type:delete']" type="danger" icon="delete" :disabled="selectIds.length === 0" @click="handleDelete(selectIds)">批量删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-dropdown v-hasPerm="['system:dict_type:patch']" trigger="click">
|
||||
<el-button type="default" :disabled="selectIds.length === 0" icon="ArrowDown">
|
||||
更多
|
||||
</el-button>
|
||||
@@ -74,16 +80,24 @@
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
<div class="data-table__toolbar--tools">
|
||||
<el-row :gutter="10">
|
||||
<el-col :span="1.5">
|
||||
<el-tooltip content="导出">
|
||||
<el-button type="warning" icon="download" circle @click="handleExport" v-hasPerm="['system:dict_type:export']" />
|
||||
<el-button v-hasPerm="['system:dict_type:export']" type="warning" icon="download" circle @click="handleExport"/>
|
||||
</el-tooltip>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-tooltip content="刷新">
|
||||
<el-button type="primary" icon="refresh" circle @click="handleRefresh" v-hasPerm="['system:dict_type:refresh']" />
|
||||
<el-button v-hasPerm="['system:dict_type:refresh']" type="primary" icon="refresh" circle @click="handleRefresh"/>
|
||||
</el-tooltip>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-tooltip content="列表筛选">
|
||||
<el-dropdown trigger="click" v-hasPerm="['system:dict_type:filter']">
|
||||
<el-dropdown v-hasPerm="['system:dict_type:filter']" trigger="click">
|
||||
<el-button type="default" icon="operation" circle />
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
@@ -94,6 +108,8 @@
|
||||
</template>
|
||||
</el-dropdown>
|
||||
</el-tooltip>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -131,10 +147,10 @@
|
||||
</el-table-column>
|
||||
<el-table-column v-if="tableColumns.find(col => col.prop === 'operation')?.show" fixed="right" label="操作" align="center" min-width="260">
|
||||
<template #default="scope">
|
||||
<el-button type="warning" size="small" link icon="document" @click="handleDictDataDrawer(scope.row.dict_type, scope.row.dict_name)" v-hasPerm="['system:dict_data:query']">字典</el-button>
|
||||
<el-button type="info" size="small" link icon="document" @click="handleOpenDialog('detail', scope.row.id)" v-hasPerm="['system:dict_type:detail']">详情</el-button>
|
||||
<el-button type="primary" size="small" link icon="edit" @click="handleOpenDialog('update', scope.row.id)" v-hasPerm="['system:dict_type:update']">编辑</el-button>
|
||||
<el-button type="danger" size="small" link icon="delete" @click="handleDelete([scope.row.id])" v-hasPerm="['system:dict_type:delete']">删除</el-button>
|
||||
<el-button v-hasPerm="['system:dict_data:query']" type="warning" size="small" link icon="document" @click="handleDictDataDrawer(scope.row.dict_type, scope.row.dict_name)">字典</el-button>
|
||||
<el-button v-hasPerm="['system:dict_type:detail']" type="info" size="small" link icon="document" @click="handleOpenDialog('detail', scope.row.id)">详情</el-button>
|
||||
<el-button v-hasPerm="['system:dict_type:update']" type="primary" size="small" link icon="edit" @click="handleOpenDialog('update', scope.row.id)">编辑</el-button>
|
||||
<el-button v-hasPerm="['system:dict_type:delete']" type="danger" size="small" link icon="delete" @click="handleDelete([scope.row.id])">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -189,8 +205,8 @@
|
||||
<div class="dialog-footer">
|
||||
<!-- 详情弹窗不需要确定按钮的提交逻辑 -->
|
||||
<el-button @click="handleCloseDialog">取消</el-button>
|
||||
<el-button v-if="dialogVisible.type !== 'detail'" type="primary" @click="handleSubmit" v-hasPerm="['system:dict_type:submit']">确定</el-button>
|
||||
<el-button v-else type="primary" @click="handleCloseDialog" v-hasPerm="['system:dict_type:detail']">确定</el-button>
|
||||
<el-button v-if="dialogVisible.type !== 'detail'" v-hasPerm="['system:dict_type:submit']" type="primary" @click="handleSubmit">确定</el-button>
|
||||
<el-button v-else v-hasPerm="['system:dict_type:detail']" type="primary" @click="handleCloseDialog">确定</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
</el-form-item>
|
||||
<!-- 查询、重置、展开/收起按钮 -->
|
||||
<el-form-item class="search-buttons">
|
||||
<el-button type="primary" icon="search" @click="handleQuery" v-hasPerm="['system:log:query']">查询</el-button>
|
||||
<el-button icon="refresh" @click="handleResetQuery" v-hasPerm="['system:log:query']">重置</el-button>
|
||||
<el-button v-hasPerm="['system:log:query']" type="primary" icon="search" @click="handleQuery">查询</el-button>
|
||||
<el-button v-hasPerm="['system:log:query']" icon="refresh" @click="handleResetQuery">重置</el-button>
|
||||
<!-- 展开/收起 -->
|
||||
<template v-if="isExpandable">
|
||||
<el-link class="ml-3" type="primary" underline="never" @click="isExpand = !isExpand">
|
||||
@@ -61,15 +61,25 @@
|
||||
<!-- 功能区域 -->
|
||||
<div class="data-table__toolbar">
|
||||
<div class="data-table__toolbar--actions">
|
||||
<el-button type="danger" icon="delete" :disabled="selectIds.length === 0" @click="handleDelete(selectIds)" v-hasPerm="['system:log:delete']">批量删除</el-button>
|
||||
<el-row :gutter="10">
|
||||
<el-col :span="1.5">
|
||||
<el-button v-hasPerm="['system:log:delete']" type="danger" icon="delete" :disabled="selectIds.length === 0" @click="handleDelete(selectIds)">批量删除</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
<div class="data-table__toolbar--tools">
|
||||
<el-row :gutter="10">
|
||||
<el-col :span="1.5">
|
||||
<el-tooltip content="导出">
|
||||
<el-button type="warning" icon="download" circle @click="handleExport" v-hasPerm="['system:log:export']" />
|
||||
<el-button v-hasPerm="['system:log:export']" type="warning" icon="download" circle @click="handleExport"/>
|
||||
</el-tooltip>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-tooltip content="刷新">
|
||||
<el-button type="default" icon="refresh" circle @click="handleRefresh" v-hasPerm="['system:log:refresh']" />
|
||||
<el-button v-hasPerm="['system:log:refresh']" type="default" icon="refresh" circle @click="handleRefresh"/>
|
||||
</el-tooltip>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -124,8 +134,8 @@
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" fixed="right" align="center" min-width="150">
|
||||
<template #default="scope">
|
||||
<el-button type="info" size="small" link icon="document" @click="handleOpenDialog('detail', scope.row.id)" v-hasPerm="['system:log:detail']">详情</el-button>
|
||||
<el-button type="danger" size="small" link icon="delete" @click="handleDelete([scope.row.id])" v-hasPerm="['system:log:delete']">删除</el-button>
|
||||
<el-button v-hasPerm="['system:log:detail']" type="info" size="small" link icon="document" @click="handleOpenDialog('detail', scope.row.id)">详情</el-button>
|
||||
<el-button v-hasPerm="['system:log:delete']" type="danger" size="small" link icon="delete" @click="handleDelete([scope.row.id])">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -179,7 +189,7 @@
|
||||
<div class="dialog-footer">
|
||||
<!-- 详情弹窗不需要确定按钮的提交逻辑 -->
|
||||
<el-button @click="handleCloseDialog">取消</el-button>
|
||||
<el-button type="primary" @click="handleCloseDialog" v-hasPerm="['system:log:detail']">确定</el-button>
|
||||
<el-button v-hasPerm="['system:log:detail']" type="primary" @click="handleCloseDialog">确定</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
@@ -22,8 +22,8 @@
|
||||
</el-form-item>
|
||||
<!-- 查询、重置、展开/收起按钮 -->
|
||||
<el-form-item class="search-buttons">
|
||||
<el-button type="primary" icon="search" @click="handleQuery" v-hasPerm="['system:menu:query']">查询</el-button>
|
||||
<el-button icon="refresh" @click="handleResetQuery" v-hasPerm="['system:menu:query']">重置</el-button>
|
||||
<el-button v-hasPerm="['system:menu:query']" type="primary" icon="search" @click="handleQuery">查询</el-button>
|
||||
<el-button v-hasPerm="['system:menu:query']" icon="refresh" @click="handleResetQuery">重置</el-button>
|
||||
<!-- 展开/收起 -->
|
||||
<template v-if="isExpandable">
|
||||
<el-link class="ml-3" type="primary" underline="never" @click="isExpand = !isExpand">
|
||||
@@ -58,9 +58,15 @@
|
||||
<!-- 功能区域 -->
|
||||
<div class="data-table__toolbar">
|
||||
<div class="data-table__toolbar--actions">
|
||||
<el-button type="success" icon="plus" @click="handleOpenDialog('create')" v-hasPerm="['system:menu:create']">新增</el-button>
|
||||
<el-button type="danger" icon="delete" :disabled="selectIds.length === 0" @click="handleDelete(selectIds)" v-hasPerm="['system:menu:delete']">批量删除</el-button>
|
||||
<el-dropdown trigger="click" v-hasPerm="['system:menu:patch']">
|
||||
<el-row :gutter="10">
|
||||
<el-col :span="1.5">
|
||||
<el-button v-hasPerm="['system:menu:create']" type="success" icon="plus" @click="handleOpenDialog('create')">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button v-hasPerm="['system:menu:delete']" type="danger" icon="delete" :disabled="selectIds.length === 0" @click="handleDelete(selectIds)">批量删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-dropdown v-hasPerm="['system:menu:patch']" trigger="click">
|
||||
<el-button type="default" :disabled="selectIds.length === 0" icon="ArrowDown">更多</el-button>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
@@ -69,11 +75,17 @@
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
<div class="data-table__toolbar--tools">
|
||||
<el-row :gutter="10">
|
||||
<el-col :span="1.5">
|
||||
<el-tooltip content="刷新">
|
||||
<el-button type="primary" icon="refresh" circle @click="handleRefresh" v-hasPerm="['system:menu:refresh']" />
|
||||
<el-button v-hasPerm="['system:menu:refresh']" type="primary" icon="refresh" circle @click="handleRefresh"/>
|
||||
</el-tooltip>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -154,10 +166,10 @@
|
||||
|
||||
<el-table-column fixed="right" label="操作" align="center" min-width="260">
|
||||
<template #default="scope">
|
||||
<el-button v-if="scope.row.type == MenuTypeEnum.CATALOG || scope.row.type == MenuTypeEnum.MENU" type="success" link size="small" icon="plus" @click.stop="handleOpenDialog('create', undefined, scope.row.id)" v-hasPerm="['system:menu:create']">新增</el-button>
|
||||
<el-button type="info" size="small" link icon="document" @click="handleOpenDialog('detail', scope.row.id)" v-hasPerm="['system:menu:detail']">详情</el-button>
|
||||
<el-button type="primary" size="small" link icon="edit" @click="handleOpenDialog('update', scope.row.id)" v-hasPerm="['system:menu:update']">编辑</el-button>
|
||||
<el-button type="danger" size="small" link icon="delete" @click="handleDelete([scope.row.id])" v-hasPerm="['system:menu:delete']">删除</el-button>
|
||||
<el-button v-if="scope.row.type == MenuTypeEnum.CATALOG || scope.row.type == MenuTypeEnum.MENU" v-hasPerm="['system:menu:create']" type="success" link size="small" icon="plus" @click.stop="handleOpenDialog('create', undefined, scope.row.id)">新增</el-button>
|
||||
<el-button v-hasPerm="['system:menu:detail']" type="info" size="small" link icon="document" @click="handleOpenDialog('detail', scope.row.id)">详情</el-button>
|
||||
<el-button v-hasPerm="['system:menu:update']" type="primary" size="small" link icon="edit" @click="handleOpenDialog('update', scope.row.id)">编辑</el-button>
|
||||
<el-button v-hasPerm="['system:menu:delete']" type="danger" size="small" link icon="delete" @click="handleDelete([scope.row.id])">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -452,8 +464,8 @@
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<!-- 详情弹窗不需要确定按钮的提交逻辑 -->
|
||||
<el-button v-if="dialogVisible.type !== 'detail'" type="primary" @click="handleSubmit" v-hasPerm="['system:menu:submit']">确定</el-button>
|
||||
<el-button v-else type="primary" @click="handleCloseDialog" v-hasPerm="['system:menu:detail']">确定</el-button>
|
||||
<el-button v-if="dialogVisible.type !== 'detail'" v-hasPerm="['system:menu:submit']" type="primary" @click="handleSubmit">确定</el-button>
|
||||
<el-button v-else v-hasPerm="['system:menu:detail']" type="primary" @click="handleCloseDialog">确定</el-button>
|
||||
<el-button @click="handleCloseDialog">取消</el-button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -32,10 +32,10 @@
|
||||
</el-form-item>
|
||||
<!-- 查询、重置、展开/收起按钮 -->
|
||||
<el-form-item class="search-buttons">
|
||||
<el-button type="primary" icon="search" @click="handleQuery" v-hasPerm="['system:notice:query']">
|
||||
<el-button v-hasPerm="['system:notice:query']" type="primary" icon="search" @click="handleQuery">
|
||||
查询
|
||||
</el-button>
|
||||
<el-button icon="refresh" @click="handleResetQuery" v-hasPerm="['system:notice:query']">
|
||||
<el-button v-hasPerm="['system:notice:query']" icon="refresh" @click="handleResetQuery">
|
||||
重置
|
||||
</el-button>
|
||||
<!-- 展开/收起 -->
|
||||
@@ -72,9 +72,15 @@
|
||||
<!-- 功能区域 -->
|
||||
<div class="data-table__toolbar">
|
||||
<div class="data-table__toolbar--actions">
|
||||
<el-button type="success" icon="plus" @click="handleOpenDialog('create')" v-hasPerm="['system:notice:create']">新增</el-button>
|
||||
<el-button type="danger" icon="delete" :disabled="selectIds.length === 0" @click="handleDelete(selectIds)" v-hasPerm="['system:notice:delete']">批量删除</el-button>
|
||||
<el-dropdown trigger="click" v-hasPerm="['system:notice:patch']">
|
||||
<el-row :gutter="10">
|
||||
<el-col :span="1.5">
|
||||
<el-button v-hasPerm="['system:notice:create']" type="success" icon="plus" @click="handleOpenDialog('create')">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button v-hasPerm="['system:notice:delete']" type="danger" icon="delete" :disabled="selectIds.length === 0" @click="handleDelete(selectIds)">批量删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-dropdown v-hasPerm="['system:notice:patch']" trigger="click">
|
||||
<el-button type="default" :disabled="selectIds.length === 0" icon="ArrowDown">更多</el-button>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
@@ -83,16 +89,24 @@
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
<div class="data-table__toolbar--tools">
|
||||
<el-row :gutter="10">
|
||||
<el-col :span="1.5">
|
||||
<el-tooltip content="导出">
|
||||
<el-button type="warning" icon="download" circle @click="handleExport" v-hasPerm="['system:notice:export']" />
|
||||
<el-button v-hasPerm="['system:notice:export']" type="warning" icon="download" circle @click="handleExport" />
|
||||
</el-tooltip>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-tooltip content="刷新">
|
||||
<el-button type="primary" icon="refresh" circle @click="handleRefresh" v-hasPerm="['system:notice:refresh']" />
|
||||
<el-button v-hasPerm="['system:notice:refresh']" type="primary" icon="refresh" circle @click="handleRefresh" />
|
||||
</el-tooltip>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-tooltip content="列表筛选">
|
||||
<el-dropdown trigger="click" v-hasPerm="['system:notice:filter']">
|
||||
<el-dropdown v-hasPerm="['system:notice:filter']" trigger="click">
|
||||
<el-button type="default" icon="operation" circle />
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
@@ -105,6 +119,8 @@
|
||||
</template>
|
||||
</el-dropdown>
|
||||
</el-tooltip>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -146,9 +162,9 @@
|
||||
|
||||
<el-table-column v-if="tableColumns.find(col => col.prop === 'operation')?.show" fixed="right" label="操作" align="center" min-width="200">
|
||||
<template #default="scope">
|
||||
<el-button type="info" size="small" link icon="document" @click="handleOpenDialog('detail', scope.row.id)" v-hasPerm="['system:notice:detail']">详情</el-button>
|
||||
<el-button type="primary" size="small" link icon="edit" @click="handleOpenDialog('update', scope.row.id)" v-hasPerm="['system:notice:update']">编辑</el-button>
|
||||
<el-button type="danger" size="small" link icon="delete" @click="handleDelete([scope.row.id])" v-hasPerm="['system:notice:delete']">删除</el-button>
|
||||
<el-button v-hasPerm="['system:notice:detail']" type="info" size="small" link icon="document" @click="handleOpenDialog('detail', scope.row.id)">详情</el-button>
|
||||
<el-button v-hasPerm="['system:notice:update']" type="primary" size="small" link icon="edit" @click="handleOpenDialog('update', scope.row.id)">编辑</el-button>
|
||||
<el-button v-hasPerm="['system:notice:delete']" type="danger" size="small" link icon="delete" @click="handleDelete([scope.row.id])">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -202,7 +218,8 @@
|
||||
</el-form-item>
|
||||
<el-form-item label="类型" prop="notice_type">
|
||||
<el-select v-model="formData.notice_type" placeholder="请选择类型" clearable>
|
||||
<el-option v-for="item in dictStore.getDictArray('sys_notice_type')"
|
||||
<el-option
|
||||
v-for="item in dictStore.getDictArray('sys_notice_type')"
|
||||
:key="item.dict_value"
|
||||
:value="item.dict_value"
|
||||
:label="item.dict_label"
|
||||
@@ -234,8 +251,8 @@
|
||||
<div class="dialog-footer">
|
||||
<!-- 详情弹窗不需要确定按钮的提交逻辑 -->
|
||||
<el-button @click="handleCloseDialog">取消</el-button>
|
||||
<el-button v-if="dialogVisible.type !== 'detail'" type="primary" @click="handleSubmit" v-hasPerm="['system:notice:submit']">确定</el-button>
|
||||
<el-button v-else type="primary" @click="handleCloseDialog" v-hasPerm="['system:notice:detail']">确定</el-button>
|
||||
<el-button v-if="dialogVisible.type !== 'detail'" v-hasPerm="['system:notice:submit']" type="primary" @click="handleSubmit">确定</el-button>
|
||||
<el-button v-else v-hasPerm="['system:notice:detail']" type="primary" @click="handleCloseDialog">确定</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
+1
-1
@@ -40,7 +40,7 @@
|
||||
<template #footer>
|
||||
<!-- 操作按钮 -->
|
||||
<el-button @click="resetForm">取消</el-button>
|
||||
<el-button type="primary" :disabled="!hasChanges" @click="submitChanges" v-hasPerm="['system:config:update']">保存</el-button>
|
||||
<el-button v-hasPerm="['system:config:update']" type="primary" :disabled="!hasChanges" @click="submitChanges">保存</el-button>
|
||||
</template>
|
||||
</el-drawer>
|
||||
</template>
|
||||
+27
-13
@@ -24,8 +24,8 @@
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item class="search-buttons">
|
||||
<el-button type="primary" icon="search" @click="handleQuery" v-hasPerm="['system:config:query']">查询</el-button>
|
||||
<el-button icon="refresh" @click="handleResetQuery" v-hasPerm="['system:config:query']">重置</el-button>
|
||||
<el-button v-hasPerm="['system:config:query']" type="primary" icon="search" @click="handleQuery">查询</el-button>
|
||||
<el-button v-hasPerm="['system:config:query']" icon="refresh" @click="handleResetQuery">重置</el-button>
|
||||
<!-- 展开/收起 -->
|
||||
<template v-if="isExpandable">
|
||||
<el-link class="ml-3" type="primary" underline="never" @click="isExpand = !isExpand">
|
||||
@@ -60,18 +60,30 @@
|
||||
<!-- 功能区域 -->
|
||||
<div class="data-table__toolbar">
|
||||
<div class="data-table__toolbar--actions">
|
||||
<el-button type="success" icon="plus" @click="handleOpenDialog('create')" v-hasPerm="['system:config:create']">新增</el-button>
|
||||
<el-button type="danger" icon="delete" :disabled="selectIds.length === 0" @click="handleDelete(selectIds)" v-hasPerm="['system:config:delete']">批量删除</el-button>
|
||||
<el-row :gutter="10">
|
||||
<el-col :span="1.5">
|
||||
<el-button v-hasPerm="['system:config:create']" type="success" icon="plus" @click="handleOpenDialog('create')">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button v-hasPerm="['system:config:delete']" type="danger" icon="delete" :disabled="selectIds.length === 0" @click="handleDelete(selectIds)">批量删除</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
<div class="data-table__toolbar--tools">
|
||||
<el-row :gutter="10">
|
||||
<el-col :span="1.5">
|
||||
<el-tooltip content="导出">
|
||||
<el-button type="warning" icon="download" circle @click="handleExport" v-hasPerm="['system:config:export']" />
|
||||
<el-button v-hasPerm="['system:config:export']" type="warning" icon="download" circle @click="handleExport"/>
|
||||
</el-tooltip>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-tooltip content="刷新">
|
||||
<el-button type="primary" icon="refresh" circle @click="handleRefresh" v-hasPerm="['system:config:refresh']" />
|
||||
<el-button v-hasPerm="['system:config:refresh']" type="primary" icon="refresh" circle @click="handleRefresh"/>
|
||||
</el-tooltip>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-tooltip content="列表筛选">
|
||||
<el-dropdown trigger="click" v-hasPerm="['system:config:filter']">
|
||||
<el-dropdown v-hasPerm="['system:config:filter']" trigger="click">
|
||||
<el-button type="default" icon="operation" circle />
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
@@ -82,6 +94,8 @@
|
||||
</template>
|
||||
</el-dropdown>
|
||||
</el-tooltip>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -115,9 +129,9 @@
|
||||
</el-table-column>
|
||||
<el-table-column v-if="tableColumns.find(col => col.prop === 'operation')?.show" fixed="right" label="操作" align="center" min-width="200">
|
||||
<template #default="scope">
|
||||
<el-button type="info" size="small" link icon="document" @click="handleOpenDialog('detail', scope.row.id)" v-hasPerm="['system:config:detail']">详情</el-button>
|
||||
<el-button type="primary" size="small" link icon="edit" @click="handleOpenDialog('update', scope.row.id)" v-hasPerm="['system:config:update']">编辑</el-button>
|
||||
<el-button type="danger" size="small" link icon="delete" @click="handleDelete([scope.row.id])" v-hasPerm="['system:config:delete']">删除</el-button>
|
||||
<el-button v-hasPerm="['system:config:detail']" type="info" size="small" link icon="document" @click="handleOpenDialog('detail', scope.row.id)">详情</el-button>
|
||||
<el-button v-hasPerm="['system:config:update']" type="primary" size="small" link icon="edit" @click="handleOpenDialog('update', scope.row.id)">编辑</el-button>
|
||||
<el-button v-hasPerm="['system:config:delete']" type="danger" size="small" link icon="delete" @click="handleDelete([scope.row.id])">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -174,8 +188,8 @@
|
||||
<div class="dialog-footer">
|
||||
<!-- 详情弹窗不需要确定按钮的提交逻辑 -->
|
||||
<el-button @click="handleCloseDialog">取消</el-button>
|
||||
<el-button v-if="dialogVisible.type !== 'detail'" type="primary" @click="handleSubmit" v-hasPerm="['system:config:submit']">确定</el-button>
|
||||
<el-button v-else type="primary" @click="handleCloseDialog" v-hasPerm="['system:config:detail']">确定</el-button>
|
||||
<el-button v-if="dialogVisible.type !== 'detail'" v-hasPerm="['system:config:create']" type="primary" @click="handleSubmit">确定</el-button>
|
||||
<el-button v-else v-hasPerm="['system:config:detail']" type="primary" @click="handleCloseDialog">确定</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
@@ -186,7 +200,7 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
defineOptions({
|
||||
name: "Config",
|
||||
name: "Params",
|
||||
inheritAttrs: false,
|
||||
});
|
||||
|
||||
@@ -22,8 +22,8 @@
|
||||
</el-form-item>
|
||||
<!-- 查询、重置、展开/收起按钮 -->
|
||||
<el-form-item class="search-buttons">
|
||||
<el-button type="primary" icon="search" @click="handleQuery" v-hasPerm="['system:position:query']">查询</el-button>
|
||||
<el-button icon="refresh" @click="handleResetQuery" v-hasPerm="['system:position:query']">重置</el-button>
|
||||
<el-button v-hasPerm="['system:position:query']" type="primary" icon="search" @click="handleQuery">查询</el-button>
|
||||
<el-button v-hasPerm="['system:position:query']" icon="refresh" @click="handleResetQuery">重置</el-button>
|
||||
<!-- 展开/收起 -->
|
||||
<template v-if="isExpandable">
|
||||
<el-link class="ml-3" type="primary" underline="never" @click="isExpand = !isExpand">
|
||||
@@ -58,9 +58,15 @@
|
||||
<!-- 功能区域 -->
|
||||
<div class="data-table__toolbar">
|
||||
<div class="data-table__toolbar--actions">
|
||||
<el-button type="success" icon="plus" @click="handleOpenDialog('create')" v-hasPerm="['system:position:create']">新增</el-button>
|
||||
<el-button type="danger" icon="delete" :disabled="selectIds.length === 0" @click="handleDelete(selectIds)" v-hasPerm="['system:position:delete']">批量删除</el-button>
|
||||
<el-dropdown trigger="click" v-hasPerm="['system:position:patch']">
|
||||
<el-row :gutter="10">
|
||||
<el-col :span="1.5">
|
||||
<el-button v-hasPerm="['system:position:create']" type="success" icon="plus" @click="handleOpenDialog('create')">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button v-hasPerm="['system:position:delete']" type="danger" icon="delete" :disabled="selectIds.length === 0" @click="handleDelete(selectIds)">批量删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-dropdown v-hasPerm="['system:position:patch']" trigger="click">
|
||||
<el-button type="default" :disabled="selectIds.length === 0" icon="ArrowDown">更多</el-button>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu v-hasPerm="['system:position:filter']">
|
||||
@@ -69,14 +75,22 @@
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
<div class="data-table__toolbar--tools">
|
||||
<el-row :gutter="10">
|
||||
<el-col :span="1.5">
|
||||
<el-tooltip content="导出">
|
||||
<el-button type="warning" icon="download" circle @click="handleExport" v-hasPerm="['system:position:export']" />
|
||||
<el-button v-hasPerm="['system:position:export']" type="warning" icon="download" circle @click="handleExport" />
|
||||
</el-tooltip>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-tooltip content="刷新">
|
||||
<el-button type="primary" icon="refresh" circle @click="handleRefresh" v-hasPerm="['system:position:refresh']" />
|
||||
<el-button v-hasPerm="['system:position:refresh']" type="primary" icon="refresh" circle @click="handleRefresh" />
|
||||
</el-tooltip>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-tooltip content="列表筛选">
|
||||
<el-dropdown trigger="click">
|
||||
<el-button type="default" icon="operation" circle />
|
||||
@@ -89,6 +103,8 @@
|
||||
</template>
|
||||
</el-dropdown>
|
||||
</el-tooltip>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -123,9 +139,9 @@
|
||||
|
||||
<el-table-column v-if="tableColumns.find(col => col.prop === 'operation')?.show" fixed="right" label="操作" align="center" min-width="200">
|
||||
<template #default="scope">
|
||||
<el-button type="info" size="small" link icon="document" @click="handleOpenDialog('detail', scope.row.id)" v-hasPerm="['system:position:detail']">详情</el-button>
|
||||
<el-button type="primary" size="small" link icon="edit" @click="handleOpenDialog('update', scope.row.id)" v-hasPerm="['system:position:update']">编辑</el-button>
|
||||
<el-button type="danger" size="small" link icon="delete" @click="handleDelete([scope.row.id])" v-hasPerm="['system:position:delete']">删除</el-button>
|
||||
<el-button v-hasPerm="['system:position:detail']" type="info" size="small" link icon="document" @click="handleOpenDialog('detail', scope.row.id)">详情</el-button>
|
||||
<el-button v-hasPerm="['system:position:update']" type="primary" size="small" link icon="edit" @click="handleOpenDialog('update', scope.row.id)">编辑</el-button>
|
||||
<el-button v-hasPerm="['system:position:delete']" type="danger" size="small" link icon="delete" @click="handleDelete([scope.row.id])">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -180,8 +196,8 @@
|
||||
<div class="dialog-footer">
|
||||
<!-- 详情弹窗不需要确定按钮的提交逻辑 -->
|
||||
<el-button @click="handleCloseDialog">取消</el-button>
|
||||
<el-button v-if="dialogVisible.type !== 'detail'" type="primary" @click="handleSubmit" v-hasPerm="['system:position:submit']">确定</el-button>
|
||||
<el-button v-else type="primary" @click="handleCloseDialog" v-hasPerm="['system:position:detail']">确定</el-button>
|
||||
<el-button v-if="dialogVisible.type !== 'detail'" v-hasPerm="['system:position:submit']" type="primary" @click="handleSubmit">确定</el-button>
|
||||
<el-button v-else v-hasPerm="['system:position:detail']" type="primary" @click="handleCloseDialog">确定</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<div class="mt-5 max-h-[60vh] b-1 b-solid b-[#e5e7eb] p-10px overflow-auto box-border" v-if="permissionState.data_scope === 5 && deptTreeData.length">
|
||||
<div v-if="permissionState.data_scope === 5 && deptTreeData.length" class="mt-5 max-h-[60vh] b-1 b-solid b-[#e5e7eb] p-10px overflow-auto box-border">
|
||||
<el-input v-model="deptFilterText" placeholder="部门名称" />
|
||||
<el-tree
|
||||
ref="deptTreeRef"
|
||||
@@ -46,8 +46,8 @@
|
||||
default-expand-all
|
||||
:highlight-current="true"
|
||||
:check-strictly="!parentChildLinked"
|
||||
@check="deptTreeCheck"
|
||||
style="height: calc(100% - 60px); overflow-y: auto; margin-top: 10px;"
|
||||
@check="deptTreeCheck"
|
||||
>
|
||||
<template #empty>
|
||||
<el-empty :image-size="80" description="暂无数据" />
|
||||
@@ -108,8 +108,9 @@
|
||||
default-expand-all
|
||||
:highlight-current="true"
|
||||
:check-strictly="!parentChildLinked"
|
||||
style="height: calc(100% - 60px); overflow: auto; margin-top: 10px;"
|
||||
@check="menuTreeCheck"
|
||||
style="height: calc(100% - 60px); overflow: auto; margin-top: 10px;">
|
||||
>
|
||||
<template #empty>
|
||||
<el-empty :image-size="80" description="暂无数据" />
|
||||
</template>
|
||||
@@ -188,11 +189,11 @@ const init = async () => {
|
||||
try {
|
||||
// 获取全部部门树
|
||||
const deptResponse = await DeptAPI.getDeptList();
|
||||
deptTreeData.value = formatTree(listToTree(deptResponse.data.data.items));
|
||||
deptTreeData.value = formatTree(listToTree(deptResponse.data.data));
|
||||
|
||||
// 获取全部菜单树
|
||||
const menuResponse = await MenuAPI.getMenuList();
|
||||
menuTreeData.value = formatTree(listToTree(menuResponse.data.data.items));
|
||||
menuTreeData.value = formatTree(listToTree(menuResponse.data.data));
|
||||
|
||||
// 获取角色详情
|
||||
const roleResponse = await RoleAPI.getRoleDetail(props.roleId);
|
||||
|
||||
@@ -22,8 +22,8 @@
|
||||
</el-form-item>
|
||||
<!-- 查询、重置、展开/收起按钮 -->
|
||||
<el-form-item class="search-buttons">
|
||||
<el-button type="primary" icon="search" @click="handleQuery" v-hasPerm="['system:role:query']">查询</el-button>
|
||||
<el-button icon="refresh" @click="handleResetQuery" v-hasPerm="['system:role:query']">重置</el-button>
|
||||
<el-button v-hasPerm="['system:role:query']" type="primary" icon="search" @click="handleQuery">查询</el-button>
|
||||
<el-button v-hasPerm="['system:role:query']" icon="refresh" @click="handleResetQuery">重置</el-button>
|
||||
<!-- 展开/收起 -->
|
||||
<template v-if="isExpandable">
|
||||
<el-link class="ml-3" type="primary" underline="never" @click="isExpand = !isExpand">
|
||||
@@ -58,6 +58,17 @@
|
||||
<!-- 功能区域 -->
|
||||
<div class="data-table__toolbar">
|
||||
<div class="data-table__toolbar--actions">
|
||||
<el-row :gutter="10">
|
||||
<el-col :span="1.5">
|
||||
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-button v-hasPerm="['system:role:create']" type="success" icon="plus" @click="handleOpenDialog('create')">新增</el-button>
|
||||
<el-button v-hasPerm="['system:role:delete']" type="danger" icon="delete" :disabled="selectIds.length === 0" @click="handleDelete(selectIds)">批量删除</el-button>
|
||||
<el-dropdown v-hasPerm="['system:role:patch']" trigger="click">
|
||||
@@ -73,12 +84,18 @@
|
||||
</el-dropdown>
|
||||
</div>
|
||||
<div class="data-table__toolbar--tools">
|
||||
<el-row :gutter="10">
|
||||
<el-col :span="1.5">
|
||||
<el-tooltip content="导出">
|
||||
<el-button type="warning" icon="download" circle @click="handleExport" v-hasPerm="['system:role:export']" />
|
||||
<el-button v-hasPerm="['system:role:export']" type="warning" icon="download" circle @click="handleExport" />
|
||||
</el-tooltip>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-tooltip content="刷新">
|
||||
<el-button type="primary" icon="refresh" circle @click="handleRefresh" v-hasPerm="['system:role:refresh']" />
|
||||
<el-button v-hasPerm="['system:role:refresh']" type="primary" icon="refresh" circle @click="handleRefresh" />
|
||||
</el-tooltip>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-tooltip content="列表筛选">
|
||||
<el-dropdown trigger="click">
|
||||
<el-button type="default" icon="operation" circle />
|
||||
@@ -91,6 +108,8 @@
|
||||
</template>
|
||||
</el-dropdown>
|
||||
</el-tooltip>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -144,12 +163,12 @@
|
||||
@click="scope.row.id === 1 ? ElMessage.warning('系统默认角色,不可操作') : handleOpenAssignPermDialog(scope.row.id, scope.row.name)"
|
||||
>分配权限</el-button>
|
||||
<el-button
|
||||
v-hasPerm="['system:role:detail']"
|
||||
type="info"
|
||||
size="small"
|
||||
link
|
||||
icon="document"
|
||||
@click="handleOpenDialog('detail', scope.row.id)"
|
||||
v-hasPerm="['system:role:detail']"
|
||||
>详情</el-button>
|
||||
<el-button
|
||||
v-hasPerm="['system:role:update']"
|
||||
@@ -239,7 +258,7 @@
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button @click="handleCloseDialog">取 消</el-button>
|
||||
<el-button type="primary" @click="handleSubmit" v-hasPerm="['system:role:submit']">确 定</el-button>
|
||||
<el-button v-hasPerm="['system:role:submit']" type="primary" @click="handleSubmit">确 定</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
@@ -9,7 +9,10 @@
|
||||
</template>
|
||||
</el-input>
|
||||
|
||||
<el-tree ref="deptTreeRef" class="mt-2" :data="deptOptions"
|
||||
<el-tree
|
||||
ref="deptTreeRef"
|
||||
class="mt-2"
|
||||
:data="deptOptions"
|
||||
:props="{ children: 'children', label: 'label', disabled: '' }"
|
||||
:expand-on-click-node="false"
|
||||
:filter-node-method="handleFilter"
|
||||
|
||||
@@ -33,8 +33,8 @@
|
||||
</el-form-item>
|
||||
<!-- 查询、重置、展开/收起按钮 -->
|
||||
<el-form-item class="search-buttons">
|
||||
<el-button type="primary" icon="search" @click="handleQuery" v-hasPerm="['system:user:query']">查询</el-button>
|
||||
<el-button icon="refresh" @click="handleResetQuery" v-hasPerm="['system:user:query']">重置</el-button>
|
||||
<el-button v-hasPerm="['system:user:query']" type="primary" icon="search" @click="handleQuery">查询</el-button>
|
||||
<el-button v-hasPerm="['system:user:query']" icon="refresh" @click="handleResetQuery">重置</el-button>
|
||||
<!-- 展开/收起 -->
|
||||
<template v-if="isExpandable">
|
||||
<el-link class="ml-3" type="primary" underline="never" @click="isExpand = !isExpand">
|
||||
@@ -68,8 +68,14 @@
|
||||
<!-- 功能区域 -->
|
||||
<div class="data-table__toolbar">
|
||||
<div class="data-table__toolbar--actions">
|
||||
<el-row :gutter="10">
|
||||
<el-col :span="1.5">
|
||||
<el-button v-hasPerm="['system:user:create']" type="success" icon="plus" @click="handleOpenDialog('create')">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button v-hasPerm="['system:user:delete']" type="danger" icon="delete" :disabled="selectIds.length === 0" @click="handleDelete(selectIds)">批量删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-dropdown v-hasPerm="['system:user:patch']" trigger="click">
|
||||
<el-button type="default" :disabled="selectIds.length === 0" icon="ArrowDown">
|
||||
更多
|
||||
@@ -81,18 +87,28 @@
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
|
||||
<div class="data-table__toolbar--tools">
|
||||
<el-row :gutter="10">
|
||||
<el-col :span="1.5">
|
||||
<el-tooltip content="导入">
|
||||
<el-button v-hasPerm="['system:user:import']" type="info" icon="upload" circle @click="handleOpenImportDialog" />
|
||||
</el-tooltip>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-tooltip content="导出">
|
||||
<el-button v-hasPerm="['system:user:export']" type="warning" icon="download" circle @click="handleExport" />
|
||||
</el-tooltip>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-tooltip content="刷新">
|
||||
<el-button type="default" icon="refresh" circle @click="handleRefresh" v-hasPerm="['system:user:refresh']" />
|
||||
<el-button v-hasPerm="['system:user:refresh']" type="default" icon="refresh" circle @click="handleRefresh"/>
|
||||
</el-tooltip>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -162,12 +178,12 @@
|
||||
@click="hancleResetPassword(scope.row)"
|
||||
>重置密码</el-button>
|
||||
<el-button
|
||||
v-hasPerm="['system:user:detail']"
|
||||
type="info"
|
||||
size="small"
|
||||
link
|
||||
icon="document"
|
||||
@click="handleOpenDialog('detail', scope.row.id)"
|
||||
v-hasPerm="['system:user:detail']"
|
||||
>详情</el-button>
|
||||
<el-button
|
||||
v-if="scope.row.username !== 'admin'"
|
||||
@@ -307,8 +323,8 @@
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<!-- 详情弹窗不需要确定按钮的提交逻辑 -->
|
||||
<el-button v-if="dialogVisible.type === 'create' || dialogVisible.type === 'update'" type="primary" @click="handleSubmit" v-hasPerm="['system:user:submit']">确定</el-button>
|
||||
<el-button v-else type="primary" @click="handleCloseDialog" v-hasPerm="['system:user:detail']">确定</el-button>
|
||||
<el-button v-if="dialogVisible.type === 'create' || dialogVisible.type === 'update'" v-hasPerm="['system:user:create']" type="primary" @click="handleSubmit">确定</el-button>
|
||||
<el-button v-else v-hasPerm="['system:user:detail']" type="primary" @click="handleCloseDialog">确定</el-button>
|
||||
<el-button @click="handleCloseDialog">取消</el-button>
|
||||
</div>
|
||||
</template>
|
||||
@@ -317,7 +333,7 @@
|
||||
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button type="primary" @click="handleSubmit" v-hasPerm="['system:user:submit']">确 定</el-button>
|
||||
<el-button v-hasPerm="['system:user:submit']" type="primary" @click="handleSubmit">确 定</el-button>
|
||||
<el-button @click="handleCloseDialog">取 消</el-button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user