Merge remote-tracking branch 'origin/master'
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run

This commit is contained in:
dev_ljl 2025-07-23 20:57:47 +08:00
commit 3749f4bbb9
7 changed files with 160 additions and 136 deletions

View File

@ -1,4 +1,9 @@
import type { RoomBookingVO, RoomBookingForm, RoomBookingQuery,GetMeetNameVO } from './model';
import type {
RoomBookingVO,
RoomBookingForm,
RoomBookingQuery,
GetMeetNameVO,
} from './model';
import type { ID, IDS } from '#/api/common';
import type { PageResult } from '#/api/common';
@ -12,7 +17,9 @@ import { requestClient } from '#/api/request';
* @returns
*/
export function getMeetName() {
return requestClient.get<PageResult<GetMeetNameVO>>(`/property/enum-fetcher/enum-values/${'getMeetName'}`);
return requestClient.get<GetMeetNameVO[]>(
`/property/enum-fetcher/enum-values/${'getMeetName'}`,
);
}
/**
@ -21,7 +28,10 @@ export function getMeetName() {
* @returns
*/
export function roomBookingList(params?: RoomBookingQuery) {
return requestClient.get<PageResult<RoomBookingVO>>('/property/roomBooking/list', { params });
return requestClient.get<PageResult<RoomBookingVO>>(
'/property/roomBooking/list',
{ params },
);
}
/**
@ -73,6 +83,11 @@ export function roomBookingRemove(id: ID | IDS) {
* @param params
* @returns
*/
export function meetbookingAppointmentList(params?: MeetbookingAppointmentQuery) {
return requestClient.get<PageResult<MeetbookingVO>>('/property/meetbooking/appointment-list', { params });
export function meetbookingAppointmentList(
params?: MeetbookingAppointmentQuery,
) {
return requestClient.get<PageResult<MeetbookingVO>>(
'/property/meetbooking/appointment-list',
{ params },
);
}

View File

@ -160,15 +160,6 @@ function handleRefund(row:any) {
>
{{ $t('pages.common.export') }}
</a-button>
<a-button
:disabled="!vxeCheckboxChecked(tableApi)"
danger
type="primary"
v-access:code="['property:clean:remove']"
@click="handleMultiDelete"
>
{{ $t('pages.common.delete') }}
</a-button>
<a-button
type="primary"
v-access:code="['property:clean:add']"
@ -187,11 +178,20 @@ function handleRefund(row:any) {
<Space>
<ghost-button @click.stop="handleView(row)"> 查看 </ghost-button>
<template v-if="row.state === 0">
<ghost-button type="primary" @click.stop="handleAudit(row)">审核</ghost-button>
<ghost-button type="primary" @click.stop="handleAudit(row)"
>审核</ghost-button
>
</template>
<template v-else>
<ghost-button danger @click.stop="handleRefund(row)" v-if="row.isUnbooking === 0">退定</ghost-button>
<ghost-button disabled v-else>已退定</ghost-button>
<ghost-button
danger
@click.stop="handleRefund(row)"
v-if="row.isUnbooking === 0"
>退定</ghost-button
>
<ghost-button disabled v-else-if="row.isUnbooking === 1"
>已退定</ghost-button
>
</template>
</Space>
</template>

View File

@ -42,7 +42,7 @@ export const columns: VxeGridProps['columns'] = [
{
title: '劳务名称',
field: 'name',
width: '120',
minWidth: '120',
},
{
title: '计量单位',
@ -95,6 +95,7 @@ export const columns: VxeGridProps['columns'] = [
fixed: 'right',
slots: { default: 'action' },
title: '操作',
width: '230',
},
];

View File

@ -12,7 +12,7 @@ import dayjs from 'dayjs';
import {
useVbenVxeGrid,
vxeCheckboxChecked,
type VxeGridProps
type VxeGridProps,
} from '#/adapter/vxe-table';
import {
@ -76,7 +76,7 @@ const gridOptions: VxeGridProps = {
keyField: 'id',
},
//
id: 'property-inspectionTask-index'
id: 'property-inspectionTask-index',
};
const [BasicTable, tableApi] = useVbenVxeGrid({
@ -118,9 +118,14 @@ function handleMultiDelete() {
}
function handleDownloadExcel() {
commonDownloadExcel(inspectionTaskExport, '巡检任务数据', tableApi.formApi.form.values, {
commonDownloadExcel(
inspectionTaskExport,
'巡检任务数据',
tableApi.formApi.form.values,
{
fieldMappingTime: formOptions.fieldMappingTime,
});
},
);
}
</script>
@ -140,16 +145,9 @@ function handleDownloadExcel() {
danger
type="primary"
v-access:code="['property:inspectionTask:remove']"
@click="handleMultiDelete">
{{ $t('pages.common.delete') }}
</a-button>
<a-button
:disabled="true"
type="primary"
v-access:code="['property:inspectionTask:add']"
@click="handleAdd"
@click="handleMultiDelete"
>
{{ $t('pages.common.add') }}
{{ $t('pages.common.delete') }}
</a-button>
</Space>
</template>

View File

@ -24,7 +24,7 @@ const [BasicForm, formApi] = useVbenForm({
//
componentProps: {
class: 'w-full',
}
},
},
schema: modalSchema(),
showDefaultActions: false,
@ -53,10 +53,13 @@ const [BasicModal, modalApi] = useVbenModal({
const { id } = modalApi.getData() as { id?: number | string };
isUpdate.value = !!id;
setupCommunitySelect()
setupCommunitySelect();
if (isUpdate.value && id) {
const record = await roomInfo(id);
await formApi.setValues(record);
await formApi.setValues({
...record,
isForSale: String(record.isForSale),
});
}
await markInitialized();
@ -84,7 +87,6 @@ async function handleConfirm() {
}
}
/**
* 初始化城市
*/
@ -134,4 +136,3 @@ async function handleClosed() {
<BasicForm />
</BasicModal>
</template>

View File

@ -5,7 +5,10 @@ import dayjs from 'dayjs';
import type { TableColumnType } from 'ant-design-vue';
import { Radio, Select, Button, Table } from 'ant-design-vue';
import { getMeetName } from '#/api/property/roomBooking';
import { getAppointmentListByDate,getAppointmentListBymeetId } from '#/api/property/roomBooking/conferenceView';
import {
getAppointmentListByDate,
getAppointmentListBymeetId,
} from '#/api/property/roomBooking/conferenceView';
import type { RadioChangeEvent } from 'ant-design-vue';
import type { SelectValue } from 'ant-design-vue/es/select';
@ -70,12 +73,12 @@ async function fetchBookings(): Promise<void> {
try {
if (viewMode.value === 'date') {
const roomRes = await getMeetName();
roomList.value = ([roomRes]).map((item: any) => ({
roomList.value = roomRes.map((item: any) => ({
id: item.value,
name: item.name
name: item.name,
}));
const appointmentRes = await getAppointmentListByDate({
appointmentDate: selectedDate.value
appointmentDate: selectedDate.value,
});
bookings.value = (appointmentRes || []).map((item: any) => ({
id: item.id,
@ -98,17 +101,19 @@ async function fetchBookings(): Promise<void> {
//
}));
//
const table: Record<string, Record<string, any>> = { '上午': {}, '下午': {} };
roomList.value.forEach(room => {
['上午', '下午'].forEach(slot => {
const booking = bookings.value.find(b => b.name === room.name && b.slots === slot);
const table: Record<string, Record<string, any>> = { 上午: {}, 下午: {} };
roomList.value.forEach((room) => {
['上午', '下午'].forEach((slot) => {
const booking = bookings.value.find(
(b) => b.name === room.name && b.slots === slot,
);
table[slot][room.name] = booking || null;
});
});
bookingTable.value = table;
} else {
const res = await getAppointmentListBymeetId({
meetId: selectedRoom.value
meetId: selectedRoom.value,
});
bookings.value = (res || []).map((item: any) => ({
id: item.id,
@ -129,16 +134,19 @@ async function fetchBookings(): Promise<void> {
bookingDate: item.scheduledStarttime,
tbConferenceId: item.meetId,
}));
const table: Record<string, Record<string, any>> = { '上午': {}, '下午': {} };
weekDates.value.forEach(date => {
['上午', '下午'].forEach(slot => {
const booking = bookings.value.find(b => dayjs(b.scheduledStarttime).format('YYYY-MM-DD') === date && b.slots === slot);
const table: Record<string, Record<string, any>> = { 上午: {}, 下午: {} };
weekDates.value.forEach((date) => {
['上午', '下午'].forEach((slot) => {
const booking = bookings.value.find(
(b) =>
dayjs(b.scheduledStarttime).format('YYYY-MM-DD') === date &&
b.slots === slot,
);
table[slot][date] = booking || null;
});
});
bookingTable.value = table;
}
} catch (error) {
console.error('获取预约数据失败:', error);
} finally {
@ -171,46 +179,45 @@ function handleRoomChange(value: SelectValue): void {
}
// /
function getCellBooking(col: string, time: string): ConferenceBooking | undefined {
function getCellBooking(
col: string,
time: string,
): ConferenceBooking | undefined {
//
function isMorning(startTime: string) {
const hour = dayjs(startTime).hour();
return hour < 12;
}
if (viewMode.value === 'date') {
const room = roomList.value.find(r => r.name === col);
return bookings.value.find(b =>
const room = roomList.value.find((r) => r.name === col);
return bookings.value.find(
(b) =>
b.tbConferenceId === room?.id &&
((time === '上午' && isMorning(b.startTime)) || (time === '下午' && !isMorning(b.startTime)))
((time === '上午' && isMorning(b.startTime)) ||
(time === '下午' && !isMorning(b.startTime))),
);
} else {
return bookings.value.find(b =>
return bookings.value.find(
(b) =>
dayjs(b.bookingDate).format('YYYY-MM-DD') === col &&
((time === '上午' && isMorning(b.startTime)) || (time === '下午' && !isMorning(b.startTime)))
((time === '上午' && isMorning(b.startTime)) ||
(time === '下午' && !isMorning(b.startTime))),
);
}
}
//
function renderBookingCell(booking: ConferenceBooking) {
return h('div',
return h(
'div',
{
class: 'booking-cell'
class: 'booking-cell',
},
[
h('span',
{ class: 'booking-user' },
`预约人:${booking.bookingName}`
),
h('span',
{ class: 'booking-dept' },
`单位:${booking.deptName}`
),
h('span',
{ class: 'booking-subject' },
`主题:${booking.subject}`
)
]
h('span', { class: 'booking-user' }, `预约人:${booking.bookingName}`),
h('span', { class: 'booking-dept' }, `单位:${booking.deptName}`),
h('span', { class: 'booking-subject' }, `主题:${booking.subject}`),
],
);
}
@ -223,7 +230,7 @@ function getRandomBgColor() {
background: `rgba(${r},${g},${b},0.5)`,
borderRadius: '6px',
padding: '60px 10px',
transition: 'background 0.3s'
transition: 'background 0.3s',
};
}
@ -247,21 +254,24 @@ function getFullRoomList() {
}
const columns = computed<TableColumnType<TableRecord>[]>(() => {
const baseColumns: TableColumnType<TableRecord>[] = [{
const baseColumns: TableColumnType<TableRecord>[] = [
{
title: '时间',
dataIndex: 'slot',
key: 'slot',
width: 100,
fixed: 'left' as const
}];
const dynamicColumns: TableColumnType<TableRecord>[] = viewMode.value === 'date'
? getFullRoomList().map(room => ({
fixed: 'left' as const,
},
];
const dynamicColumns: TableColumnType<TableRecord>[] =
viewMode.value === 'date'
? getFullRoomList().map((room) => ({
title: room.name || ' ',
dataIndex: room.name,
key: room.name,
width: 200,
}))
: weekDates.value.map(date => ({
: weekDates.value.map((date) => ({
title: dayjs(date).format('YYYY-MM-DD'),
dataIndex: date,
key: date,
@ -272,12 +282,13 @@ const columns = computed<TableColumnType<TableRecord>[]>(() => {
const tableData = computed<TableRecord[]>(() => {
const slots = ['上午', '下午'];
return slots.map(slot => {
return slots.map((slot) => {
const row: any = { slot };
const cols = viewMode.value === 'date'
? getFullRoomList().map(room => room.name)
const cols =
viewMode.value === 'date'
? getFullRoomList().map((room) => room.name)
: weekDates.value;
cols.forEach(col => {
cols.forEach((col) => {
row[col] = bookingTable.value[slot]?.[col] || null;
});
return row;
@ -336,10 +347,7 @@ onMounted(() => {
>
<template #bodyCell="{ column, record }">
<template v-if="column.dataIndex !== 'slot'">
<div
v-if="record[column.dataIndex]"
:style="getRandomBgColor()"
>
<div v-if="record[column.dataIndex]" :style="getRandomBgColor()">
<div>预约人{{ record[column.dataIndex].personName }}</div>
<div>单位{{ record[column.dataIndex].unitName }}</div>
</div>

View File

@ -3,9 +3,10 @@ import type { VxeGridProps } from '#/adapter/vxe-table';
export const querySchema: FormSchemaGetter = () => [
{
component: 'TreeSelect',
component: 'Input',
fieldName: 'unitName',
label: '单元名称',
labelWidth: 100,
},
];