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 |   59 +++++++++++++++++++++++++++++++++++++++++++++++------------
 1 files changed, 47 insertions(+), 12 deletions(-)

diff --git a/app/pagesTask/edit-emergency.vue b/app/pagesTask/edit-emergency.vue
index cb0d7dc..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 || ''
@@ -376,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) : ''
         }
         
@@ -421,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涓虹┖')
@@ -455,6 +473,23 @@
       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)
+      }
+    },
+    
     // 褰掑睘鏈烘瀯閫夋嫨鍙樺寲
     onOrganizationChange(orgData) {
       // orgData 鍖呭惈锛歞eptId, deptName, serviceOrderClass, region, departureAddress, departureLongitude, departureLatitude

--
Gitblit v1.9.1