refactor: 重构工具模块导入与项目代码结构

1.  统一所有API文件的request导入路径,从@utils/http改为@utils
2.  合并工具类导出,将分散的工具模块整合到@utils统一出口
3.  重构状态管理导入路径,统一从@utils导入相关工具与store
4.  整理组件导入与样式引用,优化项目内组件与样式的引用路径
5.  新增部分基础组件与工具方法,完善项目基础能力
6.  修复部分样式类名的书写规范,统一类名格式
This commit is contained in:
zhangtao
2026-05-17 06:56:31 +08:00
parent bb768d1a34
commit 8725be6d7d
210 changed files with 1277 additions and 1393 deletions
@@ -77,7 +77,7 @@
max-height="70vh"
>
<template #i="{ row }">
<JsonPretty v-if="row?.i != null" :value="row?.i" height="140px" />
<FaJsonPretty v-if="row?.i != null" :value="row?.i" height="140px" />
</template>
</FaDescriptions>
</template>
@@ -154,7 +154,7 @@
<script setup lang="ts">
import { useAuth } from "@/hooks/core/useAuth";
import { renderTableOperationCell, type TableOperationAction } from "@utils/table";
import { renderTableOperationCell, type TableOperationAction } from "@/utils/table";
import { useTable } from "@/hooks/core/useTable";
import { useImportExport } from "@/hooks/core/useImportExport";
import { useCrudDialog } from "@/hooks/core/useCrudDialog";
@@ -164,6 +164,7 @@ import { cleanEmptyArrayParams, stripPaginationParams } from "@/utils/query";
import type { IContentConfig, IObject } from "@/components/modal/types";
import type { AuditSearchFormParams } from "@/components/forms/fa-search-bar/auditSearchFormItems";
import type { FormItem } from "@/components/forms/fa-form/index.vue";
import FaJsonPretty from "@/components/others/fa-json-pretty/index.vue";
import type { ColumnOption } from "@/types/component";
import DemoAPI, {
type DemoForm,
@@ -171,6 +172,7 @@ import DemoAPI, {
type DemoTable,
} from "@/api/module_example/demo";
import { ResultEnum } from "@/enums/api/result.enum";
import { ElTag, ElMessage } from "element-plus";
defineOptions({
name: "Demo",
@@ -200,7 +202,7 @@ const searchForm = ref<DemoSearchFormParams>({
/** 搜索区域默认展开展示 */
const showSearchBar = ref(true);
const searchBarRef = ref<InstanceType<typeof FaSearchBarWithAudit> | null>(null);
const searchBarRef = ref<{ validate: () => Promise<boolean> } | null>(null);
const searchBarRules: Record<string, unknown> = {};
const statusOptions = ref([
{ label: "启用", value: "0" },
@@ -294,7 +296,7 @@ const {
minWidth: 160,
formatter: (row: DemoTable) => {
if (row.i == null) return h("span", { class: "text-g-500" }, "—");
return h(JsonPretty, { value: row.i, height: "120px" });
return h(FaJsonPretty, { value: row.i, height: "120px" });
},
},
{ prop: "description", label: "描述", minWidth: 120, showOverflowTooltip: true },
@@ -491,7 +493,11 @@ const rules = reactive({
status: [{ required: true, message: "请选择状态", trigger: "blur" }],
});
const dataFormRef = ref<InstanceType<typeof FaForm> | null>(null);
const dataFormRef = ref<{
resetFields: () => void;
clearValidate: () => void;
validate: (cb: (valid: boolean) => void) => void;
} | null>(null);
const submitLoading = ref(false);
const demoFormRenderKey = ref(0);
const metadataList = ref<{ key: string; value: string }[]>([]);
@@ -124,7 +124,7 @@
<script setup lang="ts">
import { useAuth } from "@/hooks/core/useAuth";
import { renderTableOperationCell, type TableOperationAction } from "@utils/table";
import { renderTableOperationCell, type TableOperationAction } from "@utils";
import { useTable } from "@/hooks/core/useTable";
import { useImportExport } from "@/hooks/core/useImportExport";
import { useCrudDialog } from "@/hooks/core/useCrudDialog";
@@ -133,6 +133,8 @@ import { confirmDelete, confirmBatchDelete, confirmAction } from "@/hooks/core/u
import { cleanEmptyArrayParams, stripPaginationParams } from "@/utils/query";
import type { IContentConfig, IObject } from "@/components/modal/types";
import type { AuditSearchFormParams } from "@/components/forms/fa-search-bar/auditSearchFormItems";
import FaSearchBarWithAudit from "@/components/forms/fa-search-bar/FaSearchBarWithAudit.vue";
import FaForm from "@/components/forms/fa-form/index.vue";
import type { FormItem } from "@/components/forms/fa-form/index.vue";
import type { ColumnOption } from "@/types/component";
import Demo01API, {
@@ -141,6 +143,7 @@ import Demo01API, {
type Demo01Table,
} from "@/api/module_example/demo01";
import { ResultEnum } from "@/enums/api/result.enum";
import { ElTag, ElMessage } from "element-plus";
defineOptions({
name: "ModuleExampleDemo01",