fix: 修改大屏不能显示bug、修改大屏字体、替换系统logo
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
This commit is contained in:
@@ -42,7 +42,11 @@ const selectedRoom = ref<string>('');
|
||||
const selectedDate = ref<string>('');
|
||||
|
||||
// 一周的日期
|
||||
const weekDates = ref<string[]>([]);
|
||||
interface WeekDate {
|
||||
date: string;
|
||||
weekDay: string;
|
||||
}
|
||||
const weekDates = ref<WeekDate[]>([]);
|
||||
|
||||
// 预约数据
|
||||
const bookings = ref<any[]>([]);
|
||||
@@ -54,16 +58,23 @@ const loading = ref(false);
|
||||
// 时间段只显示"上午" "下午"
|
||||
const timeSlots = ['上午', '下午'];
|
||||
|
||||
function getWeekDay(dateStr: string): string {
|
||||
const weekMap = ['周日', '周一', '周二', '周三', '周四', '周五', '周六'];
|
||||
const day = dayjs(dateStr).day();
|
||||
return weekMap[dayjs(dateStr).day()]!;
|
||||
}
|
||||
// 生成一周日期
|
||||
function generateWeekDates(): void {
|
||||
const today = dayjs();
|
||||
// 获取本周的周一
|
||||
const startOfWeek = today.startOf('week');
|
||||
const dates = Array.from({ length: 7 }, (_, i) => {
|
||||
return startOfWeek.add(i, 'day').format('YYYY-MM-DD');
|
||||
const dates: WeekDate[] = Array.from({ length: 7 }, (_, i) => {
|
||||
const date = startOfWeek.add(i, 'day').format('YYYY-MM-DD');
|
||||
return {
|
||||
date,
|
||||
weekDay: getWeekDay(date)
|
||||
};
|
||||
});
|
||||
weekDates.value = dates;
|
||||
// 默认选中今天
|
||||
selectedDate.value = today.format('YYYY-MM-DD');
|
||||
}
|
||||
|
||||
@@ -107,7 +118,7 @@ async function fetchBookings(): Promise<void> {
|
||||
const booking = bookings.value.find(
|
||||
(b) => b.name === room.name && b.slots === slot,
|
||||
);
|
||||
table[slot][room.name] = booking || null;
|
||||
table[slot]![room.name] = booking || null;
|
||||
});
|
||||
});
|
||||
bookingTable.value = table;
|
||||
@@ -135,14 +146,14 @@ async function fetchBookings(): Promise<void> {
|
||||
tbConferenceId: item.meetId,
|
||||
}));
|
||||
const table: Record<string, Record<string, any>> = { 上午: {}, 下午: {} };
|
||||
weekDates.value.forEach((date) => {
|
||||
weekDates.value.forEach((item) => {
|
||||
['上午', '下午'].forEach((slot) => {
|
||||
const booking = bookings.value.find(
|
||||
(b) =>
|
||||
dayjs(b.scheduledStarttime).format('YYYY-MM-DD') === date &&
|
||||
dayjs(b.scheduledStarttime).format('YYYY-MM-DD') === item.date &&
|
||||
b.slots === slot,
|
||||
);
|
||||
table[slot][date] = booking || null;
|
||||
table[slot]![item.date] = booking || null;
|
||||
});
|
||||
});
|
||||
bookingTable.value = table;
|
||||
@@ -271,10 +282,10 @@ const columns = computed<TableColumnType<TableRecord>[]>(() => {
|
||||
key: room.name,
|
||||
width: 200,
|
||||
}))
|
||||
: weekDates.value.map((date) => ({
|
||||
title: dayjs(date).format('YYYY-MM-DD'),
|
||||
dataIndex: date,
|
||||
key: date,
|
||||
: weekDates.value.map((item) => ({
|
||||
title: item.date,
|
||||
dataIndex: item.date,
|
||||
key: item.date,
|
||||
width: 200,
|
||||
}));
|
||||
return [...baseColumns, ...dynamicColumns];
|
||||
@@ -284,10 +295,12 @@ const tableData = computed<TableRecord[]>(() => {
|
||||
const slots = ['上午', '下午'];
|
||||
return slots.map((slot) => {
|
||||
const row: any = { slot };
|
||||
const cols =
|
||||
viewMode.value === 'date'
|
||||
? getFullRoomList().map((room) => room.name)
|
||||
: weekDates.value;
|
||||
let cols: string[] = [];
|
||||
if (viewMode.value === 'date') {
|
||||
cols = getFullRoomList().map((room) => room.name);
|
||||
} else {
|
||||
cols = weekDates.value.map(item => item.date);
|
||||
}
|
||||
cols.forEach((col) => {
|
||||
row[col] = bookingTable.value[slot]?.[col] || null;
|
||||
});
|
||||
@@ -328,12 +341,12 @@ onMounted(() => {
|
||||
</div>
|
||||
<div v-if="viewMode === 'date'" class="date-buttons">
|
||||
<Button
|
||||
v-for="date in weekDates"
|
||||
:key="date"
|
||||
:type="date === selectedDate ? 'primary' : 'default'"
|
||||
@click="handleDateChange(date)"
|
||||
v-for="item in weekDates"
|
||||
:key="item.date"
|
||||
:type="item.date === selectedDate ? 'primary' : 'default'"
|
||||
@click="handleDateChange(item.date)"
|
||||
>
|
||||
{{ dayjs(date).format('YYYY-MM-DD') }}
|
||||
{{ item.date }} ({{ item.weekDay }})
|
||||
</Button>
|
||||
</div>
|
||||
<Table
|
||||
@@ -347,7 +360,7 @@ onMounted(() => {
|
||||
>
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.dataIndex !== 'slot'">
|
||||
<div v-if="record[column.dataIndex]" :style="getRandomBgColor()">
|
||||
<div v-if="typeof column.dataIndex === 'string' && record[column.dataIndex]" :style="getRandomBgColor()">
|
||||
<div>预约人:{{ record[column.dataIndex].personName }}</div>
|
||||
<div>单位:{{ record[column.dataIndex].unitName }}</div>
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user