refactor(gencode): 重构代码生成模块,优化类型定义和组件逻辑

- 将多个Vue组件脚本迁移至TypeScript,增强类型安全
- 重构API接口定义,优化参数传递和响应处理
- 改进表单验证逻辑,简化冗余代码
- 统一使用Element Plus的消息提示组件
- 优化路由处理逻辑,修复混合布局下的路径解析问题
- 完善类型定义,增加GenTableSchema等接口
- 移除未使用的导入和冗余代码
- 改进代码预览和复制功能
This commit is contained in:
zhangtao
2025-10-06 20:17:47 +08:00
parent 75215a89c2
commit f2a3c1f2dd
15 changed files with 1207 additions and 1031 deletions
@@ -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);
});
};