@ebiz/designer-components 0.1.124 → 0.1.126
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 +35548 -33511
- package/dist/{pdf-C9oIcL2N.js → pdf-KomaE0u5.js} +891 -891
- 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 +312 -312
- 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 +366 -366
- package/src/components/EbizApprovalDetail.vue +169 -169
- package/src/components/EbizApprovalForm.vue +534 -534
- package/src/components/EbizApprovalV2.vue +713 -713
- 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 +148 -148
- package/src/components/EbizDescriptions.vue +340 -340
- package/src/components/EbizDescriptionsItem.vue +47 -47
- package/src/components/EbizDetailBlock.vue +81 -81
- package/src/components/EbizDetailItem.vue +559 -559
- package/src/components/EbizDetailView.md +438 -438
- package/src/components/EbizDetailView.vue +355 -355
- package/src/components/EbizDialog.vue +260 -260
- package/src/components/EbizDictionarySelect.vue +229 -229
- package/src/components/EbizDiv.vue +40 -40
- package/src/components/EbizDivider.vue +96 -96
- package/src/components/EbizDormDashboard.vue +314 -314
- package/src/components/EbizDropdown.vue +135 -135
- package/src/components/EbizDropdownItem.vue +85 -85
- package/src/components/EbizEmployeeInfo.vue +144 -144
- package/src/components/EbizEmployeeSelector.vue +1160 -1160
- package/src/components/EbizFileList.vue +502 -502
- package/src/components/EbizMap.vue +541 -541
- package/src/components/EbizMeetingRoomSelector.vue +1149 -1149
- package/src/components/EbizMobileMeetingRoomSelector.vue +727 -727
- package/src/components/EbizOkrTree.vue +99 -99
- package/src/components/EbizPageHeader.vue +98 -98
- package/src/components/EbizPagination.vue +162 -162
- package/src/components/EbizParkingDashboard.vue +152 -152
- package/src/components/EbizPdfViewer.vue +540 -540
- package/src/components/EbizPopconfirm.vue +47 -47
- package/src/components/EbizQrCode.vue +167 -167
- package/src/components/EbizRadio.vue +86 -86
- package/src/components/EbizRadioGroup.vue +83 -83
- package/src/components/EbizRemoteSelect.vue +232 -232
- package/src/components/EbizRichTextEditor.vue +338 -338
- package/src/components/EbizRouteBreadcrumb.vue +46 -46
- package/src/components/EbizSApprovalProcess.vue +1456 -1426
- 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 +141 -141
- package/src/components/EbizTreeMergeTable.vue +1494 -1494
- package/src/components/EbizTreeSelector.vue +469 -469
- package/src/components/EbizVideo.vue +553 -553
- package/src/components/EbizVxeTable.vue +290 -290
- package/src/components/Form.vue +28 -28
- package/src/components/Home.vue +7 -7
- package/src/components/LaunchInterview.vue +526 -526
- 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 +446 -446
- 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 +414 -414
- 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/mItems/UserInfo.vue +349 -349
- package/src/components/senior/EbizApprovalList/ApprovalList.vue +127 -127
- package/src/components/senior/EbizSData/index.vue +280 -280
- package/src/components/senior/EbizSDialog/index.vue +776 -776
- package/src/components/senior/EbizSForm/README.md +157 -157
- package/src/components/senior/EbizSForm/index.vue +667 -667
- package/src/components/senior/EbizSForm/item.vue +1011 -1011
- package/src/components/senior/EbizSForm/mItems/DateTimePicker.vue +51 -51
- package/src/components/senior/EbizSForm/mItems/Picker.vue +63 -63
- package/src/index.js +327 -327
- package/src/main.js +55 -55
- package/src/router/index.js +436 -436
- 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/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 +87 -87
- package/src/views/EbizApprovalFormDemo.vue +207 -207
- 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/EbizDetailViewDemo.vue +412 -412
- package/src/views/EbizDormDashboardDemo.vue +87 -87
- package/src/views/EbizEmployeeInfo.vue +249 -249
- package/src/views/EbizEmployeeSelector.vue +85 -85
- package/src/views/EbizFileListDemo.vue +339 -339
- package/src/views/EbizMap.vue +201 -201
- package/src/views/EbizMeetingRoomSelectorDemo.vue +293 -293
- package/src/views/EbizMobileMeetingRoomSelectorDemo.vue +566 -566
- package/src/views/EbizParkingDashboardDemo.vue +28 -28
- package/src/views/EbizRadioDemo.vue +151 -151
- package/src/views/EbizSDataDemo.vue +136 -136
- package/src/views/EbizSDialogDemo.vue +303 -303
- package/src/views/EbizSForm/index.vue +352 -352
- 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 +156 -156
- package/src/views/LaunchInterviewDemo.vue +111 -111
- 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/PdfViewerDemo.vue +433 -433
- 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 +128 -128
- package/src/views/VideoDemo.vue +245 -245
- package/src/views/VxeTableDemo.vue +279 -279
- package/src/views/WatermarkDemo.vue +85 -85
|
@@ -1,314 +1,314 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="ebiz-dorm-dashboard">
|
|
3
|
-
<div class="dashboard-header">
|
|
4
|
-
<t-radio-group v-model="innerArea" variant="default-filled" @change="onAreaChange">
|
|
5
|
-
<t-radio-button v-for="ele in areaList" :key="ele.value" :value="ele.value">{{ ele.label }}</t-radio-button>
|
|
6
|
-
</t-radio-group>
|
|
7
|
-
<!-- <t-tabs v-model="innerArea" :list="areaList" @change="onAreaChange" theme="card" /> -->
|
|
8
|
-
<t-select v-model="innerBuilding" :options="buildingOptions" @change="onBuildingChange" class="building-select" />
|
|
9
|
-
</div>
|
|
10
|
-
<div class="dashboard-grid">
|
|
11
|
-
<div v-for="floor in currentFloors" :key="floorKey(floor)" class="floor-block">
|
|
12
|
-
<div class="floor-title">{{ floorLabel(floor) }}</div>
|
|
13
|
-
<div class="rooms-grid">
|
|
14
|
-
<t-tooltip v-for="room in floor.rooms" :key="roomKey(room)" :content="roomTooltip(room)" placement="top">
|
|
15
|
-
<div class="room-item" @click="emitRoomClick(room, floor)">
|
|
16
|
-
<div class="room-card">
|
|
17
|
-
<div class="room-card-fill" :style="roomFillStyle(room)"></div>
|
|
18
|
-
<div class="room-percent">{{ roomPercent(room) }}%</div>
|
|
19
|
-
</div>
|
|
20
|
-
<div class="room-no">{{ room.roomNo }}</div>
|
|
21
|
-
<div class="room-type">{{ room.roomType }}{{ room.roomDormType ? `(${room.roomDormType})` : ''}}</div>
|
|
22
|
-
</div>
|
|
23
|
-
</t-tooltip>
|
|
24
|
-
</div>
|
|
25
|
-
</div>
|
|
26
|
-
</div>
|
|
27
|
-
</div>
|
|
28
|
-
</template>
|
|
29
|
-
|
|
30
|
-
<script>
|
|
31
|
-
export default {
|
|
32
|
-
name: 'EbizDormDashboard'
|
|
33
|
-
}
|
|
34
|
-
</script>
|
|
35
|
-
|
|
36
|
-
<script setup>
|
|
37
|
-
import { computed, ref, watch, onMounted } from 'vue'
|
|
38
|
-
import dataService from '../apiService/simpleDataService'
|
|
39
|
-
import { Tabs as TTabs, Select as TSelect, Tooltip as TTooltip, RadioGroup as TRadioGroup, RadioButton as TRadioButton } from 'tdesign-vue-next'
|
|
40
|
-
|
|
41
|
-
// 外部可双向绑定的当前区域值
|
|
42
|
-
const props = defineProps({
|
|
43
|
-
areaValue: {
|
|
44
|
-
type: [String, Number],
|
|
45
|
-
default: undefined
|
|
46
|
-
},
|
|
47
|
-
buildingValue: {
|
|
48
|
-
type: [String, Number],
|
|
49
|
-
default: undefined
|
|
50
|
-
}
|
|
51
|
-
})
|
|
52
|
-
|
|
53
|
-
const emit = defineEmits(['update:areaValue', 'update:buildingValue', 'roomClick'])
|
|
54
|
-
|
|
55
|
-
// 内部当前区域与楼栋(受控于 v-model)
|
|
56
|
-
const innerArea = ref(props.areaValue)
|
|
57
|
-
const innerBuilding = ref(props.buildingValue)
|
|
58
|
-
const regionList = ref([])
|
|
59
|
-
const buildingList = ref([])
|
|
60
|
-
|
|
61
|
-
watch(
|
|
62
|
-
() => props.areaValue,
|
|
63
|
-
(v) => {
|
|
64
|
-
innerArea.value = v
|
|
65
|
-
}
|
|
66
|
-
)
|
|
67
|
-
watch(
|
|
68
|
-
() => props.buildingValue,
|
|
69
|
-
(v) => {
|
|
70
|
-
innerBuilding.value = v
|
|
71
|
-
}
|
|
72
|
-
)
|
|
73
|
-
|
|
74
|
-
// 区域列表:直接使用接口返回的数据
|
|
75
|
-
const areaList = computed(() => regionList.value)
|
|
76
|
-
|
|
77
|
-
// 楼栋列表:直接使用接口返回的数据(已按区域过滤)
|
|
78
|
-
const buildingOptions = computed(() => buildingList.value)
|
|
79
|
-
|
|
80
|
-
watch(
|
|
81
|
-
buildingOptions,
|
|
82
|
-
(options) => {
|
|
83
|
-
if (!innerBuilding.value || !options.some((o) => o.value === innerBuilding.value)) {
|
|
84
|
-
if (options.length) innerBuilding.value = options[0].value
|
|
85
|
-
}
|
|
86
|
-
},
|
|
87
|
-
{ immediate: true }
|
|
88
|
-
)
|
|
89
|
-
|
|
90
|
-
// 当前楼层与房间数据(接口返回)
|
|
91
|
-
const floors = ref([])
|
|
92
|
-
const currentFloors = computed(() => floors.value)
|
|
93
|
-
|
|
94
|
-
const roomPercent = (room) => {
|
|
95
|
-
const total = Number(room.totalBeds || 0)
|
|
96
|
-
const occ = Number(room.occupiedBeds || 0)
|
|
97
|
-
if (!total) return 0
|
|
98
|
-
return Math.round((occ / total) * 100)
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
const roomColor = (room) => {
|
|
102
|
-
const p = roomPercent(room)
|
|
103
|
-
if (p <= 0) return '#c2c2c2'
|
|
104
|
-
if (p < 40) return '#2b71ff'
|
|
105
|
-
if (p < 80) return '#f5a623'
|
|
106
|
-
return '#ff4d4f'
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
const roomFillStyle = (room) => ({
|
|
110
|
-
height: roomPercent(room) + '%',
|
|
111
|
-
backgroundColor: roomColor(room)
|
|
112
|
-
})
|
|
113
|
-
|
|
114
|
-
const roomTooltip = (room) => {
|
|
115
|
-
const total = Number(room.totalBeds || 0)
|
|
116
|
-
const occ = Number(room.occupiedBeds || 0)
|
|
117
|
-
return `房间: ${room.roomNo} | 床位: ${total} | 已入住: ${occ}`
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
const floorKey = (floor) => String(floor.name ?? floor.floor ?? '')
|
|
121
|
-
const floorLabel = (floor) => String(floor.name ?? floor.floor ?? '') + ' 楼'
|
|
122
|
-
const roomKey = (room) => String(room.roomNo)
|
|
123
|
-
|
|
124
|
-
const emitRoomClick = (room, floor) => {
|
|
125
|
-
emit('roomClick', {
|
|
126
|
-
area: innerArea.value,
|
|
127
|
-
building: innerBuilding.value,
|
|
128
|
-
floor: floor.name ?? floor.floor,
|
|
129
|
-
roomNo: room.roomNo,
|
|
130
|
-
roomType: room.roomType,
|
|
131
|
-
roomDormType: room.roomDormType,
|
|
132
|
-
totalBeds: Number(room.totalBeds || 0),
|
|
133
|
-
occupiedBeds: Number(room.occupiedBeds || 0),
|
|
134
|
-
percent: roomPercent(room)
|
|
135
|
-
})
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
// 获取楼层与房间列表(按楼栋)
|
|
139
|
-
const getFloors = () => {
|
|
140
|
-
if (!innerBuilding.value) {
|
|
141
|
-
floors.value = []
|
|
142
|
-
return
|
|
143
|
-
}
|
|
144
|
-
dataService
|
|
145
|
-
.fetch(
|
|
146
|
-
{
|
|
147
|
-
queryParams: { buildings: innerBuilding.value }
|
|
148
|
-
},
|
|
149
|
-
{ key: 'dormitory_list_remote', apiId: 2655, apiType: 0 }
|
|
150
|
-
)
|
|
151
|
-
.then((res) => {
|
|
152
|
-
const data = res.data || []
|
|
153
|
-
const dataGroup = {}
|
|
154
|
-
data.forEach((f) => {
|
|
155
|
-
const floor = f.floor ?? ''
|
|
156
|
-
if (!dataGroup[floor]) dataGroup[floor] = []
|
|
157
|
-
dataGroup[floor].push(f)
|
|
158
|
-
})
|
|
159
|
-
floors.value = Object.entries(dataGroup).map(([name, rooms]) => ({
|
|
160
|
-
name,
|
|
161
|
-
rooms: rooms.map((r) => ({
|
|
162
|
-
roomNo: String(r.room_no ?? r.name ?? ''),
|
|
163
|
-
roomType: r.type_desc ?? '',
|
|
164
|
-
roomDormType: r.dorm_type_desc ?? '',
|
|
165
|
-
totalBeds: Number(r.occupant_max_num ?? r.bed_num ?? 0),
|
|
166
|
-
occupiedBeds: Number(r.occupant_num ?? 0)
|
|
167
|
-
}))
|
|
168
|
-
}))
|
|
169
|
-
})
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
// 获取楼栋列表(按区域)
|
|
173
|
-
const getBuildings = () => {
|
|
174
|
-
if (!innerArea.value) {
|
|
175
|
-
buildingList.value = []
|
|
176
|
-
return
|
|
177
|
-
}
|
|
178
|
-
dataService
|
|
179
|
-
.fetch(
|
|
180
|
-
{
|
|
181
|
-
queryParams: { region_id: innerArea.value }
|
|
182
|
-
},
|
|
183
|
-
{ key: 'dormitory_remote_buildings', apiId: 2617, apiType: 0 }
|
|
184
|
-
)
|
|
185
|
-
.then((res) => {
|
|
186
|
-
buildingList.value = (res.data || [])
|
|
187
|
-
.sort((a, b) => a.id - b.id)
|
|
188
|
-
.map((item) => ({ label: item.name, value: item.id }))
|
|
189
|
-
if (!innerBuilding.value || !buildingList.value.some((b) => b.value === innerBuilding.value)) {
|
|
190
|
-
innerBuilding.value = buildingList.value[0]?.value
|
|
191
|
-
}
|
|
192
|
-
getFloors()
|
|
193
|
-
})
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
// 获取区域列表
|
|
197
|
-
const getRegion = () => {
|
|
198
|
-
dataService.fetch({}, { key: 'dormitory_buildings_remote_region', apiId: 2596, apiType: 0 }).then((res) => {
|
|
199
|
-
regionList.value = (res.data || [])
|
|
200
|
-
.sort((a, b) => a.id - b.id)
|
|
201
|
-
.map((item) => ({ label: item.name, value: item.id }))
|
|
202
|
-
if (!innerArea.value && regionList.value.length) innerArea.value = regionList.value[0].value
|
|
203
|
-
getBuildings()
|
|
204
|
-
})
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
const onAreaChange = (v) => {
|
|
208
|
-
console.log('onAreaChange', v)
|
|
209
|
-
innerArea.value = v
|
|
210
|
-
emit('update:areaValue', v)
|
|
211
|
-
getBuildings()
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
const onBuildingChange = (v) => {
|
|
215
|
-
innerBuilding.value = v
|
|
216
|
-
emit('update:buildingValue', v)
|
|
217
|
-
getFloors()
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
// 初始化:拉取区域 → 楼栋 → 楼层
|
|
221
|
-
onMounted(() => {
|
|
222
|
-
getRegion()
|
|
223
|
-
})
|
|
224
|
-
</script>
|
|
225
|
-
|
|
226
|
-
<style lang="less" scoped>
|
|
227
|
-
.ebiz-dorm-dashboard {
|
|
228
|
-
display: flex;
|
|
229
|
-
flex-direction: column;
|
|
230
|
-
gap: 12px;
|
|
231
|
-
}
|
|
232
|
-
.dashboard-header {
|
|
233
|
-
display: flex;
|
|
234
|
-
align-items: flex-end;
|
|
235
|
-
gap: 20px;
|
|
236
|
-
}
|
|
237
|
-
.building-select {
|
|
238
|
-
width: 150px;
|
|
239
|
-
}
|
|
240
|
-
.dashboard-grid {
|
|
241
|
-
display: flex;
|
|
242
|
-
flex-direction: column;
|
|
243
|
-
gap: 5px;
|
|
244
|
-
}
|
|
245
|
-
.floor-block {
|
|
246
|
-
display: flex;
|
|
247
|
-
gap: 8px;
|
|
248
|
-
border: 1px solid #eee;
|
|
249
|
-
border-radius: 12px;
|
|
250
|
-
background: #fff;
|
|
251
|
-
padding: 12px;
|
|
252
|
-
transition: all 0.2s ease;
|
|
253
|
-
cursor: pointer;
|
|
254
|
-
}
|
|
255
|
-
.floor-block:hover {
|
|
256
|
-
box-shadow: 0 0 8px rgba(0, 0, 0, 0.1);
|
|
257
|
-
}
|
|
258
|
-
.floor-title {
|
|
259
|
-
font-weight: 500;
|
|
260
|
-
white-space: nowrap;
|
|
261
|
-
margin-top: 10px;
|
|
262
|
-
}
|
|
263
|
-
.rooms-grid {
|
|
264
|
-
width: calc(100% - 30px);
|
|
265
|
-
display: grid;
|
|
266
|
-
grid-template-columns: repeat(auto-fill, 50px);
|
|
267
|
-
gap: 28px;
|
|
268
|
-
}
|
|
269
|
-
.room-item {
|
|
270
|
-
display: flex;
|
|
271
|
-
flex-direction: column;
|
|
272
|
-
cursor: pointer;
|
|
273
|
-
}
|
|
274
|
-
.room-card {
|
|
275
|
-
position: relative;
|
|
276
|
-
height: 80px;
|
|
277
|
-
border-radius: 8px;
|
|
278
|
-
background: #f0f0f0;
|
|
279
|
-
overflow: hidden;
|
|
280
|
-
display: flex;
|
|
281
|
-
align-items: flex-end;
|
|
282
|
-
justify-content: center;
|
|
283
|
-
}
|
|
284
|
-
.room-card-fill {
|
|
285
|
-
position: absolute;
|
|
286
|
-
left: 0;
|
|
287
|
-
right: 0;
|
|
288
|
-
bottom: 0;
|
|
289
|
-
}
|
|
290
|
-
.room-percent {
|
|
291
|
-
position: relative;
|
|
292
|
-
bottom: 8px;
|
|
293
|
-
z-index: 1;
|
|
294
|
-
color: #fff;
|
|
295
|
-
font-weight: 600;
|
|
296
|
-
display: none;
|
|
297
|
-
}
|
|
298
|
-
.room-no {
|
|
299
|
-
margin-top: 4px;
|
|
300
|
-
font-size: 13px;
|
|
301
|
-
line-height: 1;
|
|
302
|
-
font-weight: 600;
|
|
303
|
-
color: #333;
|
|
304
|
-
text-align: center;
|
|
305
|
-
}
|
|
306
|
-
.room-type {
|
|
307
|
-
margin-top: 2px;
|
|
308
|
-
font-size: 10px;
|
|
309
|
-
line-height: 1;
|
|
310
|
-
color: #666;
|
|
311
|
-
text-align: center;
|
|
312
|
-
white-space: nowrap;
|
|
313
|
-
}
|
|
314
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<div class="ebiz-dorm-dashboard">
|
|
3
|
+
<div class="dashboard-header">
|
|
4
|
+
<t-radio-group v-model="innerArea" variant="default-filled" @change="onAreaChange">
|
|
5
|
+
<t-radio-button v-for="ele in areaList" :key="ele.value" :value="ele.value">{{ ele.label }}</t-radio-button>
|
|
6
|
+
</t-radio-group>
|
|
7
|
+
<!-- <t-tabs v-model="innerArea" :list="areaList" @change="onAreaChange" theme="card" /> -->
|
|
8
|
+
<t-select v-model="innerBuilding" :options="buildingOptions" @change="onBuildingChange" class="building-select" />
|
|
9
|
+
</div>
|
|
10
|
+
<div class="dashboard-grid">
|
|
11
|
+
<div v-for="floor in currentFloors" :key="floorKey(floor)" class="floor-block">
|
|
12
|
+
<div class="floor-title">{{ floorLabel(floor) }}</div>
|
|
13
|
+
<div class="rooms-grid">
|
|
14
|
+
<t-tooltip v-for="room in floor.rooms" :key="roomKey(room)" :content="roomTooltip(room)" placement="top">
|
|
15
|
+
<div class="room-item" @click="emitRoomClick(room, floor)">
|
|
16
|
+
<div class="room-card">
|
|
17
|
+
<div class="room-card-fill" :style="roomFillStyle(room)"></div>
|
|
18
|
+
<div class="room-percent">{{ roomPercent(room) }}%</div>
|
|
19
|
+
</div>
|
|
20
|
+
<div class="room-no">{{ room.roomNo }}</div>
|
|
21
|
+
<div class="room-type">{{ room.roomType }}{{ room.roomDormType ? `(${room.roomDormType})` : ''}}</div>
|
|
22
|
+
</div>
|
|
23
|
+
</t-tooltip>
|
|
24
|
+
</div>
|
|
25
|
+
</div>
|
|
26
|
+
</div>
|
|
27
|
+
</div>
|
|
28
|
+
</template>
|
|
29
|
+
|
|
30
|
+
<script>
|
|
31
|
+
export default {
|
|
32
|
+
name: 'EbizDormDashboard'
|
|
33
|
+
}
|
|
34
|
+
</script>
|
|
35
|
+
|
|
36
|
+
<script setup>
|
|
37
|
+
import { computed, ref, watch, onMounted } from 'vue'
|
|
38
|
+
import dataService from '../apiService/simpleDataService'
|
|
39
|
+
import { Tabs as TTabs, Select as TSelect, Tooltip as TTooltip, RadioGroup as TRadioGroup, RadioButton as TRadioButton } from 'tdesign-vue-next'
|
|
40
|
+
|
|
41
|
+
// 外部可双向绑定的当前区域值
|
|
42
|
+
const props = defineProps({
|
|
43
|
+
areaValue: {
|
|
44
|
+
type: [String, Number],
|
|
45
|
+
default: undefined
|
|
46
|
+
},
|
|
47
|
+
buildingValue: {
|
|
48
|
+
type: [String, Number],
|
|
49
|
+
default: undefined
|
|
50
|
+
}
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
const emit = defineEmits(['update:areaValue', 'update:buildingValue', 'roomClick'])
|
|
54
|
+
|
|
55
|
+
// 内部当前区域与楼栋(受控于 v-model)
|
|
56
|
+
const innerArea = ref(props.areaValue)
|
|
57
|
+
const innerBuilding = ref(props.buildingValue)
|
|
58
|
+
const regionList = ref([])
|
|
59
|
+
const buildingList = ref([])
|
|
60
|
+
|
|
61
|
+
watch(
|
|
62
|
+
() => props.areaValue,
|
|
63
|
+
(v) => {
|
|
64
|
+
innerArea.value = v
|
|
65
|
+
}
|
|
66
|
+
)
|
|
67
|
+
watch(
|
|
68
|
+
() => props.buildingValue,
|
|
69
|
+
(v) => {
|
|
70
|
+
innerBuilding.value = v
|
|
71
|
+
}
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
// 区域列表:直接使用接口返回的数据
|
|
75
|
+
const areaList = computed(() => regionList.value)
|
|
76
|
+
|
|
77
|
+
// 楼栋列表:直接使用接口返回的数据(已按区域过滤)
|
|
78
|
+
const buildingOptions = computed(() => buildingList.value)
|
|
79
|
+
|
|
80
|
+
watch(
|
|
81
|
+
buildingOptions,
|
|
82
|
+
(options) => {
|
|
83
|
+
if (!innerBuilding.value || !options.some((o) => o.value === innerBuilding.value)) {
|
|
84
|
+
if (options.length) innerBuilding.value = options[0].value
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
{ immediate: true }
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
// 当前楼层与房间数据(接口返回)
|
|
91
|
+
const floors = ref([])
|
|
92
|
+
const currentFloors = computed(() => floors.value)
|
|
93
|
+
|
|
94
|
+
const roomPercent = (room) => {
|
|
95
|
+
const total = Number(room.totalBeds || 0)
|
|
96
|
+
const occ = Number(room.occupiedBeds || 0)
|
|
97
|
+
if (!total) return 0
|
|
98
|
+
return Math.round((occ / total) * 100)
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
const roomColor = (room) => {
|
|
102
|
+
const p = roomPercent(room)
|
|
103
|
+
if (p <= 0) return '#c2c2c2'
|
|
104
|
+
if (p < 40) return '#2b71ff'
|
|
105
|
+
if (p < 80) return '#f5a623'
|
|
106
|
+
return '#ff4d4f'
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
const roomFillStyle = (room) => ({
|
|
110
|
+
height: roomPercent(room) + '%',
|
|
111
|
+
backgroundColor: roomColor(room)
|
|
112
|
+
})
|
|
113
|
+
|
|
114
|
+
const roomTooltip = (room) => {
|
|
115
|
+
const total = Number(room.totalBeds || 0)
|
|
116
|
+
const occ = Number(room.occupiedBeds || 0)
|
|
117
|
+
return `房间: ${room.roomNo} | 床位: ${total} | 已入住: ${occ}`
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
const floorKey = (floor) => String(floor.name ?? floor.floor ?? '')
|
|
121
|
+
const floorLabel = (floor) => String(floor.name ?? floor.floor ?? '') + ' 楼'
|
|
122
|
+
const roomKey = (room) => String(room.roomNo)
|
|
123
|
+
|
|
124
|
+
const emitRoomClick = (room, floor) => {
|
|
125
|
+
emit('roomClick', {
|
|
126
|
+
area: innerArea.value,
|
|
127
|
+
building: innerBuilding.value,
|
|
128
|
+
floor: floor.name ?? floor.floor,
|
|
129
|
+
roomNo: room.roomNo,
|
|
130
|
+
roomType: room.roomType,
|
|
131
|
+
roomDormType: room.roomDormType,
|
|
132
|
+
totalBeds: Number(room.totalBeds || 0),
|
|
133
|
+
occupiedBeds: Number(room.occupiedBeds || 0),
|
|
134
|
+
percent: roomPercent(room)
|
|
135
|
+
})
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// 获取楼层与房间列表(按楼栋)
|
|
139
|
+
const getFloors = () => {
|
|
140
|
+
if (!innerBuilding.value) {
|
|
141
|
+
floors.value = []
|
|
142
|
+
return
|
|
143
|
+
}
|
|
144
|
+
dataService
|
|
145
|
+
.fetch(
|
|
146
|
+
{
|
|
147
|
+
queryParams: { buildings: innerBuilding.value }
|
|
148
|
+
},
|
|
149
|
+
{ key: 'dormitory_list_remote', apiId: 2655, apiType: 0 }
|
|
150
|
+
)
|
|
151
|
+
.then((res) => {
|
|
152
|
+
const data = res.data || []
|
|
153
|
+
const dataGroup = {}
|
|
154
|
+
data.forEach((f) => {
|
|
155
|
+
const floor = f.floor ?? ''
|
|
156
|
+
if (!dataGroup[floor]) dataGroup[floor] = []
|
|
157
|
+
dataGroup[floor].push(f)
|
|
158
|
+
})
|
|
159
|
+
floors.value = Object.entries(dataGroup).map(([name, rooms]) => ({
|
|
160
|
+
name,
|
|
161
|
+
rooms: rooms.map((r) => ({
|
|
162
|
+
roomNo: String(r.room_no ?? r.name ?? ''),
|
|
163
|
+
roomType: r.type_desc ?? '',
|
|
164
|
+
roomDormType: r.dorm_type_desc ?? '',
|
|
165
|
+
totalBeds: Number(r.occupant_max_num ?? r.bed_num ?? 0),
|
|
166
|
+
occupiedBeds: Number(r.occupant_num ?? 0)
|
|
167
|
+
}))
|
|
168
|
+
}))
|
|
169
|
+
})
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
// 获取楼栋列表(按区域)
|
|
173
|
+
const getBuildings = () => {
|
|
174
|
+
if (!innerArea.value) {
|
|
175
|
+
buildingList.value = []
|
|
176
|
+
return
|
|
177
|
+
}
|
|
178
|
+
dataService
|
|
179
|
+
.fetch(
|
|
180
|
+
{
|
|
181
|
+
queryParams: { region_id: innerArea.value }
|
|
182
|
+
},
|
|
183
|
+
{ key: 'dormitory_remote_buildings', apiId: 2617, apiType: 0 }
|
|
184
|
+
)
|
|
185
|
+
.then((res) => {
|
|
186
|
+
buildingList.value = (res.data || [])
|
|
187
|
+
.sort((a, b) => a.id - b.id)
|
|
188
|
+
.map((item) => ({ label: item.name, value: item.id }))
|
|
189
|
+
if (!innerBuilding.value || !buildingList.value.some((b) => b.value === innerBuilding.value)) {
|
|
190
|
+
innerBuilding.value = buildingList.value[0]?.value
|
|
191
|
+
}
|
|
192
|
+
getFloors()
|
|
193
|
+
})
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
// 获取区域列表
|
|
197
|
+
const getRegion = () => {
|
|
198
|
+
dataService.fetch({}, { key: 'dormitory_buildings_remote_region', apiId: 2596, apiType: 0 }).then((res) => {
|
|
199
|
+
regionList.value = (res.data || [])
|
|
200
|
+
.sort((a, b) => a.id - b.id)
|
|
201
|
+
.map((item) => ({ label: item.name, value: item.id }))
|
|
202
|
+
if (!innerArea.value && regionList.value.length) innerArea.value = regionList.value[0].value
|
|
203
|
+
getBuildings()
|
|
204
|
+
})
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
const onAreaChange = (v) => {
|
|
208
|
+
console.log('onAreaChange', v)
|
|
209
|
+
innerArea.value = v
|
|
210
|
+
emit('update:areaValue', v)
|
|
211
|
+
getBuildings()
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
const onBuildingChange = (v) => {
|
|
215
|
+
innerBuilding.value = v
|
|
216
|
+
emit('update:buildingValue', v)
|
|
217
|
+
getFloors()
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
// 初始化:拉取区域 → 楼栋 → 楼层
|
|
221
|
+
onMounted(() => {
|
|
222
|
+
getRegion()
|
|
223
|
+
})
|
|
224
|
+
</script>
|
|
225
|
+
|
|
226
|
+
<style lang="less" scoped>
|
|
227
|
+
.ebiz-dorm-dashboard {
|
|
228
|
+
display: flex;
|
|
229
|
+
flex-direction: column;
|
|
230
|
+
gap: 12px;
|
|
231
|
+
}
|
|
232
|
+
.dashboard-header {
|
|
233
|
+
display: flex;
|
|
234
|
+
align-items: flex-end;
|
|
235
|
+
gap: 20px;
|
|
236
|
+
}
|
|
237
|
+
.building-select {
|
|
238
|
+
width: 150px;
|
|
239
|
+
}
|
|
240
|
+
.dashboard-grid {
|
|
241
|
+
display: flex;
|
|
242
|
+
flex-direction: column;
|
|
243
|
+
gap: 5px;
|
|
244
|
+
}
|
|
245
|
+
.floor-block {
|
|
246
|
+
display: flex;
|
|
247
|
+
gap: 8px;
|
|
248
|
+
border: 1px solid #eee;
|
|
249
|
+
border-radius: 12px;
|
|
250
|
+
background: #fff;
|
|
251
|
+
padding: 12px;
|
|
252
|
+
transition: all 0.2s ease;
|
|
253
|
+
cursor: pointer;
|
|
254
|
+
}
|
|
255
|
+
.floor-block:hover {
|
|
256
|
+
box-shadow: 0 0 8px rgba(0, 0, 0, 0.1);
|
|
257
|
+
}
|
|
258
|
+
.floor-title {
|
|
259
|
+
font-weight: 500;
|
|
260
|
+
white-space: nowrap;
|
|
261
|
+
margin-top: 10px;
|
|
262
|
+
}
|
|
263
|
+
.rooms-grid {
|
|
264
|
+
width: calc(100% - 30px);
|
|
265
|
+
display: grid;
|
|
266
|
+
grid-template-columns: repeat(auto-fill, 50px);
|
|
267
|
+
gap: 28px;
|
|
268
|
+
}
|
|
269
|
+
.room-item {
|
|
270
|
+
display: flex;
|
|
271
|
+
flex-direction: column;
|
|
272
|
+
cursor: pointer;
|
|
273
|
+
}
|
|
274
|
+
.room-card {
|
|
275
|
+
position: relative;
|
|
276
|
+
height: 80px;
|
|
277
|
+
border-radius: 8px;
|
|
278
|
+
background: #f0f0f0;
|
|
279
|
+
overflow: hidden;
|
|
280
|
+
display: flex;
|
|
281
|
+
align-items: flex-end;
|
|
282
|
+
justify-content: center;
|
|
283
|
+
}
|
|
284
|
+
.room-card-fill {
|
|
285
|
+
position: absolute;
|
|
286
|
+
left: 0;
|
|
287
|
+
right: 0;
|
|
288
|
+
bottom: 0;
|
|
289
|
+
}
|
|
290
|
+
.room-percent {
|
|
291
|
+
position: relative;
|
|
292
|
+
bottom: 8px;
|
|
293
|
+
z-index: 1;
|
|
294
|
+
color: #fff;
|
|
295
|
+
font-weight: 600;
|
|
296
|
+
display: none;
|
|
297
|
+
}
|
|
298
|
+
.room-no {
|
|
299
|
+
margin-top: 4px;
|
|
300
|
+
font-size: 13px;
|
|
301
|
+
line-height: 1;
|
|
302
|
+
font-weight: 600;
|
|
303
|
+
color: #333;
|
|
304
|
+
text-align: center;
|
|
305
|
+
}
|
|
306
|
+
.room-type {
|
|
307
|
+
margin-top: 2px;
|
|
308
|
+
font-size: 10px;
|
|
309
|
+
line-height: 1;
|
|
310
|
+
color: #666;
|
|
311
|
+
text-align: center;
|
|
312
|
+
white-space: nowrap;
|
|
313
|
+
}
|
|
314
|
+
</style>
|