From 7f912eac3e9186a4500322001cc93b636e1b995e Mon Sep 17 00:00:00 2001 From: KangshuYing <220240715@seu.edu.cn> Date: Fri, 30 May 2025 19:50:53 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E4=BF=AE=E6=94=B9=E7=B3=BB?= =?UTF-8?q?=E7=BB=9F=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/system/{unit => config}/Company.ts | 3 +- src/views/system/config/Company/Company.ts | 61 ++++++++++++++ .../{unit => config}/Company/CompanyModal.vue | 10 +-- .../system/{unit => config}/Company/index.vue | 27 ++++--- src/views/system/unit/Company/Company.ts | 79 ------------------- 5 files changed, 84 insertions(+), 96 deletions(-) rename src/api/system/{unit => config}/Company.ts (95%) create mode 100644 src/views/system/config/Company/Company.ts rename src/views/system/{unit => config}/Company/CompanyModal.vue (92%) rename src/views/system/{unit => config}/Company/index.vue (76%) delete mode 100644 src/views/system/unit/Company/Company.ts diff --git a/src/api/system/unit/Company.ts b/src/api/system/config/Company.ts similarity index 95% rename from src/api/system/unit/Company.ts rename to src/api/system/config/Company.ts index 5ab9f7d..316b9c4 100644 --- a/src/api/system/unit/Company.ts +++ b/src/api/system/config/Company.ts @@ -2,15 +2,14 @@ import { defHttp } from '@/utils/http/axios' export interface CompanyVO { id?: number + num: number// 集团序号 name: string // 集团名称 short: string // 集团简称 - status: number // 状态 createTime: Date // 创建时间 } export interface CompanyPageReqVO { name?: string - status?: number } // 查询集团列表 diff --git a/src/views/system/config/Company/Company.ts b/src/views/system/config/Company/Company.ts new file mode 100644 index 0000000..c2585cf --- /dev/null +++ b/src/views/system/config/Company/Company.ts @@ -0,0 +1,61 @@ +import dayjs from 'dayjs' +import utc from 'dayjs/plugin/utc' +import type { BasicColumn, FormSchema } from '@/components/Table' + +// 初始化 UTC 插件 +dayjs.extend(utc) + +export const columns: BasicColumn[] = [ + { + title: '集团序号', + dataIndex: 'num', + width: 120, + }, + { + title: '集团名称', + dataIndex: 'name', + width: 260, + }, + { + title: '集团简称', + dataIndex: 'shortName', + width: 60, + }, + { + title: '创建时间', + dataIndex: 'createTime', + width: 180, + // 推荐的新写法(Ant Design Vue 2.2+) + customRender: ({ text }) => { + // 假设 text 是 UTC 时间(如 "2025-05-28T17:02:44") + return dayjs.utc(text).local().format('YYYY-MM-DD HH:mm:ss') + }, + }, +] + +export const formSchema: FormSchema[] = [ + { + label: '编号', + field: 'id', + show: false, + component: 'Input', + }, + { + label: '集团序号', + field: 'num', + required: true, + component: 'Input', + }, + { + label: '集团名称', + field: 'name', + required: true, + component: 'Input', + }, + { + label: '集团简称', + field: 'shortName', + required: true, + component: 'Input', + }, +] diff --git a/src/views/system/unit/Company/CompanyModal.vue b/src/views/system/config/Company/CompanyModal.vue similarity index 92% rename from src/views/system/unit/Company/CompanyModal.vue rename to src/views/system/config/Company/CompanyModal.vue index 6cc6120..1602523 100644 --- a/src/views/system/unit/Company/CompanyModal.vue +++ b/src/views/system/config/Company/CompanyModal.vue @@ -5,7 +5,7 @@ import { useI18n } from '@/hooks/web/useI18n' import { useMessage } from '@/hooks/web/useMessage' import { BasicForm, useForm } from '@/components/Form' import { BasicModal, useModalInner } from '@/components/Modal' -import { createCompany, getCompany, updateCompany } from '@/api/system/unit/Company' +import { createCompany, getCompany, updateCompany } from '@/api/system/config/Company' defineOptions({ name: 'CompanyModal' }) @@ -40,7 +40,6 @@ async function handleSubmit() { await updateCompany(values) else await createCompany(values) - closeModal() emit('success') createMessage.success(t('common.saveSuccessText')) @@ -53,11 +52,12 @@ async function handleSubmit() { -./Company -@/api/system/unit/Company diff --git a/src/views/system/unit/Company/index.vue b/src/views/system/config/Company/index.vue similarity index 76% rename from src/views/system/unit/Company/index.vue rename to src/views/system/config/Company/index.vue index 111a69e..1e00061 100644 --- a/src/views/system/unit/Company/index.vue +++ b/src/views/system/config/Company/index.vue @@ -1,12 +1,12 @@