Compare commits
10 Commits
e5e95beea7
...
0de0938956
| Author | SHA1 | Date | |
|---|---|---|---|
| 0de0938956 | |||
| e1f8c76c4d | |||
| d7a446d3f9 | |||
| 20c44595df | |||
| c5d1100088 | |||
| 87aa9f9655 | |||
| a752648272 | |||
| 0c0f22efcb | |||
| f649802c53 | |||
| 11cc8cfa95 |
BIN
apps/web-antd/public/img/traditional-chinese-medicine.jpg
Normal file
BIN
apps/web-antd/public/img/traditional-chinese-medicine.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 67 KiB |
@@ -19,6 +19,7 @@ import { Base64 } from 'js-base64';
|
||||
import { useAuthStore } from '#/store';
|
||||
|
||||
import { refreshTokenApi } from './core';
|
||||
import {downloadByData} from "#/util/tool";
|
||||
|
||||
const { apiURL } = useAppConfig(import.meta.env, import.meta.env.PROD);
|
||||
|
||||
@@ -131,6 +132,9 @@ function createRequestClient(baseURL: string) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (response.data instanceof Blob) {
|
||||
return response;
|
||||
}
|
||||
|
||||
throw Object.assign({}, response, { response });
|
||||
},
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
import { defineOverridesPreferences } from '@vben/preferences';
|
||||
|
||||
// {
|
||||
// "app": {
|
||||
// "layout": "sidebar-nav"
|
||||
// }
|
||||
// }{
|
||||
// "tabbar": {
|
||||
// "enable": false
|
||||
// }
|
||||
// }
|
||||
/**
|
||||
* @description 项目配置文件
|
||||
* 只需要覆盖项目中的一部分配置,不需要的配置不用覆盖,会自动使用默认配置
|
||||
@@ -9,7 +17,8 @@ export const overridesPreferences = defineOverridesPreferences({
|
||||
// overrides
|
||||
app: {
|
||||
name: import.meta.env.VITE_APP_TITLE,
|
||||
layout: 'sidebar-mixed-nav',
|
||||
// layout: 'sidebar-mixed-nav',
|
||||
layout: 'sidebar-nav',
|
||||
// 登录过期模式
|
||||
// loginExpiredMode: 'modal',
|
||||
loginExpiredMode: 'page',
|
||||
@@ -18,7 +27,8 @@ export const overridesPreferences = defineOverridesPreferences({
|
||||
enableRefreshToken: false,
|
||||
defaultAvatar:
|
||||
'https://yanydy.oss-cn-hangzhou.aliyuncs.com/uploads/20241219/2b38e38414a2b9383b8643983e3f69d7.png',
|
||||
watermark: true,
|
||||
watermark: false,
|
||||
// watermark: true,
|
||||
// 是否开启检查更新
|
||||
enableCheckUpdates: true,
|
||||
// 检查更新的时间间隔,单位为分钟
|
||||
@@ -49,4 +59,7 @@ export const overridesPreferences = defineOverridesPreferences({
|
||||
icp: '浙ICP备19041368号-2',
|
||||
icpLink: 'https://beian.miit.gov.cn/#/Integrated/recordQuery',
|
||||
},
|
||||
tabbar: {
|
||||
enable: false,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -62,19 +62,19 @@ export const useAuthStore = defineStore('auth', () => {
|
||||
: await router.push(userInfo.home_path || DEFAULT_HOME_PATH);
|
||||
}
|
||||
|
||||
if (userInfo?.nick_name) {
|
||||
// 这里修改水印内容
|
||||
await updateWatermark({
|
||||
contentType: 'multi-line-text',
|
||||
// 水印内容
|
||||
content: `${userInfo?.nick_name}\r\n${userInfo?.phone}`,
|
||||
});
|
||||
notification.success({
|
||||
description: `${$t('authentication.loginSuccessDesc')}:${userInfo?.nick_name}`,
|
||||
duration: 3,
|
||||
message: $t('authentication.loginSuccess'),
|
||||
});
|
||||
}
|
||||
// if (userInfo?.nick_name) {
|
||||
// // 这里修改水印内容
|
||||
// await updateWatermark({
|
||||
// contentType: 'multi-line-text',
|
||||
// // 水印内容
|
||||
// content: `${userInfo?.nick_name}\r\n${userInfo?.phone}`,
|
||||
// });
|
||||
// notification.success({
|
||||
// description: `${$t('authentication.loginSuccessDesc')}:${userInfo?.nick_name}`,
|
||||
// duration: 3,
|
||||
// message: $t('authentication.loginSuccess'),
|
||||
// });
|
||||
// }
|
||||
}
|
||||
} finally {
|
||||
loginLoading.value = false;
|
||||
|
||||
@@ -373,3 +373,34 @@ export function formatTimeToRelative(time: string) {
|
||||
}
|
||||
return time;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Download according to the background interface file stream
|
||||
* @param {*} data
|
||||
* @param {*} filename
|
||||
* @param {*} mime
|
||||
* @param {*} bom
|
||||
*/
|
||||
export function downloadByData(
|
||||
data: BlobPart,
|
||||
filename: string,
|
||||
mime?: string,
|
||||
bom?: BlobPart,
|
||||
) {
|
||||
const blobData = bom === undefined ? [data] : [bom, data];
|
||||
const blob = new Blob(blobData, { type: mime || 'application/octet-stream' });
|
||||
|
||||
const blobURL = window.URL.createObjectURL(blob);
|
||||
const tempLink = document.createElement('a');
|
||||
tempLink.style.display = 'none';
|
||||
tempLink.href = blobURL;
|
||||
tempLink.setAttribute('download', filename);
|
||||
if (tempLink.download === undefined) {
|
||||
tempLink.setAttribute('target', '_blank');
|
||||
}
|
||||
document.body.append(tempLink);
|
||||
tempLink.click();
|
||||
tempLink.remove();
|
||||
window.URL.revokeObjectURL(blobURL);
|
||||
}
|
||||
|
||||
@@ -1,310 +0,0 @@
|
||||
<script lang="ts" setup>
|
||||
import { computed, ref } from 'vue';
|
||||
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
import { Timeline, TimelineItem } from 'ant-design-vue';
|
||||
|
||||
import {
|
||||
FileTextOutlined,
|
||||
MedicineBoxOutlined,
|
||||
ShopOutlined,
|
||||
UserOutlined,
|
||||
} from '@ant-design/icons-vue';
|
||||
|
||||
import { getPrescriptionSourceApi } from '../api';
|
||||
|
||||
defineOptions({ name: 'PrescriptionSource' });
|
||||
|
||||
// 处方溯源信息
|
||||
const data = ref();
|
||||
|
||||
// 格式化时间戳
|
||||
const formatTime = (timestamp) => {
|
||||
if (!timestamp) return '--';
|
||||
return new Date(timestamp * 1000).toLocaleString('zh-CN', {
|
||||
year: 'numeric',
|
||||
month: '2-digit',
|
||||
day: '2-digit',
|
||||
hour: '2-digit',
|
||||
minute: '2-digit',
|
||||
second: '2-digit',
|
||||
});
|
||||
};
|
||||
|
||||
// 处方类型
|
||||
const prescriptionTypeMap = {
|
||||
1: '西药处方',
|
||||
2: '中成药处方',
|
||||
3: '中药处方',
|
||||
};
|
||||
|
||||
// 处方状态
|
||||
const statusMap = {
|
||||
0: '待审核',
|
||||
1: '已审核',
|
||||
2: '已驳回',
|
||||
3: '已过期',
|
||||
};
|
||||
|
||||
// 计算属性:处方类型文本
|
||||
const prescriptionTypeText = computed(() => {
|
||||
return data.value
|
||||
? prescriptionTypeMap[data.value.prescription_type] || '未知'
|
||||
: '--';
|
||||
});
|
||||
|
||||
// 计算属性:处方状态文本
|
||||
const statusText = computed(() => {
|
||||
return data.value ? statusMap[data.value.status] || '未知' : '--';
|
||||
});
|
||||
|
||||
// 计算属性:状态颜色
|
||||
const statusColor = computed(() => {
|
||||
if (!data.value) return 'gray';
|
||||
|
||||
const statusColors = {
|
||||
0: 'orange',
|
||||
1: 'green',
|
||||
2: 'red',
|
||||
3: 'gray',
|
||||
};
|
||||
|
||||
return statusColors[data.value.status] || 'gray';
|
||||
});
|
||||
|
||||
// 计算属性:过期时间
|
||||
const expireTime = computed(() => {
|
||||
return data.value ? formatTime(data.value.auto_expire_time) : '--';
|
||||
});
|
||||
|
||||
const [Modal, modalApi] = useVbenModal({
|
||||
fullscreenButton: false,
|
||||
draggable: true,
|
||||
onCancel() {
|
||||
modalApi.close();
|
||||
},
|
||||
onConfirm: async () => {
|
||||
modalApi.close();
|
||||
},
|
||||
onOpenChange(isOpen: boolean) {
|
||||
const { id } = modalApi.getData<Record<string, any>>();
|
||||
if (isOpen && id) {
|
||||
getPrescriptionSourceApi({ id }).then((res) => {
|
||||
data.value = res;
|
||||
});
|
||||
} else {
|
||||
data.value = null; // Reset data when modal is closed or id is missing
|
||||
}
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Modal class="w-[80%]" title="处方溯源">
|
||||
<div v-if="data" class="prescription-source-container">
|
||||
<!-- 药店信息 -->
|
||||
<div
|
||||
class="mb-6 transform rounded-lg p-6 shadow-md transition-all duration-300 hover:shadow-lg"
|
||||
>
|
||||
<div class="mb-4 flex items-center">
|
||||
<ShopOutlined class="mr-2 text-xl text-purple-500" />
|
||||
<h2 class="text-xl font-bold">药店信息</h2>
|
||||
</div>
|
||||
<div v-if="data.store" class="grid grid-cols-1 gap-4">
|
||||
<div class="info-item">
|
||||
<span class="label">药店名称:</span>
|
||||
<span class="value">{{ data.store.name }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else class="italic text-gray-500">暂无药店信息</div>
|
||||
</div>
|
||||
|
||||
<!-- 处方基本信息 -->
|
||||
<div
|
||||
class="mb-6 transform rounded-lg p-6 shadow-md transition-all duration-300 hover:shadow-lg"
|
||||
>
|
||||
<div class="mb-4 flex items-center">
|
||||
<FileTextOutlined class="mr-2 text-xl text-blue-500" />
|
||||
<h2 class="text-xl font-bold">处方基本信息</h2>
|
||||
</div>
|
||||
<div class="grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-3">
|
||||
<div class="info-item">
|
||||
<span class="label">处方编号:</span>
|
||||
<span class="value">{{ data.prescription_no }}</span>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<span class="label">处方类型:</span>
|
||||
<span class="value">{{ prescriptionTypeText }}</span>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<span class="label">处方状态:</span>
|
||||
<span :class="`text-${statusColor}-500`" class="value">{{
|
||||
statusText
|
||||
}}</span>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<span class="label">总金额:</span>
|
||||
<span class="value font-bold text-red-500">¥{{ data.total_pay_price }}</span>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<span class="label">过期时间:</span>
|
||||
<span class="value">{{ expireTime }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 医生信息 -->
|
||||
<div
|
||||
class="mb-6 transform rounded-lg p-6 shadow-md transition-all duration-300 hover:shadow-lg"
|
||||
>
|
||||
<div class="mb-4 flex items-center">
|
||||
<MedicineBoxOutlined class="mr-2 text-xl text-green-500" />
|
||||
<h2 class="text-xl font-bold">医生信息</h2>
|
||||
</div>
|
||||
<div
|
||||
v-if="data.doctor_info"
|
||||
class="grid grid-cols-1 gap-4 md:grid-cols-2"
|
||||
>
|
||||
<div class="info-item">
|
||||
<span class="label">医生姓名:</span>
|
||||
<span class="value">{{ data.doctor_info.name }}</span>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<span class="label">所属科室:</span>
|
||||
<span class="value">{{
|
||||
data.doctor_info.depart?.name || '--'
|
||||
}}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else class="italic text-gray-500">暂无医生信息</div>
|
||||
</div>
|
||||
|
||||
<!-- 患者信息 -->
|
||||
<div
|
||||
class="transform rounded-lg p-6 shadow-md transition-all duration-300 hover:shadow-lg"
|
||||
>
|
||||
<div class="mb-4 flex items-center">
|
||||
<UserOutlined class="mr-2 text-xl text-amber-500" />
|
||||
<h2 class="text-xl font-bold">患者信息</h2>
|
||||
</div>
|
||||
<div
|
||||
v-if="data.user_patient"
|
||||
class="grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-3"
|
||||
>
|
||||
<div class="info-item">
|
||||
<span class="label">患者姓名:</span>
|
||||
<span class="value">{{ data.user_patient.name }}</span>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<span class="label">年龄:</span>
|
||||
<span class="value">{{ data.user_patient.age }}岁</span>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<span class="label">性别:</span>
|
||||
<span class="value">{{
|
||||
data.user_patient.sex === 1 ? '男' : '女'
|
||||
}}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else class="italic text-gray-500">暂无患者信息</div>
|
||||
</div>
|
||||
|
||||
<!-- 时间线 -->
|
||||
<div
|
||||
class="mb-6 transform rounded-lg p-6 shadow-md transition-all duration-300 hover:shadow-lg"
|
||||
>
|
||||
<div class="mb-4 flex items-center">
|
||||
<FileTextOutlined class="mr-2 text-xl text-blue-500" />
|
||||
<h2 class="text-xl font-bold">处方基本信息</h2>
|
||||
</div>
|
||||
<div class="grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-3 mt-5">
|
||||
<Timeline>
|
||||
<TimelineItem v-if="data.pharmacist_view_time">
|
||||
{{ data.pharmacist_view_time }}
|
||||
<template v-if="data.pharmacist_info">
|
||||
【{{ data.pharmacist_info.name }}】 审核
|
||||
</template>
|
||||
<template v-else> -- </template>
|
||||
</TimelineItem>
|
||||
<TimelineItem v-else>
|
||||
待审核
|
||||
</TimelineItem>
|
||||
<TimelineItem>
|
||||
{{ data.created_at }}
|
||||
<template v-if="data.doctor_info">
|
||||
【{{ data.doctor_info.name }}】 开方,诊断:{{
|
||||
data.clinical_diagnose
|
||||
}}
|
||||
</template>
|
||||
<template v-else> -- </template>
|
||||
</TimelineItem>
|
||||
<TimelineItem>
|
||||
{{ data.register.created_at }}
|
||||
<template v-if="data.doctor_info">
|
||||
【{{ data.user_patient.name }}】 挂号
|
||||
</template>
|
||||
<template v-else> -- </template>
|
||||
</TimelineItem>
|
||||
</Timeline>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 加载状态 -->
|
||||
<div v-else class="flex h-64 items-center justify-center">
|
||||
<div
|
||||
class="h-12 w-12 animate-spin rounded-full border-b-2 border-t-2 border-blue-500"
|
||||
></div>
|
||||
</div>
|
||||
</Modal>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.prescription-source-container {
|
||||
@apply max-h-[70vh] overflow-auto p-4;
|
||||
}
|
||||
|
||||
.info-item {
|
||||
@apply flex flex-col rounded-md p-3 transition-all duration-300;
|
||||
}
|
||||
|
||||
.label {
|
||||
@apply mb-1 text-sm text-gray-500;
|
||||
}
|
||||
|
||||
.value {
|
||||
@apply font-medium;
|
||||
}
|
||||
|
||||
/* 添加动感效果 */
|
||||
@keyframes fadeIn {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(10px);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translateY(0);
|
||||
}
|
||||
}
|
||||
|
||||
.prescription-source-container > div {
|
||||
animation: fadeIn 0.5s ease-out forwards;
|
||||
}
|
||||
|
||||
.prescription-source-container > div:nth-child(1) {
|
||||
animation-delay: 0.1s;
|
||||
}
|
||||
|
||||
.prescription-source-container > div:nth-child(2) {
|
||||
animation-delay: 0.2s;
|
||||
}
|
||||
|
||||
.prescription-source-container > div:nth-child(3) {
|
||||
animation-delay: 0.3s;
|
||||
}
|
||||
|
||||
.prescription-source-container > div:nth-child(4) {
|
||||
animation-delay: 0.4s;
|
||||
}
|
||||
</style>
|
||||
@@ -111,14 +111,14 @@ const openPrescriptionSourceModal = (id) => {
|
||||
{
|
||||
label: '查看处方',
|
||||
type: 'link',
|
||||
icon: 'ri:send-plane-fill',
|
||||
icon: 'marketeq:eye',
|
||||
// auth: ['超级订单', 'sys:user:save'],
|
||||
onClick: openPrescriptionDetail.bind(null, row.id),
|
||||
},
|
||||
{
|
||||
label: '处方溯源',
|
||||
type: 'link',
|
||||
icon: 'ri:send-plane-fill',
|
||||
icon: 'marketeq:eye',
|
||||
// auth: ['超级订单', 'sys:user:save'],
|
||||
onClick: openPrescriptionSourceModal.bind(null, row.id),
|
||||
},
|
||||
|
||||
@@ -70,3 +70,10 @@ export async function sendOrder(data: Record<string, any>) {
|
||||
export async function expressDetailByOrderId(data: Record<string, any>) {
|
||||
return requestClient.post<any>(`express-detail/detail-by-order`, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出订单数据
|
||||
*/
|
||||
export async function exportOrderApi() {
|
||||
return requestClient.download(`${prefix}export`);
|
||||
}
|
||||
|
||||
@@ -109,7 +109,16 @@ function getColor(status: any) {
|
||||
{{ data.free_ship === 1 ? '是' : '否' }}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="状态">
|
||||
{{ data.status === 0 ? '待处理' : '已处理' }}
|
||||
<Tag v-if="data.status === 0" color="red">待支付</Tag>
|
||||
<Tag v-else-if="data.status === 1" color="orange">待发货</Tag>
|
||||
<Tag v-else-if="data.status === 2" color="blue">待收货</Tag>
|
||||
<Tag v-else-if="data.status === 3" color="purple">待评价</Tag>
|
||||
<Tag v-else-if="data.status === 4" color="green">已退款</Tag>
|
||||
<Tag v-else-if="data.status === 5" color="pink">退款中</Tag>
|
||||
<Tag v-else-if="data.status === 6" color="cyan">已收货</Tag>
|
||||
<Tag v-else-if="data.status === 7" color="green">确认收货</Tag>
|
||||
<Tag v-else-if="data.status === 8" color="#B22222">拒绝退款</Tag>
|
||||
<Tag v-else-if="data.status === 9" color="gray">已取消</Tag>
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="配送方式">
|
||||
{{ deliveryMethod === 0 ? '快递到家' : '药店自提' }}
|
||||
@@ -158,8 +167,21 @@ function getColor(status: any) {
|
||||
</div>
|
||||
<div class="mt-4">
|
||||
<h3>订单商品</h3>
|
||||
<div v-if="data.prescription_type === 1">
|
||||
<ul class="custom-list pl-6">
|
||||
<li
|
||||
v-for="(item, index) in data.product_order_items"
|
||||
:key="index"
|
||||
class="custom-list-item"
|
||||
>
|
||||
【{{ item.drug.drug_number }}】 {{ item.drug_name }} (*
|
||||
{{ item.number * (item.dosage > 0 ? item.dosage : 1) }})
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<Card
|
||||
v-for="(item, index) in data.product_order_items"
|
||||
v-else
|
||||
:key="index"
|
||||
class="mb-4 mt-5"
|
||||
>
|
||||
@@ -167,7 +189,12 @@ function getColor(status: any) {
|
||||
<div
|
||||
class="mr-6 h-32 w-32 overflow-hidden rounded-lg bg-gray-200 dark:bg-gray-800"
|
||||
>
|
||||
<Image :src="item.drug_image || '/img/empty.png'" alt="/img/empty.png" height="100%" width="100%" />
|
||||
<Image
|
||||
:src="item.drug_image || '/img/empty.png'"
|
||||
alt="/img/empty.png"
|
||||
height="100%"
|
||||
width="100%"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<h4>{{ item.drug_name }}</h4>
|
||||
@@ -256,6 +283,34 @@ function getColor(status: any) {
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.custom-list {
|
||||
list-style-type: none;
|
||||
padding-left: 0;
|
||||
}
|
||||
|
||||
.custom-list-item {
|
||||
background-color: rgba(64, 158, 255, 0.04);
|
||||
border-radius: 4px;
|
||||
margin-bottom: 8px;
|
||||
padding: 8px 12px;
|
||||
font-size: 14px;
|
||||
transition: background-color 0.3s;
|
||||
|
||||
&:hover {
|
||||
background-color: rgba(64, 158, 255, 0.1);
|
||||
}
|
||||
|
||||
&::before {
|
||||
content: '';
|
||||
display: inline-block;
|
||||
width: 6px;
|
||||
height: 6px;
|
||||
background-color: #409eff;
|
||||
border-radius: 50%;
|
||||
margin-right: 8px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
}
|
||||
.ant-descriptions-item-label {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
@@ -42,7 +42,8 @@ export const gridOptions: VxeGridProps<RowType> = {
|
||||
title: '订单类型&邮寄方式&订单状态',
|
||||
slots: { default: 'delivery-method' },
|
||||
},
|
||||
{ field: 'items_price', title: '总价' },
|
||||
{ field: 'items_price', title: '药品总价' },
|
||||
{ field: 'total_pay_price', title: '支付总价' },
|
||||
{ field: 'is_sync_erp', title: 'Erp状态', slots: { default: 'is-sync-erp' } },
|
||||
{ field: 'pay_time', title: '支付时间', slots: { default: 'pay-time' } },
|
||||
{ field: 'created_at', title: '下单时间' },
|
||||
|
||||
@@ -11,11 +11,12 @@ import {
|
||||
} from '@vben/common-ui';
|
||||
import { SvgCakeIcon } from '@vben/icons';
|
||||
|
||||
import { Button, Image, Tag } from 'ant-design-vue';
|
||||
import {Button, Image, message, Tag} from 'ant-design-vue';
|
||||
|
||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import { TableAction } from '#/components/table-action';
|
||||
import {
|
||||
exportOrderApi,
|
||||
getOrderList,
|
||||
saleAmountApi,
|
||||
} from '#/views/business/order/product-order/api';
|
||||
@@ -25,6 +26,7 @@ import DetailModal from './components/detail.vue';
|
||||
import FormModalDemo from './components/modal.vue';
|
||||
import { formOptions } from './config/search';
|
||||
import { gridOptions } from './config/table';
|
||||
import {downloadByData} from "#/util/tool";
|
||||
|
||||
const hasTopTableDropDownActions = ref(false);
|
||||
|
||||
@@ -138,6 +140,18 @@ const openPrescriptionDetail = (values) => {
|
||||
});
|
||||
PrescrtionDetailModalApi.open();
|
||||
};
|
||||
|
||||
/**
|
||||
* 西药导出
|
||||
*/
|
||||
const passApplication = () => {
|
||||
// 新标签跳转到 exportWesternMedicineApi
|
||||
exportOrderApi().then((res) => {
|
||||
// 创建新的URL表示指定的File对象或者Blob对象。
|
||||
downloadByData(res.data, '萧康云医-西药导出.xlsx');
|
||||
message.success('导出成功!');
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -150,6 +164,13 @@ const openPrescriptionDetail = (values) => {
|
||||
<template #toolbar-buttons>
|
||||
<TableAction
|
||||
:actions="[
|
||||
{
|
||||
label: '导出',
|
||||
type: 'primary',
|
||||
icon: 'ix:export-check',
|
||||
// auth: ['超级西(中成)药', 'sys:user:save'],
|
||||
onClick: passApplication.bind(null),
|
||||
},
|
||||
{
|
||||
label: '展开全部',
|
||||
type: 'primary',
|
||||
@@ -237,11 +258,20 @@ const openPrescriptionDetail = (values) => {
|
||||
{
|
||||
label: '详情',
|
||||
type: 'link',
|
||||
icon: 'uil:edit',
|
||||
icon: 'marketeq:eye',
|
||||
size: 'small',
|
||||
// auth: ['order', 'sys:role:detail'],
|
||||
onClick: infoModal.bind(null, row),
|
||||
},
|
||||
{
|
||||
label: '处方',
|
||||
type: 'link',
|
||||
icon: 'marketeq:eye',
|
||||
// auth: ['超级订单', 'sys:user:save'],
|
||||
onClick: openPrescriptionDetail.bind(null, row.p_id),
|
||||
},
|
||||
]"
|
||||
:drop-down-actions="[
|
||||
{
|
||||
label: '发货',
|
||||
type: 'link',
|
||||
@@ -254,15 +284,6 @@ const openPrescriptionDetail = (values) => {
|
||||
// },
|
||||
},
|
||||
]"
|
||||
:drop-down-actions="[
|
||||
{
|
||||
label: '查看处方',
|
||||
type: 'link',
|
||||
icon: 'ri:send-plane-fill',
|
||||
// auth: ['超级订单', 'sys:user:save'],
|
||||
onClick: openPrescriptionDetail.bind(null, row.p_id),
|
||||
},
|
||||
]"
|
||||
/>
|
||||
</template>
|
||||
|
||||
|
||||
@@ -93,7 +93,7 @@ const openPrescriptionDetail = (values) => {
|
||||
{
|
||||
label: '查看处方',
|
||||
type: 'link',
|
||||
icon: 'ri:send-plane-fill',
|
||||
icon: 'marketeq:eye',
|
||||
// auth: ['超级订单', 'sys:user:save'],
|
||||
onClick: openPrescriptionDetail.bind(null, row.id),
|
||||
},
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
import type { RequestResponse } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
const prefix = 'china-medicine/';
|
||||
|
||||
/**
|
||||
* 分页查询用户列表
|
||||
* @param data
|
||||
*/
|
||||
export async function getChinaMedicineList(data: any) {
|
||||
return requestClient.get<any>(`${prefix}list`, { params: data });
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询用户列表
|
||||
* @param data
|
||||
*/
|
||||
export async function getChinaMedicineOption(data: any) {
|
||||
return requestClient.get<any>(`${prefix}option`, { params: data });
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取中药详情
|
||||
* @param id
|
||||
*/
|
||||
export async function getChinaMedicineInfo(id: number) {
|
||||
return requestClient.get<any>(`${prefix}detail`, { params: { id } });
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出中药药品
|
||||
*/
|
||||
export async function exportChinaMedicineApi() {
|
||||
return requestClient.download(`${prefix}export`);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增中药
|
||||
* @param data
|
||||
*/
|
||||
export async function createChinaMedicine(data: Record<string, any>) {
|
||||
return requestClient.post<any>(`${prefix}create`, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑中药
|
||||
* @param data
|
||||
*/
|
||||
export async function updateChinaMedicine(data: Record<string, any>) {
|
||||
return requestClient.post<any>(`${prefix}update`, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除中药
|
||||
* @param data
|
||||
*/
|
||||
export async function deleteChinaMedicine(data: Record<string, any>) {
|
||||
return requestClient.post<any>(`${prefix}delete`, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入中药
|
||||
* @param data
|
||||
*/
|
||||
export async function importChinaMedicineApi(data: Record<string, any>) {
|
||||
return requestClient.upload(`${prefix}import`, data);
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue';
|
||||
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
|
||||
import { message, UploadDragger } from 'ant-design-vue';
|
||||
|
||||
import { importChinaMedicineApi } from '../api';
|
||||
|
||||
const gridApi = ref();
|
||||
const fileList = ref([]);
|
||||
|
||||
const importChinaMedicine = (file) => {
|
||||
const submitApi = importChinaMedicineApi;
|
||||
submitApi({
|
||||
file: file.file,
|
||||
})
|
||||
.then(() => {
|
||||
message.success('导入成功');
|
||||
gridApi.value?.reload();
|
||||
modalApi.close();
|
||||
})
|
||||
.finally(() => {
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
const [Modal, modalApi] = useVbenModal({
|
||||
fullscreenButton: false,
|
||||
draggable: true,
|
||||
onCancel() {
|
||||
modalApi.close();
|
||||
},
|
||||
onConfirm: async () => {
|
||||
modalApi.setState({ loading: true, confirmLoading: true });
|
||||
const submitApi = importChinaMedicineApi;
|
||||
submitApi({
|
||||
file: fileList.value,
|
||||
})
|
||||
.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;
|
||||
},
|
||||
});
|
||||
</script>
|
||||
<template>
|
||||
<Modal class="w-[30%]" title="上传Excel">
|
||||
<UploadDragger
|
||||
v-model:file-list="fileList"
|
||||
:custom-request="importChinaMedicine"
|
||||
:max-count="1"
|
||||
name="file"
|
||||
>
|
||||
<p class="flex justify-center">
|
||||
<svg
|
||||
height="64"
|
||||
viewBox="0 0 32 32"
|
||||
width="64"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<defs>
|
||||
<linearGradient
|
||||
id="vscodeIconsFileTypeExcel0"
|
||||
gradientTransform="translate(0 2100)"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
x1="4.494"
|
||||
x2="13.832"
|
||||
y1="-2092.086"
|
||||
y2="-2075.914"
|
||||
>
|
||||
<stop offset="0" stop-color="#18884f" />
|
||||
<stop offset=".5" stop-color="#117e43" />
|
||||
<stop offset="1" stop-color="#0b6631" />
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<path
|
||||
d="M19.581 15.35L8.512 13.4v14.409A1.19 1.19 0 0 0 9.705 29h19.1A1.19 1.19 0 0 0 30 27.809V22.5Z"
|
||||
fill="#185c37"
|
||||
/>
|
||||
<path
|
||||
d="M19.581 3H9.705a1.19 1.19 0 0 0-1.193 1.191V9.5L19.581 16l5.861 1.95L30 16V9.5Z"
|
||||
fill="#21a366"
|
||||
/>
|
||||
<path d="M8.512 9.5h11.069V16H8.512Z" fill="#107c41" />
|
||||
<path
|
||||
d="M16.434 8.2H8.512v16.25h7.922a1.2 1.2 0 0 0 1.194-1.191V9.391A1.2 1.2 0 0 0 16.434 8.2"
|
||||
opacity="0.1"
|
||||
/>
|
||||
<path
|
||||
d="M15.783 8.85H8.512V25.1h7.271a1.2 1.2 0 0 0 1.194-1.191V10.041a1.2 1.2 0 0 0-1.194-1.191"
|
||||
opacity="0.2"
|
||||
/>
|
||||
<path
|
||||
d="M15.783 8.85H8.512V23.8h7.271a1.2 1.2 0 0 0 1.194-1.191V10.041a1.2 1.2 0 0 0-1.194-1.191"
|
||||
opacity="0.2"
|
||||
/>
|
||||
<path
|
||||
d="M15.132 8.85h-6.62V23.8h6.62a1.2 1.2 0 0 0 1.194-1.191V10.041a1.2 1.2 0 0 0-1.194-1.191"
|
||||
opacity="0.2"
|
||||
/>
|
||||
<path
|
||||
d="M3.194 8.85h11.938a1.193 1.193 0 0 1 1.194 1.191v11.918a1.193 1.193 0 0 1-1.194 1.191H3.194A1.19 1.19 0 0 1 2 21.959V10.041A1.19 1.19 0 0 1 3.194 8.85"
|
||||
fill="url(#vscodeIconsFileTypeExcel0)"
|
||||
/>
|
||||
<path
|
||||
d="m5.7 19.873l2.511-3.884l-2.3-3.862h1.847L9.013 14.6c.116.234.2.408.238.524h.017q.123-.281.26-.546l1.342-2.447h1.7l-2.359 3.84l2.419 3.905h-1.809l-1.45-2.711A2.4 2.4 0 0 1 9.2 16.8h-.024a1.7 1.7 0 0 1-.168.351l-1.493 2.722Z"
|
||||
fill="#fff"
|
||||
/>
|
||||
<path
|
||||
d="M28.806 3h-9.225v6.5H30V4.191A1.19 1.19 0 0 0 28.806 3"
|
||||
fill="#33c481"
|
||||
/>
|
||||
<path d="M19.581 16H30v6.5H19.581Z" fill="#107c41" />
|
||||
</svg>
|
||||
</p>
|
||||
<p class="ant-upload-text">点击或拖动文件到此区域进行上传</p>
|
||||
<p class="ant-upload-hint">
|
||||
支持单个上传,xlsx格式文件。严禁上传公司数据或其他带格式文件。
|
||||
</p>
|
||||
</UploadDragger>
|
||||
<!-- <Form />-->
|
||||
</Modal>
|
||||
</template>
|
||||
@@ -0,0 +1,132 @@
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue';
|
||||
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
import { useUserStore } from '@vben/stores';
|
||||
|
||||
import { message } from 'ant-design-vue';
|
||||
|
||||
import { useVbenForm } from '#/adapter/form';
|
||||
|
||||
import { createChinaMedicine, updateChinaMedicine } from '../api';
|
||||
import { modalFormProps } from '../config/form';
|
||||
import {getDrugUseList} from "#/views/doctor/doctor-reception/api";
|
||||
|
||||
defineOptions({
|
||||
name: 'FormModelDemo',
|
||||
});
|
||||
const userStore = useUserStore();
|
||||
|
||||
const drugTime = ref([]);
|
||||
const drugType = ref([]);
|
||||
const drugUnit = ref([]);
|
||||
const drugFrequency = ref([]);
|
||||
getDrugUseList().then((res) => {
|
||||
drugTime.value = res.drug_time.map((item) => {
|
||||
return {
|
||||
label: item.name,
|
||||
value: item.id,
|
||||
};
|
||||
});
|
||||
drugType.value = res.drug_use_type.map((item) => {
|
||||
return {
|
||||
label: item.name,
|
||||
value: item.id,
|
||||
};
|
||||
});
|
||||
drugUnit.value = res.drug_unit.map((item) => {
|
||||
return {
|
||||
label: item.name,
|
||||
value: item.id,
|
||||
};
|
||||
});
|
||||
drugFrequency.value = res.drug_use_frequency.map((item) => {
|
||||
return {
|
||||
label: item.name,
|
||||
value: item.id,
|
||||
};
|
||||
});
|
||||
return res;
|
||||
});
|
||||
|
||||
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
|
||||
? updateChinaMedicine
|
||||
: createChinaMedicine;
|
||||
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) {
|
||||
|
||||
formApi.updateSchema([
|
||||
{
|
||||
componentProps: {
|
||||
options: drugTime.value,
|
||||
},
|
||||
fieldName: 'time_id',
|
||||
},
|
||||
{
|
||||
componentProps: {
|
||||
options: drugUnit.value,
|
||||
},
|
||||
fieldName: 'unit_id',
|
||||
},
|
||||
{
|
||||
componentProps: {
|
||||
options: drugType.value,
|
||||
},
|
||||
fieldName: 'type_id',
|
||||
},
|
||||
{
|
||||
componentProps: {
|
||||
options: drugFrequency.value,
|
||||
},
|
||||
fieldName: 'frequency_id',
|
||||
},
|
||||
]);
|
||||
const { values, update } = modalApi.getData<Record<string, any>>();
|
||||
if (values) {
|
||||
console.log(values, 'sssssssssssss')
|
||||
isUpdate.value = update;
|
||||
formApi.setValues(values);
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
</script>
|
||||
<template>
|
||||
<Modal
|
||||
:title="`${isUpdate === true ? '编辑' : '新增'}中药`"
|
||||
class="w-[30%]"
|
||||
>
|
||||
<Form />
|
||||
</Modal>
|
||||
</template>
|
||||
@@ -0,0 +1,165 @@
|
||||
import type {VbenFormProps} from '#/adapter/form';
|
||||
|
||||
import {getSupplierOption} from '#/views/system/supplier/api';
|
||||
|
||||
|
||||
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',
|
||||
dependencies: {
|
||||
show: false,
|
||||
triggerFields: ['id'],
|
||||
},
|
||||
},
|
||||
{
|
||||
component: 'VbenInput',
|
||||
fieldName: 'showSelect',
|
||||
label: 'ID',
|
||||
formItemClass: 'col-span-6',
|
||||
dependencies: {
|
||||
show: false,
|
||||
triggerFields: ['id'],
|
||||
},
|
||||
},
|
||||
{
|
||||
component: 'VbenInput',
|
||||
componentProps: {
|
||||
placeholder: '请输入药品昵称',
|
||||
},
|
||||
fieldName: 'drug_name',
|
||||
formItemClass: 'col-span-6',
|
||||
label: '药品昵称',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
component: 'VbenInput',
|
||||
componentProps: {
|
||||
placeholder: '请输入药品别名',
|
||||
},
|
||||
fieldName: 'drug_alias',
|
||||
formItemClass: 'col-span-6',
|
||||
label: '药品别名',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
component: 'VbenInput',
|
||||
componentProps: {
|
||||
placeholder: '请输入药品编号',
|
||||
},
|
||||
fieldName: 'drug_number',
|
||||
formItemClass: 'col-span-6',
|
||||
label: '药品编号',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
component: 'VbenSelect',
|
||||
componentProps: {
|
||||
options: [],
|
||||
placeholder: '请选择',
|
||||
},
|
||||
fieldName: 'time_id',
|
||||
formItemClass: 'col-span-6',
|
||||
label: '使用时间',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
component: 'VbenSelect',
|
||||
componentProps: {
|
||||
options: [],
|
||||
placeholder: '请选择',
|
||||
},
|
||||
fieldName: 'type_id',
|
||||
formItemClass: 'col-span-6',
|
||||
label: '使用方法',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
component: 'VbenSelect',
|
||||
componentProps: {
|
||||
options: [],
|
||||
placeholder: '请选择',
|
||||
},
|
||||
fieldName: 'unit_id',
|
||||
formItemClass: 'col-span-6',
|
||||
label: '单位',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
component: 'VbenSelect',
|
||||
componentProps: {
|
||||
options: [],
|
||||
placeholder: '请选择',
|
||||
},
|
||||
fieldName: 'frequency_id',
|
||||
formItemClass: 'col-span-6',
|
||||
label: '频率',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
component: 'RadioGroup',
|
||||
componentProps: {
|
||||
placeholder: '请选择',
|
||||
options: [
|
||||
{
|
||||
label: '草稿',
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
label: '下架',
|
||||
value: 2,
|
||||
},
|
||||
{
|
||||
label: '上架',
|
||||
value: 3,
|
||||
},
|
||||
],
|
||||
},
|
||||
defaultValue: 1,
|
||||
formItemClass: 'col-span-12',
|
||||
fieldName: 'status',
|
||||
label: '商品状态',
|
||||
rules: 'required',
|
||||
},
|
||||
],
|
||||
showDefaultActions: false,
|
||||
};
|
||||
export const uploadExcelProps: VbenFormProps = {
|
||||
wrapperClass: 'grid-cols-12', // 24栅格,
|
||||
commonConfig: {
|
||||
formItemClass: 'col-span-12',
|
||||
// 所有表单项
|
||||
componentProps: {
|
||||
class: 'w-full',
|
||||
},
|
||||
},
|
||||
// handleSubmit: onSubmit,
|
||||
layout: 'horizontal',
|
||||
schema: [
|
||||
{
|
||||
component: 'Upload',
|
||||
componentProps: {
|
||||
placeholder: '请选择',
|
||||
multiple: true,
|
||||
},
|
||||
fieldName: 'frequency_id',
|
||||
formItemClass: 'col-span-12',
|
||||
label: '导入excel',
|
||||
rules: 'file',
|
||||
},
|
||||
],
|
||||
showDefaultActions: false,
|
||||
};
|
||||
@@ -0,0 +1,37 @@
|
||||
import type { VbenFormProps } from '#/adapter/form';
|
||||
|
||||
// import dayjs from 'dayjs';
|
||||
|
||||
export const formOptions: VbenFormProps = {
|
||||
// 默认展开
|
||||
collapsed: false,
|
||||
schema: [
|
||||
{
|
||||
component: 'VbenInput',
|
||||
componentProps: {
|
||||
placeholder: '输入名称',
|
||||
},
|
||||
defaultValue: '',
|
||||
fieldName: 'name',
|
||||
label: '中药名称',
|
||||
},
|
||||
// {
|
||||
// component: 'RangePicker',
|
||||
// componentProps: {
|
||||
// format: 'YYYY-MM-DD', // 确保格式与你需要的一致
|
||||
// },
|
||||
// // defaultValue: [dayjs().startOf('month'), dayjs()],
|
||||
// fieldName: 'search_time',
|
||||
// label: '时间范围',
|
||||
// },
|
||||
],
|
||||
// 控制表单是否显示折叠按钮
|
||||
showCollapseButton: true,
|
||||
submitButtonOptions: {
|
||||
content: '查询',
|
||||
},
|
||||
// 是否在字段值改变时提交表单
|
||||
submitOnChange: true,
|
||||
// 按下回车时是否提交表单
|
||||
submitOnEnter: false,
|
||||
};
|
||||
@@ -0,0 +1,70 @@
|
||||
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||
|
||||
import { getChinaMedicineList } from '../api';
|
||||
|
||||
interface RowType {
|
||||
id: string;
|
||||
name: string;
|
||||
logo: string;
|
||||
introduce: string;
|
||||
created_at: string;
|
||||
}
|
||||
|
||||
export const gridOptions: VxeGridProps<RowType> = {
|
||||
checkboxConfig: {
|
||||
highlight: true,
|
||||
labelField: '',
|
||||
},
|
||||
columnConfig: {
|
||||
useKey: true,
|
||||
},
|
||||
rowConfig: {
|
||||
useKey: true,
|
||||
},
|
||||
columns: [
|
||||
{ type: 'checkbox', width: 60 },
|
||||
{ field: 'id', align: 'left', title: 'ID', width: 100 },
|
||||
{ field: 'drug_name', align: 'left', title: '药品名称' },
|
||||
{ field: 'pinyin_simple', title: '拼音' },
|
||||
{ field: 'status', title: '状态', slots: { default: 'status' } },
|
||||
{ field: 'created_at', title: '发布时间' },
|
||||
{ type: 'html', title: '操作', slots: { default: 'action' } },
|
||||
],
|
||||
keepSource: true,
|
||||
pagerConfig: {},
|
||||
proxyConfig: {
|
||||
ajax: {
|
||||
// 请求后端接口方法
|
||||
query: async ({ page }, formValues) => {
|
||||
return await getChinaMedicineList({
|
||||
page: page.currentPage,
|
||||
pageSize: page.pageSize,
|
||||
...formValues,
|
||||
});
|
||||
},
|
||||
},
|
||||
},
|
||||
// exportConfig: {
|
||||
// api: passApplicationApi,
|
||||
// },
|
||||
height: 'auto',
|
||||
border: false,
|
||||
toolbarConfig: {
|
||||
// 是否显示搜索表单控制按钮
|
||||
// @ts-ignore 正式环境时有完整的类型声明
|
||||
search: true,
|
||||
refresh: true, // 刷新
|
||||
print: false, // 打印
|
||||
export: false, // 导出
|
||||
// custom: true, // 自定义列
|
||||
zoom: true, // 最大化最小化
|
||||
slots: {
|
||||
buttons: 'toolbar-buttons',
|
||||
},
|
||||
custom: {
|
||||
// 自定义列-图标
|
||||
icon: 'vxe-icon-menu',
|
||||
},
|
||||
},
|
||||
showOverflow: false,
|
||||
};
|
||||
@@ -0,0 +1,194 @@
|
||||
<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, Tag } from 'ant-design-vue';
|
||||
|
||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import { TableAction } from '#/components/table-action';
|
||||
import { downloadByData } from '#/util/tool';
|
||||
|
||||
import { deleteChinaMedicine, exportChinaMedicineApi } from './api';
|
||||
import FormModalDemo from './components/modal.vue';
|
||||
import ExcelUpload from './components/ExcelUpload.vue';
|
||||
import { formOptions } from './config/search';
|
||||
import { gridOptions } from './config/table';
|
||||
|
||||
const hasTopTableDropDownActions = ref(false);
|
||||
|
||||
const gridEvents: VxeGridListeners<any> = {
|
||||
checkboxChange() {
|
||||
// eslint-disable-next-line no-use-before-define
|
||||
const records = gridApi.grid.getCheckboxRecords();
|
||||
hasTopTableDropDownActions.value = records.length > 0;
|
||||
},
|
||||
checkboxAll() {
|
||||
// eslint-disable-next-line no-use-before-define
|
||||
const records = gridApi.grid.getCheckboxRecords();
|
||||
hasTopTableDropDownActions.value = records.length > 0;
|
||||
},
|
||||
};
|
||||
|
||||
const [Grid, gridApi] = useVbenVxeGrid({
|
||||
formOptions,
|
||||
gridOptions,
|
||||
gridEvents,
|
||||
});
|
||||
|
||||
const [FormModal, formModalApi] = useVbenModal({
|
||||
connectedComponent: FormModalDemo,
|
||||
});
|
||||
|
||||
const [ExcelUploadModal, ExcelUploadModalApi] = useVbenModal({
|
||||
connectedComponent: ExcelUpload,
|
||||
});
|
||||
|
||||
const showModal = (data = {}, isUpdate = false) => {
|
||||
formModalApi.setData({
|
||||
// 表单值
|
||||
values: data,
|
||||
update: isUpdate,
|
||||
gridApi,
|
||||
});
|
||||
formModalApi.open();
|
||||
};
|
||||
|
||||
const deleteApi = (row: any) => {
|
||||
let ids = [];
|
||||
if (row) {
|
||||
ids.push(row);
|
||||
} else {
|
||||
ids = gridApi.grid.getCheckboxRecords().map((item) => item.id);
|
||||
}
|
||||
deleteChinaMedicine({ ids }).then(() => {
|
||||
message.success('删除成功!');
|
||||
gridApi.reload();
|
||||
});
|
||||
};
|
||||
/**
|
||||
* 中药导出
|
||||
*/
|
||||
const passApplication = () => {
|
||||
// 新标签跳转到 exportChinaMedicineApi
|
||||
exportChinaMedicineApi().then((res) => {
|
||||
// 创建新的URL表示指定的File对象或者Blob对象。
|
||||
downloadByData(res.data, '萧康云医-中药导出.xlsx');
|
||||
message.success('导出成功!');
|
||||
});
|
||||
};
|
||||
|
||||
const openExcelUploadModal = () => {
|
||||
ExcelUploadModalApi.setData({
|
||||
gridApi,
|
||||
});
|
||||
ExcelUploadModalApi.open();
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Page auto-content-height title="中药管理">
|
||||
<ExcelUploadModal />
|
||||
<FormModal />
|
||||
<Grid>
|
||||
<template #toolbar-buttons>
|
||||
<TableAction
|
||||
:actions="[
|
||||
{
|
||||
label: '新增',
|
||||
type: 'primary',
|
||||
icon: 'ant-design:plus-outlined',
|
||||
// auth: ['超级中药', 'sys:user:save'],
|
||||
onClick: showModal.bind(null),
|
||||
},
|
||||
{
|
||||
label: '导入',
|
||||
type: 'primary',
|
||||
icon: 'ix:export-check',
|
||||
// auth: ['超级中药', 'sys:user:save'],
|
||||
onClick: openExcelUploadModal.bind(null),
|
||||
},
|
||||
{
|
||||
label: '导出',
|
||||
type: 'primary',
|
||||
icon: 'mingcute:download-3-fill',
|
||||
// auth: ['超级中药', 'sys:user:save'],
|
||||
onClick: passApplication.bind(null),
|
||||
},
|
||||
]"
|
||||
:drop-down-actions="[
|
||||
{
|
||||
label: '删除',
|
||||
icon: 'ant-design:delete-outlined',
|
||||
ifShow: hasTopTableDropDownActions,
|
||||
// auth: ['超级中药', 'sys:user:save'],
|
||||
popConfirm: {
|
||||
title: '确定删除吗?',
|
||||
confirm: deleteApi.bind(null, false),
|
||||
},
|
||||
},
|
||||
]"
|
||||
>
|
||||
<template #more>
|
||||
<Button style="margin-left: 16px">
|
||||
批量操作
|
||||
<Icon icon="ant-design:down-outlined" />
|
||||
</Button>
|
||||
</template>
|
||||
</TableAction>
|
||||
</template>
|
||||
<template #status="{ row }">
|
||||
<Tag :color="row.status_color">{{ row.status_txt }}</Tag>
|
||||
</template>
|
||||
<template #toolbar-tools></template>
|
||||
<template #action="{ row }">
|
||||
<TableAction
|
||||
:actions="[
|
||||
{
|
||||
label: '编辑',
|
||||
type: 'link',
|
||||
icon: 'uil:edit',
|
||||
size: 'small',
|
||||
// auth: ['china-medicine', 'sys:role:detail'],
|
||||
onClick: showModal.bind(null, row, true),
|
||||
},
|
||||
{
|
||||
label: '删除',
|
||||
type: 'link',
|
||||
icon: 'ant-design:delete-outlined',
|
||||
size: 'small',
|
||||
// auth: ['china-medicine', '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: ['china-medicine', 'sys:role:detail'],
|
||||
// onClick: showModal.bind(null, row, true),
|
||||
// },
|
||||
// {
|
||||
// label: '删除',
|
||||
// type: 'link',
|
||||
// icon: 'ant-design:delete-outlined',
|
||||
// size: 'small',
|
||||
// // auth: ['china-medicine', 'sys:role:detail'],
|
||||
// popConfirm: {
|
||||
// title: '确定删除吗?',
|
||||
// confirm: deleteApi.bind(null, row.id),
|
||||
// },
|
||||
// },
|
||||
]"
|
||||
/>
|
||||
</template>
|
||||
</Grid>
|
||||
</Page>
|
||||
</template>
|
||||
@@ -0,0 +1,66 @@
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
const prefix = 'western-medicine/';
|
||||
|
||||
/**
|
||||
* 分页查询用户列表
|
||||
* @param data
|
||||
*/
|
||||
export async function getWesternMedicineList(data: any) {
|
||||
return requestClient.get<any>(`${prefix}list`, { params: data });
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询用户列表
|
||||
* @param data
|
||||
*/
|
||||
export async function getWesternMedicineOption(data: any) {
|
||||
return requestClient.get<any>(`${prefix}option`, { params: data });
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取西(中成)药详情
|
||||
* @param id
|
||||
*/
|
||||
export async function getWesternMedicineInfo(id: number) {
|
||||
return requestClient.get<any>(`${prefix}detail`, { params: { id } });
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出西药药品
|
||||
*/
|
||||
export async function exportWesternMedicineApi() {
|
||||
return requestClient.download(`${prefix}export`);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增西(中成)药
|
||||
* @param data
|
||||
*/
|
||||
export async function createWesternMedicine(data: Record<string, any>) {
|
||||
return requestClient.post<any>(`${prefix}create`, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑西(中成)药
|
||||
* @param data
|
||||
*/
|
||||
export async function updateWesternMedicine(data: Record<string, any>) {
|
||||
return requestClient.post<any>(`${prefix}update`, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除西(中成)药
|
||||
* @param data
|
||||
*/
|
||||
export async function deleteWesternMedicine(data: Record<string, any>) {
|
||||
return requestClient.post<any>(`${prefix}delete`, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入西药
|
||||
* @param data
|
||||
*/
|
||||
export async function importWesternMedicineApi(data: Record<string, any>) {
|
||||
return requestClient.upload(`${prefix}import`, data);
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue';
|
||||
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
|
||||
import { message, UploadDragger } from 'ant-design-vue';
|
||||
|
||||
import { importWesternMedicineApi } from '../api';
|
||||
|
||||
const gridApi = ref();
|
||||
const fileList = ref([]);
|
||||
|
||||
const importWesternMedicine = (file) => {
|
||||
const submitApi = importWesternMedicineApi;
|
||||
submitApi({
|
||||
file: file.file,
|
||||
})
|
||||
.then(() => {
|
||||
message.success('导入成功');
|
||||
gridApi.value?.reload();
|
||||
modalApi.close();
|
||||
})
|
||||
.finally(() => {
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
const [Modal, modalApi] = useVbenModal({
|
||||
fullscreenButton: false,
|
||||
draggable: true,
|
||||
onCancel() {
|
||||
modalApi.close();
|
||||
},
|
||||
onConfirm: async () => {
|
||||
modalApi.setState({ loading: true, confirmLoading: true });
|
||||
const submitApi = importWesternMedicineApi;
|
||||
submitApi({
|
||||
file: fileList.value,
|
||||
})
|
||||
.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;
|
||||
},
|
||||
});
|
||||
</script>
|
||||
<template>
|
||||
<Modal class="w-[30%]" title="上传Excel">
|
||||
<UploadDragger
|
||||
v-model:file-list="fileList"
|
||||
:custom-request="importWesternMedicine"
|
||||
:max-count="1"
|
||||
name="file"
|
||||
>
|
||||
<p class="flex justify-center">
|
||||
<svg
|
||||
height="64"
|
||||
viewBox="0 0 32 32"
|
||||
width="64"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<defs>
|
||||
<linearGradient
|
||||
id="vscodeIconsFileTypeExcel0"
|
||||
gradientTransform="translate(0 2100)"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
x1="4.494"
|
||||
x2="13.832"
|
||||
y1="-2092.086"
|
||||
y2="-2075.914"
|
||||
>
|
||||
<stop offset="0" stop-color="#18884f" />
|
||||
<stop offset=".5" stop-color="#117e43" />
|
||||
<stop offset="1" stop-color="#0b6631" />
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<path
|
||||
d="M19.581 15.35L8.512 13.4v14.409A1.19 1.19 0 0 0 9.705 29h19.1A1.19 1.19 0 0 0 30 27.809V22.5Z"
|
||||
fill="#185c37"
|
||||
/>
|
||||
<path
|
||||
d="M19.581 3H9.705a1.19 1.19 0 0 0-1.193 1.191V9.5L19.581 16l5.861 1.95L30 16V9.5Z"
|
||||
fill="#21a366"
|
||||
/>
|
||||
<path d="M8.512 9.5h11.069V16H8.512Z" fill="#107c41" />
|
||||
<path
|
||||
d="M16.434 8.2H8.512v16.25h7.922a1.2 1.2 0 0 0 1.194-1.191V9.391A1.2 1.2 0 0 0 16.434 8.2"
|
||||
opacity="0.1"
|
||||
/>
|
||||
<path
|
||||
d="M15.783 8.85H8.512V25.1h7.271a1.2 1.2 0 0 0 1.194-1.191V10.041a1.2 1.2 0 0 0-1.194-1.191"
|
||||
opacity="0.2"
|
||||
/>
|
||||
<path
|
||||
d="M15.783 8.85H8.512V23.8h7.271a1.2 1.2 0 0 0 1.194-1.191V10.041a1.2 1.2 0 0 0-1.194-1.191"
|
||||
opacity="0.2"
|
||||
/>
|
||||
<path
|
||||
d="M15.132 8.85h-6.62V23.8h6.62a1.2 1.2 0 0 0 1.194-1.191V10.041a1.2 1.2 0 0 0-1.194-1.191"
|
||||
opacity="0.2"
|
||||
/>
|
||||
<path
|
||||
d="M3.194 8.85h11.938a1.193 1.193 0 0 1 1.194 1.191v11.918a1.193 1.193 0 0 1-1.194 1.191H3.194A1.19 1.19 0 0 1 2 21.959V10.041A1.19 1.19 0 0 1 3.194 8.85"
|
||||
fill="url(#vscodeIconsFileTypeExcel0)"
|
||||
/>
|
||||
<path
|
||||
d="m5.7 19.873l2.511-3.884l-2.3-3.862h1.847L9.013 14.6c.116.234.2.408.238.524h.017q.123-.281.26-.546l1.342-2.447h1.7l-2.359 3.84l2.419 3.905h-1.809l-1.45-2.711A2.4 2.4 0 0 1 9.2 16.8h-.024a1.7 1.7 0 0 1-.168.351l-1.493 2.722Z"
|
||||
fill="#fff"
|
||||
/>
|
||||
<path
|
||||
d="M28.806 3h-9.225v6.5H30V4.191A1.19 1.19 0 0 0 28.806 3"
|
||||
fill="#33c481"
|
||||
/>
|
||||
<path d="M19.581 16H30v6.5H19.581Z" fill="#107c41" />
|
||||
</svg>
|
||||
</p>
|
||||
<p class="ant-upload-text">点击或拖动文件到此区域进行上传</p>
|
||||
<p class="ant-upload-hint">
|
||||
支持单个上传,xlsx格式文件。严禁上传公司数据或其他带格式文件。
|
||||
</p>
|
||||
</UploadDragger>
|
||||
<!-- <Form />-->
|
||||
</Modal>
|
||||
</template>
|
||||
@@ -0,0 +1,132 @@
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue';
|
||||
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
import { useUserStore } from '@vben/stores';
|
||||
|
||||
import { message } from 'ant-design-vue';
|
||||
|
||||
import { useVbenForm } from '#/adapter/form';
|
||||
|
||||
import { createWesternMedicine, updateWesternMedicine } from '../api';
|
||||
import { modalFormProps } from '../config/form';
|
||||
import {getDrugUseList} from "#/views/doctor/doctor-reception/api";
|
||||
|
||||
defineOptions({
|
||||
name: 'FormModelDemo',
|
||||
});
|
||||
const userStore = useUserStore();
|
||||
|
||||
const drugTime = ref([]);
|
||||
const drugType = ref([]);
|
||||
const drugUnit = ref([]);
|
||||
const drugFrequency = ref([]);
|
||||
getDrugUseList().then((res) => {
|
||||
drugTime.value = res.drug_time.map((item) => {
|
||||
return {
|
||||
label: item.name,
|
||||
value: item.id,
|
||||
};
|
||||
});
|
||||
drugType.value = res.drug_use_type.map((item) => {
|
||||
return {
|
||||
label: item.name,
|
||||
value: item.id,
|
||||
};
|
||||
});
|
||||
drugUnit.value = res.drug_unit.map((item) => {
|
||||
return {
|
||||
label: item.name,
|
||||
value: item.id,
|
||||
};
|
||||
});
|
||||
drugFrequency.value = res.drug_use_frequency.map((item) => {
|
||||
return {
|
||||
label: item.name,
|
||||
value: item.id,
|
||||
};
|
||||
});
|
||||
return res;
|
||||
});
|
||||
|
||||
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
|
||||
? updateWesternMedicine
|
||||
: createWesternMedicine;
|
||||
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) {
|
||||
|
||||
formApi.updateSchema([
|
||||
{
|
||||
componentProps: {
|
||||
options: drugTime.value,
|
||||
},
|
||||
fieldName: 'time_id',
|
||||
},
|
||||
{
|
||||
componentProps: {
|
||||
options: drugUnit.value,
|
||||
},
|
||||
fieldName: 'unit_id',
|
||||
},
|
||||
{
|
||||
componentProps: {
|
||||
options: drugType.value,
|
||||
},
|
||||
fieldName: 'type_id',
|
||||
},
|
||||
{
|
||||
componentProps: {
|
||||
options: drugFrequency.value,
|
||||
},
|
||||
fieldName: 'frequency_id',
|
||||
},
|
||||
]);
|
||||
const { values, update } = modalApi.getData<Record<string, any>>();
|
||||
if (values) {
|
||||
console.log(values, 'sssssssssssss')
|
||||
isUpdate.value = update;
|
||||
formApi.setValues(values);
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
</script>
|
||||
<template>
|
||||
<Modal
|
||||
:title="`${isUpdate === true ? '编辑' : '新增'}西(中成)药`"
|
||||
class="w-[30%]"
|
||||
>
|
||||
<Form />
|
||||
</Modal>
|
||||
</template>
|
||||
@@ -0,0 +1,222 @@
|
||||
import type {VbenFormProps} from '#/adapter/form';
|
||||
|
||||
import {getSupplierOption} from '#/views/system/supplier/api';
|
||||
|
||||
|
||||
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',
|
||||
dependencies: {
|
||||
show: false,
|
||||
triggerFields: ['id'],
|
||||
},
|
||||
},
|
||||
{
|
||||
component: 'VbenInput',
|
||||
fieldName: 'showSelect',
|
||||
label: 'ID',
|
||||
formItemClass: 'col-span-6',
|
||||
dependencies: {
|
||||
show: false,
|
||||
triggerFields: ['id'],
|
||||
},
|
||||
},
|
||||
{
|
||||
component: 'Avatar',
|
||||
fieldName: 'image',
|
||||
label: '产品图片',
|
||||
rules: 'required',
|
||||
formItemClass: 'col-span-6',
|
||||
},
|
||||
{
|
||||
component: 'ApiSelect',
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
showSearch: true,
|
||||
filterOption: (input: string, option: any) => {
|
||||
// 自定义过滤逻辑,确保可以根据 name 进行搜索
|
||||
return option?.label.toLowerCase().indexOf(input.toLowerCase()) >= 0;
|
||||
},
|
||||
// 菜单接口转options格式
|
||||
afterFetch: (data: { id: number; name: string }[]) => {
|
||||
return data.map((item: any) => ({
|
||||
label: item.name,
|
||||
value: item.id,
|
||||
}));
|
||||
},
|
||||
api: getSupplierOption,
|
||||
placeholder: '请选择',
|
||||
},
|
||||
fieldName: 'supplier_id',
|
||||
formItemClass: 'col-span-6',
|
||||
label: '所属供应商',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
component: 'VbenInput',
|
||||
componentProps: {
|
||||
placeholder: '请输入药品昵称',
|
||||
},
|
||||
fieldName: 'drug_name',
|
||||
formItemClass: 'col-span-6',
|
||||
label: '药品昵称',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
component: 'VbenInput',
|
||||
componentProps: {
|
||||
placeholder: '请输入药品别名',
|
||||
},
|
||||
fieldName: 'drug_alias',
|
||||
formItemClass: 'col-span-6',
|
||||
label: '药品别名',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
component: 'VbenInput',
|
||||
componentProps: {
|
||||
placeholder: '请输入药品编号',
|
||||
},
|
||||
fieldName: 'drug_number',
|
||||
formItemClass: 'col-span-6',
|
||||
label: '药品编号',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
component: 'VbenInput',
|
||||
componentProps: {
|
||||
placeholder: '请输入规格',
|
||||
},
|
||||
fieldName: 'specification',
|
||||
formItemClass: 'col-span-6',
|
||||
label: '规格',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
component: 'VbenSelect',
|
||||
componentProps: {
|
||||
options: [],
|
||||
placeholder: '请选择',
|
||||
},
|
||||
fieldName: 'time_id',
|
||||
formItemClass: 'col-span-6',
|
||||
label: '使用时间',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
component: 'VbenSelect',
|
||||
componentProps: {
|
||||
options: [],
|
||||
placeholder: '请选择',
|
||||
},
|
||||
fieldName: 'type_id',
|
||||
formItemClass: 'col-span-6',
|
||||
label: '使用方法',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
component: 'VbenSelect',
|
||||
componentProps: {
|
||||
options: [],
|
||||
placeholder: '请选择',
|
||||
},
|
||||
fieldName: 'unit_id',
|
||||
formItemClass: 'col-span-6',
|
||||
label: '单位',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
component: 'VbenSelect',
|
||||
componentProps: {
|
||||
options: [],
|
||||
placeholder: '请选择',
|
||||
},
|
||||
fieldName: 'frequency_id',
|
||||
formItemClass: 'col-span-6',
|
||||
label: '频率',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
component: 'RadioGroup',
|
||||
componentProps: {
|
||||
placeholder: '请选择',
|
||||
options: [
|
||||
{
|
||||
label: '草稿',
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
label: '下架',
|
||||
value: 2,
|
||||
},
|
||||
{
|
||||
label: '上架',
|
||||
value: 3,
|
||||
},
|
||||
],
|
||||
},
|
||||
defaultValue: 1,
|
||||
formItemClass: 'col-span-12',
|
||||
fieldName: 'status',
|
||||
label: '商品状态',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
component: 'Textarea',
|
||||
componentProps: {
|
||||
placeholder: '请输入药品主治功能',
|
||||
},
|
||||
fieldName: 'function',
|
||||
label: '药品主治功能',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
component: 'Avatar',
|
||||
fieldName: 'instruction',
|
||||
label: '产品说明书',
|
||||
rules: 'required',
|
||||
formItemClass: 'col-span-6',
|
||||
},
|
||||
],
|
||||
showDefaultActions: false,
|
||||
};
|
||||
export const uploadExcelProps: VbenFormProps = {
|
||||
wrapperClass: 'grid-cols-12', // 24栅格,
|
||||
commonConfig: {
|
||||
formItemClass: 'col-span-12',
|
||||
// 所有表单项
|
||||
componentProps: {
|
||||
class: 'w-full',
|
||||
},
|
||||
},
|
||||
// handleSubmit: onSubmit,
|
||||
layout: 'horizontal',
|
||||
schema: [
|
||||
{
|
||||
component: 'Upload',
|
||||
componentProps: {
|
||||
placeholder: '请选择',
|
||||
multiple: true,
|
||||
},
|
||||
fieldName: 'frequency_id',
|
||||
formItemClass: 'col-span-12',
|
||||
label: '导入excel',
|
||||
rules: 'file',
|
||||
},
|
||||
],
|
||||
showDefaultActions: false,
|
||||
};
|
||||
@@ -0,0 +1,37 @@
|
||||
import type { VbenFormProps } from '#/adapter/form';
|
||||
|
||||
// import dayjs from 'dayjs';
|
||||
|
||||
export const formOptions: VbenFormProps = {
|
||||
// 默认展开
|
||||
collapsed: false,
|
||||
schema: [
|
||||
{
|
||||
component: 'VbenInput',
|
||||
componentProps: {
|
||||
placeholder: '输入名称',
|
||||
},
|
||||
defaultValue: '',
|
||||
fieldName: 'name',
|
||||
label: '西(中成)药名称',
|
||||
},
|
||||
// {
|
||||
// component: 'RangePicker',
|
||||
// componentProps: {
|
||||
// format: 'YYYY-MM-DD', // 确保格式与你需要的一致
|
||||
// },
|
||||
// // defaultValue: [dayjs().startOf('month'), dayjs()],
|
||||
// fieldName: 'search_time',
|
||||
// label: '时间范围',
|
||||
// },
|
||||
],
|
||||
// 控制表单是否显示折叠按钮
|
||||
showCollapseButton: true,
|
||||
submitButtonOptions: {
|
||||
content: '查询',
|
||||
},
|
||||
// 是否在字段值改变时提交表单
|
||||
submitOnChange: true,
|
||||
// 按下回车时是否提交表单
|
||||
submitOnEnter: false,
|
||||
};
|
||||
@@ -0,0 +1,87 @@
|
||||
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||
|
||||
import { getWesternMedicineList } from '../api';
|
||||
|
||||
interface RowType {
|
||||
id: string;
|
||||
name: string;
|
||||
logo: string;
|
||||
introduce: string;
|
||||
created_at: string;
|
||||
}
|
||||
|
||||
export const gridOptions: VxeGridProps<RowType> = {
|
||||
checkboxConfig: {
|
||||
highlight: true,
|
||||
labelField: '',
|
||||
},
|
||||
columnConfig: {
|
||||
useKey: true,
|
||||
},
|
||||
rowConfig: {
|
||||
useKey: true,
|
||||
},
|
||||
columns: [
|
||||
{ type: 'checkbox', width: 60 },
|
||||
{ field: 'id', align: 'left', title: 'ID', width: 100 },
|
||||
{ field: 'drug_name', align: 'left', title: '药品名称' },
|
||||
{ field: 'pinyin_simple', title: '拼音' },
|
||||
{ field: 'supplier.name', title: '供应商', slots: { default: 'supplier' } },
|
||||
{
|
||||
field: 'image',
|
||||
align: 'left',
|
||||
title: '产品图片',
|
||||
slots: { default: 'image' },
|
||||
width: 130,
|
||||
},
|
||||
{
|
||||
field: 'instruction',
|
||||
align: 'left',
|
||||
title: '说明书',
|
||||
slots: { default: 'instruction' },
|
||||
width: 130,
|
||||
},
|
||||
{ field: 'function', title: '主要功能' },
|
||||
{ field: 'specification', title: '规格' },
|
||||
{ field: 'status', title: '状态', slots: { default: 'status' } },
|
||||
{ field: 'created_at', title: '发布时间' },
|
||||
{ type: 'html', title: '操作', slots: { default: 'action' } },
|
||||
],
|
||||
keepSource: true,
|
||||
pagerConfig: {},
|
||||
proxyConfig: {
|
||||
ajax: {
|
||||
// 请求后端接口方法
|
||||
query: async ({ page }, formValues) => {
|
||||
return await getWesternMedicineList({
|
||||
page: page.currentPage,
|
||||
pageSize: page.pageSize,
|
||||
...formValues,
|
||||
});
|
||||
},
|
||||
},
|
||||
},
|
||||
// exportConfig: {
|
||||
// api: passApplicationApi,
|
||||
// },
|
||||
height: 'auto',
|
||||
border: false,
|
||||
toolbarConfig: {
|
||||
// 是否显示搜索表单控制按钮
|
||||
// @ts-ignore 正式环境时有完整的类型声明
|
||||
search: true,
|
||||
refresh: true, // 刷新
|
||||
print: false, // 打印
|
||||
export: false, // 导出
|
||||
// custom: true, // 自定义列
|
||||
zoom: true, // 最大化最小化
|
||||
slots: {
|
||||
buttons: 'toolbar-buttons',
|
||||
},
|
||||
custom: {
|
||||
// 自定义列-图标
|
||||
icon: 'vxe-icon-menu',
|
||||
},
|
||||
},
|
||||
showOverflow: false,
|
||||
};
|
||||
@@ -0,0 +1,205 @@
|
||||
<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, Tag } from 'ant-design-vue';
|
||||
|
||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import { TableAction } from '#/components/table-action';
|
||||
import { downloadByData } from '#/util/tool';
|
||||
|
||||
import { deleteWesternMedicine, exportWesternMedicineApi } from './api';
|
||||
import FormModalDemo from './components/modal.vue';
|
||||
import ExcelUpload from './components/ExcelUpload.vue';
|
||||
import { formOptions } from './config/search';
|
||||
import { gridOptions } from './config/table';
|
||||
|
||||
const hasTopTableDropDownActions = ref(false);
|
||||
|
||||
const gridEvents: VxeGridListeners<any> = {
|
||||
checkboxChange() {
|
||||
// eslint-disable-next-line no-use-before-define
|
||||
const records = gridApi.grid.getCheckboxRecords();
|
||||
hasTopTableDropDownActions.value = records.length > 0;
|
||||
},
|
||||
checkboxAll() {
|
||||
// eslint-disable-next-line no-use-before-define
|
||||
const records = gridApi.grid.getCheckboxRecords();
|
||||
hasTopTableDropDownActions.value = records.length > 0;
|
||||
},
|
||||
};
|
||||
|
||||
const [Grid, gridApi] = useVbenVxeGrid({
|
||||
formOptions,
|
||||
gridOptions,
|
||||
gridEvents,
|
||||
});
|
||||
|
||||
const [FormModal, formModalApi] = useVbenModal({
|
||||
connectedComponent: FormModalDemo,
|
||||
});
|
||||
|
||||
const [ExcelUploadModal, ExcelUploadModalApi] = useVbenModal({
|
||||
connectedComponent: ExcelUpload,
|
||||
});
|
||||
|
||||
const showModal = (data = {}, isUpdate = false) => {
|
||||
formModalApi.setData({
|
||||
// 表单值
|
||||
values: data,
|
||||
update: isUpdate,
|
||||
gridApi,
|
||||
});
|
||||
formModalApi.open();
|
||||
};
|
||||
|
||||
const deleteApi = (row: any) => {
|
||||
let ids = [];
|
||||
if (row) {
|
||||
ids.push(row);
|
||||
} else {
|
||||
ids = gridApi.grid.getCheckboxRecords().map((item) => item.id);
|
||||
}
|
||||
deleteWesternMedicine({ ids }).then(() => {
|
||||
message.success('删除成功!');
|
||||
gridApi.reload();
|
||||
});
|
||||
};
|
||||
/**
|
||||
* 西药导出
|
||||
*/
|
||||
const passApplication = () => {
|
||||
// 新标签跳转到 exportWesternMedicineApi
|
||||
exportWesternMedicineApi().then((res) => {
|
||||
// 创建新的URL表示指定的File对象或者Blob对象。
|
||||
downloadByData(res.data, '萧康云医-西药导出.xlsx');
|
||||
message.success('导出成功!');
|
||||
});
|
||||
};
|
||||
|
||||
const openExcelUploadModal = () => {
|
||||
ExcelUploadModalApi.setData({
|
||||
gridApi,
|
||||
});
|
||||
ExcelUploadModalApi.open();
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Page auto-content-height title="西(中成)药管理">
|
||||
<ExcelUploadModal />
|
||||
<FormModal />
|
||||
<Grid>
|
||||
<template #toolbar-buttons>
|
||||
<TableAction
|
||||
:actions="[
|
||||
{
|
||||
label: '新增',
|
||||
type: 'primary',
|
||||
icon: 'ant-design:plus-outlined',
|
||||
// auth: ['超级西(中成)药', 'sys:user:save'],
|
||||
onClick: showModal.bind(null),
|
||||
},
|
||||
{
|
||||
label: '导入',
|
||||
type: 'primary',
|
||||
icon: 'ix:export-check',
|
||||
// auth: ['超级西(中成)药', 'sys:user:save'],
|
||||
onClick: openExcelUploadModal.bind(null),
|
||||
},
|
||||
{
|
||||
label: '导出',
|
||||
type: 'primary',
|
||||
icon: 'mingcute:download-3-fill',
|
||||
// auth: ['超级西(中成)药', 'sys:user:save'],
|
||||
onClick: passApplication.bind(null),
|
||||
},
|
||||
]"
|
||||
:drop-down-actions="[
|
||||
{
|
||||
label: '删除',
|
||||
icon: 'ant-design:delete-outlined',
|
||||
ifShow: hasTopTableDropDownActions,
|
||||
// auth: ['超级西(中成)药', 'sys:user:save'],
|
||||
popConfirm: {
|
||||
title: '确定删除吗?',
|
||||
confirm: deleteApi.bind(null, false),
|
||||
},
|
||||
},
|
||||
]"
|
||||
>
|
||||
<template #more>
|
||||
<Button style="margin-left: 16px">
|
||||
批量操作
|
||||
<Icon icon="ant-design:down-outlined" />
|
||||
</Button>
|
||||
</template>
|
||||
</TableAction>
|
||||
</template>
|
||||
<template #image="{ row }">
|
||||
<Image :src="row.image" height="30" width="30" />
|
||||
</template>
|
||||
<template #supplier="{ row }">
|
||||
{{ row.supplier?.name || row.source }}
|
||||
</template>
|
||||
<template #instruction="{ row }">
|
||||
<div class="div" style="width: 120px; height: 120px; overflow: scroll">
|
||||
<Image :src="row.instruction" height="30" width="30" />
|
||||
</div>
|
||||
</template>
|
||||
<template #status="{ row }">
|
||||
<Tag :color="row.status_color">{{ row.status_txt }}</Tag>
|
||||
</template>
|
||||
<template #toolbar-tools></template>
|
||||
<template #action="{ row }">
|
||||
<TableAction
|
||||
:actions="[
|
||||
{
|
||||
label: '编辑',
|
||||
type: 'link',
|
||||
icon: 'uil:edit',
|
||||
size: 'small',
|
||||
// auth: ['western-medicine', 'sys:role:detail'],
|
||||
onClick: showModal.bind(null, row, true),
|
||||
},
|
||||
{
|
||||
label: '删除',
|
||||
type: 'link',
|
||||
icon: 'ant-design:delete-outlined',
|
||||
size: 'small',
|
||||
// auth: ['western-medicine', '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: ['western-medicine', 'sys:role:detail'],
|
||||
// onClick: showModal.bind(null, row, true),
|
||||
// },
|
||||
// {
|
||||
// label: '删除',
|
||||
// type: 'link',
|
||||
// icon: 'ant-design:delete-outlined',
|
||||
// size: 'small',
|
||||
// // auth: ['western-medicine', 'sys:role:detail'],
|
||||
// popConfirm: {
|
||||
// title: '确定删除吗?',
|
||||
// confirm: deleteApi.bind(null, row.id),
|
||||
// },
|
||||
// },
|
||||
]"
|
||||
/>
|
||||
</template>
|
||||
</Grid>
|
||||
</Page>
|
||||
</template>
|
||||
@@ -0,0 +1,80 @@
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
const prefix = 'warehouse-drug-management/';
|
||||
|
||||
/**
|
||||
* 分页查询用户列表
|
||||
* @param data
|
||||
*/
|
||||
export async function getWarehouseDrugManagementList(data: any) {
|
||||
return requestClient.get<any>(`${prefix}list`, { params: data });
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询用户列表
|
||||
* @param data
|
||||
*/
|
||||
export async function getWarehouseDrugManagementOption(data: any) {
|
||||
return requestClient.get<any>(`${prefix}option`, { params: data });
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取西(中成)药详情
|
||||
* @param id
|
||||
*/
|
||||
export async function getWarehouseDrugManagementInfo(id: number) {
|
||||
return requestClient.get<any>(`${prefix}detail`, { params: { id } });
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出仓库药品药品
|
||||
*/
|
||||
export async function exportWarehouseDrugManagementApi() {
|
||||
return requestClient.download(`${prefix}export`);
|
||||
}
|
||||
/**
|
||||
* 导出仓库药品药品 - 模板
|
||||
*/
|
||||
export async function exportWarehouseDrugManagementTemplateApi() {
|
||||
return requestClient.download(`${prefix}export-template`);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增西(中成)药
|
||||
* @param data
|
||||
*/
|
||||
export async function createWarehouseDrugManagement(data: Record<string, any>) {
|
||||
return requestClient.post<any>(`${prefix}create`, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑西(中成)药
|
||||
* @param data
|
||||
*/
|
||||
export async function updateWarehouseDrugManagement(data: Record<string, any>) {
|
||||
return requestClient.post<any>(`${prefix}update`, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除西(中成)药
|
||||
* @param data
|
||||
*/
|
||||
export async function deleteWarehouseDrugManagement(data: Record<string, any>) {
|
||||
return requestClient.post<any>(`${prefix}delete`, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入仓库药品
|
||||
* @param data
|
||||
*/
|
||||
export async function importWarehouseDrugManagementApi(data: Record<string, any>) {
|
||||
return requestClient.upload(`${prefix}import`, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入仓库药品修改价格
|
||||
* @param data
|
||||
*/
|
||||
export async function importUpdatePriceApi(data: Record<string, any>) {
|
||||
return requestClient.upload(`${prefix}import-update-price`, data);
|
||||
}
|
||||
@@ -0,0 +1,172 @@
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue';
|
||||
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
|
||||
import {
|
||||
Button,
|
||||
message,
|
||||
type UploadChangeParam,
|
||||
UploadDragger,
|
||||
} from 'ant-design-vue';
|
||||
|
||||
import { downloadByData } from '#/util/tool';
|
||||
|
||||
import {
|
||||
exportWarehouseDrugManagementTemplateApi,
|
||||
importUpdatePriceApi,
|
||||
importWarehouseDrugManagementApi,
|
||||
} from '../api';
|
||||
|
||||
const gridApi = ref();
|
||||
const passApplication = ref();
|
||||
const importType = ref(1);
|
||||
const fileList = ref([]);
|
||||
|
||||
const [Modal, modalApi] = useVbenModal({
|
||||
fullscreenButton: false,
|
||||
draggable: true,
|
||||
onCancel() {
|
||||
modalApi.close();
|
||||
},
|
||||
onConfirm: async () => {
|
||||
modalApi.setState({ loading: true, confirmLoading: true });
|
||||
gridApi.value?.reload();
|
||||
modalApi.close();
|
||||
},
|
||||
onOpenChange(isOpen: boolean) {
|
||||
gridApi.value = isOpen ? modalApi.getData()?.gridApi : null;
|
||||
passApplication.value = isOpen ? modalApi.getData()?.passApplication : null;
|
||||
importType.value = isOpen ? modalApi.getData()?.type : 1;
|
||||
fileList.value = [];
|
||||
},
|
||||
});
|
||||
|
||||
const importWarehouseDrugManagement = ({ file, onSuccess }) => {
|
||||
modalApi.setState({ loading: true, confirmLoading: true });
|
||||
const submitApi =
|
||||
importType.value === 1
|
||||
? importWarehouseDrugManagementApi
|
||||
: importUpdatePriceApi;
|
||||
submitApi({
|
||||
file,
|
||||
})
|
||||
.then(() => {
|
||||
onSuccess('ok', { status: 'done' });
|
||||
})
|
||||
.catch(() => {
|
||||
onSuccess('error', { status: 'error' });
|
||||
})
|
||||
.finally(() => {
|
||||
modalApi.setState({ loading: false, confirmLoading: false });
|
||||
});
|
||||
};
|
||||
const handleChange = (info: UploadChangeParam) => {
|
||||
if (info.file.status === 'uploading') {
|
||||
return;
|
||||
}
|
||||
if (info.file.status === 'done') {
|
||||
message.success('上传成功');
|
||||
}
|
||||
if (info.file.status === 'error') {
|
||||
message.error('upload error');
|
||||
}
|
||||
};
|
||||
|
||||
const exportWarehouseDrugManagementTemplate = () => {
|
||||
exportWarehouseDrugManagementTemplateApi().then((res) => {
|
||||
// 创建新的URL表示指定的File对象或者Blob对象。
|
||||
downloadByData(
|
||||
res.data,
|
||||
'萧康云医-仓库商品导入模板结果导出(只包含未导入的药品).xlsx',
|
||||
);
|
||||
message.success('导出成功!');
|
||||
});
|
||||
};
|
||||
</script>
|
||||
<template>
|
||||
<Modal class="w-[30%]" :title="importType === 1 ? '上传Excel' : '批量修改价格'">
|
||||
<Button v-if="importType === 1" type="link" @click="exportWarehouseDrugManagementTemplate">
|
||||
下载位同步到仓库药品的导入模板
|
||||
</Button>
|
||||
<Button v-if="importType === 2" type="link" @click="passApplication">
|
||||
下载修改价格模板
|
||||
</Button>
|
||||
<UploadDragger
|
||||
class="mt-6"
|
||||
v-model:file-list="fileList"
|
||||
:custom-request="importWarehouseDrugManagement"
|
||||
:max-count="1"
|
||||
:on-change="handleChange"
|
||||
name="file"
|
||||
>
|
||||
<p class="flex justify-center">
|
||||
<svg
|
||||
height="64"
|
||||
viewBox="0 0 32 32"
|
||||
width="64"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<defs>
|
||||
<linearGradient
|
||||
id="vscodeIconsFileTypeExcel0"
|
||||
gradientTransform="translate(0 2100)"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
x1="4.494"
|
||||
x2="13.832"
|
||||
y1="-2092.086"
|
||||
y2="-2075.914"
|
||||
>
|
||||
<stop offset="0" stop-color="#18884f" />
|
||||
<stop offset=".5" stop-color="#117e43" />
|
||||
<stop offset="1" stop-color="#0b6631" />
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<path
|
||||
d="M19.581 15.35L8.512 13.4v14.409A1.19 1.19 0 0 0 9.705 29h19.1A1.19 1.19 0 0 0 30 27.809V22.5Z"
|
||||
fill="#185c37"
|
||||
/>
|
||||
<path
|
||||
d="M19.581 3H9.705a1.19 1.19 0 0 0-1.193 1.191V9.5L19.581 16l5.861 1.95L30 16V9.5Z"
|
||||
fill="#21a366"
|
||||
/>
|
||||
<path d="M8.512 9.5h11.069V16H8.512Z" fill="#107c41" />
|
||||
<path
|
||||
d="M16.434 8.2H8.512v16.25h7.922a1.2 1.2 0 0 0 1.194-1.191V9.391A1.2 1.2 0 0 0 16.434 8.2"
|
||||
opacity="0.1"
|
||||
/>
|
||||
<path
|
||||
d="M15.783 8.85H8.512V25.1h7.271a1.2 1.2 0 0 0 1.194-1.191V10.041a1.2 1.2 0 0 0-1.194-1.191"
|
||||
opacity="0.2"
|
||||
/>
|
||||
<path
|
||||
d="M15.783 8.85H8.512V23.8h7.271a1.2 1.2 0 0 0 1.194-1.191V10.041a1.2 1.2 0 0 0-1.194-1.191"
|
||||
opacity="0.2"
|
||||
/>
|
||||
<path
|
||||
d="M15.132 8.85h-6.62V23.8h6.62a1.2 1.2 0 0 0 1.194-1.191V10.041a1.2 1.2 0 0 0-1.194-1.191"
|
||||
opacity="0.2"
|
||||
/>
|
||||
<path
|
||||
d="M3.194 8.85h11.938a1.193 1.193 0 0 1 1.194 1.191v11.918a1.193 1.193 0 0 1-1.194 1.191H3.194A1.19 1.19 0 0 1 2 21.959V10.041A1.19 1.19 0 0 1 3.194 8.85"
|
||||
fill="url(#vscodeIconsFileTypeExcel0)"
|
||||
/>
|
||||
<path
|
||||
d="m5.7 19.873l2.511-3.884l-2.3-3.862h1.847L9.013 14.6c.116.234.2.408.238.524h.017q.123-.281.26-.546l1.342-2.447h1.7l-2.359 3.84l2.419 3.905h-1.809l-1.45-2.711A2.4 2.4 0 0 1 9.2 16.8h-.024a1.7 1.7 0 0 1-.168.351l-1.493 2.722Z"
|
||||
fill="#fff"
|
||||
/>
|
||||
<path
|
||||
d="M28.806 3h-9.225v6.5H30V4.191A1.19 1.19 0 0 0 28.806 3"
|
||||
fill="#33c481"
|
||||
/>
|
||||
<path d="M19.581 16H30v6.5H19.581Z" fill="#107c41" />
|
||||
</svg>
|
||||
</p>
|
||||
<p class="ant-upload-text">点击或拖动文件到此区域进行上传</p>
|
||||
<p class="ant-upload-hint">
|
||||
支持单个上传,xlsx格式文件。严禁上传公司数据或其他带格式文件。
|
||||
</p>
|
||||
</UploadDragger>
|
||||
<!-- <Form />-->
|
||||
</Modal>
|
||||
</template>
|
||||
@@ -0,0 +1,135 @@
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue';
|
||||
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
import { useUserStore } from '@vben/stores';
|
||||
|
||||
import { message } from 'ant-design-vue';
|
||||
|
||||
import { useVbenForm } from '#/adapter/form';
|
||||
|
||||
import {
|
||||
createWarehouseDrugManagement,
|
||||
updateWarehouseDrugManagement,
|
||||
} from '../api';
|
||||
import { modalFormProps } from '../config/form';
|
||||
import {getDrugUseList} from "#/views/doctor/doctor-reception/api";
|
||||
|
||||
defineOptions({
|
||||
name: 'FormModelDemo',
|
||||
});
|
||||
const userStore = useUserStore();
|
||||
|
||||
const drugTime = ref([]);
|
||||
const drugType = ref([]);
|
||||
const drugUnit = ref([]);
|
||||
const drugFrequency = ref([]);
|
||||
getDrugUseList().then((res) => {
|
||||
drugTime.value = res.drug_time.map((item) => {
|
||||
return {
|
||||
label: item.name,
|
||||
value: item.id,
|
||||
};
|
||||
});
|
||||
drugType.value = res.drug_use_type.map((item) => {
|
||||
return {
|
||||
label: item.name,
|
||||
value: item.id,
|
||||
};
|
||||
});
|
||||
drugUnit.value = res.drug_unit.map((item) => {
|
||||
return {
|
||||
label: item.name,
|
||||
value: item.id,
|
||||
};
|
||||
});
|
||||
drugFrequency.value = res.drug_use_frequency.map((item) => {
|
||||
return {
|
||||
label: item.name,
|
||||
value: item.id,
|
||||
};
|
||||
});
|
||||
return res;
|
||||
});
|
||||
|
||||
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
|
||||
? updateWarehouseDrugManagement
|
||||
: createWarehouseDrugManagement;
|
||||
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) {
|
||||
|
||||
formApi.updateSchema([
|
||||
{
|
||||
componentProps: {
|
||||
options: drugTime.value,
|
||||
},
|
||||
fieldName: 'time_id',
|
||||
},
|
||||
{
|
||||
componentProps: {
|
||||
options: drugUnit.value,
|
||||
},
|
||||
fieldName: 'unit_id',
|
||||
},
|
||||
{
|
||||
componentProps: {
|
||||
options: drugType.value,
|
||||
},
|
||||
fieldName: 'type_id',
|
||||
},
|
||||
{
|
||||
componentProps: {
|
||||
options: drugFrequency.value,
|
||||
},
|
||||
fieldName: 'frequency_id',
|
||||
},
|
||||
]);
|
||||
const { values, update } = modalApi.getData<Record<string, any>>();
|
||||
if (values) {
|
||||
console.log(values, 'sssssssssssss')
|
||||
isUpdate.value = update;
|
||||
formApi.setValues(values);
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
</script>
|
||||
<template>
|
||||
<Modal
|
||||
:title="`${isUpdate === true ? '编辑' : '新增'}西(中成)药`"
|
||||
class="w-[30%]"
|
||||
>
|
||||
<Form />
|
||||
</Modal>
|
||||
</template>
|
||||
@@ -0,0 +1,108 @@
|
||||
import type {VbenFormProps} from '#/adapter/form';
|
||||
|
||||
import {getSupplierOption} from '#/views/system/supplier/api';
|
||||
import {
|
||||
getWarehouseDrugManagementOption
|
||||
} from "#/views/business/warehouse-drug-management/admin/api";
|
||||
|
||||
|
||||
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',
|
||||
dependencies: {
|
||||
show: false,
|
||||
triggerFields: ['id'],
|
||||
},
|
||||
},
|
||||
{
|
||||
component: 'ApiSelect',
|
||||
fieldName: 'drug_id',
|
||||
label: '选择加入的药品',
|
||||
formItemClass: 'col-span-12',
|
||||
rules: 'required',
|
||||
componentProps: {
|
||||
api: getWarehouseDrugManagementOption,
|
||||
allowClear: true,
|
||||
showSearch: true,
|
||||
filterOption: (input: string, option: any) => {
|
||||
// 自定义过滤逻辑,确保可以根据 name 进行搜索
|
||||
return option?.label.toLowerCase().indexOf(input.toLowerCase()) >= 0;
|
||||
},
|
||||
// 菜单接口转options格式
|
||||
afterFetch: (data: { drug_name: string; id: number }[]) => {
|
||||
return data.map((item: any) => ({
|
||||
label: `${item.drug_name}【${item.pinyin_simple}】`,
|
||||
value: item.id,
|
||||
}));
|
||||
},
|
||||
},
|
||||
dependencies: {
|
||||
show(formValues: any) {
|
||||
return !formValues.id;
|
||||
},
|
||||
triggerFields: ['id'],
|
||||
},
|
||||
},
|
||||
{
|
||||
component: 'VbenInput',
|
||||
componentProps: {
|
||||
placeholder: '请输入供货价格',
|
||||
},
|
||||
fieldName: 'market_price',
|
||||
formItemClass: 'col-span-12',
|
||||
label: '供货价格',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
component: 'VbenInput',
|
||||
componentProps: {
|
||||
placeholder: '请输入价格',
|
||||
},
|
||||
fieldName: 'price',
|
||||
formItemClass: 'col-span-12',
|
||||
label: '价格',
|
||||
rules: 'required',
|
||||
},
|
||||
],
|
||||
showDefaultActions: false,
|
||||
};
|
||||
export const uploadExcelProps: VbenFormProps = {
|
||||
wrapperClass: 'grid-cols-12', // 24栅格,
|
||||
commonConfig: {
|
||||
formItemClass: 'col-span-12',
|
||||
// 所有表单项
|
||||
componentProps: {
|
||||
class: 'w-full',
|
||||
},
|
||||
},
|
||||
// handleSubmit: onSubmit,
|
||||
layout: 'horizontal',
|
||||
schema: [
|
||||
{
|
||||
component: 'Upload',
|
||||
componentProps: {
|
||||
placeholder: '请选择',
|
||||
multiple: true,
|
||||
},
|
||||
fieldName: 'frequency_id',
|
||||
formItemClass: 'col-span-12',
|
||||
label: '导入excel',
|
||||
rules: 'file',
|
||||
},
|
||||
],
|
||||
showDefaultActions: false,
|
||||
};
|
||||
@@ -0,0 +1,60 @@
|
||||
import type { VbenFormProps } from '#/adapter/form';
|
||||
|
||||
// import dayjs from 'dayjs';
|
||||
|
||||
export const formOptions: VbenFormProps = {
|
||||
// 默认展开
|
||||
collapsed: false,
|
||||
schema: [
|
||||
{
|
||||
component: 'VbenInput',
|
||||
componentProps: {
|
||||
placeholder: '输入名称',
|
||||
},
|
||||
defaultValue: '',
|
||||
fieldName: 'name',
|
||||
label: '药名称',
|
||||
},
|
||||
{
|
||||
component: 'VbenSelect',
|
||||
componentProps: {
|
||||
placeholder: '输入名称',
|
||||
options: [
|
||||
{
|
||||
label: '中药',
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
label: '西药',
|
||||
value: 2,
|
||||
},
|
||||
{
|
||||
label: '服务包',
|
||||
value: 5,
|
||||
},
|
||||
],
|
||||
},
|
||||
defaultValue: 1,
|
||||
fieldName: 'type',
|
||||
label: '类型',
|
||||
}
|
||||
// {
|
||||
// component: 'RangePicker',
|
||||
// componentProps: {
|
||||
// format: 'YYYY-MM-DD', // 确保格式与你需要的一致
|
||||
// },
|
||||
// // defaultValue: [dayjs().startOf('month'), dayjs()],
|
||||
// fieldName: 'search_time',
|
||||
// label: '时间范围',
|
||||
// },
|
||||
],
|
||||
// 控制表单是否显示折叠按钮
|
||||
showCollapseButton: true,
|
||||
submitButtonOptions: {
|
||||
content: '查询',
|
||||
},
|
||||
// 是否在字段值改变时提交表单
|
||||
submitOnChange: true,
|
||||
// 按下回车时是否提交表单
|
||||
submitOnEnter: false,
|
||||
};
|
||||
@@ -0,0 +1,79 @@
|
||||
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||
|
||||
import {getWarehouseDrugManagementList} from '../api';
|
||||
|
||||
interface RowType {
|
||||
id: string;
|
||||
name: string;
|
||||
logo: string;
|
||||
introduce: string;
|
||||
created_at: string;
|
||||
}
|
||||
|
||||
export const gridOptions: VxeGridProps<RowType> = {
|
||||
checkboxConfig: {
|
||||
highlight: true,
|
||||
labelField: '',
|
||||
},
|
||||
columnConfig: {
|
||||
useKey: true,
|
||||
},
|
||||
rowConfig: {
|
||||
useKey: true,
|
||||
},
|
||||
columns: [
|
||||
{ type: 'checkbox', width: 60 },
|
||||
{ field: 'id', align: 'left', title: 'ID', width: 100 },
|
||||
{ field: 'drug.drug_name', align: 'left', title: '药品名称' },
|
||||
{ field: 'drug.pinyin_simple', title: '拼音' },
|
||||
{
|
||||
field: 'image',
|
||||
align: 'left',
|
||||
title: '产品图片',
|
||||
slots: { default: 'image' },
|
||||
width: 130,
|
||||
},
|
||||
{ field: 'market_price', title: '供货价' },
|
||||
{ field: 'price', title: '建议售价' },
|
||||
{ field: 'status', title: '状态', slots: { default: 'status' } },
|
||||
{ field: 'created_at', title: '创建时间' },
|
||||
{ type: 'html', title: '操作', slots: { default: 'action' } },
|
||||
],
|
||||
keepSource: true,
|
||||
pagerConfig: {},
|
||||
proxyConfig: {
|
||||
ajax: {
|
||||
// 请求后端接口方法
|
||||
query: async ({ page }, formValues) => {
|
||||
return await getWarehouseDrugManagementList({
|
||||
page: page.currentPage,
|
||||
pageSize: page.pageSize,
|
||||
...formValues,
|
||||
});
|
||||
},
|
||||
},
|
||||
},
|
||||
// exportConfig: {
|
||||
// api: passApplicationApi,
|
||||
// },
|
||||
height: 'auto',
|
||||
border: false,
|
||||
toolbarConfig: {
|
||||
// 是否显示搜索表单控制按钮
|
||||
// @ts-ignore 正式环境时有完整的类型声明
|
||||
search: true,
|
||||
refresh: true, // 刷新
|
||||
print: false, // 打印
|
||||
export: false, // 导出
|
||||
// custom: true, // 自定义列
|
||||
zoom: true, // 最大化最小化
|
||||
slots: {
|
||||
buttons: 'toolbar-buttons',
|
||||
},
|
||||
custom: {
|
||||
// 自定义列-图标
|
||||
icon: 'vxe-icon-menu',
|
||||
},
|
||||
},
|
||||
showOverflow: false,
|
||||
};
|
||||
@@ -0,0 +1,213 @@
|
||||
<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, Tag } from 'ant-design-vue';
|
||||
|
||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import { TableAction } from '#/components/table-action';
|
||||
import { downloadByData } from '#/util/tool';
|
||||
|
||||
import { deleteWarehouseDrugManagement, exportWarehouseDrugManagementApi } from './api';
|
||||
import FormModalDemo from './components/modal.vue';
|
||||
import ExcelUpload from './components/ExcelUpload.vue';
|
||||
import { formOptions } from './config/search';
|
||||
import { gridOptions } from './config/table';
|
||||
|
||||
const hasTopTableDropDownActions = ref(false);
|
||||
|
||||
const gridEvents: VxeGridListeners<any> = {
|
||||
checkboxChange() {
|
||||
// eslint-disable-next-line no-use-before-define
|
||||
const records = gridApi.grid.getCheckboxRecords();
|
||||
hasTopTableDropDownActions.value = records.length > 0;
|
||||
},
|
||||
checkboxAll() {
|
||||
// eslint-disable-next-line no-use-before-define
|
||||
const records = gridApi.grid.getCheckboxRecords();
|
||||
hasTopTableDropDownActions.value = records.length > 0;
|
||||
},
|
||||
};
|
||||
|
||||
const [Grid, gridApi] = useVbenVxeGrid({
|
||||
formOptions,
|
||||
gridOptions,
|
||||
gridEvents,
|
||||
});
|
||||
|
||||
const [FormModal, formModalApi] = useVbenModal({
|
||||
connectedComponent: FormModalDemo,
|
||||
});
|
||||
|
||||
const [ExcelUploadModal, ExcelUploadModalApi] = useVbenModal({
|
||||
connectedComponent: ExcelUpload,
|
||||
});
|
||||
|
||||
const showModal = (data = {}, isUpdate = false) => {
|
||||
formModalApi.setData({
|
||||
// 表单值
|
||||
values: data,
|
||||
update: isUpdate,
|
||||
gridApi,
|
||||
});
|
||||
formModalApi.open();
|
||||
};
|
||||
|
||||
const deleteApi = (row: any) => {
|
||||
let ids = [];
|
||||
if (row) {
|
||||
ids.push(row);
|
||||
} else {
|
||||
ids = gridApi.grid.getCheckboxRecords().map((item) => item.id);
|
||||
}
|
||||
deleteWarehouseDrugManagement({ ids }).then(() => {
|
||||
message.success('删除成功!');
|
||||
gridApi.reload();
|
||||
});
|
||||
};
|
||||
/**
|
||||
* 导出
|
||||
*/
|
||||
const passApplication = () => {
|
||||
// 新标签跳转到 exportWarehouseDrugManagementApi
|
||||
exportWarehouseDrugManagementApi().then((res) => {
|
||||
// 创建新的URL表示指定的File对象或者Blob对象。
|
||||
downloadByData(res.data, '萧康云医-仓库商品导出.xlsx');
|
||||
message.success('导出成功!');
|
||||
});
|
||||
};
|
||||
|
||||
const openExcelUploadModal = (type = 1) => {
|
||||
ExcelUploadModalApi.setData({
|
||||
gridApi,
|
||||
type,
|
||||
passApplication,
|
||||
});
|
||||
ExcelUploadModalApi.open();
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Page auto-content-height title="西(中成)药管理">
|
||||
<ExcelUploadModal />
|
||||
<FormModal />
|
||||
<Grid>
|
||||
<template #toolbar-buttons>
|
||||
<TableAction
|
||||
:actions="[
|
||||
{
|
||||
label: '新增',
|
||||
type: 'primary',
|
||||
icon: 'ant-design:plus-outlined',
|
||||
// auth: ['超级西(中成)药', 'sys:user:save'],
|
||||
onClick: showModal.bind(null),
|
||||
},
|
||||
{
|
||||
label: '导入',
|
||||
type: 'primary',
|
||||
icon: 'ix:export-check',
|
||||
// auth: ['超级西(中成)药', 'sys:user:save'],
|
||||
onClick: openExcelUploadModal.bind(null, 1),
|
||||
},
|
||||
{
|
||||
label: '批量修改价格',
|
||||
type: 'primary',
|
||||
icon: 'ix:export-check',
|
||||
// auth: ['超级西(中成)药', 'sys:user:save'],
|
||||
onClick: openExcelUploadModal.bind(null, 2),
|
||||
},
|
||||
{
|
||||
label: '导出',
|
||||
type: 'primary',
|
||||
icon: 'mingcute:download-3-fill',
|
||||
// auth: ['超级西(中成)药', 'sys:user:save'],
|
||||
onClick: passApplication.bind(null),
|
||||
},
|
||||
]"
|
||||
:drop-down-actions="[
|
||||
{
|
||||
label: '删除',
|
||||
icon: 'ant-design:delete-outlined',
|
||||
ifShow: hasTopTableDropDownActions,
|
||||
// auth: ['超级西(中成)药', 'sys:user:save'],
|
||||
popConfirm: {
|
||||
title: '确定删除吗?',
|
||||
confirm: deleteApi.bind(null, false),
|
||||
},
|
||||
},
|
||||
]"
|
||||
>
|
||||
<template #more>
|
||||
<Button style="margin-left: 16px">
|
||||
批量操作
|
||||
<Icon icon="ant-design:down-outlined" />
|
||||
</Button>
|
||||
</template>
|
||||
</TableAction>
|
||||
</template>
|
||||
<template #image="{ row }">
|
||||
<Image :src="row.drug?.image || '/public/img/traditional-chinese-medicine.jpg'" height="30" width="30" />
|
||||
</template>
|
||||
<template #instruction="{ row }">
|
||||
<div class="div" style="width: 120px; height: 120px; overflow: scroll">
|
||||
<Image :src="row.instruction" height="30" width="30" />
|
||||
</div>
|
||||
</template>
|
||||
<template #status="{ row }">
|
||||
<Tag :color="row.status === 2 ? 'green' : 'red'">{{
|
||||
row.status === 2 ? '上架' : '下架'
|
||||
}}</Tag>
|
||||
</template>
|
||||
<template #toolbar-tools></template>
|
||||
<template #action="{ row }">
|
||||
<TableAction
|
||||
:actions="[
|
||||
{
|
||||
label: '编辑',
|
||||
type: 'link',
|
||||
icon: 'uil:edit',
|
||||
size: 'small',
|
||||
// auth: ['western-medicine', 'sys:role:detail'],
|
||||
onClick: showModal.bind(null, row, true),
|
||||
},
|
||||
{
|
||||
label: '删除',
|
||||
type: 'link',
|
||||
icon: 'ant-design:delete-outlined',
|
||||
size: 'small',
|
||||
// auth: ['western-medicine', '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: ['western-medicine', 'sys:role:detail'],
|
||||
// onClick: showModal.bind(null, row, true),
|
||||
// },
|
||||
// {
|
||||
// label: '删除',
|
||||
// type: 'link',
|
||||
// icon: 'ant-design:delete-outlined',
|
||||
// size: 'small',
|
||||
// // auth: ['western-medicine', 'sys:role:detail'],
|
||||
// popConfirm: {
|
||||
// title: '确定删除吗?',
|
||||
// confirm: deleteApi.bind(null, row.id),
|
||||
// },
|
||||
// },
|
||||
]"
|
||||
/>
|
||||
</template>
|
||||
</Grid>
|
||||
</Page>
|
||||
</template>
|
||||
@@ -23,13 +23,13 @@ export const gridOptions: VxeGridProps<RowType> = {
|
||||
{ field: 'charge_cash', title: '手续费' },
|
||||
{ field: 'status', title: '状态', slots: { default: 'status' } },
|
||||
{ field: 'created_at', title: '记录时间' },
|
||||
{
|
||||
type: 'html',
|
||||
title: '操作',
|
||||
align: 'right',
|
||||
slots: { default: 'action' },
|
||||
width: 200,
|
||||
},
|
||||
// {
|
||||
// type: 'html',
|
||||
// title: '操作',
|
||||
// align: 'right',
|
||||
// slots: { default: 'action' },
|
||||
// width: 200,
|
||||
// },
|
||||
],
|
||||
keepSource: true,
|
||||
pagerConfig: {},
|
||||
|
||||
@@ -69,7 +69,7 @@ const infoModal = (id) => {
|
||||
{
|
||||
label: '详情',
|
||||
type: 'link',
|
||||
icon: 'uil:edit',
|
||||
icon: 'marketeq:eye',
|
||||
size: 'small',
|
||||
// auth: ['order', 'sys:role:detail'],
|
||||
onClick: infoModal.bind(null, row.order_id),
|
||||
|
||||
@@ -76,7 +76,7 @@ initTableAjax();
|
||||
{
|
||||
label: '结算订单',
|
||||
type: 'primary',
|
||||
icon: 'ant-design:plus-outlined',
|
||||
// icon: 'ant-design:plus-outlined',
|
||||
// auth: ['超级诊所', 'sys:user:save'],
|
||||
onClick: infoModal.bind(null, null, 2),
|
||||
},
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
const prefix = 'withdrawal-application/';
|
||||
/**
|
||||
* 提现审核
|
||||
* @param data
|
||||
*/
|
||||
export async function getFundWaterListApi(data: any) {
|
||||
return requestClient.get<any>(`${prefix}audit-list`, { params: data });
|
||||
}
|
||||
/**
|
||||
* 拒绝申请
|
||||
* @param data
|
||||
*/
|
||||
export async function refuseApplicationApi(data: any) {
|
||||
return requestClient.post<any>(`${prefix}refuse-application`, data);
|
||||
}
|
||||
/**
|
||||
* 通过申请
|
||||
* @param data
|
||||
*/
|
||||
export async function passApplicationApi(data: any) {
|
||||
return requestClient.post<any>(`${prefix}pass-application`, data);
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
<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 {
|
||||
passApplicationApi,
|
||||
refuseApplicationApi,
|
||||
} from '#/views/finance/withdrawal-audit/api';
|
||||
|
||||
import { withdrawalAudit } from '../config/form';
|
||||
|
||||
const gridApi = ref();
|
||||
const type = ref(1);
|
||||
|
||||
const [WithdrawalAuditForm, WithdrawalAuditFormApi] =
|
||||
useVbenForm(withdrawalAudit);
|
||||
|
||||
const [Modal, modalApi] = useVbenModal({
|
||||
fullscreenButton: false,
|
||||
draggable: true,
|
||||
onCancel() {
|
||||
modalApi.close();
|
||||
},
|
||||
onConfirm: async () => {
|
||||
const formApi = WithdrawalAuditFormApi;
|
||||
formApi.validate().then(async (e: any) => {
|
||||
if (e.valid) {
|
||||
const values = await formApi.getValues();
|
||||
modalApi.setState({ loading: true, confirmLoading: true });
|
||||
const submitApi =
|
||||
type.value === 1 ? refuseApplicationApi : passApplicationApi;
|
||||
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 { id, modalType } = modalApi.getData<Record<string, any>>();
|
||||
type.value = modalType;
|
||||
WithdrawalAuditFormApi.setValues({
|
||||
id,
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Modal :title="`提现审核【${type === 1 ? '拒绝' : '通过'}】`" class="w-[30%]">
|
||||
<WithdrawalAuditForm />
|
||||
</Modal>
|
||||
</template>
|
||||
@@ -0,0 +1,39 @@
|
||||
import type { VbenFormProps } from '#/adapter/form';
|
||||
|
||||
/**
|
||||
* 作废表单
|
||||
*/
|
||||
export const withdrawalAudit: 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',
|
||||
dependencies: {
|
||||
show: false,
|
||||
triggerFields: ['id'],
|
||||
},
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
component: 'Textarea',
|
||||
componentProps: {
|
||||
placeholder: '请输入备注',
|
||||
},
|
||||
fieldName: 'reason',
|
||||
label: '备注',
|
||||
rules: 'required',
|
||||
},
|
||||
],
|
||||
showDefaultActions: false,
|
||||
};
|
||||
@@ -0,0 +1,60 @@
|
||||
import type { VbenFormProps } from '#/adapter/form';
|
||||
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
export const formOptions: VbenFormProps = {
|
||||
// 默认展开
|
||||
collapsed: false,
|
||||
schema: [
|
||||
{
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
placeholder: '选择结算状态',
|
||||
options: [
|
||||
{
|
||||
label: '全部',
|
||||
value: '',
|
||||
},
|
||||
{
|
||||
label: '待审核',
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
label: '审核通过',
|
||||
value: 2,
|
||||
},
|
||||
{
|
||||
label: '审核拒绝',
|
||||
value: 3,
|
||||
},
|
||||
{
|
||||
label: '打款失败',
|
||||
value: 4,
|
||||
},
|
||||
],
|
||||
},
|
||||
defaultValue: '',
|
||||
fieldName: 'check_status',
|
||||
label: '审核状态',
|
||||
},
|
||||
{
|
||||
component: 'RangePicker',
|
||||
componentProps: {
|
||||
format: 'YYYY-MM-DD', // 确保格式与你需要的一致
|
||||
},
|
||||
defaultValue: [dayjs().startOf('month'), dayjs()],
|
||||
fieldName: 'search_time',
|
||||
label: '时间范围',
|
||||
},
|
||||
],
|
||||
// 控制表单是否显示折叠按钮
|
||||
showCollapseButton: true,
|
||||
submitButtonOptions: {
|
||||
content: '查询',
|
||||
},
|
||||
// 是否在字段值改变时提交表单
|
||||
// submitOnChange: true,
|
||||
// submitOnChange: true,
|
||||
// 按下回车时是否提交表单
|
||||
submitOnEnter: true,
|
||||
};
|
||||
@@ -0,0 +1,83 @@
|
||||
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||
|
||||
import { getFundWaterListApi } from '../api';
|
||||
|
||||
interface RowType {
|
||||
id: string;
|
||||
name: string;
|
||||
logo: string;
|
||||
introduce: string;
|
||||
created_at: string;
|
||||
}
|
||||
|
||||
export const gridOptions: VxeGridProps<RowType> = {
|
||||
checkboxConfig: {
|
||||
highlight: true,
|
||||
labelField: '',
|
||||
},
|
||||
columns: [
|
||||
{ field: 'id', align: 'left', title: 'ID', width: 50 },
|
||||
{ field: 'user_info', title: '申请诊所/供应商/平台', slots: { default: 'user-info'} },
|
||||
{ field: 'order_no', title: '订单号' },
|
||||
{ field: 'apply_cash', title: '申请金额' },
|
||||
{ field: 'true_cash', title: '打款金额' },
|
||||
{ field: 'charge_cash', title: '手续费' },
|
||||
{ field: 'check_id', title: '审核信息', slots: { default: 'check-id' } },
|
||||
{ field: 'dakuan_status', title: '打款信息', slots: { default: 'dakuan-status'} },
|
||||
{ field: 'apply_time', title: '申请时间' },
|
||||
{
|
||||
type: 'html',
|
||||
title: '操作',
|
||||
align: 'right',
|
||||
slots: { default: 'action' },
|
||||
width: 200,
|
||||
},
|
||||
],
|
||||
keepSource: true,
|
||||
pagerConfig: {},
|
||||
columnConfig: {
|
||||
useKey: true,
|
||||
},
|
||||
rowConfig: {
|
||||
useKey: true,
|
||||
},
|
||||
// scrollY: {
|
||||
// enabled: true,
|
||||
// gt: 0,
|
||||
// },
|
||||
proxyConfig: {
|
||||
ajax: {
|
||||
// 请求后端接口方法
|
||||
query: async ({ page }, formValues) => {
|
||||
return await getFundWaterListApi({
|
||||
page: page.currentPage,
|
||||
pageSize: page.pageSize,
|
||||
...formValues,
|
||||
});
|
||||
},
|
||||
},
|
||||
},
|
||||
height: 'auto',
|
||||
border: false,
|
||||
toolbarConfig: {
|
||||
// 是否显示搜索表单控制按钮
|
||||
// @ts-ignore 正式环境时有完整的类型声明
|
||||
search: true,
|
||||
refresh: true, // 刷新
|
||||
print: false, // 打印
|
||||
export: false, // 导出
|
||||
// custom: true, // 自定义列
|
||||
zoom: true, // 最大化最小化
|
||||
slots: {
|
||||
buttons: 'toolbar-buttons',
|
||||
},
|
||||
custom: {
|
||||
// 自定义列-图标
|
||||
icon: 'vxe-icon-menu',
|
||||
},
|
||||
},
|
||||
expandConfig: {
|
||||
// expandAll: true,
|
||||
},
|
||||
showOverflow: false,
|
||||
};
|
||||
146
apps/web-antd/src/views/finance/withdrawal-audit/index.vue
Normal file
146
apps/web-antd/src/views/finance/withdrawal-audit/index.vue
Normal file
@@ -0,0 +1,146 @@
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue';
|
||||
|
||||
import { Page, useVbenModal } from '@vben/common-ui';
|
||||
|
||||
import {Button, message, Tag} from 'ant-design-vue';
|
||||
|
||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import { TableAction } from '#/components/table-action';
|
||||
import WithdrawalAudit from './components/WithdrawalAudit.vue';
|
||||
import StatisticsReconciliation from '#/views/finance/reconciliation/components/statistics.vue';
|
||||
|
||||
import { formOptions } from './config/search';
|
||||
import { gridOptions } from './config/table';
|
||||
|
||||
const [Grid, gridApi] = useVbenVxeGrid({
|
||||
formOptions,
|
||||
gridOptions,
|
||||
});
|
||||
|
||||
const statistics = ref();
|
||||
|
||||
const [WithdrawalAuditModal, WithdrawalAuditModalApi] = useVbenModal({
|
||||
connectedComponent: WithdrawalAudit,
|
||||
});
|
||||
|
||||
const infoModal = (id, modalType = 0) => {
|
||||
if (modalType === 0) {
|
||||
message.info('正在开发');
|
||||
return;
|
||||
}
|
||||
WithdrawalAuditModalApi.setData({
|
||||
// 表单值
|
||||
id,
|
||||
modalType,
|
||||
gridApi,
|
||||
});
|
||||
WithdrawalAuditModalApi.open();
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Page auto-content-height title="提现审核">
|
||||
<WithdrawalAuditModal />
|
||||
<StatisticsReconciliation v-if="statistics" :statistics="statistics" />
|
||||
<Grid>
|
||||
<template #toolbar-buttons>
|
||||
<TableAction :actions="[]" :drop-down-actions="[]">
|
||||
<template #more>
|
||||
<Button style="margin-left: 16px">
|
||||
批量操作
|
||||
<Icon icon="ant-design:down-outlined" />
|
||||
</Button>
|
||||
</template>
|
||||
</TableAction>
|
||||
</template>
|
||||
<template #user-info="{ row }">
|
||||
<div>
|
||||
<Tag color="green">{{ row?.user_type_txt || '平台' }}</Tag>
|
||||
<Tag class="mt-3" color="#455cda">{{ row.store?.name || row.supplier?.name || '萧康云医' }}</Tag>
|
||||
</div>
|
||||
</template>
|
||||
<template #check-id="{ row }">
|
||||
<div v-if="row.check_id !== 0">
|
||||
<span v-if="row.is_new === 0">{{ row.check_admin?.nickname || '旧后台' }}</span>
|
||||
<span v-else-if="row.is_new === 1">{{ row.new_check_admin?.nick_name || '新后台' }}</span>
|
||||
</div>
|
||||
<div :class="row.check_id !== 0? 'mt-3': ''">
|
||||
<Tag v-if="row.check_status === 1" color="purple">待审核</Tag>
|
||||
<Tag v-else-if="row.check_status === 2" color="green">审核通过</Tag>
|
||||
<Tag v-else-if="row.check_status === 3" color="error">审核拒绝</Tag>
|
||||
<Tag v-else-if="row.check_status === 4" color="error">提现失败</Tag>
|
||||
</div>
|
||||
<div v-if="row.check_result" :class="row.check_id !== 0? 'mt-3': ''">
|
||||
备注:{{ row.check_result }}
|
||||
</div>
|
||||
<div v-if="row.check_time" :class="row.check_id !== 0? 'mt-3': ''">
|
||||
{{ row.check_time }}
|
||||
</div>
|
||||
</template>
|
||||
<template #dakuan-status="{ row }">
|
||||
<div class="mt-3">
|
||||
<Tag v-if="row.dakuan_status === 0" color="purple">未知</Tag>
|
||||
<Tag v-else-if="row.dakuan_status === 1" color="green">已到账</Tag>
|
||||
<Tag v-else-if="row.dakuan_status === -1" color="error">打款失败</Tag>
|
||||
</div>
|
||||
<div v-if="row.dakuan_time" class="mt-3">
|
||||
{{ row.dakuan_time }}
|
||||
</div>
|
||||
</template>
|
||||
<template #toolbar-tools></template>
|
||||
<template #action="{ row }">
|
||||
<TableAction
|
||||
:actions="[
|
||||
{
|
||||
label: '审核通过',
|
||||
type: 'link',
|
||||
icon: 'mdi:success-bold',
|
||||
size: 'small',
|
||||
// auth: ['order', 'sys:role:detail'],
|
||||
onClick: infoModal.bind(null, row.id),
|
||||
},
|
||||
{
|
||||
label: '拒绝审核',
|
||||
type: 'link',
|
||||
icon: 'icon-park-solid:error',
|
||||
size: 'small',
|
||||
// auth: ['order', 'sys:role:detail'],
|
||||
onClick: infoModal.bind(null, row.id, 1),
|
||||
},
|
||||
]"
|
||||
/>
|
||||
</template>
|
||||
</Grid>
|
||||
</Page>
|
||||
</template>
|
||||
<style scoped lang="scss">
|
||||
.custom-list {
|
||||
list-style-type: none;
|
||||
padding-left: 0;
|
||||
}
|
||||
|
||||
.custom-list-item {
|
||||
background-color: rgba(64, 158, 255, 0.04);
|
||||
border-radius: 4px;
|
||||
margin-bottom: 8px;
|
||||
padding: 8px 12px;
|
||||
font-size: 14px;
|
||||
transition: background-color 0.3s;
|
||||
|
||||
&:hover {
|
||||
background-color: rgba(64, 158, 255, 0.1);
|
||||
}
|
||||
|
||||
&::before {
|
||||
content: '';
|
||||
display: inline-block;
|
||||
width: 6px;
|
||||
height: 6px;
|
||||
background-color: #409eff;
|
||||
border-radius: 50%;
|
||||
margin-right: 8px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -63,9 +63,9 @@ withDefaults(defineProps<Props>(), {
|
||||
class="app-version text-foreground truncate text-nowrap font-semibold"
|
||||
>
|
||||
{{ text }}
|
||||
<b>
|
||||
<i>V {{ version }}</i>
|
||||
</b>
|
||||
<!-- <b>-->
|
||||
<!-- <i>V {{ version }}</i>-->
|
||||
<!-- </b>-->
|
||||
</span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user