From c10b1e130ccbc94e6481a43e8e2d35cfc8fcf83b Mon Sep 17 00:00:00 2001
From: wlzboy <66905212@qq.com>
Date: 星期五, 26 十二月 2025 18:05:06 +0800
Subject: [PATCH] feat:显示问题

---
 app/pagesTask/create-emergency.vue |   64 ++++++++++++++++++++++++++------
 1 files changed, 52 insertions(+), 12 deletions(-)

diff --git a/app/pagesTask/create-emergency.vue b/app/pagesTask/create-emergency.vue
index e2b1d05..166e11c 100644
--- a/app/pagesTask/create-emergency.vue
+++ b/app/pagesTask/create-emergency.vue
@@ -65,7 +65,7 @@
         label="鎵ц浠诲姟浜哄憳"
         :required="false"
         :auto-add-current-user="true"
-        :current-user-removable="false"
+        :current-user-removable="true"
         :branch-dept-ids="allOrganizationIds"
         @change="onStaffChange"
       />
@@ -266,7 +266,7 @@
 import { mapState } from 'vuex'
 import uniDatetimePicker from '@/uni_modules/uni-datetime-picker/components/uni-datetime-picker/uni-datetime-picker.vue'
 import uniPopup from '@/uni_modules/uni-popup/components/uni-popup/uni-popup.vue'
-import { addTask } from "@/api/task"
+import { addTask, checkTaskDuplicate } from "@/api/task"
 import { listAvailableVehicles, getUserBoundVehicle } from "@/api/vehicle"
 import { searchHospitals, searchHospitalsByDeptRegion } from "@/api/hospital"
 import DepartureSelector from './components/DepartureSelector.vue'
@@ -567,11 +567,7 @@
       console.log('杞嚭鍖婚櫌鍙樺寲:', hospitalData)
       // 缁勪欢宸茬粡閫氳繃 v-model 鏇存柊浜� taskForm.hospitalOut
       
-      // 濡傛灉閫夋嫨鐨勬槸"瀹朵腑"锛岃嚜鍔ㄨ缃瀹や负"鍏跺畠"
-      if (hospitalData.name === '瀹朵腑') {
-        this.taskForm.hospitalOut.department = '鍏跺畠'
-        this.taskForm.hospitalOut.departmentId = null
-      }
+      // 绉戝鐨勮缃敱 DepartmentSelector 缁勪欢鑷姩澶勭悊锛堥�氳繃 isHome 灞炴�э級
       
       // 濡傛灉杞叆鍦板潃宸插~鍐�,鑷姩璁$畻璺濈
       if (this.taskForm.hospitalIn.address) {
@@ -597,11 +593,7 @@
       console.log('杞叆鍖婚櫌鍙樺寲:', hospitalData)
       // 缁勪欢宸茬粡閫氳繃 v-model 鏇存柊浜� taskForm.hospitalIn
       
-      // 濡傛灉閫夋嫨鐨勬槸"瀹朵腑"锛岃嚜鍔ㄨ缃瀹や负"鍏跺畠"
-      if (hospitalData.name === '瀹朵腑') {
-        this.taskForm.hospitalIn.department = '鍏跺畠'
-        this.taskForm.hospitalIn.departmentId = null
-      }
+      // 绉戝鐨勮缃敱 DepartmentSelector 缁勪欢鑷姩澶勭悊锛堥�氳繃 isHome 灞炴�э級
       
       // 濡傛灉杞嚭鍦板潃宸插~鍐�,鑷姩璁$畻璺濈
       if (this.taskForm.hospitalOut.address) {
@@ -813,6 +805,18 @@
         return false
       }
       
+      // 濡傛灉杞叆鍖婚櫌鏄�滃涓�濓紝蹇呴』濉啓鍦板潃
+      if (this.taskForm.hospitalIn.name === '瀹朵腑' && !this.taskForm.hospitalIn.address) {
+        this.$modal.showToast('璇疯緭鍏ヨ浆鍏ュ湴鍧�锛堝涓級')
+        return false
+      }
+      
+      // 濡傛灉杞嚭鍖婚櫌鏄�滃涓�濓紝蹇呴』濉啓鍦板潃
+      if (this.taskForm.hospitalOut.name === '瀹朵腑' && !this.taskForm.hospitalOut.address) {
+        this.$modal.showToast('璇疯緭鍏ヨ浆鍑哄湴鍧�锛堝涓級')
+        return false
+      }
+      
       if (!this.taskForm.transferDistance) {
         this.$modal.showToast('璇疯緭鍏ヨ浆杩愬叕閲屾暟')
         return false
@@ -846,6 +850,10 @@
           conditionText = this.taskForm.patient.condition
         }
       }
+      
+      // 璋冭瘯鏃ュ織锛氭鏌ヨ浆鍏ュ尰闄㈠湴鍧�
+      console.log('鏋勫缓鎻愪氦鏁版嵁 - 杞叆鍖婚櫌:', this.taskForm.hospitalIn.name)
+      console.log('鏋勫缓鎻愪氦鏁版嵁 - 杞叆鍖婚櫌鍦板潃:', this.taskForm.hospitalIn.address)
       
       const submitData = {
         taskType: 'EMERGENCY_TRANSFER',
@@ -909,6 +917,38 @@
         return
       }
       
+      // 鑾峰彇褰撳墠鏃ユ湡锛堟牸寮廦YYY-MM-DD锛�
+      const today = new Date()
+      const createDate = today.getFullYear() + '-' + 
+                        String(today.getMonth() + 1).padStart(2, '0') + '-' + 
+                        String(today.getDate()).padStart(2, '0')
+      const phone = this.taskForm.patient.phone
+      
+      // 鍏堟鏌ユ槸鍚﹂噸澶�
+      uni.showLoading({
+        title: '妫�鏌ヤ腑...'
+      })
+      
+      checkTaskDuplicate(phone, createDate).then(response => {
+        uni.hideLoading()
+        
+        // 濡傛灉鎺ュ彛杩斿洖閿欒锛岃鏄庡瓨鍦ㄩ噸澶�
+        if (response.code !== 200) {
+          this.$modal.showToast(response.msg || '璇ヨ仈绯荤數璇濆湪褰撳ぉ宸叉湁浠诲姟锛屼笉鑳介噸澶嶆彁浜�')
+          return
+        }
+        
+        // 妫�鏌ラ�氳繃锛岀户缁彁浜�
+        this.doSubmitTask()
+      }).catch(error => {
+        uni.hideLoading()
+        console.error('閲嶅鎬ф鏌ュけ璐�:', error)
+        this.$modal.showToast('妫�鏌ュけ璐ワ紝璇烽噸璇�')
+      })
+    },
+    
+    // 鎵ц瀹為檯鐨勬彁浜ゆ搷浣�
+    doSubmitTask() {
       this.$modal.confirm('纭畾瑕佷繚瀛樹换鍔″悧锛�').then(() => {
         this.loading = true
         const submitData = this.buildSubmitData()

--
Gitblit v1.9.1