refactor: 重命名 CRUD 组件为 Crud 并简化字典标签类型

- CURD 组件 PageModal、PageSearch、PageContent、usePage 重命名为 CrudModal、CrudSearch、CrudTable、useCrudPage
- 字典项标签类型改用 primary/success/warning/danger/info,保留历史单字母值兼容读取
- 字典项页面拆分为独立子组件,移除 GithubCorner 组件
- 新增 icon 工具与 screen 样式
- 新增路由缓存、路由跳转、大屏与表格 CRUD 示例页
This commit is contained in:
Ray.Hao
2026-09-25 21:10:54 +08:00
parent 3ccbdb7c06
commit 89d45da839
224 changed files with 7926 additions and 3052 deletions

View File

@@ -180,10 +180,16 @@ const currentFilePath = computed(() => {
return idx > -1 ? key.slice(idx + 1) : key;
});
/**
* 切换预览范围
*/
function onScopeChange(val: any) {
emit("update:previewScope", val as "all" | "frontend" | "backend");
}
/**
* 切换预览文件类型
*/
function onTypesChange(val: any) {
emit("update:previewTypes", val as string[]);
}
@@ -196,6 +202,9 @@ const currentLanguage = computed(() => {
const fileCount = computed(() => {
let count = 0;
/**
* 递归统计文件数量
*/
function walk(nodes: any[]) {
nodes.forEach((n) => {
if (!n.children || !n.children.length) count++;
@@ -206,11 +215,17 @@ const fileCount = computed(() => {
return count;
});
/**
* 下载生成的代码
*/
function handleDownload() {
const pageType = props.genConfigFormData.pageType || "classic";
GeneratorAPI.download(props.tableName, pageType as "classic" | "curd", "ts");
GeneratorAPI.download(props.tableName, pageType as "classic" | "crud", "ts");
}
/**
* 刷新代码编辑器布局
*/
function refreshEditor() {
const inst = cmRef.value as any;
inst?.cminstance?.refresh?.();
@@ -218,12 +233,21 @@ function refreshEditor() {
inst?.editor?.refresh?.();
}
/**
* 开始拖动文件树宽度
*/
function startResize(e: MouseEvent) {
const startX = e.clientX;
const startWidth = fileTreeWidth.value;
/**
* 拖动中更新文件树宽度
*/
const onMove = (ev: MouseEvent) => {
fileTreeWidth.value = Math.max(200, Math.min(500, startWidth + ev.clientX - startX));
};
/**
* 结束拖动并解绑监听
*/
const onUp = () => {
document.removeEventListener("mousemove", onMove);
document.removeEventListener("mouseup", onUp);