Merge branch 'master' of https://codeup.aliyun.com/bsdtec/biz-pc-cloud
This commit is contained in:
commit
a333b91947
3 files changed
+61
-33
No files matched your search
@@ -48,3 +48,11 @@ export function getMeetingRoomTimeSlots(roomId: string, date: string) {
|
||||
})
|
||||
}
|
||||
|
||||
// 获取会议室下拉列表
|
||||
export function getMeetingRoomList() {
|
||||
return request({
|
||||
url: '/integrated/meetingRoom/app/select',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
@@ -23,12 +23,6 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="审批状态" prop="meetingStatus">
|
||||
<el-input v-model="form.meetingStatus" placeholder="请输入审批状态"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<!-- <el-col :span="12" class="mb20">-->
|
||||
<!-- <el-form-item label="申请人id" prop="applicantId">-->
|
||||
<!-- <el-input v-model="form.applicantId" placeholder="请选择申请人"/>-->
|
||||
@@ -37,7 +31,7 @@
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="会议负责人" prop="assigneeId">
|
||||
<el-input v-model="form.assigneeId" placeholder="请输入会议负责人"/>
|
||||
<el-input v-model="form.assigneeName" placeholder="请输入会议负责人"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
@@ -139,7 +133,7 @@
|
||||
<script setup lang="ts" name="MeetingBookingDialog">
|
||||
import { useDict } from '/@/hooks/dict';
|
||||
import { useMessage } from "/@/hooks/message";
|
||||
import { getObj, addObj, putObj, getMeetingRoomTimeSlots } from '/@/api/integrated/meetingBooking'
|
||||
import { getObj, addObj, putObj, getMeetingRoomTimeSlots, getMeetingRoomList } from '/@/api/integrated/meetingBooking'
|
||||
import { rule } from '/@/utils/validate';
|
||||
import axios from 'axios'
|
||||
import { ref, onMounted, watch } from 'vue'
|
||||
@@ -169,7 +163,7 @@ const form = reactive({
|
||||
meetingStatus: '',
|
||||
deptId: '',
|
||||
applicantId: '',
|
||||
assigneeId: '',
|
||||
assigneeName: '',
|
||||
startTime: '',
|
||||
endTime: '',
|
||||
bookingDate:''
|
||||
@@ -185,17 +179,17 @@ const dataRules = ref({
|
||||
})
|
||||
|
||||
// 打开弹窗
|
||||
const openDialog = (id: string) => {
|
||||
const openDialog = async (id: string) => {
|
||||
visible.value = true;
|
||||
form.id = '';
|
||||
nextTick(async () => {
|
||||
dataFormRef.value?.resetFields();
|
||||
await fetchRoomList();
|
||||
if (id) {
|
||||
form.id = id;
|
||||
await getmeetingBookingData(id);
|
||||
}
|
||||
});
|
||||
if (id) {
|
||||
form.id = id;
|
||||
getmeetingBookingData(id);
|
||||
}
|
||||
};
|
||||
|
||||
// 提交
|
||||
@@ -217,15 +211,39 @@ const onSubmit = async () => {
|
||||
};
|
||||
|
||||
|
||||
// 初始化表单数据
|
||||
const getmeetingBookingData = (id: string) => {
|
||||
// 获取数据
|
||||
loading.value = true
|
||||
getObj(id).then((res: any) => {
|
||||
Object.assign(form, res.data)
|
||||
}).finally(() => {
|
||||
loading.value = false
|
||||
})
|
||||
// 初始化表单数据(编辑时自动回显时间段高亮和表单时间)
|
||||
const getmeetingBookingData = async (id: string) => {
|
||||
loading.value = true;
|
||||
try {
|
||||
const res = await getObj(id);
|
||||
Object.assign(form, res.data);
|
||||
|
||||
// 先设置tab日期和会议室
|
||||
if (form.bookingDate) {
|
||||
activeDate.value = form.bookingDate;
|
||||
}
|
||||
if (form.roomId && activeDate.value) {
|
||||
// 等待 activeDate 和 roomId 都设置好后再请求
|
||||
await fetchTimeSlots();
|
||||
// 设置已选时间段
|
||||
if (form.startTime && form.endTime) {
|
||||
// 找到所有在startTime~endTime范围内的slot
|
||||
const slotKeys: string[] = [];
|
||||
let inRange = false;
|
||||
for (const slot of timeSlots.value) {
|
||||
const key = slot.startTime + '-' + slot.endTime;
|
||||
if (slot.startTime === form.startTime) inRange = true;
|
||||
if (inRange) slotKeys.push(key);
|
||||
if (slot.endTime === form.endTime) break;
|
||||
}
|
||||
selectedSlots.value = slotKeys;
|
||||
} else {
|
||||
selectedSlots.value = [];
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
// 生成今天及往后6天tab
|
||||
@@ -248,10 +266,9 @@ const fetchTimeSlots = async () => {
|
||||
return;
|
||||
}
|
||||
const res = await getMeetingRoomTimeSlots(form.roomId, activeDate.value);
|
||||
console.log('fetchTimeSlots params:', form.roomId, activeDate.value, 'result:', res);
|
||||
// 强制转为普通数组,避免Proxy导致渲染异常
|
||||
const arr = Array.isArray(res.data?.data) ? [...res.data.data] : [];
|
||||
console.log('接口返回', res);
|
||||
console.log('最终渲染', arr);
|
||||
timeSlots.value = res.data;
|
||||
}
|
||||
|
||||
@@ -334,10 +351,8 @@ const isSelected = (slot: any) => {
|
||||
|
||||
// 假数据,实际应请求接口
|
||||
const fetchRoomList = async () => {
|
||||
roomList.value = [
|
||||
{ id: '1925061129836544002', name: '会议室A' },
|
||||
{ id: '2', name: '会议室B' }
|
||||
];
|
||||
const res = await getMeetingRoomList();
|
||||
roomList.value = Array.isArray(res.data) ? res.data : [];
|
||||
if (roomList.value.length && !form.roomId) {
|
||||
form.roomId = roomList.value[0].id;
|
||||
}
|
||||
|
||||
@@ -36,10 +36,15 @@
|
||||
<el-table-column type="selection" width="40" align="center" />
|
||||
<el-table-column type="index" label="#" width="40" />
|
||||
<el-table-column prop="title" label="会议主题" show-overflow-tooltip/>
|
||||
<el-table-column prop="roomId" label="会议室id" show-overflow-tooltip/>
|
||||
<el-table-column prop="roomName" label="会议室" show-overflow-tooltip/>
|
||||
<el-table-column prop="description" label="会议说明" show-overflow-tooltip/>
|
||||
<el-table-column prop="meetingStatus" label="审批状态" show-overflow-tooltip/>
|
||||
<el-table-column prop="applicantId" label="申请人" show-overflow-tooltip/>
|
||||
<!-- <el-table-column prop="meetingStatus" label="审批状态" show-overflow-tooltip/>-->
|
||||
<el-table-column prop="checkStatus" label="审批状态" show-overflow-tooltip>
|
||||
<template #default="scope">
|
||||
<dict-tag :options="check_status" :value="scope.row.checkStatus"></dict-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="createBy" label="申请人" show-overflow-tooltip/>
|
||||
<el-table-column prop="assigneeId" label="会议负责人" show-overflow-tooltip/>
|
||||
<el-table-column prop="bookingDate" label="开始时间" show-overflow-tooltip/>
|
||||
<el-table-column prop="startTime" label="开始时间" show-overflow-tooltip/>
|
||||
@@ -70,7 +75,7 @@ import { useDict } from '/@/hooks/dict';
|
||||
// 引入组件
|
||||
const FormDialog = defineAsyncComponent(() => import('./form.vue'));
|
||||
// 定义查询字典
|
||||
|
||||
const { check_status } = useDict("check_status")
|
||||
// 定义变量内容
|
||||
const formDialogRef = ref()
|
||||
// 搜索变量
|
||||
|
||||
Reference in new issue
Block a user