登陆页面和医院审核
Some checks failed
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
Close stale issues / stale (push) Has been cancelled

This commit is contained in:
李琦
2026-03-23 13:02:46 +08:00
parent 235cccc146
commit 8bcae19369
12 changed files with 1267 additions and 100 deletions

View File

@@ -43,59 +43,49 @@ const formSchema = computed((): VbenFormSchema[] => {
dependencies: { dependencies: {
trigger(values, form) { trigger(values, form) {
loginMethod.value = values.login_method; loginMethod.value = values.login_method;
// 切换登录方式时清空其他字段 // 切换登录方式时清空输入框
if (values.login_method === 'phone') { form.setValues({ login_value: '' });
form.setValues({ login_account: '', job_number: '' });
} else if (values.login_method === 'login_account') {
form.setValues({ username: '', job_number: '' });
} else if (values.login_method === 'job_number') {
form.setValues({ username: '', login_account: '' });
}
}, },
triggerFields: ['login_method'], triggerFields: ['login_method'],
}, },
}, },
]; ];
// 2. 根据选择动态显示输入框 // 2. 统一的登录输入框(根据登录方式动态更新 label 和 placeholder
const loginMethodValue = loginMethod.value; const loginMethodValue = loginMethod.value;
let loginLabel = '';
let loginPlaceholder = '';
let loginRules: any;
if (loginMethodValue === 'phone') { if (loginMethodValue === 'phone') {
schema.push({ loginLabel = $t('authentication.username');
component: 'VbenInput', loginPlaceholder = $t('authentication.usernameTip');
componentProps: { loginRules = z
placeholder: $t('authentication.usernameTip'), .string()
}, .min(1, { message: $t('authentication.mobileTip') })
fieldName: 'username', .refine((v) => /^\d{11}$/.test(v), {
label: $t('authentication.username'), message: $t('authentication.mobileErrortip'),
rules: z });
.string()
.min(1, { message: $t('authentication.mobileTip') })
.refine((v) => /^\d{11}$/.test(v), {
message: $t('authentication.mobileErrortip'),
}),
});
} else if (loginMethodValue === 'login_account') { } else if (loginMethodValue === 'login_account') {
schema.push({ loginLabel = '登录账号';
component: 'VbenInput', loginPlaceholder = '请输入登录账号';
componentProps: { loginRules = z.string().min(1, { message: '请输入登录账号' });
placeholder: '请输入登录账号',
},
fieldName: 'login_account',
label: '登录账号',
rules: z.string().min(1, { message: '请输入登录账号' }),
});
} else if (loginMethodValue === 'job_number') { } else if (loginMethodValue === 'job_number') {
schema.push({ loginLabel = '工号';
component: 'VbenInput', loginPlaceholder = '请输入工号';
componentProps: { loginRules = z.string().min(1, { message: '请输入工号' });
placeholder: '请输入工号',
},
fieldName: 'job_number',
label: '工号',
rules: z.string().min(1, { message: '请输入工号' }),
});
} }
schema.push({
component: 'VbenInput',
componentProps: {
placeholder: loginPlaceholder,
},
fieldName: 'login_value',
label: loginLabel,
rules: loginRules,
});
// 3. 密码输入框(常驻) // 3. 密码输入框(常驻)
schema.push({ schema.push({
component: 'VbenInputPassword', component: 'VbenInputPassword',
@@ -128,62 +118,42 @@ const formSchema = computed((): VbenFormSchema[] => {
const values = await formApi.getValues(); const values = await formApi.getValues();
const loginMethodValue = values.login_method || 'phone'; const loginMethodValue = values.login_method || 'phone';
const loginValue = values.login_value || '';
try { try {
let result; // 统一验证 login_value 字段
if (loginMethodValue === 'phone') { await formApi.validateField('login_value');
// 手机号登录:验证手机号 const isValid = await formApi.isFieldValid('login_value');
await formApi.validateField('username'); if (!isValid) {
const isPhoneReady = await formApi.isFieldValid('username'); loading.value = false;
if (!isPhoneReady) { const errorMsg = loginMethodValue === 'phone'
loading.value = false; ? '手机号格式不正确'
throw new Error('手机号格式不正确'); : loginMethodValue === 'login_account'
} ? '登录账号不能为空'
const password = await formApi.isFieldValid('password'); : '工号不能为空';
if (!password) { throw new Error(errorMsg);
loading.value = false;
throw new Error('密码不符合要求');
}
result = await sendVerificationCode({
login_method: 'phone',
username: values.username
});
} else if (loginMethodValue === 'login_account') {
// 登录账号登录:验证登录账号
await formApi.validateField('login_account');
const isAccountReady = await formApi.isFieldValid('login_account');
if (!isAccountReady) {
loading.value = false;
throw new Error('登录账号不能为空');
}
const password = await formApi.isFieldValid('password');
if (!password) {
loading.value = false;
throw new Error('密码不符合要求');
}
result = await sendVerificationCode({
login_method: 'login_account',
login_account: values.login_account
});
} else if (loginMethodValue === 'job_number') {
// 工号登录:验证工号
await formApi.validateField('job_number');
const isJobNumberReady = await formApi.isFieldValid('job_number');
if (!isJobNumberReady) {
loading.value = false;
throw new Error('工号不能为空');
}
const password = await formApi.isFieldValid('password');
if (!password) {
loading.value = false;
throw new Error('密码不符合要求');
}
result = await sendVerificationCode({
login_method: 'job_number',
job_number: values.job_number
});
} }
const password = await formApi.isFieldValid('password');
if (!password) {
loading.value = false;
throw new Error('密码不符合要求');
}
// 根据登录方式组装参数
const params: any = {
login_method: loginMethodValue,
};
if (loginMethodValue === 'phone') {
params.username = loginValue;
} else if (loginMethodValue === 'login_account') {
params.login_account = loginValue;
} else if (loginMethodValue === 'job_number') {
params.job_number = loginValue;
}
const result = await sendVerificationCode(params);
if (result) { if (result) {
if (result.need_select && result.accounts && result.accounts.length > 1) { if (result.need_select && result.accounts && result.accounts.length > 1) {
needSelectAccount.value = true; needSelectAccount.value = true;
@@ -219,20 +189,21 @@ const formSchema = computed((): VbenFormSchema[] => {
// 自定义提交处理 // 自定义提交处理
async function handleLogin(values: Recordable<any>) { async function handleLogin(values: Recordable<any>) {
const loginMethodValue = values.login_method || 'phone'; const loginMethodValue = values.login_method || 'phone';
const loginValue = values.login_value || '';
// 验证必填字段 // 验证必填字段
if (loginMethodValue === 'phone') { if (loginMethodValue === 'phone') {
if (!values.username || !/^\d{11}$/.test(values.username)) { if (!loginValue || !/^\d{11}$/.test(loginValue)) {
message.error('请输入正确的手机号'); message.error('请输入正确的手机号');
return; return;
} }
} else if (loginMethodValue === 'login_account') { } else if (loginMethodValue === 'login_account') {
if (!values.login_account || values.login_account.trim() === '') { if (!loginValue || loginValue.trim() === '') {
message.error('请输入登录账号'); message.error('请输入登录账号');
return; return;
} }
} else if (loginMethodValue === 'job_number') { } else if (loginMethodValue === 'job_number') {
if (!values.job_number || values.job_number.trim() === '') { if (!loginValue || loginValue.trim() === '') {
message.error('请输入工号'); message.error('请输入工号');
return; return;
} }
@@ -246,11 +217,11 @@ async function handleLogin(values: Recordable<any>) {
// 根据登录方式组装参数 // 根据登录方式组装参数
if (loginMethodValue === 'phone') { if (loginMethodValue === 'phone') {
loginData.phone = values.username; loginData.phone = loginValue;
} else if (loginMethodValue === 'login_account') { } else if (loginMethodValue === 'login_account') {
loginData.login_account = values.login_account; loginData.login_account = loginValue;
} else if (loginMethodValue === 'job_number') { } else if (loginMethodValue === 'job_number') {
loginData.job_number = values.job_number; loginData.job_number = loginValue;
} }
await authStore.authLogin(loginData); await authStore.authLogin(loginData);

View File

@@ -1,9 +1,11 @@
<script lang="ts" setup> <script lang="ts" setup>
import type { VxeGridListeners } from '#/adapter/vxe-table'; import type { VxeGridListeners } from '#/adapter/vxe-table';
import { ref } from 'vue'; import { computed, ref } from 'vue';
import { useRouter } from 'vue-router';
import { Page, useVbenModal } from '@vben/common-ui'; import { Page, useVbenModal } from '@vben/common-ui';
import { useUserStore } from '@vben/stores';
import { useClipboard } from '@vueuse/core'; import { useClipboard } from '@vueuse/core';
import { Button, Image, message, Switch, Tag } from 'ant-design-vue'; import { Button, Image, message, Switch, Tag } from 'ant-design-vue';
@@ -31,6 +33,19 @@ import { formOptions } from './config/search';
// 导入表格配置 // 导入表格配置
import { gridOptions } from './config/table'; import { gridOptions } from './config/table';
const userStore = useUserStore();
const router = useRouter();
// 判断是否为平台管理员user_type === 2
const isPlatformAdmin = computed(() => {
return userStore?.userInfo?.roles?.user_type === 2;
});
// 跳转到审核页面
const goToAudit = () => {
router.push('/system/store-input/audit');
};
// 是否有选中的表格行(用于控制批量操作按钮显示) // 是否有选中的表格行(用于控制批量操作按钮显示)
const hasTopTableDropDownActions = ref(false); const hasTopTableDropDownActions = ref(false);
@@ -214,6 +229,14 @@ const batchSyncDrugPrice = () => {
auth: ['Super Admin', 'Admin'], auth: ['Super Admin', 'Admin'],
onClick: showModal.bind(null), onClick: showModal.bind(null),
}, },
{
label: '审核',
type: 'default',
icon: 'ant-design:audit-outlined',
auth: ['Super Admin', 'Admin'],
ifShow: isPlatformAdmin,
onClick: goToAudit,
},
]" ]"
:drop-down-actions="[ :drop-down-actions="[
{ {

View File

@@ -0,0 +1,47 @@
import { requestClient } from '#/api/request';
const prefix = 'store-input/';
/**
* 创建录入
* @param data
*/
export async function createStoreInput(data: Record<string, any>) {
return requestClient.post<any>(`${prefix}create`, data);
}
/**
* 获取录入列表
* @param data
*/
export async function getStoreInputList(data: any) {
return requestClient.get<any>(`${prefix}list`, { params: data });
}
/**
* 获取录入详情
* @param id
*/
export async function getStoreInputDetail(id: number) {
return requestClient.get<any>(`${prefix}detail`, { params: { id } });
}
/**
* 更新录入
* @param data
*/
export async function updateStoreInput(data: Record<string, any>) {
return requestClient.post<any>(`${prefix}update`, data);
}
/**
* 审核录入
* @param data
*/
export async function auditStoreInput(data: {
id: number;
status: number; // 1=审核通过2=审核拒绝
audit_remark?: string;
}) {
return requestClient.post<any>(`${prefix}audit`, data);
}

View File

@@ -0,0 +1,147 @@
<script lang="ts" setup>
import type { VxeGridListeners } from '#/adapter/vxe-table';
import { computed, ref } from 'vue';
import { Page, useVbenModal } from '@vben/common-ui';
import { useUserStore } from '@vben/stores';
import { Button, message, Modal, Tag, Textarea } from 'ant-design-vue';
import { useVbenVxeGrid } from '#/adapter/vxe-table';
import { TableAction } from '#/components/table-action';
import { auditStoreInput, getStoreInputDetail } from './api';
import AuditModal from './components/AuditModal.vue';
import DetailModal from './components/DetailModal.vue';
import { formOptions } from './config/search';
import { auditGridOptions } from './config/table';
const userStore = useUserStore();
// 判断是否为平台管理员user_type === 2
const isPlatformAdmin = computed(() => {
return userStore?.userInfo?.roles?.user_type === 2;
});
const hasTopTableDropDownActions = ref(false);
const gridEvents: VxeGridListeners<any> = {
checkboxChange() {
const records = gridApi.grid.getCheckboxRecords();
hasTopTableDropDownActions.value = records.length > 0;
},
checkboxAll() {
const records = gridApi.grid.getCheckboxRecords();
hasTopTableDropDownActions.value = records.length > 0;
},
};
const [Grid, gridApi] = useVbenVxeGrid({
formOptions,
gridOptions: auditGridOptions,
gridEvents,
});
const [DetailModalComponent, detailModalApi] = useVbenModal({
connectedComponent: DetailModal,
});
const [AuditModalComponent, auditModalApi] = useVbenModal({
connectedComponent: AuditModal,
});
const showDetail = (row: any) => {
detailModalApi.setData({
values: row,
});
detailModalApi.open();
};
const showAudit = (row: any) => {
auditModalApi.setData({
values: row,
gridApi,
});
auditModalApi.open();
};
// 获取诊所类型颜色
const getClinicTypeColor = (type: number) => {
if (type == 1) return 'blue';
if (type == 2) return 'green';
return 'default';
};
// 获取诊所类型文本
const getClinicTypeText = (type: number) => {
if (type == 1) return '西医诊所';
if (type == 2) return '中医诊所';
return '未设置';
};
// 获取审核状态颜色
const getStatusColor = (status: number) => {
if (status == 0) return 'orange';
if (status == 1) return 'success';
return 'error';
};
// 获取审核状态文本
const getStatusText = (status: number) => {
if (status == 0) return '待审核';
if (status == 1) return '审核通过';
return '审核拒绝';
};
</script>
<template>
<Page auto-content-height title="诊所|药店信息审核">
<DetailModalComponent />
<AuditModalComponent />
<Grid>
<template #type="{ row }">
<Tag :color="row.type == 0 ? 'blue' : 'green'">
{{ row.type == 0 ? '诊所' : '药店' }}
</Tag>
</template>
<template #clinic_type="{ row }">
<Tag :color="getClinicTypeColor(row.clinic_type)">
{{ getClinicTypeText(row.clinic_type) }}
</Tag>
</template>
<template #status="{ row }">
<Tag :color="getStatusColor(row.status)">
{{ getStatusText(row.status) }}
</Tag>
</template>
<template #audit_time="{ row }">
<span v-if="row.audit_time">
{{ new Date(row.audit_time * 1000).toLocaleString() }}
</span>
<span v-else>-</span>
</template>
<template #action="{ row }">
<TableAction
:actions="[
{
label: '查看详情',
type: 'link',
icon: 'uil:eye',
size: 'small',
onClick: showDetail.bind(null, row),
},
{
label: '审核',
type: 'link',
icon: 'uil:check',
size: 'small',
ifShow: row.status === 0 && isPlatformAdmin,
onClick: showAudit.bind(null, row),
},
]"
/>
</template>
</Grid>
</Page>
</template>

View File

@@ -0,0 +1,87 @@
<script lang="ts" setup>
import { ref } from 'vue';
import { useVbenModal } from '@vben/common-ui';
import { Button, message, Modal, Radio, RadioGroup, Textarea } from 'ant-design-vue';
import { auditStoreInput } from '../api';
const [ModalComponent, modalApi] = useVbenModal({
fullscreenButton: false,
draggable: true,
onCancel() {
modalApi.close();
},
});
const auditStatus = ref<number>(1);
const auditRemark = ref<string>('');
const currentRow = ref<any>(null);
const gridApi = ref<any>(null);
const loading = ref(false);
const handleAudit = async () => {
if (!currentRow.value) {
message.error('数据错误');
return;
}
loading.value = true;
try {
await auditStoreInput({
id: currentRow.value.id,
status: auditStatus.value,
audit_remark: auditRemark.value,
});
message.success('审核成功');
gridApi.value?.reload();
modalApi.close();
// 重置表单
auditStatus.value = 1;
auditRemark.value = '';
} catch (error) {
console.error('审核失败:', error);
message.error('审核失败,请稍后重试');
} finally {
loading.value = false;
}
};
modalApi.onOpenChange = (isOpen: boolean) => {
if (isOpen) {
const { values, gridApi: api } = modalApi.getData<Record<string, any>>();
currentRow.value = values;
gridApi.value = api;
auditStatus.value = 1;
auditRemark.value = '';
}
};
</script>
<template>
<ModalComponent
title="审核录入信息"
class="w-[500px]"
:confirm-loading="loading"
@confirm="handleAudit"
>
<div class="p-4 space-y-4">
<div>
<div class="mb-2 font-semibold">审核结果</div>
<RadioGroup v-model:value="auditStatus">
<Radio :value="1">审核通过</Radio>
<Radio :value="2">审核拒绝</Radio>
</RadioGroup>
</div>
<div>
<div class="mb-2 font-semibold">审核备注</div>
<Textarea
v-model:value="auditRemark"
:rows="4"
placeholder="请输入审核备注(可选)"
/>
</div>
</div>
</ModalComponent>
</template>

View File

@@ -0,0 +1,110 @@
<script lang="ts" setup>
import { ref } from 'vue';
import { useVbenModal } from '@vben/common-ui';
import { Descriptions, DescriptionsItem, Image } from 'ant-design-vue';
import { getStoreInputDetail } from '../api';
const [Modal, modalApi] = useVbenModal({
fullscreenButton: false,
draggable: true,
onCancel() {
modalApi.close();
},
});
const detailData = ref<any>(null);
const loading = ref(false);
const loadDetail = async (id: number) => {
loading.value = true;
try {
const res = await getStoreInputDetail(id);
detailData.value = res;
} catch (error) {
console.error('获取详情失败:', error);
} finally {
loading.value = false;
}
};
modalApi.onOpenChange = async (isOpen: boolean) => {
if (isOpen) {
const { values } = modalApi.getData<Record<string, any>>();
if (values?.id) {
await loadDetail(values.id);
} else {
detailData.value = values;
}
}
};
</script>
<template>
<Modal title="录入详情" class="w-[70%]">
<div v-if="detailData" class="p-4">
<Descriptions :column="2" bordered>
<DescriptionsItem label="ID">{{ detailData.id }}</DescriptionsItem>
<DescriptionsItem label="名称">{{ detailData.name }}</DescriptionsItem>
<DescriptionsItem label="类型">
{{ detailData.type === 0 ? '诊所' : '药店' }}
</DescriptionsItem>
<DescriptionsItem label="诊所类型">
{{ detailData.clinic_type === 1 ? '西医诊所' : detailData.clinic_type === 2 ? '中医诊所' : '未设置' }}
</DescriptionsItem>
<DescriptionsItem label="联系人">{{ detailData.contact }}</DescriptionsItem>
<DescriptionsItem label="联系电话">{{ detailData.mobile }}</DescriptionsItem>
<DescriptionsItem label="省市区">
{{ detailData.province?.name }} {{ detailData.city?.name }}
</DescriptionsItem>
<DescriptionsItem label="详细地址">{{ detailData.position }}</DescriptionsItem>
<DescriptionsItem label="录入人">{{ detailData.inputUser?.nick_name }}</DescriptionsItem>
<DescriptionsItem label="审核状态">
<span :class="{
'text-orange-500': detailData.status === 0,
'text-green-500': detailData.status === 1,
'text-red-500': detailData.status === 2,
}">
{{ detailData.status === 0 ? '待审核' : detailData.status === 1 ? '审核通过' : '审核拒绝' }}
</span>
</DescriptionsItem>
<DescriptionsItem label="审核人" v-if="detailData.auditAdmin">
{{ detailData.auditAdmin.nick_name }}
</DescriptionsItem>
<DescriptionsItem label="审核时间" v-if="detailData.audit_time">
{{ new Date(detailData.audit_time * 1000).toLocaleString() }}
</DescriptionsItem>
<DescriptionsItem label="审核备注" v-if="detailData.audit_remark" :span="2">
{{ detailData.audit_remark }}
</DescriptionsItem>
<DescriptionsItem label="轮播图" v-if="detailData.url && detailData.url.length > 0" :span="2">
<div class="flex flex-wrap gap-2">
<Image
v-for="(url, index) in detailData.url"
:key="index"
:src="url"
:width="100"
:height="100"
:preview="true"
/>
</div>
</DescriptionsItem>
<DescriptionsItem label="合同文件" v-if="detailData.contract_files && detailData.contract_files.length > 0" :span="2">
<div class="flex flex-col gap-2">
<a
v-for="(file, index) in detailData.contract_files"
:key="index"
:href="file.file_url"
target="_blank"
class="text-blue-500 hover:underline"
>
{{ file.file_name || '合同文件' }}
</a>
</div>
</DescriptionsItem>
</Descriptions>
</div>
</Modal>
</template>

View File

@@ -0,0 +1,80 @@
<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-input/config/form';
import { createStoreInput, getStoreInputDetail, updateStoreInput } from '../api';
import dayjs from 'dayjs';
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 ? updateStoreInput : createStoreInput;
submitApi(values)
.then(() => {
message.success(isUpdate.value ? '更新成功' : '录入成功');
gridApi.value?.reload();
modalApi.close();
})
.finally(() => {
modalApi.setState({ loading: false, confirmLoading: false });
});
}
});
await formApi.validateAndSubmitForm();
},
async 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.address = [values.province_id, values.city_id];
// 处理合同文件
if (values.contract_files && Array.isArray(values.contract_files)) {
values.contract_files = values.contract_files.map((file: any) => {
if (typeof file === 'string') {
return { url: file, name: file.split('/').pop() || '合同文件' };
}
return file;
});
}
formApi.setValues({
...values,
start_time: dayjs(values.start_time || '08:00', 'HH:mm'),
end_time: dayjs(values.end_time || '20:00', 'HH:mm'),
subscribe_price_change: values.subscribe_price_change ?? 0,
});
} else {
isUpdate.value = false;
}
}
},
});
</script>
<template>
<Modal :title="`${isUpdate === true ? '编辑' : '新增'}录入`" class="w-[50%]">
<Form />
</Modal>
</template>

View File

@@ -0,0 +1,315 @@
import type { VbenFormProps } from '#/adapter/form';
import { addressOption } from '#/util/address.ts';
// 诊所|药店信息录入表单配置
export const modalFormProps: VbenFormProps = {
wrapperClass: 'grid-cols-12',
commonConfig: {
formItemClass: 'col-span-12',
componentProps: {
class: 'w-full',
},
},
layout: 'horizontal',
schema: [
{
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: 'Input',
fieldName: 'type',
dependencies: {
show: false,
triggerFields: ['id'],
},
defaultValue: 0,
},
{
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: 1 },
{ label: '中医诊所', value: 2 },
],
placeholder: '诊所类型',
},
fieldName: 'clinic_type',
label: '诊所类型',
rules: 'required',
defaultValue: 2,
},
{
component: 'RadioGroup',
formItemClass: 'col-span-6',
componentProps: {
options: [
{ label: '订阅价格波动', value: 0 },
{ label: '不订阅价格波动', value: 1 },
],
placeholder: '是否订阅价格波动',
},
fieldName: 'subscribe_price_change',
label: '是否订阅价格波动',
defaultValue: 0,
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,
},
},
{
component: 'UploadImage',
fieldName: 'contract_files',
label: '合同文件',
componentProps: {
maxCount: 10,
accept: '.pdf,.doc,.docx,.jpg,.jpeg,.png',
},
},
{
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: () => '%',
defaultValue: 100,
},
{
component: 'InputNumber',
formItemClass: 'col-span-6',
componentProps: {
placeholder: '请输入中药销售比例',
},
fieldName: 'z_sale_percent',
label: '中药销售比例',
rules: 'required',
suffix: () => '%',
defaultValue: 100,
},
{
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: '请选择银行账户类型',
},
fieldName: 'bank_account_type',
label: '银行账户类型',
rules: 'required',
},
],
showDefaultActions: false,
};

View File

@@ -0,0 +1,47 @@
import type { VbenFormProps } from '#/adapter/form';
export const formOptions: VbenFormProps = {
wrapperClass: 'grid-cols-12',
commonConfig: {
formItemClass: 'col-span-12',
componentProps: {
class: 'w-full',
},
},
layout: 'horizontal',
schema: [
{
component: 'VbenInput',
formItemClass: 'col-span-6',
componentProps: {
placeholder: '请输入诊所/药店名称',
},
fieldName: 'name',
label: '诊所/药店名称',
},
{
component: 'VbenInput',
formItemClass: 'col-span-6',
componentProps: {
placeholder: '请输入联系电话',
},
fieldName: 'mobile',
label: '联系电话',
},
{
component: 'Select',
formItemClass: 'col-span-6',
componentProps: {
placeholder: '请选择审核状态',
options: [
{ label: '待审核', value: 0 },
{ label: '审核通过', value: 1 },
{ label: '审核拒绝', value: 2 },
],
},
fieldName: 'status',
label: '审核状态',
},
],
showDefaultActions: false,
};

View File

@@ -0,0 +1,175 @@
import type { VxeGridProps } from '#/adapter/vxe-table';
import { getStoreInputList } from '../api';
interface RowType {
id: number;
name: string;
type: number;
clinic_type: number;
status: number;
input_user_id: number;
inputUser: {
nick_name: string;
};
auditAdmin: {
nick_name: string;
};
audit_time: number;
created_at: string;
}
// 录入列表表格配置
export const inputGridOptions: 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: 'type',
align: 'left',
title: '类型',
width: 100,
slots: { default: 'type' },
},
{
field: 'clinic_type',
align: 'left',
title: '诊所类型',
width: 120,
slots: { default: 'clinic_type' },
},
{
field: 'status',
align: 'left',
title: '审核状态',
width: 120,
slots: { default: 'status' },
},
{ field: 'contact', title: '联系人' },
{ field: 'mobile', title: '联系电话' },
{ field: 'position', title: '详细地址' },
{ field: 'created_at', title: '录入时间' },
{
type: 'html',
title: '操作',
align: 'right',
slots: { default: 'action' },
},
],
keepSource: true,
pagerConfig: {},
proxyConfig: {
ajax: {
query: async ({ page }, formValues) => {
return await getStoreInputList({
page: page.currentPage,
pageSize: page.pageSize,
...formValues,
});
},
},
},
height: 'auto',
border: false,
toolbarConfig: {
search: true,
refresh: true,
print: false,
export: false,
zoom: true,
slots: {
buttons: 'toolbar-buttons',
},
},
showOverflow: false,
};
// 审核列表表格配置
export const auditGridOptions: 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: 'type',
align: 'left',
title: '类型',
width: 100,
slots: { default: 'type' },
},
{
field: 'clinic_type',
align: 'left',
title: '诊所类型',
width: 120,
slots: { default: 'clinic_type' },
},
{
field: 'status',
align: 'left',
title: '审核状态',
width: 120,
slots: { default: 'status' },
},
{ field: 'inputUser.nick_name', title: '录入人' },
{ field: 'auditAdmin.nick_name', title: '审核人' },
{ field: 'audit_time', title: '审核时间', slots: { default: 'audit_time' } },
{ field: 'contact', title: '联系人' },
{ field: 'mobile', title: '联系电话' },
{ field: 'position', title: '详细地址' },
{ field: 'created_at', title: '录入时间' },
{
type: 'html',
title: '操作',
align: 'right',
slots: { default: 'action' },
},
],
keepSource: true,
pagerConfig: {},
proxyConfig: {
ajax: {
query: async ({ page }, formValues) => {
return await getStoreInputList({
page: page.currentPage,
pageSize: page.pageSize,
...formValues,
});
},
},
},
height: 'auto',
border: false,
toolbarConfig: {
search: true,
refresh: true,
print: false,
export: false,
zoom: true,
slots: {
buttons: 'toolbar-buttons',
},
},
showOverflow: false,
};

