fix: 首页药店分区入口、平台资质管理
This commit is contained in:
18
apps/web-antd/src/views/system/platform-info/api/index.ts
Normal file
18
apps/web-antd/src/views/system/platform-info/api/index.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
const prefix = 'platform-info/';
|
||||
/**
|
||||
* 获取平台信息详情
|
||||
* @param data
|
||||
*/
|
||||
export async function getPlatformInfoDetail(data: any) {
|
||||
return requestClient.get<any>(`${prefix}detail`, { params: data });
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新平台信息
|
||||
* @param data
|
||||
*/
|
||||
export async function updatePlatformInfo(data: Record<string, any>) {
|
||||
return requestClient.post<any>(`${prefix}update`, data);
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
const prefix = 'platform-qualifications/';
|
||||
/**
|
||||
* 分页查询资质列表
|
||||
* @param data
|
||||
*/
|
||||
export async function getPlatformQualificationsList(data: any) {
|
||||
return requestClient.get<any>(`${prefix}list`, { params: data });
|
||||
}
|
||||
/**
|
||||
* 获取资质下拉列表
|
||||
* @param data
|
||||
*/
|
||||
export async function getPlatformQualificationsOption(data: any) {
|
||||
return requestClient.get<any>(`${prefix}option`, { params: data });
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取资质详情
|
||||
* @param id
|
||||
*/
|
||||
export async function getPlatformQualificationsInfo(id: number) {
|
||||
return requestClient.get<any>(`${prefix}detail`, { params: { id } });
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增资质
|
||||
* @param data
|
||||
*/
|
||||
export async function createPlatformQualifications(data: Record<string, any>) {
|
||||
return requestClient.post<any>(`${prefix}create`, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑资质
|
||||
* @param data
|
||||
*/
|
||||
export async function updatePlatformQualifications(data: Record<string, any>) {
|
||||
return requestClient.post<any>(`${prefix}update`, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除资质
|
||||
* @param data
|
||||
*/
|
||||
export async function deletePlatformQualifications(data: Record<string, any>) {
|
||||
return requestClient.post<any>(`${prefix}delete`, data);
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
<script lang="ts" setup>
|
||||
import { ref, onMounted } from 'vue';
|
||||
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
|
||||
import { message } from 'ant-design-vue';
|
||||
|
||||
import { useVbenForm } from '#/adapter/form';
|
||||
import { getPlatformInfoDetail, updatePlatformInfo } from '#/views/system/platform-info/api';
|
||||
import { modalFormProps } from '#/views/system/platform-info/config/form';
|
||||
|
||||
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 });
|
||||
updatePlatformInfo(values)
|
||||
.then(() => {
|
||||
message.success('保存成功');
|
||||
gridApi.value?.reload();
|
||||
modalApi.close();
|
||||
})
|
||||
.finally(() => {
|
||||
modalApi.setState({ loading: false, confirmLoading: false });
|
||||
});
|
||||
}
|
||||
});
|
||||
await formApi.validateAndSubmitForm();
|
||||
},
|
||||
onOpenChange(isOpen: boolean) {
|
||||
gridApi.value = isOpen ? modalApi.getData()?.gridApi : null;
|
||||
if (isOpen) {
|
||||
// 加载平台信息
|
||||
const platformId = modalApi.getData()?.platform_id || 1;
|
||||
// 先设置默认值,确保所有字段都有值
|
||||
const defaultFormData = {
|
||||
id: '',
|
||||
platform_id: platformId,
|
||||
contact_phone: '',
|
||||
contact_email: '',
|
||||
contact_address: '',
|
||||
complaint_phone: '',
|
||||
complaint_email: '',
|
||||
complaint_address: '',
|
||||
};
|
||||
formApi.setValues(defaultFormData);
|
||||
|
||||
getPlatformInfoDetail({ platform_id: platformId })
|
||||
.then((res: any) => {
|
||||
const data = res.data?.data || res.data?.result || {};
|
||||
// 将嵌套的数据结构展开为扁平结构,确保所有字段都有值
|
||||
const formData: any = {
|
||||
id: data.id || '',
|
||||
platform_id: platformId,
|
||||
contact_phone: data.contact?.phone || '',
|
||||
contact_email: data.contact?.email || '',
|
||||
contact_address: data.contact?.address || '',
|
||||
complaint_phone: data.complaint?.phone || '',
|
||||
complaint_email: data.complaint?.email || '',
|
||||
complaint_address: data.complaint?.address || '',
|
||||
};
|
||||
formApi.setValues(formData);
|
||||
})
|
||||
.catch(() => {
|
||||
// 如果加载失败,使用默认值(已经在上面设置了)
|
||||
});
|
||||
} else {
|
||||
// 关闭时重置表单
|
||||
formApi.resetFields();
|
||||
}
|
||||
},
|
||||
});
|
||||
</script>
|
||||
<template>
|
||||
<Modal title="平台信息管理" class="w-[60%]">
|
||||
<Form />
|
||||
</Modal>
|
||||
</template>
|
||||
@@ -0,0 +1,95 @@
|
||||
<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 {
|
||||
createPlatformQualifications,
|
||||
updatePlatformQualifications,
|
||||
} from '../api/qualifications';
|
||||
import { modalFormProps } from '../config/qualifications-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();
|
||||
// 处理 store_id,如果为空字符串则设为 null
|
||||
if (values.store_id === '' || values.store_id === undefined) {
|
||||
values.store_id = null;
|
||||
}
|
||||
modalApi.setState({ loading: true, confirmLoading: true });
|
||||
const submitApi = isUpdate.value ? updatePlatformQualifications : createPlatformQualifications;
|
||||
submitApi(values)
|
||||
.then(() => {
|
||||
message.success('保存成功');
|
||||
gridApi.value?.reload();
|
||||
modalApi.close();
|
||||
})
|
||||
.finally(() => {
|
||||
modalApi.setState({ loading: false, confirmLoading: false });
|
||||
});
|
||||
}
|
||||
});
|
||||
await formApi.validateAndSubmitForm();
|
||||
},
|
||||
onOpenChange(isOpen: boolean) {
|
||||
gridApi.value = isOpen ? modalApi.getData()?.gridApi : null;
|
||||
if (isOpen) {
|
||||
const { values, update } = modalApi.getData<Record<string, any>>();
|
||||
if (values && update) {
|
||||
// 编辑时,确保所有字段都有值
|
||||
isUpdate.value = true;
|
||||
const formData: any = {
|
||||
id: values.id || '',
|
||||
drug_license_image: values.drug_license_image || '',
|
||||
business_license_image: values.business_license_image || '',
|
||||
medical_device_license_image: values.medical_device_license_image || '',
|
||||
food_license_image: values.food_license_image || '',
|
||||
pharmacist_certificate_image: values.pharmacist_certificate_image || '',
|
||||
sort_order: values.sort_order ?? 0,
|
||||
status: values.status ?? 1,
|
||||
store_id: values.store_id ?? null,
|
||||
};
|
||||
formApi.setValues(formData);
|
||||
} else {
|
||||
// 新增时重置表单并设置默认值
|
||||
isUpdate.value = false;
|
||||
formApi.resetFields();
|
||||
formApi.setValues({
|
||||
id: '',
|
||||
drug_license_image: '',
|
||||
business_license_image: '',
|
||||
medical_device_license_image: '',
|
||||
food_license_image: '',
|
||||
pharmacist_certificate_image: '',
|
||||
sort_order: 0,
|
||||
status: 1,
|
||||
store_id: null,
|
||||
});
|
||||
}
|
||||
} else {
|
||||
// 关闭时重置表单
|
||||
formApi.resetFields();
|
||||
}
|
||||
},
|
||||
});
|
||||
</script>
|
||||
<template>
|
||||
<Modal :title="`${isUpdate === true ? '编辑' : '新增'}平台资质`" class="w-[60%]">
|
||||
<Form />
|
||||
</Modal>
|
||||
</template>
|
||||
129
apps/web-antd/src/views/system/platform-info/config/form.ts
Normal file
129
apps/web-antd/src/views/system/platform-info/config/form.ts
Normal file
@@ -0,0 +1,129 @@
|
||||
import type { VbenFormProps } from '#/adapter/form';
|
||||
|
||||
export const modalFormProps: VbenFormProps = {
|
||||
wrapperClass: 'grid-cols-12', // 24栅格,
|
||||
commonConfig: {
|
||||
formItemClass: 'col-span-12',
|
||||
// 所有表单项
|
||||
componentProps: {
|
||||
class: 'w-full',
|
||||
},
|
||||
},
|
||||
// handleSubmit: onSubmit,
|
||||
layout: 'horizontal',
|
||||
schema: [
|
||||
{
|
||||
component: 'VbenInput',
|
||||
fieldName: 'id',
|
||||
label: 'ID',
|
||||
formItemClass: 'col-span-6',
|
||||
defaultValue: '',
|
||||
dependencies: {
|
||||
show: false,
|
||||
triggerFields: ['id'],
|
||||
},
|
||||
},
|
||||
{
|
||||
component: 'VbenInput',
|
||||
fieldName: 'platform_id',
|
||||
label: '平台ID',
|
||||
formItemClass: 'col-span-6',
|
||||
defaultValue: 1,
|
||||
dependencies: {
|
||||
show: false,
|
||||
triggerFields: ['platform_id'],
|
||||
},
|
||||
},
|
||||
{
|
||||
component: 'Divider',
|
||||
fieldName: '',
|
||||
label: '联系方式',
|
||||
formItemClass: 'col-span-12',
|
||||
hideLabel: true,
|
||||
renderComponentContent: () => {
|
||||
return {
|
||||
default: () => {
|
||||
return '联系方式';
|
||||
},
|
||||
};
|
||||
},
|
||||
},
|
||||
{
|
||||
component: 'VbenInput',
|
||||
componentProps: {
|
||||
placeholder: '请输入联系电话',
|
||||
},
|
||||
fieldName: 'contact_phone',
|
||||
label: '联系电话',
|
||||
formItemClass: 'col-span-6',
|
||||
defaultValue: '',
|
||||
},
|
||||
{
|
||||
component: 'VbenInput',
|
||||
componentProps: {
|
||||
placeholder: '请输入联系邮箱',
|
||||
},
|
||||
fieldName: 'contact_email',
|
||||
label: '联系邮箱',
|
||||
formItemClass: 'col-span-6',
|
||||
defaultValue: '',
|
||||
},
|
||||
{
|
||||
component: 'Textarea',
|
||||
componentProps: {
|
||||
placeholder: '请输入联系地址',
|
||||
rows: 2,
|
||||
},
|
||||
fieldName: 'contact_address',
|
||||
label: '联系地址',
|
||||
formItemClass: 'col-span-12',
|
||||
defaultValue: '',
|
||||
},
|
||||
{
|
||||
component: 'Divider',
|
||||
fieldName: '',
|
||||
label: '投诉举报方式',
|
||||
formItemClass: 'col-span-12',
|
||||
hideLabel: true,
|
||||
renderComponentContent: () => {
|
||||
return {
|
||||
default: () => {
|
||||
return '投诉举报方式';
|
||||
},
|
||||
};
|
||||
},
|
||||
},
|
||||
{
|
||||
component: 'VbenInput',
|
||||
componentProps: {
|
||||
placeholder: '请输入投诉电话',
|
||||
},
|
||||
fieldName: 'complaint_phone',
|
||||
label: '投诉电话',
|
||||
formItemClass: 'col-span-6',
|
||||
defaultValue: '',
|
||||
},
|
||||
{
|
||||
component: 'VbenInput',
|
||||
componentProps: {
|
||||
placeholder: '请输入投诉邮箱',
|
||||
},
|
||||
fieldName: 'complaint_email',
|
||||
label: '投诉邮箱',
|
||||
formItemClass: 'col-span-6',
|
||||
defaultValue: '',
|
||||
},
|
||||
{
|
||||
component: 'Textarea',
|
||||
componentProps: {
|
||||
placeholder: '请输入投诉地址',
|
||||
rows: 2,
|
||||
},
|
||||
fieldName: 'complaint_address',
|
||||
label: '投诉地址',
|
||||
formItemClass: 'col-span-12',
|
||||
defaultValue: '',
|
||||
},
|
||||
],
|
||||
showDefaultActions: false,
|
||||
};
|
||||
@@ -0,0 +1,106 @@
|
||||
import type { VbenFormProps } from '#/adapter/form';
|
||||
|
||||
export const modalFormProps: VbenFormProps = {
|
||||
wrapperClass: 'grid-cols-12', // 24栅格,
|
||||
commonConfig: {
|
||||
formItemClass: 'col-span-12',
|
||||
// 所有表单项
|
||||
componentProps: {
|
||||
class: 'w-full',
|
||||
},
|
||||
},
|
||||
// handleSubmit: onSubmit,
|
||||
layout: 'horizontal',
|
||||
schema: [
|
||||
{
|
||||
component: 'VbenInput',
|
||||
fieldName: 'id',
|
||||
label: 'ID',
|
||||
formItemClass: 'col-span-6',
|
||||
defaultValue: '',
|
||||
dependencies: {
|
||||
show: false,
|
||||
triggerFields: ['id'],
|
||||
},
|
||||
},
|
||||
{
|
||||
component: 'Avatar',
|
||||
fieldName: 'drug_license_image',
|
||||
label: '药品经营许可证',
|
||||
formItemClass: 'col-span-4',
|
||||
},
|
||||
{
|
||||
component: 'Avatar',
|
||||
fieldName: 'business_license_image',
|
||||
label: '营业执照',
|
||||
formItemClass: 'col-span-4',
|
||||
},
|
||||
{
|
||||
component: 'Avatar',
|
||||
fieldName: 'medical_device_license_image',
|
||||
label: '医疗器械经营许可证',
|
||||
formItemClass: 'col-span-4',
|
||||
},
|
||||
{
|
||||
component: 'Avatar',
|
||||
fieldName: 'food_license_image',
|
||||
label: '食品经营许可证',
|
||||
formItemClass: 'col-span-4',
|
||||
},
|
||||
{
|
||||
component: 'Avatar',
|
||||
fieldName: 'pharmacist_certificate_image',
|
||||
label: '药师资格证',
|
||||
formItemClass: 'col-span-4',
|
||||
},
|
||||
{
|
||||
component: 'InputNumber',
|
||||
componentProps: {
|
||||
placeholder: '请输入排序顺序',
|
||||
min: 0,
|
||||
},
|
||||
// dependencies: {
|
||||
// show: false,
|
||||
// triggerFields: ['id'],
|
||||
// },
|
||||
fieldName: 'sort_order',
|
||||
label: '排序顺序',
|
||||
formItemClass: 'col-span-6',
|
||||
defaultValue: 0,
|
||||
},
|
||||
{
|
||||
component: 'VbenSelect',
|
||||
componentProps: {
|
||||
placeholder: '请选择状态',
|
||||
options: [
|
||||
{ label: '启用', value: 1 },
|
||||
{ label: '禁用', value: 0 },
|
||||
],
|
||||
},
|
||||
dependencies: {
|
||||
show: false,
|
||||
triggerFields: ['id'],
|
||||
},
|
||||
fieldName: 'status',
|
||||
label: '状态',
|
||||
formItemClass: 'col-span-6',
|
||||
defaultValue: 1,
|
||||
},
|
||||
{
|
||||
component: 'VbenInputNumber',
|
||||
componentProps: {
|
||||
placeholder: '门店ID(留空表示平台通用)',
|
||||
min: 0,
|
||||
},
|
||||
dependencies: {
|
||||
show: false,
|
||||
triggerFields: ['id'],
|
||||
},
|
||||
fieldName: 'store_id',
|
||||
label: '门店ID',
|
||||
formItemClass: 'col-span-6',
|
||||
defaultValue: 0,
|
||||
},
|
||||
],
|
||||
showDefaultActions: false,
|
||||
};
|
||||
@@ -0,0 +1,30 @@
|
||||
import type { VbenFormProps } from '#/adapter/form';
|
||||
|
||||
export const formOptions: VbenFormProps = {
|
||||
// 默认展开
|
||||
collapsed: false,
|
||||
schema: [
|
||||
{
|
||||
component: 'VbenSelect',
|
||||
componentProps: {
|
||||
placeholder: '选择状态',
|
||||
options: [
|
||||
{ label: '启用', value: 1 },
|
||||
{ label: '禁用', value: 0 },
|
||||
],
|
||||
},
|
||||
defaultValue: '',
|
||||
fieldName: 'status',
|
||||
label: '状态',
|
||||
},
|
||||
],
|
||||
// 控制表单是否显示折叠按钮
|
||||
showCollapseButton: true,
|
||||
submitButtonOptions: {
|
||||
content: '查询',
|
||||
},
|
||||
// 是否在字段值改变时提交表单
|
||||
submitOnChange: true,
|
||||
// 按下回车时是否提交表单
|
||||
submitOnEnter: false,
|
||||
};
|
||||
@@ -0,0 +1,113 @@
|
||||
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||
|
||||
import { getPlatformQualificationsList } from '../api/qualifications';
|
||||
|
||||
interface RowType {
|
||||
id: string;
|
||||
drug_license_image: string;
|
||||
business_license_image: string;
|
||||
medical_device_license_image: string;
|
||||
food_license_image: string;
|
||||
pharmacist_certificate_image: string;
|
||||
store_id: number | null;
|
||||
sort_order: number;
|
||||
status: number;
|
||||
status_txt: string;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
}
|
||||
|
||||
export const gridOptions: VxeGridProps<RowType> = {
|
||||
checkboxConfig: {
|
||||
highlight: true,
|
||||
labelField: '',
|
||||
},
|
||||
columnConfig: {
|
||||
useKey: true,
|
||||
},
|
||||
rowConfig: {
|
||||
useKey: true,
|
||||
},
|
||||
columns: [
|
||||
{ type: 'checkbox', width: 60 },
|
||||
{ field: 'id', align: 'left', title: 'ID', width: 100 },
|
||||
{
|
||||
field: 'drug_license_image',
|
||||
align: 'left',
|
||||
title: '药品经营许可证',
|
||||
slots: { default: 'drug_license_image' },
|
||||
width: 150,
|
||||
},
|
||||
{
|
||||
field: 'business_license_image',
|
||||
align: 'left',
|
||||
title: '营业执照',
|
||||
slots: { default: 'business_license_image' },
|
||||
width: 150,
|
||||
},
|
||||
{
|
||||
field: 'medical_device_license_image',
|
||||
align: 'left',
|
||||
title: '医疗器械经营许可证',
|
||||
slots: { default: 'medical_device_license_image' },
|
||||
width: 180,
|
||||
},
|
||||
{
|
||||
field: 'food_license_image',
|
||||
align: 'left',
|
||||
title: '食品经营许可证',
|
||||
slots: { default: 'food_license_image' },
|
||||
width: 150,
|
||||
},
|
||||
{
|
||||
field: 'pharmacist_certificate_image',
|
||||
align: 'left',
|
||||
title: '药师资格证',
|
||||
slots: { default: 'pharmacist_certificate_image' },
|
||||
width: 150,
|
||||
},
|
||||
{ field: 'store_id', align: 'left', title: '门店ID', width: 120 },
|
||||
{ field: 'sort_order', align: 'left', title: '排序', width: 100 },
|
||||
{
|
||||
field: 'status_txt',
|
||||
align: 'left',
|
||||
title: '状态',
|
||||
width: 100,
|
||||
},
|
||||
{ field: 'created_at', title: '创建时间', width: 180 },
|
||||
{ type: 'html', title: '操作', slots: { default: 'action' }, width: 150 },
|
||||
],
|
||||
keepSource: true,
|
||||
pagerConfig: {},
|
||||
proxyConfig: {
|
||||
ajax: {
|
||||
// 请求后端接口方法
|
||||
query: async ({ page }, formValues) => {
|
||||
return await getPlatformQualificationsList({
|
||||
page: page.currentPage,
|
||||
pageSize: page.pageSize,
|
||||
...formValues,
|
||||
});
|
||||
},
|
||||
},
|
||||
},
|
||||
border: false,
|
||||
toolbarConfig: {
|
||||
// 是否显示搜索表单控制按钮
|
||||
// @ts-ignore 正式环境时有完整的类型声明
|
||||
search: true,
|
||||
refresh: true, // 刷新
|
||||
print: false, // 打印
|
||||
export: false, // 导出
|
||||
// custom: true, // 自定义列
|
||||
zoom: true, // 最大化最小化
|
||||
slots: {
|
||||
buttons: 'toolbar-buttons',
|
||||
},
|
||||
custom: {
|
||||
// 自定义列-图标
|
||||
icon: 'vxe-icon-menu',
|
||||
},
|
||||
},
|
||||
showOverflow: false,
|
||||
};
|
||||
227
apps/web-antd/src/views/system/platform-info/index.vue
Normal file
227
apps/web-antd/src/views/system/platform-info/index.vue
Normal file
@@ -0,0 +1,227 @@
|
||||
<script lang="ts" setup>
|
||||
import type { VxeGridListeners } from '#/adapter/vxe-table';
|
||||
|
||||
import { ref } from 'vue';
|
||||
|
||||
import { Page, useVbenModal } from '@vben/common-ui';
|
||||
|
||||
import { Button, Image, message, Tabs, TabPane } from 'ant-design-vue';
|
||||
|
||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import { TableAction } from '#/components/table-action';
|
||||
|
||||
import { deletePlatformQualifications } from './api/qualifications';
|
||||
import FormModalDemo from './components/modal.vue';
|
||||
import QualificationsModalDemo from './components/qualifications-modal.vue';
|
||||
import { formOptions as qualificationsFormOptions } from './config/qualifications-search';
|
||||
import { gridOptions as qualificationsGridOptions } from './config/qualifications-table';
|
||||
|
||||
// 平台信息相关
|
||||
const [FormModal, formModalApi] = useVbenModal({
|
||||
connectedComponent: FormModalDemo,
|
||||
});
|
||||
|
||||
const showPlatformInfoModal = () => {
|
||||
formModalApi.setData({
|
||||
platform_id: 1, // 默认平台ID
|
||||
gridApi: null,
|
||||
});
|
||||
formModalApi.open();
|
||||
};
|
||||
|
||||
// 平台资质相关
|
||||
const activeTab = ref('qualifications');
|
||||
const hasTopTableDropDownActions = ref(false);
|
||||
|
||||
const gridEvents: VxeGridListeners<any> = {
|
||||
checkboxChange() {
|
||||
// eslint-disable-next-line no-use-before-define
|
||||
const records = qualificationsGridApi.grid.getCheckboxRecords();
|
||||
hasTopTableDropDownActions.value = records.length > 0;
|
||||
},
|
||||
checkboxAll() {
|
||||
// eslint-disable-next-line no-use-before-define
|
||||
const records = qualificationsGridApi.grid.getCheckboxRecords();
|
||||
hasTopTableDropDownActions.value = records.length > 0;
|
||||
},
|
||||
};
|
||||
|
||||
const [QualificationsGrid, qualificationsGridApi] = useVbenVxeGrid({
|
||||
formOptions: qualificationsFormOptions,
|
||||
gridOptions: qualificationsGridOptions,
|
||||
gridEvents,
|
||||
});
|
||||
|
||||
const [QualificationsFormModal, qualificationsFormModalApi] = useVbenModal({
|
||||
connectedComponent: QualificationsModalDemo,
|
||||
});
|
||||
|
||||
const showQualificationsModal = (data = {}, isUpdate = false) => {
|
||||
qualificationsFormModalApi.setData({
|
||||
// 表单值
|
||||
values: data,
|
||||
update: isUpdate,
|
||||
gridApi: qualificationsGridApi,
|
||||
});
|
||||
qualificationsFormModalApi.open();
|
||||
};
|
||||
|
||||
const deleteQualificationsApi = (row: any) => {
|
||||
let ids = [];
|
||||
if (row) {
|
||||
ids.push(row);
|
||||
} else {
|
||||
ids = qualificationsGridApi.grid.getCheckboxRecords().map((item) => item.id);
|
||||
}
|
||||
deletePlatformQualifications({ ids }).then(() => {
|
||||
message.success('删除成功!');
|
||||
qualificationsGridApi.reload();
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Page auto-content-height title="平台信息管理">
|
||||
<!-- 平台信息编辑弹窗 -->
|
||||
<FormModal />
|
||||
<!-- 平台资质编辑弹窗 -->
|
||||
<QualificationsFormModal />
|
||||
|
||||
<Tabs v-model:active-key="activeTab" type="card">
|
||||
<!-- <!– Tab 1: 平台信息 –>-->
|
||||
<!-- <TabPane key="info" tab="平台信息">-->
|
||||
<!-- <div class="p-4">-->
|
||||
<!-- <TableAction-->
|
||||
<!-- :actions="[-->
|
||||
<!-- {-->
|
||||
<!-- label: '编辑平台信息',-->
|
||||
<!-- type: 'primary',-->
|
||||
<!-- icon: 'ant-design:edit-outlined',-->
|
||||
<!-- onClick: showPlatformInfoModal,-->
|
||||
<!-- },-->
|
||||
<!-- ]"-->
|
||||
<!-- />-->
|
||||
<!-- <div class="mt-4 text-gray-500">-->
|
||||
<!-- <p>点击"编辑平台信息"按钮可以配置平台的联系方式和投诉举报方式。</p>-->
|
||||
<!-- <p class="mt-2">这些信息将在小程序端显示给用户。</p>-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
<!-- </TabPane>-->
|
||||
|
||||
<!-- Tab 2: 平台资质管理 -->
|
||||
<TabPane key="qualifications" tab="平台资质管理">
|
||||
<QualificationsGrid>
|
||||
<template #toolbar-buttons>
|
||||
<TableAction
|
||||
:actions="[
|
||||
{
|
||||
label: '新增',
|
||||
type: 'primary',
|
||||
icon: 'ant-design:plus-outlined',
|
||||
onClick: showQualificationsModal.bind(null),
|
||||
},
|
||||
]"
|
||||
:drop-down-actions="[
|
||||
{
|
||||
label: '删除',
|
||||
icon: 'ant-design:delete-outlined',
|
||||
ifShow: hasTopTableDropDownActions,
|
||||
popConfirm: {
|
||||
title: '确定删除吗?',
|
||||
confirm: deleteQualificationsApi.bind(null, false),
|
||||
},
|
||||
},
|
||||
]"
|
||||
>
|
||||
<template #more>
|
||||
<Button style="margin-left: 16px">
|
||||
批量操作
|
||||
<Icon icon="ant-design:down-outlined" />
|
||||
</Button>
|
||||
</template>
|
||||
</TableAction>
|
||||
</template>
|
||||
<template #drug_license_image="{ row }">
|
||||
<Image
|
||||
v-if="row.drug_license_image"
|
||||
:src="row.drug_license_image"
|
||||
height="30"
|
||||
width="30"
|
||||
:preview="{ src: row.drug_license_image }"
|
||||
style="cursor: pointer;"
|
||||
/>
|
||||
<span v-else>暂无</span>
|
||||
</template>
|
||||
<template #business_license_image="{ row }">
|
||||
<Image
|
||||
v-if="row.business_license_image"
|
||||
:src="row.business_license_image"
|
||||
height="30"
|
||||
width="30"
|
||||
:preview="{ src: row.business_license_image }"
|
||||
style="cursor: pointer;"
|
||||
/>
|
||||
<span v-else>暂无</span>
|
||||
</template>
|
||||
<template #medical_device_license_image="{ row }">
|
||||
<Image
|
||||
v-if="row.medical_device_license_image"
|
||||
:src="row.medical_device_license_image"
|
||||
height="30"
|
||||
width="30"
|
||||
:preview="{ src: row.medical_device_license_image }"
|
||||
style="cursor: pointer;"
|
||||
/>
|
||||
<span v-else>暂无</span>
|
||||
</template>
|
||||
<template #food_license_image="{ row }">
|
||||
<Image
|
||||
v-if="row.food_license_image"
|
||||
:src="row.food_license_image"
|
||||
height="30"
|
||||
width="30"
|
||||
:preview="{ src: row.food_license_image }"
|
||||
style="cursor: pointer;"
|
||||
/>
|
||||
<span v-else>暂无</span>
|
||||
</template>
|
||||
<template #pharmacist_certificate_image="{ row }">
|
||||
<Image
|
||||
v-if="row.pharmacist_certificate_image"
|
||||
:src="row.pharmacist_certificate_image"
|
||||
height="30"
|
||||
width="30"
|
||||
:preview="{ src: row.pharmacist_certificate_image }"
|
||||
style="cursor: pointer;"
|
||||
/>
|
||||
<span v-else>暂无</span>
|
||||
</template>
|
||||
<template #toolbar-tools></template>
|
||||
<template #action="{ row }">
|
||||
<TableAction
|
||||
:actions="[
|
||||
{
|
||||
label: '编辑',
|
||||
type: 'link',
|
||||
icon: 'uil:edit',
|
||||
size: 'small',
|
||||
onClick: showQualificationsModal.bind(null, row, true),
|
||||
},
|
||||
{
|
||||
label: '删除',
|
||||
type: 'link',
|
||||
icon: 'ant-design:delete-outlined',
|
||||
size: 'small',
|
||||
popConfirm: {
|
||||
title: '确定删除吗?',
|
||||
confirm: deleteQualificationsApi.bind(null, row.id),
|
||||
},
|
||||
},
|
||||
]"
|
||||
/>
|
||||
</template>
|
||||
</QualificationsGrid>
|
||||
</TabPane>
|
||||
</Tabs>
|
||||
</Page>
|
||||
</template>
|
||||
Reference in New Issue
Block a user