diff --git a/apps/web-antd/src/views/erp/finance/account/data.ts b/apps/web-antd/src/views/erp/finance/account/data.ts new file mode 100644 index 000000000..dc11d945f --- /dev/null +++ b/apps/web-antd/src/views/erp/finance/account/data.ts @@ -0,0 +1,167 @@ +import type { VbenFormSchema } from '#/adapter/form'; +import type { VxeTableGridOptions } from '#/adapter/vxe-table'; + +import { h } from 'vue'; + +import { Tag } from 'ant-design-vue'; + +import { z } from '#/adapter/form'; +import { CommonStatusEnum, DICT_TYPE, getDictOptions } from '#/utils'; + +/** 新增/修改的表单 */ +export function useFormSchema(): VbenFormSchema[] { + return [ + { + component: 'Input', + fieldName: 'id', + dependencies: { + triggerFields: [''], + show: () => false, + }, + }, + { + component: 'Input', + fieldName: 'name', + label: '名称', + rules: 'required', + componentProps: { + placeholder: '请输入名称', + }, + }, + { + fieldName: 'status', + label: '状态', + component: 'RadioGroup', + componentProps: { + options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'), + buttonStyle: 'solid', + optionType: 'button', + }, + rules: z.number().default(CommonStatusEnum.ENABLE), + }, + + { + fieldName: 'sort', + label: '排序', + component: 'InputNumber', + componentProps: { + placeholder: '请输入排序', + precision: 0, + class: 'w-full', + }, + rules: 'required', + defaultValue: 0, + }, + { + fieldName: 'defaultStatus', + label: '是否默认', + component: 'RadioGroup', + componentProps: { + options: [ + { + label: '是', + value: true, + }, + { + label: '否', + value: false, + }, + ], + buttonStyle: 'solid', + optionType: 'button', + }, + rules: z.boolean().default(false).optional(), + }, + { + fieldName: 'no', + label: '编码', + component: 'Input', + componentProps: { + placeholder: '请输入编码', + }, + }, + { + fieldName: 'remark', + label: '备注', + component: 'Textarea', + }, + ]; +} + +/** 列表的搜索表单 */ +export function useGridFormSchema(): VbenFormSchema[] { + return [ + { + fieldName: 'name', + label: '名称', + component: 'Input', + }, + { + fieldName: 'no', + label: '编码', + component: 'Input', + }, + { + fieldName: 'remark', + label: '备注', + component: 'Input', + }, + ]; +} + +/** 列表的字段 */ +export function useGridColumns(): VxeTableGridOptions['columns'] { + return [ + { + field: 'name', + title: '名称', + }, + { + field: 'no', + title: '编码', + }, + { + field: 'remark', + title: '备注', + }, + { + field: 'sort', + title: '排序', + }, + { + field: 'status', + title: '状态', + cellRender: { + name: 'CellDict', + props: { type: DICT_TYPE.COMMON_STATUS }, + }, + }, + { + field: 'defaultStatus', + title: '是否默认', + slots: { + default: ({ row }) => { + return h( + Tag, + { + class: 'mr-1', + color: row.defaultStatus ? 'blue' : 'red', + }, + () => (row.defaultStatus ? '是' : '否'), + ); + }, + }, + }, + { + field: 'createTime', + title: '创建时间', + formatter: 'formatDateTime', + }, + { + title: '操作', + width: 130, + fixed: 'right', + slots: { default: 'actions' }, + }, + ]; +} diff --git a/apps/web-antd/src/views/erp/finance/account/index.vue b/apps/web-antd/src/views/erp/finance/account/index.vue index c53233737..858ccbd4c 100644 --- a/apps/web-antd/src/views/erp/finance/account/index.vue +++ b/apps/web-antd/src/views/erp/finance/account/index.vue @@ -1,34 +1,152 @@ diff --git a/apps/web-antd/src/views/erp/finance/account/modules/form.vue b/apps/web-antd/src/views/erp/finance/account/modules/form.vue new file mode 100644 index 000000000..9adcff6d1 --- /dev/null +++ b/apps/web-antd/src/views/erp/finance/account/modules/form.vue @@ -0,0 +1,86 @@ + + +