fix: 诊所管理

This commit is contained in:
2025-04-01 19:13:44 +08:00
parent ffd9a0c6e3
commit 342f3cbd57
13 changed files with 12956 additions and 168 deletions

View File

@@ -73,6 +73,13 @@ export async function getMyCard() {
return requestClient.get<any>(`${prefix}my-card`);
}
/**
* 获取我绑定的银行卡
*/
export async function getQuickMenuApi() {
return requestClient.get<any>(`${prefix}get-quick-menu`);
}
/**
* 编辑账户绑定银行卡
* @param data

View File

@@ -0,0 +1,59 @@
import { requestClient } from '#/api/request';
const prefix = 'store/';
/**
* 分页查询用户列表
* @param data
*/
export async function getStoreList(data: any) {
return requestClient.get<any>(`${prefix}list`, { params: data });
}
/**
* 分页查询用户列表
* @param data
*/
export async function getStoreOption(data: any) {
return requestClient.get<any>(`${prefix}option`, { params: data });
}
/**
* 获取诊所详情
* @param id
*/
export async function getStoreInfo(id: number) {
return requestClient.get<any>(`${prefix}detail`, { params: { id } });
}
/**
* 新增诊所
* @param data
*/
export async function createStore(data: Record<string, any>) {
return requestClient.post<any>(`${prefix}create`, data);
}
/**
* 编辑诊所
* @param data
*/
export async function updateStore(data: Record<string, any>) {
return requestClient.post<any>(`${prefix}update`, data);
}
/**
* 删除诊所
* @param data
*/
export async function deleteStore(data: Record<string, any>) {
return requestClient.post<any>(`${prefix}delete`, data);
}
/**
* 开启后台登录
* @param id
*/
export async function openPcWindowsApiByStore(id: number) {
return requestClient.post<any>(`${prefix}open-pc-windows`, {
id,
});
}

View File

@@ -0,0 +1,68 @@
<script lang="ts" setup>
import { ref } from 'vue';
import { useVbenModal } from '@vben/common-ui';
import { message } from 'ant-design-vue';
import { useVbenForm } from '#/adapter/form';
import { modalFormProps } from '#/views/system/store/config/form';
import { createStore, updateStore } from '../api';
import dayjs from "dayjs";
defineOptions({
name: 'FormModelDemo',
});
const isUpdate = ref(false);
const gridApi = ref();
const [Form, formApi] = useVbenForm(modalFormProps);
const [Modal, modalApi] = useVbenModal({
fullscreenButton: false,
draggable: true,
onCancel() {
modalApi.close();
},
onConfirm: async () => {
formApi.validate().then(async (e: any) => {
if (e.valid) {
const values = await formApi.getValues();
modalApi.setState({ loading: true, confirmLoading: true });
const submitApi = isUpdate.value ? updateStore : createStore;
submitApi(values)
.then(() => {
message.success('保存成功');
gridApi.value?.reload();
modalApi.close();
})
.finally(() => {
modalApi.setState({ loading: false, confirmLoading: false });
});
}
});
await formApi.validateAndSubmitForm();
},
onOpenChange(isOpen: boolean) {
gridApi.value = isOpen ? modalApi.getData()?.gridApi : null;
if (isOpen) {
const { values, update } = modalApi.getData<Record<string, any>>();
if (values) {
isUpdate.value = update;
// 把values.start_time变成dayjs
values.start_time = dayjs(values.start_time, 'HH:mm');
values.end_time = dayjs(values.end_time, 'HH:mm');
values.address = [values.province_id, values.city_id];
formApi.setValues(values);
}
}
},
});
</script>
<template>
<Modal :title="`${isUpdate === true ? '编辑' : '新增'}诊所`" class="w-[50%]">
<Form />
</Modal>
</template>

View File

