1. 推广员功能增强
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
CI / CI OK (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
Lock Threads / action (push) Has been cancelled
Issue Close Require / close-issues (push) Has been cancelled
Close stale issues / stale (push) Has been cancelled
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
CI / CI OK (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
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:
@@ -26,6 +26,7 @@ export const ADMIN_ROLE_LIST: AdminRoleMeta[] = [
|
||||
{ id: 9, title: '诊所员工', slug: 'clinic-staff', formType: 'clinic' },
|
||||
{ id: 10, title: '医生', slug: 'doctor', formType: 'doctor' },
|
||||
{ id: 11, title: '药师', slug: 'pharmacist', formType: 'pharmacist' },
|
||||
{ id: 14, title: '诊所推广员', slug: 'clinic-salesperson', formType: 'clinic' },
|
||||
];
|
||||
|
||||
export const ROLE_CITY_MANAGER = 4;
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
<script lang="ts" setup>
|
||||
import AdminPage from '../_shared/admin-page.vue';
|
||||
</script>
|
||||
<template>
|
||||
<AdminPage :role-id="14" />
|
||||
</template>
|
||||
27
apps/web-antd/src/views/system/doctor-input/api/index.ts
Normal file
27
apps/web-antd/src/views/system/doctor-input/api/index.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
const prefix = 'doctor-input/';
|
||||
|
||||
export async function createDoctorInput(data: Record<string, any>) {
|
||||
return requestClient.post<any>(`${prefix}create`, data);
|
||||
}
|
||||
|
||||
export async function getDoctorInputList(data: any) {
|
||||
return requestClient.get<any>(`${prefix}list`, { params: data });
|
||||
}
|
||||
|
||||
export async function getDoctorInputDetail(id: number) {
|
||||
return requestClient.get<any>(`${prefix}detail`, { params: { id } });
|
||||
}
|
||||
|
||||
export async function updateDoctorInput(data: Record<string, any>) {
|
||||
return requestClient.post<any>(`${prefix}update`, data);
|
||||
}
|
||||
|
||||
export async function auditDoctorInput(data: {
|
||||
id: number;
|
||||
status: number;
|
||||
audit_remark?: string;
|
||||
}) {
|
||||
return requestClient.post<any>(`${prefix}audit`, data);
|
||||
}
|
||||
128
apps/web-antd/src/views/system/doctor-input/audit.vue
Normal file
128
apps/web-antd/src/views/system/doctor-input/audit.vue
Normal file
@@ -0,0 +1,128 @@
|
||||
<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 { Tag } from 'ant-design-vue';
|
||||
|
||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import { TableAction } from '#/components/table-action';
|
||||
|
||||
import AuditModal from './components/AuditModal.vue';
|
||||
import DetailModal from './components/DetailModal.vue';
|
||||
import { auditFormOptions } from './config/search';
|
||||
import { auditGridOptions } from './config/table';
|
||||
|
||||
const userStore = useUserStore();
|
||||
|
||||
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: auditFormOptions,
|
||||
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 getTypeText = (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>{{ getTypeText(row.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>
|
||||
@@ -0,0 +1,86 @@
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue';
|
||||
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
|
||||
import { message, Radio, RadioGroup, Textarea } from 'ant-design-vue';
|
||||
|
||||
import { auditDoctorInput } 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 auditDoctorInput({
|
||||
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="space-y-4 p-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>
|
||||
@@ -0,0 +1,146 @@
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue';
|
||||
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
|
||||
import { Avatar, Descriptions, DescriptionsItem, Image, Spin, message } from 'ant-design-vue';
|
||||
|
||||
import { getDoctorInputDetail } from '../api';
|
||||
import {
|
||||
inputUserDisplayName,
|
||||
normalizeInputUser,
|
||||
resolveAvatarUrl,
|
||||
} from '../../store-input/utils/inputUser';
|
||||
|
||||
const detailData = ref<any>(null);
|
||||
const loading = ref(false);
|
||||
|
||||
const getTypeText = (type: number) => {
|
||||
if (type === 1) return '中医医生';
|
||||
if (type === 2) return '西医医生';
|
||||
return '-';
|
||||
};
|
||||
|
||||
const getSignTypeText = (signType: number) => {
|
||||
if (signType === 1) return '电子签名';
|
||||
if (signType === 2) return '手写签名';
|
||||
return '-';
|
||||
};
|
||||
|
||||
const loadDetail = async (id: number) => {
|
||||
loading.value = true;
|
||||
detailData.value = null;
|
||||
try {
|
||||
const res = await getDoctorInputDetail(id);
|
||||
detailData.value = res;
|
||||
normalizeInputUser(detailData.value);
|
||||
} catch (error) {
|
||||
console.error('获取详情失败:', error);
|
||||
message.error('获取详情失败');
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
const [Modal, modalApi] = useVbenModal({
|
||||
fullscreenButton: false,
|
||||
draggable: true,
|
||||
onCancel() {
|
||||
modalApi.close();
|
||||
},
|
||||
async onOpenChange(isOpen: boolean) {
|
||||
if (!isOpen) {
|
||||
detailData.value = null;
|
||||
loading.value = false;
|
||||
return;
|
||||
}
|
||||
const { values } = modalApi.getData<Record<string, any>>();
|
||||
if (values?.id) {
|
||||
await loadDetail(values.id);
|
||||
} else {
|
||||
detailData.value = values || null;
|
||||
normalizeInputUser(detailData.value);
|
||||
}
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Modal title="医生预填详情" class="w-[70%]">
|
||||
<Spin :spinning="loading">
|
||||
<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.mobile }}</DescriptionsItem>
|
||||
<DescriptionsItem label="身份证">{{ detailData.idcard }}</DescriptionsItem>
|
||||
<DescriptionsItem label="身份">{{ getTypeText(detailData.type) }}</DescriptionsItem>
|
||||
<DescriptionsItem label="签名类型">{{ getSignTypeText(detailData.sign_type) }}</DescriptionsItem>
|
||||
<DescriptionsItem label="科室">{{ detailData.depart?.name || '-' }}</DescriptionsItem>
|
||||
<DescriptionsItem label="职称">{{ detailData.titleInfo?.name || '-' }}</DescriptionsItem>
|
||||
<DescriptionsItem label="擅长" :span="2">{{ detailData.good_at }}</DescriptionsItem>
|
||||
<DescriptionsItem label="简介" :span="2">{{ detailData.intro }}</DescriptionsItem>
|
||||
<DescriptionsItem label="录入人">
|
||||
<div class="flex items-center gap-2">
|
||||
<Avatar
|
||||
v-if="resolveAvatarUrl(detailData.inputUser?.avatar)"
|
||||
:src="resolveAvatarUrl(detailData.inputUser?.avatar)"
|
||||
:size="40"
|
||||
/>
|
||||
<Avatar v-else :size="40">{{ inputUserDisplayName(detailData.inputUser).charAt(0) }}</Avatar>
|
||||
<span>{{ inputUserDisplayName(detailData.inputUser) }}</span>
|
||||
</div>
|
||||
</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 v-if="detailData.auditAdmin" label="审核人">
|
||||
{{ detailData.auditAdmin.nick_name }}
|
||||
</DescriptionsItem>
|
||||
<DescriptionsItem v-if="detailData.audit_time" label="审核时间">
|
||||
{{ new Date(detailData.audit_time * 1000).toLocaleString() }}
|
||||
</DescriptionsItem>
|
||||
<DescriptionsItem v-if="detailData.audit_remark" label="审核备注" :span="2">
|
||||
{{ detailData.audit_remark }}
|
||||
</DescriptionsItem>
|
||||
<DescriptionsItem v-if="detailData.avatar" label="头像" :span="2">
|
||||
<Image :src="detailData.avatar" :width="100" :height="100" :preview="true" />
|
||||
</DescriptionsItem>
|
||||
<DescriptionsItem v-if="detailData.qualification" label="资格证书" :span="2">
|
||||
<Image :src="detailData.qualification" :width="100" :height="100" :preview="true" />
|
||||
</DescriptionsItem>
|
||||
<DescriptionsItem v-if="detailData.practicing" label="执业证书" :span="2">
|
||||
<Image :src="detailData.practicing" :width="100" :height="100" :preview="true" />
|
||||
</DescriptionsItem>
|
||||
<DescriptionsItem v-if="detailData.title" label="职称证书" :span="2">
|
||||
<Image :src="detailData.title" :width="100" :height="100" :preview="true" />
|
||||
</DescriptionsItem>
|
||||
<DescriptionsItem v-if="detailData.card_up" label="身份证正面" :span="2">
|
||||
<Image :src="detailData.card_up" :width="100" :height="100" :preview="true" />
|
||||
</DescriptionsItem>
|
||||
<DescriptionsItem v-if="detailData.card_down" label="身份证反面" :span="2">
|
||||
<Image :src="detailData.card_down" :width="100" :height="100" :preview="true" />
|
||||
</DescriptionsItem>
|
||||
<DescriptionsItem v-if="detailData.sign_image" label="签名图片" :span="2">
|
||||
<Image :src="detailData.sign_image" :width="100" :height="100" :preview="true" />
|
||||
</DescriptionsItem>
|
||||
</Descriptions>
|
||||
</div>
|
||||
<div v-else-if="!loading" class="p-8 text-center text-gray-400">暂无详情数据</div>
|
||||
</Spin>
|
||||
</Modal>
|
||||
</template>
|
||||
@@ -0,0 +1,78 @@
|
||||
<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 {
|
||||
createDoctorInput,
|
||||
getDoctorInputDetail,
|
||||
updateDoctorInput,
|
||||
} from '../api';
|
||||
import { modalFormProps } from '../config/form';
|
||||
|
||||
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 ? updateDoctorInput : createDoctorInput;
|
||||
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?.id) {
|
||||
isUpdate.value = update;
|
||||
if (update) {
|
||||
const detail = await getDoctorInputDetail(values.id);
|
||||
formApi.setValues({
|
||||
...detail,
|
||||
stores: detail.store_ids || [],
|
||||
});
|
||||
} else {
|
||||
formApi.setValues({
|
||||
...values,
|
||||
stores: values.store_ids || [],
|
||||
});
|
||||
}
|
||||
} else {
|
||||
isUpdate.value = false;
|
||||
formApi.resetForm();
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Modal :title="`${isUpdate ? '编辑' : '新增'}医生预填`" class="w-[60%]">
|
||||
<Form />
|
||||
</Modal>
|
||||
</template>
|
||||
228
apps/web-antd/src/views/system/doctor-input/config/form.ts
Normal file
228
apps/web-antd/src/views/system/doctor-input/config/form.ts
Normal file
@@ -0,0 +1,228 @@
|
||||
import type { VbenFormProps } from '#/adapter/form';
|
||||
|
||||
import { getDepartOptionApi } from '#/views/doctor/doctor/api';
|
||||
import { getDoctorTitleOptionApi } from '#/views/doctor/pharmacist/api';
|
||||
import { getStoreOption } from '#/views/system/store/api';
|
||||
|
||||
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: 'ApiSelect',
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
filterOption: (input: string, option: any) =>
|
||||
option?.label.toLowerCase().indexOf(input.toLowerCase()) >= 0,
|
||||
showSearch: true,
|
||||
afterFetch: (data: { id: number; name: string }[]) =>
|
||||
data.map((item: any) => ({
|
||||
label: item.name,
|
||||
value: item.id,
|
||||
})),
|
||||
api: getStoreOption,
|
||||
placeholder: '请选择诊所',
|
||||
mode: 'multiple',
|
||||
},
|
||||
fieldName: 'stores',
|
||||
formItemClass: 'col-span-12',
|
||||
label: '关联诊所',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
component: 'Avatar',
|
||||
componentProps: {
|
||||
placeholder: '请上传医生头像',
|
||||
},
|
||||
fieldName: 'avatar',
|
||||
formItemClass: 'col-span-12',
|
||||
label: '医生头像',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
component: 'ApiSelect',
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
afterFetch: (data: { id: number; name: string }[]) =>
|
||||
data.map((item: any) => ({
|
||||
label: item.name,
|
||||
value: item.id,
|
||||
})),
|
||||
api: getDoctorTitleOptionApi,
|
||||
placeholder: '请选择职称',
|
||||
},
|
||||
fieldName: 'title_id',
|
||||
formItemClass: 'col-span-6',
|
||||
label: '职称',
|
||||
},
|
||||
{
|
||||
component: 'ApiSelect',
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
afterFetch: (data: { id: number; name: string }[]) =>
|
||||
data.map((item: any) => ({
|
||||
label: item.name,
|
||||
value: item.id,
|
||||
})),
|
||||
api: getDepartOptionApi,
|
||||
placeholder: '请选择科室',
|
||||
},
|
||||
fieldName: 'depart_id',
|
||||
formItemClass: 'col-span-6',
|
||||
label: '科室',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
component: 'VbenInput',
|
||||
componentProps: {
|
||||
placeholder: '请填写医生名称',
|
||||
},
|
||||
fieldName: 'name',
|
||||
formItemClass: 'col-span-6',
|
||||
label: '医生名称',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
component: 'VbenInput',
|
||||
componentProps: {
|
||||
placeholder: '请填写手机号码',
|
||||
},
|
||||
fieldName: 'mobile',
|
||||
formItemClass: 'col-span-6',
|
||||
label: '手机号码',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
component: 'VbenInput',
|
||||
componentProps: {
|
||||
placeholder: '请填写身份证',
|
||||
},
|
||||
fieldName: 'idcard',
|
||||
formItemClass: 'col-span-6',
|
||||
label: '身份证',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
component: 'VbenSelect',
|
||||
componentProps: {
|
||||
placeholder: '请选择身份',
|
||||
options: [
|
||||
{ label: '中医医生', value: 1 },
|
||||
{ label: '西医医生', value: 2 },
|
||||
],
|
||||
},
|
||||
fieldName: 'type',
|
||||
formItemClass: 'col-span-6',
|
||||
label: '身份',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
component: 'VbenSelect',
|
||||
componentProps: {
|
||||
placeholder: '请选择签名类型',
|
||||
options: [
|
||||
{ label: '电子签名', value: 1 },
|
||||
{ label: '手写签名', value: 2 },
|
||||
],
|
||||
},
|
||||
fieldName: 'sign_type',
|
||||
formItemClass: 'col-span-6',
|
||||
label: '签名类型',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
component: 'Textarea',
|
||||
componentProps: {
|
||||
placeholder: '请输入擅长',
|
||||
},
|
||||
fieldName: 'good_at',
|
||||
label: '擅长',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
component: 'Textarea',
|
||||
componentProps: {
|
||||
placeholder: '请输入简介',
|
||||
},
|
||||
fieldName: 'intro',
|
||||
label: '简介',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
component: 'Avatar',
|
||||
componentProps: {
|
||||
placeholder: '请上传资格证书',
|
||||
},
|
||||
fieldName: 'qualification',
|
||||
formItemClass: 'col-span-6',
|
||||
label: '资格证书',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
component: 'Avatar',
|
||||
componentProps: {
|
||||
placeholder: '请上传执业证书',
|
||||
},
|
||||
fieldName: 'practicing',
|
||||
formItemClass: 'col-span-6',
|
||||
label: '执业证书',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
component: 'Avatar',
|
||||
componentProps: {
|
||||
placeholder: '请上传职称证书',
|
||||
},
|
||||
fieldName: 'title',
|
||||
formItemClass: 'col-span-6',
|
||||
label: '职称证书',
|
||||
},
|
||||
{
|
||||
component: 'Avatar',
|
||||
componentProps: {
|
||||
placeholder: '请上传身份证正面',
|
||||
},
|
||||
fieldName: 'card_up',
|
||||
formItemClass: 'col-span-6',
|
||||
label: '身份证正面',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
component: 'Avatar',
|
||||
componentProps: {
|
||||
placeholder: '请上传身份证反面',
|
||||
},
|
||||
fieldName: 'card_down',
|
||||
formItemClass: 'col-span-6',
|
||||
label: '身份证反面',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
component: 'Avatar',
|
||||
componentProps: {
|
||||
placeholder: '请上传签名图片',
|
||||
},
|
||||
fieldName: 'sign_image',
|
||||
formItemClass: 'col-span-6',
|
||||
label: '签名图片',
|
||||
rules: 'required',
|
||||
},
|
||||
],
|
||||
showDefaultActions: false,
|
||||
};
|
||||
55
apps/web-antd/src/views/system/doctor-input/config/search.ts
Normal file
55
apps/web-antd/src/views/system/doctor-input/config/search.ts
Normal file
@@ -0,0 +1,55 @@
|
||||
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,
|
||||
};
|
||||
|
||||
/** 审核列表:默认只看待审核 */
|
||||
export const auditFormOptions: VbenFormProps = {
|
||||
...formOptions,
|
||||
schema: formOptions.schema?.map((item) =>
|
||||
item.fieldName === 'status' ? { ...item, defaultValue: 0 } : item,
|
||||
),
|
||||
};
|
||||
170
apps/web-antd/src/views/system/doctor-input/config/table.ts
Normal file
170
apps/web-antd/src/views/system/doctor-input/config/table.ts
Normal file
@@ -0,0 +1,170 @@
|
||||
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||
|
||||
import { getDoctorInputList } from '../api';
|
||||
|
||||
interface RowType {
|
||||
id: number;
|
||||
name: string;
|
||||
mobile: string;
|
||||
type: number;
|
||||
status: number;
|
||||
input_user_id: number;
|
||||
inputUser: {
|
||||
nick_name: string;
|
||||
};
|
||||
auditAdmin: {
|
||||
nick_name: string;
|
||||
};
|
||||
depart: {
|
||||
name: string;
|
||||
};
|
||||
titleInfo: {
|
||||
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: 'mobile', title: '手机号', width: 140 },
|
||||
{
|
||||
field: 'type',
|
||||
align: 'left',
|
||||
title: '身份',
|
||||
width: 100,
|
||||
slots: { default: 'type' },
|
||||
},
|
||||
{ field: 'depart.name', title: '科室', width: 120 },
|
||||
{ field: 'titleInfo.name', title: '职称', width: 120 },
|
||||
{
|
||||
field: 'status',
|
||||
align: 'left',
|
||||
title: '审核状态',
|
||||
width: 120,
|
||||
slots: { default: 'status' },
|
||||
},
|
||||
{ field: 'created_at', title: '录入时间' },
|
||||
{
|
||||
type: 'html',
|
||||
title: '操作',
|
||||
fixed: 'right',
|
||||
width: 200,
|
||||
slots: { default: 'action' },
|
||||
},
|
||||
],
|
||||
keepSource: true,
|
||||
pagerConfig: {},
|
||||
proxyConfig: {
|
||||
ajax: {
|
||||
query: async ({ page }, formValues) => {
|
||||
return await getDoctorInputList({
|
||||
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: 'mobile', title: '手机号', width: 140 },
|
||||
{
|
||||
field: 'type',
|
||||
align: 'left',
|
||||
title: '身份',
|
||||
width: 100,
|
||||
slots: { default: 'type' },
|
||||
},
|
||||
{ field: 'depart.name', title: '科室', width: 120 },
|
||||
{ field: 'titleInfo.name', title: '职称', width: 120 },
|
||||
{
|
||||
field: 'status',
|
||||
align: 'left',
|
||||
title: '审核状态',
|
||||
width: 120,
|
||||
slots: { default: 'status' },
|
||||
},
|
||||
{
|
||||
field: 'inputUser',
|
||||
title: '录入人',
|
||||
minWidth: 140,
|
||||
slots: { default: 'inputUser' },
|
||||
},
|
||||
{ field: 'auditAdmin.nick_name', title: '审核人' },
|
||||
{ field: 'audit_time', title: '审核时间', slots: { default: 'audit_time' } },
|
||||
{ field: 'created_at', title: '录入时间' },
|
||||
{
|
||||
type: 'html',
|
||||
title: '操作',
|
||||
align: 'right',
|
||||
slots: { default: 'action' },
|
||||
},
|
||||
],
|
||||
keepSource: true,
|
||||
pagerConfig: {},
|
||||
proxyConfig: {
|
||||
ajax: {
|
||||
query: async ({ page }, formValues) => {
|
||||
return await getDoctorInputList({
|
||||
page: page.currentPage,
|
||||
pageSize: page.pageSize,
|
||||
...formValues,
|
||||
});
|
||||
},
|
||||
},
|
||||
},
|
||||
height: 'auto',
|
||||
border: false,
|
||||
toolbarConfig: {
|
||||
search: true,
|
||||
refresh: true,
|
||||
print: false,
|
||||
export: false,
|
||||
zoom: true,
|
||||
},
|
||||
showOverflow: false,
|
||||
};
|
||||
145
apps/web-antd/src/views/system/doctor-input/index.vue
Normal file
145
apps/web-antd/src/views/system/doctor-input/index.vue
Normal file
@@ -0,0 +1,145 @@
|
||||
<script lang="ts" setup>
|
||||
import type { VxeGridListeners } from '#/adapter/vxe-table';
|
||||
|
||||
import { ref } from 'vue';
|
||||
|
||||
import { Page, useVbenModal } from '@vben/common-ui';
|
||||
|
||||
import { Avatar, Tag } from 'ant-design-vue';
|
||||
|
||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import { TableAction } from '#/components/table-action';
|
||||
|
||||
import DetailModal from './components/DetailModal.vue';
|
||||
import FormModalDemo from './components/modal.vue';
|
||||
import { formOptions } from './config/search';
|
||||
import { inputGridOptions } from './config/table';
|
||||
import {
|
||||
inputUserDisplayName,
|
||||
normalizeInputUser,
|
||||
resolveAvatarUrl,
|
||||
} from '../store-input/utils/inputUser';
|
||||
|
||||
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 [DetailModalComponent, detailModalApi] = useVbenModal({
|
||||
connectedComponent: DetailModal,
|
||||
});
|
||||
|
||||
const showDetail = (row: any) => {
|
||||
detailModalApi.setData({
|
||||
values: row,
|
||||
});
|
||||
detailModalApi.open();
|
||||
};
|
||||
|
||||
const showModal = (data = {}, isUpdate = false) => {
|
||||
formModalApi.setData({
|
||||
values: data,
|
||||
update: isUpdate,
|
||||
gridApi,
|
||||
});
|
||||
formModalApi.open();
|
||||
};
|
||||
|
||||
const getTypeText = (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 />
|
||||
<DetailModalComponent />
|
||||
<Grid>
|
||||
<template #toolbar-buttons>
|
||||
<TableAction
|
||||
:actions="[
|
||||
{
|
||||
label: '新增预填',
|
||||
type: 'primary',
|
||||
icon: 'ant-design:plus-outlined',
|
||||
onClick: showModal.bind(null, {}, false),
|
||||
},
|
||||
]"
|
||||
/>
|
||||
</template>
|
||||
<template #type="{ row }">
|
||||
<Tag>{{ getTypeText(row.type) }}</Tag>
|
||||
</template>
|
||||
<template #status="{ row }">
|
||||
<Tag :color="getStatusColor(row.status)">
|
||||
{{ getStatusText(row.status) }}
|
||||
</Tag>
|
||||
</template>
|
||||
<template #inputUser="{ row }">
|
||||
<div v-if="normalizeInputUser(row)" class="flex items-center gap-2">
|
||||
<Avatar
|
||||
v-if="resolveAvatarUrl(row.inputUser?.avatar)"
|
||||
:src="resolveAvatarUrl(row.inputUser?.avatar)"
|
||||
:size="28"
|
||||
/>
|
||||
<Avatar v-else :size="28">{{ inputUserDisplayName(row.inputUser).charAt(0) }}</Avatar>
|
||||
<span>{{ inputUserDisplayName(row.inputUser) }}</span>
|
||||
</div>
|
||||
<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:edit',
|
||||
size: 'small',
|
||||
ifShow: row.status === 0,
|
||||
onClick: showModal.bind(null, row, true),
|
||||
},
|
||||
]"
|
||||
/>
|
||||
</template>
|
||||
</Grid>
|
||||
</Page>
|
||||
</template>
|
||||
@@ -23,6 +23,7 @@ const [Form, formApi] = useVbenForm(modalFormProps);
|
||||
|
||||
// 初始化弹窗
|
||||
const [Modal, modalApi] = useVbenModal({
|
||||
closeOnClickModal: false,
|
||||
fullscreenButton: false, // 不显示全屏按钮
|
||||
draggable: true, // 可拖拽
|
||||
// 取消按钮回调
|
||||
|
||||
@@ -57,6 +57,13 @@ export const gridOptions: VxeGridProps<RowType> = {
|
||||
slots: { default: 'subscribe_price_change' },
|
||||
width: 120,
|
||||
},
|
||||
{
|
||||
field: 'see_rate',
|
||||
align: 'left',
|
||||
title: '查看毛利率',
|
||||
slots: { default: 'see_rate' },
|
||||
width: 120,
|
||||
},
|
||||
{
|
||||
// 药店二维码列(已从"诊所二维码"改为"药店二维码")
|
||||
field: 'qr_code',
|
||||
|
||||
@@ -22,6 +22,7 @@ import {
|
||||
openPcWindowsApiByStore,
|
||||
openQrCodeApi,
|
||||
updateStoreShippingFree,
|
||||
updateStoreSeeRateStatus,
|
||||
updateStoreSubscribeStatus,
|
||||
} from '#/views/system/store/api';
|
||||
// 导入表单弹窗组件
|
||||
@@ -223,6 +224,16 @@ const updateSubscribe = (id: number) => {
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 切换是否可查看毛利率
|
||||
*/
|
||||
const updateSeeRate = (id: number) => {
|
||||
updateStoreSeeRateStatus({ id }).then(() => {
|
||||
message.success('修改成功!');
|
||||
gridApi.query();
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 批量同步总仓库药品
|
||||
*/
|
||||
@@ -387,6 +398,15 @@ const batchSyncDrugPrice = () => {
|
||||
{{ row.subscribe_price_change === 0 ? '订阅' : '不订阅' }}
|
||||
</Tag>
|
||||
</template>
|
||||
<template #see_rate="{ row }">
|
||||
<Tag
|
||||
:color="Number(row.see_rate) === 1 ? 'success' : 'default'"
|
||||
style="cursor: pointer"
|
||||
@click="updateSeeRate(row.id)"
|
||||
>
|
||||
{{ Number(row.see_rate) === 1 ? '可查看' : '不可查看' }}
|
||||
</Tag>
|
||||
</template>
|
||||
<template #start-time="{ row }">
|
||||
早:<Tag color="success">{{ row.start_time }}</Tag>
|
||||
<br />
|
||||
|
||||
@@ -9,13 +9,59 @@ import { useVbenForm } from '#/adapter/form';
|
||||
import { createProcess, updateProcess } from '#/views/system/process/api';
|
||||
import { modalFormProps } from '#/views/system/process/config/form';
|
||||
|
||||
|
||||
|
||||
const isUpdate = ref(false);
|
||||
const gridApi = ref();
|
||||
|
||||
const [Form, formApi] = useVbenForm(modalFormProps);
|
||||
|
||||
function buildSubmitPayload(values: Record<string, any>) {
|
||||
const formLevel = Number(values.formLevel);
|
||||
const payload: Record<string, any> = {
|
||||
id: values.id,
|
||||
};
|
||||
|
||||
if (formLevel === 3) {
|
||||
payload.node_type = 'note';
|
||||
payload.rule_id = values.rule_id;
|
||||
payload.note = values.note;
|
||||
if (values.real_id) {
|
||||
payload.real_id = values.real_id;
|
||||
}
|
||||
return payload;
|
||||
}
|
||||
|
||||
payload.node_type = 'rule';
|
||||
payload.name = values.name;
|
||||
payload.pid = formLevel === 1 ? 0 : values.pid;
|
||||
if (formLevel === 2) {
|
||||
payload.calc_method = values.calc_method;
|
||||
payload.price = values.price;
|
||||
payload.unit = values.unit;
|
||||
}
|
||||
|
||||
return payload;
|
||||
}
|
||||
|
||||
function validateFormValues(values: Record<string, any>) {
|
||||
const formLevel = Number(values.formLevel);
|
||||
if (formLevel === 3) {
|
||||
if (!String(values.note ?? '').trim()) {
|
||||
message.error('请输入备注名称');
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (!String(values.name ?? '').trim()) {
|
||||
message.error('请输入名称');
|
||||
return false;
|
||||
}
|
||||
if (formLevel === 2 && !values.pid) {
|
||||
message.error('请选择父级制剂');
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
const [Modal, modalApi] = useVbenModal({
|
||||
fullscreenButton: false,
|
||||
draggable: true,
|
||||
@@ -23,31 +69,37 @@ const [Modal, modalApi] = useVbenModal({
|
||||
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 ? updateProcess : createProcess;
|
||||
submitApi(values)
|
||||
.then(() => {
|
||||
message.success('保存成功');
|
||||
gridApi.value?.reload();
|
||||
modalApi.close();
|
||||
})
|
||||
.finally(() => {
|
||||
modalApi.setState({ loading: false, confirmLoading: false });
|
||||
});
|
||||
}
|
||||
});
|
||||
await formApi.validateAndSubmitForm();
|
||||
const values = await formApi.getValues();
|
||||
if (!validateFormValues(values)) {
|
||||
return;
|
||||
}
|
||||
const payload = buildSubmitPayload(values);
|
||||
modalApi.setState({ loading: true, confirmLoading: true });
|
||||
const submitApi = isUpdate.value ? updateProcess : createProcess;
|
||||
submitApi(payload)
|
||||
.then(() => {
|
||||
message.success('保存成功');
|
||||
gridApi.value?.reload();
|
||||
modalApi.close();
|
||||
})
|
||||
.finally(() => {
|
||||
modalApi.setState({ loading: false, confirmLoading: false });
|
||||
});
|
||||
},
|
||||
onOpenChange(isOpen: boolean) {
|
||||
gridApi.value = isOpen ? modalApi.getData()?.gridApi : null;
|
||||
if (isOpen) {
|
||||
const { values, update } = modalApi.getData<Record<string, any>>();
|
||||
const { values, update, formLevel } = modalApi.getData<Record<string, any>>();
|
||||
isUpdate.value = update;
|
||||
formApi.resetForm();
|
||||
if (values) {
|
||||
isUpdate.value = update;
|
||||
formApi.setValues(values);
|
||||
const formValues = {
|
||||
...values,
|
||||
formLevel,
|
||||
note: values.note ?? values.name,
|
||||
has_children: values.has_children ?? false,
|
||||
};
|
||||
formApi.setValues(formValues);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue';
|
||||
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
|
||||
import { Form, FormItem, InputNumber, message } from 'ant-design-vue';
|
||||
|
||||
import { updateProcess } from '#/views/system/process/api';
|
||||
|
||||
const noteRow = ref<Record<string, any>>({});
|
||||
const volumeValue = ref<null | number>(null);
|
||||
const gridApiRef = ref<any>(null);
|
||||
|
||||
const [Modal, modalApi] = useVbenModal({
|
||||
fullscreenButton: false,
|
||||
draggable: true,
|
||||
onCancel() {
|
||||
modalApi.close();
|
||||
},
|
||||
onConfirm: async () => {
|
||||
if (volumeValue.value === null || volumeValue.value === undefined) {
|
||||
message.error('请输入毫升');
|
||||
return;
|
||||
}
|
||||
modalApi.setState({ confirmLoading: true });
|
||||
try {
|
||||
const realId = noteRow.value.real_id ?? Math.abs(Number(noteRow.value.id));
|
||||
await updateProcess({
|
||||
id: noteRow.value.id,
|
||||
node_type: 'note',
|
||||
real_id: realId,
|
||||
note: noteRow.value.note ?? noteRow.value.name,
|
||||
volume: volumeValue.value,
|
||||
});
|
||||
message.success('保存成功');
|
||||
gridApiRef.value?.query?.();
|
||||
// gridApiRef.value?.reload?.();
|
||||
modalApi.close();
|
||||
} finally {
|
||||
modalApi.setState({ confirmLoading: false });
|
||||
}
|
||||
},
|
||||
onOpenChange(isOpen: boolean) {
|
||||
if (isOpen) {
|
||||
const data = modalApi.getData<{
|
||||
gridApi: any;
|
||||
row: Record<string, any>;
|
||||
}>();
|
||||
gridApiRef.value = data?.gridApi;
|
||||
noteRow.value = data?.row ?? {};
|
||||
const raw = noteRow.value.volume;
|
||||
volumeValue.value =
|
||||
raw !== null && raw !== undefined && raw !== '' ? Number(raw) : null;
|
||||
} else {
|
||||
noteRow.value = {};
|
||||
volumeValue.value = null;
|
||||
gridApiRef.value = null;
|
||||
}
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Modal title="设置毫升" class="w-[400px]">
|
||||
<Form layout="vertical">
|
||||
<FormItem label="备注名称">
|
||||
<span>{{ noteRow.name ?? noteRow.note ?? '-' }}</span>
|
||||
</FormItem>
|
||||
<FormItem label="毫升" required>
|
||||
<InputNumber
|
||||
v-model:value="volumeValue"
|
||||
:min="1"
|
||||
class="w-full"
|
||||
placeholder="请输入毫升,用于传给 MES"
|
||||
/>
|
||||
</FormItem>
|
||||
</Form>
|
||||
</Modal>
|
||||
</template>
|
||||
@@ -1,92 +1,127 @@
|
||||
import type { VbenFormProps } from '#/adapter/form';
|
||||
import {getProcessOptionPidApi} from "#/views/system/process/api";
|
||||
|
||||
import { getProcessOptionPidApi } from '#/views/system/process/api';
|
||||
|
||||
export const modalFormProps: VbenFormProps = {
|
||||
wrapperClass: 'grid-cols-12', // 24栅格,
|
||||
wrapperClass: 'grid-cols-12',
|
||||
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: 'VbenInput',
|
||||
fieldName: 'node_type',
|
||||
label: '节点类型',
|
||||
dependencies: {
|
||||
show: false,
|
||||
triggerFields: ['node_type'],
|
||||
},
|
||||
},
|
||||
{
|
||||
component: 'VbenInput',
|
||||
fieldName: 'formLevel',
|
||||
label: '表单层级',
|
||||
dependencies: {
|
||||
show: false,
|
||||
triggerFields: ['formLevel'],
|
||||
},
|
||||
},
|
||||
{
|
||||
component: 'VbenInput',
|
||||
fieldName: 'rule_id',
|
||||
label: '所属煎法',
|
||||
dependencies: {
|
||||
show: false,
|
||||
triggerFields: ['rule_id'],
|
||||
},
|
||||
},
|
||||
{
|
||||
component: 'VbenInput',
|
||||
fieldName: 'real_id',
|
||||
label: '真实ID',
|
||||
dependencies: {
|
||||
show: false,
|
||||
triggerFields: ['real_id'],
|
||||
},
|
||||
},
|
||||
{
|
||||
component: 'VbenInput',
|
||||
fieldName: 'has_children',
|
||||
label: '是否有子级',
|
||||
dependencies: {
|
||||
show: false,
|
||||
triggerFields: ['has_children'],
|
||||
},
|
||||
},
|
||||
{
|
||||
component: 'VbenInput',
|
||||
componentProps: {
|
||||
placeholder: '请输入加工费昵称',
|
||||
placeholder: '请输入名称',
|
||||
},
|
||||
fieldName: 'name',
|
||||
label: '加工费名称',
|
||||
rules: 'required',
|
||||
label: '名称',
|
||||
dependencies: {
|
||||
show(values) {
|
||||
return Number(values.formLevel) !== 3;
|
||||
},
|
||||
triggerFields: ['formLevel'],
|
||||
},
|
||||
},
|
||||
{
|
||||
component: 'VbenInput',
|
||||
componentProps: {
|
||||
placeholder: '请输入备注名称',
|
||||
},
|
||||
fieldName: 'note',
|
||||
label: '备注名称',
|
||||
dependencies: {
|
||||
show(values) {
|
||||
return Number(values.formLevel) === 3;
|
||||
},
|
||||
triggerFields: ['formLevel'],
|
||||
},
|
||||
},
|
||||
// calc_method '计算方式 1固定价格 2贴数 3克数',
|
||||
{
|
||||
component: 'VbenSelect',
|
||||
componentProps: {
|
||||
placeholder: '请选择计算方式',
|
||||
options: [
|
||||
{
|
||||
label: '固定价格',
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
label: '贴数',
|
||||
value: 2,
|
||||
},
|
||||
{
|
||||
label: '克数',
|
||||
value: 3,
|
||||
},
|
||||
{ label: '固定价格', value: 1 },
|
||||
{ label: '贴数', value: 2 },
|
||||
{ label: '克数', value: 3 },
|
||||
],
|
||||
},
|
||||
fieldName: 'calc_method',
|
||||
label: '计算方式',
|
||||
dependencies: {
|
||||
show(values) {
|
||||
return Number(values.formLevel) === 2;
|
||||
},
|
||||
triggerFields: ['formLevel'],
|
||||
},
|
||||
},
|
||||
{
|
||||
component: 'ApiSelect',
|
||||
componentProps: {
|
||||
placeholder: '请选择计算方式',
|
||||
placeholder: '请选择父级制剂',
|
||||
api: getProcessOptionPidApi,
|
||||
filterOption: (input: string, option: any) => {
|
||||
// 自定义过滤逻辑,确保可以根据 name 进行搜索
|
||||
return option?.label.toLowerCase().indexOf(input.toLowerCase()) >= 0;
|
||||
},
|
||||
filterOption: (input: string, option: any) =>
|
||||
option?.label.toLowerCase().indexOf(input.toLowerCase()) >= 0,
|
||||
showSearch: true,
|
||||
// 菜单接口转options格式
|
||||
afterFetch: (data: { id: number; name: string }[]) => {
|
||||
// 在开头插入value = 0 的选项
|
||||
data.unshift({
|
||||
name: '一级分类',
|
||||
id: 0,
|
||||
});
|
||||
return data.map((item: any) => ({
|
||||
label: item.name,
|
||||
value: item.id,
|
||||
@@ -94,15 +129,28 @@ export const modalFormProps: VbenFormProps = {
|
||||
},
|
||||
},
|
||||
fieldName: 'pid',
|
||||
label: '父级',
|
||||
label: '父级制剂',
|
||||
dependencies: {
|
||||
show(values) {
|
||||
return Number(values.formLevel) === 2;
|
||||
},
|
||||
triggerFields: ['formLevel'],
|
||||
},
|
||||
},
|
||||
{
|
||||
component: 'InputNumber',
|
||||
componentProps: {
|
||||
placeholder: '请输入计算价格',
|
||||
class: 'w-full',
|
||||
},
|
||||
fieldName: 'price',
|
||||
label: '计算价格',
|
||||
dependencies: {
|
||||
show(values) {
|
||||
return Number(values.formLevel) === 2;
|
||||
},
|
||||
triggerFields: ['formLevel'],
|
||||
},
|
||||
},
|
||||
{
|
||||
component: 'VbenInput',
|
||||
@@ -111,6 +159,12 @@ export const modalFormProps: VbenFormProps = {
|
||||
},
|
||||
fieldName: 'unit',
|
||||
label: '计算单位',
|
||||
dependencies: {
|
||||
show(values) {
|
||||
return Number(values.formLevel) === 2;
|
||||
},
|
||||
triggerFields: ['formLevel'],
|
||||
},
|
||||
},
|
||||
],
|
||||
showDefaultActions: false,
|
||||
|
||||
@@ -2,6 +2,22 @@ import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||
|
||||
import { getProcessList } from '#/views/system/process/api';
|
||||
|
||||
const calcMethodMap: Record<number, string> = {
|
||||
1: '固定价格',
|
||||
2: '贴数',
|
||||
3: '克数',
|
||||
};
|
||||
|
||||
function getLevelLabel(row: Record<string, any>) {
|
||||
if (row.node_type === 'note') {
|
||||
return '备注';
|
||||
}
|
||||
if (Number(row.pid) === 0) {
|
||||
return '制剂';
|
||||
}
|
||||
return '煎法';
|
||||
}
|
||||
|
||||
export const gridOptions: VxeGridProps = {
|
||||
checkboxConfig: {
|
||||
highlight: true,
|
||||
@@ -17,18 +33,48 @@ export const gridOptions: VxeGridProps = {
|
||||
{ type: 'checkbox', width: 60 },
|
||||
{ width: 60, treeNode: true },
|
||||
{ field: 'id', align: 'left', title: 'ID', width: 100 },
|
||||
{ field: 'name', title: '加工费名称' },
|
||||
{ field: 'calc_method', title: '计算方式' },
|
||||
{ field: 'price', title: '计算价格' },
|
||||
{ field: 'unit', title: '计算单位' },
|
||||
{
|
||||
field: 'level',
|
||||
title: '级别',
|
||||
width: 90,
|
||||
formatter: ({ row }) => getLevelLabel(row),
|
||||
},
|
||||
{ field: 'name', title: '名称' },
|
||||
{
|
||||
field: 'calc_method',
|
||||
title: '计算方式',
|
||||
formatter: ({ row, cellValue }) => {
|
||||
if (row.node_type === 'note') {
|
||||
return '-';
|
||||
}
|
||||
return calcMethodMap[Number(cellValue)] || cellValue || '-';
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'price',
|
||||
title: '计算价格',
|
||||
formatter: ({ row, cellValue }) =>
|
||||
row.node_type === 'note' ? '-' : (cellValue ?? '-'),
|
||||
},
|
||||
{
|
||||
field: 'unit',
|
||||
title: '计算单位',
|
||||
formatter: ({ row, cellValue }) =>
|
||||
row.node_type === 'note' ? '-' : (cellValue ?? '-'),
|
||||
},
|
||||
{
|
||||
field: 'volume',
|
||||
title: '毫升',
|
||||
width: 100,
|
||||
slots: { default: 'volume' },
|
||||
},
|
||||
{ field: 'created_at', title: '创建时间' },
|
||||
{ type: 'html', title: '操作', slots: { default: 'action' } },
|
||||
{ type: 'html', title: '操作', slots: { default: 'action' }, width: 220 },
|
||||
],
|
||||
keepSource: true,
|
||||
pagerConfig: {},
|
||||
proxyConfig: {
|
||||
ajax: {
|
||||
// 请求后端接口方法
|
||||
query: async ({ page }, formValues) => {
|
||||
return await getProcessList({
|
||||
page: page.currentPage,
|
||||
@@ -47,21 +93,27 @@ export const gridOptions: VxeGridProps = {
|
||||
height: 'auto',
|
||||
border: false,
|
||||
toolbarConfig: {
|
||||
// 是否显示搜索表单控制按钮
|
||||
// @ts-ignore 正式环境时有完整的类型声明
|
||||
search: true,
|
||||
refresh: true, // 刷新
|
||||
print: false, // 打印
|
||||
export: false, // 导出
|
||||
// custom: true, // 自定义列
|
||||
zoom: true, // 最大化最小化
|
||||
refresh: true,
|
||||
print: false,
|
||||
export: false,
|
||||
zoom: true,
|
||||
slots: {
|
||||
buttons: 'toolbar-buttons',
|
||||
},
|
||||
custom: {
|
||||
// 自定义列-图标
|
||||
icon: 'vxe-icon-menu',
|
||||
},
|
||||
},
|
||||
showOverflow: false,
|
||||
};
|
||||
|
||||
export function getProcessNodeLevel(row: Record<string, any>) {
|
||||
if (row.node_type === 'note') {
|
||||
return 3;
|
||||
}
|
||||
if (Number(row.pid) === 0) {
|
||||
return 1;
|
||||
}
|
||||
return 2;
|
||||
}
|
||||
|
||||
@@ -5,26 +5,25 @@ import { ref } from 'vue';
|
||||
|
||||
import { Page, useVbenModal } from '@vben/common-ui';
|
||||
|
||||
import { Button, Image, message } from 'ant-design-vue';
|
||||
import { Button, message } from 'ant-design-vue';
|
||||
|
||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import { TableAction } from '#/components/table-action';
|
||||
|
||||
import { deleteProcess } from './api';
|
||||
import FormModalDemo from './components/modal.vue';
|
||||
import VolumeModal from './components/volume-modal.vue';
|
||||
import { formOptions } from './config/search';
|
||||
import { gridOptions } from './config/table';
|
||||
import { getProcessNodeLevel, 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;
|
||||
},
|
||||
@@ -40,28 +39,113 @@ const [FormModal, formModalApi] = useVbenModal({
|
||||
connectedComponent: FormModalDemo,
|
||||
});
|
||||
|
||||
const showModal = (data = {}, isUpdate = false) => {
|
||||
const [VolumeModalComponent, volumeModalApi] = useVbenModal({
|
||||
connectedComponent: VolumeModal,
|
||||
});
|
||||
|
||||
function showVolumeModal(row: Record<string, any>) {
|
||||
volumeModalApi.setData({
|
||||
row,
|
||||
gridApi,
|
||||
});
|
||||
volumeModalApi.open();
|
||||
}
|
||||
|
||||
function getVolumeLinkLabel(row: Record<string, any>) {
|
||||
const volume = row.volume;
|
||||
if (volume !== null && volume !== undefined && volume !== '') {
|
||||
return `${volume}ml`;
|
||||
}
|
||||
return '设置';
|
||||
}
|
||||
|
||||
function openModal(options: {
|
||||
formLevel: number;
|
||||
isUpdate?: boolean;
|
||||
parentRow?: Record<string, any>;
|
||||
values?: Record<string, any>;
|
||||
}) {
|
||||
const { formLevel, isUpdate = false, parentRow, values = {} } = options;
|
||||
let formValues: Record<string, any> = { ...values, formLevel };
|
||||
|
||||
if (!isUpdate) {
|
||||
if (formLevel === 1) {
|
||||
formValues = {
|
||||
node_type: 'rule',
|
||||
pid: 0,
|
||||
formLevel: 1,
|
||||
};
|
||||
} else if (formLevel === 2 && parentRow) {
|
||||
formValues = {
|
||||
node_type: 'rule',
|
||||
pid: parentRow.id,
|
||||
formLevel: 2,
|
||||
};
|
||||
} else if (formLevel === 3 && parentRow) {
|
||||
formValues = {
|
||||
node_type: 'note',
|
||||
rule_id: parentRow.id,
|
||||
formLevel: 3,
|
||||
};
|
||||
}
|
||||
} else if (formLevel === 3) {
|
||||
formValues = {
|
||||
...values,
|
||||
formLevel: 3,
|
||||
note: values.note ?? values.name,
|
||||
rule_id: values.pid,
|
||||
real_id: values.real_id ?? Math.abs(Number(values.id)),
|
||||
};
|
||||
} else {
|
||||
formValues = {
|
||||
...values,
|
||||
formLevel,
|
||||
has_children: values.has_children ?? false,
|
||||
};
|
||||
}
|
||||
|
||||
formModalApi.setData({
|
||||
// 表单值
|
||||
values: data,
|
||||
values: formValues,
|
||||
update: isUpdate,
|
||||
formLevel,
|
||||
gridApi,
|
||||
});
|
||||
formModalApi.open();
|
||||
}
|
||||
|
||||
const showCreateLevel1 = () => {
|
||||
openModal({ formLevel: 1 });
|
||||
};
|
||||
|
||||
const deleteApi = (row: any) => {
|
||||
let ids = [];
|
||||
if (row) {
|
||||
ids.push(row);
|
||||
} else {
|
||||
ids = gridApi.grid.getCheckboxRecords().map((item) => item.id);
|
||||
}
|
||||
deleteProcess({ ids }).then(() => {
|
||||
const showEditModal = (row: Record<string, any>) => {
|
||||
openModal({
|
||||
formLevel: getProcessNodeLevel(row),
|
||||
isUpdate: true,
|
||||
values: row,
|
||||
});
|
||||
};
|
||||
|
||||
const showCreateChildRule = (row: Record<string, any>) => {
|
||||
openModal({
|
||||
formLevel: 2,
|
||||
parentRow: row,
|
||||
});
|
||||
};
|
||||
|
||||
const showCreateChildNote = (row: Record<string, any>) => {
|
||||
openModal({
|
||||
formLevel: 3,
|
||||
parentRow: row,
|
||||
});
|
||||
};
|
||||
|
||||
const deleteRow = (row: Record<string, any>) => {
|
||||
deleteProcess({ ids: [row.id] }).then(() => {
|
||||
message.success('删除成功!');
|
||||
gridApi.query();
|
||||
});
|
||||
};
|
||||
|
||||
const expandAll = () => {
|
||||
gridApi.grid?.setAllTreeExpand(true);
|
||||
};
|
||||
@@ -74,42 +158,29 @@ const collapseAll = () => {
|
||||
<template>
|
||||
<Page auto-content-height title="加工费管理">
|
||||
<FormModal />
|
||||
<VolumeModalComponent />
|
||||
<Grid>
|
||||
<template #toolbar-buttons>
|
||||
<TableAction
|
||||
:actions="[
|
||||
{
|
||||
label: '新增',
|
||||
label: '新增制剂',
|
||||
type: 'primary',
|
||||
icon: 'ant-design:plus-outlined',
|
||||
// auth: ['超级加工费', 'sys:user:save'],
|
||||
onClick: showModal.bind(null),
|
||||
onClick: showCreateLevel1,
|
||||
},
|
||||
{
|
||||
label: '展开全部',
|
||||
type: 'primary',
|
||||
// auth: ['超级菜单', 'sys:user:save'],
|
||||
onClick: expandAll.bind(null),
|
||||
onClick: expandAll,
|
||||
},
|
||||
{
|
||||
label: '收起全部',
|
||||
type: 'primary',
|
||||
// auth: ['超级菜单', 'sys:user:save'],
|
||||
onClick: collapseAll.bind(null),
|
||||
onClick: collapseAll,
|
||||
},
|
||||
]"
|
||||
:drop-down-actions="[
|
||||
// {
|
||||
// label: '删除',
|
||||
// icon: 'ant-design:delete-outlined',
|
||||
// ifShow: hasTopTableDropDownActions,
|
||||
// // auth: ['超级加工费', 'sys:user:save'],
|
||||
// popConfirm: {
|
||||
// title: '确定删除吗?',
|
||||
// confirm: deleteApi.bind(null, false),
|
||||
// },
|
||||
// },
|
||||
]"
|
||||
:drop-down-actions="[]"
|
||||
>
|
||||
<template #more>
|
||||
<Button style="margin-left: 16px">
|
||||
@@ -119,66 +190,62 @@ const collapseAll = () => {
|
||||
</template>
|
||||
</TableAction>
|
||||
</template>
|
||||
<template #logo="{ row }">
|
||||
<Image :src="row.logo" height="30" width="30" />
|
||||
<template #volume="{ row }">
|
||||
<Button
|
||||
v-if="row.node_type === 'note'"
|
||||
class="h-auto p-0"
|
||||
size="small"
|
||||
type="link"
|
||||
@click="showVolumeModal(row)"
|
||||
>
|
||||
{{ getVolumeLinkLabel(row) }}
|
||||
</Button>
|
||||
<span v-else>-</span>
|
||||
</template>
|
||||
<template #open_business_license="{ row }">
|
||||
<Image :src="row.open_business_license" height="30" width="30" />
|
||||
</template>
|
||||
<template #business_license="{ row }">
|
||||
<Image :src="row.business_license" height="30" width="30" />
|
||||
</template>
|
||||
<template #product_registration_certificate="{ row }">
|
||||
<Image
|
||||
:src="row.product_registration_certificate"
|
||||
height="30"
|
||||
width="30"
|
||||
/>
|
||||
</template>
|
||||
<template #toolbar-tools></template>
|
||||
<template #action="{ row }">
|
||||
<TableAction
|
||||
:actions="[
|
||||
...(getProcessNodeLevel(row) === 1
|
||||
? [
|
||||
{
|
||||
label: '新增煎法',
|
||||
type: 'link',
|
||||
size: 'small',
|
||||
onClick: () => showCreateChildRule(row),
|
||||
},
|
||||
]
|
||||
: []),
|
||||
...(getProcessNodeLevel(row) === 2
|
||||
? [
|
||||
{
|
||||
label: '新增备注',
|
||||
type: 'link',
|
||||
size: 'small',
|
||||
onClick: () => showCreateChildNote(row),
|
||||
},
|
||||
]
|
||||
: []),
|
||||
{
|
||||
label: '编辑',
|
||||
type: 'link',
|
||||
icon: 'uil:edit',
|
||||
size: 'small',
|
||||
// auth: ['process', 'sys:role:detail'],
|
||||
onClick: showModal.bind(null, row, true),
|
||||
onClick: () => showEditModal(row),
|
||||
},
|
||||
// {
|
||||
// label: '删除',
|
||||
// type: 'link',
|
||||
// icon: 'ant-design:delete-outlined',
|
||||
// size: 'small',
|
||||
// // auth: ['process', '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: ['process', 'sys:role:detail'],
|
||||
// onClick: showModal.bind(null, row, true),
|
||||
// },
|
||||
// {
|
||||
// label: '删除',
|
||||
// type: 'link',
|
||||
// icon: 'ant-design:delete-outlined',
|
||||
// size: 'small',
|
||||
// // auth: ['process', 'sys:role:detail'],
|
||||
// popConfirm: {
|
||||
// title: '确定删除吗?',
|
||||
// confirm: deleteApi.bind(null, row.id),
|
||||
// },
|
||||
// },
|
||||
...(getProcessNodeLevel(row) === 3
|
||||
? [
|
||||
{
|
||||
label: '删除',
|
||||
type: 'link',
|
||||
icon: 'ant-design:delete-outlined',
|
||||
size: 'small',
|
||||
popConfirm: {
|
||||
title: '确定删除该备注吗?',
|
||||
confirm: () => deleteRow(row),
|
||||
},
|
||||
},
|
||||
]
|
||||
: []),
|
||||
]"
|
||||
/>
|
||||
</template>
|
||||
|
||||
@@ -38,10 +38,25 @@ export async function updateStoreInput(data: Record<string, any>) {
|
||||
* 审核录入
|
||||
* @param data
|
||||
*/
|
||||
export async function getPromoterOptions() {
|
||||
return requestClient.get<{
|
||||
id: number;
|
||||
nick_name: string;
|
||||
avatar: string;
|
||||
code: string;
|
||||
role_id: number;
|
||||
role_name: string;
|
||||
}[]>(`${prefix}promoter-options`);
|
||||
}
|
||||
|
||||
export async function auditStoreInput(data: {
|
||||
id: number;
|
||||
status: number; // 1=审核通过,2=审核拒绝
|
||||
audit_remark?: string;
|
||||
erp_id?: number | string;
|
||||
mes_id?: number | string;
|
||||
/** 门店审核通过时一并审核的医生预填 ID */
|
||||
doctor_input_ids?: number[];
|
||||
}) {
|
||||
return requestClient.post<any>(`${prefix}audit`, data);
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ 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 { Avatar, Button, message, Modal, Tag, Textarea } from 'ant-design-vue';
|
||||
|
||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import { TableAction } from '#/components/table-action';
|
||||
@@ -14,8 +14,13 @@ 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 { auditFormOptions } from './config/search';
|
||||
import { auditGridOptions } from './config/table';
|
||||
import {
|
||||
inputUserDisplayName,
|
||||
normalizeInputUser,
|
||||
resolveAvatarUrl,
|
||||
} from './utils/inputUser';
|
||||
|
||||
const userStore = useUserStore();
|
||||
|
||||
@@ -38,7 +43,7 @@ const gridEvents: VxeGridListeners<any> = {
|
||||
};
|
||||
|
||||
const [Grid, gridApi] = useVbenVxeGrid({
|
||||
formOptions,
|
||||
formOptions: auditFormOptions,
|
||||
gridOptions: auditGridOptions,
|
||||
gridEvents,
|
||||
});
|
||||
@@ -96,7 +101,7 @@ const getStatusText = (status: number) => {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Page auto-content-height title="诊所|药店信息审核">
|
||||
<Page auto-content-height title="门店信息审核">
|
||||
<DetailModalComponent />
|
||||
<AuditModalComponent />
|
||||
<Grid>
|
||||
@@ -115,6 +120,18 @@ const getStatusText = (status: number) => {
|
||||
{{ getStatusText(row.status) }}
|
||||
</Tag>
|
||||
</template>
|
||||
<template #inputUser="{ row }">
|
||||
<div v-if="normalizeInputUser(row)" class="flex items-center gap-2">
|
||||
<Avatar
|
||||
v-if="resolveAvatarUrl(row.inputUser?.avatar)"
|
||||
:src="resolveAvatarUrl(row.inputUser?.avatar)"
|
||||
:size="28"
|
||||
/>
|
||||
<Avatar v-else :size="28">{{ inputUserDisplayName(row.inputUser).charAt(0) }}</Avatar>
|
||||
<span>{{ inputUserDisplayName(row.inputUser) }}</span>
|
||||
</div>
|
||||
<span v-else>-</span>
|
||||
</template>
|
||||
<template #audit_time="{ row }">
|
||||
<span v-if="row.audit_time">
|
||||
{{ new Date(row.audit_time * 1000).toLocaleString() }}
|
||||
|
||||
@@ -1,25 +1,58 @@
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue';
|
||||
import { computed, ref, watch } from 'vue';
|
||||
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
|
||||
import { Button, message, Modal, Radio, RadioGroup, Textarea } from 'ant-design-vue';
|
||||
import { Button, Input, message, Radio, RadioGroup, Textarea } from 'ant-design-vue';
|
||||
|
||||
import { auditStoreInput } from '../api';
|
||||
|
||||
const [ModalComponent, modalApi] = useVbenModal({
|
||||
fullscreenButton: false,
|
||||
draggable: true,
|
||||
onCancel() {
|
||||
modalApi.close();
|
||||
},
|
||||
});
|
||||
import { auditStoreInput, getStoreInputDetail } from '../api';
|
||||
import DoctorInputCardGrid from './DoctorInputCardGrid.vue';
|
||||
import { getLinkedDoctors, isDoctorPending } from '../utils/doctorInputDisplay';
|
||||
|
||||
const auditStatus = ref<number>(1);
|
||||
const auditRemark = ref<string>('');
|
||||
const erpId = ref<string>('');
|
||||
const mesId = ref<string>('');
|
||||
const currentRow = ref<any>(null);
|
||||
const gridApi = ref<any>(null);
|
||||
const loading = ref(false);
|
||||
const detailLoading = ref(false);
|
||||
const allDoctors = ref<any[]>([]);
|
||||
const selectedDoctorIds = ref<number[]>([]);
|
||||
|
||||
const pendingDoctorIds = computed(() =>
|
||||
allDoctors.value
|
||||
.filter((d) => isDoctorPending(d))
|
||||
.map((d) => Number(d.id))
|
||||
.filter((id) => id > 0),
|
||||
);
|
||||
|
||||
const loadLinkedDoctors = async (storeInputId: number) => {
|
||||
detailLoading.value = true;
|
||||
allDoctors.value = [];
|
||||
selectedDoctorIds.value = [];
|
||||
try {
|
||||
const res = await getStoreInputDetail(storeInputId);
|
||||
allDoctors.value = getLinkedDoctors(res);
|
||||
selectedDoctorIds.value = allDoctors.value
|
||||
.filter((d) => isDoctorPending(d))
|
||||
.map((d) => Number(d.id))
|
||||
.filter((id) => id > 0);
|
||||
} catch (error) {
|
||||
console.error('加载关联医生失败:', error);
|
||||
message.error('加载关联医生失败');
|
||||
} finally {
|
||||
detailLoading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
const selectAllPending = () => {
|
||||
selectedDoctorIds.value = [...pendingDoctorIds.value];
|
||||
};
|
||||
|
||||
const clearSelection = () => {
|
||||
selectedDoctorIds.value = [];
|
||||
};
|
||||
|
||||
const handleAudit = async () => {
|
||||
if (!currentRow.value) {
|
||||
@@ -27,46 +60,96 @@ const handleAudit = async () => {
|
||||
return;
|
||||
}
|
||||
|
||||
if (auditStatus.value === 1 && !erpId.value.trim()) {
|
||||
message.error('审核通过时请填写 ERP ID');
|
||||
return;
|
||||
}
|
||||
|
||||
loading.value = true;
|
||||
modalApi.setState({ confirmLoading: true });
|
||||
try {
|
||||
await auditStoreInput({
|
||||
const payload: Parameters<typeof auditStoreInput>[0] = {
|
||||
id: currentRow.value.id,
|
||||
status: auditStatus.value,
|
||||
audit_remark: auditRemark.value,
|
||||
});
|
||||
message.success('审核成功');
|
||||
erp_id: auditStatus.value === 1 ? erpId.value.trim() : undefined,
|
||||
mes_id:
|
||||
auditStatus.value === 1 && mesId.value.trim()
|
||||
? mesId.value.trim()
|
||||
: undefined,
|
||||
};
|
||||
if (auditStatus.value === 1 && selectedDoctorIds.value.length > 0) {
|
||||
payload.doctor_input_ids = [...selectedDoctorIds.value];
|
||||
}
|
||||
await auditStoreInput(payload);
|
||||
const doctorCount =
|
||||
auditStatus.value === 1 ? selectedDoctorIds.value.length : 0;
|
||||
message.success(
|
||||
doctorCount > 0
|
||||
? `审核成功,已一并通过 ${doctorCount} 位医生预填`
|
||||
: '审核成功',
|
||||
);
|
||||
gridApi.value?.reload();
|
||||
modalApi.close();
|
||||
// 重置表单
|
||||
auditStatus.value = 1;
|
||||
auditRemark.value = '';
|
||||
erpId.value = '';
|
||||
mesId.value = '';
|
||||
allDoctors.value = [];
|
||||
selectedDoctorIds.value = [];
|
||||
} catch (error) {
|
||||
console.error('审核失败:', error);
|
||||
message.error('审核失败,请稍后重试');
|
||||
} finally {
|
||||
loading.value = false;
|
||||
modalApi.setState({ confirmLoading: 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 = '';
|
||||
const [ModalComponent, modalApi] = useVbenModal({
|
||||
fullscreenButton: false,
|
||||
draggable: true,
|
||||
onCancel() {
|
||||
modalApi.close();
|
||||
},
|
||||
onConfirm: handleAudit,
|
||||
async 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 = '';
|
||||
erpId.value = values?.erp_id != null ? String(values.erp_id) : '';
|
||||
mesId.value = values?.mes_id != null ? String(values.mes_id) : '';
|
||||
if (values?.id) {
|
||||
await loadLinkedDoctors(Number(values.id));
|
||||
} else {
|
||||
message.warning('门店数据异常,无法加载关联医生');
|
||||
}
|
||||
} else {
|
||||
allDoctors.value = [];
|
||||
selectedDoctorIds.value = [];
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
watch(auditStatus, (v) => {
|
||||
if (v !== 1) {
|
||||
selectedDoctorIds.value = [];
|
||||
} else if (currentRow.value?.id && pendingDoctorIds.value.length) {
|
||||
selectedDoctorIds.value = [...pendingDoctorIds.value];
|
||||
}
|
||||
};
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<ModalComponent
|
||||
title="审核录入信息"
|
||||
class="w-[500px]"
|
||||
class="w-[720px]"
|
||||
:confirm-loading="loading"
|
||||
@confirm="handleAudit"
|
||||
>
|
||||
<div class="p-4 space-y-4">
|
||||
<div class="space-y-4 p-4">
|
||||
<div>
|
||||
<div class="mb-2 font-semibold">审核结果:</div>
|
||||
<RadioGroup v-model:value="auditStatus">
|
||||
@@ -74,6 +157,37 @@ modalApi.onOpenChange = (isOpen: boolean) => {
|
||||
<Radio :value="2">审核拒绝</Radio>
|
||||
</RadioGroup>
|
||||
</div>
|
||||
<div v-if="auditStatus === 1">
|
||||
<div class="mb-2 font-semibold">ERP ID:</div>
|
||||
<Input v-model:value="erpId" placeholder="审核通过时必填" />
|
||||
</div>
|
||||
<div v-if="auditStatus === 1">
|
||||
<div class="mb-2 font-semibold">MES ID:</div>
|
||||
<Input v-model:value="mesId" placeholder="可选,煎药中心编码" />
|
||||
</div>
|
||||
<div v-if="auditStatus === 1">
|
||||
<div class="mb-2 flex flex-wrap items-center justify-between gap-2">
|
||||
<div>
|
||||
<div class="font-semibold">一并审核关联医生(可选)</div>
|
||||
<div class="text-xs text-gray-500">点击卡片选中/取消,悬停查看详情</div>
|
||||
</div>
|
||||
<div v-if="pendingDoctorIds.length > 0" class="flex gap-2">
|
||||
<Button size="small" type="link" @click="selectAllPending">全选</Button>
|
||||
<Button size="small" type="link" @click="clearSelection">取消全选</Button>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="detailLoading" class="text-sm text-gray-400">加载中...</div>
|
||||
<div v-else-if="allDoctors.length === 0" class="text-sm text-gray-400">
|
||||
暂无关联医生预填
|
||||
</div>
|
||||
<DoctorInputCardGrid
|
||||
v-else
|
||||
v-model:selected-ids="selectedDoctorIds"
|
||||
:doctors="allDoctors"
|
||||
selectable
|
||||
only-pending-selectable
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<div class="mb-2 font-semibold">审核备注:</div>
|
||||
<Textarea
|
||||
|
||||
@@ -1,11 +1,47 @@
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue';
|
||||
import { computed, ref } from 'vue';
|
||||
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
|
||||
import { Descriptions, DescriptionsItem, Image } from 'ant-design-vue';
|
||||
import {
|
||||
Avatar,
|
||||
Descriptions,
|
||||
DescriptionsItem,
|
||||
Image,
|
||||
Spin,
|
||||
message,
|
||||
} from 'ant-design-vue';
|
||||
|
||||
import { getStoreInputDetail } from '../api';
|
||||
import DoctorInputCardGrid from './DoctorInputCardGrid.vue';
|
||||
import { getLinkedDoctors } from '../utils/doctorInputDisplay';
|
||||
import {
|
||||
inputUserDisplayName,
|
||||
normalizeInputUser,
|
||||
resolveAvatarUrl,
|
||||
} from '../utils/inputUser';
|
||||
|
||||
const detailData = ref<any>(null);
|
||||
const loading = ref(false);
|
||||
|
||||
const linkedDoctorList = computed(() =>
|
||||
detailData.value ? getLinkedDoctors(detailData.value) : [],
|
||||
);
|
||||
|
||||
const loadDetail = async (id: number) => {
|
||||
loading.value = true;
|
||||
detailData.value = null;
|
||||
try {
|
||||
const res = await getStoreInputDetail(id);
|
||||
detailData.value = res;
|
||||
normalizeInputUser(detailData.value);
|
||||
} catch (error) {
|
||||
console.error('获取详情失败:', error);
|
||||
message.error('获取详情失败');
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
const [Modal, modalApi] = useVbenModal({
|
||||
fullscreenButton: false,
|
||||
@@ -13,98 +49,143 @@ const [Modal, modalApi] = useVbenModal({
|
||||
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) {
|
||||
async onOpenChange(isOpen: boolean) {
|
||||
if (!isOpen) {
|
||||
detailData.value = null;
|
||||
loading.value = false;
|
||||
return;
|
||||
}
|
||||
const { values } = modalApi.getData<Record<string, any>>();
|
||||
if (values?.id) {
|
||||
await loadDetail(values.id);
|
||||
} else {
|
||||
detailData.value = values;
|
||||
detailData.value = values || null;
|
||||
normalizeInputUser(detailData.value);
|
||||
}
|
||||
}
|
||||
};
|
||||
},
|
||||
});
|
||||
</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">
|
||||
<Spin :spinning="loading">
|
||||
<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="录入人">
|
||||
<div class="flex items-center gap-2">
|
||||
<Avatar
|
||||
v-if="resolveAvatarUrl(detailData.inputUser?.avatar)"
|
||||
:src="resolveAvatarUrl(detailData.inputUser?.avatar)"
|
||||
:size="40"
|
||||
/>
|
||||
<Avatar v-else :size="40">
|
||||
{{ inputUserDisplayName(detailData.inputUser).charAt(0) }}
|
||||
</Avatar>
|
||||
<span>{{ inputUserDisplayName(detailData.inputUser) }}</span>
|
||||
</div>
|
||||
</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 v-if="detailData.auditAdmin" label="审核人">
|
||||
{{ detailData.auditAdmin.nick_name }}
|
||||
</DescriptionsItem>
|
||||
<DescriptionsItem v-if="detailData.audit_time" label="审核时间">
|
||||
{{ new Date(detailData.audit_time * 1000).toLocaleString() }}
|
||||
</DescriptionsItem>
|
||||
<DescriptionsItem
|
||||
v-if="detailData.audit_remark"
|
||||
label="审核备注"
|
||||
:span="2"
|
||||
>
|
||||
{{ detailData.audit_remark }}
|
||||
</DescriptionsItem>
|
||||
<DescriptionsItem v-if="detailData.see_rate" label="公章" :span="2">
|
||||
<Image
|
||||
v-for="(url, index) in detailData.url"
|
||||
:key="index"
|
||||
:src="url"
|
||||
:src="detailData.see_rate"
|
||||
: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>
|
||||
</DescriptionsItem>
|
||||
<DescriptionsItem
|
||||
v-if="detailData.url && detailData.url.length > 0"
|
||||
label="轮播图"
|
||||
: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
|
||||
v-if="detailData.contract_files && detailData.contract_files.length > 0"
|
||||
label="合同文件"
|
||||
: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>
|
||||
<DescriptionsItem label="关联医生" :span="2">
|
||||
<div v-if="linkedDoctorList.length === 0" class="text-gray-400">
|
||||
暂无关联医生预填
|
||||
</div>
|
||||
<DoctorInputCardGrid v-else :doctors="linkedDoctorList" />
|
||||
</DescriptionsItem>
|
||||
</Descriptions>
|
||||
</div>
|
||||
<div v-else-if="!loading" class="p-8 text-center text-gray-400">
|
||||
暂无详情数据
|
||||
</div>
|
||||
</Spin>
|
||||
</Modal>
|
||||
</template>
|
||||
|
||||
@@ -0,0 +1,196 @@
|
||||
<script lang="ts" setup>
|
||||
import { computed } from 'vue';
|
||||
|
||||
import {
|
||||
Avatar,
|
||||
Descriptions,
|
||||
DescriptionsItem,
|
||||
Image,
|
||||
Popover,
|
||||
} from 'ant-design-vue';
|
||||
|
||||
import { resolveAvatarUrl } from '../utils/inputUser';
|
||||
import {
|
||||
doctorCertImages,
|
||||
doctorDepartName,
|
||||
doctorTitleName,
|
||||
getAuditStatusText,
|
||||
getDoctorTypeText,
|
||||
getSignTypeText,
|
||||
isDoctorPending,
|
||||
normalizeDoctorRecord,
|
||||
} from '../utils/doctorInputDisplay';
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
doctors: Record<string, any>[];
|
||||
selectedIds?: number[];
|
||||
selectable?: boolean;
|
||||
onlyPendingSelectable?: boolean;
|
||||
}>(),
|
||||
{
|
||||
selectedIds: () => [],
|
||||
selectable: false,
|
||||
onlyPendingSelectable: true,
|
||||
},
|
||||
);
|
||||
|
||||
const emit = defineEmits<{
|
||||
'update:selectedIds': [ids: number[]];
|
||||
}>();
|
||||
|
||||
const normalizedDoctors = computed(() =>
|
||||
(props.doctors || []).map((d) => normalizeDoctorRecord({ ...d })),
|
||||
);
|
||||
|
||||
function doctorId(doc: Record<string, any>) {
|
||||
return Number(doc.id) || 0;
|
||||
}
|
||||
|
||||
function isSelected(doc: Record<string, any>) {
|
||||
return props.selectedIds.includes(doctorId(doc));
|
||||
}
|
||||
|
||||
function canToggle(doc: Record<string, any>) {
|
||||
if (!props.selectable) return false;
|
||||
if (props.onlyPendingSelectable && !isDoctorPending(doc)) return false;
|
||||
return doctorId(doc) > 0;
|
||||
}
|
||||
|
||||
function toggleSelect(doc: Record<string, any>) {
|
||||
if (!canToggle(doc)) return;
|
||||
const id = doctorId(doc);
|
||||
const next = [...props.selectedIds];
|
||||
const idx = next.indexOf(id);
|
||||
if (idx >= 0) {
|
||||
next.splice(idx, 1);
|
||||
} else {
|
||||
next.push(id);
|
||||
}
|
||||
emit('update:selectedIds', next);
|
||||
}
|
||||
|
||||
function cardClass(doc: Record<string, any>) {
|
||||
const base =
|
||||
'flex h-full flex-col rounded border p-3 transition-colors';
|
||||
if (!props.selectable) {
|
||||
return `${base} cursor-default border-gray-100`;
|
||||
}
|
||||
if (!canToggle(doc)) {
|
||||
return `${base} cursor-not-allowed border-gray-100 bg-gray-50 opacity-75`;
|
||||
}
|
||||
if (isSelected(doc)) {
|
||||
return `${base} cursor-pointer border-primary ring-2 ring-primary ring-offset-1`;
|
||||
}
|
||||
return `${base} cursor-pointer border-gray-200 hover:border-primary/50`;
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="grid grid-cols-2 gap-3 md:grid-cols-3">
|
||||
<Popover
|
||||
v-for="doc in normalizedDoctors"
|
||||
:key="doc.id"
|
||||
trigger="hover"
|
||||
placement="right"
|
||||
>
|
||||
<template #content>
|
||||
<Descriptions :column="1" size="small" class="max-w-[480px]">
|
||||
<DescriptionsItem label="ID">{{ doc.id }}</DescriptionsItem>
|
||||
<DescriptionsItem label="姓名">{{ doc.name }}</DescriptionsItem>
|
||||
<DescriptionsItem label="手机号">{{ doc.mobile || '-' }}</DescriptionsItem>
|
||||
<DescriptionsItem label="身份证">{{ doc.idcard || '-' }}</DescriptionsItem>
|
||||
<DescriptionsItem label="身份">{{ getDoctorTypeText(doc.type) }}</DescriptionsItem>
|
||||
<DescriptionsItem label="签名类型">
|
||||
{{ getSignTypeText(doc.sign_type) }}
|
||||
</DescriptionsItem>
|
||||
<DescriptionsItem label="科室">{{ doctorDepartName(doc) }}</DescriptionsItem>
|
||||
<DescriptionsItem label="职称">{{ doctorTitleName(doc) }}</DescriptionsItem>
|
||||
<DescriptionsItem label="擅长">{{ doc.good_at || '-' }}</DescriptionsItem>
|
||||
<DescriptionsItem label="简介">{{ doc.intro || '-' }}</DescriptionsItem>
|
||||
<DescriptionsItem label="审核状态">
|
||||
{{ getAuditStatusText(doc.status) }}
|
||||
</DescriptionsItem>
|
||||
</Descriptions>
|
||||
<div
|
||||
v-if="doctorCertImages(doc).length"
|
||||
class="mt-3 flex flex-wrap gap-2 border-t border-gray-100 pt-3"
|
||||
>
|
||||
<div
|
||||
v-for="(cert, idx) in doctorCertImages(doc)"
|
||||
:key="idx"
|
||||
class="text-center"
|
||||
>
|
||||
<Image
|
||||
:src="cert.url"
|
||||
:width="72"
|
||||
:height="72"
|
||||
:preview="true"
|
||||
class="rounded border border-gray-100"
|
||||
/>
|
||||
<div class="mt-1 text-xs text-gray-500">{{ cert.label }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<div :class="cardClass(doc)" @click="toggleSelect(doc)">
|
||||
<div
|
||||
v-if="selectable && canToggle(doc) && isSelected(doc)"
|
||||
class="mb-1 text-right text-xs font-medium text-primary"
|
||||
>
|
||||
已选
|
||||
</div>
|
||||
<div
|
||||
v-else-if="selectable && onlyPendingSelectable && !isDoctorPending(doc)"
|
||||
class="mb-1 text-right text-xs text-gray-400"
|
||||
>
|
||||
{{ getAuditStatusText(doc.status) }}
|
||||
</div>
|
||||
<div class="mb-2 flex items-center gap-2">
|
||||
<Avatar
|
||||
v-if="resolveAvatarUrl(doc.avatar)"
|
||||
:src="resolveAvatarUrl(doc.avatar)"
|
||||
:size="40"
|
||||
/>
|
||||
<Avatar v-else :size="40">{{ (doc.name || '?').charAt(0) }}</Avatar>
|
||||
<div class="min-w-0 flex-1">
|
||||
<div class="truncate font-medium">{{ doc.name || '-' }}</div>
|
||||
<div class="truncate text-xs text-gray-500">
|
||||
{{ doctorDepartName(doc) }} · {{ doctorTitleName(doc) }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
v-if="!selectable"
|
||||
class="text-xs"
|
||||
:class="{
|
||||
'text-orange-500': doc.status === 0,
|
||||
'text-green-500': doc.status === 1,
|
||||
'text-red-500': doc.status === 2,
|
||||
}"
|
||||
>
|
||||
{{ getAuditStatusText(doc.status) }}
|
||||
</div>
|
||||
<div
|
||||
v-if="doctorCertImages(doc).length"
|
||||
class="mt-2 flex flex-wrap gap-1"
|
||||
>
|
||||
<Image
|
||||
v-for="(cert, cidx) in doctorCertImages(doc).slice(0, 4)"
|
||||
:key="cidx"
|
||||
:src="cert.url"
|
||||
:width="48"
|
||||
:height="48"
|
||||
:preview="true"
|
||||
class="rounded border border-gray-100 object-cover"
|
||||
/>
|
||||
<span
|
||||
v-if="doctorCertImages(doc).length > 4"
|
||||
class="flex h-12 w-12 items-center justify-center rounded bg-gray-50 text-xs text-gray-400"
|
||||
>
|
||||
+{{ doctorCertImages(doc).length - 4 }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</Popover>
|
||||
</div>
|
||||
</template>
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { VbenFormProps } from '#/adapter/form';
|
||||
|
||||
|
||||
// 诊所|药店信息录入表单配置
|
||||
// 门店信息录入表单配置
|
||||
export const modalFormProps: VbenFormProps = {
|
||||
wrapperClass: 'grid-cols-12',
|
||||
commonConfig: {
|
||||
@@ -46,10 +46,10 @@ export const modalFormProps: VbenFormProps = {
|
||||
component: 'VbenInput',
|
||||
formItemClass: 'col-span-6',
|
||||
componentProps: {
|
||||
placeholder: '请输入诊所/药店名称',
|
||||
placeholder: '请输入门店名称',
|
||||
},
|
||||
fieldName: 'name',
|
||||
label: '诊所/药店名称',
|
||||
label: '门店名称',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
@@ -60,15 +60,19 @@ export const modalFormProps: VbenFormProps = {
|
||||
},
|
||||
fieldName: 'erp_id',
|
||||
label: 'ERP ID',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'type',
|
||||
dependencies: {
|
||||
show: false,
|
||||
triggerFields: ['id'],
|
||||
component: 'RadioGroup',
|
||||
formItemClass: 'col-span-6',
|
||||
componentProps: {
|
||||
options: [
|
||||
{ label: '诊所', value: 0 },
|
||||
{ label: '药店', value: 1 },
|
||||
],
|
||||
},
|
||||
fieldName: 'type',
|
||||
label: '门店类型',
|
||||
rules: 'required',
|
||||
defaultValue: 0,
|
||||
},
|
||||
{
|
||||
@@ -136,13 +140,10 @@ export const modalFormProps: VbenFormProps = {
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
component: 'VbenInput',
|
||||
component: 'PromoterPicker',
|
||||
formItemClass: 'col-span-6',
|
||||
componentProps: {
|
||||
placeholder: '请输入业务码',
|
||||
},
|
||||
fieldName: 'code',
|
||||
label: '业务码',
|
||||
label: '业务员',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
|
||||
@@ -14,10 +14,10 @@ export const formOptions: VbenFormProps = {
|
||||
component: 'VbenInput',
|
||||
formItemClass: 'col-span-6',
|
||||
componentProps: {
|
||||
placeholder: '请输入诊所/药店名称',
|
||||
placeholder: '请输入门店名称',
|
||||
},
|
||||
fieldName: 'name',
|
||||
label: '诊所/药店名称',
|
||||
label: '门店名称',
|
||||
},
|
||||
{
|
||||
component: 'VbenInput',
|
||||
@@ -45,3 +45,11 @@ export const formOptions: VbenFormProps = {
|
||||
],
|
||||
showDefaultActions: false,
|
||||
};
|
||||
|
||||
/** 审核列表:默认只看待审核 */
|
||||
export const auditFormOptions: VbenFormProps = {
|
||||
...formOptions,
|
||||
schema: formOptions.schema?.map((item) =>
|
||||
item.fieldName === 'status' ? { ...item, defaultValue: 0 } : item,
|
||||
),
|
||||
};
|
||||
|
||||
@@ -34,7 +34,7 @@ export const inputGridOptions: VxeGridProps<RowType> = {
|
||||
columns: [
|
||||
{ type: 'checkbox', width: 60 },
|
||||
{ field: 'id', align: 'left', title: 'ID', width: 100 },
|
||||
{ field: 'name', align: 'left', title: '诊所/药店名称' },
|
||||
{ field: 'name', align: 'left', title: '门店名称' },
|
||||
{
|
||||
field: 'type',
|
||||
align: 'left',
|
||||
@@ -60,6 +60,12 @@ export const inputGridOptions: VxeGridProps<RowType> = {
|
||||
{ field: 'mobile', title: '联系电话' },
|
||||
{ field: 'position', title: '详细地址' },
|
||||
{ field: 'created_at', title: '录入时间' },
|
||||
{
|
||||
field: 'inputUser',
|
||||
title: '录入人',
|
||||
minWidth: 140,
|
||||
slots: { default: 'inputUser' },
|
||||
},
|
||||
{
|
||||
type: 'html',
|
||||
title: '操作',
|
||||
@@ -110,7 +116,7 @@ export const auditGridOptions: VxeGridProps<RowType> = {
|
||||
columns: [
|
||||
{ type: 'checkbox', width: 60 },
|
||||
{ field: 'id', align: 'left', title: 'ID', width: 100 },
|
||||
{ field: 'name', align: 'left', title: '诊所/药店名称' },
|
||||
{ field: 'name', align: 'left', title: '门店名称' },
|
||||
{
|
||||
field: 'type',
|
||||
align: 'left',
|
||||
@@ -132,7 +138,12 @@ export const auditGridOptions: VxeGridProps<RowType> = {
|
||||
width: 120,
|
||||
slots: { default: 'status' },
|
||||
},
|
||||
{ field: 'inputUser.nick_name', title: '录入人' },
|
||||
{
|
||||
field: 'inputUser',
|
||||
title: '录入人',
|
||||
minWidth: 140,
|
||||
slots: { default: 'inputUser' },
|
||||
},
|
||||
{ field: 'auditAdmin.nick_name', title: '审核人' },
|
||||
{ field: 'audit_time', title: '审核时间', slots: { default: 'audit_time' } },
|
||||
{ field: 'contact', title: '联系人' },
|
||||
@@ -142,7 +153,8 @@ export const auditGridOptions: VxeGridProps<RowType> = {
|
||||
{
|
||||
type: 'html',
|
||||
title: '操作',
|
||||
align: 'right',
|
||||
fixed: 'right',
|
||||
width: 200,
|
||||
slots: { default: 'action' },
|
||||
},
|
||||
],
|
||||
|
||||
@@ -6,7 +6,7 @@ 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 { Avatar, Button, message, Tag } from 'ant-design-vue';
|
||||
|
||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import { TableAction } from '#/components/table-action';
|
||||
@@ -16,9 +16,15 @@ import {
|
||||
getStoreInputDetail,
|
||||
updateStoreInput,
|
||||
} from './api';
|
||||
import DetailModal from './components/DetailModal.vue';
|
||||
import FormModalDemo from './components/modal.vue';
|
||||
import { formOptions } from './config/search';
|
||||
import { inputGridOptions } from './config/table';
|
||||
import {
|
||||
inputUserDisplayName,
|
||||
normalizeInputUser,
|
||||
resolveAvatarUrl,
|
||||
} from './utils/inputUser';
|
||||
|
||||
const userStore = useUserStore();
|
||||
|
||||
@@ -45,6 +51,17 @@ const [FormModal, formModalApi] = useVbenModal({
|
||||
connectedComponent: FormModalDemo,
|
||||
});
|
||||
|
||||
const [DetailModalComponent, detailModalApi] = useVbenModal({
|
||||
connectedComponent: DetailModal,
|
||||
});
|
||||
|
||||
const showDetail = (row: any) => {
|
||||
detailModalApi.setData({
|
||||
values: row,
|
||||
});
|
||||
detailModalApi.open();
|
||||
};
|
||||
|
||||
const showModal = (data = {}, isUpdate = false) => {
|
||||
formModalApi.setData({
|
||||
values: data,
|
||||
@@ -94,8 +111,9 @@ const getStatusText = (status: number) => {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Page auto-content-height title="诊所|药店信息录入">
|
||||
<Page auto-content-height title="门店信息录入">
|
||||
<FormModal />
|
||||
<DetailModalComponent />
|
||||
<Grid>
|
||||
<template #toolbar-buttons>
|
||||
<TableAction
|
||||
@@ -124,6 +142,18 @@ const getStatusText = (status: number) => {
|
||||
{{ getStatusText(row.status) }}
|
||||
</Tag>
|
||||
</template>
|
||||
<template #inputUser="{ row }">
|
||||
<div v-if="normalizeInputUser(row)" class="flex items-center gap-2">
|
||||
<Avatar
|
||||
v-if="resolveAvatarUrl(row.inputUser?.avatar)"
|
||||
:src="resolveAvatarUrl(row.inputUser?.avatar)"
|
||||
:size="28"
|
||||
/>
|
||||
<Avatar v-else :size="28">{{ inputUserDisplayName(row.inputUser).charAt(0) }}</Avatar>
|
||||
<span>{{ inputUserDisplayName(row.inputUser) }}</span>
|
||||
</div>
|
||||
<span v-else>-</span>
|
||||
</template>
|
||||
<template #action="{ row }">
|
||||
<TableAction
|
||||
:actions="[
|
||||
@@ -132,7 +162,7 @@ const getStatusText = (status: number) => {
|
||||
type: 'link',
|
||||
icon: 'uil:eye',
|
||||
size: 'small',
|
||||
onClick: showModal.bind(null, row, false),
|
||||
onClick: showDetail.bind(null, row),
|
||||
},
|
||||
{
|
||||
label: '编辑',
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
export type DoctorCertImage = { label: string; url: string };
|
||||
|
||||
export function normalizeDoctorRecord(doc: Record<string, any>) {
|
||||
if (!doc) return doc;
|
||||
if (!doc.titleInfo && doc.title_info) {
|
||||
doc.titleInfo = doc.title_info;
|
||||
}
|
||||
if (!doc.depart && doc.department) {
|
||||
doc.depart = doc.department;
|
||||
}
|
||||
return doc;
|
||||
}
|
||||
|
||||
export function unwrapStoreInputDetail(res: unknown): Record<string, any> | null | undefined {
|
||||
if (res == null || typeof res !== 'object') {
|
||||
return res as Record<string, any> | null | undefined;
|
||||
}
|
||||
const obj = res as Record<string, any>;
|
||||
if (obj.doctor_inputs != null || obj.doctorInputs != null || obj.id != null) {
|
||||
return obj;
|
||||
}
|
||||
const inner = obj.data ?? obj.result;
|
||||
if (inner != null && typeof inner === 'object') {
|
||||
return inner as Record<string, any>;
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
export function getLinkedDoctors(data: Record<string, any> | null | undefined) {
|
||||
const detail = unwrapStoreInputDetail(data) ?? data;
|
||||
const list = detail?.doctor_inputs ?? detail?.doctorInputs ?? [];
|
||||
const arr = Array.isArray(list) ? list : [];
|
||||
return arr.map((d) => normalizeDoctorRecord(d));
|
||||
}
|
||||
|
||||
export function doctorDepartName(doc: Record<string, any> | null | undefined) {
|
||||
if (!doc) return '-';
|
||||
const d = normalizeDoctorRecord(doc);
|
||||
return d.depart?.name ?? d.depart_name ?? '-';
|
||||
}
|
||||
|
||||
export function doctorTitleName(doc: Record<string, any> | null | undefined) {
|
||||
if (!doc) return '-';
|
||||
const d = normalizeDoctorRecord(doc);
|
||||
return d.titleInfo?.name ?? d.title_info?.name ?? '-';
|
||||
}
|
||||
|
||||
export function getDoctorTypeText(type: number) {
|
||||
if (type === 1) return '中医医生';
|
||||
if (type === 2) return '西医医生';
|
||||
return '-';
|
||||
}
|
||||
|
||||
export function getSignTypeText(signType: number) {
|
||||
if (signType === 1) return '电子签名';
|
||||
if (signType === 2) return '手写签名';
|
||||
return '-';
|
||||
}
|
||||
|
||||
export function getAuditStatusText(status: number) {
|
||||
if (status === 0) return '待审核';
|
||||
if (status === 1) return '审核通过';
|
||||
if (status === 2) return '审核拒绝';
|
||||
return '-';
|
||||
}
|
||||
|
||||
export function doctorCertImages(doc: Record<string, any> | null | undefined): DoctorCertImage[] {
|
||||
if (!doc) return [];
|
||||
const items: DoctorCertImage[] = [
|
||||
{ label: '头像', url: doc.avatar },
|
||||
{ label: '资格证书', url: doc.qualification },
|
||||
{ label: '执业证书', url: doc.practicing },
|
||||
{ label: '职称证书', url: doc.title },
|
||||
{ label: '身份证正面', url: doc.card_up },
|
||||
{ label: '身份证反面', url: doc.card_down },
|
||||
{ label: '签名', url: doc.sign_image },
|
||||
];
|
||||
return items.filter((item) => !!item.url);
|
||||
}
|
||||
|
||||
export function isDoctorPending(doc: Record<string, any>) {
|
||||
return Number(doc?.status) === 0;
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
const OSS_PREFIX = 'https://xiaokang88.oss-cn-hangzhou.aliyuncs.com/';
|
||||
|
||||
export type InputUserLike = {
|
||||
avatar?: string;
|
||||
nick_name?: string;
|
||||
};
|
||||
|
||||
export function normalizeInputUser(
|
||||
row: Record<string, any> | null | undefined,
|
||||
): InputUserLike | null {
|
||||
if (!row) return null;
|
||||
const u = row.input_user ?? row.inputUser;
|
||||
if (!u) return null;
|
||||
if (!row.inputUser) {
|
||||
row.inputUser = u;
|
||||
}
|
||||
return u;
|
||||
}
|
||||
|
||||
export function resolveAvatarUrl(url?: string | null): string {
|
||||
if (!url) return '';
|
||||
const s = String(url).trim();
|
||||
if (!s) return '';
|
||||
if (/^https?:\/\//i.test(s)) return s;
|
||||
if (s.startsWith('//')) return `https:${s}`;
|
||||
return `${OSS_PREFIX}${s.replace(/^\//, '')}`;
|
||||
}
|
||||
|
||||
export function inputUserDisplayName(u: InputUserLike | null | undefined): string {
|
||||
return u?.nick_name?.trim() || '-';
|
||||
}
|
||||
@@ -114,6 +114,14 @@ export async function updateStoreSubscribeStatus(data: { id: number }) {
|
||||
return requestClient.post<any>(`${prefix}update-subscribe-status`, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 切换门店是否可查看毛利率
|
||||
* @param data
|
||||
*/
|
||||
export async function updateStoreSeeRateStatus(data: { id: number }) {
|
||||
return requestClient.post<any>(`${prefix}update-see-rate`, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取诊所药品列表(按类型)
|
||||
* @param storeId 诊所ID
|
||||
|
||||
@@ -10,6 +10,10 @@ export function getCommissionList(params: Record<string, any>) {
|
||||
return requestClient.get(`${prefix}commission-list`, { params });
|
||||
}
|
||||
|
||||
export function getCommissionOrderList(params: Record<string, any>) {
|
||||
return requestClient.get(`${prefix}commission-order-list`, { params });
|
||||
}
|
||||
|
||||
export function getSettlementPreview(params: Record<string, any>) {
|
||||
return requestClient.get(`${prefix}settlement-preview`, { params });
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ import SalespersonSettlementConfirmModal from '#/components/salesperson/Salesper
|
||||
import {
|
||||
confirmSettlement,
|
||||
getCommissionList,
|
||||
getCommissionOrderList,
|
||||
getSalespersonList,
|
||||
getSettlementDetail,
|
||||
getSettlementList,
|
||||
@@ -42,10 +43,28 @@ const selectedRowKeys = ref<number[]>([]);
|
||||
const settlementList = ref<any[]>([]);
|
||||
const settlementDetail = ref<any>(null);
|
||||
const detailVisible = ref(false);
|
||||
const orderDetailVisible = ref(false);
|
||||
const orderDetailLoading = ref(false);
|
||||
const orderDetailData = ref<any[]>([]);
|
||||
const currentOrder = ref<{ order_id: number; order_no: string } | null>(null);
|
||||
const periodRange = ref<any[]>([]);
|
||||
const settlementConfirmRef = ref<InstanceType<typeof SalespersonSettlementConfirmModal>>();
|
||||
|
||||
const commissionColumns = [
|
||||
const orderCommissionColumns = [
|
||||
{ title: '订单号', dataIndex: 'order_no', width: 160 },
|
||||
{ title: '明细数', dataIndex: 'item_count', width: 80 },
|
||||
{ title: '分成总额', dataIndex: 'commission_amount', width: 100 },
|
||||
{ title: '支付时间', dataIndex: 'order_pay_at_text', width: 170 },
|
||||
{ title: '操作', key: 'action', width: 90 },
|
||||
];
|
||||
|
||||
const commissionDetailColumns = [
|
||||
{ title: '药品信息', dataIndex: 'drug_info', ellipsis: true },
|
||||
{ title: '分成金额', dataIndex: 'commission_amount', width: 100 },
|
||||
{ title: '分成时间', dataIndex: 'order_pay_at_text', width: 170 },
|
||||
];
|
||||
|
||||
const settlementLineColumns = [
|
||||
{ title: '订单号', dataIndex: 'order_no', width: 160 },
|
||||
{ title: '药品信息', dataIndex: 'drug_info', ellipsis: true },
|
||||
{ title: '分成金额', dataIndex: 'commission_amount', width: 100 },
|
||||
@@ -67,19 +86,19 @@ const rowSelection = computed(() =>
|
||||
activeTab.value === 'pending'
|
||||
? {
|
||||
selectedRowKeys: selectedRowKeys.value,
|
||||
onChange: (keys: number[], rows: any[]) => {
|
||||
onChange: (keys: number[]) => {
|
||||
selectedRowKeys.value = keys as number[];
|
||||
selectedOrderIds.value = [...new Set(rows.map((r) => r.order_id))];
|
||||
selectedOrderIds.value = keys as number[];
|
||||
},
|
||||
getCheckboxProps: () => ({ disabled: false }),
|
||||
}
|
||||
: undefined,
|
||||
);
|
||||
|
||||
function open(row: { id: number; name: string }) {
|
||||
function open(row: { id: number; name: string; salespersonId?: number }) {
|
||||
storeId.value = row.id;
|
||||
storeName.value = row.name;
|
||||
salespersonId.value = undefined;
|
||||
salespersonId.value = row.salespersonId;
|
||||
selectedOrderIds.value = [];
|
||||
selectedRowKeys.value = [];
|
||||
visible.value = true;
|
||||
@@ -117,7 +136,7 @@ async function loadCommission() {
|
||||
params.start_at = dayjs(dateRange.value[0]).startOf('day').unix();
|
||||
params.end_at = dayjs(dateRange.value[1]).endOf('day').unix();
|
||||
}
|
||||
const res = await getCommissionList(params);
|
||||
const res = await getCommissionOrderList(params);
|
||||
commissionData.value = res?.items || [];
|
||||
commissionTotal.value = res?.total || 0;
|
||||
} finally {
|
||||
@@ -125,6 +144,24 @@ async function loadCommission() {
|
||||
}
|
||||
}
|
||||
|
||||
async function showOrderDetail(record: { order_id: number; order_no: string }) {
|
||||
currentOrder.value = record;
|
||||
orderDetailVisible.value = true;
|
||||
orderDetailLoading.value = true;
|
||||
try {
|
||||
const res = await getCommissionList({
|
||||
store_id: storeId.value,
|
||||
salesperson_id: salespersonId.value,
|
||||
order_id: record.order_id,
|
||||
page: 1,
|
||||
pageSize: 100,
|
||||
});
|
||||
orderDetailData.value = res?.items || [];
|
||||
} finally {
|
||||
orderDetailLoading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
async function loadSettlements() {
|
||||
if (!storeId.value || !salespersonId.value) return;
|
||||
const res = await getSettlementList({
|
||||
@@ -216,24 +253,36 @@ defineExpose({ open });
|
||||
<Button type="primary" ghost @click="handleSettleByOrders">结算选中订单</Button>
|
||||
</div>
|
||||
<Table
|
||||
:columns="commissionColumns"
|
||||
:columns="orderCommissionColumns"
|
||||
:data-source="commissionData"
|
||||
:loading="loading"
|
||||
:pagination="{ current: page, pageSize, total: commissionTotal, onChange: onPageChange }"
|
||||
:row-key="(r) => r.id"
|
||||
:row-key="(r) => r.order_id"
|
||||
:row-selection="rowSelection"
|
||||
size="small"
|
||||
/>
|
||||
>
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.key === 'action'">
|
||||
<Button type="link" size="small" @click="showOrderDetail(record)">查看明细</Button>
|
||||
</template>
|
||||
</template>
|
||||
</Table>
|
||||
</Tabs.TabPane>
|
||||
<Tabs.TabPane key="settled" tab="已结算">
|
||||
<Table
|
||||
:columns="commissionColumns"
|
||||
:columns="orderCommissionColumns"
|
||||
:data-source="commissionData"
|
||||
:loading="loading"
|
||||
:pagination="{ current: page, pageSize, total: commissionTotal, onChange: onPageChange }"
|
||||
:row-key="(r) => r.id"
|
||||
:row-key="(r) => r.order_id"
|
||||
size="small"
|
||||
/>
|
||||
>
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.key === 'action'">
|
||||
<Button type="link" size="small" @click="showOrderDetail(record)">查看明细</Button>
|
||||
</template>
|
||||
</template>
|
||||
</Table>
|
||||
</Tabs.TabPane>
|
||||
<Tabs.TabPane key="history" tab="结算记录">
|
||||
<Table :columns="settlementColumns" :data-source="settlementList" :row-key="(r) => r.id" size="small">
|
||||
@@ -252,6 +301,21 @@ defineExpose({ open });
|
||||
@success="onSettlementSuccess"
|
||||
/>
|
||||
|
||||
<Drawer
|
||||
v-model:open="orderDetailVisible"
|
||||
:title="`订单明细 - ${currentOrder?.order_no || ''}`"
|
||||
width="720"
|
||||
destroy-on-close
|
||||
>
|
||||
<Table
|
||||
:columns="commissionDetailColumns"
|
||||
:data-source="orderDetailData"
|
||||
:loading="orderDetailLoading"
|
||||
:row-key="(r) => r.id"
|
||||
size="small"
|
||||
/>
|
||||
</Drawer>
|
||||
|
||||
<Drawer v-model:open="detailVisible" title="结算单详情" width="720" destroy-on-close>
|
||||
<div v-if="settlementDetail" class="mb-3">
|
||||
<p>单号:{{ settlementDetail.settlement_no }}</p>
|
||||
@@ -272,7 +336,7 @@ defineExpose({ open });
|
||||
</div>
|
||||
</div>
|
||||
<Table
|
||||
:columns="commissionColumns"
|
||||
:columns="settlementLineColumns"
|
||||
:data-source="settlementDetail?.records || []"
|
||||
:row-key="(r) => r.id"
|
||||
size="small"
|
||||
|
||||
@@ -17,6 +17,7 @@ const gridApi = ref();
|
||||
const [Form, formApi] = useVbenForm(modalFormProps);
|
||||
|
||||
const [Modal, modalApi] = useVbenModal({
|
||||
closeOnClickModal: false,
|
||||
fullscreenButton: false,
|
||||
draggable: true,
|
||||
onCancel() {
|
||||
|
||||
@@ -54,6 +54,13 @@ export const gridOptions: VxeGridProps<RowType> = {
|
||||
slots: { default: 'subscribe_price_change' },
|
||||
width: 120,
|
||||
},
|
||||
{
|
||||
field: 'see_rate',
|
||||
align: 'left',
|
||||
title: '查看毛利率',
|
||||
slots: { default: 'see_rate' },
|
||||
width: 120,
|
||||
},
|
||||
{
|
||||
field: 'qr_code',
|
||||
align: 'left',
|
||||
|
||||
@@ -22,6 +22,7 @@ import {
|
||||
openQrCodeApi,
|
||||
updateClinicTypeApi,
|
||||
updateStoreShippingFree,
|
||||
updateStoreSeeRateStatus,
|
||||
updateStoreSubscribeStatus,
|
||||
} from './api';
|
||||
import FormModalDemo from './components/modal.vue';
|
||||
@@ -204,6 +205,16 @@ const updateSubscribe = (id: number) => {
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 切换是否可查看毛利率
|
||||
*/
|
||||
const updateSeeRate = (id: number) => {
|
||||
updateStoreSeeRateStatus({ id }).then(() => {
|
||||
message.success('修改成功!');
|
||||
gridApi.query();
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 批量同步总仓库药品
|
||||
*/
|
||||
@@ -420,6 +431,15 @@ const handleSwitchClinicType = (row: any) => {
|
||||
{{ row.subscribe_price_change === 0 ? '订阅' : '不订阅' }}
|
||||
</Tag>
|
||||
</template>
|
||||
<template #see_rate="{ row }">
|
||||
<Tag
|
||||
:color="Number(row.see_rate) === 1 ? 'success' : 'default'"
|
||||
style="cursor: pointer"
|
||||
@click="updateSeeRate(row.id)"
|
||||
>
|
||||
{{ Number(row.see_rate) === 1 ? '可查看' : '不可查看' }}
|
||||
</Tag>
|
||||
</template>
|
||||
<template #start-time="{ row }">
|
||||
早:<Tag color="success">{{ row.start_time }}</Tag>
|
||||
<br />
|
||||
|
||||
Reference in New Issue
Block a user