From 9c412edc78c03fb9208cfa654801f014103a90b7 Mon Sep 17 00:00:00 2001 From: kkfluous Date: Fri, 13 Mar 2026 10:49:22 +0800 Subject: [PATCH] feat(frontend): add inspection template management page Create CRUD page for inspection templates with: - List page with search by name/bizType/status - Modal form with basic info + inline editable items table - Support add/delete inspection items with category, name, code, input type, sort, required fields Co-Authored-By: Claude Opus 4.6 --- .../views/asset/inspection-template/data.ts | 138 +++++++++++ .../views/asset/inspection-template/index.vue | 124 ++++++++++ .../inspection-template/modules/form.vue | 221 ++++++++++++++++++ 3 files changed, 483 insertions(+) create mode 100644 apps/web-antd/src/views/asset/inspection-template/data.ts create mode 100644 apps/web-antd/src/views/asset/inspection-template/index.vue create mode 100644 apps/web-antd/src/views/asset/inspection-template/modules/form.vue diff --git a/apps/web-antd/src/views/asset/inspection-template/data.ts b/apps/web-antd/src/views/asset/inspection-template/data.ts new file mode 100644 index 0000000..ddd02ec --- /dev/null +++ b/apps/web-antd/src/views/asset/inspection-template/data.ts @@ -0,0 +1,138 @@ +import type { VbenFormSchema } from '#/adapter/form'; +import type { VxeTableGridOptions } from '#/adapter/vxe-table'; + +import { z } from '#/adapter/form'; + +export const BIZ_TYPE_OPTIONS = [ + { label: '备车', value: 1 }, + { label: '交车', value: 2 }, + { label: '还车', value: 3 }, +]; + +export const STATUS_OPTIONS = [ + { label: '启用', value: 1 }, + { label: '禁用', value: 0 }, +]; + +export const INPUT_TYPE_OPTIONS = [ + { label: '勾选(合格/不合格)', value: 'checkbox' }, + { label: '数值', value: 'number' }, + { label: '文本', value: 'text' }, +]; + +/** 搜索表单 */ +export function useGridFormSchema(): VbenFormSchema[] { + return [ + { + fieldName: 'name', + label: '模板名称', + component: 'Input', + componentProps: { placeholder: '请输入模板名称' }, + }, + { + fieldName: 'bizType', + label: '适用业务', + component: 'Select', + componentProps: { + placeholder: '请选择', + options: BIZ_TYPE_OPTIONS, + allowClear: true, + }, + }, + { + fieldName: 'status', + label: '状态', + component: 'Select', + componentProps: { + placeholder: '请选择', + options: STATUS_OPTIONS, + allowClear: true, + }, + }, + ]; +} + +/** 表格列 */ +export function useGridColumns(): VxeTableGridOptions['columns'] { + return [ + { type: 'checkbox', width: 60, fixed: 'left' }, + { field: 'code', title: '模板编码', minWidth: 140, fixed: 'left' }, + { field: 'name', title: '模板名称', minWidth: 180 }, + { + field: 'bizType', + title: '适用业务', + minWidth: 100, + formatter({ cellValue }: any) { + return BIZ_TYPE_OPTIONS.find((o) => o.value === cellValue)?.label ?? cellValue; + }, + }, + { field: 'vehicleType', title: '适用车型', minWidth: 120 }, + { + field: 'status', + title: '状态', + minWidth: 80, + formatter({ cellValue }: any) { + return cellValue === 1 ? '启用' : '禁用'; + }, + }, + { field: 'remark', title: '备注', minWidth: 150 }, + { field: 'createTime', title: '创建时间', minWidth: 180, formatter: 'formatDateTime' }, + { title: '操作', width: 160, fixed: 'right', slots: { default: 'actions' } }, + ]; +} + +/** 模板基本信息表单 */ +export function useFormSchema(): VbenFormSchema[] { + return [ + { + component: 'Input', + fieldName: 'id', + dependencies: { triggerFields: [''], show: () => false }, + }, + { + fieldName: 'code', + label: '模板编码', + component: 'Input', + componentProps: { placeholder: '请输入模板编码' }, + rules: z.string().min(1, { message: '请输入模板编码' }), + }, + { + fieldName: 'name', + label: '模板名称', + component: 'Input', + componentProps: { placeholder: '请输入模板名称' }, + rules: z.string().min(1, { message: '请输入模板名称' }), + }, + { + fieldName: 'bizType', + label: '适用业务', + component: 'Select', + componentProps: { + placeholder: '请选择适用业务', + options: BIZ_TYPE_OPTIONS, + }, + rules: z.number({ message: '请选择适用业务' }), + }, + { + fieldName: 'vehicleType', + label: '适用车型', + component: 'Input', + componentProps: { placeholder: '留空表示通用模板' }, + }, + { + fieldName: 'status', + label: '状态', + component: 'Select', + componentProps: { + options: STATUS_OPTIONS, + }, + defaultValue: 1, + }, + { + fieldName: 'remark', + label: '备注', + component: 'Textarea', + componentProps: { placeholder: '请输入备注', rows: 2 }, + }, + ]; +} diff --git a/apps/web-antd/src/views/asset/inspection-template/index.vue b/apps/web-antd/src/views/asset/inspection-template/index.vue new file mode 100644 index 0000000..0f84026 --- /dev/null +++ b/apps/web-antd/src/views/asset/inspection-template/index.vue @@ -0,0 +1,124 @@ + + + diff --git a/apps/web-antd/src/views/asset/inspection-template/modules/form.vue b/apps/web-antd/src/views/asset/inspection-template/modules/form.vue new file mode 100644 index 0000000..1c0b86e --- /dev/null +++ b/apps/web-antd/src/views/asset/inspection-template/modules/form.vue @@ -0,0 +1,221 @@ + + +