@ebiz/designer-components 0.1.1 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +29 -29
- package/dist/designer-components.css +1 -1
- package/dist/index.mjs +4781 -4773
- package/package.json +1 -1
- package/src/App.vue +26 -26
- package/src/apiService/SIMPLE_DATA_SERVICE.md +284 -284
- package/src/apiService/mockDataService.js +115 -115
- package/src/apiService/simpleDataService.js +297 -297
- package/src/assets/base.css +86 -86
- package/src/assets/logo.svg +1 -1
- package/src/components/Button.vue +149 -149
- package/src/components/DataContainer.vue +40 -40
- package/src/components/EbizApproval.vue +332 -332
- package/src/components/EbizAutoForm.vue +596 -596
- package/src/components/EbizAvatar.vue +115 -115
- package/src/components/EbizCheckbox.vue +93 -93
- package/src/components/EbizCheckboxGroup.vue +69 -69
- package/src/components/EbizDepartmentSelector.vue +144 -144
- package/src/components/EbizDescriptions.vue +340 -340
- package/src/components/EbizDescriptionsItem.vue +47 -47
- package/src/components/EbizDetailBlock.vue +81 -81
- package/src/components/EbizDialog.vue +260 -260
- package/src/components/EbizDiv.vue +32 -32
- package/src/components/EbizDivider.vue +96 -96
- package/src/components/EbizEmployeeInfo.vue +138 -138
- package/src/components/EbizEmployeeSelector.vue +1095 -1095
- package/src/components/EbizFileUpload.vue +238 -238
- package/src/components/EbizMap.vue +541 -541
- package/src/components/EbizMeetingRoomSelector.vue +664 -664
- package/src/components/EbizMobileMeetingRoomSelector.vue +727 -727
- package/src/components/EbizOkrTree.vue +99 -99
- package/src/components/EbizPageHeader.vue +95 -95
- package/src/components/EbizPagination.vue +162 -162
- package/src/components/EbizPopconfirm.vue +47 -47
- package/src/components/EbizRadio.vue +86 -86
- package/src/components/EbizRadioGroup.vue +83 -83
- package/src/components/EbizRemoteSelect.vue +232 -232
- package/src/components/EbizRouteBreadcrumb.vue +46 -46
- package/src/components/EbizSelect.vue +85 -85
- package/src/components/EbizSpace.vue +100 -100
- package/src/components/EbizStatistic.vue +149 -149
- package/src/components/EbizStatsCard.vue +113 -113
- package/src/components/EbizSwiper.vue +113 -113
- package/src/components/EbizSwiperItem.vue +13 -13
- package/src/components/EbizSwitch.vue +85 -85
- package/src/components/EbizTabHeader.vue +132 -132
- package/src/components/EbizTabPanel.vue +22 -22
- package/src/components/EbizTable.vue +469 -469
- package/src/components/EbizTableColumn.vue +116 -116
- package/src/components/EbizTableSort.vue +179 -179
- package/src/components/EbizTabs.vue +142 -142
- package/src/components/EbizTdesignButtonDialog.vue +332 -332
- package/src/components/EbizTdesignLoading.vue +107 -107
- package/src/components/EbizTimePicker.vue +143 -143
- package/src/components/EbizTitle.vue +91 -91
- package/src/components/EbizTree.vue +152 -152
- package/src/components/EbizTreeMergeTable.vue +1414 -1414
- package/src/components/EbizTreeSelector.vue +418 -418
- package/src/components/EbizVxeTable.vue +290 -290
- package/src/components/Form.vue +28 -28
- package/src/components/Home.vue +7 -7
- package/src/components/MyComponent.vue +39 -39
- package/src/components/Table.vue +45 -45
- package/src/components/TdesignAlert.vue +115 -115
- package/src/components/TdesignButton.vue +135 -135
- package/src/components/TdesignCalendar/index.vue +145 -145
- package/src/components/TdesignCard.vue +195 -195
- package/src/components/TdesignCol.vue +101 -101
- package/src/components/TdesignCollapse.vue +142 -142
- package/src/components/TdesignCollapsePanel.vue +79 -79
- package/src/components/TdesignDatePicker.vue +124 -124
- package/src/components/TdesignDescriptions.vue +74 -74
- package/src/components/TdesignDescriptionsItem.vue +50 -50
- package/src/components/TdesignDialog.vue +225 -225
- package/src/components/TdesignForm.vue +138 -138
- package/src/components/TdesignFormItem.vue +105 -105
- package/src/components/TdesignGrid.vue +55 -55
- package/src/components/TdesignIcon.vue +67 -67
- package/src/components/TdesignImage.vue +162 -162
- package/src/components/TdesignImageViewer.vue +200 -200
- package/src/components/TdesignInput.vue +242 -242
- package/src/components/TdesignSelect.vue +444 -444
- package/src/components/TdesignTag.vue +117 -117
- package/src/components/TdesignTextarea.vue +142 -142
- package/src/components/TdesignTimeline.vue +58 -58
- package/src/components/TdesignTimelineItem.vue +71 -71
- package/src/components/TdesignUpload.vue +405 -392
- package/src/components/TdesignWatermark.vue +107 -107
- package/src/components/ebiz-form/components/cascader.vue +61 -61
- package/src/components/ebiz-form/components/checkbox.vue +37 -37
- package/src/components/ebiz-form/components/city.vue +137 -137
- package/src/components/ebiz-form/components/date-panel.vue +52 -52
- package/src/components/ebiz-form/components/date-range-panel.vue +52 -52
- package/src/components/ebiz-form/components/date-range.vue +56 -56
- package/src/components/ebiz-form/components/date.vue +52 -52
- package/src/components/ebiz-form/components/editor-multi-language.vue +47 -47
- package/src/components/ebiz-form/components/editor.vue +78 -78
- package/src/components/ebiz-form/components/file-multi-language.vue +52 -52
- package/src/components/ebiz-form/components/file.vue +149 -149
- package/src/components/ebiz-form/components/images-multi-language.vue +52 -52
- package/src/components/ebiz-form/components/images.vue +129 -129
- package/src/components/ebiz-form/components/img-multi-language.vue +51 -51
- package/src/components/ebiz-form/components/img.vue +129 -129
- package/src/components/ebiz-form/components/number.vue +50 -50
- package/src/components/ebiz-form/components/radio.vue +28 -28
- package/src/components/ebiz-form/components/select.vue +119 -119
- package/src/components/ebiz-form/components/switch.vue +23 -23
- package/src/components/ebiz-form/components/text-multi-language.vue +47 -47
- package/src/components/ebiz-form/components/text.vue +52 -52
- package/src/components/ebiz-form/components/textarea-multi-language.vue +48 -48
- package/src/components/ebiz-form/components/textarea.vue +29 -29
- package/src/components/ebiz-form/components/video-multi-language.vue +51 -51
- package/src/components/ebiz-form/components/video.vue +97 -97
- package/src/components/ebiz-form/index.vue +157 -157
- package/src/components/examples/PopconfirmExample.vue +149 -149
- package/src/components/icons/IconCommunity.vue +7 -7
- package/src/components/icons/IconDocumentation.vue +7 -7
- package/src/components/icons/IconEcosystem.vue +7 -7
- package/src/components/icons/IconSupport.vue +7 -7
- package/src/components/icons/IconTooling.vue +19 -19
- package/src/components/senior/EbizSData/index.vue +262 -262
- package/src/components/senior/EbizSDialog/index.vue +715 -715
- package/src/components/senior/EbizSForm/README.md +157 -157
- package/src/components/senior/EbizSForm/index.vue +668 -668
- package/src/components/senior/EbizSForm/item.vue +512 -512
- package/src/components/senior/EbizSForm/mItems/DateTimePicker.vue +51 -51
- package/src/components/senior/EbizSForm/mItems/Picker.vue +63 -63
- package/src/index.js +224 -224
- package/src/main.js +55 -55
- package/src/router/index.js +386 -386
- package/src/utils/formatCode.js +24 -24
- package/src/utils/generateImportStatement.js +52 -52
- package/src/utils/hasJsx.js +25 -25
- package/src/utils/index.js +166 -166
- package/src/utils/mergeOptions.js +29 -29
- package/src/utils/parseRequiredBlocks.js +18 -18
- package/src/utils/upload.ts +126 -126
- package/src/utils/vue-sfc-validator.js +155 -155
- package/src/views/Button.vue +23 -23
- package/src/views/CheckboxDemo.vue +104 -104
- package/src/views/DataContainer.vue +19 -19
- package/src/views/DialogDemo.vue +125 -125
- package/src/views/EbizApprovalDemo.vue +76 -76
- package/src/views/EbizAutoFormDemo.vue +129 -129
- package/src/views/EbizAvatar.vue +223 -223
- package/src/views/EbizDepartmentSelectorDemo.vue +169 -169
- package/src/views/EbizDetailBlockDemo.vue +30 -30
- package/src/views/EbizEmployeeInfo.vue +249 -249
- package/src/views/EbizEmployeeSelector.vue +83 -83
- package/src/views/EbizMap.vue +201 -201
- package/src/views/EbizMeetingRoomSelectorDemo.vue +293 -293
- package/src/views/EbizMobileMeetingRoomSelectorDemo.vue +566 -566
- package/src/views/EbizRadioDemo.vue +151 -151
- package/src/views/EbizSDataDemo.vue +136 -136
- package/src/views/EbizSDialogDemo.vue +301 -301
- package/src/views/EbizSForm/index.vue +359 -359
- package/src/views/EbizSFormDemo.vue +420 -420
- package/src/views/EbizSpace.vue +185 -185
- package/src/views/EbizSwiper.vue +157 -157
- package/src/views/EbizTdesignButtonDialogExample.vue +437 -437
- package/src/views/Form.vue +19 -19
- package/src/views/GridDemo.vue +238 -238
- package/src/views/Home.vue +148 -148
- package/src/views/Mindmap.vue +17 -17
- package/src/views/MyComponent.vue +19 -19
- package/src/views/OkrTree.vue +19 -19
- package/src/views/PageHeaderDemo.vue +104 -104
- package/src/views/PaginationDemo.vue +96 -96
- package/src/views/PermissionBoxDemo.vue +85 -85
- package/src/views/PopconfirmDemo.vue +80 -80
- package/src/views/RemoteSelect.vue +350 -350
- package/src/views/StatisticDemo.vue +190 -190
- package/src/views/SwitchDemo.vue +79 -79
- package/src/views/Table.vue +19 -19
- package/src/views/TableDemo.vue +334 -334
- package/src/views/TableSortDemo.vue +143 -143
- package/src/views/TableView.vue +68 -68
- package/src/views/TabsDemo.vue +282 -282
- package/src/views/TagDemo.vue +101 -101
- package/src/views/TdesignAlert.vue +98 -98
- package/src/views/TdesignButton.vue +190 -190
- package/src/views/TdesignCalendar.vue +94 -94
- package/src/views/TdesignCard.vue +296 -296
- package/src/views/TdesignCollapse.vue +293 -293
- package/src/views/TdesignDatePicker.vue +187 -187
- package/src/views/TdesignDescriptions.vue +101 -101
- package/src/views/TdesignForm.vue +248 -248
- package/src/views/TdesignIcon.vue +203 -203
- package/src/views/TdesignImage.vue +215 -215
- package/src/views/TdesignImageViewer.vue +198 -198
- package/src/views/TdesignInput.vue +252 -252
- package/src/views/TdesignSelect.vue +473 -473
- package/src/views/TdesignSwiper.vue +157 -157
- package/src/views/TextareaDemo.vue +93 -93
- package/src/views/TimePickerDemo.vue +146 -146
- package/src/views/TimelineDemo.vue +160 -160
- package/src/views/Title.vue +19 -19
- package/src/views/TreeDemo.vue +254 -254
- package/src/views/TreeMergeTableDemo.vue +239 -239
- package/src/views/TreeSelectorDemo.vue +245 -245
- package/src/views/UploadDemo.vue +121 -121
- package/src/views/VxeTableDemo.vue +279 -279
- package/src/views/WatermarkDemo.vue +85 -85
- package/src/components/EbizDropdown.vue +0 -117
- package/src/components/EbizDropdownItem.vue +0 -81
@@ -1,728 +1,728 @@
|
|
1
|
-
<template>
|
2
|
-
<div class="ebiz-mobile-meeting-room-selector">
|
3
|
-
<!-- 头部区域 -->
|
4
|
-
<div class="selector-header">
|
5
|
-
<slot name="header">
|
6
|
-
<div class="header-content">
|
7
|
-
<h3 class="title">📅 会议室预约</h3>
|
8
|
-
<div class="date-selector">
|
9
|
-
<t-date-picker
|
10
|
-
v-model="currentDate"
|
11
|
-
:disabled="disabled"
|
12
|
-
:min-date="new Date()"
|
13
|
-
format="YYYY-MM-DD"
|
14
|
-
placeholder="选择日期"
|
15
|
-
@change="handleDateChange"
|
16
|
-
/>
|
17
|
-
</div>
|
18
|
-
</div>
|
19
|
-
</slot>
|
20
|
-
</div>
|
21
|
-
|
22
|
-
<!-- 加载状态 -->
|
23
|
-
<div v-if="loading" class="loading-container">
|
24
|
-
<t-loading size="large" text="加载中..." />
|
25
|
-
</div>
|
26
|
-
|
27
|
-
<!-- 主要内容区域 -->
|
28
|
-
<div v-else class="selector-content">
|
29
|
-
<!-- 会议室列表 -->
|
30
|
-
<div class="rooms-list">
|
31
|
-
<div
|
32
|
-
v-for="room in roomList"
|
33
|
-
:key="room.id"
|
34
|
-
class="room-card"
|
35
|
-
:class="{ 'selected': selectedRoom?.id === room.id }"
|
36
|
-
@click="handleRoomSelect(room)"
|
37
|
-
>
|
38
|
-
<!-- 会议室信息 -->
|
39
|
-
<div class="room-info">
|
40
|
-
<slot name="room-info" :room="room">
|
41
|
-
<div class="room-header">
|
42
|
-
<h4 class="room-name">🏢 {{ room.name }}</h4>
|
43
|
-
<div class="room-status" :class="getRoomStatusClass(room)">
|
44
|
-
{{ getRoomStatusText(room) }}
|
45
|
-
</div>
|
46
|
-
</div>
|
47
|
-
<div class="room-details">
|
48
|
-
<div class="detail-item">
|
49
|
-
<span class="icon">👥</span>
|
50
|
-
<span>{{ room.capacity }}人</span>
|
51
|
-
</div>
|
52
|
-
<div class="detail-item">
|
53
|
-
<span class="icon">📍</span>
|
54
|
-
<span>{{ room.location }}</span>
|
55
|
-
</div>
|
56
|
-
</div>
|
57
|
-
<div v-if="room.equipment?.length" class="equipment">
|
58
|
-
<t-tag
|
59
|
-
v-for="item in room.equipment"
|
60
|
-
:key="item"
|
61
|
-
size="small"
|
62
|
-
variant="light"
|
63
|
-
class="equipment-tag"
|
64
|
-
>
|
65
|
-
{{ item }}
|
66
|
-
</t-tag>
|
67
|
-
</div>
|
68
|
-
</slot>
|
69
|
-
</div>
|
70
|
-
|
71
|
-
<!-- 时间段选择区域 -->
|
72
|
-
<div v-if="selectedRoom?.id === room.id" class="time-selection">
|
73
|
-
<div class="time-header">
|
74
|
-
<h5>⏰ 选择时间段</h5>
|
75
|
-
<div class="time-info">
|
76
|
-
<span v-if="selectedTimeSlots.length > 0" class="selected-info">
|
77
|
-
已选 {{ selectedTimeSlots.length * 0.5 }}小时
|
78
|
-
</span>
|
79
|
-
</div>
|
80
|
-
</div>
|
81
|
-
|
82
|
-
<!-- 时间段网格 -->
|
83
|
-
<div class="time-slots-grid">
|
84
|
-
<div
|
85
|
-
v-for="slot in timeSlotList"
|
86
|
-
:key="slot.value"
|
87
|
-
class="time-slot"
|
88
|
-
:class="{
|
89
|
-
'booked': isSlotBooked(room.id, slot.value),
|
90
|
-
'selected': isSlotSelected(room.id, slot.value),
|
91
|
-
'disabled': disabled || isSlotDisabled(room.id, slot.value)
|
92
|
-
}"
|
93
|
-
@click="handleTimeSlotClick(room, slot)"
|
94
|
-
>
|
95
|
-
<slot name="time-slot" :room="room" :slot="slot" :is-booked="isSlotBooked(room.id, slot.value)">
|
96
|
-
<div class="slot-content">
|
97
|
-
<div class="slot-time">{{ slot.label }}</div>
|
98
|
-
<div class="slot-status">
|
99
|
-
<span v-if="isSlotBooked(room.id, slot.value)" class="status-icon booked">❌</span>
|
100
|
-
<span v-else-if="isSlotSelected(room.id, slot.value)" class="status-icon selected">✅</span>
|
101
|
-
<span v-else class="status-icon available">⭕</span>
|
102
|
-
</div>
|
103
|
-
</div>
|
104
|
-
</slot>
|
105
|
-
</div>
|
106
|
-
</div>
|
107
|
-
</div>
|
108
|
-
</div>
|
109
|
-
</div>
|
110
|
-
</div>
|
111
|
-
|
112
|
-
<!-- 预约确认浮动面板 -->
|
113
|
-
<div v-if="selectedTimeSlots.length > 0" class="booking-panel">
|
114
|
-
<slot name="booking-form" :selection="currentSelection">
|
115
|
-
<div class="booking-form">
|
116
|
-
<div class="booking-header">
|
117
|
-
<h4>📋 预约确认</h4>
|
118
|
-
<t-button
|
119
|
-
variant="text"
|
120
|
-
size="small"
|
121
|
-
@click="handleCancelSelection"
|
122
|
-
>
|
123
|
-
取消
|
124
|
-
</t-button>
|
125
|
-
</div>
|
126
|
-
<div class="booking-info">
|
127
|
-
<div class="info-row">
|
128
|
-
<span class="label">会议室:</span>
|
129
|
-
<span class="value">{{ selectedRoom?.name }}</span>
|
130
|
-
</div>
|
131
|
-
<div class="info-row">
|
132
|
-
<span class="label">日期:</span>
|
133
|
-
<span class="value">{{ currentDate }}</span>
|
134
|
-
</div>
|
135
|
-
<div class="info-row">
|
136
|
-
<span class="label">时间:</span>
|
137
|
-
<span class="value">{{ formatSelectedTime() }}</span>
|
138
|
-
</div>
|
139
|
-
<div class="info-row">
|
140
|
-
<span class="label">时长:</span>
|
141
|
-
<span class="value">{{ selectedTimeSlots.length * 0.5 }}小时</span>
|
142
|
-
</div>
|
143
|
-
</div>
|
144
|
-
<div class="booking-actions">
|
145
|
-
<t-button
|
146
|
-
theme="primary"
|
147
|
-
size="large"
|
148
|
-
block
|
149
|
-
@click="handleConfirmBooking"
|
150
|
-
>
|
151
|
-
🎯 确认预约
|
152
|
-
</t-button>
|
153
|
-
</div>
|
154
|
-
</div>
|
155
|
-
</slot>
|
156
|
-
</div>
|
157
|
-
|
158
|
-
<!-- 底部说明 -->
|
159
|
-
<div class="selector-footer">
|
160
|
-
<slot name="footer">
|
161
|
-
<div class="legend">
|
162
|
-
<div class="legend-item">
|
163
|
-
<span class="legend-icon">⭕</span>
|
164
|
-
<span>可预约</span>
|
165
|
-
</div>
|
166
|
-
<div class="legend-item">
|
167
|
-
<span class="legend-icon">❌</span>
|
168
|
-
<span>已预约</span>
|
169
|
-
</div>
|
170
|
-
<div class="legend-item">
|
171
|
-
<span class="legend-icon">✅</span>
|
172
|
-
<span>已选择</span>
|
173
|
-
</div>
|
174
|
-
</div>
|
175
|
-
</slot>
|
176
|
-
</div>
|
177
|
-
</div>
|
178
|
-
</template>
|
179
|
-
|
180
|
-
<script setup lang="ts">
|
181
|
-
import { ref, computed, watch, defineProps, defineEmits } from 'vue'
|
182
|
-
import { DatePicker as TDatePicker, Loading as TLoading, Tag as TTag, Button as TButton } from 'tdesign-vue-next'
|
183
|
-
|
184
|
-
// 组件属性接口
|
185
|
-
interface Room {
|
186
|
-
id: string
|
187
|
-
name: string
|
188
|
-
capacity: number
|
189
|
-
location: string
|
190
|
-
equipment?: string[]
|
191
|
-
}
|
192
|
-
|
193
|
-
interface TimeSlot {
|
194
|
-
value: string
|
195
|
-
label: string
|
196
|
-
hour: number
|
197
|
-
minute: number
|
198
|
-
}
|
199
|
-
|
200
|
-
interface Props {
|
201
|
-
rooms?: Room[]
|
202
|
-
selectedDate?: string
|
203
|
-
timeSlots?: TimeSlot[]
|
204
|
-
bookedSlots?: Record<string, string[]>
|
205
|
-
loading?: boolean
|
206
|
-
disabled?: boolean
|
207
|
-
minDuration?: number
|
208
|
-
maxDuration?: number
|
209
|
-
}
|
210
|
-
|
211
|
-
// 定义属性
|
212
|
-
const props = withDefaults(defineProps<Props>(), {
|
213
|
-
rooms: () => [],
|
214
|
-
selectedDate: "",
|
215
|
-
timeSlots: () => [],
|
216
|
-
bookedSlots: () => ({}),
|
217
|
-
loading: false,
|
218
|
-
disabled: false,
|
219
|
-
minDuration: 1,
|
220
|
-
maxDuration: 8
|
221
|
-
})
|
222
|
-
|
223
|
-
// 定义事件
|
224
|
-
const emit = defineEmits(['room-select', 'time-select', 'booking-confirm', 'date-change'])
|
225
|
-
|
226
|
-
// 响应式数据
|
227
|
-
const currentDate = ref(props.selectedDate || new Date().toISOString().split('T')[0])
|
228
|
-
const selectedRoom = ref<Room | null>(null)
|
229
|
-
const selectedTimeSlots = ref<string[]>([])
|
230
|
-
|
231
|
-
// 计算属性
|
232
|
-
const roomList = computed(() => props.rooms)
|
233
|
-
|
234
|
-
const timeSlotList = computed(() => {
|
235
|
-
if (props.timeSlots.length > 0) {
|
236
|
-
return props.timeSlots
|
237
|
-
}
|
238
|
-
|
239
|
-
// 默认生成9:00-18:00的时间段,每30分钟一个
|
240
|
-
const slots: TimeSlot[] = []
|
241
|
-
for (let hour = 9; hour < 18; hour++) {
|
242
|
-
for (let minute = 0; minute < 60; minute += 30) {
|
243
|
-
const timeValue = `${hour.toString().padStart(2, '0')}:${minute.toString().padStart(2, '0')}`
|
244
|
-
slots.push({
|
245
|
-
value: timeValue,
|
246
|
-
label: timeValue,
|
247
|
-
hour,
|
248
|
-
minute
|
249
|
-
})
|
250
|
-
}
|
251
|
-
}
|
252
|
-
return slots
|
253
|
-
})
|
254
|
-
|
255
|
-
// 辅助方法
|
256
|
-
const getEndTime = (startTime: string): string => {
|
257
|
-
const [hour, minute] = startTime.split(':').map(Number)
|
258
|
-
const endMinute = minute + 30
|
259
|
-
const endHour = endMinute >= 60 ? hour + 1 : hour
|
260
|
-
const finalMinute = endMinute >= 60 ? endMinute - 60 : endMinute
|
261
|
-
|
262
|
-
return `${endHour.toString().padStart(2, '0')}:${finalMinute.toString().padStart(2, '0')}`
|
263
|
-
}
|
264
|
-
|
265
|
-
const clearTimeSelection = () => {
|
266
|
-
selectedTimeSlots.value = []
|
267
|
-
}
|
268
|
-
|
269
|
-
const clearSelection = () => {
|
270
|
-
selectedRoom.value = null
|
271
|
-
clearTimeSelection()
|
272
|
-
}
|
273
|
-
|
274
|
-
const isSlotBooked = (roomId: string, timeSlot: string): boolean => {
|
275
|
-
return props.bookedSlots[roomId]?.includes(timeSlot) || false
|
276
|
-
}
|
277
|
-
|
278
|
-
const isSlotSelected = (roomId: string, timeSlot: string): boolean => {
|
279
|
-
return selectedRoom.value?.id === roomId && selectedTimeSlots.value.includes(timeSlot)
|
280
|
-
}
|
281
|
-
|
282
|
-
const isSlotDisabled = (_roomId: string, _timeSlot: string): boolean => {
|
283
|
-
return false
|
284
|
-
}
|
285
|
-
|
286
|
-
const getRoomStatusClass = (room: Room): string => {
|
287
|
-
const availableSlots = timeSlotList.value.filter(slot =>
|
288
|
-
!isSlotBooked(room.id, slot.value)
|
289
|
-
).length
|
290
|
-
|
291
|
-
if (availableSlots === 0) return 'fully-booked'
|
292
|
-
if (availableSlots < timeSlotList.value.length / 2) return 'partially-available'
|
293
|
-
return 'available'
|
294
|
-
}
|
295
|
-
|
296
|
-
const getRoomStatusText = (room: Room): string => {
|
297
|
-
const availableSlots = timeSlotList.value.filter(slot =>
|
298
|
-
!isSlotBooked(room.id, slot.value)
|
299
|
-
).length
|
300
|
-
|
301
|
-
if (availableSlots === 0) return '已满'
|
302
|
-
if (availableSlots < timeSlotList.value.length / 2) return '紧张'
|
303
|
-
return '充足'
|
304
|
-
}
|
305
|
-
|
306
|
-
const formatSelectedTime = (): string => {
|
307
|
-
if (selectedTimeSlots.value.length === 0) return ''
|
308
|
-
|
309
|
-
const sortedSlots = [...selectedTimeSlots.value].sort()
|
310
|
-
const startTime = sortedSlots[0]
|
311
|
-
const endTime = getEndTime(sortedSlots[sortedSlots.length - 1])
|
312
|
-
|
313
|
-
return `${startTime} - ${endTime}`
|
314
|
-
}
|
315
|
-
|
316
|
-
const currentSelection = computed(() => {
|
317
|
-
if (!selectedRoom.value || selectedTimeSlots.value.length === 0) {
|
318
|
-
return null
|
319
|
-
}
|
320
|
-
|
321
|
-
const sortedSlots = [...selectedTimeSlots.value].sort()
|
322
|
-
return {
|
323
|
-
room: selectedRoom.value,
|
324
|
-
date: currentDate.value,
|
325
|
-
startTime: sortedSlots[0],
|
326
|
-
endTime: getEndTime(sortedSlots[sortedSlots.length - 1]),
|
327
|
-
duration: selectedTimeSlots.value.length,
|
328
|
-
timeSlots: sortedSlots
|
329
|
-
}
|
330
|
-
})
|
331
|
-
|
332
|
-
// 事件处理方法
|
333
|
-
const handleDateChange = (date: string) => {
|
334
|
-
currentDate.value = date
|
335
|
-
clearSelection()
|
336
|
-
emit('date-change', date)
|
337
|
-
}
|
338
|
-
|
339
|
-
const handleRoomSelect = (room: Room) => {
|
340
|
-
if (selectedRoom.value?.id === room.id) {
|
341
|
-
// 如果点击的是已选中的会议室,则收起时间选择
|
342
|
-
selectedRoom.value = null
|
343
|
-
clearTimeSelection()
|
344
|
-
} else {
|
345
|
-
// 选择新的会议室
|
346
|
-
selectedRoom.value = room
|
347
|
-
clearTimeSelection()
|
348
|
-
emit('room-select', room)
|
349
|
-
}
|
350
|
-
}
|
351
|
-
|
352
|
-
const handleTimeSlotClick = (room: Room, slot: TimeSlot) => {
|
353
|
-
if (disabled || isSlotDisabled(room.id, slot.value) || isSlotBooked(room.id, slot.value)) {
|
354
|
-
return
|
355
|
-
}
|
356
|
-
|
357
|
-
const slotIndex = selectedTimeSlots.value.indexOf(slot.value)
|
358
|
-
|
359
|
-
if (slotIndex > -1) {
|
360
|
-
// 取消选择
|
361
|
-
selectedTimeSlots.value.splice(slotIndex, 1)
|
362
|
-
} else {
|
363
|
-
// 添加选择
|
364
|
-
selectedTimeSlots.value.push(slot.value)
|
365
|
-
|
366
|
-
// 检查时长限制
|
367
|
-
if (selectedTimeSlots.value.length > props.maxDuration) {
|
368
|
-
selectedTimeSlots.value = selectedTimeSlots.value.slice(-props.maxDuration)
|
369
|
-
}
|
370
|
-
}
|
371
|
-
|
372
|
-
if (selectedTimeSlots.value.length >= props.minDuration) {
|
373
|
-
emit('time-select', currentSelection.value)
|
374
|
-
}
|
375
|
-
}
|
376
|
-
|
377
|
-
const handleConfirmBooking = () => {
|
378
|
-
if (currentSelection.value) {
|
379
|
-
emit('booking-confirm', currentSelection.value)
|
380
|
-
clearSelection()
|
381
|
-
}
|
382
|
-
}
|
383
|
-
|
384
|
-
const handleCancelSelection = () => {
|
385
|
-
clearSelection()
|
386
|
-
}
|
387
|
-
|
388
|
-
// 监听属性变化
|
389
|
-
watch(() => props.selectedDate, (newDate) => {
|
390
|
-
if (newDate && newDate !== currentDate.value) {
|
391
|
-
currentDate.value = newDate
|
392
|
-
clearSelection()
|
393
|
-
}
|
394
|
-
})
|
395
|
-
|
396
|
-
// 暴露组件实例方法
|
397
|
-
defineExpose({
|
398
|
-
clearSelection,
|
399
|
-
clearTimeSelection,
|
400
|
-
getCurrentSelection: () => currentSelection.value
|
401
|
-
})
|
402
|
-
</script>
|
403
|
-
|
404
|
-
<style scoped>
|
405
|
-
.ebiz-mobile-meeting-room-selector {
|
406
|
-
background: #f5f5f5;
|
407
|
-
min-height: 100vh;
|
408
|
-
padding-bottom: 80px; /* 为浮动面板留出空间 */
|
409
|
-
}
|
410
|
-
|
411
|
-
.selector-header {
|
412
|
-
background: #fff;
|
413
|
-
padding: 16px;
|
414
|
-
border-bottom: 1px solid #eee;
|
415
|
-
position: sticky;
|
416
|
-
top: 0;
|
417
|
-
z-index: 100;
|
418
|
-
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
419
|
-
}
|
420
|
-
|
421
|
-
.header-content {
|
422
|
-
display: flex;
|
423
|
-
justify-content: space-between;
|
424
|
-
align-items: center;
|
425
|
-
}
|
426
|
-
|
427
|
-
.title {
|
428
|
-
margin: 0;
|
429
|
-
font-size: 18px;
|
430
|
-
font-weight: 600;
|
431
|
-
color: #333;
|
432
|
-
}
|
433
|
-
|
434
|
-
.date-selector {
|
435
|
-
flex-shrink: 0;
|
436
|
-
}
|
437
|
-
|
438
|
-
.loading-container {
|
439
|
-
padding: 60px 20px;
|
440
|
-
text-align: center;
|
441
|
-
}
|
442
|
-
|
443
|
-
.selector-content {
|
444
|
-
padding: 16px;
|
445
|
-
}
|
446
|
-
|
447
|
-
.rooms-list {
|
448
|
-
display: flex;
|
449
|
-
flex-direction: column;
|
450
|
-
gap: 16px;
|
451
|
-
}
|
452
|
-
|
453
|
-
.room-card {
|
454
|
-
background: #fff;
|
455
|
-
border-radius: 12px;
|
456
|
-
overflow: hidden;
|
457
|
-
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
458
|
-
transition: all 0.3s ease;
|
459
|
-
}
|
460
|
-
|
461
|
-
.room-card.selected {
|
462
|
-
border: 2px solid #1890ff;
|
463
|
-
box-shadow: 0 4px 12px rgba(24, 144, 255, 0.2);
|
464
|
-
}
|
465
|
-
|
466
|
-
.room-info {
|
467
|
-
padding: 16px;
|
468
|
-
cursor: pointer;
|
469
|
-
}
|
470
|
-
|
471
|
-
.room-header {
|
472
|
-
display: flex;
|
473
|
-
justify-content: space-between;
|
474
|
-
align-items: center;
|
475
|
-
margin-bottom: 12px;
|
476
|
-
}
|
477
|
-
|
478
|
-
.room-name {
|
479
|
-
margin: 0;
|
480
|
-
font-size: 16px;
|
481
|
-
font-weight: 600;
|
482
|
-
color: #333;
|
483
|
-
}
|
484
|
-
|
485
|
-
.room-status {
|
486
|
-
padding: 4px 8px;
|
487
|
-
border-radius: 12px;
|
488
|
-
font-size: 12px;
|
489
|
-
font-weight: 500;
|
490
|
-
}
|
491
|
-
|
492
|
-
.room-status.available {
|
493
|
-
background: #f6ffed;
|
494
|
-
color: #52c41a;
|
495
|
-
}
|
496
|
-
|
497
|
-
.room-status.partially-available {
|
498
|
-
background: #fff7e6;
|
499
|
-
color: #fa8c16;
|
500
|
-
}
|
501
|
-
|
502
|
-
.room-status.fully-booked {
|
503
|
-
background: #fff2f0;
|
504
|
-
color: #ff4d4f;
|
505
|
-
}
|
506
|
-
|
507
|
-
.room-details {
|
508
|
-
display: flex;
|
509
|
-
gap: 16px;
|
510
|
-
margin-bottom: 12px;
|
511
|
-
}
|
512
|
-
|
513
|
-
.detail-item {
|
514
|
-
display: flex;
|
515
|
-
align-items: center;
|
516
|
-
gap: 4px;
|
517
|
-
font-size: 14px;
|
518
|
-
color: #666;
|
519
|
-
}
|
520
|
-
|
521
|
-
.icon {
|
522
|
-
font-size: 16px;
|
523
|
-
}
|
524
|
-
|
525
|
-
.equipment {
|
526
|
-
display: flex;
|
527
|
-
flex-wrap: wrap;
|
528
|
-
gap: 6px;
|
529
|
-
}
|
530
|
-
|
531
|
-
.equipment-tag {
|
532
|
-
font-size: 12px;
|
533
|
-
}
|
534
|
-
|
535
|
-
.time-selection {
|
536
|
-
border-top: 1px solid #f0f0f0;
|
537
|
-
padding: 16px;
|
538
|
-
background: #fafafa;
|
539
|
-
}
|
540
|
-
|
541
|
-
.time-header {
|
542
|
-
display: flex;
|
543
|
-
justify-content: space-between;
|
544
|
-
align-items: center;
|
545
|
-
margin-bottom: 12px;
|
546
|
-
}
|
547
|
-
|
548
|
-
.time-header h5 {
|
549
|
-
margin: 0;
|
550
|
-
font-size: 14px;
|
551
|
-
font-weight: 600;
|
552
|
-
color: #333;
|
553
|
-
}
|
554
|
-
|
555
|
-
.selected-info {
|
556
|
-
font-size: 12px;
|
557
|
-
color: #1890ff;
|
558
|
-
font-weight: 500;
|
559
|
-
}
|
560
|
-
|
561
|
-
.time-slots-grid {
|
562
|
-
display: grid;
|
563
|
-
grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
|
564
|
-
gap: 8px;
|
565
|
-
}
|
566
|
-
|
567
|
-
.time-slot {
|
568
|
-
background: #fff;
|
569
|
-
border: 1px solid #e0e0e0;
|
570
|
-
border-radius: 8px;
|
571
|
-
padding: 8px;
|
572
|
-
text-align: center;
|
573
|
-
cursor: pointer;
|
574
|
-
transition: all 0.2s ease;
|
575
|
-
min-height: 60px;
|
576
|
-
display: flex;
|
577
|
-
flex-direction: column;
|
578
|
-
justify-content: center;
|
579
|
-
}
|
580
|
-
|
581
|
-
.time-slot:active {
|
582
|
-
transform: scale(0.95);
|
583
|
-
}
|
584
|
-
|
585
|
-
.time-slot.booked {
|
586
|
-
background: #f5f5f5;
|
587
|
-
border-color: #d9d9d9;
|
588
|
-
cursor: not-allowed;
|
589
|
-
}
|
590
|
-
|
591
|
-
.time-slot.selected {
|
592
|
-
background: #e6f7ff;
|
593
|
-
border-color: #1890ff;
|
594
|
-
color: #1890ff;
|
595
|
-
}
|
596
|
-
|
597
|
-
.time-slot.disabled {
|
598
|
-
background: #f0f0f0;
|
599
|
-
cursor: not-allowed;
|
600
|
-
opacity: 0.5;
|
601
|
-
}
|
602
|
-
|
603
|
-
.slot-content {
|
604
|
-
display: flex;
|
605
|
-
flex-direction: column;
|
606
|
-
align-items: center;
|
607
|
-
gap: 4px;
|
608
|
-
}
|
609
|
-
|
610
|
-
.slot-time {
|
611
|
-
font-size: 12px;
|
612
|
-
font-weight: 500;
|
613
|
-
}
|
614
|
-
|
615
|
-
.status-icon {
|
616
|
-
font-size: 16px;
|
617
|
-
}
|
618
|
-
|
619
|
-
.booking-panel {
|
620
|
-
position: fixed;
|
621
|
-
bottom: 0;
|
622
|
-
left: 0;
|
623
|
-
right: 0;
|
624
|
-
background: #fff;
|
625
|
-
border-top: 1px solid #eee;
|
626
|
-
box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
|
627
|
-
z-index: 1000;
|
628
|
-
animation: slideUp 0.3s ease;
|
629
|
-
}
|
630
|
-
|
631
|
-
@keyframes slideUp {
|
632
|
-
from {
|
633
|
-
transform: translateY(100%);
|
634
|
-
}
|
635
|
-
to {
|
636
|
-
transform: translateY(0);
|
637
|
-
}
|
638
|
-
}
|
639
|
-
|
640
|
-
.booking-form {
|
641
|
-
padding: 16px;
|
642
|
-
}
|
643
|
-
|
644
|
-
.booking-header {
|
645
|
-
display: flex;
|
646
|
-
justify-content: space-between;
|
647
|
-
align-items: center;
|
648
|
-
margin-bottom: 12px;
|
649
|
-
}
|
650
|
-
|
651
|
-
.booking-header h4 {
|
652
|
-
margin: 0;
|
653
|
-
font-size: 16px;
|
654
|
-
font-weight: 600;
|
655
|
-
color: #333;
|
656
|
-
}
|
657
|
-
|
658
|
-
.booking-info {
|
659
|
-
margin-bottom: 16px;
|
660
|
-
}
|
661
|
-
|
662
|
-
.info-row {
|
663
|
-
display: flex;
|
664
|
-
justify-content: space-between;
|
665
|
-
align-items: center;
|
666
|
-
padding: 6px 0;
|
667
|
-
font-size: 14px;
|
668
|
-
}
|
669
|
-
|
670
|
-
.label {
|
671
|
-
color: #666;
|
672
|
-
font-weight: 500;
|
673
|
-
}
|
674
|
-
|
675
|
-
.value {
|
676
|
-
color: #333;
|
677
|
-
font-weight: 600;
|
678
|
-
}
|
679
|
-
|
680
|
-
.booking-actions {
|
681
|
-
margin-top: 16px;
|
682
|
-
}
|
683
|
-
|
684
|
-
.selector-footer {
|
685
|
-
padding: 16px;
|
686
|
-
background: #fff;
|
687
|
-
margin-top: 16px;
|
688
|
-
}
|
689
|
-
|
690
|
-
.legend {
|
691
|
-
display: flex;
|
692
|
-
justify-content: center;
|
693
|
-
gap: 24px;
|
694
|
-
}
|
695
|
-
|
696
|
-
.legend-item {
|
697
|
-
display: flex;
|
698
|
-
align-items: center;
|
699
|
-
gap: 6px;
|
700
|
-
font-size: 12px;
|
701
|
-
color: #666;
|
702
|
-
}
|
703
|
-
|
704
|
-
.legend-icon {
|
705
|
-
font-size: 14px;
|
706
|
-
}
|
707
|
-
|
708
|
-
/* 响应式设计 */
|
709
|
-
@media (max-width: 375px) {
|
710
|
-
.time-slots-grid {
|
711
|
-
grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
|
712
|
-
gap: 6px;
|
713
|
-
}
|
714
|
-
|
715
|
-
.time-slot {
|
716
|
-
padding: 6px;
|
717
|
-
min-height: 50px;
|
718
|
-
}
|
719
|
-
|
720
|
-
.slot-time {
|
721
|
-
font-size: 11px;
|
722
|
-
}
|
723
|
-
|
724
|
-
.status-icon {
|
725
|
-
font-size: 14px;
|
726
|
-
}
|
727
|
-
}
|
1
|
+
<template>
|
2
|
+
<div class="ebiz-mobile-meeting-room-selector">
|
3
|
+
<!-- 头部区域 -->
|
4
|
+
<div class="selector-header">
|
5
|
+
<slot name="header">
|
6
|
+
<div class="header-content">
|
7
|
+
<h3 class="title">📅 会议室预约</h3>
|
8
|
+
<div class="date-selector">
|
9
|
+
<t-date-picker
|
10
|
+
v-model="currentDate"
|
11
|
+
:disabled="disabled"
|
12
|
+
:min-date="new Date()"
|
13
|
+
format="YYYY-MM-DD"
|
14
|
+
placeholder="选择日期"
|
15
|
+
@change="handleDateChange"
|
16
|
+
/>
|
17
|
+
</div>
|
18
|
+
</div>
|
19
|
+
</slot>
|
20
|
+
</div>
|
21
|
+
|
22
|
+
<!-- 加载状态 -->
|
23
|
+
<div v-if="loading" class="loading-container">
|
24
|
+
<t-loading size="large" text="加载中..." />
|
25
|
+
</div>
|
26
|
+
|
27
|
+
<!-- 主要内容区域 -->
|
28
|
+
<div v-else class="selector-content">
|
29
|
+
<!-- 会议室列表 -->
|
30
|
+
<div class="rooms-list">
|
31
|
+
<div
|
32
|
+
v-for="room in roomList"
|
33
|
+
:key="room.id"
|
34
|
+
class="room-card"
|
35
|
+
:class="{ 'selected': selectedRoom?.id === room.id }"
|
36
|
+
@click="handleRoomSelect(room)"
|
37
|
+
>
|
38
|
+
<!-- 会议室信息 -->
|
39
|
+
<div class="room-info">
|
40
|
+
<slot name="room-info" :room="room">
|
41
|
+
<div class="room-header">
|
42
|
+
<h4 class="room-name">🏢 {{ room.name }}</h4>
|
43
|
+
<div class="room-status" :class="getRoomStatusClass(room)">
|
44
|
+
{{ getRoomStatusText(room) }}
|
45
|
+
</div>
|
46
|
+
</div>
|
47
|
+
<div class="room-details">
|
48
|
+
<div class="detail-item">
|
49
|
+
<span class="icon">👥</span>
|
50
|
+
<span>{{ room.capacity }}人</span>
|
51
|
+
</div>
|
52
|
+
<div class="detail-item">
|
53
|
+
<span class="icon">📍</span>
|
54
|
+
<span>{{ room.location }}</span>
|
55
|
+
</div>
|
56
|
+
</div>
|
57
|
+
<div v-if="room.equipment?.length" class="equipment">
|
58
|
+
<t-tag
|
59
|
+
v-for="item in room.equipment"
|
60
|
+
:key="item"
|
61
|
+
size="small"
|
62
|
+
variant="light"
|
63
|
+
class="equipment-tag"
|
64
|
+
>
|
65
|
+
{{ item }}
|
66
|
+
</t-tag>
|
67
|
+
</div>
|
68
|
+
</slot>
|
69
|
+
</div>
|
70
|
+
|
71
|
+
<!-- 时间段选择区域 -->
|
72
|
+
<div v-if="selectedRoom?.id === room.id" class="time-selection">
|
73
|
+
<div class="time-header">
|
74
|
+
<h5>⏰ 选择时间段</h5>
|
75
|
+
<div class="time-info">
|
76
|
+
<span v-if="selectedTimeSlots.length > 0" class="selected-info">
|
77
|
+
已选 {{ selectedTimeSlots.length * 0.5 }}小时
|
78
|
+
</span>
|
79
|
+
</div>
|
80
|
+
</div>
|
81
|
+
|
82
|
+
<!-- 时间段网格 -->
|
83
|
+
<div class="time-slots-grid">
|
84
|
+
<div
|
85
|
+
v-for="slot in timeSlotList"
|
86
|
+
:key="slot.value"
|
87
|
+
class="time-slot"
|
88
|
+
:class="{
|
89
|
+
'booked': isSlotBooked(room.id, slot.value),
|
90
|
+
'selected': isSlotSelected(room.id, slot.value),
|
91
|
+
'disabled': disabled || isSlotDisabled(room.id, slot.value)
|
92
|
+
}"
|
93
|
+
@click="handleTimeSlotClick(room, slot)"
|
94
|
+
>
|
95
|
+
<slot name="time-slot" :room="room" :slot="slot" :is-booked="isSlotBooked(room.id, slot.value)">
|
96
|
+
<div class="slot-content">
|
97
|
+
<div class="slot-time">{{ slot.label }}</div>
|
98
|
+
<div class="slot-status">
|
99
|
+
<span v-if="isSlotBooked(room.id, slot.value)" class="status-icon booked">❌</span>
|
100
|
+
<span v-else-if="isSlotSelected(room.id, slot.value)" class="status-icon selected">✅</span>
|
101
|
+
<span v-else class="status-icon available">⭕</span>
|
102
|
+
</div>
|
103
|
+
</div>
|
104
|
+
</slot>
|
105
|
+
</div>
|
106
|
+
</div>
|
107
|
+
</div>
|
108
|
+
</div>
|
109
|
+
</div>
|
110
|
+
</div>
|
111
|
+
|
112
|
+
<!-- 预约确认浮动面板 -->
|
113
|
+
<div v-if="selectedTimeSlots.length > 0" class="booking-panel">
|
114
|
+
<slot name="booking-form" :selection="currentSelection">
|
115
|
+
<div class="booking-form">
|
116
|
+
<div class="booking-header">
|
117
|
+
<h4>📋 预约确认</h4>
|
118
|
+
<t-button
|
119
|
+
variant="text"
|
120
|
+
size="small"
|
121
|
+
@click="handleCancelSelection"
|
122
|
+
>
|
123
|
+
取消
|
124
|
+
</t-button>
|
125
|
+
</div>
|
126
|
+
<div class="booking-info">
|
127
|
+
<div class="info-row">
|
128
|
+
<span class="label">会议室:</span>
|
129
|
+
<span class="value">{{ selectedRoom?.name }}</span>
|
130
|
+
</div>
|
131
|
+
<div class="info-row">
|
132
|
+
<span class="label">日期:</span>
|
133
|
+
<span class="value">{{ currentDate }}</span>
|
134
|
+
</div>
|
135
|
+
<div class="info-row">
|
136
|
+
<span class="label">时间:</span>
|
137
|
+
<span class="value">{{ formatSelectedTime() }}</span>
|
138
|
+
</div>
|
139
|
+
<div class="info-row">
|
140
|
+
<span class="label">时长:</span>
|
141
|
+
<span class="value">{{ selectedTimeSlots.length * 0.5 }}小时</span>
|
142
|
+
</div>
|
143
|
+
</div>
|
144
|
+
<div class="booking-actions">
|
145
|
+
<t-button
|
146
|
+
theme="primary"
|
147
|
+
size="large"
|
148
|
+
block
|
149
|
+
@click="handleConfirmBooking"
|
150
|
+
>
|
151
|
+
🎯 确认预约
|
152
|
+
</t-button>
|
153
|
+
</div>
|
154
|
+
</div>
|
155
|
+
</slot>
|
156
|
+
</div>
|
157
|
+
|
158
|
+
<!-- 底部说明 -->
|
159
|
+
<div class="selector-footer">
|
160
|
+
<slot name="footer">
|
161
|
+
<div class="legend">
|
162
|
+
<div class="legend-item">
|
163
|
+
<span class="legend-icon">⭕</span>
|
164
|
+
<span>可预约</span>
|
165
|
+
</div>
|
166
|
+
<div class="legend-item">
|
167
|
+
<span class="legend-icon">❌</span>
|
168
|
+
<span>已预约</span>
|
169
|
+
</div>
|
170
|
+
<div class="legend-item">
|
171
|
+
<span class="legend-icon">✅</span>
|
172
|
+
<span>已选择</span>
|
173
|
+
</div>
|
174
|
+
</div>
|
175
|
+
</slot>
|
176
|
+
</div>
|
177
|
+
</div>
|
178
|
+
</template>
|
179
|
+
|
180
|
+
<script setup lang="ts">
|
181
|
+
import { ref, computed, watch, defineProps, defineEmits } from 'vue'
|
182
|
+
import { DatePicker as TDatePicker, Loading as TLoading, Tag as TTag, Button as TButton } from 'tdesign-vue-next'
|
183
|
+
|
184
|
+
// 组件属性接口
|
185
|
+
interface Room {
|
186
|
+
id: string
|
187
|
+
name: string
|
188
|
+
capacity: number
|
189
|
+
location: string
|
190
|
+
equipment?: string[]
|
191
|
+
}
|
192
|
+
|
193
|
+
interface TimeSlot {
|
194
|
+
value: string
|
195
|
+
label: string
|
196
|
+
hour: number
|
197
|
+
minute: number
|
198
|
+
}
|
199
|
+
|
200
|
+
interface Props {
|
201
|
+
rooms?: Room[]
|
202
|
+
selectedDate?: string
|
203
|
+
timeSlots?: TimeSlot[]
|
204
|
+
bookedSlots?: Record<string, string[]>
|
205
|
+
loading?: boolean
|
206
|
+
disabled?: boolean
|
207
|
+
minDuration?: number
|
208
|
+
maxDuration?: number
|
209
|
+
}
|
210
|
+
|
211
|
+
// 定义属性
|
212
|
+
const props = withDefaults(defineProps<Props>(), {
|
213
|
+
rooms: () => [],
|
214
|
+
selectedDate: "",
|
215
|
+
timeSlots: () => [],
|
216
|
+
bookedSlots: () => ({}),
|
217
|
+
loading: false,
|
218
|
+
disabled: false,
|
219
|
+
minDuration: 1,
|
220
|
+
maxDuration: 8
|
221
|
+
})
|
222
|
+
|
223
|
+
// 定义事件
|
224
|
+
const emit = defineEmits(['room-select', 'time-select', 'booking-confirm', 'date-change'])
|
225
|
+
|
226
|
+
// 响应式数据
|
227
|
+
const currentDate = ref(props.selectedDate || new Date().toISOString().split('T')[0])
|
228
|
+
const selectedRoom = ref<Room | null>(null)
|
229
|
+
const selectedTimeSlots = ref<string[]>([])
|
230
|
+
|
231
|
+
// 计算属性
|
232
|
+
const roomList = computed(() => props.rooms)
|
233
|
+
|
234
|
+
const timeSlotList = computed(() => {
|
235
|
+
if (props.timeSlots.length > 0) {
|
236
|
+
return props.timeSlots
|
237
|
+
}
|
238
|
+
|
239
|
+
// 默认生成9:00-18:00的时间段,每30分钟一个
|
240
|
+
const slots: TimeSlot[] = []
|
241
|
+
for (let hour = 9; hour < 18; hour++) {
|
242
|
+
for (let minute = 0; minute < 60; minute += 30) {
|
243
|
+
const timeValue = `${hour.toString().padStart(2, '0')}:${minute.toString().padStart(2, '0')}`
|
244
|
+
slots.push({
|
245
|
+
value: timeValue,
|
246
|
+
label: timeValue,
|
247
|
+
hour,
|
248
|
+
minute
|
249
|
+
})
|
250
|
+
}
|
251
|
+
}
|
252
|
+
return slots
|
253
|
+
})
|
254
|
+
|
255
|
+
// 辅助方法
|
256
|
+
const getEndTime = (startTime: string): string => {
|
257
|
+
const [hour, minute] = startTime.split(':').map(Number)
|
258
|
+
const endMinute = minute + 30
|
259
|
+
const endHour = endMinute >= 60 ? hour + 1 : hour
|
260
|
+
const finalMinute = endMinute >= 60 ? endMinute - 60 : endMinute
|
261
|
+
|
262
|
+
return `${endHour.toString().padStart(2, '0')}:${finalMinute.toString().padStart(2, '0')}`
|
263
|
+
}
|
264
|
+
|
265
|
+
const clearTimeSelection = () => {
|
266
|
+
selectedTimeSlots.value = []
|
267
|
+
}
|
268
|
+
|
269
|
+
const clearSelection = () => {
|
270
|
+
selectedRoom.value = null
|
271
|
+
clearTimeSelection()
|
272
|
+
}
|
273
|
+
|
274
|
+
const isSlotBooked = (roomId: string, timeSlot: string): boolean => {
|
275
|
+
return props.bookedSlots[roomId]?.includes(timeSlot) || false
|
276
|
+
}
|
277
|
+
|
278
|
+
const isSlotSelected = (roomId: string, timeSlot: string): boolean => {
|
279
|
+
return selectedRoom.value?.id === roomId && selectedTimeSlots.value.includes(timeSlot)
|
280
|
+
}
|
281
|
+
|
282
|
+
const isSlotDisabled = (_roomId: string, _timeSlot: string): boolean => {
|
283
|
+
return false
|
284
|
+
}
|
285
|
+
|
286
|
+
const getRoomStatusClass = (room: Room): string => {
|
287
|
+
const availableSlots = timeSlotList.value.filter(slot =>
|
288
|
+
!isSlotBooked(room.id, slot.value)
|
289
|
+
).length
|
290
|
+
|
291
|
+
if (availableSlots === 0) return 'fully-booked'
|
292
|
+
if (availableSlots < timeSlotList.value.length / 2) return 'partially-available'
|
293
|
+
return 'available'
|
294
|
+
}
|
295
|
+
|
296
|
+
const getRoomStatusText = (room: Room): string => {
|
297
|
+
const availableSlots = timeSlotList.value.filter(slot =>
|
298
|
+
!isSlotBooked(room.id, slot.value)
|
299
|
+
).length
|
300
|
+
|
301
|
+
if (availableSlots === 0) return '已满'
|
302
|
+
if (availableSlots < timeSlotList.value.length / 2) return '紧张'
|
303
|
+
return '充足'
|
304
|
+
}
|
305
|
+
|
306
|
+
const formatSelectedTime = (): string => {
|
307
|
+
if (selectedTimeSlots.value.length === 0) return ''
|
308
|
+
|
309
|
+
const sortedSlots = [...selectedTimeSlots.value].sort()
|
310
|
+
const startTime = sortedSlots[0]
|
311
|
+
const endTime = getEndTime(sortedSlots[sortedSlots.length - 1])
|
312
|
+
|
313
|
+
return `${startTime} - ${endTime}`
|
314
|
+
}
|
315
|
+
|
316
|
+
const currentSelection = computed(() => {
|
317
|
+
if (!selectedRoom.value || selectedTimeSlots.value.length === 0) {
|
318
|
+
return null
|
319
|
+
}
|
320
|
+
|
321
|
+
const sortedSlots = [...selectedTimeSlots.value].sort()
|
322
|
+
return {
|
323
|
+
room: selectedRoom.value,
|
324
|
+
date: currentDate.value,
|
325
|
+
startTime: sortedSlots[0],
|
326
|
+
endTime: getEndTime(sortedSlots[sortedSlots.length - 1]),
|
327
|
+
duration: selectedTimeSlots.value.length,
|
328
|
+
timeSlots: sortedSlots
|
329
|
+
}
|
330
|
+
})
|
331
|
+
|
332
|
+
// 事件处理方法
|
333
|
+
const handleDateChange = (date: string) => {
|
334
|
+
currentDate.value = date
|
335
|
+
clearSelection()
|
336
|
+
emit('date-change', date)
|
337
|
+
}
|
338
|
+
|
339
|
+
const handleRoomSelect = (room: Room) => {
|
340
|
+
if (selectedRoom.value?.id === room.id) {
|
341
|
+
// 如果点击的是已选中的会议室,则收起时间选择
|
342
|
+
selectedRoom.value = null
|
343
|
+
clearTimeSelection()
|
344
|
+
} else {
|
345
|
+
// 选择新的会议室
|
346
|
+
selectedRoom.value = room
|
347
|
+
clearTimeSelection()
|
348
|
+
emit('room-select', room)
|
349
|
+
}
|
350
|
+
}
|
351
|
+
|
352
|
+
const handleTimeSlotClick = (room: Room, slot: TimeSlot) => {
|
353
|
+
if (disabled || isSlotDisabled(room.id, slot.value) || isSlotBooked(room.id, slot.value)) {
|
354
|
+
return
|
355
|
+
}
|
356
|
+
|
357
|
+
const slotIndex = selectedTimeSlots.value.indexOf(slot.value)
|
358
|
+
|
359
|
+
if (slotIndex > -1) {
|
360
|
+
// 取消选择
|
361
|
+
selectedTimeSlots.value.splice(slotIndex, 1)
|
362
|
+
} else {
|
363
|
+
// 添加选择
|
364
|
+
selectedTimeSlots.value.push(slot.value)
|
365
|
+
|
366
|
+
// 检查时长限制
|
367
|
+
if (selectedTimeSlots.value.length > props.maxDuration) {
|
368
|
+
selectedTimeSlots.value = selectedTimeSlots.value.slice(-props.maxDuration)
|
369
|
+
}
|
370
|
+
}
|
371
|
+
|
372
|
+
if (selectedTimeSlots.value.length >= props.minDuration) {
|
373
|
+
emit('time-select', currentSelection.value)
|
374
|
+
}
|
375
|
+
}
|
376
|
+
|
377
|
+
const handleConfirmBooking = () => {
|
378
|
+
if (currentSelection.value) {
|
379
|
+
emit('booking-confirm', currentSelection.value)
|
380
|
+
clearSelection()
|
381
|
+
}
|
382
|
+
}
|
383
|
+
|
384
|
+
const handleCancelSelection = () => {
|
385
|
+
clearSelection()
|
386
|
+
}
|
387
|
+
|
388
|
+
// 监听属性变化
|
389
|
+
watch(() => props.selectedDate, (newDate) => {
|
390
|
+
if (newDate && newDate !== currentDate.value) {
|
391
|
+
currentDate.value = newDate
|
392
|
+
clearSelection()
|
393
|
+
}
|
394
|
+
})
|
395
|
+
|
396
|
+
// 暴露组件实例方法
|
397
|
+
defineExpose({
|
398
|
+
clearSelection,
|
399
|
+
clearTimeSelection,
|
400
|
+
getCurrentSelection: () => currentSelection.value
|
401
|
+
})
|
402
|
+
</script>
|
403
|
+
|
404
|
+
<style scoped>
|
405
|
+
.ebiz-mobile-meeting-room-selector {
|
406
|
+
background: #f5f5f5;
|
407
|
+
min-height: 100vh;
|
408
|
+
padding-bottom: 80px; /* 为浮动面板留出空间 */
|
409
|
+
}
|
410
|
+
|
411
|
+
.selector-header {
|
412
|
+
background: #fff;
|
413
|
+
padding: 16px;
|
414
|
+
border-bottom: 1px solid #eee;
|
415
|
+
position: sticky;
|
416
|
+
top: 0;
|
417
|
+
z-index: 100;
|
418
|
+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
419
|
+
}
|
420
|
+
|
421
|
+
.header-content {
|
422
|
+
display: flex;
|
423
|
+
justify-content: space-between;
|
424
|
+
align-items: center;
|
425
|
+
}
|
426
|
+
|
427
|
+
.title {
|
428
|
+
margin: 0;
|
429
|
+
font-size: 18px;
|
430
|
+
font-weight: 600;
|
431
|
+
color: #333;
|
432
|
+
}
|
433
|
+
|
434
|
+
.date-selector {
|
435
|
+
flex-shrink: 0;
|
436
|
+
}
|
437
|
+
|
438
|
+
.loading-container {
|
439
|
+
padding: 60px 20px;
|
440
|
+
text-align: center;
|
441
|
+
}
|
442
|
+
|
443
|
+
.selector-content {
|
444
|
+
padding: 16px;
|
445
|
+
}
|
446
|
+
|
447
|
+
.rooms-list {
|
448
|
+
display: flex;
|
449
|
+
flex-direction: column;
|
450
|
+
gap: 16px;
|
451
|
+
}
|
452
|
+
|
453
|
+
.room-card {
|
454
|
+
background: #fff;
|
455
|
+
border-radius: 12px;
|
456
|
+
overflow: hidden;
|
457
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
458
|
+
transition: all 0.3s ease;
|
459
|
+
}
|
460
|
+
|
461
|
+
.room-card.selected {
|
462
|
+
border: 2px solid #1890ff;
|
463
|
+
box-shadow: 0 4px 12px rgba(24, 144, 255, 0.2);
|
464
|
+
}
|
465
|
+
|
466
|
+
.room-info {
|
467
|
+
padding: 16px;
|
468
|
+
cursor: pointer;
|
469
|
+
}
|
470
|
+
|
471
|
+
.room-header {
|
472
|
+
display: flex;
|
473
|
+
justify-content: space-between;
|
474
|
+
align-items: center;
|
475
|
+
margin-bottom: 12px;
|
476
|
+
}
|
477
|
+
|
478
|
+
.room-name {
|
479
|
+
margin: 0;
|
480
|
+
font-size: 16px;
|
481
|
+
font-weight: 600;
|
482
|
+
color: #333;
|
483
|
+
}
|
484
|
+
|
485
|
+
.room-status {
|
486
|
+
padding: 4px 8px;
|
487
|
+
border-radius: 12px;
|
488
|
+
font-size: 12px;
|
489
|
+
font-weight: 500;
|
490
|
+
}
|
491
|
+
|
492
|
+
.room-status.available {
|
493
|
+
background: #f6ffed;
|
494
|
+
color: #52c41a;
|
495
|
+
}
|
496
|
+
|
497
|
+
.room-status.partially-available {
|
498
|
+
background: #fff7e6;
|
499
|
+
color: #fa8c16;
|
500
|
+
}
|
501
|
+
|
502
|
+
.room-status.fully-booked {
|
503
|
+
background: #fff2f0;
|
504
|
+
color: #ff4d4f;
|
505
|
+
}
|
506
|
+
|
507
|
+
.room-details {
|
508
|
+
display: flex;
|
509
|
+
gap: 16px;
|
510
|
+
margin-bottom: 12px;
|
511
|
+
}
|
512
|
+
|
513
|
+
.detail-item {
|
514
|
+
display: flex;
|
515
|
+
align-items: center;
|
516
|
+
gap: 4px;
|
517
|
+
font-size: 14px;
|
518
|
+
color: #666;
|
519
|
+
}
|
520
|
+
|
521
|
+
.icon {
|
522
|
+
font-size: 16px;
|
523
|
+
}
|
524
|
+
|
525
|
+
.equipment {
|
526
|
+
display: flex;
|
527
|
+
flex-wrap: wrap;
|
528
|
+
gap: 6px;
|
529
|
+
}
|
530
|
+
|
531
|
+
.equipment-tag {
|
532
|
+
font-size: 12px;
|
533
|
+
}
|
534
|
+
|
535
|
+
.time-selection {
|
536
|
+
border-top: 1px solid #f0f0f0;
|
537
|
+
padding: 16px;
|
538
|
+
background: #fafafa;
|
539
|
+
}
|
540
|
+
|
541
|
+
.time-header {
|
542
|
+
display: flex;
|
543
|
+
justify-content: space-between;
|
544
|
+
align-items: center;
|
545
|
+
margin-bottom: 12px;
|
546
|
+
}
|
547
|
+
|
548
|
+
.time-header h5 {
|
549
|
+
margin: 0;
|
550
|
+
font-size: 14px;
|
551
|
+
font-weight: 600;
|
552
|
+
color: #333;
|
553
|
+
}
|
554
|
+
|
555
|
+
.selected-info {
|
556
|
+
font-size: 12px;
|
557
|
+
color: #1890ff;
|
558
|
+
font-weight: 500;
|
559
|
+
}
|
560
|
+
|
561
|
+
.time-slots-grid {
|
562
|
+
display: grid;
|
563
|
+
grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
|
564
|
+
gap: 8px;
|
565
|
+
}
|
566
|
+
|
567
|
+
.time-slot {
|
568
|
+
background: #fff;
|
569
|
+
border: 1px solid #e0e0e0;
|
570
|
+
border-radius: 8px;
|
571
|
+
padding: 8px;
|
572
|
+
text-align: center;
|
573
|
+
cursor: pointer;
|
574
|
+
transition: all 0.2s ease;
|
575
|
+
min-height: 60px;
|
576
|
+
display: flex;
|
577
|
+
flex-direction: column;
|
578
|
+
justify-content: center;
|
579
|
+
}
|
580
|
+
|
581
|
+
.time-slot:active {
|
582
|
+
transform: scale(0.95);
|
583
|
+
}
|
584
|
+
|
585
|
+
.time-slot.booked {
|
586
|
+
background: #f5f5f5;
|
587
|
+
border-color: #d9d9d9;
|
588
|
+
cursor: not-allowed;
|
589
|
+
}
|
590
|
+
|
591
|
+
.time-slot.selected {
|
592
|
+
background: #e6f7ff;
|
593
|
+
border-color: #1890ff;
|
594
|
+
color: #1890ff;
|
595
|
+
}
|
596
|
+
|
597
|
+
.time-slot.disabled {
|
598
|
+
background: #f0f0f0;
|
599
|
+
cursor: not-allowed;
|
600
|
+
opacity: 0.5;
|
601
|
+
}
|
602
|
+
|
603
|
+
.slot-content {
|
604
|
+
display: flex;
|
605
|
+
flex-direction: column;
|
606
|
+
align-items: center;
|
607
|
+
gap: 4px;
|
608
|
+
}
|
609
|
+
|
610
|
+
.slot-time {
|
611
|
+
font-size: 12px;
|
612
|
+
font-weight: 500;
|
613
|
+
}
|
614
|
+
|
615
|
+
.status-icon {
|
616
|
+
font-size: 16px;
|
617
|
+
}
|
618
|
+
|
619
|
+
.booking-panel {
|
620
|
+
position: fixed;
|
621
|
+
bottom: 0;
|
622
|
+
left: 0;
|
623
|
+
right: 0;
|
624
|
+
background: #fff;
|
625
|
+
border-top: 1px solid #eee;
|
626
|
+
box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
|
627
|
+
z-index: 1000;
|
628
|
+
animation: slideUp 0.3s ease;
|
629
|
+
}
|
630
|
+
|
631
|
+
@keyframes slideUp {
|
632
|
+
from {
|
633
|
+
transform: translateY(100%);
|
634
|
+
}
|
635
|
+
to {
|
636
|
+
transform: translateY(0);
|
637
|
+
}
|
638
|
+
}
|
639
|
+
|
640
|
+
.booking-form {
|
641
|
+
padding: 16px;
|
642
|
+
}
|
643
|
+
|
644
|
+
.booking-header {
|
645
|
+
display: flex;
|
646
|
+
justify-content: space-between;
|
647
|
+
align-items: center;
|
648
|
+
margin-bottom: 12px;
|
649
|
+
}
|
650
|
+
|
651
|
+
.booking-header h4 {
|
652
|
+
margin: 0;
|
653
|
+
font-size: 16px;
|
654
|
+
font-weight: 600;
|
655
|
+
color: #333;
|
656
|
+
}
|
657
|
+
|
658
|
+
.booking-info {
|
659
|
+
margin-bottom: 16px;
|
660
|
+
}
|
661
|
+
|
662
|
+
.info-row {
|
663
|
+
display: flex;
|
664
|
+
justify-content: space-between;
|
665
|
+
align-items: center;
|
666
|
+
padding: 6px 0;
|
667
|
+
font-size: 14px;
|
668
|
+
}
|
669
|
+
|
670
|
+
.label {
|
671
|
+
color: #666;
|
672
|
+
font-weight: 500;
|
673
|
+
}
|
674
|
+
|
675
|
+
.value {
|
676
|
+
color: #333;
|
677
|
+
font-weight: 600;
|
678
|
+
}
|
679
|
+
|
680
|
+
.booking-actions {
|
681
|
+
margin-top: 16px;
|
682
|
+
}
|
683
|
+
|
684
|
+
.selector-footer {
|
685
|
+
padding: 16px;
|
686
|
+
background: #fff;
|
687
|
+
margin-top: 16px;
|
688
|
+
}
|
689
|
+
|
690
|
+
.legend {
|
691
|
+
display: flex;
|
692
|
+
justify-content: center;
|
693
|
+
gap: 24px;
|
694
|
+
}
|
695
|
+
|
696
|
+
.legend-item {
|
697
|
+
display: flex;
|
698
|
+
align-items: center;
|
699
|
+
gap: 6px;
|
700
|
+
font-size: 12px;
|
701
|
+
color: #666;
|
702
|
+
}
|
703
|
+
|
704
|
+
.legend-icon {
|
705
|
+
font-size: 14px;
|
706
|
+
}
|
707
|
+
|
708
|
+
/* 响应式设计 */
|
709
|
+
@media (max-width: 375px) {
|
710
|
+
.time-slots-grid {
|
711
|
+
grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
|
712
|
+
gap: 6px;
|
713
|
+
}
|
714
|
+
|
715
|
+
.time-slot {
|
716
|
+
padding: 6px;
|
717
|
+
min-height: 50px;
|
718
|
+
}
|
719
|
+
|
720
|
+
.slot-time {
|
721
|
+
font-size: 11px;
|
722
|
+
}
|
723
|
+
|
724
|
+
.status-icon {
|
725
|
+
font-size: 14px;
|
726
|
+
}
|
727
|
+
}
|
728
728
|
</style>
|