fix: 音频文件
Some checks failed
CI / Test (ubuntu-latest) (push) Has been cancelled
CI / Test (windows-latest) (push) Has been cancelled
CI / Lint (ubuntu-latest) (push) Has been cancelled
CI / Lint (windows-latest) (push) Has been cancelled
CI / Check (ubuntu-latest) (push) Has been cancelled
CI / Check (windows-latest) (push) Has been cancelled
CI / CI OK (push) Has been cancelled
CodeQL / Analyze (javascript-typescript) (push) Has been cancelled
Deploy Website on push / Deploy Push Playground Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Docs Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Antd Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Element Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Naive Ftp (push) Has been cancelled
Release Drafter / update_release_draft (push) Has been cancelled
Close stale issues / stale (push) Has been cancelled

This commit is contained in:
2025-07-31 16:03:07 +08:00
parent 7fd5c489bc
commit d2990661e2
14 changed files with 5300 additions and 158 deletions

View File

@@ -1,18 +1,37 @@
<script setup>
import { defineEmits, defineProps } from 'vue';
import ChatHeader from './ChatHeader.vue';
import MessageInput from './MessageInput.vue';
import MessageList from './MessageList.vue';
// 定义 props 和 emits
const props = defineProps({
// ... existing props
});
const emit = defineEmits([
// ... existing emits
'openPrescription',
]);
// 开方功能触发函数
const handleOpenPrescription = (registerId) => {
emit('openPrescription', registerId);
};
// ... rest of the component
</script>
<template>
<div class="flex flex-col h-full">
<div class="flex h-full flex-col">
<!-- 聊天头部 -->
<ChatHeader/>
<ChatHeader />
<!-- 消息区域 -->
<MessageList class="flex-1"/>
<MessageList class="flex-1" />
<!-- 输入区域 -->
<MessageInput/>
<MessageInput @open-prescription="handleOpenPrescription" />
</div>
</template>
<script setup>
import ChatHeader from './ChatHeader.vue';
import MessageList from './MessageList.vue';
import MessageInput from './MessageInput.vue';
</script>

View File

