diff --git a/apps/web-antd/src/views/system/pharmacy/components/modal.vue b/apps/web-antd/src/views/system/pharmacy/components/modal.vue new file mode 100644 index 00000000..d4569053 --- /dev/null +++ b/apps/web-antd/src/views/system/pharmacy/components/modal.vue @@ -0,0 +1,87 @@ + + diff --git a/apps/web-antd/src/views/system/pharmacy/config/form.ts b/apps/web-antd/src/views/system/pharmacy/config/form.ts new file mode 100644 index 00000000..6582abeb --- /dev/null +++ b/apps/web-antd/src/views/system/pharmacy/config/form.ts @@ -0,0 +1,342 @@ +import type { VbenFormProps } from '#/adapter/form'; + +import { addressOption } from '#/util/address.ts'; + +// 药店管理表单配置 +// 注意:已移除类型选择字段,固定为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', + }, + // 注意:已移除门店类型选择字段,因为药店管理固定为type=1 + { + // 是否包邮字段 + component: 'Select', + formItemClass: 'col-span-6', + componentProps: { + options: [ + { label: '不包邮', value: 0 }, + { label: '包邮', value: 1 }, + ], + placeholder: '是否包邮', + }, + fieldName: 'is_shipping_free', + label: '是否包邮', + rules: 'required', + }, + { + // 联系人姓名字段 + component: 'VbenInput', + formItemClass: 'col-span-6', + componentProps: { + placeholder: '请输入药店联系人姓名', // 已从"诊所联系人姓名"改为"药店联系人姓名" + }, + fieldName: 'contact', + label: '联系人姓名', + rules: 'required', + }, + { + // 联系人手机号字段 + component: 'VbenInput', + formItemClass: 'col-span-6', + componentProps: { + placeholder: '请输入药店联系人手机号', // 已从"诊所联系人手机号"改为"药店联系人手机号" + }, + fieldName: 'mobile', + label: '联系人手机号', + rules: 'required', + }, + { + // 业务码字段 + component: 'VbenInput', + formItemClass: 'col-span-6', + componentProps: { + placeholder: '请输入业务码', + }, + 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: 'Cascader', + componentProps: { + placeholder: '请选省市区', + options: addressOption, + }, + 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, + renderComponentContent: () => { + return { + default: () => { + return '销售比例信息'; + }, + }; + }, + }, + { + // 中药采购价比例字段 + component: 'InputNumber', + formItemClass: 'col-span-6', + componentProps: { + placeholder: '请输入中药采购价比例', + }, + fieldName: 'z_buy_percent', + label: '中药采购价比例', + rules: 'required', + suffix: () => '%', // 后缀显示百分号 + }, + { + // 中药销售比例字段 + component: 'InputNumber', + formItemClass: 'col-span-6', + componentProps: { + placeholder: '请输入中药销售比例', + }, + fieldName: 'z_sale_percent', + label: '中药销售比例', + rules: 'required', + suffix: () => '%', // 后缀显示百分号 + }, + { + // 银行卡信息分隔线(仅在新增时显示) + component: 'Divider', + fieldName: '', + label: 'x', + rules: 'required', + hideLabel: true, + dependencies: { + show: (values) => { + // 仅在新增时显示(id为空时) + return values.id == null; + }, + triggerFields: ['id'], + }, + renderComponentContent: () => { + return { + default: () => { + return '银行卡信息'; + }, + }; + }, + }, + { + // 开户人姓名字段(仅在新增时显示) + component: 'VbenInput', + formItemClass: 'col-span-6', + componentProps: { + placeholder: '请输入开户人姓名', + }, + dependencies: { + show: (values) => { + // 仅在新增时显示(id为空时) + return values.id == null; + }, + triggerFields: ['id'], + }, + fieldName: 'bank_user_name', + label: '开户人姓名', + rules: 'required', + }, + { + // 银行卡号字段(仅在新增时显示) + component: 'VbenInput', + formItemClass: 'col-span-6', + componentProps: { + placeholder: '请输入银行卡号', + }, + dependencies: { + show: (values) => { + // 仅在新增时显示(id为空时) + return values.id == null; + }, + triggerFields: ['id'], + }, + fieldName: 'bank_card', + label: '银行卡号', + rules: 'required', + }, + { + // 开户行字段(仅在新增时显示) + component: 'VbenInput', + formItemClass: 'col-span-6', + componentProps: { + placeholder: '请输入开户行', + }, + dependencies: { + show: (values) => { + // 仅在新增时显示(id为空时) + return values.id == null; + }, + triggerFields: ['id'], + }, + fieldName: 'bank_name', + label: '开户行', + rules: 'required', + }, + { + // 银联行号字段(仅在新增时显示,非必填) + component: 'VbenInput', + formItemClass: 'col-span-6', + componentProps: { + placeholder: '请输入银联行号', + }, + dependencies: { + show: (values) => { + // 仅在新增时显示(id为空时) + return values.id == null; + }, + triggerFields: ['id'], + }, + fieldName: 'bank_no', + label: '银联行号', + }, + { + // 银行账户类型字段(仅在新增时显示) + component: 'RadioGroup', + componentProps: { + options: [ + { label: '对公', value: 1 }, + { label: '对私', value: 2 }, + { label: '存折', value: 5 }, + ], + placeholder: '请选择银行账户类型', + }, + dependencies: { + show: (values) => { + // 仅在新增时显示(id为空时) + return values.id == null; + }, + triggerFields: ['id'], + }, + fieldName: 'bank_account_type', + label: '银行账户类型', + rules: 'required', + }, + ], + showDefaultActions: false, // 不显示默认操作按钮 +}; diff --git a/apps/web-antd/src/views/system/pharmacy/config/search.ts b/apps/web-antd/src/views/system/pharmacy/config/search.ts new file mode 100644 index 00000000..1e562c4d --- /dev/null +++ b/apps/web-antd/src/views/system/pharmacy/config/search.ts @@ -0,0 +1,50 @@ +import type { VbenFormProps } from '#/adapter/form'; + +// 药店管理搜索表单配置 +// 注意:已移除类型筛选字段,因为药店管理页面只显示type=1的数据 +export const formOptions: VbenFormProps = { + // 默认展开搜索表单 + collapsed: false, + schema: [ + { + // 药店名称搜索字段 + component: 'VbenInput', + componentProps: { + placeholder: '输入名称', + }, + defaultValue: '', + fieldName: 'name', + label: '药店名称', // 已从"诊所名称"改为"药店名称" + }, + { + // 药店首字母搜索字段 + component: 'VbenInput', + componentProps: { + placeholder: '输入名称', + }, + defaultValue: '', + fieldName: 'shouzimu', + label: '药店首字母', // 已从"诊所首字母"改为"药店首字母" + }, + { + // 联系人手机号搜索字段 + component: 'VbenInput', + componentProps: { + placeholder: '输入联系人手机号', + }, + defaultValue: '', + fieldName: 'mobile', + label: '联系人手机号', + }, + // 注意:已移除类型筛选字段,因为药店管理页面固定显示type=1的数据 + ], + // 控制表单是否显示折叠按钮 + showCollapseButton: true, + submitButtonOptions: { + content: '查询', + }, + // 是否在字段值改变时提交表单 + submitOnChange: true, + // 按下回车时是否提交表单 + submitOnEnter: false, +}; diff --git a/apps/web-antd/src/views/system/pharmacy/config/table.ts b/apps/web-antd/src/views/system/pharmacy/config/table.ts new file mode 100644 index 00000000..5da8dee7 --- /dev/null +++ b/apps/web-antd/src/views/system/pharmacy/config/table.ts @@ -0,0 +1,116 @@ +import type { VxeGridProps } from '#/adapter/vxe-table'; + +// 直接使用store的API接口 +import { getStoreList } from '#/views/system/store/api'; + +// 表格行数据类型定义 +interface RowType { + id: string; + name: string; + logo: string; + introduce: string; + created_at: string; +} + +// 药店管理表格配置 +// 注意:查询时会自动添加type=1参数,只显示药店类型的数据 +export const gridOptions: VxeGridProps = { + // 复选框配置 + checkboxConfig: { + highlight: true, + labelField: '', + }, + // 列配置 + columnConfig: { + useKey: true, + }, + // 行配置 + rowConfig: { + useKey: true, + }, + // 表格列定义 + columns: [ + { type: 'checkbox', width: 60 }, // 复选框列 + { field: 'id', align: 'left', title: 'ID', width: 100 }, // ID列 + { field: 'name', align: 'left', title: '药店名称' }, // 药店名称列(已从"诊所名称"改为"药店名称") + { + // 类型列(显示为标签) + field: 'type', + align: 'left', + title: '类型', + slots: { default: 'type' }, + width: 100, + }, + { + // 是否包邮列(显示为开关) + field: 'is_shipping_free', + align: 'left', + title: '是否包邮', + slots: { default: 'is_shipping_free' }, + width: 120, + }, + { + // 药店二维码列(已从"诊所二维码"改为"药店二维码") + field: 'qr_code', + align: 'left', + title: '药店二维码', + slots: { default: 'qr_code' }, + width: 130, + }, + { field: 'position', title: '详细地址' }, // 详细地址列 + { field: 'new_admin.nick_name', title: '业务员' }, // 业务员列 + { field: 'mobile', title: '联系人、电话', slots: { default: 'mobile' } }, // 联系人电话列 + { + // 营业时间列 + field: 'start_time', + title: '营业时间', + slots: { default: 'start-time' }, + }, + { field: 'created_at', title: '注册时间' }, // 注册时间列 + { + // 操作列 + type: 'html', + title: '操作', + align: 'right', + slots: { default: 'action' }, + }, + ], + keepSource: true, + // 分页配置 + pagerConfig: {}, + // 代理配置(数据请求) + proxyConfig: { + ajax: { + // 请求后端接口方法 + // 注意:会自动添加type=1参数,只查询药店类型的数据 + query: async ({ page }, formValues) => { + return await getStoreList({ + page: page.currentPage, + pageSize: page.pageSize, + type: 1, // 固定为药店类型 + ...formValues, + }); + }, + }, + }, + height: 'auto', + border: false, + // 工具栏配置 + toolbarConfig: { + // 是否显示搜索表单控制按钮 + // @ts-ignore 正式环境时有完整的类型声明 + search: true, + refresh: true, // 刷新按钮 + print: false, // 打印按钮 + export: false, // 导出按钮 + zoom: true, // 最大化最小化按钮 + slots: { + buttons: 'toolbar-buttons', // 工具栏按钮插槽 + }, + custom: { + // 自定义列-图标 + icon: 'vxe-icon-menu', + }, + }, + showOverflow: false, +}; diff --git a/apps/web-antd/src/views/system/pharmacy/index.vue b/apps/web-antd/src/views/system/pharmacy/index.vue new file mode 100644 index 00000000..f330d881 --- /dev/null +++ b/apps/web-antd/src/views/system/pharmacy/index.vue @@ -0,0 +1,287 @@ + + + + + diff --git a/apps/web-antd/src/views/system/store/components/modal.vue b/apps/web-antd/src/views/system/store/components/modal.vue index a5baeb33..7e61b693 100644 --- a/apps/web-antd/src/views/system/store/components/modal.vue +++ b/apps/web-antd/src/views/system/store/components/modal.vue @@ -30,6 +30,7 @@ const [Modal, modalApi] = useVbenModal({ const values = await formApi.getValues(); modalApi.setState({ loading: true, confirmLoading: true }); const submitApi = isUpdate.value ? updateStore : createStore; + // 固定设置type=0(诊所类型),无论是新增还是编辑 submitApi(values) .then(() => { message.success('保存成功'); diff --git a/apps/web-antd/src/views/system/store/config/form.ts b/apps/web-antd/src/views/system/store/config/form.ts index 2daeb6b1..e27bd8c7 100644 --- a/apps/web-antd/src/views/system/store/config/form.ts +++ b/apps/web-antd/src/views/system/store/config/form.ts @@ -2,6 +2,8 @@ import type { VbenFormProps } from '#/adapter/form'; import { addressOption } from '#/util/address.ts'; +// 诊所管理表单配置 +// 注意:已移除类型选择字段,固定为type=0(诊所类型) export const modalFormProps: VbenFormProps = { wrapperClass: 'grid-cols-12', // 24栅格, commonConfig: { @@ -80,19 +82,15 @@ export const modalFormProps: VbenFormProps = { rules: 'required', }, { - component: 'Select', - formItemClass: 'col-span-6', - componentProps: { - options: [ - { label: '诊所', value: 0 }, - { label: '药店', value: 1 }, - ], - placeholder: '请选择门店类型', - }, + component: 'Input', fieldName: 'type', - label: '门店类型', - rules: 'required', + dependencies: { + show: false, + triggerFields: ['id'], + }, + defaultValue: 0, }, + // 注意:已移除门店类型选择字段,因为诊所管理固定为type=0 { component: 'Select', formItemClass: 'col-span-6', diff --git a/apps/web-antd/src/views/system/store/config/search.ts b/apps/web-antd/src/views/system/store/config/search.ts index c22aebc8..d3dc7417 100644 --- a/apps/web-antd/src/views/system/store/config/search.ts +++ b/apps/web-antd/src/views/system/store/config/search.ts @@ -1,12 +1,13 @@ import type { VbenFormProps } from '#/adapter/form'; -// import dayjs from 'dayjs'; - +// 诊所管理搜索表单配置 +// 注意:已移除类型筛选字段,因为诊所管理页面只显示type=0的数据 export const formOptions: VbenFormProps = { - // 默认展开 + // 默认展开搜索表单 collapsed: false, schema: [ { + // 诊所名称搜索字段 component: 'VbenInput', componentProps: { placeholder: '输入名称', @@ -16,6 +17,7 @@ export const formOptions: VbenFormProps = { label: '诊所名称', }, { + // 诊所首字母搜索字段 component: 'VbenInput', componentProps: { placeholder: '输入名称', @@ -25,6 +27,7 @@ export const formOptions: VbenFormProps = { label: '诊所首字母', }, { + // 联系人手机号搜索字段 component: 'VbenInput', componentProps: { placeholder: '输入联系人手机号', @@ -33,19 +36,7 @@ export const formOptions: VbenFormProps = { fieldName: 'mobile', label: '联系人手机号', }, - { - component: 'Select', - componentProps: { - placeholder: '请选择类型', - options: [ - { label: '诊所', value: 0 }, - { label: '药店', value: 1 }, - ], - }, - defaultValue: undefined, - fieldName: 'type', - label: '类型', - }, + // 注意:已移除类型筛选字段,因为诊所管理页面固定显示type=0的数据 // { // component: 'RangePicker', // componentProps: { diff --git a/apps/web-antd/src/views/system/store/config/table.ts b/apps/web-antd/src/views/system/store/config/table.ts index 1821df74..a4de5937 100644 --- a/apps/web-antd/src/views/system/store/config/table.ts +++ b/apps/web-antd/src/views/system/store/config/table.ts @@ -70,10 +70,12 @@ export const gridOptions: VxeGridProps = { proxyConfig: { ajax: { // 请求后端接口方法 + // 注意:会自动添加type=0参数,只查询诊所类型的数据 query: async ({ page }, formValues) => { return await getStoreList({ page: page.currentPage, pageSize: page.pageSize, + type: 0, // 固定为诊所类型 ...formValues, }); },