@@ -0,0 +1,288 @@
import type {VbenFormProps} from '#/adapter/form';
import { addressOption } from '#/util/address.ts';
export const modalFormProps: VbenFormProps = {
wrapperClass: 'grid-cols-12', // 24栅格,
commonConfig: {
formItemClass: 'col-span-12',
// 所有表单项
componentProps: {
class: 'w-full',
},
},
// handleSubmit: onSubmit,
layout: 'horizontal',
schema: [
// {
// fieldName: 'baseinfo',
// component: 'Divider',
// label: '基础信息',
// formItemClass: 'col-span-12',
// componentProps: {},
// hideLabel: true,
// renderComponentContent: () => {
// return {
// default: () => {
// return '基础信息';
// },
// };
// },
// },
{
component: 'VbenInput',
fieldName: 'id',
label: 'ID',
formItemClass: 'col-span-6',
dependencies: {
show: false,
triggerFields: ['id'],
},
},
{
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',
},
{
component: 'VbenInput',
formItemClass: 'col-span-6',
componentProps: {
placeholder: '请输入诊所ERP ID',
},
fieldName: 'erp_id',
label: 'ERP ID',
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,
onChange: (value: any) => {
console.log(value);
},
},
fieldName: 'address',
label: '省市区',
rules: 'required',
},
{
component: 'Textarea',
componentProps: {
placeholder: '请选择结束营业时间',
// format: 'HH:MM', // 确保格式与你需要的一致
},
fieldName: 'position',
label: '详细地址',
rules: 'required',
},
{
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: 'VbenInput',
// formItemClass: 'col-span-6',
// componentProps: {
// placeholder: '请输入颗粒药采购价比例',
// },
// fieldName: 'g_bug_percent',
// label: '颗粒药采购价比例',
// rules: 'required',
// },
// {
// component: 'VbenInput',
// formItemClass: 'col-span-6',
// componentProps: {
// placeholder: '请输入颗粒药销售比例',
// },
// fieldName: 'g_sale_percent',
// label: '颗粒药销售比例',
// rules: 'required',
// },
{
component: 'Divider',
fieldName: '',
label: 'x',
rules: 'required',
hideLabel: true,
renderComponentContent: () => {
return {
default: () => {
return '银行卡信息';
},
};
},
},
{
component: 'VbenInput',
formItemClass: 'col-span-6',
componentProps: {
placeholder: '请输入开户人姓名',
},
fieldName: 'bank_user_name',
label: '开户人姓名',
rules: 'required',
},
{
component: 'VbenInput',
formItemClass: 'col-span-6',
componentProps: {
placeholder: '请输入银行卡号',
},
fieldName: 'bank_card',
label: '银行卡号',
rules: 'required',
},
{
component: 'VbenInput',
formItemClass: 'col-span-6',
componentProps: {
placeholder: '请输入开户行',
},
fieldName: 'bank_name',
label: '开户行',
rules: 'required',
},
{
component: 'VbenInput',
formItemClass: 'col-span-6',
componentProps: {
placeholder: '请输入银联行号',
},
fieldName: 'bank_no',
label: '银联行号',
},
{
component: 'RadioGroup',
componentProps: {
options: [
{ label: '对公', value: 1 },
{ label: '对私', value: 2 },
{ label: '存折', value: 5 },
],
placeholder: '请选择银行账户类型',
},
dependencies: {
disabled: (values) => {
return values.id != null;
},
triggerFields: ['id'],
},
fieldName: 'bank_account_type',
label: '银行账户类型',
rules: 'required',
},
],
showDefaultActions: false,
};

View File

@@ -0,0 +1,37 @@
import type { VbenFormProps } from '#/adapter/form';
// import dayjs from 'dayjs';
export const formOptions: VbenFormProps = {
// 默认展开
collapsed: false,
schema: [
{
component: 'VbenInput',
componentProps: {
placeholder: '输入名称',
},
defaultValue: '',
fieldName: 'name',
label: '诊所名称',
},
// {
// component: 'RangePicker',
// componentProps: {
// format: 'YYYY-MM-DD', // 确保格式与你需要的一致
// },
// // defaultValue: [dayjs().startOf('month'), dayjs()],
// fieldName: 'search_time',
// label: '时间范围',
// },
],
// 控制表单是否显示折叠按钮
showCollapseButton: true,
submitButtonOptions: {
content: '查询',
},
// 是否在字段值改变时提交表单
submitOnChange: true,
// 按下回车时是否提交表单
submitOnEnter: false,
};

View File

@@ -0,0 +1,77 @@
import type { VxeGridProps } from '#/adapter/vxe-table';
import { getStoreList } from '../api';
interface RowType {
id: string;
name: string;
logo: string;
introduce: string;
created_at: string;
}
export const gridOptions: VxeGridProps<RowType> = {
checkboxConfig: {
highlight: true,
labelField: '',
},
columnConfig: {
useKey: true,
},
rowConfig: {
useKey: true,
},
columns: [
{ type: 'checkbox', width: 60 },
{ field: 'id', align: 'left', title: 'ID', width: 100 },
{ field: 'name', align: 'left', title: '诊所名称' },
{
field: 'qr_code',
align: 'left',
title: '诊所二维码',
slots: { default: 'qr_code' },
width: 130,
},
// { field: 'erp_id', title: 'erpID' },
// { field: 'shouzimu', title: '诊所首字母' },
{ field: 'position', title: '详细地址' },
{ field: 'contact', title: '联系人' },
{ field: 'mobile', title: '联系电话' },
{ field: 'created_at', title: '注册时间' },
{ type: 'html', title: '操作', align: 'right', slots: { default: 'action' } },
],
keepSource: true,
pagerConfig: {},
proxyConfig: {
ajax: {
// 请求后端接口方法
query: async ({ page }, formValues) => {
return await getStoreList({
page: page.currentPage,
pageSize: page.pageSize,
...formValues,
});
},
},
},
height: 'auto',
border: false,
toolbarConfig: {
// 是否显示搜索表单控制按钮
// @ts-ignore 正式环境时有完整的类型声明
search: true,
refresh: true, // 刷新
print: false, // 打印
export: false, // 导出
// custom: true, // 自定义列
zoom: true, // 最大化最小化
slots: {
buttons: 'toolbar-buttons',
},
custom: {
// 自定义列-图标
icon: 'vxe-icon-menu',
},
},
showOverflow: false,
};

