From e2317a1bcab0134f0c1b1aec99eb4d78dfddf1b8 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期四, 05 三月 2026 17:41:03 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev_New' into dev_New
---
src/views/collaborativeApproval/notificationManagement/meetApplication/index.vue | 153 +++++++++++++++++++++++++++++++++++++++++++++------
1 files changed, 135 insertions(+), 18 deletions(-)
diff --git a/src/views/collaborativeApproval/notificationManagement/meetApplication/index.vue b/src/views/collaborativeApproval/notificationManagement/meetApplication/index.vue
index 7781593..b2fb88d 100644
--- a/src/views/collaborativeApproval/notificationManagement/meetApplication/index.vue
+++ b/src/views/collaborativeApproval/notificationManagement/meetApplication/index.vue
@@ -90,7 +90,7 @@
style="width: 100%"
>
<el-option
- v-for="time in timeOptions"
+ v-for="time in startTimeOptions"
:key="time.value"
:label="time.label"
:value="time.value"
@@ -106,7 +106,7 @@
style="width: 100%"
>
<el-option
- v-for="time in timeOptions"
+ v-for="time in endTimeOptions"
:key="time.value"
:label="time.label"
:value="time.value"
@@ -127,7 +127,7 @@
<el-option
v-for="person in employees"
:key="person.id"
- :label="`${person.staffName} (${person.postJob})`"
+ :label="`${person.staffName}${person.postName ? ` (${person.postName})` : ''}`"
:value="person.id"
/>
</el-select>
@@ -152,11 +152,11 @@
</template>
<script setup>
-import {ref, reactive, onMounted} from 'vue'
+import {ref, reactive, onMounted, computed, watch} from 'vue'
import {ElMessage} from 'element-plus'
import {Plus, Document, Promotion, Bell} from '@element-plus/icons-vue'
import {getRoomEnum, saveMeetingApplication} from '@/api/collaborativeApproval/meeting.js'
-import {getStaffOnJob} from "@/api/personnelManagement/onboarding.js";
+import {staffOnJobListPage} from "@/api/personnelManagement/staffOnJob.js";
// 褰撳墠鐢宠绫诲瀷
const currentType = ref('department') // approval: 瀹℃壒娴佺▼, department: 閮ㄩ棬绾�, notification: 閫氱煡鍙戝竷
@@ -196,17 +196,6 @@
description: ''
})
-// 琛ㄥ崟鏍¢獙瑙勫垯
-const rules = {
- title: [{required: true, message: '璇疯緭鍏ヤ細璁富棰�', trigger: 'blur'}],
- roomId: [{required: true, message: '璇烽�夋嫨浼氳瀹�', trigger: 'change'}],
- host: [{required: true, message: '璇疯緭鍏ヤ富鎸佷汉', trigger: 'blur'}],
- meetingDate: [{required: true, message: '璇烽�夋嫨浼氳鏃ユ湡', trigger: 'change'}],
- startTime: [{required: true, message: '璇烽�夋嫨寮�濮嬫椂闂�', trigger: 'change'}],
- endTime: [{required: true, message: '璇烽�夋嫨缁撴潫鏃堕棿', trigger: 'change'}],
- participants: [{required: true, message: '璇烽�夋嫨鍙備細浜哄憳', trigger: 'change'}]
-}
-
// 琛ㄥ崟寮曠敤
const meetingFormRef = ref(null)
@@ -219,10 +208,108 @@
// 鏃堕棿閫夐」锛堜互鍗婂皬鏃朵负闂撮殧锛�
const timeOptions = ref([])
+const getTimeInMinutes = (time) => {
+ if (!time) return -1
+ const [hour, minute] = time.split(':').map(Number)
+ return hour * 60 + minute
+}
+
+const isToday = (dateText) => {
+ if (!dateText) return false
+ const [year, month, day] = dateText.split('-').map(Number)
+ const now = new Date()
+ return year === now.getFullYear() && month === now.getMonth() + 1 && day === now.getDate()
+}
+
+const validateStartTime = (_rule, value, callback) => {
+ if (!value) {
+ callback()
+ return
+ }
+
+ if (isToday(meetingForm.meetingDate)) {
+ const now = new Date()
+ const currentMinutes = now.getHours() * 60 + now.getMinutes()
+ if (getTimeInMinutes(value) > currentMinutes) {
+ callback(new Error('褰撳ぉ寮�濮嬫椂闂翠笉鑳芥櫄浜庡綋鍓嶆椂闂�'))
+ return
+ }
+ }
+
+ callback()
+}
+
+const validateEndTime = (_rule, value, callback) => {
+ if (!value || !meetingForm.startTime) {
+ callback()
+ return
+ }
+
+ if (getTimeInMinutes(value) <= getTimeInMinutes(meetingForm.startTime)) {
+ callback(new Error('缁撴潫鏃堕棿蹇呴』澶т簬寮�濮嬫椂闂�'))
+ return
+ }
+
+ callback()
+}
+
+// 琛ㄥ崟鏍¢獙瑙勫垯
+const rules = {
+ title: [{required: true, message: '璇疯緭鍏ヤ細璁富棰�', trigger: 'blur'}],
+ roomId: [{required: true, message: '璇烽�夋嫨浼氳瀹�', trigger: 'change'}],
+ host: [{required: true, message: '璇疯緭鍏ヤ富鎸佷汉', trigger: 'blur'}],
+ meetingDate: [{required: true, message: '璇烽�夋嫨浼氳鏃ユ湡', trigger: 'change'}],
+ startTime: [
+ {required: true, message: '璇烽�夋嫨寮�濮嬫椂闂�', trigger: 'change'},
+ {validator: validateStartTime, trigger: 'change'}
+ ],
+ endTime: [
+ {required: true, message: '璇烽�夋嫨缁撴潫鏃堕棿', trigger: 'change'},
+ {validator: validateEndTime, trigger: 'change'}
+ ],
+ participants: [{required: true, message: '璇烽�夋嫨鍙備細浜哄憳', trigger: 'change'}]
+}
+
+const startTimeOptions = computed(() => {
+ if (!isToday(meetingForm.meetingDate)) {
+ return timeOptions.value
+ }
+ const now = new Date()
+ const currentMinutes = now.getHours() * 60 + now.getMinutes()
+ return timeOptions.value.filter(item => getTimeInMinutes(item.value) <= currentMinutes)
+})
+
+const endTimeOptions = computed(() => {
+ if (!meetingForm.startTime) {
+ return timeOptions.value
+ }
+ const startMinutes = getTimeInMinutes(meetingForm.startTime)
+ return timeOptions.value.filter(item => getTimeInMinutes(item.value) > startMinutes)
+})
+
// 鍒濆鍖栨椂闂撮�夐」
const initTimeOptions = () => {
const options = []
+ const now = new Date()
+ const currentHour = now.getHours()
+ const currentMinute = now.getMinutes()
+ // meetingDate 鏄� "yyyy-MM-dd"
+ const meetingDate = new Date(meetingForm.meetingDate)
+
+ const isSameDay =
+ now.getFullYear() === meetingDate.getFullYear() &&
+ now.getMonth() === meetingDate.getMonth() &&
+ now.getDate() === meetingDate.getDate()
+
+ console.log('鏄惁鍚屼竴澶�:', isSameDay)
for (let hour = 8; hour <= 18; hour++) {
+ // 寮�濮嬫椂闂村繀椤绘櫄浜庡綋鍓嶆椂闂�
+ if (hour < currentHour && isSameDay) {
+ continue
+ }
+ if (hour === currentHour && currentMinute > 30 && isSameDay) {
+ continue
+ }
// 姣忎釜灏忔椂娣诲姞涓や釜閫夐」锛氭暣鐐瑰拰鍗婄偣
options.push({
value: `${hour.toString().padStart(2, '0')}:00`,
@@ -238,6 +325,32 @@
}
timeOptions.value = options
}
+
+watch(() => meetingForm.meetingDate, () => {
+ if (meetingForm.startTime && !startTimeOptions.value.some(item => item.value === meetingForm.startTime)) {
+ meetingForm.startTime = ''
+ }
+ if (meetingForm.endTime && !endTimeOptions.value.some(item => item.value === meetingForm.endTime)) {
+ meetingForm.endTime = ''
+ }
+ if (meetingForm.startTime) {
+ meetingFormRef.value?.validateField('startTime')
+ }
+ if (meetingForm.endTime) {
+ meetingFormRef.value?.validateField('endTime')
+ }
+ initTimeOptions()
+})
+
+watch(() => meetingForm.startTime, () => {
+ if (meetingForm.endTime && getTimeInMinutes(meetingForm.endTime) <= getTimeInMinutes(meetingForm.startTime)) {
+ meetingForm.endTime = ''
+ }
+ if (meetingForm.endTime) {
+ meetingFormRef.value?.validateField('endTime')
+ }
+
+})
// 绂佺敤鏃ユ湡锛堢鐢ㄤ粖澶╀箣鍓嶇殑鏃ユ湡锛�
const disabledDate = (time) => {
@@ -302,8 +415,12 @@
getRoomEnum().then(res => {
meetingRooms.value = res.data
})
- getStaffOnJob().then(res => {
- employees.value = res.data.sort((a, b) => a.postJob.localeCompare(b.postJob))
+ staffOnJobListPage({
+ current: -1,
+ size: -1,
+ staffState: 1
+ }).then(res => {
+ employees.value = res.data.records.sort((a, b) => (a.postName || '').localeCompare(b.postName || ''))
})
})
</script>
--
Gitblit v1.9.3