1
|
|
-<script setup lang="ts">
|
2
|
|
- import { List, Card, Button, PaginationProps, Tooltip } from 'ant-design-vue';
|
3
|
|
- import { ReloadOutlined } from '@ant-design/icons-vue';
|
4
|
|
- import { onMounted, reactive, ref, unref } from 'vue';
|
5
|
|
- import { OrganizationIdTree, useResetOrganizationTree } from '../common/organizationIdTree';
|
6
|
|
- import {
|
7
|
|
- bigScreenCancelPublish,
|
8
|
|
- bigScreenPublish,
|
9
|
|
- deleteBigScreenenter,
|
10
|
|
- getPage,
|
11
|
|
- } from '/@/api/bigscreen/center/bigscreenCenter';
|
12
|
|
- import { BigScreenCenterItemsModel } from '/@/api/bigscreen/center/model/bigscreenCenterModel';
|
13
|
|
- import { PageWrapper } from '/@/components/Page';
|
14
|
|
- import { BasicForm, useForm } from '/@/components/Form';
|
15
|
|
- import { ConfigurationPermission, searchFormSchema } from './config';
|
16
|
|
- import { useMessage } from '/@/hooks/web/useMessage';
|
17
|
|
- import { Authority } from '/@/components/Authority';
|
18
|
|
- import ConfigurationCenterDrawer from './BigScreenDrawer.vue';
|
19
|
|
- import { useDrawer } from '/@/components/Drawer';
|
20
|
|
- import { getBoundingClientRect } from '/@/utils/domUtils';
|
21
|
|
- import configurationSrc from '/@/assets/icons/configuration.svg';
|
22
|
|
- import { cloneDeep } from 'lodash';
|
23
|
|
- import { useGlobSetting } from '/@/hooks/setting';
|
24
|
|
- import { AuthIcon, CardLayoutButton } from '/@/components/Widget';
|
25
|
|
- import AuthDropDown from '/@/components/Widget/AuthDropDown.vue';
|
26
|
|
- import { PublicApiDrawer } from './publicApi/index';
|
27
|
|
-
|
28
|
|
- const listColumn = ref(5);
|
29
|
|
-
|
30
|
|
- const { createMessage } = useMessage();
|
31
|
|
-
|
32
|
|
- const organizationId = ref<Nullable<number>>(null);
|
33
|
|
-
|
34
|
|
- const pagination = reactive<PaginationProps>({
|
35
|
|
- size: 'small',
|
36
|
|
- showTotal: (total: number) => `共 ${total} 条数据`,
|
37
|
|
- current: 1,
|
38
|
|
- pageSize: unref(listColumn) * 2,
|
39
|
|
- onChange: (page: number) => {
|
40
|
|
- pagination.current = page;
|
41
|
|
- getListData();
|
42
|
|
- },
|
43
|
|
- });
|
44
|
|
-
|
45
|
|
- const loading = ref(false);
|
46
|
|
-
|
47
|
|
- const dataSource = ref<BigScreenCenterItemsModel[]>([]);
|
48
|
|
-
|
49
|
|
- const [registerForm, { getFieldsValue }] = useForm({
|
50
|
|
- schemas: searchFormSchema,
|
51
|
|
- showAdvancedButton: true,
|
52
|
|
- labelWidth: 100,
|
53
|
|
- compact: true,
|
54
|
|
- resetFunc: () => {
|
55
|
|
- resetFn();
|
56
|
|
- organizationId.value = null;
|
57
|
|
- return getListData();
|
58
|
|
- },
|
59
|
|
- submitFunc: async () => {
|
60
|
|
- const value = getFieldsValue();
|
61
|
|
- getListData(value);
|
62
|
|
- },
|
63
|
|
- });
|
64
|
|
-
|
65
|
|
- async function getListData(value: Recordable = {}) {
|
66
|
|
- try {
|
67
|
|
- loading.value = true;
|
68
|
|
- const pageSize = unref(listColumn) * 2;
|
69
|
|
- const { items, total } = await getPage({
|
70
|
|
- organizationId: unref(organizationId),
|
71
|
|
- ...value,
|
72
|
|
- page: pagination.current!,
|
73
|
|
- pageSize,
|
74
|
|
- });
|
75
|
|
-
|
76
|
|
- dataSource.value = items;
|
77
|
|
- Object.assign(pagination, { total, pageSize });
|
78
|
|
- } catch (error) {
|
79
|
|
- } finally {
|
80
|
|
- loading.value = false;
|
81
|
|
- }
|
82
|
|
- }
|
83
|
|
-
|
84
|
|
- onMounted(() => {
|
85
|
|
- getListData();
|
86
|
|
- });
|
87
|
|
-
|
88
|
|
- const searchInfo = reactive<Recordable>({});
|
89
|
|
- const { organizationIdTreeRef, resetFn } = useResetOrganizationTree(searchInfo);
|
90
|
|
- const handleSelect = (orgId: number) => {
|
91
|
|
- organizationId.value = orgId;
|
92
|
|
- getListData();
|
93
|
|
- };
|
94
|
|
-
|
95
|
|
- const [registerDrawer, { openDrawer }] = useDrawer();
|
96
|
|
-
|
97
|
|
- const [registerPublicDrawer, { openDrawer: openPublicApiDrawer }] = useDrawer();
|
98
|
|
-
|
99
|
|
- const handleCreateOrUpdate = (record?: BigScreenCenterItemsModel) => {
|
100
|
|
- if (record) {
|
101
|
|
- openDrawer(true, {
|
102
|
|
- isUpdate: true,
|
103
|
|
- record: cloneDeep(record),
|
104
|
|
- });
|
105
|
|
- } else {
|
106
|
|
- openDrawer(true, {
|
107
|
|
- isUpdate: false,
|
108
|
|
- });
|
109
|
|
- }
|
110
|
|
- };
|
111
|
|
-
|
112
|
|
- const handleCreateOrUpdatePublicApi = () => openPublicApiDrawer(true);
|
113
|
|
-
|
114
|
|
- const { largeDesignerPrefix } = useGlobSetting();
|
115
|
|
-
|
116
|
|
- const handlePreview = (record: BigScreenCenterItemsModel) => {
|
117
|
|
- window.open(`${largeDesignerPrefix}/#/chart/preview/${record.id}`);
|
118
|
|
- };
|
119
|
|
-
|
120
|
|
- const handleDesign = (record: BigScreenCenterItemsModel) => {
|
121
|
|
- if (record.state === 1) return;
|
122
|
|
- window.open(`${largeDesignerPrefix}/#/chart/home/${record.id}`);
|
123
|
|
- };
|
124
|
|
-
|
125
|
|
- const handleDelete = async (record: BigScreenCenterItemsModel) => {
|
126
|
|
- try {
|
127
|
|
- await deleteBigScreenenter([record.id]);
|
128
|
|
- createMessage.success('删除成功');
|
129
|
|
- await getListData();
|
130
|
|
- } catch (error) {}
|
131
|
|
- };
|
132
|
|
-
|
133
|
|
- const handleCardLayoutChange = () => {
|
134
|
|
- pagination.current = 1;
|
135
|
|
- getListData();
|
136
|
|
- };
|
137
|
|
-
|
138
|
|
- const listEl = ref<Nullable<ComponentElRef>>(null);
|
139
|
|
-
|
140
|
|
- onMounted(() => {
|
141
|
|
- const clientHeight = document.documentElement.clientHeight;
|
142
|
|
- const rect = getBoundingClientRect(unref(listEl)!.$el!) as DOMRect;
|
143
|
|
- // margin-top 24 height 24
|
144
|
|
- const paginationHeight = 24 + 24 + 8;
|
145
|
|
- // list pading top 8 maring-top 8 extra slot 56
|
146
|
|
- const listContainerMarginBottom = 8 + 8 + 56;
|
147
|
|
- const listContainerHeight =
|
148
|
|
- clientHeight - rect.top - paginationHeight - listContainerMarginBottom;
|
149
|
|
- const listContainerEl = (unref(listEl)!.$el as HTMLElement).querySelector(
|
150
|
|
- '.ant-spin-container'
|
151
|
|
- ) as HTMLElement;
|
152
|
|
- listContainerEl &&
|
153
|
|
- (listContainerEl.style.height = listContainerHeight + 'px') &&
|
154
|
|
- (listContainerEl.style.overflowY = 'auto') &&
|
155
|
|
- (listContainerEl.style.overflowX = 'hidden');
|
156
|
|
- });
|
157
|
|
-
|
158
|
|
- const getPublicApiListData = () => {};
|
159
|
|
-
|
160
|
|
- const handlePublish = async ({ id }) => {
|
161
|
|
- await bigScreenPublish(id);
|
162
|
|
- createMessage.success('发布成功');
|
163
|
|
- getListData();
|
164
|
|
- };
|
165
|
|
- const handleCancelPublish = async ({ id }) => {
|
166
|
|
- await bigScreenCancelPublish(id);
|
167
|
|
- createMessage.success('取消发布成功');
|
168
|
|
- getListData();
|
169
|
|
- };
|
170
|
|
-</script>
|
171
|
|
-
|
172
|
|
-<template>
|
173
|
|
- <PageWrapper dense contentFullHeight contentClass="flex">
|
174
|
|
- <OrganizationIdTree @select="handleSelect" ref="organizationIdTreeRef" />
|
175
|
|
- <section class="flex-auto p-4 w-3/4 xl:w-4/5 w-full configuration-list">
|
176
|
|
- <div class="flex-auto w-full bg-light-50 dark:bg-dark-900 p-4">
|
177
|
|
- <BasicForm @register="registerForm" />
|
178
|
|
- </div>
|
179
|
|
- <List
|
180
|
|
- ref="listEl"
|
181
|
|
- :loading="loading"
|
182
|
|
- class="flex-auto bg-light-50 dark:bg-dark-900 !p-2 !mt-4"
|
183
|
|
- position="bottom"
|
184
|
|
- :pagination="pagination"
|
185
|
|
- :data-source="dataSource"
|
186
|
|
- :grid="{ gutter: 4, column: listColumn }"
|
187
|
|
- >
|
188
|
|
- <template #header>
|
189
|
|
- <div class="flex gap-3 justify-end">
|
190
|
|
- <Authority :value="ConfigurationPermission.CREATE">
|
191
|
|
- <Button type="primary" @click="handleCreateOrUpdate()">新增大屏</Button>
|
192
|
|
- </Authority>
|
193
|
|
- <Authority :value="ConfigurationPermission.CREATE">
|
194
|
|
- <Button type="primary" @click="handleCreateOrUpdatePublicApi()">公共接口管理</Button>
|
195
|
|
- </Authority>
|
196
|
|
- <CardLayoutButton v-model:value="listColumn" @change="handleCardLayoutChange" />
|
197
|
|
- <Tooltip title="刷新">
|
198
|
|
- <Button type="primary" @click="getListData">
|
199
|
|
- <ReloadOutlined />
|
200
|
|
- </Button>
|
201
|
|
- </Tooltip>
|
202
|
|
- </div>
|
203
|
|
- </template>
|
204
|
|
- <template #renderItem="{ item }">
|
205
|
|
- <List.Item>
|
206
|
|
- <Card>
|
207
|
|
- <template #cover>
|
208
|
|
- <div class="h-full w-full hover-show-modal-content">
|
209
|
|
- <img
|
210
|
|
- style="position: relative"
|
211
|
|
- class="w-full h-45 hover-show-modal"
|
212
|
|
- alt="example"
|
213
|
|
- :src="item.thumbnail || configurationSrc"
|
214
|
|
- @click="handlePreview(item)"
|
215
|
|
- />
|
216
|
|
- <div class="masker-content">
|
217
|
|
- <div class="masker-text">
|
218
|
|
- <div
|
219
|
|
- ><span>{{ item.name }}</span></div
|
220
|
|
- >
|
221
|
|
- <div>
|
222
|
|
- <span class="masker-text-org"
|
223
|
|
- >所属组织:{{ item?.organizationDTO?.name }}</span
|
224
|
|
- >
|
225
|
|
- </div>
|
226
|
|
- <div>
|
227
|
|
- <span class="masker-text-state"
|
228
|
|
- >发布状态:{{ item.state === 1 ? '已发布' : '未发布' }}</span
|
229
|
|
- >
|
230
|
|
- </div>
|
231
|
|
- </div>
|
232
|
|
- </div>
|
233
|
|
- </div>
|
234
|
|
- </template>
|
235
|
|
- <template class="ant-card-actions" #actions>
|
236
|
|
- <Tooltip title="预览">
|
237
|
|
- <AuthIcon
|
238
|
|
- class="!text-lg"
|
239
|
|
- icon="ant-design:eye-outlined"
|
240
|
|
- @click="handlePreview(item)"
|
241
|
|
- />
|
242
|
|
- </Tooltip>
|
243
|
|
- <Tooltip title="设计">
|
244
|
|
- <AuthIcon
|
245
|
|
- :class="`!text-lg ${
|
246
|
|
- item.state === 1 ? '!cursor-not-allowed !text-gray-200' : ''
|
247
|
|
- }`"
|
248
|
|
- icon="ant-design:edit-outlined"
|
249
|
|
- @click="handleDesign(item)"
|
250
|
|
- />
|
251
|
|
- </Tooltip>
|
252
|
|
- <AuthDropDown
|
253
|
|
- :dropMenuList="[
|
254
|
|
- {
|
255
|
|
- text: '发布',
|
256
|
|
- auth: ConfigurationPermission.UPDATE,
|
257
|
|
- icon: 'ant-design:node-expand-outlined',
|
258
|
|
- event: '',
|
259
|
|
- onClick: handlePublish.bind(null, item),
|
260
|
|
- disabled: item.state === 0 ? false : true,
|
261
|
|
- },
|
262
|
|
- {
|
263
|
|
- text: '取消发布',
|
264
|
|
- icon: 'ant-design:node-collapse-outlined',
|
265
|
|
- event: '',
|
266
|
|
- onClick: handleCancelPublish.bind(null, item),
|
267
|
|
- disabled: item.state === 1 ? false : true,
|
268
|
|
- },
|
269
|
|
- {
|
270
|
|
- text: '编辑',
|
271
|
|
- auth: ConfigurationPermission.UPDATE,
|
272
|
|
- icon: 'clarity:note-edit-line',
|
273
|
|
- event: '',
|
274
|
|
- onClick: handleCreateOrUpdate.bind(null, item),
|
275
|
|
- disabled: item.state === 0 ? false : true,
|
276
|
|
- },
|
277
|
|
- {
|
278
|
|
- text: '删除',
|
279
|
|
- auth: ConfigurationPermission.DELETE,
|
280
|
|
- icon: 'ant-design:delete-outlined',
|
281
|
|
- disabled: item.state === 0 ? false : true,
|
282
|
|
- event: '',
|
283
|
|
- popconfirm: {
|
284
|
|
- title: '是否确认删除操作?',
|
285
|
|
- onConfirm: handleDelete.bind(null, item),
|
286
|
|
- },
|
287
|
|
- },
|
288
|
|
- ]"
|
289
|
|
- :trigger="['hover']"
|
290
|
|
- />
|
291
|
|
- </template>
|
292
|
|
- </Card>
|
293
|
|
- </List.Item>
|
294
|
|
- </template>
|
295
|
|
- </List>
|
296
|
|
- </section>
|
297
|
|
- <ConfigurationCenterDrawer @register="registerDrawer" @success="getListData" />
|
298
|
|
- <PublicApiDrawer @register="registerPublicDrawer" @success="getPublicApiListData" />
|
299
|
|
- </PageWrapper>
|
300
|
|
-</template>
|
301
|
|
-
|
302
|
|
-<style lang="less" scoped>
|
303
|
|
- .configuration-list:deep(.ant-list-header) {
|
304
|
|
- border-bottom: none !important;
|
305
|
|
- }
|
306
|
|
-
|
307
|
|
- .configuration-list:deep(.ant-list-pagination) {
|
308
|
|
- height: 24px;
|
309
|
|
- }
|
310
|
|
-
|
311
|
|
- .configuration-list:deep(.ant-card-body) {
|
312
|
|
- padding: 16px !important;
|
313
|
|
- }
|
314
|
|
-
|
315
|
|
- .configuration-list:deep(.ant-list-empty-text) {
|
316
|
|
- @apply w-full h-full flex justify-center items-center;
|
317
|
|
- }
|
318
|
|
-
|
319
|
|
- :deep(.ant-card-body) {
|
320
|
|
- display: none;
|
321
|
|
- }
|
322
|
|
-
|
323
|
|
- .masker-content {
|
324
|
|
- opacity: 0;
|
325
|
|
- z-index: 1000;
|
326
|
|
- width: 100%;
|
327
|
|
- height: 11.25rem;
|
328
|
|
- background-color: rgba(0, 0, 0, 0.5);
|
329
|
|
- position: absolute;
|
330
|
|
- transition: opacity 0.5;
|
331
|
|
- pointer-events: none;
|
332
|
|
- top: 0;
|
333
|
|
- left: 0;
|
334
|
|
- right: 0;
|
335
|
|
- bottom: 0;
|
336
|
|
-
|
337
|
|
- .masker-text {
|
338
|
|
- color: #fff;
|
339
|
|
- font-size: 16px;
|
340
|
|
- display: flex;
|
341
|
|
- flex-direction: column;
|
342
|
|
- align-items: center;
|
343
|
|
- justify-content: center;
|
344
|
|
- line-height: 2.5rem;
|
345
|
|
- margin: 4rem 0;
|
346
|
|
-
|
347
|
|
- .masker-text-org {
|
348
|
|
- font-size: 12px;
|
349
|
|
- position: absolute;
|
350
|
|
- bottom: 0;
|
351
|
|
- left: 0.8rem;
|
352
|
|
- }
|
353
|
|
-
|
354
|
|
- .masker-text-state {
|
355
|
|
- font-size: 12px;
|
356
|
|
- position: absolute;
|
357
|
|
- bottom: 0;
|
358
|
|
- right: 0.8rem;
|
359
|
|
- }
|
360
|
|
- }
|
361
|
|
- }
|
362
|
|
-
|
363
|
|
- .hover-show-modal-content:hover > .masker-content {
|
364
|
|
- opacity: 1;
|
365
|
|
- }
|
366
|
|
-</style> |
|
1
|
+<script setup lang="ts">
|
|
2
|
+ import { List, Card, Button, PaginationProps, Tooltip } from 'ant-design-vue';
|
|
3
|
+ import { ReloadOutlined } from '@ant-design/icons-vue';
|
|
4
|
+ import { onMounted, reactive, ref, unref } from 'vue';
|
|
5
|
+ import { OrganizationIdTree, useResetOrganizationTree } from '../common/organizationIdTree';
|
|
6
|
+ import {
|
|
7
|
+ bigScreenCancelPublish,
|
|
8
|
+ bigScreenPublish,
|
|
9
|
+ deleteBigScreenenter,
|
|
10
|
+ getPage,
|
|
11
|
+ shareLargeScreen,
|
|
12
|
+ } from '/@/api/bigscreen/center/bigscreenCenter';
|
|
13
|
+ import { BigScreenCenterItemsModel } from '/@/api/bigscreen/center/model/bigscreenCenterModel';
|
|
14
|
+ import { PageWrapper } from '/@/components/Page';
|
|
15
|
+ import { BasicForm, useForm } from '/@/components/Form';
|
|
16
|
+ import { ConfigurationPermission, searchFormSchema } from './config';
|
|
17
|
+ import { useMessage } from '/@/hooks/web/useMessage';
|
|
18
|
+ import { Authority } from '/@/components/Authority';
|
|
19
|
+ import ConfigurationCenterDrawer from './BigScreenDrawer.vue';
|
|
20
|
+ import { useDrawer } from '/@/components/Drawer';
|
|
21
|
+ import { getBoundingClientRect } from '/@/utils/domUtils';
|
|
22
|
+ import configurationSrc from '/@/assets/icons/configuration.svg';
|
|
23
|
+ import { cloneDeep } from 'lodash';
|
|
24
|
+ import { useGlobSetting } from '/@/hooks/setting';
|
|
25
|
+ import { AuthIcon, CardLayoutButton } from '/@/components/Widget';
|
|
26
|
+ import AuthDropDown from '/@/components/Widget/AuthDropDown.vue';
|
|
27
|
+ import { PublicApiDrawer } from './publicApi/index';
|
|
28
|
+ import { useModal } from '/@/components/Modal';
|
|
29
|
+ import { ShareModal } from '/@/views/common/ShareModal';
|
|
30
|
+ import { ViewTypeNameEnum } from '../common/ShareModal/config';
|
|
31
|
+ import { useCopyToClipboard } from '/@/hooks/web/useCopyToClipboard';
|
|
32
|
+
|
|
33
|
+ const listColumn = ref(5);
|
|
34
|
+
|
|
35
|
+ const { createMessage } = useMessage();
|
|
36
|
+
|
|
37
|
+ const organizationId = ref<Nullable<number>>(null);
|
|
38
|
+
|
|
39
|
+ const pagination = reactive<PaginationProps>({
|
|
40
|
+ size: 'small',
|
|
41
|
+ showTotal: (total: number) => `共 ${total} 条数据`,
|
|
42
|
+ current: 1,
|
|
43
|
+ pageSize: unref(listColumn) * 2,
|
|
44
|
+ onChange: (page: number) => {
|
|
45
|
+ pagination.current = page;
|
|
46
|
+ getListData();
|
|
47
|
+ },
|
|
48
|
+ });
|
|
49
|
+
|
|
50
|
+ const loading = ref(false);
|
|
51
|
+
|
|
52
|
+ const dataSource = ref<BigScreenCenterItemsModel[]>([]);
|
|
53
|
+
|
|
54
|
+ const [registerForm, { getFieldsValue }] = useForm({
|
|
55
|
+ schemas: searchFormSchema,
|
|
56
|
+ showAdvancedButton: true,
|
|
57
|
+ labelWidth: 100,
|
|
58
|
+ compact: true,
|
|
59
|
+ resetFunc: () => {
|
|
60
|
+ resetFn();
|
|
61
|
+ organizationId.value = null;
|
|
62
|
+ return getListData();
|
|
63
|
+ },
|
|
64
|
+ submitFunc: async () => {
|
|
65
|
+ const value = getFieldsValue();
|
|
66
|
+ getListData(value);
|
|
67
|
+ },
|
|
68
|
+ });
|
|
69
|
+
|
|
70
|
+ async function getListData(value: Recordable = {}) {
|
|
71
|
+ try {
|
|
72
|
+ loading.value = true;
|
|
73
|
+ const pageSize = unref(listColumn) * 2;
|
|
74
|
+ const { items, total } = await getPage({
|
|
75
|
+ organizationId: unref(organizationId),
|
|
76
|
+ ...value,
|
|
77
|
+ page: pagination.current!,
|
|
78
|
+ pageSize,
|
|
79
|
+ });
|
|
80
|
+
|
|
81
|
+ dataSource.value = items;
|
|
82
|
+ Object.assign(pagination, { total, pageSize });
|
|
83
|
+ } catch (error) {
|
|
84
|
+ } finally {
|
|
85
|
+ loading.value = false;
|
|
86
|
+ }
|
|
87
|
+ }
|
|
88
|
+
|
|
89
|
+ onMounted(() => {
|
|
90
|
+ getListData();
|
|
91
|
+ });
|
|
92
|
+
|
|
93
|
+ const searchInfo = reactive<Recordable>({});
|
|
94
|
+ const { organizationIdTreeRef, resetFn } = useResetOrganizationTree(searchInfo);
|
|
95
|
+ const handleSelect = (orgId: number) => {
|
|
96
|
+ organizationId.value = orgId;
|
|
97
|
+ getListData();
|
|
98
|
+ };
|
|
99
|
+
|
|
100
|
+ const [registerDrawer, { openDrawer }] = useDrawer();
|
|
101
|
+
|
|
102
|
+ const [registerPublicDrawer, { openDrawer: openPublicApiDrawer }] = useDrawer();
|
|
103
|
+
|
|
104
|
+ const handleCreateOrUpdate = (record?: BigScreenCenterItemsModel) => {
|
|
105
|
+ if (record) {
|
|
106
|
+ openDrawer(true, {
|
|
107
|
+ isUpdate: true,
|
|
108
|
+ record: cloneDeep(record),
|
|
109
|
+ });
|
|
110
|
+ } else {
|
|
111
|
+ openDrawer(true, {
|
|
112
|
+ isUpdate: false,
|
|
113
|
+ });
|
|
114
|
+ }
|
|
115
|
+ };
|
|
116
|
+
|
|
117
|
+ const handleCreateOrUpdatePublicApi = () => openPublicApiDrawer(true);
|
|
118
|
+
|
|
119
|
+ const { largeDesignerPrefix } = useGlobSetting();
|
|
120
|
+
|
|
121
|
+ const handlePreview = (record: BigScreenCenterItemsModel) => {
|
|
122
|
+ window.open(`${largeDesignerPrefix}/#/chart/preview/${record.id}`);
|
|
123
|
+ };
|
|
124
|
+
|
|
125
|
+ const handleDesign = (record: BigScreenCenterItemsModel) => {
|
|
126
|
+ if (record.state === 1) return;
|
|
127
|
+ window.open(`${largeDesignerPrefix}/#/chart/home/${record.id}`);
|
|
128
|
+ };
|
|
129
|
+
|
|
130
|
+ const handleDelete = async (record: BigScreenCenterItemsModel) => {
|
|
131
|
+ try {
|
|
132
|
+ await deleteBigScreenenter([record.id]);
|
|
133
|
+ createMessage.success('删除成功');
|
|
134
|
+ await getListData();
|
|
135
|
+ } catch (error) {}
|
|
136
|
+ };
|
|
137
|
+
|
|
138
|
+ const handleCardLayoutChange = () => {
|
|
139
|
+ pagination.current = 1;
|
|
140
|
+ getListData();
|
|
141
|
+ };
|
|
142
|
+
|
|
143
|
+ const listEl = ref<Nullable<ComponentElRef>>(null);
|
|
144
|
+
|
|
145
|
+ onMounted(() => {
|
|
146
|
+ const clientHeight = document.documentElement.clientHeight;
|
|
147
|
+ const rect = getBoundingClientRect(unref(listEl)!.$el!) as DOMRect;
|
|
148
|
+ // margin-top 24 height 24
|
|
149
|
+ const paginationHeight = 24 + 24 + 8;
|
|
150
|
+ // list pading top 8 maring-top 8 extra slot 56
|
|
151
|
+ const listContainerMarginBottom = 8 + 8 + 56;
|
|
152
|
+ const listContainerHeight =
|
|
153
|
+ clientHeight - rect.top - paginationHeight - listContainerMarginBottom;
|
|
154
|
+ const listContainerEl = (unref(listEl)!.$el as HTMLElement).querySelector(
|
|
155
|
+ '.ant-spin-container'
|
|
156
|
+ ) as HTMLElement;
|
|
157
|
+ listContainerEl &&
|
|
158
|
+ (listContainerEl.style.height = listContainerHeight + 'px') &&
|
|
159
|
+ (listContainerEl.style.overflowY = 'auto') &&
|
|
160
|
+ (listContainerEl.style.overflowX = 'hidden');
|
|
161
|
+ });
|
|
162
|
+
|
|
163
|
+ const getPublicApiListData = () => {};
|
|
164
|
+
|
|
165
|
+ const [registerShareModal, { openModal }] = useModal();
|
|
166
|
+ const handleOpenShareModal = (item: BigScreenCenterItemsModel) => {
|
|
167
|
+ openModal(true, item);
|
|
168
|
+ };
|
|
169
|
+
|
|
170
|
+ const { clipboardRef, isSuccessRef } = useCopyToClipboard();
|
|
171
|
+ const handleCreateShareUrl = (record: BigScreenCenterItemsModel) => {
|
|
172
|
+ const { origin } = location;
|
|
173
|
+ const { largeDesignerPrefix } = useGlobSetting();
|
|
174
|
+ clipboardRef.value = `${origin}${largeDesignerPrefix}/#/share/preview/${record.id}/${record.publicId}`;
|
|
175
|
+ if (unref(isSuccessRef)) {
|
|
176
|
+ createMessage.success('复制成功~');
|
|
177
|
+ }
|
|
178
|
+ };
|
|
179
|
+
|
|
180
|
+ const handlePublish = async ({ id }) => {
|
|
181
|
+ await bigScreenPublish(id);
|
|
182
|
+ createMessage.success('发布成功');
|
|
183
|
+ getListData();
|
|
184
|
+ };
|
|
185
|
+ const handleCancelPublish = async ({ id }) => {
|
|
186
|
+ await bigScreenCancelPublish(id);
|
|
187
|
+ createMessage.success('取消发布成功');
|
|
188
|
+ getListData();
|
|
189
|
+ };
|
|
190
|
+</script>
|
|
191
|
+
|
|
192
|
+<template>
|
|
193
|
+ <PageWrapper dense contentFullHeight contentClass="flex">
|
|
194
|
+ <OrganizationIdTree @select="handleSelect" ref="organizationIdTreeRef" />
|
|
195
|
+ <section class="flex-auto p-4 w-3/4 xl:w-4/5 w-full configuration-list">
|
|
196
|
+ <div class="flex-auto w-full bg-light-50 dark:bg-dark-900 p-4">
|
|
197
|
+ <BasicForm @register="registerForm" />
|
|
198
|
+ </div>
|
|
199
|
+ <List
|
|
200
|
+ ref="listEl"
|
|
201
|
+ :loading="loading"
|
|
202
|
+ class="flex-auto bg-light-50 dark:bg-dark-900 !p-2 !mt-4"
|
|
203
|
+ position="bottom"
|
|
204
|
+ :pagination="pagination"
|
|
205
|
+ :data-source="dataSource"
|
|
206
|
+ :grid="{ gutter: 4, column: listColumn }"
|
|
207
|
+ >
|
|
208
|
+ <template #header>
|
|
209
|
+ <div class="flex gap-3 justify-end">
|
|
210
|
+ <Authority :value="ConfigurationPermission.CREATE">
|
|
211
|
+ <Button type="primary" @click="handleCreateOrUpdate()">新增大屏</Button>
|
|
212
|
+ </Authority>
|
|
213
|
+ <Authority :value="ConfigurationPermission.CREATE">
|
|
214
|
+ <Button type="primary" @click="handleCreateOrUpdatePublicApi()">公共接口管理</Button>
|
|
215
|
+ </Authority>
|
|
216
|
+ <CardLayoutButton v-model:value="listColumn" @change="handleCardLayoutChange" />
|
|
217
|
+ <Tooltip title="刷新">
|
|
218
|
+ <Button type="primary" @click="getListData">
|
|
219
|
+ <ReloadOutlined />
|
|
220
|
+ </Button>
|
|
221
|
+ </Tooltip>
|
|
222
|
+ </div>
|
|
223
|
+ </template>
|
|
224
|
+ <template #renderItem="{ item }">
|
|
225
|
+ <List.Item>
|
|
226
|
+ <Card class="card-container">
|
|
227
|
+ <template #cover>
|
|
228
|
+ <div class="h-full w-full relative hover-show-modal-content img-container">
|
|
229
|
+ <img
|
|
230
|
+ style="position: relative"
|
|
231
|
+ class="w-full h-45 hover-show-modal"
|
|
232
|
+ alt="example"
|
|
233
|
+ :src="item.thumbnail || configurationSrc"
|
|
234
|
+ @click="handlePreview(item)"
|
|
235
|
+ />
|
|
236
|
+ <span
|
|
237
|
+ class="absolute top-0 left-0 text-light-50 transform -rotate-45 translate-y-1"
|
|
238
|
+ >
|
|
239
|
+ {{ ViewTypeNameEnum[item.viewType] || ViewTypeNameEnum.PRIVATE_VIEW }}
|
|
240
|
+ </span>
|
|
241
|
+ <div class="masker-content">
|
|
242
|
+ <div class="masker-text">
|
|
243
|
+ <div
|
|
244
|
+ ><span>{{ item.name }}</span></div
|
|
245
|
+ >
|
|
246
|
+ <div>
|
|
247
|
+ <span class="masker-text-org"
|
|
248
|
+ >所属组织:{{ item?.organizationDTO?.name }}</span
|
|
249
|
+ >
|
|
250
|
+ </div>
|
|
251
|
+ <div>
|
|
252
|
+ <span class="masker-text-state"
|
|
253
|
+ >发布状态:{{ item.state === 1 ? '已发布' : '未发布' }}</span
|
|
254
|
+ >
|
|
255
|
+ </div>
|
|
256
|
+ </div>
|
|
257
|
+ </div>
|
|
258
|
+ </div>
|
|
259
|
+ </template>
|
|
260
|
+ <template class="ant-card-actions" #actions>
|
|
261
|
+ <Tooltip title="预览">
|
|
262
|
+ <AuthIcon
|
|
263
|
+ class="!text-lg"
|
|
264
|
+ icon="ant-design:eye-outlined"
|
|
265
|
+ @click="handlePreview(item)"
|
|
266
|
+ />
|
|
267
|
+ </Tooltip>
|
|
268
|
+ <Tooltip title="设计">
|
|
269
|
+ <AuthIcon
|
|
270
|
+ :disabled="item.state === 1"
|
|
271
|
+ icon="ant-design:edit-outlined"
|
|
272
|
+ @click="handleDesign(item)"
|
|
273
|
+ />
|
|
274
|
+ </Tooltip>
|
|
275
|
+ <Tooltip title="点击复制分享链接">
|
|
276
|
+ <AuthIcon
|
|
277
|
+ :auth="ConfigurationPermission.SHARE"
|
|
278
|
+ :disabled="!item.publicId"
|
|
279
|
+ class="!text-lg"
|
|
280
|
+ icon="ant-design:share-alt-outlined"
|
|
281
|
+ @click="handleCreateShareUrl(item)"
|
|
282
|
+ />
|
|
283
|
+ </Tooltip>
|
|
284
|
+ <AuthDropDown
|
|
285
|
+ :dropMenuList="[
|
|
286
|
+ {
|
|
287
|
+ text: '分享',
|
|
288
|
+ auth: ConfigurationPermission.SHARE,
|
|
289
|
+ icon: 'ant-design:share-alt-outlined',
|
|
290
|
+ event: '',
|
|
291
|
+ onClick: handleOpenShareModal.bind(null, item),
|
|
292
|
+ },
|
|
293
|
+ {
|
|
294
|
+ text: '发布',
|
|
295
|
+ auth: ConfigurationPermission.UPDATE,
|
|
296
|
+ icon: 'ant-design:node-expand-outlined',
|
|
297
|
+ event: '',
|
|
298
|
+ onClick: handlePublish.bind(null, item),
|
|
299
|
+ disabled: item.state === 0 ? false : true,
|
|
300
|
+ },
|
|
301
|
+ {
|
|
302
|
+ text: '取消发布',
|
|
303
|
+ icon: 'ant-design:node-collapse-outlined',
|
|
304
|
+ event: '',
|
|
305
|
+ onClick: handleCancelPublish.bind(null, item),
|
|
306
|
+ disabled: item.state === 1 ? false : true,
|
|
307
|
+ },
|
|
308
|
+ {
|
|
309
|
+ text: '编辑',
|
|
310
|
+ auth: ConfigurationPermission.UPDATE,
|
|
311
|
+ icon: 'clarity:note-edit-line',
|
|
312
|
+ event: '',
|
|
313
|
+ onClick: handleCreateOrUpdate.bind(null, item),
|
|
314
|
+ disabled: item.state === 0 ? false : true,
|
|
315
|
+ },
|
|
316
|
+ {
|
|
317
|
+ text: '删除',
|
|
318
|
+ auth: ConfigurationPermission.DELETE,
|
|
319
|
+ icon: 'ant-design:delete-outlined',
|
|
320
|
+ disabled: item.state === 0 ? false : true,
|
|
321
|
+ event: '',
|
|
322
|
+ popconfirm: {
|
|
323
|
+ title: '是否确认删除操作?',
|
|
324
|
+ onConfirm: handleDelete.bind(null, item),
|
|
325
|
+ },
|
|
326
|
+ },
|
|
327
|
+ ]"
|
|
328
|
+ :trigger="['hover']"
|
|
329
|
+ />
|
|
330
|
+ </template>
|
|
331
|
+ </Card>
|
|
332
|
+ </List.Item>
|
|
333
|
+ </template>
|
|
334
|
+ </List>
|
|
335
|
+ </section>
|
|
336
|
+ <ShareModal
|
|
337
|
+ @register="registerShareModal"
|
|
338
|
+ :shareApi="shareLargeScreen"
|
|
339
|
+ @success="getListData"
|
|
340
|
+ />
|
|
341
|
+ <ConfigurationCenterDrawer @register="registerDrawer" @success="getListData" />
|
|
342
|
+ <PublicApiDrawer @register="registerPublicDrawer" @success="getPublicApiListData" />
|
|
343
|
+ </PageWrapper>
|
|
344
|
+</template>
|
|
345
|
+
|
|
346
|
+<style lang="less" scoped>
|
|
347
|
+ .configuration-list:deep(.ant-list-header) {
|
|
348
|
+ border-bottom: none !important;
|
|
349
|
+ }
|
|
350
|
+
|
|
351
|
+ .configuration-list:deep(.ant-list-pagination) {
|
|
352
|
+ height: 24px;
|
|
353
|
+ }
|
|
354
|
+
|
|
355
|
+ .configuration-list:deep(.ant-card-body) {
|
|
356
|
+ padding: 16px !important;
|
|
357
|
+ }
|
|
358
|
+
|
|
359
|
+ .configuration-list:deep(.ant-list-empty-text) {
|
|
360
|
+ @apply w-full h-full flex justify-center items-center;
|
|
361
|
+ }
|
|
362
|
+
|
|
363
|
+ :deep(.ant-card-body) {
|
|
364
|
+ display: none;
|
|
365
|
+ }
|
|
366
|
+
|
|
367
|
+ .masker-content {
|
|
368
|
+ opacity: 0;
|
|
369
|
+ z-index: 1000;
|
|
370
|
+ width: 100%;
|
|
371
|
+ height: 11.25rem;
|
|
372
|
+ background-color: rgba(0, 0, 0, 0.5);
|
|
373
|
+ position: absolute;
|
|
374
|
+ transition: opacity 0.5;
|
|
375
|
+ pointer-events: none;
|
|
376
|
+ top: 0;
|
|
377
|
+ left: 0;
|
|
378
|
+ right: 0;
|
|
379
|
+ bottom: 0;
|
|
380
|
+
|
|
381
|
+ .masker-text {
|
|
382
|
+ color: #fff;
|
|
383
|
+ font-size: 16px;
|
|
384
|
+ display: flex;
|
|
385
|
+ flex-direction: column;
|
|
386
|
+ align-items: center;
|
|
387
|
+ justify-content: center;
|
|
388
|
+ line-height: 2.5rem;
|
|
389
|
+ margin: 4rem 0;
|
|
390
|
+
|
|
391
|
+ .masker-text-org {
|
|
392
|
+ font-size: 12px;
|
|
393
|
+ position: absolute;
|
|
394
|
+ bottom: 0;
|
|
395
|
+ left: 0.8rem;
|
|
396
|
+ }
|
|
397
|
+
|
|
398
|
+ .masker-text-state {
|
|
399
|
+ font-size: 12px;
|
|
400
|
+ position: absolute;
|
|
401
|
+ bottom: 0;
|
|
402
|
+ right: 0.8rem;
|
|
403
|
+ }
|
|
404
|
+ }
|
|
405
|
+ }
|
|
406
|
+
|
|
407
|
+ .hover-show-modal-content:hover > .masker-content {
|
|
408
|
+ opacity: 1;
|
|
409
|
+ }
|
|
410
|
+
|
|
411
|
+ .card-container {
|
|
412
|
+ // background-color: red;
|
|
413
|
+ .img-container {
|
|
414
|
+ border-top-left-radius: 80px;
|
|
415
|
+ background-color: #fff;
|
|
416
|
+
|
|
417
|
+ img {
|
|
418
|
+ border-top-left-radius: 80px;
|
|
419
|
+ }
|
|
420
|
+ }
|
|
421
|
+ }
|
|
422
|
+
|
|
423
|
+ .card-container:deep(.ant-card-cover) {
|
|
424
|
+ background-color: #2db7f5;
|
|
425
|
+ }
|
|
426
|
+</style> |
...
|
...
|
|