From 4fdde57a837b47b0a04aa17a7627c21b7425eda2 Mon Sep 17 00:00:00 2001
From: wlzboy <66905212@qq.com>
Date: 星期五, 26 十二月 2025 23:25:11 +0800
Subject: [PATCH] feat: 优化取消时,调度单中显示原因
---
app/pagesTask/create-emergency.vue | 66 +++++++++++++++++++++++++++------
1 files changed, 54 insertions(+), 12 deletions(-)
diff --git a/app/pagesTask/create-emergency.vue b/app/pagesTask/create-emergency.vue
index e2b1d05..d3db251 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',
@@ -908,7 +916,41 @@
if (!this.validateForm()) {
return
}
+ this.doSubmitTask();
+
+ },
+ checkTaskDp(){
+ // 鑾峰彇褰撳墠鏃ユ湡锛堟牸寮廦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