转接方
Some checks failed
Close stale issues / stale (push) Has been cancelled
CI / Test (ubuntu-latest) (push) Has been cancelled
CI / Test (windows-latest) (push) Has been cancelled
CI / Lint (ubuntu-latest) (push) Has been cancelled
CI / Lint (windows-latest) (push) Has been cancelled
CI / Check (ubuntu-latest) (push) Has been cancelled
CI / Check (windows-latest) (push) Has been cancelled
CodeQL / Analyze (javascript-typescript) (push) Has been cancelled
Deploy Website on push / Deploy Push Playground Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Docs Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Antd Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Element Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Naive Ftp (push) Has been cancelled
Release Drafter / update_release_draft (push) Has been cancelled
CI / CI OK (push) Has been cancelled
Lock Threads / action (push) Has been cancelled
Issue Close Require / close-issues (push) Has been cancelled

This commit is contained in:
李琦
2026-02-04 08:53:52 +08:00
parent 4c03953127
commit 37d42263a8
22 changed files with 2120 additions and 97 deletions

View File

@@ -149,3 +149,11 @@ export async function batchSyncDrugPriceApi(ids: number[]) {
ids,
});
}
/**
* 更新诊所类型
* @param data 包含id和clinic_type的对象,clinic_type: 1=西医诊所, 2=中医诊所
*/
export async function updateClinicTypeApi(data: { id: number; clinic_type: number }) {
return requestClient.post<any>(`${prefix}update-clinic-type`, data);
}

View File

@@ -106,6 +106,22 @@ export const modalFormProps: VbenFormProps = {
label: '是否包邮',
rules: 'required',
},
{
// 诊所类型(单选)
component: 'RadioGroup',
formItemClass: 'col-span-6',
componentProps: {
options: [
{ label: '西医诊所', value: 1 },
{ label: '中医诊所', value: 2 },
],
placeholder: '诊所类型',
},
fieldName: 'clinic_type',
label: '诊所类型',
rules: 'required',
defaultValue: 2, // 默认中医诊所
},
{
// 是否订阅价格波动(单选,新增和编辑时都显示)
component: 'RadioGroup',

View File

@@ -25,6 +25,13 @@ export const gridOptions: VxeGridProps<RowType> = {
{ type: 'checkbox', width: 60 },
{ field: 'id', align: 'left', title: 'ID', width: 100 },
{ field: 'name', align: 'left', title: '诊所名称' },
{
field: 'clinic_type',
align: 'left',
title: '诊所类型',
width: 120,
slots: { default: 'clinic_type' },
},
{
field: 'online_consultation_config',
align: 'left',

View File

@@ -7,7 +7,7 @@ import { Page, useVbenModal } from '@vben/common-ui';
import { useUserStore } from '@vben/stores';
import { useClipboard } from '@vueuse/core';
import { Button, Image, message, Switch, Tag } from 'ant-design-vue';
import { Button, Image, message, Modal, Switch, Tag } from 'ant-design-vue';
import { useVbenVxeGrid } from '#/adapter/vxe-table';
import { Icon } from '#/components/icon';
@@ -19,6 +19,7 @@ import {
deleteStore,
openPcWindowsApiByStore,
openQrCodeApi,
updateClinicTypeApi,
updateStoreShippingFree,
updateStoreSubscribeStatus,
} from './api';
@@ -189,6 +190,36 @@ const batchSyncDrugPrice = () => {
message.error('批量同步失败!');
});
};
/**
* 切换诊所类型
*/
const handleSwitchClinicType = (row: any) => {
if (!row) return;
const currentType = row.clinic_type || 2; // 默认为中医诊所
const newType = currentType === 1 ? 2 : 1;
const currentTypeText = currentType === 1 ? '西医诊所' : '中医诊所';
const newTypeText = newType === 1 ? '西医诊所' : '中医诊所';
const clinicName = row.name || '该诊所';
Modal.confirm({
title: '确认切换诊所类型',
content: `确定要将【${clinicName}】的诊所类型从【${currentTypeText}】切换为【${newTypeText}】吗?`,
okText: '确定',
cancelText: '取消',
onOk: async () => {
try {
await updateClinicTypeApi({ id: row.id, clinic_type: newType });
message.success(`诊所类型已切换为【${newTypeText}】`);
gridApi.query();
} catch (error) {
console.error('切换诊所类型失败:', error);
message.error('切换失败,请稍后重试');
}
}
});
};
</script>
<template>
@@ -268,6 +299,15 @@ const batchSyncDrugPrice = () => {
</template>
<template #type="{ row }">
</template>
<template #clinic_type="{ row }">
<Tag
:color="row.clinic_type === 1 ? 'blue' : row.clinic_type === 2 ? 'green' : 'default'"
class="clinic-type-tag cursor-pointer"
@click="handleSwitchClinicType(row)"
>
{{ row.clinic_type === 1 ? '西医诊所' : row.clinic_type === 2 ? '中医诊所' : '未设置' }}
</Tag>
</template>
<template #online_consultation_config="{ row }">
<div
v-if="row.is_internet_medical === 1 && row.online_consultation_doctor_name"
@@ -398,4 +438,19 @@ const batchSyncDrugPrice = () => {
.qr_code:hover {
cursor: pointer;
}
/* 诊所类型标签样式 */
.clinic-type-tag {
transition: all 0.2s ease;
user-select: none;
&:hover {
opacity: 0.8;
transform: scale(1.05);
}
&:active {
transform: scale(0.95);
}
}
</style>