@@ -8,6 +8,8 @@ import {Avatar, Image} from 'ant-design-vue';
import previewMedia from '../composables/useMediaPreview.ts';
import {useThemeStore} from '../stores/theme.ts';
import AudioMessage from './AudioMessage.vue';
import { useVbenModal } from '@vben/common-ui';
import PrescriptionDetail from '#/views/doctor/doctor-reception/components/PrescriptionDetail.vue';
const props = defineProps({
message: {
@@ -43,6 +45,10 @@ const bubbleClasses = computed(() => {
baseClasses.push('received');
}
if (props.message.type === 'text') {
baseClasses.push('bubble-bg');
}
if (themeStore.isDarkMode) {
baseClasses.push('dark');
}
@@ -94,6 +100,26 @@ const handleImageError = (event) => {
const handleVideoError = (event) => {
console.error('视频加载失败:', event);
};
// 添加处方状态映射
const prescriptionStatusMap = {
0: '待审核',
1: '已审核',
2: '未通过',
};
const [PrescriptionDetailModal, PrescriptionDetailModalApi] = useVbenModal({
connectedComponent: PrescriptionDetail,
});
const viewPrescription = (item) => {
PrescriptionDetailModalApi.setData({
values: item.id,
})
PrescriptionDetailModalApi.open();
}
</script>
<template>
@@ -101,6 +127,7 @@ const handleVideoError = (event) => {
:class="isSent ? 'flex-row-reverse' : 'flex-row'"
class="mb-4 flex items-start gap-3"
>
<PrescriptionDetailModal />
<!-- 头像 -->
<!-- <div-->
<!-- :style="avatarStyle"-->
@@ -211,6 +238,61 @@ const handleVideoError = (event) => {
:message="message"
/>
<!-- 处方卡片消息 -->
<!-- 处方卡片消息 -->
<div
v-else-if="message.type === 'prescription'"
class="prescription-card"
@click="viewPrescription(message.content)"
>
<div class="flex items-center gap-3">
<div class="w-12 h-12 rounded-full bg-blue-100 dark:bg-blue-900 flex items-center justify-center flex-shrink-0">
<i class="fas fa-file-prescription text-blue-500 dark:text-blue-300 text-xl"></i>
</div>
<div class="flex-1 min-w-0">
<div class="flex items-center justify-between">
<div class="font-semibold text-gray-800 dark:text-gray-100">电子处方</div>
<div
class="text-xs px-2 py-1 rounded-full font-medium"
:class="{
'bg-yellow-100 text-yellow-800': message.content.status === 0,
'bg-green-100 text-green-800': message.content.status === 1,
'bg-blue-100 text-blue-800': message.content.status === 2,
'bg-gray-100 text-gray-800': message.content.status === 3,
'bg-red-100 text-red-800': message.content.status === 4
}"
>
{{ prescriptionStatusMap[message.content.status] }}
</div>
</div>
<div class="mt-1 flex flex-wrap gap-2 text-xs text-gray-600 dark:text-gray-300">
<div class="flex items-center gap-1">
<i class="fas fa-hashtag text-xs"></i>
<span class="truncate max-w-[100px]">{{ message.content.order_no }}</span>
</div>
<div class="flex items-center gap-1">
<i class="fas fa-truck text-xs"></i>
<span>{{ message.content.express_name }}</span>
</div>
</div>
</div>
</div>
<div class="mt-3 pt-2 border-t border-gray-200 dark:border-gray-600 flex items-center justify-between">
<div class="text-sm font-medium text-gray-700 dark:text-gray-200">
支付金额: <span class="text-red-500 dark:text-red-400">¥{{ message.content.total_pay_price }}</span>
</div>
<div class="flex items-center text-blue-500 dark:text-blue-300 hover:text-blue-600 dark:hover:text-blue-200 transition-colors">
<span class="text-sm font-medium">查看处方</span>
<i class="fas fa-chevron-right ml-1 text-xs"></i>
</div>
</div>
</div>
<!-- 通话消息 -->
<div
v-else-if="message.type === 'video-call' || message.type === 'voice-call'"
@@ -262,19 +344,25 @@ v-else-if="message.type === 'video-call' || message.type === 'voice-call'"
}
.message-bubble.sent {
background: linear-gradient(135deg, #4361ee, #3f37c9);
color: white;
border-bottom-right-radius: 4px;
}
.message-bubble.received {
.bubble-bg {
background: linear-gradient(135deg, #4361ee, #3f37c9);
}
.bubble-bg.dark {
background: linear-gradient(135deg, #4361ee, #3f37c9);
}
.message-bubble.received.bubble-bg {
background: white;
color: #1a202c;
border: 1px solid #e2e8f0;
border-bottom-left-radius: 4px;
}
.message-bubble.received.dark {
.message-bubble.received.dark.bubble-bg {
background: #374151;
color: #f7fafc;
border-color: #4b5563;
@@ -514,4 +602,19 @@ v-else-if="message.type === 'video-call' || message.type === 'voice-call'"
.message-bubble.sent :deep(.text-link:hover) {
color: white;
}
/* 处方卡片样式 - 使用TailwindCSS类替代 */
.prescription-card {
@apply w-full max-w-xs md:max-w-sm cursor-pointer rounded-xl bg-white dark:bg-gray-700 p-4 shadow-sm transition-all duration-300;
@apply border border-gray-200 dark:border-gray-600 hover:shadow-md hover:border-blue-300 dark:hover:border-blue-500;
}
.message-bubble.sent .prescription-card {
@apply bg-blue-50/30 dark:bg-blue-900/30 border-blue-200/50 dark:border-blue-700/70;
}
.prescription-card:hover {
@apply transform -translate-y-0.5;
}
</style>

View File

@@ -1,5 +1,5 @@
<script setup>
import { nextTick, onMounted, onUnmounted, provide, ref } from 'vue';
import { ref, provide, nextTick, onMounted, onUnmounted } from 'vue';
import { message } from 'ant-design-vue';
@@ -13,6 +13,14 @@ import CustomTextarea from './CustomTextarea.vue';
import EmojiPicker from './EmojiPicker.vue';
import FileUploadPreview from './FileUploadPreview.vue';
// 定义 props
const props = defineProps({
currentFriend: {
type: Object,
default: () => ({})
}
});
const userStore = useUserStore();
const chatStore = useChatStore();
const themeStore = useThemeStore();
@@ -244,65 +252,84 @@ onMounted(() => {
onUnmounted(() => {
window.removeEventListener('audioRecorded', handleAudioRecorded);
});
// 定义 emits
const emit = defineEmits([
'sendMessage',
'openPrescription' // 添加开方事件
]);
// 开方功能触发函数
const handleOpenPrescription = () => {
// 获取当前会话的register_id这里假设可以通过某种方式获取
// 例如从聊天存储或props中获取
const registerId = props.currentFriend?.register_id || 66;
if (registerId) {
emit('openPrescription', registerId);
} else {
console.warn('无法获取当前会话的register_id');
// 可以添加一个提示或使用默认值
emit('openPrescription', 0);
}
};
</script>
<template>
<div :class="{ dark: themeStore.isDarkMode }" class="message-input-area">
<div class="message-input-container" :class="{ dark: themeStore.isDarkMode }">
<!-- 文件上传预览 -->
<FileUploadPreview v-if="uploadPreview" />
<!-- 表情选择器 -->
<EmojiPicker v-if="showEmojiPicker" class="mb-10" @select="insertEmoji" />
<!-- 工具栏 -->
<div class="toolbar">
<button
class="function-btn prescription-button"
@click="handleOpenPrescription"
title="开方"
>
<i class="fas fa-file-medical"></i>
<!-- <i class="fas fa-prescription"></i>-->
</button>
<button
class="function-btn"
@click="triggerFileInput('image')"
title="发送图片"
>
<i class="fas fa-image"></i>
</button>
<button
class="function-btn"
@click="triggerFileInput('video')"
title="发送视频"
>
<i class="fas fa-video"></i>
</button>
<button
:class="{ active: showEmojiPicker }"
class="function-btn"
title="选择表情"
@click="toggleEmojiPicker"
>
<i class="fas fa-smile"></i>
</button>
<button
:class="{ recording: isRecording }"
class="function-btn record-btn"
title="按住录音"
@mousedown="startRecording"
@mouseleave="stopRecording"
@mouseup="stopRecording"
@touchend="stopRecording"
@touchstart="startRecording"
>
<i class="fas fa-microphone"></i>
</button>
</div>
<div class="input-container">
<!-- 功能按钮区域 -->
<div class="function-buttons">
<button
class="function-btn"
title="发送图片"
@click="triggerFileInput('image')"
>
<i class="fas fa-image"></i>
<div class="btn-ripple"></div>
</button>
<button
class="function-btn"
title="发送视频"
@click="triggerFileInput('video')"
>
<i class="fas fa-video"></i>
<div class="btn-ripple"></div>
</button>
<button
:class="{ active: showEmojiPicker }"
class="function-btn"
title="选择表情"
@click="toggleEmojiPicker"
>
<i class="fas fa-smile"></i>
<div class="btn-ripple"></div>
</button>
<button
:class="{ recording: isRecording }"
class="function-btn record-btn"
title="按住录音"
@mousedown="startRecording"
@mouseleave="stopRecording"
@mouseup="stopRecording"
@touchend="stopRecording"
@touchstart="startRecording"
>
<i class="fas fa-microphone"></i>
<div class="btn-ripple"></div>
<div v-if="isRecording" class="recording-wave"></div>
</button>
<!-- 录音状态指示器 -->
<!-- <RecordingIndicator />-->
</div>
<!-- 输入框区域 -->
<div class="input-section">
<CustomTextarea
@@ -348,14 +375,14 @@ onUnmounted(() => {
</template>
<style scoped>
.message-input-area {
.message-input-container {
padding: 20px;
border-top: 1px solid #e2e8f0;
background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
position: relative;
}
.message-input-area.dark {
.message-input-container.dark {
border-top-color: #374151;
background: linear-gradient(135deg, #2d2d2d 0%, #1f2937 100%);
}
@@ -366,6 +393,38 @@ onUnmounted(() => {
gap: 16px;
}
.toolbar {
display: flex;
align-items: center;
padding: 8px;
border-top: 1px solid #666666;
}
.function-btn {
background: none;
border: none;
cursor: pointer;
padding: 5px 10px;
border-radius: 4px;
margin-right: 5px;
display: flex;
align-items: center;
color: #666;
}
.function-btn:hover {
background-color: #f0f0f0;
}
.prescription-button {
color: #455cda;
font-weight: 500;
}
.prescription-button:hover {
background-color: #e6e9ff;
}
.function-buttons {
display: flex;
gap: 12px;
@@ -461,12 +520,12 @@ onUnmounted(() => {
height: 100px;
}
.message-input-area.dark .function-btn {
.message-input-container.dark .function-btn {
background: linear-gradient(135deg, #374151, #4b5563);
color: #9ca3af;
}
.message-input-area.dark .function-btn:hover {
.message-input-container.dark .function-btn:hover {
background: linear-gradient(135deg, #4361ee, #3f37c9);
color: white;
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,7 @@
<script setup>
import { onMounted, onUnmounted, ref, watch } from 'vue';
import { onUnmounted, ref, watch } from 'vue';
import { useVbenModal } from '@vben/common-ui';
import ChatArea from './components/ChatArea.vue';
import ConnectionStatus from './components/ConnectionStatus.vue';
@@ -9,7 +11,7 @@ import FriendsManagement from './components/FriendsManagement.vue';
import GroupsManagement from './components/GroupsManagement.vue';
import MediaPreview from './components/MediaPreview.vue';
import MomentsView from './components/MomentsView.vue';
// import SideNavigation from './components/SideNavigation.vue';
import PrescriptionModal from './components/PrescriptionModal.vue';
import VideoCallComponent from './components/VideoCallComponent.vue';
import { useChatStore } from './stores/chat.ts';
import { useThemeStore } from './stores/theme.ts';
@@ -25,19 +27,39 @@ const callType = ref('video');
const isIncoming = ref(false);
const callerInfo = ref(null);
// 初始化录音功能
// const { isRecording } = useRecording();
// 使用 VbenModal 管理处方模态框
const [PrescriptionModalComponent, prescriptionModalApi] = useVbenModal({
connectedComponent: PrescriptionModal,
});
// 处理导航切换
const handleNavChange = (nav) => {
currentNav.value = nav;
};
// 显示开方模块 - 使用正确的VbenModal数据传递方式
const openPrescriptionModule = (registerId) => {
console.log('registerId', registerId);
// 通过 setData 传递数据,然后打开模态框
prescriptionModalApi.setData({
registerId,
onPrescriptionSent: handlePrescriptionSent, // 传递回调函数
});
prescriptionModalApi.open();
};
// 处理处方发送完成事件
const handlePrescriptionSent = () => {
console.log('处方发送完成');
// 可以在这里添加其他逻辑,如刷新聊天记录等
// 注意模态框会在PrescriptionModal组件内部关闭
};
// 监听通话状态变化
watch(
() => chatStore.callStatus,
(status) => {
// 只有当通话状态是活跃状态时才显示视频组件
showVideoCall.value =
status === 'connecting' ||
status === 'calling' ||
@@ -69,7 +91,6 @@ watch(
callType.value = call.callType;
isIncoming.value = false;
} else {
// 当通话结束时重置状态
showVideoCall.value = false;
}
},
@@ -85,7 +106,7 @@ const handleRejectCall = () => {
chatStore.rejectCall();
};
// 处理结束通话 - 修复挂断逻辑
// 处理结束通话
const handleEndCall = () => {
chatStore.endCall();
};
@@ -94,33 +115,16 @@ const handleEndCall = () => {
themeStore.loadTheme();
onUnmounted(() => {
// disconnectWebSocket();
// 清理资源
});
</script>
<template>
<div
style="height: 95vh;"
class="flex bg-gradient-to-br from-blue-900 via-purple-900 to-pink-300 p-5"
class="chat-box-body flex bg-gradient-to-br from-blue-900 via-purple-900 to-pink-300 p-5"
style="height: 95vh"
>
<!-- &lt;!&ndash; 背景装饰 &ndash;&gt;-->
<!-- <div class="pointer-events-none fixed inset-0 z-0">-->
<!-- <div-->
<!-- class="animate-float absolute left-10 top-10 h-72 w-72 rounded-full bg-blue-500 opacity-10"-->
<!-- ></div>-->
<!-- <div-->
<!-- class="right-15 animate-float-delayed absolute top-60 h-48 w-48 rounded-full bg-cyan-400 opacity-10"-->
<!-- ></div>-->
<!-- <div-->
<!-- class="animate-float-slow absolute bottom-10 left-20 h-36 w-36 rounded-full bg-red-400 opacity-10"-->
<!-- ></div>-->
<!-- </div>-->
<!-- &lt;!&ndash; 录音状态指示器 &ndash;&gt;-->
<!-- <RecordingIndicator />-->
<!-- 视频通话组件移动到此处 -->
<!-- 视频通话组件 -->
<VideoCallComponent
v-if="showVideoCall"
:call-type="callType"
@@ -137,18 +141,19 @@ onUnmounted(() => {
>
<!-- 连接状态指示器 -->
<ConnectionStatus />
<!-- &lt;!&ndash; 侧边导航 &ndash;&gt;-->
<!-- <SideNavigation-->
<!-- :current-view="currentNav"-->
<!-- @nav-change="handleNavChange"-->
<!-- />-->
<!-- 好友列表 -->
<FriendList class="w-80 min-w-80" />
<!-- 处方模态框 - 使用 VbenModal 模式 -->
<PrescriptionModalComponent />
<!-- 聊天区域 -->
<div class="min-w-0 flex-1">
<ChatArea v-if="chatStore.currentFriend && currentNav === 'chat'" />
<ChatArea
v-if="chatStore.currentFriend && currentNav === 'chat'"
@open-prescription="openPrescriptionModule"
/>
<FriendsManagement v-else-if="currentNav === 'friends'" />
<GroupsManagement v-else-if="currentNav === 'groups'" />
<MomentsView v-else-if="currentNav === 'moments'" />
@@ -160,6 +165,7 @@ onUnmounted(() => {
<MediaPreview />
</div>
</template>
<style scoped>
/*@keyframes float {
0% {

View File

@@ -237,7 +237,10 @@ export const useChatStore = defineStore('chat', () => {
return {
id: message.id,
type: getMessageType(message.message_type),
content: message.message_content,
content:
message.message_type === 4
? JSON.parse(message.message_content)
: message.message_content,
time: message.created_at_text,
timestamp: message.created_at,
senderId: message.sender_user_id,
@@ -261,6 +264,7 @@ export const useChatStore = defineStore('chat', () => {
if (message.type === 'image') lastMessage = '[图片]';
if (message.type === 'video') lastMessage = '[视频]';
if (message.type === 'audio') lastMessage = '[语音]';
if (message.type === 'prescription') lastMessage = '[处方]';
if (message.type === 'video-call' || message.type === 'audio-call')
lastMessage = '[通话]';

View File

@@ -1,7 +1,7 @@
import {defineStore} from "pinia"
import {ref} from "vue"
import { defineStore } from "pinia"
import { ref, nextTick } from "vue"
export const useThemeStore = defineStore("theme", () => {
export const useThemeStore = defineStore('theme', () => {
const isDarkMode = ref(false)
const toggleTheme = () => {
@@ -10,24 +10,40 @@ export const useThemeStore = defineStore("theme", () => {
updateTheme()
}
// 修改:仅针对.chat-box-body元素应用主题
const updateTheme = () => {
if (isDarkMode.value) {
document.documentElement.setAttribute("data-theme", "dark")
document.documentElement.classList.add("dark")
} else {
document.documentElement.removeAttribute("data-theme")
document.documentElement.classList.remove("dark")
}
nextTick(() => {
const chatBoxBody = document.querySelector('.chat-box-body')
if (!chatBoxBody) return
if (isDarkMode.value) {
chatBoxBody.setAttribute("data-theme", "dark")
chatBoxBody.classList.add("dark")
} else {
chatBoxBody.removeAttribute("data-theme")
chatBoxBody.classList.remove("dark")
}
})
}
// 修改确保DOM就绪后再加载主题
const loadTheme = () => {
const savedTheme = localStorage.getItem("chatTheme")
if (savedTheme) {
isDarkMode.value = savedTheme === "dark"
} else {
isDarkMode.value = window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches
isDarkMode.value = window.matchMedia?.("(prefers-color-scheme: dark)").matches
}
updateTheme()
// 等待DOM渲染完成后再更新主题
const applyTheme = () => {
if (document.querySelector('.chat-box-body')) {
updateTheme()
} else {
requestAnimationFrame(applyTheme)
}
}
applyTheme()
}
return {

View File

@@ -126,7 +126,8 @@ export const sendMessage = (data) => {
const requestData = {
room_id: data.roomId,
sender_user_id: 'doctor-' + data.senderId.toString(),
// sender_user_id: 'doctor-' + data.senderId.toString(),
sender_user_id: data.senderId.toString(),
receiver_user_id: data.receiverId.toString(),
message_type: messageTypeMap[data.type] || 0,
message_content: data.content || '',

View File

@@ -23,19 +23,24 @@ import {
Select,
SelectOption,
} from 'ant-design-vue';
import { debounce } from 'lodash-es'; // 或者使用自定义防抖函数
import { debounce } from 'lodash-es';
import {
getDrugUseList,
getProductListDoctorReception,
} from '#/views/doctor/doctor-reception/api';
import { usePrescriptionStore } from '#/store/prescription'
// 使用 Pinia store
const prescriptionStore = usePrescriptionStore();
const { currentDrugs, initializeForModal, updateCurrentDrugs } = prescriptionStore;
// 搜索关键词
const searchKey = ref('');
// 药品类型1-中药2-西药
const type = ref(1);
// 当前药品回调函数
const currentDrugs = ref();
const currentDrugsWestern = ref();
// 当前患者ID
const activePatientId = ref(0);
// 药品列表
@@ -51,6 +56,7 @@ const drugTime = ref([]);
const drugUseWay = ref([]);
// 当前选中的药品ID
const selectProductId = ref(0);
const ChatTypeCheck = ref('');
// 预览图片URL
const previewImage = ref('');
@@ -285,6 +291,10 @@ function propProducts(data) {
function updateSelectStorage() {
try {
localStorage.setItem(storageKey.value, JSON.stringify(selectList.value));
if (ChatTypeCheck.value === 'chat') {
// 使用 Pinia store 的方法更新 currentDrugs
updateCurrentDrugs(selectList.value);
}
} catch (error) {
console.error('保存处方数据失败:', error);
message.error('保存处方数据失败');
@@ -311,11 +321,9 @@ const [Modal, modalApi] = useVbenModal({
modalApi.close();
},
onConfirm: async () => {
// 保存数据
updateSelectStorage();
// 调用回调函数
if (typeof currentDrugs.value === 'function') {
currentDrugs.value();
if (typeof currentDrugsWestern.value === 'function') {
currentDrugsWestern.value();
}
// 关闭modal
modalApi.close();
@@ -326,16 +334,22 @@ const [Modal, modalApi] = useVbenModal({
if (isOpen) {
// 获取回调函数
const data = modalApi.getData();
currentDrugs.value = data?.getCurrentDrugs;
currentDrugsWestern.value = data?.getCurrentDrugs;
// 获取参数
const { values, activePatient_id } = data || {};
const { values, activePatient_id, isChat } = data || {};
if (values) {
// 设置药品类型
type.value = values;
// 设置患者ID
activePatientId.value = activePatient_id;
if (isChat === 'chat') {
ChatTypeCheck.value = isChat;
activePatientId.value = `-chat-${activePatient_id.value}`;
// 使用轻量级初始化,不获取患者信息
initializeForModal(activePatient_id.value);
}
// 获取药品列表
getDrugListByWesternModal();
// 获取药品使用方式列表
@@ -362,12 +376,12 @@ function selectDrugUseWayChange(id) {
drugList.value = drugList.value.map((item) =>
item.id === selectProductId.value
? {
...item,
drug: {
...item.drug,
way_id: id,
},
}
...item,
drug: {
...item.drug,
way_id: id,
},
}
: item,
);
@@ -375,10 +389,10 @@ function selectDrugUseWayChange(id) {
selectList.value = selectList.value.map((item) =>
item.index_id === selectProductId.value
? {
...item,
way_id: id,
use_ways: drugUseWay.value.find((value) => value.id === id),
}
...item,
way_id: id,
use_ways: drugUseWay.value.find((value) => value.id === id),
}
: item,
);
@@ -395,12 +409,12 @@ function selectFrequencyChange(id) {
selectList.value = selectList.value.map((item) =>
item.index_id === selectProductId.value
? {
...item,
frequency_id: id,
use_frequency: drugUseFrequency.value.find(
(value) => value.id === id,
),
}
...item,
frequency_id: id,
use_frequency: drugUseFrequency.value.find(
(value) => value.id === id,
),
}
: item,
);
@@ -417,10 +431,10 @@ function selectTimeChange(id) {
selectList.value = selectList.value.map((item) =>
item.index_id === selectProductId.value
? {
...item,
time_id: id,
use_num: drugTime.value.find((value) => value.id === id),
}
...item,
time_id: id,
use_num: drugTime.value.find((value) => value.id === id),
}
: item,
);
@@ -437,10 +451,10 @@ function selectTypeChange(id) {
selectList.value = selectList.value.map((item) =>
item.index_id === selectProductId.value
? {
...item,
type_id: id,
use_type: drugUseType.value.find((value) => value.id === id),
}
...item,
type_id: id,
use_type: drugUseType.value.find((value) => value.id === id),
}
: item,
);
@@ -457,10 +471,10 @@ function selectUnitChange(id) {
selectList.value = selectList.value.map((item) =>
item.index_id === selectProductId.value
? {
...item,
unit_id: id,
unit: drugUnit.value.find((value) => value.id === id),
}
...item,
unit_id: id,
unit: drugUnit.value.find((value) => value.id === id),
}
: item,
);
@@ -484,9 +498,9 @@ function updateProductNumber(id, number) {
selectList.value = selectList.value.map((item) =>
item.index_id === id
? {
...item,
number,
}
...item,
number,
}
: item,
);
@@ -546,8 +560,7 @@ function updateProductNumber(id, number) {
</template>
</CardMeta>
<div class="card-box mt-5" style="padding: 10px 5px">
<p>单价{{item.price}}/g</p>
<p>单价{{ item.price }}/g</p>
<!-- 选择中药煎法 -->
<Select
:value="item.drug?.way_id"
@@ -641,7 +654,6 @@ function updateProductNumber(id, number) {
<p class="drug-function text-xs">
功效{{ item.drug?.function }}
</p>
<template #content>
<p>功效{{ item.drug?.function }}</p>
<p>用法{{ item.drug?.usage }}</p>