From af8cab142a6b15c06e131a8474574dd5b00df982 Mon Sep 17 00:00:00 2001
From: wlzboy <66905212@qq.com>
Date: 星期四, 04 十二月 2025 22:09:58 +0800
Subject: [PATCH] feat: 改造微信accesstoken存放在系统配置表中

---
 app/pagesTask/edit-emergency.vue |   66 +++++++++++++++++++++++++++------
 1 files changed, 54 insertions(+), 12 deletions(-)

diff --git a/app/pagesTask/edit-emergency.vue b/app/pagesTask/edit-emergency.vue
index 67c10f4..eefd5df 100644
--- a/app/pagesTask/edit-emergency.vue
+++ b/app/pagesTask/edit-emergency.vue
@@ -19,7 +19,8 @@
       />
       
       <view class="form-item">
-        <OrganizationSelector 
+        <OrganizationSelector
+          ref="organizationSelector"
           v-model="selectedOrganizationId"
           :required="true"
           :auto-select-user-dept="false"
@@ -53,6 +54,7 @@
         :required="false"
         :auto-add-current-user="false"
         :current-user-removable="true"
+        :branch-dept-ids="allOrganizationIds"
         @change="onStaffChange"
       />
       
@@ -224,6 +226,7 @@
       taskDetail: null,
       selectedVehicleId: null,
       selectedOrganizationId: null,
+      allOrganizationIds: [], // 鎵�鏈夊彲閫夋満鏋処D鏁扮粍
       selectedRegion: '',
       mapSelectorType: '',
       // 鎵╁睍 addressCoordinates 鏀寔澶氱閿悕
@@ -292,6 +295,11 @@
       }, 1500)
     }
   },