View File

@@ -0,0 +1,150 @@
<script lang="ts" setup>
import type { VxeGridListeners } from '#/adapter/vxe-table';
import { computed, ref } from 'vue';
import { Page, useVbenModal } from '@vben/common-ui';
import { useUserStore } from '@vben/stores';
import { Button, message, Tag } from 'ant-design-vue';
import { useVbenVxeGrid } from '#/adapter/vxe-table';
import { TableAction } from '#/components/table-action';
import {
createStoreInput,
getStoreInputDetail,
updateStoreInput,
} from './api';
import FormModalDemo from './components/modal.vue';
import { formOptions } from './config/search';
import { inputGridOptions } from './config/table';
const userStore = useUserStore();
const hasTopTableDropDownActions = ref(false);
const gridEvents: VxeGridListeners<any> = {
checkboxChange() {
const records = gridApi.grid.getCheckboxRecords();
hasTopTableDropDownActions.value = records.length > 0;
},
checkboxAll() {
const records = gridApi.grid.getCheckboxRecords();
hasTopTableDropDownActions.value = records.length > 0;
},
};
const [Grid, gridApi] = useVbenVxeGrid({
formOptions,
gridOptions: inputGridOptions,
gridEvents,
});
const [FormModal, formModalApi] = useVbenModal({
connectedComponent: FormModalDemo,
});
const showModal = (data = {}, isUpdate = false) => {
formModalApi.setData({
values: data,
update: isUpdate,
gridApi,
});
formModalApi.open();
};
// 获取类型颜色
const getTypeColor = (type: number) => {
return type == 0 ? 'blue' : 'green';
};
// 获取类型文本
const getTypeText = (type: number) => {
return type == 0 ? '诊所' : '药店';
};
// 获取诊所类型颜色
const getClinicTypeColor = (type: number) => {
if (type == 1) return 'blue';
if (type == 2) return 'green';
return 'default';
};
// 获取诊所类型文本
const getClinicTypeText = (type: number) => {
if (type == 1) return '西医诊所';
if (type == 2) return '中医诊所';
return '未设置';
};
// 获取审核状态颜色
const getStatusColor = (status: number) => {
if (status == 0) return 'orange';
if (status == 1) return 'success';
return 'error';
};
// 获取审核状态文本
const getStatusText = (status: number) => {
if (status == 0) return '待审核';
if (status == 1) return '审核通过';
return '审核拒绝';
};
</script>
<template>
<Page auto-content-height title="诊所|药店信息录入">
<FormModal />
<Grid>
<template #toolbar-buttons>
<TableAction
:actions="[
{
label: '新增录入',
type: 'primary',
icon: 'ant-design:plus-outlined',
onClick: showModal.bind(null),
},
]"
/>
</template>
<template #type="{ row }">
<Tag :color="getTypeColor(row.type)">
{{ getTypeText(row.type) }}
</Tag>
</template>
<template #clinic_type="{ row }">
<Tag :color="getClinicTypeColor(row.clinic_type)">
{{ getClinicTypeText(row.clinic_type) }}
</Tag>
</template>
<template #status="{ row }">
<Tag :color="getStatusColor(row.status)">
{{ getStatusText(row.status) }}
</Tag>
</template>
<template #action="{ row }">
<TableAction
:actions="[
{
label: '查看',
type: 'link',
icon: 'uil:eye',
size: 'small',
onClick: showModal.bind(null, row, false),
},
{
label: '编辑',
type: 'link',
icon: 'uil:edit',
size: 'small',
ifShow: row.status === 0,
onClick: showModal.bind(null, row, true),
},
]"
/>
</template>
</Grid>
</Page>
</template>

