From 25f4ca40c2e26ba02bd8b2bbee29cbe40cd1ee3b Mon Sep 17 00:00:00 2001 From: KangshuYing <220240715@seu.edu.cn> Date: Tue, 20 May 2025 15:48:56 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E9=9B=86=E5=9B=A2=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pnpm-lock.yaml | 4 - src/api/system/unit/Company.ts | 39 ++++++++ src/views/system/unit/Company/Company.ts | 79 ++++++++++++++++ .../system/unit/Company/CompanyModal.vue | 63 +++++++++++++ src/views/system/unit/Company/index.vue | 89 +++++++++++++++++++ 5 files changed, 270 insertions(+), 4 deletions(-) create mode 100644 src/api/system/unit/Company.ts create mode 100644 src/views/system/unit/Company/Company.ts create mode 100644 src/views/system/unit/Company/CompanyModal.vue create mode 100644 src/views/system/unit/Company/index.vue diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 66bd3e9..21cb62b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1400,25 +1400,21 @@ packages: resolution: {integrity: sha512-2hBHEtCjnBTeuLvDAlHRCqsuFQSyAhTQs9vbZEVBTV8ap35pDI1ukPbIVFFCWNvL/KE7xRor5YZFvfyGCfvLnA==} cpu: [arm64] os: [linux] - libc: [glibc] '@rollup/rollup-linux-arm64-musl@4.4.0': resolution: {integrity: sha512-u7zy0Ygzl7O5Gvr9TSNSQj+DBzvMJC7rXfyQNgZ13KwkhgJ8z0z+gt2AO4RPd01rZioMQ2/TA24XGGg4xqhd0Q==} cpu: [arm64] os: [linux] - libc: [musl] '@rollup/rollup-linux-x64-gnu@4.4.0': resolution: {integrity: sha512-VvpAdh5SgewmWo8sa5QPYG8aSKH9hU2Kr5+3of0GzBI/8n8PBqhLyvF0DbO+zDW8j5IM8NDebv82MpHrZaD0Cw==} cpu: [x64] os: [linux] - libc: [glibc] '@rollup/rollup-linux-x64-musl@4.4.0': resolution: {integrity: sha512-3g6jaXxXVFaDnFoMn2+E3ludGcXFfEr6lDn+S1lh9Qe0JcL9sPt1wGh0g2cKIlb6OakNOFopZqJ5Yub9F7gQlA==} cpu: [x64] os: [linux] - libc: [musl] '@rollup/rollup-win32-arm64-msvc@4.4.0': resolution: {integrity: sha512-jnoDRkg5Ve6Y1qx2m1+ehouOLQ4ddc15/iQSfFjcDUL6bqLdJJ5c4CKfUy/C6W1oCU4la+hMkveE9GG7ECN7dg==} diff --git a/src/api/system/unit/Company.ts b/src/api/system/unit/Company.ts new file mode 100644 index 0000000..5ab9f7d --- /dev/null +++ b/src/api/system/unit/Company.ts @@ -0,0 +1,39 @@ +import { defHttp } from '@/utils/http/axios' + +export interface CompanyVO { + id?: number + name: string // 集团名称 + short: string // 集团简称 + status: number // 状态 + createTime: Date // 创建时间 +} + +export interface CompanyPageReqVO { + name?: string + status?: number +} + +// 查询集团列表 +export function getCompanyPage(params: CompanyPageReqVO) { + return defHttp.get({ url: '/system/Company/page', params }) +} + +// 查询集团详情 +export function getCompany(id: number) { + return defHttp.get({ url: `/system/Company/get?id=${id}` }) +} + +// 新增集团 +export function createCompany(data: CompanyVO) { + return defHttp.post({ url: '/system/Company/create', data }) +} + +// 修改集团 +export function updateCompany(params: CompanyVO) { + return defHttp.put({ url: '/system/Company/update', data: params }) +} + +// 删除集团 +export function deleteCompany(id: number) { + return defHttp.delete({ url: `/system/Company/delete?id=${id}` }) +} diff --git a/src/views/system/unit/Company/Company.ts b/src/views/system/unit/Company/Company.ts new file mode 100644 index 0000000..5815f54 --- /dev/null +++ b/src/views/system/unit/Company/Company.ts @@ -0,0 +1,79 @@ +import type { BasicColumn, FormSchema } from '@/components/Table' +import { useRender } from '@/components/Table' +import { DICT_TYPE, getDictOptions } from '@/utils/dict' + +export const columns: BasicColumn[] = [ + { + title: '集团名称', + dataIndex: 'name', + width: 260, + }, + { + title: '集团简称', + dataIndex: 'shortName', // 注意:后端是 shortName,不是 short! + width: 60, + }, + { + title: '状态', + dataIndex: 'status', + width: 180, + customRender: ({ text }) => { + return useRender.renderDict(text, DICT_TYPE.COMMON_STATUS) + }, + }, + { + title: '创建时间', + dataIndex: 'createTime', + width: 180, + customRender: ({ text }) => { + return useRender.renderDate(text) + }, + }, +] + +export const searchFormSchema: FormSchema[] = [ + { + label: '集团名称', + field: 'name', + component: 'Input', + colProps: { span: 8 }, + }, + { + label: '状态', + field: 'status', + component: 'Select', + componentProps: { + options: getDictOptions(DICT_TYPE.COMMON_STATUS), + }, + colProps: { span: 8 }, + }, +] + +export const formSchema: FormSchema[] = [ + { + label: '编号', + field: 'id', + show: false, + component: 'Input', + }, + { + label: '集团名称', + field: 'name', + required: true, + component: 'Input', + }, + { + label: '集团简称', + field: 'shortName', // 注意:后端是 shortName,不是 short! + required: true, + component: 'Input', + }, + { + label: '集团状态', + field: 'status', + component: 'Select', + componentProps: { + options: getDictOptions(DICT_TYPE.COMMON_STATUS), + }, + }, +] diff --git a/src/views/system/unit/Company/CompanyModal.vue b/src/views/system/unit/Company/CompanyModal.vue new file mode 100644 index 0000000..6cc6120 --- /dev/null +++ b/src/views/system/unit/Company/CompanyModal.vue @@ -0,0 +1,63 @@ + + + +./Company +@/api/system/unit/Company diff --git a/src/views/system/unit/Company/index.vue b/src/views/system/unit/Company/index.vue new file mode 100644 index 0000000..111a69e --- /dev/null +++ b/src/views/system/unit/Company/index.vue @@ -0,0 +1,89 @@ + + + +./Company +@/api/system/unit/Company