+  
+  mounted() {
+    // 椤甸潰鎸傝浇鍚庡姞杞芥墍鏈夋満鏋処D
+    this.loadAllOrganizationIds()
+  },
   methods: {
     // 鍔犺浇浠诲姟璇︽儏
     loadTaskDetail() {
@@ -320,8 +328,9 @@
           const info = this.taskDetail.emergencyInfo
           console.log('杞繍浠诲姟淇℃伅:', info)
           
-          // 杞繍鏃堕棿
-          this.taskForm.transferTime = this.taskDetail.plannedStartTime || ''
+          // 杞繍鏃堕棿锛堜慨澶嶏細1900骞寸殑鏃ユ湡鏄剧ず涓虹┖锛�
+          const transferTime = this.taskDetail.plannedStartTime || ''
+          this.taskForm.transferTime = transferTime && transferTime.startsWith('1900') ? '' : transferTime
           
           // 鎮h�呬俊鎭�
           this.taskForm.patient.contact = info.patientContact || ''
@@ -338,8 +347,10 @@
           this.taskForm.hospitalOut.id = info.hospitalOutId || null
           this.taskForm.hospitalOut.name = info.hospitalOutName || ''
           this.taskForm.hospitalOut.department = info.hospitalOutDepartment || ''
+          this.taskForm.hospitalOut.departmentId = info.hospitalOutDepartmentId || null
           this.taskForm.hospitalOut.bedNumber = info.hospitalOutBedNumber || ''
           this.taskForm.hospitalOut.address = info.hospitalOutAddress || ''
+          console.log('杞嚭鍖婚櫌绉戝ID:', info.hospitalOutDepartmentId)
           
           // 鍔犺浇杞嚭鍖婚櫌GPS鍧愭爣锛堜笉鏄剧ず锛屼絾淇濆瓨鍦ㄦ暟鎹腑锛�
           if (info.hospitalOutLongitude && info.hospitalOutLatitude) {
@@ -354,8 +365,10 @@
           this.taskForm.hospitalIn.id = info.hospitalInId || null
           this.taskForm.hospitalIn.name = info.hospitalInName || ''
           this.taskForm.hospitalIn.department = info.hospitalInDepartment || ''
+          this.taskForm.hospitalIn.departmentId = info.hospitalInDepartmentId || null
           this.taskForm.hospitalIn.bedNumber = info.hospitalInBedNumber || ''
           this.taskForm.hospitalIn.address = info.hospitalInAddress || ''
+          console.log('杞叆鍖婚櫌绉戝ID:', info.hospitalInDepartmentId)
           
           // 鍔犺浇杞叆鍖婚櫌GPS鍧愭爣锛堜笉鏄剧ず锛屼絾淇濆瓨鍦ㄦ暟鎹腑锛�
           if (info.hospitalInLongitude && info.hospitalInLatitude) {
@@ -372,7 +385,8 @@
         } else {
           console.warn('浠诲姟璇︽儏涓病鏈塭mergencyInfo瀛楁锛屽皾璇曚粠涓诲璞¤幏鍙栨暟鎹�')
           // 鍏煎澶勭悊锛氬鏋渆mergencyInfo涓嶅瓨鍦紝灏濊瘯浠庝富瀵硅薄鑾峰彇
-          this.taskForm.transferTime = this.taskDetail.plannedStartTime || ''
+          const transferTime = this.taskDetail.plannedStartTime || ''
+          this.taskForm.transferTime = transferTime && transferTime.startsWith('1900') ? '' : transferTime
           this.taskForm.transferDistance = this.taskDetail.estimatedDistance ? String(this.taskDetail.estimatedDistance) : ''
         }
         
@@ -417,16 +431,24 @@
           console.log('璁剧疆鐩爣鍦板潗鏍�:', this.taskDetail.destinationLongitude, this.taskDetail.destinationLatitude)
         }
         
-        // 璁剧疆鎵ц浜哄憳锛堜慨澶嶏細纭繚 assignees 涓嶄负 null锛�
+        // 璁剧疆鎵ц浜哄憳锛堜慨澶嶏細纭繚 assignees 涓嶄负 null锛屽苟姝g‘鏄犲皠瀛楁锛�
         if (this.taskDetail.assignees && Array.isArray(this.taskDetail.assignees) && this.taskDetail.assignees.length > 0) {
           console.log('鍘熷鎵ц浜哄憳鏁版嵁:', this.taskDetail.assignees)
-          this.selectedStaff = this.taskDetail.assignees.map(assignee => ({
-            userId: assignee.userId,
-            nickName: assignee.userName,
-            type: assignee.userType || 'driver',
-            phonenumber: '',
-            deptName: ''
-          }))
+          this.selectedStaff = this.taskDetail.assignees.map(assignee => {
+            console.log('澶勭悊鎵ц浜哄憳:', assignee)
+            console.log('  - userName:', assignee.userName)
+            console.log('  - nickName:', assignee.nickName)
+            console.log('  - phonenumber:', assignee.phonenumber)
+            console.log('  - phone:', assignee.phone)
+            
+            return {
+              userId: assignee.userId,
+              nickName: assignee.userName || assignee.nickName || '',
+              type: assignee.userType || 'driver',
+              phonenumber: assignee.phonenumber || assignee.phone || '',
+              deptName: assignee.deptName || ''
+            }
+          })
           console.log('澶勭悊鍚庣殑鎵ц浜哄憳鍒楄〃:', this.selectedStaff)
         } else {
           console.warn('浠诲姟娌℃湁鍒嗛厤鎵ц浜哄憳鎴朼ssignees涓虹┖')
@@ -449,6 +471,23 @@
     // 杞﹁締閫夋嫨鍙樺寲
     onVehicleChange(vehicle) {
       console.log('閫変腑杞﹁締:', vehicle)
+    },
+    
+    // 鍔犺浇鎵�鏈夋満鏋処D
+    loadAllOrganizationIds() {
+      // 閫氳繃 OrganizationSelector 缁勪欢鑾峰彇鎵�鏈夋満鏋�
+      const orgSelector = this.$refs.organizationSelector
+      if (orgSelector) {
+        orgSelector.reload().then(organizations => {
+          this.allOrganizationIds = organizations.map(org => org.deptId)
+          console.log('鎵�鏈夋満鏋処D:', this.allOrganizationIds)
+        })
+      } else {
+        // 濡傛灉缁勪欢杩樻湭鎸傝浇,绋嶅悗閲嶈瘯
+        setTimeout(() => {
+          this.loadAllOrganizationIds()
+        }, 100)
+      }
     },
     
     // 褰掑睘鏈烘瀯閫夋嫨鍙樺寲
@@ -854,6 +893,9 @@
         this.loading = true
         const submitData = this.buildSubmitData()
         
+        console.log('鎻愪氦鏁版嵁 - 杞嚭鍖婚櫌绉戝ID:', submitData.hospitalOut.departmentId)
+        console.log('鎻愪氦鏁版嵁 - 杞叆鍖婚櫌绉戝ID:', submitData.hospitalIn.departmentId)
+        
         updateTask(submitData).then(response => {
           this.loading = false
           console.log('浠诲姟鏇存柊鍝嶅簲:', response)

--
Gitblit v1.9.1