Files
xk-admin/apps/web-antd/src/views/system/pharmacy/config/form.ts
李琦 6db736a6f4 feat:
1. 更新框架
2. 修复框架更新后导致的问题
3. 消息系统升级
2026-08-11 13:30:21 +08:00

288 lines
7.6 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import type { VbenFormProps } from '#/adapter/form';
// 药店管理表单配置
// 注意已移除类型选择字段固定为type=1药店类型
export const modalFormProps: VbenFormProps = {
wrapperClass: 'grid-cols-12', // 24栅格布局
commonConfig: {
formItemClass: 'col-span-12',
// 所有表单项的公共配置
componentProps: {
class: 'w-full',
},
},
layout: 'horizontal', // 水平布局
schema: [
{
// ID字段隐藏
component: 'VbenInput',
fieldName: 'id',
label: 'ID',
formItemClass: 'col-span-6',
dependencies: {
show: false, // 隐藏ID字段
triggerFields: ['id'],
},
},
{
component: 'Input',
fieldName: 'type',
dependencies: {
show: false,
triggerFields: ['id'],
},
defaultValue: 1,
},
{
// 基础信息分隔线
component: 'Divider',
fieldName: '',
label: '',
rules: 'required',
hideLabel: true,
renderComponentContent: () => {
return {
default: () => {
return '基础信息';
},
};
},
},
{
// 公章字段
component: 'Avatar',
formItemClass: 'col-span-6',
fieldName: 'see_rate',
label: '公章',
},
{
// 药店名称字段(已从"诊所名称"改为"药店名称"
component: 'VbenInput',
formItemClass: 'col-span-6',
componentProps: {
placeholder: '请输入药店名称', // 已从"诊所昵称"改为"药店名称"
},
fieldName: 'name',
label: '药店名称', // 已从"诊所名称"改为"药店名称"
rules: 'required',
},
{
// ERP ID字段
component: 'VbenInput',
formItemClass: 'col-span-6',
componentProps: {
placeholder: '请输入药店ERP ID', // 已从"诊所ERP ID"改为"药店ERP ID"
},
fieldName: 'erp_id',
label: 'ERP ID',
rules: 'required',
},
{
component: 'VbenInput',
formItemClass: 'col-span-6',
componentProps: {
placeholder: '请输入药店 MES ID',
},
fieldName: 'mes_id',
label: 'MES ID',
},
// 注意已移除门店类型选择字段因为药店管理固定为type=1
{
// 是否包邮字段(单选)
component: 'RadioGroup',
formItemClass: 'col-span-6',
componentProps: {
options: [
{ label: '不包邮', value: 0 },
{ label: '包邮', value: 1 },
],
placeholder: '是否包邮',
},
fieldName: 'is_shipping_free',
label: '是否包邮',
rules: 'required',
},
{
// 是否订阅价格波动(单选,新增和编辑时都显示)
component: 'RadioGroup',
formItemClass: 'col-span-6',
componentProps: {
options: [
{ label: '订阅价格波动', value: 0 }, // 0 表示订阅
{ label: '不订阅价格波动', value: 1 }, // 1 表示不订阅
],
placeholder: '是否订阅价格波动',
},
fieldName: 'subscribe_price_change',
label: '是否订阅价格波动',
defaultValue: 0, // 默认订阅
rules: 'required',
},
{
component: 'RadioGroup',
formItemClass: 'col-span-6',
componentProps: {
options: [
{ label: '关闭', value: 0 },
{ label: '开启', value: 1 },
],
},
fieldName: 'enable_order_price_percent_adjust',
label: '订单打折/涨幅',
defaultValue: 0,
},
{
// 联系人姓名字段
component: 'VbenInput',
formItemClass: 'col-span-6',
componentProps: {
placeholder: '请输入药店联系人姓名', // 已从"诊所联系人姓名"改为"药店联系人姓名"
},
fieldName: 'contact',
label: '联系人姓名',
rules: 'required',
},
{
// 联系人手机号字段
component: 'VbenInput',
formItemClass: 'col-span-6',
componentProps: {
placeholder: '请输入药店联系人手机号', // 已从"诊所联系人手机号"改为"药店联系人手机号"
},
fieldName: 'mobile',
label: '联系人手机号',
// 与后端 checkPhone 一致:必填 + 大陆 11 位号段
rules: 'mobile',
},
{
// 编辑时可选:同步修改药店管理员后台登录手机号
component: 'Switch',
formItemClass: 'col-span-12',
fieldName: 'sync_admin_phone',
label: '同步管理员登录号',
defaultValue: false,
componentProps: {
checkedChildren: '是',
unCheckedChildren: '否',
},
help: '勾选后,保存时将同步修改药店管理员后台登录手机号(需已开通后台)',
dependencies: {
show: (values) => values.id != null,
triggerFields: ['id'],
},
},
{
component: 'PromoterPicker',
formItemClass: 'col-span-6',
fieldName: 'code',
label: '业务员',
rules: 'required',
},
{
// 开始营业时间字段
component: 'TimePicker',
formItemClass: 'col-span-6',
componentProps: {
placeholder: '请选择开始营业时间',
format: 'HH:mm', // 时间格式
},
fieldName: 'start_time',
label: '开始营业时间',
rules: 'required',
},
{
// 结束营业时间字段
component: 'TimePicker',
formItemClass: 'col-span-6',
componentProps: {
placeholder: '请选择结束营业时间',
format: 'HH:mm', // 时间格式
},
fieldName: 'end_time',
label: '结束营业时间',
rules: 'required',
},
{
component: 'RegionAddressPicker',
fieldName: 'address',
label: '省市区',
rules: 'required',
},
{
// 详细地址字段
component: 'Textarea',
componentProps: {
placeholder: '请输入详细地址',
},
fieldName: 'position',
label: '详细地址',
rules: 'required',
},
{
// 轮播图上传字段
component: 'UploadImage',
fieldName: 'url',
label: '轮播图',
rules: 'required',
componentProps: {
maxCount: 9, // 最多上传9张图片
},
},
{
// 销售比例信息分隔线
component: 'Divider',
fieldName: '',
label: 'x',
rules: 'required',
hideLabel: true,
dependencies: {
show: false,
triggerFields: ['id'],
},
renderComponentContent: () => {
return {
default: () => {
return '销售比例信息';
},
};
},
},
{
// 中药采购价比例字段
component: 'InputNumber',
formItemClass: 'col-span-6',
componentProps: {
placeholder: '请输入中药采购价比例',
},
dependencies: {
show: false,
triggerFields: ['id'],
},
defaultValue: '100',
fieldName: 'z_buy_percent',
label: '中药采购价比例',
rules: 'required',
suffix: () => '%', // 后缀显示百分号
},
{
// 中药销售比例字段
component: 'InputNumber',
formItemClass: 'col-span-6',
componentProps: {
placeholder: '请输入中药销售比例',
},
dependencies: {
show: false,
triggerFields: ['id'],
},
defaultValue: '100',
fieldName: 'z_sale_percent',
label: '中药销售比例',
rules: 'required',
suffix: () => '%', // 后缀显示百分号
},
],
showDefaultActions: false, // 不显示默认操作按钮
};