View File

@@ -0,0 +1,175 @@
<script lang="ts" setup>
import type { VxeGridListeners } from '#/adapter/vxe-table';
import { ref } from 'vue';
import { Page, useVbenModal } from '@vben/common-ui';
import { Button, Image, message } from 'ant-design-vue';
import { useVbenVxeGrid } from '#/adapter/vxe-table';
import { TableAction } from '#/components/table-action';
import { deleteStore, openPcWindowsApiByStore } from './api';
import FormModalDemo from './components/modal.vue';
import { formOptions } from './config/search';
import { gridOptions } from './config/table';
const hasTopTableDropDownActions = ref(false);
const gridEvents: VxeGridListeners<any> = {
checkboxChange() {
// eslint-disable-next-line no-use-before-define
const records = gridApi.grid.getCheckboxRecords();
hasTopTableDropDownActions.value = records.length > 0;
},
checkboxAll() {
// eslint-disable-next-line no-use-before-define
const records = gridApi.grid.getCheckboxRecords();
hasTopTableDropDownActions.value = records.length > 0;
},
};
const [Grid, gridApi] = useVbenVxeGrid({
formOptions,
gridOptions,
gridEvents,
});
const [FormModal, formModalApi] = useVbenModal({
connectedComponent: FormModalDemo,
});
const showModal = (data = {}, isUpdate = false) => {
formModalApi.setData({
// 表单值
values: data,
update: isUpdate,
gridApi,
});
formModalApi.open();
};
const deleteApi = (row: any) => {
let ids = [];
if (row) {
ids.push(row);
} else {
ids = gridApi.grid.getCheckboxRecords().map((item) => item.id);
}
deleteStore({ ids }).then(() => {
message.success('删除成功!');
gridApi.reload();
});
};
/**
* 开启后台账号
*/
function openPcWindows(id) {
openPcWindowsApiByStore(id).then(() => {
message.success('操作成功!');
gridApi.reload();
});
}
</script>
<template>
<Page auto-content-height title="诊所管理">
<FormModal />
<Grid>
<template #toolbar-buttons>
<TableAction
:actions="[
{
label: '新增',
type: 'primary',
icon: 'ant-design:plus-outlined',
// auth: ['超级诊所', 'sys:user:save'],
onClick: showModal.bind(null),
},
]"
:drop-down-actions="[
{
label: '删除',
icon: 'ant-design:delete-outlined',
ifShow: hasTopTableDropDownActions,
// auth: ['超级诊所', 'sys:user:save'],
popConfirm: {
title: '确定删除吗?',
confirm: deleteApi.bind(null, false),
},
},
]"
>
<template #more>
<Button style="margin-left: 16px">
批量操作
<Icon icon="ant-design:down-outlined" />
</Button>
</template>
</TableAction>
</template>
<template #qr_code="{ row }">
<Image :src="row.qr_code" height="30" width="30" />
</template>
<template #toolbar-tools></template>
<template #action="{ row }">
<TableAction
:actions="[
{
label: '编辑',
type: 'link',
icon: 'uil:edit',
size: 'small',
// auth: ['store', 'sys:role:detail'],
onClick: showModal.bind(null, row, true),
},
{
label: '删除',
type: 'link',
icon: 'ant-design:delete-outlined',
size: 'small',
// auth: ['store', 'sys:role:detail'],
popConfirm: {
title: '确定删除吗?',
confirm: deleteApi.bind(null, row.id),
},
},
]"
:drop-down-actions="[
// {
// label: '编辑',
// type: 'link',
// icon: 'ant-design:delete-outlined',
// size: 'small',
// // auth: ['store', 'sys:role:detail'],
// onClick: showModal.bind(null, row, true),
// },
// {
// label: '删除',
// type: 'link',
// icon: 'ant-design:delete-outlined',
// size: 'small',
// // auth: ['store', 'sys:role:detail'],
// popConfirm: {
// title: '确定删除吗?',
// confirm: deleteApi.bind(null, row.id),
// },
// },
{
label: '开通后台',
type: 'link',
icon: 'uil:edit',
size: 'small',
// auth: ['store', 'sys:role:detail'],
popConfirm: {
title: '确定开通后台吗?',
confirm: openPcWindows.bind(null, row.id),
},
},
]"
/>
</template>
</Grid>
</Page>
</template>