From 5d75fcaea0a3774052b7484a4ffe755258502363 Mon Sep 17 00:00:00 2001
From: wlzboy <66905212@qq.com>
Date: 星期六, 06 十二月 2025 20:49:11 +0800
Subject: [PATCH] fix:开始执行人员就绪按钮
---
app/pagesTask/create-emergency.vue | 168 ++++++++++++++++++++++++++-----------------------------
1 files changed, 80 insertions(+), 88 deletions(-)
diff --git a/app/pagesTask/create-emergency.vue b/app/pagesTask/create-emergency.vue
index a752eda..e2b1d05 100644
--- a/app/pagesTask/create-emergency.vue
+++ b/app/pagesTask/create-emergency.vue
@@ -144,28 +144,60 @@
label="鍖婚櫌鍚嶇О"
address-label="杞嚭鍦板潃"
:required="true"
- :department-required="true"
+ :show-department="false"
v-model="taskForm.hospitalOut"
:dept-id="selectedOrganizationId"
:region="selectedRegion"
- :department-options="departmentOptions"
@change="onHospitalOutChange"
@address-selected="onHospitalOutAddressSelected"
/>
+ <DepartmentSelector
+ label="杞嚭绉戝"
+ :required="true"
+ v-model="taskForm.hospitalOut.department"
+ :department-id="taskForm.hospitalOut.departmentId"
+ :is-home="taskForm.hospitalOut.name === '瀹朵腑'"
+ @change="onHospitalOutDepartmentChange"
+ />
+
+ <view class="form-item">
+ <view class="form-label">搴婂彿</view>
+ <input
+ class="form-input"
+ placeholder="璇疯緭鍏ュ簥鍙�"
+ v-model="taskForm.hospitalOut.bedNumber"
+ />
+ </view>
<view class="form-section-title">杞叆鍖婚櫌淇℃伅</view>
<HospitalSelector
label="鍖婚櫌鍚嶇О"
address-label="杞叆鍦板潃"
:required="true"
- :department-required="true"
+ :show-department="false"
v-model="taskForm.hospitalIn"
:dept-id="selectedOrganizationId"
:region="selectedRegion"
- :department-options="departmentOptions"
@change="onHospitalInChange"
@address-selected="onHospitalInAddressSelected"
/>
+ <DepartmentSelector
+ label="杞叆绉戝"
+ :required="true"
+ v-model="taskForm.hospitalIn.department"
+ :department-id="taskForm.hospitalIn.departmentId"
+ :is-home="taskForm.hospitalIn.name === '瀹朵腑'"
+ @change="onHospitalInDepartmentChange"
+ />
+
+ <view class="form-item">
+ <view class="form-label">搴婂彿</view>
+ <input
+ class="form-input"
+ placeholder="璇疯緭鍏ュ簥鍙�"
+ v-model="taskForm.hospitalIn.bedNumber"
+ />
+ </view>
<view class="form-item">
<view class="form-label required">杞繍鍏噷鏁�</view>
@@ -245,13 +277,14 @@
import { checkVehicleActiveTasks } from "@/api/task"
import { getDicts } from "@/api/dict"
-import { getServiceOrdAreaTypes, getServiceOrderTypes, getHospitalDepartments } from "@/api/dictionary"
+import { getServiceOrdAreaTypes, getServiceOrderTypes } from "@/api/dictionary"
import { listBranchCompany, getDept } from "@/api/system/dept"
import MapSelector from './components/map-selector.vue'
import OrganizationSelector from './components/OrganizationSelector.vue'
import HospitalSelector from './components/HospitalSelector.vue'
import DiseaseSelector from './components/DiseaseSelector.vue'
import StaffSelector from './components/StaffSelector.vue'
+import DepartmentSelector from './components/DepartmentSelector.vue'
export default {
components: {
@@ -262,7 +295,8 @@
HospitalSelector,
DiseaseSelector,
DepartureSelector,
- StaffSelector
+ StaffSelector,
+ DepartmentSelector
},
data() {
return {
@@ -320,7 +354,6 @@
emergencyTaskTypeOptions: [], // 浠诲姟绫诲瀷閫夐」锛堢敤浜巔icker鏄剧ず锛�
documentTypes: [], // 鍗曟嵁绫诲瀷鍒楄〃
documentTypeOptions: [], // 鍗曟嵁绫诲瀷閫夐」锛堢敤浜巔icker鏄剧ず锛�
- departmentOptions: [], // 绉戝瀛楀吀鏁版嵁
loading: false,
// 鏅鸿兘璇嗗埆鐩稿叧
rawText: '',
@@ -357,8 +390,6 @@
this.getAvailableVehicles().then(() => {
this.getUserBoundVehicleInfo()
})
- // 鍔犺浇绉戝瀛楀吀鏁版嵁
- this.loadDepartments()
// 鍔犺浇浠诲姟绫诲瀷鏁版嵁
this.loadEmergencyTaskTypes()
// 鍔犺浇鍗曟嵁绫诲瀷鏁版嵁
@@ -468,22 +499,6 @@
}
},
- // 鍔犺浇绉戝鏁版嵁锛堜粠 SQL Server 鍔ㄦ�佸姞杞斤級
- loadDepartments() {
- getHospitalDepartments().then(response => {
- const list = response.data || [];
- this.departmentOptions = list.map(item => ({
- id: item.vID,
- text: item.vtext,
- dictValue: item.vtext // 涓轰簡淇濇寔鍏煎鎬э紝淇濈暀dictValue瀛楁
- }));
- // console.log('绉戝鏁版嵁鍔犺浇鎴愬姛:', this.departmentOptions);
- }).catch(error => {
- console.error('鍔犺浇绉戝鏁版嵁澶辫触:', error)
- this.departmentOptions = []
- })
- },
-
// 鍔犺浇浠诲姟绫诲瀷鏁版嵁锛堜粠 SQL Server锛�
loadEmergencyTaskTypes() {
getServiceOrderTypes().then(response => {
@@ -552,6 +567,12 @@
console.log('杞嚭鍖婚櫌鍙樺寲:', hospitalData)
// 缁勪欢宸茬粡閫氳繃 v-model 鏇存柊浜� taskForm.hospitalOut
+ // 濡傛灉閫夋嫨鐨勬槸"瀹朵腑"锛岃嚜鍔ㄨ缃瀹や负"鍏跺畠"
+ if (hospitalData.name === '瀹朵腑') {
+ this.taskForm.hospitalOut.department = '鍏跺畠'
+ this.taskForm.hospitalOut.departmentId = null
+ }
+
// 濡傛灉杞叆鍦板潃宸插~鍐�,鑷姩璁$畻璺濈
if (this.taskForm.hospitalIn.address) {
// 濡傛灉涓や釜閮戒笉鏄�"瀹朵腑",浣跨敤鍖婚櫌璺濈璁$畻
@@ -576,6 +597,12 @@
console.log('杞叆鍖婚櫌鍙樺寲:', hospitalData)
// 缁勪欢宸茬粡閫氳繃 v-model 鏇存柊浜� taskForm.hospitalIn
+ // 濡傛灉閫夋嫨鐨勬槸"瀹朵腑"锛岃嚜鍔ㄨ缃瀹や负"鍏跺畠"
+ if (hospitalData.name === '瀹朵腑') {
+ this.taskForm.hospitalIn.department = '鍏跺畠'
+ this.taskForm.hospitalIn.departmentId = null
+ }
+
// 濡傛灉杞嚭鍦板潃宸插~鍐�,鑷姩璁$畻璺濈
if (this.taskForm.hospitalOut.address) {
// 濡傛灉涓や釜閮戒笉鏄�"瀹朵腑",浣跨敤鍖婚櫌璺濈璁$畻
@@ -592,6 +619,28 @@
onHospitalInAddressSelected(data) {
if (this.taskForm.hospitalOut.address) {
this.calculateDistanceByManualAddress()
+ }
+ },
+
+ // 杞嚭绉戝鍙樺寲
+ onHospitalOutDepartmentChange(data) {
+ if (data && typeof data === 'object') {
+ this.taskForm.hospitalOut.department = data.department
+ this.taskForm.hospitalOut.departmentId = data.departmentId
+ } else {
+ this.taskForm.hospitalOut.department = data
+ this.taskForm.hospitalOut.departmentId = null
+ }
+ },
+
+ // 杞叆绉戝鍙樺寲
+ onHospitalInDepartmentChange(data) {
+ if (data && typeof data === 'object') {
+ this.taskForm.hospitalIn.department = data.department
+ this.taskForm.hospitalIn.departmentId = data.departmentId
+ } else {
+ this.taskForm.hospitalIn.department = data
+ this.taskForm.hospitalIn.departmentId = null
}
},
@@ -1002,20 +1051,14 @@
if (result.phone) this.taskForm.patient.phone = result.phone
if (result.price) this.taskForm.price = result.price
- // 搴旂敤绉戝淇℃伅锛堝尮閰� departmentOptions 涓殑鏁版嵁锛�
+ // 搴旂敤绉戝淇℃伅锛堥�氳繃 DepartmentSelector 缁勪欢澶勭悊锛�
if (result.departmentOut) {
- const deptOut = this.matchDepartment(result.departmentOut)
- if (deptOut) {
- this.taskForm.hospitalOut.department = deptOut.text
- this.taskForm.hospitalOut.departmentId = deptOut.id
- }
+ this.taskForm.hospitalOut.department = result.departmentOut
+ // 绉戝ID浼氬湪 DepartmentSelector 缁勪欢涓嚜鍔ㄥ尮閰�
}
if (result.departmentIn) {
- const deptIn = this.matchDepartment(result.departmentIn)
- if (deptIn) {
- this.taskForm.hospitalIn.department = deptIn.text
- this.taskForm.hospitalIn.departmentId = deptIn.id
- }
+ this.taskForm.hospitalIn.department = result.departmentIn
+ // 绉戝ID浼氬湪 DepartmentSelector 缁勪欢涓嚜鍔ㄥ尮閰�
}
// 澶勭悊鍖婚櫌鍚嶇О 鈫� 绮剧‘鍖归厤鍖婚櫌骞惰ˉ鍏ㄥ湴鍧�涓嶪D锛堜笉闄愬埗鍒嗗叕鍙稿尯鍩燂級
@@ -1161,40 +1204,6 @@
return ''
},
- // 鍖归厤绉戝锛堜紭鍏堜娇鐢� departmentOptions 涓殑鏁版嵁锛�
- matchDepartment(deptName) {
- if (!deptName || !this.departmentOptions || this.departmentOptions.length === 0) {
- return null
- }
-
- const normalized = deptName.trim().toUpperCase()
-
- // 1. 绮剧‘鍖归厤锛堜笉鍖哄垎澶у皬鍐欙級
- let matched = this.departmentOptions.find(d =>
- d.text.toUpperCase() === normalized
- )
- if (matched) return matched
-
- // 2. 鍖呭惈鍖归厤锛堢瀹ゅ悕鍖呭惈璇嗗埆鍒扮殑鍏抽敭璇嶏級
- matched = this.departmentOptions.find(d =>
- d.text.toUpperCase().includes(normalized) ||
- normalized.includes(d.text.toUpperCase())
- )
- if (matched) return matched
-
- // 3. 妯$硦鍖归厤锛堝幓闄�"绉�"銆�"瀹�"绛夊悗缂�鍐嶅尮閰嶏級
- const cleanedInput = normalized.replace(/[绉戝閮╙/g, '')
- matched = this.departmentOptions.find(d => {
- const cleanedDept = d.text.toUpperCase().replace(/[绉戝閮╙/g, '')
- return cleanedDept === cleanedInput ||
- cleanedDept.includes(cleanedInput) ||
- cleanedInput.includes(cleanedDept)
- })
- if (matched) return matched
-
- return null
- },
-
// 鎻愬彇绉戝淇℃伅
extractDepartment(text, type) {
// 甯歌绉戝鍏抽敭璇嶏紙浣滀负鍏滃簳鏂规锛�
@@ -1210,24 +1219,7 @@
'妫�楠岀', '鐥呯悊绉�', '鑽墏绉�', '钀ュ吇绉�'
]
- // 浼樺厛灏濊瘯浠� departmentOptions 涓尮閰�
- if (this.departmentOptions && this.departmentOptions.length > 0) {
- // 鏋勫缓 departmentOptions 鐨勫尮閰嶆ā寮忥紙鎸夐暱搴﹀�掑簭锛�
- const optionTexts = this.departmentOptions.map(d => d.text).sort((a, b) => b.length - a.length)
- const optionPattern = optionTexts.map(t => t.replace(/[()锛堬級]/g, '\\$&')).join('|')
-
- if (optionPattern) {
- const regex = new RegExp(`(${optionPattern})`, 'gi')
- const matches = text.match(regex)
-
- if (matches && matches.length > 0) {
- // 濡傛灉鏄浆鍑猴紝鍙栫涓�涓瀹わ紱濡傛灉鏄浆鍏ワ紝鍙栨渶鍚庝竴涓瀹�
- return type === 'out' ? matches[0] : matches[matches.length - 1]
- }
- }
- }
-
- // 鍏滃簳锛氫娇鐢ㄩ粯璁ょ瀹ゅ垪琛ㄥ尮閰�
+ // 浣跨敤榛樿绉戝鍒楄〃鍖归厤
const sortedDepts = departments.sort((a, b) => b.length - a.length)
const deptPattern = sortedDepts.join('|')
--
Gitblit v1.9.1