View File

@@ -2,6 +2,7 @@
import type { VxeGridListeners } from '#/adapter/vxe-table'; import type { VxeGridListeners } from '#/adapter/vxe-table';
import { computed, ref } from 'vue'; import { computed, ref } from 'vue';
import { useRouter } from 'vue-router';
import { Page, useVbenModal } from '@vben/common-ui'; import { Page, useVbenModal } from '@vben/common-ui';
import { useUserStore } from '@vben/stores'; import { useUserStore } from '@vben/stores';
@@ -30,12 +31,18 @@ import { formOptions } from './config/search';
import { gridOptions } from './config/table'; import { gridOptions } from './config/table';
const userStore = useUserStore(); const userStore = useUserStore();
const router = useRouter();
// 判断是否为平台管理员user_type === 2 // 判断是否为平台管理员user_type === 2
const isPlatformAdmin = computed(() => { const isPlatformAdmin = computed(() => {
return userStore?.userInfo?.roles?.user_type === 2; return userStore?.userInfo?.roles?.user_type === 2;
}); });
// 跳转到审核页面
const goToAudit = () => {
router.push('/system/store-input/audit');
};
const hasTopTableDropDownActions = ref(false); const hasTopTableDropDownActions = ref(false);
const gridEvents: VxeGridListeners<any> = { const gridEvents: VxeGridListeners<any> = {
@@ -239,6 +246,14 @@ const handleSwitchClinicType = (row: any) => {
auth: ['Super Admin', 'Admin'], auth: ['Super Admin', 'Admin'],
onClick: showModal.bind(null), onClick: showModal.bind(null),
}, },
{
label: '审核',
type: 'default',
icon: 'ant-design:audit-outlined',
auth: ['Super Admin', 'Admin'],
ifShow: isPlatformAdmin,
onClick: goToAudit,
},
]" ]"
:drop-down-actions="[ :drop-down-actions="[
{ {