From d0494a1b3ff6cdf48b1237058d99840da245a75e Mon Sep 17 00:00:00 2001
From: WXL <wl_5969728@163.com>
Date: 星期五, 28 十一月 2025 16:40:45 +0800
Subject: [PATCH] 打印提醒优化

---
 src/views/ecg/doctor/components/RoutinePanel.vue |   42 ++++++++++++++++++++++++++++++++++--------
 1 files changed, 34 insertions(+), 8 deletions(-)

diff --git a/src/views/ecg/doctor/components/RoutinePanel.vue b/src/views/ecg/doctor/components/RoutinePanel.vue
index 076ce48..ad7f9fd 100644
--- a/src/views/ecg/doctor/components/RoutinePanel.vue
+++ b/src/views/ecg/doctor/components/RoutinePanel.vue
@@ -57,8 +57,10 @@
   <el-button @click="submitForm" type="primary" :disabled="formLoading">妫�鏌ュ畬鎴�</el-button>
   <el-button @click="cancelInstall" :disabled="formLoading">鏀惧純妫�鏌�</el-button>
   <el-button @click="resetForm()">閲� 缃�</el-button>
-  <el-button @click="yddownload()">骞虫澘杩愬姩蹇冪數鍥剧煡鎯呭悓鎰忎功</el-button>
-  <el-button @click="sgdownload()">椋熺蹇冭剰鐢电敓鐞嗚瘖鐤楃煡鎯呭悓鎰忎功</el-button>
+  <el-button @click="yddownload()" :loading="yddownloadLoading"
+    :disabled="yddownloadLoading">骞虫澘杩愬姩蹇冪數鍥剧煡鎯呭悓鎰忎功</el-button>
+  <el-button @click="sgdownload()" :loading="sgdownloadLoading"
+    :disabled="sgdownloadLoading">椋熺蹇冭剰鐢电敓鐞嗚瘖鐤楃煡鎯呭悓鎰忎功</el-button>
   <el-button
     v-if="needAutoFeeConfirm(formData.checkType)"
     @click="feeConfirm"
@@ -192,7 +194,8 @@
 const message = useMessage() // 娑堟伅寮圭獥
 
 const dialogVisible = ref(false) // 寮圭獥鐨勬槸鍚﹀睍绀�
-
+const yddownloadLoading = ref(false);
+const sgdownloadLoading = ref(false);
 const formLoading = ref(false) // 琛ㄥ崟鐨勫姞杞戒腑锛�1锛変慨鏀规椂鐨勬暟鎹姞杞斤紱2锛夋彁浜ょ殑鎸夐挳绂佺敤
 
 const formData = ref<Partial<DevRentVO>>({
@@ -266,14 +269,37 @@
   formRef.value?.resetFields()
 }
 const yddownload = async () => {
-  const obj = await DoctorApi.yddownload(props.setappointmentId)
-  console.log(obj,'xml');
+  // 妫�鏌� setappointmentId 鏄惁瀛樺湪
+  if (!props.setappointmentId) {
+    message.warning('褰撳墠鏃犲氨璇婁腑鎮h�呰鍏堝彨鍙�')
+    return
+  }
   
-  downloadWordFile(obj, '骞虫澘杩愬姩蹇冪數鍥剧煡鎯呭悓鎰忎功.doc');
+  yddownloadLoading.value = true
+  try {
+    const response = await DoctorApi.yddownload(props.setappointmentId)
+    console.log(response, 'xml1')
+    console.log(response.fileContent, 'xml2')
+    downloadWordFile(response.fileContent, response.fileName)
+  } finally {
+    yddownloadLoading.value = false
+  }
 }
+
 const sgdownload = async () => {
-  const obj = await DoctorApi.sgdownload(props.setappointmentId)
-  downloadWordFile(obj, '椋熺蹇冭剰鐢电敓鐞嗚瘖鐤楃煡鎯呭悓鎰忎功.doc');
+  // 妫�鏌� setappointmentId 鏄惁瀛樺湪
+  if (!props.setappointmentId) {
+    message.warning('褰撳墠鏃犲氨璇婁腑鎮h�呰鍏堝彨鍙�')
+    return
+  }
+  
+  sgdownloadLoading.value = true
+  try {
+    const response = await DoctorApi.sgdownload(props.setappointmentId)
+    downloadWordFile(response.fileContent, response.fileName)
+  } finally {
+    sgdownloadLoading.value = false
+  }
 }
 const downloadWordFile = (data, filename = 'document') => {
   try {

--
Gitblit v1.9.3