From 3cd8628d8f9cb5918e04c755d305216865790287 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期一, 08 六月 2026 17:53:04 +0800
Subject: [PATCH] 新疆大罗素 1.会议列表展示不出来 2.会议申请时间选不了 2.会议审批参会人数一直是0人
---
src/views/collaborativeApproval/notificationManagement/meetApplication/index.vue | 186 +++-------------------------------------------
1 files changed, 13 insertions(+), 173 deletions(-)
diff --git a/src/views/collaborativeApproval/notificationManagement/meetApplication/index.vue b/src/views/collaborativeApproval/notificationManagement/meetApplication/index.vue
index 873e62a..f36004f 100644
--- a/src/views/collaborativeApproval/notificationManagement/meetApplication/index.vue
+++ b/src/views/collaborativeApproval/notificationManagement/meetApplication/index.vue
@@ -84,34 +84,24 @@
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="寮�濮嬫椂闂�" prop="startTime">
- <el-select
+ <el-time-picker
v-model="meetingForm.startTime"
placeholder="璇烽�夋嫨寮�濮嬫椂闂�"
+ value-format="HH:mm"
+ format="HH:mm"
style="width: 100%"
- >
- <el-option
- v-for="time in startTimeOptions"
- :key="time.value"
- :label="time.label"
- :value="time.value"
- />
- </el-select>
+ />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="缁撴潫鏃堕棿" prop="endTime">
- <el-select
+ <el-time-picker
v-model="meetingForm.endTime"
placeholder="璇烽�夋嫨缁撴潫鏃堕棿"
+ value-format="HH:mm"
+ format="HH:mm"
style="width: 100%"
- >
- <el-option
- v-for="time in endTimeOptions"
- :key="time.value"
- :label="time.label"
- :value="time.value"
- />
- </el-select>
+ />
</el-form-item>
</el-col>
</el-row>
@@ -152,9 +142,9 @@
</template>
<script setup>
-import {ref, reactive, onMounted, computed, watch} from 'vue'
+import {ref, reactive, onActivated} from 'vue'
import {ElMessage} from 'element-plus'
-import {Plus, Document, Promotion, Bell} from '@element-plus/icons-vue'
+import {Document, Promotion, Bell} from '@element-plus/icons-vue'
import {getRoomEnum, saveMeetingApplication} from '@/api/collaborativeApproval/meeting.js'
import {userListNoPageByTenantId} from "@/api/system/user.js";
@@ -205,152 +195,16 @@
// 鍛樺伐鍒楄〃
const employees = ref([])
-// 鏃堕棿閫夐」锛堜互鍗婂皬鏃朵负闂撮殧锛�
-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'}
- ],
+ startTime: [{required: true, message: '璇烽�夋嫨寮�濮嬫椂闂�', trigger: 'change'}],
+ endTime: [{required: true, message: '璇烽�夋嫨缁撴潫鏃堕棿', 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`,
- label: `${hour.toString().padStart(2, '0')}:00`
- })
-
- if (hour < 18) { // 18:00涔嬪悗娌℃湁鍗婄偣閫夐」
- options.push({
- value: `${hour.toString().padStart(2, '0')}:30`,
- label: `${hour.toString().padStart(2, '0')}:30`
- })
- }
- }
- 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) => {
@@ -389,19 +243,6 @@
// 妯℃嫙鎻愪氦鎿嶄綔
ElMessage.success(`${getCurrentTypeName()}鎻愪氦鎴愬姛`)
-
- // 鏍规嵁涓嶅悓绫诲瀷鎵ц涓嶅悓鎿嶄綔
- switch (currentType.value) {
- case 'approval':
- ElMessage.info('浼氳宸叉彁浜ゅ鎵规祦绋�')
- break
- case 'department':
- ElMessage.info('閮ㄩ棬绾т細璁敵璇峰凡鎻愪氦')
- break
- case 'notification':
- ElMessage.info('浼氳閫氱煡宸插彂甯�')
- break
- }
resetForm()
})
@@ -410,8 +251,7 @@
}
// 椤甸潰鍔犺浇鏃跺垵濮嬪寲
-onMounted(() => {
- initTimeOptions()
+onActivated(() => {
getRoomEnum().then(res => {
meetingRooms.value = res.data
})
--
Gitblit v1.9.3