|
|
@@ -0,0 +1,273 @@
|
|
|
+import type { DynamicNewsVO, WorkroomVO } from '#/api/workroom';
|
|
|
+
|
|
|
+import { $t } from '@vben/locales';
|
|
|
+import { getPopupContainer } from '@vben/utils';
|
|
|
+
|
|
|
+import { defineEditShell } from '#/adapter/shell/edit';
|
|
|
+import { defineGrid } from '#/adapter/vxe-table';
|
|
|
+import { optionsDepartmentMethod } from '#/api/system';
|
|
|
+import {
|
|
|
+ DynamicNewsVoSchema,
|
|
|
+ editDynamicNewsMethod,
|
|
|
+ editWorkroomMethod,
|
|
|
+ getWorkroomMethod,
|
|
|
+ listWorkroomMethod,
|
|
|
+ WorkroomVOSchema,
|
|
|
+} from '#/api/workroom';
|
|
|
+
|
|
|
+export const workroomGrid = defineGrid<WorkroomVO>({
|
|
|
+ scope: 'workroom',
|
|
|
+ query: listWorkroomMethod,
|
|
|
+ fields: [
|
|
|
+ {
|
|
|
+ component: 'Input',
|
|
|
+ fieldName: 'name',
|
|
|
+ label: $t('workroom.name', ['名称']),
|
|
|
+ },
|
|
|
+ {
|
|
|
+ component: 'Input',
|
|
|
+ fieldName: 'doctor.name',
|
|
|
+ label: '名老中医',
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ columns: (col) => [
|
|
|
+ col.seq(),
|
|
|
+ { field: 'name', title: $t('system.post.field.name'), minWidth: 140 },
|
|
|
+ { field: 'code', title: $t('system.post.field.code'), width: 140 },
|
|
|
+ {
|
|
|
+ field: 'department.name',
|
|
|
+ title: $t('workroom.department'),
|
|
|
+ minWidth: 140,
|
|
|
+ },
|
|
|
+ { field: 'principal', title: '负责人', width: 120 },
|
|
|
+ { field: 'phone', title: '联系电话', width: 130 },
|
|
|
+ { field: 'doctor.name', title: '名老中医', width: 120 },
|
|
|
+ {
|
|
|
+ field: 'doctor.description',
|
|
|
+ title: '名老中医简介',
|
|
|
+ minWidth: 120,
|
|
|
+ visible: false,
|
|
|
+ },
|
|
|
+ { field: 'sect.name', title: '流派名称', minWidth: 120, visible: false },
|
|
|
+ {
|
|
|
+ field: 'sect.description',
|
|
|
+ title: '流派传承',
|
|
|
+ minWidth: 120,
|
|
|
+ visible: false,
|
|
|
+ },
|
|
|
+ { field: 'smriti.name', title: '专科方向', minWidth: 120, visible: false },
|
|
|
+ {
|
|
|
+ field: 'smriti.description',
|
|
|
+ title: '传承团队',
|
|
|
+ minWidth: 120,
|
|
|
+ visible: false,
|
|
|
+ },
|
|
|
+ { field: 'remark', title: '备注', minWidth: 120, visible: false },
|
|
|
+ ...col.audit(),
|
|
|
+ col.actions(['edit', 'delete'], 160),
|
|
|
+ ],
|
|
|
+});
|
|
|
+
|
|
|
+export const workroomForm = defineEditShell<WorkroomVO>({
|
|
|
+ scope: 'workroom',
|
|
|
+ submit: editWorkroomMethod,
|
|
|
+ load: getWorkroomMethod,
|
|
|
+ shell: 'drawer',
|
|
|
+ form: {
|
|
|
+ layout: 'vertical',
|
|
|
+ wrapperClass: 'grid-cols-2',
|
|
|
+ },
|
|
|
+ schema: [
|
|
|
+ {
|
|
|
+ component: 'ApiTreeSelect',
|
|
|
+ componentProps: {
|
|
|
+ api: optionsDepartmentMethod,
|
|
|
+ filterTreeNode(input: string, node: Recordable<any>) {
|
|
|
+ if (!input || input.length === 0) return true;
|
|
|
+ const title: string = node.label.toString() ?? '';
|
|
|
+ if (!title) return false;
|
|
|
+ return title.includes(input) || $t(title).includes(input);
|
|
|
+ },
|
|
|
+ getPopupContainer,
|
|
|
+ class: 'w-full',
|
|
|
+ labelField: 'name',
|
|
|
+ valueField: 'id',
|
|
|
+ childrenField: 'children',
|
|
|
+ showSearch: true,
|
|
|
+ allowClear: true,
|
|
|
+ popupClassName: 'ant-select-tree-node-w-full',
|
|
|
+ },
|
|
|
+ fieldName: 'department.id',
|
|
|
+ label: $t('workroom.department'),
|
|
|
+ rules: 'selectRequired',
|
|
|
+ formItemClass: 'col-span-2 md:col-span-2 xxx',
|
|
|
+ controlClass: 'c--x',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ component: 'Input',
|
|
|
+ fieldName: 'name',
|
|
|
+ label: $t('workroom.name', ['名称']),
|
|
|
+ rules: WorkroomVOSchema.shape.name,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ component: 'Input',
|
|
|
+ fieldName: 'code',
|
|
|
+ label: $t('workroom.name', ['编码']),
|
|
|
+ rules: WorkroomVOSchema.shape.code,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ component: 'Input',
|
|
|
+ fieldName: 'principal',
|
|
|
+ label: '负责人',
|
|
|
+ rules: WorkroomVOSchema.shape.principal,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ component: 'Input',
|
|
|
+ componentProps: { maxlength: 11 },
|
|
|
+ fieldName: 'phone',
|
|
|
+ label: '联系电话',
|
|
|
+ rules: WorkroomVOSchema.shape.phone,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ component: 'Textarea',
|
|
|
+ fieldName: 'description',
|
|
|
+ label: '工作室简介',
|
|
|
+ rules: WorkroomVOSchema.shape.description.optional(),
|
|
|
+ formItemClass: 'col-span-2 md:col-span-2',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ component: 'Input',
|
|
|
+ fieldName: 'doctor.name',
|
|
|
+ label: '名老中医',
|
|
|
+ rules: WorkroomVOSchema.shape.doctor.shape.name,
|
|
|
+ formItemClass: 'col-span-2 md:col-span-2',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ component: 'Textarea',
|
|
|
+ fieldName: 'doctor.description',
|
|
|
+ label: '名老中医简介',
|
|
|
+ rules: WorkroomVOSchema.shape.doctor.shape.description.optional(),
|
|
|
+ formItemClass: 'col-span-2 md:col-span-2',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ component: 'Input',
|
|
|
+ fieldName: 'sect.name',
|
|
|
+ label: '流派名称',
|
|
|
+ rules: WorkroomVOSchema.shape.sect.shape.name.optional(),
|
|
|
+ formItemClass: 'col-span-2 md:col-span-2',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ component: 'Textarea',
|
|
|
+ fieldName: 'sect.description',
|
|
|
+ label: '流派传承',
|
|
|
+ rules: WorkroomVOSchema.shape.sect.shape.description.optional(),
|
|
|
+ formItemClass: 'col-span-2 md:col-span-2',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ component: 'Input',
|
|
|
+ fieldName: 'smriti.name',
|
|
|
+ label: '专科方向',
|
|
|
+ rules: WorkroomVOSchema.shape.smriti.shape.name.optional(),
|
|
|
+ formItemClass: 'col-span-2 md:col-span-2',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ component: 'Textarea',
|
|
|
+ fieldName: 'smriti.description',
|
|
|
+ label: '传承团队',
|
|
|
+ rules: WorkroomVOSchema.shape.smriti.shape.description.optional(),
|
|
|
+ formItemClass: 'col-span-2 md:col-span-2',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ component: 'Textarea',
|
|
|
+ fieldName: 'remark',
|
|
|
+ label: $t('ui.field.remark'),
|
|
|
+ rules: WorkroomVOSchema.shape.remark,
|
|
|
+ formItemClass: 'col-span-2',
|
|
|
+ },
|
|
|
+ ],
|
|
|
+});
|
|
|
+
|
|
|
+export const workroomInfoForm = defineEditShell<WorkroomVO>({
|
|
|
+ submit: editWorkroomMethod,
|
|
|
+ load: getWorkroomMethod,
|
|
|
+ shell: 'modal',
|
|
|
+ schema: [
|
|
|
+ {
|
|
|
+ component: 'Textarea',
|
|
|
+ fieldName: 'description',
|
|
|
+ label: '工作室简介',
|
|
|
+ rules: WorkroomVOSchema.shape.description,
|
|
|
+ formItemClass: 'col-span-2 md:col-span-2',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ component: 'Input',
|
|
|
+ fieldName: 'doctor.name',
|
|
|
+ label: '名老中医',
|
|
|
+ rules: WorkroomVOSchema.shape.doctor.shape.name,
|
|
|
+ formItemClass: 'col-span-2 md:col-span-2',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ component: 'Textarea',
|
|
|
+ fieldName: 'doctor.description',
|
|
|
+ label: '名老中医简介',
|
|
|
+ rules: WorkroomVOSchema.shape.doctor.shape.description,
|
|
|
+ formItemClass: 'col-span-2 md:col-span-2',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ component: 'Input',
|
|
|
+ fieldName: 'sect.name',
|
|
|
+ label: '流派名称',
|
|
|
+ rules: WorkroomVOSchema.shape.sect.shape.name,
|
|
|
+ formItemClass: 'col-span-2 md:col-span-2',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ component: 'Textarea',
|
|
|
+ fieldName: 'sect.description',
|
|
|
+ label: '流派传承',
|
|
|
+ rules: WorkroomVOSchema.shape.sect.shape.description,
|
|
|
+ formItemClass: 'col-span-2 md:col-span-2',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ component: 'Input',
|
|
|
+ fieldName: 'smriti.name',
|
|
|
+ label: '专科方向',
|
|
|
+ rules: WorkroomVOSchema.shape.smriti.shape.name,
|
|
|
+ formItemClass: 'col-span-2 md:col-span-2',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ component: 'Textarea',
|
|
|
+ fieldName: 'smriti.description',
|
|
|
+ label: '传承团队',
|
|
|
+ rules: WorkroomVOSchema.shape.smriti.shape.description,
|
|
|
+ formItemClass: 'col-span-2 md:col-span-2',
|
|
|
+ },
|
|
|
+ ],
|
|
|
+});
|
|
|
+
|
|
|
+export const dynamicNewsForm = defineEditShell<DynamicNewsVO>({
|
|
|
+ scope: 'workroom.news',
|
|
|
+ submit: editDynamicNewsMethod,
|
|
|
+ shell: 'modal',
|
|
|
+ form: { layout: 'vertical' },
|
|
|
+ schema: [
|
|
|
+ {
|
|
|
+ component: 'DatePicker',
|
|
|
+ fieldName: 'date',
|
|
|
+ label: '日期',
|
|
|
+ rules: DynamicNewsVoSchema.shape.date,
|
|
|
+ controlClass: 'w-full',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ component: 'Input',
|
|
|
+ fieldName: 'title',
|
|
|
+ label: '标题',
|
|
|
+ rules: DynamicNewsVoSchema.shape.title,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ component: 'Textarea',
|
|
|
+ fieldName: 'content',
|
|
|
+ label: '内容',
|
|
|
+ rules: DynamicNewsVoSchema.shape.content,
|
|
|
+ },
|
|
|
+ ],
|
|
|
+});
|