Commit 75d71b6d593041c965d74d4c59cc9c3c32fe1a26
1 parent
6401f7ce
perf: DEFECT-809 refactor configuration center page
Showing
5 changed files
with
454 additions
and
202 deletions
1 | 1 | import { defHttp } from '/@/utils/http/axios'; |
2 | 2 | import type { |
3 | 3 | queryPageParams, |
4 | - ConfigurationModal, | |
5 | 4 | ConfigurationCenterParams, |
6 | 5 | ConfigurationCenterInfo, |
6 | + ConfigurationCenterItemsModal, | |
7 | 7 | } from './model/configurationCenterModal'; |
8 | 8 | import { getPageData } from '../../base'; |
9 | 9 | enum API { |
... | ... | @@ -11,7 +11,7 @@ enum API { |
11 | 11 | } |
12 | 12 | |
13 | 13 | export const getPage = (params: queryPageParams) => { |
14 | - return getPageData<ConfigurationModal>(params, API.basicUrl); | |
14 | + return getPageData<ConfigurationCenterItemsModal>(params, API.basicUrl); | |
15 | 15 | }; |
16 | 16 | |
17 | 17 | export const saveConfigurationCenter = (params: ConfigurationCenterParams) => { | ... | ... |
1 | 1 | import { BasicPageParams } from '/@/api/model/baseModel'; |
2 | -import { ContactParams } from '/@/api/alarm/contact/model/alarmContactModal'; | |
3 | 2 | |
4 | -interface ConfigurationCenterItemsModal { | |
3 | +export interface ConfigurationCenterItemsModal { | |
5 | 4 | id: string; |
6 | 5 | name: string; |
7 | 6 | createTime: string; |
8 | 7 | creator: string; |
9 | 8 | remark: string; |
10 | 9 | } |
11 | -export type queryPageParams = BasicPageParams & { name: string; organizationId: string }; | |
10 | +export type queryPageParams = BasicPageParams & { | |
11 | + name?: Nullable<string>; | |
12 | + organizationId?: Nullable<number>; | |
13 | +}; | |
12 | 14 | |
13 | 15 | export interface ConfigurationModal { |
14 | 16 | items: ConfigurationCenterItemsModal[]; | ... | ... |
src/views/configuration/center/CardMode.vue
deleted
100644 → 0
1 | -<script setup lang="ts"> | |
2 | - import {} from '/@/components/'; | |
3 | -</script> | |
4 | - | |
5 | -<template> | |
6 | - <CardList :params="params" :api="demoListApi" @get-method="getMethod" @delete="handleDel"> | |
7 | - <template #header> | |
8 | - <Button type="primary" color="error"> 按钮1 </Button> | |
9 | - <Button type="primary" color="success"> 按钮2 </Button> | |
10 | - </template> | |
11 | - </CardList> | |
12 | -</template> |
src/views/configuration/center/TableMode.vue
0 → 100644
1 | +<template> | |
2 | + <div> | |
3 | + <PageWrapper dense contentFullHeight contentClass="flex"> | |
4 | + <OrganizationIdTree @select="handleSelect" ref="organizationIdTreeRef" /> | |
5 | + <BasicTable | |
6 | + style="flex: auto" | |
7 | + :clickToRowSelect="false" | |
8 | + @register="registerTable" | |
9 | + :searchInfo="searchInfo" | |
10 | + class="w-3/4 xl:w-4/5" | |
11 | + > | |
12 | + <template #platform="{ record }"> | |
13 | + <Tag :color="record.platform === Platform.PHONE ? 'cyan' : 'blue'"> | |
14 | + {{ record.platform === Platform.PHONE ? '移动端' : 'PC端' }} | |
15 | + </Tag> | |
16 | + </template> | |
17 | + <template #toolbar> | |
18 | + <Authority value="api:yt:configuration:center:post"> | |
19 | + <a-button type="primary" @click="handleCreateOrEdit(null)"> 新增组态 </a-button> | |
20 | + </Authority> | |
21 | + <Authority value="api:yt:configuration:center:delete"> | |
22 | + <Popconfirm | |
23 | + title="您确定要批量删除数据" | |
24 | + ok-text="确定" | |
25 | + cancel-text="取消" | |
26 | + @confirm="handleDeleteOrBatchDelete(null)" | |
27 | + > | |
28 | + <a-button type="primary" color="error" :disabled="hasBatchDelete"> | |
29 | + 批量删除 | |
30 | + </a-button> | |
31 | + </Popconfirm> | |
32 | + </Authority> | |
33 | + </template> | |
34 | + <template #action="{ record }"> | |
35 | + <TableAction | |
36 | + :actions="[ | |
37 | + { | |
38 | + label: '设计', | |
39 | + auth: 'api:yt:configuration:center:get_configuration_info:get', | |
40 | + icon: 'clarity:note-edit-line', | |
41 | + onClick: handleDesign.bind(null, record), | |
42 | + }, | |
43 | + { | |
44 | + label: '预览', | |
45 | + auth: 'api:yt:configuration:center:get_configuration_info:get', | |
46 | + icon: 'ant-design:eye-outlined', | |
47 | + onClick: handlePreview.bind(null, record), | |
48 | + }, | |
49 | + { | |
50 | + label: '编辑', | |
51 | + auth: 'api:yt:configuration:center:update', | |
52 | + icon: 'clarity:note-edit-line', | |
53 | + onClick: handleCreateOrEdit.bind(null, record), | |
54 | + }, | |
55 | + { | |
56 | + label: '删除', | |
57 | + auth: 'api:yt:configuration:center:delete', | |
58 | + icon: 'ant-design:delete-outlined', | |
59 | + color: 'error', | |
60 | + popConfirm: { | |
61 | + title: '是否确认删除', | |
62 | + confirm: handleDeleteOrBatchDelete.bind(null, record), | |
63 | + }, | |
64 | + }, | |
65 | + ]" | |
66 | + /> | |
67 | + </template> | |
68 | + </BasicTable> | |
69 | + </PageWrapper> | |
70 | + <ContactDrawer @register="registerDrawer" @success="handleSuccess" /> | |
71 | + </div> | |
72 | +</template> | |
73 | + | |
74 | +<script lang="ts"> | |
75 | + import { defineComponent, reactive, nextTick } from 'vue'; | |
76 | + import { BasicTable, useTable, TableAction } from '/@/components/Table'; | |
77 | + import { PageWrapper } from '/@/components/Page'; | |
78 | + import { useDrawer } from '/@/components/Drawer'; | |
79 | + import ContactDrawer from './ConfigurationCenterDrawer.vue'; | |
80 | + import { useResetOrganizationTree, OrganizationIdTree } from '/@/views/common/organizationIdTree'; | |
81 | + import { searchFormSchema, columns, Platform } from './center.data'; | |
82 | + import { | |
83 | + getPage, | |
84 | + deleteConfigurationCenter, | |
85 | + } from '/@/api/configuration/center/configurationCenter'; | |
86 | + import { useBatchDelete } from '/@/hooks/web/useBatchDelete'; | |
87 | + import { getAppEnvConfig, isDevMode } from '/@/utils/env'; | |
88 | + import { Authority } from '/@/components/Authority'; | |
89 | + import { Popconfirm } from 'ant-design-vue'; | |
90 | + import { Tag } from 'ant-design-vue'; | |
91 | + export default defineComponent({ | |
92 | + components: { | |
93 | + PageWrapper, | |
94 | + OrganizationIdTree, | |
95 | + BasicTable, | |
96 | + TableAction, | |
97 | + ContactDrawer, | |
98 | + Authority, | |
99 | + Popconfirm, | |
100 | + Tag, | |
101 | + }, | |
102 | + setup() { | |
103 | + const { VITE_GLOB_CONFIGURATION } = getAppEnvConfig(); | |
104 | + const isDev = isDevMode(); | |
105 | + const searchInfo = reactive<Recordable>({}); | |
106 | + const { organizationIdTreeRef, resetFn } = useResetOrganizationTree(searchInfo); | |
107 | + // 表格hooks | |
108 | + const [registerTable, { reload, setProps }] = useTable({ | |
109 | + title: '组态中心列表', | |
110 | + api: getPage, | |
111 | + columns, | |
112 | + clickToRowSelect: false, | |
113 | + formConfig: { | |
114 | + labelWidth: 120, | |
115 | + schemas: searchFormSchema, | |
116 | + resetFunc: resetFn, | |
117 | + }, | |
118 | + showIndexColumn: false, | |
119 | + useSearchForm: true, | |
120 | + showTableSetting: true, | |
121 | + bordered: true, | |
122 | + rowKey: 'id', | |
123 | + actionColumn: { | |
124 | + width: 200, | |
125 | + title: '操作', | |
126 | + dataIndex: 'action', | |
127 | + slots: { customRender: 'action' }, | |
128 | + fixed: 'right', | |
129 | + }, | |
130 | + }); | |
131 | + const { hasBatchDelete, handleDeleteOrBatchDelete, selectionOptions } = useBatchDelete( | |
132 | + deleteConfigurationCenter, | |
133 | + handleSuccess, | |
134 | + setProps | |
135 | + ); | |
136 | + nextTick(() => { | |
137 | + setProps(selectionOptions); | |
138 | + }); | |
139 | + | |
140 | + // 弹框 | |
141 | + const [registerDrawer, { openDrawer }] = useDrawer(); | |
142 | + | |
143 | + // 刷新 | |
144 | + function handleSuccess() { | |
145 | + reload(); | |
146 | + } | |
147 | + // 新增或编辑 | |
148 | + const handleCreateOrEdit = (record: Recordable | null) => { | |
149 | + if (record) { | |
150 | + openDrawer(true, { | |
151 | + isUpdate: true, | |
152 | + record, | |
153 | + }); | |
154 | + } else { | |
155 | + openDrawer(true, { | |
156 | + isUpdate: false, | |
157 | + }); | |
158 | + } | |
159 | + }; | |
160 | + // 树形选择器 | |
161 | + const handleSelect = (organizationId: string) => { | |
162 | + searchInfo.organizationId = organizationId; | |
163 | + handleSuccess(); | |
164 | + }; | |
165 | + | |
166 | + const handlePreview = (record: Recordable | null) => { | |
167 | + window.open( | |
168 | + `${VITE_GLOB_CONFIGURATION}/${isDev ? '?dev=1&' : '?'}configurationId=${ | |
169 | + record!.id | |
170 | + }&lightbox=1` | |
171 | + ); | |
172 | + }; | |
173 | + const handleDesign = (record: Recordable | null) => { | |
174 | + window.open( | |
175 | + `${VITE_GLOB_CONFIGURATION}/${isDev ? '?dev=1&' : '?'}configurationId=${record!.id}` | |
176 | + ); | |
177 | + }; | |
178 | + | |
179 | + return { | |
180 | + Platform, | |
181 | + searchInfo, | |
182 | + hasBatchDelete, | |
183 | + handleCreateOrEdit, | |
184 | + handleDeleteOrBatchDelete, | |
185 | + handleSelect, | |
186 | + handleSuccess, | |
187 | + handlePreview, | |
188 | + handleDesign, | |
189 | + registerTable, | |
190 | + registerDrawer, | |
191 | + organizationIdTreeRef, | |
192 | + }; | |
193 | + }, | |
194 | + }); | |
195 | +</script> | ... | ... |
1 | -<template> | |
2 | - <div> | |
3 | - <PageWrapper dense contentFullHeight contentClass="flex"> | |
4 | - <OrganizationIdTree @select="handleSelect" ref="organizationIdTreeRef" /> | |
5 | - <BasicTable | |
6 | - style="flex: auto" | |
7 | - :clickToRowSelect="false" | |
8 | - @register="registerTable" | |
9 | - :searchInfo="searchInfo" | |
10 | - class="w-3/4 xl:w-4/5" | |
11 | - > | |
12 | - <template #platform="{ record }"> | |
13 | - <Tag :color="record.platform === Platform.PHONE ? 'cyan' : 'blue'"> | |
14 | - {{ record.platform === Platform.PHONE ? '移动端' : 'PC端' }} | |
15 | - </Tag> | |
16 | - </template> | |
17 | - <template #toolbar> | |
18 | - <Authority value="api:yt:configuration:center:post"> | |
19 | - <a-button type="primary" @click="handleCreateOrEdit(null)"> 新增组态 </a-button> | |
20 | - </Authority> | |
21 | - <Authority value="api:yt:configuration:center:delete"> | |
22 | - <Popconfirm | |
23 | - title="您确定要批量删除数据" | |
24 | - ok-text="确定" | |
25 | - cancel-text="取消" | |
26 | - @confirm="handleDeleteOrBatchDelete(null)" | |
27 | - > | |
28 | - <a-button type="primary" color="error" :disabled="hasBatchDelete"> | |
29 | - 批量删除 | |
30 | - </a-button> | |
31 | - </Popconfirm> | |
32 | - </Authority> | |
33 | - </template> | |
34 | - <template #action="{ record }"> | |
35 | - <TableAction | |
36 | - :actions="[ | |
37 | - { | |
38 | - label: '设计', | |
39 | - auth: 'api:yt:configuration:center:get_configuration_info:get', | |
40 | - icon: 'clarity:note-edit-line', | |
41 | - onClick: handleDesign.bind(null, record), | |
42 | - }, | |
43 | - { | |
44 | - label: '预览', | |
45 | - auth: 'api:yt:configuration:center:get_configuration_info:get', | |
46 | - icon: 'ant-design:eye-outlined', | |
47 | - onClick: handlePreview.bind(null, record), | |
48 | - }, | |
49 | - { | |
50 | - label: '编辑', | |
51 | - auth: 'api:yt:configuration:center:update', | |
52 | - icon: 'clarity:note-edit-line', | |
53 | - onClick: handleCreateOrEdit.bind(null, record), | |
54 | - }, | |
55 | - { | |
56 | - label: '删除', | |
57 | - auth: 'api:yt:configuration:center:delete', | |
58 | - icon: 'ant-design:delete-outlined', | |
59 | - color: 'error', | |
60 | - popConfirm: { | |
61 | - title: '是否确认删除', | |
62 | - confirm: handleDeleteOrBatchDelete.bind(null, record), | |
63 | - }, | |
64 | - }, | |
65 | - ]" | |
66 | - /> | |
67 | - </template> | |
68 | - </BasicTable> | |
69 | - </PageWrapper> | |
70 | - <ContactDrawer @register="registerDrawer" @success="handleSuccess" /> | |
71 | - </div> | |
72 | -</template> | |
73 | - | |
74 | -<script lang="ts"> | |
75 | - import { defineComponent, reactive, nextTick } from 'vue'; | |
76 | - import { BasicTable, useTable, TableAction } from '/@/components/Table'; | |
77 | - import { PageWrapper } from '/@/components/Page'; | |
78 | - import { useDrawer } from '/@/components/Drawer'; | |
79 | - import ContactDrawer from './ConfigurationCenterDrawer.vue'; | |
80 | - import { useResetOrganizationTree, OrganizationIdTree } from '/@/views/common/organizationIdTree'; | |
81 | - import { searchFormSchema, columns, Platform } from './center.data'; | |
1 | +<script setup lang="ts"> | |
2 | + import { List, Card, Button, PaginationProps, Popover, Slider, Tooltip } from 'ant-design-vue'; | |
3 | + import { | |
4 | + ReloadOutlined, | |
5 | + AppstoreOutlined, | |
6 | + EyeOutlined, | |
7 | + EditOutlined, | |
8 | + EllipsisOutlined, | |
9 | + } from '@ant-design/icons-vue'; | |
10 | + import { onMounted, reactive, ref, unref } from 'vue'; | |
11 | + import { OrganizationIdTree, useResetOrganizationTree } from '../../common/organizationIdTree'; | |
82 | 12 | import { |
83 | - getPage, | |
84 | 13 | deleteConfigurationCenter, |
14 | + getPage, | |
85 | 15 | } from '/@/api/configuration/center/configurationCenter'; |
86 | - import { useBatchDelete } from '/@/hooks/web/useBatchDelete'; | |
87 | - import { getAppEnvConfig, isDevMode } from '/@/utils/env'; | |
16 | + import { ConfigurationCenterItemsModal } from '/@/api/configuration/center/model/configurationCenterModal'; | |
17 | + import { PageWrapper } from '/@/components/Page'; | |
18 | + import { Dropdown } from '/@/components/Dropdown'; | |
19 | + import { BasicForm, useForm } from '/@/components/Form'; | |
20 | + import { searchFormSchema } from './center.data'; | |
21 | + import { useMessage } from '/@/hooks/web/useMessage'; | |
88 | 22 | import { Authority } from '/@/components/Authority'; |
89 | - import { Popconfirm } from 'ant-design-vue'; | |
90 | - import { Tag } from 'ant-design-vue'; | |
91 | - export default defineComponent({ | |
92 | - components: { | |
93 | - PageWrapper, | |
94 | - OrganizationIdTree, | |
95 | - BasicTable, | |
96 | - TableAction, | |
97 | - ContactDrawer, | |
98 | - Authority, | |
99 | - Popconfirm, | |
100 | - Tag, | |
23 | + import { isDevMode } from '/@/utils/env'; | |
24 | + import ConfigurationCenterDrawer from './ConfigurationCenterDrawer.vue'; | |
25 | + import { useDrawer } from '/@/components/Drawer'; | |
26 | + import { useSyncConfirm } from '/@/hooks/component/useSyncConfirm'; | |
27 | + import { getBoundingClientRect } from '/@/utils/domUtils'; | |
28 | + | |
29 | + const listColumn = ref(4); | |
30 | + | |
31 | + const { createMessage } = useMessage(); | |
32 | + | |
33 | + const organizationId = ref<Nullable<number>>(null); | |
34 | + | |
35 | + const pagination = reactive<PaginationProps>({ | |
36 | + size: 'small', | |
37 | + showTotal: (total: number) => `共 ${total} 条数据`, | |
38 | + current: 1, | |
39 | + onChange: (page: number) => { | |
40 | + pagination.current = page; | |
41 | + getListData(); | |
42 | + }, | |
43 | + }); | |
44 | + | |
45 | + const loading = ref(false); | |
46 | + | |
47 | + const dataSource = ref<ConfigurationCenterItemsModal[]>([]); | |
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(); | |
101 | 58 | }, |
102 | - setup() { | |
103 | - const { VITE_GLOB_CONFIGURATION } = getAppEnvConfig(); | |
104 | - const isDev = isDevMode(); | |
105 | - const searchInfo = reactive<Recordable>({}); | |
106 | - const { organizationIdTreeRef, resetFn } = useResetOrganizationTree(searchInfo); | |
107 | - // 表格hooks | |
108 | - const [registerTable, { reload, setProps }] = useTable({ | |
109 | - title: '组态中心列表', | |
110 | - api: getPage, | |
111 | - columns, | |
112 | - clickToRowSelect: false, | |
113 | - formConfig: { | |
114 | - labelWidth: 120, | |
115 | - schemas: searchFormSchema, | |
116 | - resetFunc: resetFn, | |
117 | - }, | |
118 | - showIndexColumn: false, | |
119 | - useSearchForm: true, | |
120 | - showTableSetting: true, | |
121 | - bordered: true, | |
122 | - rowKey: 'id', | |
123 | - actionColumn: { | |
124 | - width: 200, | |
125 | - title: '操作', | |
126 | - dataIndex: 'action', | |
127 | - slots: { customRender: 'action' }, | |
128 | - fixed: 'right', | |
129 | - }, | |
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 = 4 * unref(listColumn); | |
69 | + const { items, total } = await getPage({ | |
70 | + organizationId: unref(organizationId), | |
71 | + ...value, | |
72 | + page: pagination.current!, | |
73 | + pageSize, | |
74 | + }); | |
75 | + dataSource.value = items; | |
76 | + pagination.total = total; | |
77 | + pagination.pageSize = 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 handleCreateOrUpdate = (record?: ConfigurationCenterItemsModal) => { | |
98 | + if (record) { | |
99 | + openDrawer(true, { | |
100 | + isUpdate: true, | |
101 | + record, | |
130 | 102 | }); |
131 | - const { hasBatchDelete, handleDeleteOrBatchDelete, selectionOptions } = useBatchDelete( | |
132 | - deleteConfigurationCenter, | |
133 | - handleSuccess, | |
134 | - setProps | |
135 | - ); | |
136 | - nextTick(() => { | |
137 | - setProps(selectionOptions); | |
103 | + } else { | |
104 | + openDrawer(true, { | |
105 | + isUpdate: false, | |
138 | 106 | }); |
107 | + } | |
108 | + }; | |
139 | 109 | |
140 | - // 弹框 | |
141 | - const [registerDrawer, { openDrawer }] = useDrawer(); | |
142 | - | |
143 | - // 刷新 | |
144 | - function handleSuccess() { | |
145 | - reload(); | |
146 | - } | |
147 | - // 新增或编辑 | |
148 | - const handleCreateOrEdit = (record: Recordable | null) => { | |
149 | - if (record) { | |
150 | - openDrawer(true, { | |
151 | - isUpdate: true, | |
152 | - record, | |
153 | - }); | |
154 | - } else { | |
155 | - openDrawer(true, { | |
156 | - isUpdate: false, | |
157 | - }); | |
158 | - } | |
159 | - }; | |
160 | - // 树形选择器 | |
161 | - const handleSelect = (organizationId: string) => { | |
162 | - searchInfo.organizationId = organizationId; | |
163 | - handleSuccess(); | |
164 | - }; | |
165 | - | |
166 | - const handlePreview = (record: Recordable | null) => { | |
167 | - window.open( | |
168 | - `${VITE_GLOB_CONFIGURATION}/${isDev ? '?dev=1&' : '?'}configurationId=${ | |
169 | - record!.id | |
170 | - }&lightbox=1` | |
171 | - ); | |
172 | - }; | |
173 | - const handleDesign = (record: Recordable | null) => { | |
174 | - window.open( | |
175 | - `${VITE_GLOB_CONFIGURATION}/${isDev ? '?dev=1&' : '?'}configurationId=${record!.id}` | |
176 | - ); | |
177 | - }; | |
178 | - | |
179 | - return { | |
180 | - Platform, | |
181 | - searchInfo, | |
182 | - hasBatchDelete, | |
183 | - handleCreateOrEdit, | |
184 | - handleDeleteOrBatchDelete, | |
185 | - handleSelect, | |
186 | - handleSuccess, | |
187 | - handlePreview, | |
188 | - handleDesign, | |
189 | - registerTable, | |
190 | - registerDrawer, | |
191 | - organizationIdTreeRef, | |
192 | - }; | |
193 | - }, | |
110 | + const { VITE_GLOB_CONFIGURATION } = import.meta.env; | |
111 | + const isDev = isDevMode(); | |
112 | + | |
113 | + const handlePreview = (record: ConfigurationCenterItemsModal) => { | |
114 | + console.log(record); | |
115 | + window.open( | |
116 | + `${VITE_GLOB_CONFIGURATION}/${isDev ? '?dev=1&' : '?'}configurationId=${ | |
117 | + record!.id | |
118 | + }&lightbox=1` | |
119 | + ); | |
120 | + }; | |
121 | + | |
122 | + const handleDesign = (record: ConfigurationCenterItemsModal) => { | |
123 | + window.open( | |
124 | + `${VITE_GLOB_CONFIGURATION}/${isDev ? '?dev=1&' : '?'}configurationId=${record!.id}` | |
125 | + ); | |
126 | + }; | |
127 | + | |
128 | + const { createSyncConfirm } = useSyncConfirm(); | |
129 | + const handleDelete = async (record: ConfigurationCenterItemsModal) => { | |
130 | + try { | |
131 | + await createSyncConfirm({ iconType: 'warning', content: '是否确认删除操作?' }); | |
132 | + await deleteConfigurationCenter([record.id]); | |
133 | + createMessage.success('删除成功'); | |
134 | + await getListData(); | |
135 | + } catch (error) {} | |
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 | + const paginationHeight = 24 + 24; | |
144 | + const listContainerMarginBottom = 16 + 8 + 32 + 20; | |
145 | + const listContainerHeight = | |
146 | + clientHeight - rect.top - paginationHeight - listContainerMarginBottom; | |
147 | + const listContainerEl = (unref(listEl)!.$el as HTMLElement).querySelector( | |
148 | + '.ant-spin-container' | |
149 | + ) as HTMLElement; | |
150 | + listContainerEl && | |
151 | + (listContainerEl.style.height = listContainerHeight + 'px') && | |
152 | + (listContainerEl.style.overflowY = 'auto') && | |
153 | + (listContainerEl.style.overflowX = 'hidden'); | |
194 | 154 | }); |
195 | 155 | </script> |
156 | + | |
157 | +<template> | |
158 | + <PageWrapper dense contentFullHeight contentClass="flex"> | |
159 | + <OrganizationIdTree @select="handleSelect" ref="organizationIdTreeRef" /> | |
160 | + <section class="flex-auto pl-9 p-4 configuration-list"> | |
161 | + <div class="flex-auto w-full bg-light-50 dark:bg-dark-900 p-4"> | |
162 | + <BasicForm @register="registerForm" /> | |
163 | + </div> | |
164 | + <List | |
165 | + ref="listEl" | |
166 | + :loading="loading" | |
167 | + class="flex-auto bg-light-50 dark:bg-dark-900 !p-2 !mt-4" | |
168 | + position="bottom" | |
169 | + :pagination="pagination" | |
170 | + :data-source="dataSource" | |
171 | + :grid="{ gutter: 4, column: listColumn }" | |
172 | + > | |
173 | + <template #header> | |
174 | + <div class="flex gap-3 justify-end"> | |
175 | + <Button type="primary" @click="handleCreateOrUpdate()">新增组态</Button> | |
176 | + <Popover :trigger="['hover']"> | |
177 | + <template #content> | |
178 | + <div class="w-40"> | |
179 | + <Slider | |
180 | + v-model:value="listColumn" | |
181 | + :max="12" | |
182 | + :min="4" | |
183 | + :marks="{ 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9, 10: 10, 11: 11, 12: 12 }" | |
184 | + @change="getListData" | |
185 | + /> | |
186 | + </div> | |
187 | + </template> | |
188 | + <Button type="primary"> | |
189 | + <AppstoreOutlined /> | |
190 | + </Button> | |
191 | + </Popover> | |
192 | + <Button type="primary" @click="getListData"> | |
193 | + <ReloadOutlined @click="getListData" /> | |
194 | + </Button> | |
195 | + </div> | |
196 | + </template> | |
197 | + <template #renderItem="{ item }"> | |
198 | + <List.Item> | |
199 | + <Card hoverable> | |
200 | + <template #cover> | |
201 | + <img | |
202 | + alt="example" | |
203 | + src="https://gw.alipayobjects.com/zos/rmsportal/JiqGstEfoWAOHiTxclqi.png" | |
204 | + /> | |
205 | + </template> | |
206 | + <template class="ant-card-actions" #actions> | |
207 | + <Authority value="api:yt:configuration:center:get_configuration_info:get"> | |
208 | + <Tooltip title="预览"> | |
209 | + <EyeOutlined key="setting" @click="handlePreview(item)" /> | |
210 | + </Tooltip> | |
211 | + </Authority> | |
212 | + <Authority value="api:yt:configuration:center:update"> | |
213 | + <Tooltip title="编辑"> | |
214 | + <EditOutlined key="edit" @click="handleCreateOrUpdate(item)" /> | |
215 | + </Tooltip> | |
216 | + </Authority> | |
217 | + <Dropdown | |
218 | + :dropMenuList="[ | |
219 | + { | |
220 | + text: '设计', | |
221 | + auth: 'api:yt:configuration:center:get_configuration_info:get', | |
222 | + icon: 'clarity:note-edit-line', | |
223 | + onClick: handleDesign.bind(null, item), | |
224 | + }, | |
225 | + { | |
226 | + text: '删除', | |
227 | + auth: 'api:yt:configuration:center:delete', | |
228 | + icon: 'ant-design:delete-outlined', | |
229 | + color: 'error', | |
230 | + onClick: handleDelete.bind(null, item), | |
231 | + }, | |
232 | + ]" | |
233 | + :trigger="['hover']" | |
234 | + > | |
235 | + <EllipsisOutlined key="ellipsis" /> | |
236 | + </Dropdown> | |
237 | + </template> | |
238 | + <Card.Meta :title="item.name"> | |
239 | + <template #description> | |
240 | + <div class="truncate">{{ item.organizationDTO.name }}</div> | |
241 | + <div class="truncate">{{ item.remark }} </div> | |
242 | + </template> | |
243 | + </Card.Meta> | |
244 | + </Card> | |
245 | + </List.Item> | |
246 | + </template> | |
247 | + </List> | |
248 | + </section> | |
249 | + <ConfigurationCenterDrawer @register="registerDrawer" @success="getListData" /> | |
250 | + </PageWrapper> | |
251 | +</template> | |
252 | + | |
253 | +<style lang="less" scoped> | |
254 | + .configuration-list:deep(.ant-list-header) { | |
255 | + border-bottom: none !important; | |
256 | + } | |
257 | + | |
258 | + .configuration-list:deep(.ant-list-pagination) { | |
259 | + height: 24px; | |
260 | + background-color: #fff; | |
261 | + } | |
262 | +</style> | ... | ... |