Showing
5 changed files
with
49 additions
and
263 deletions
@@ -4,7 +4,7 @@ import type { | @@ -4,7 +4,7 @@ import type { | ||
4 | BigScreenCenterParams, | 4 | BigScreenCenterParams, |
5 | ConfigurationCenterInfo, | 5 | ConfigurationCenterInfo, |
6 | BigScreenCenterItemsModal, | 6 | BigScreenCenterItemsModal, |
7 | -} from './model/bigscreenCenterModal'; | 7 | +} from './model/bigscreenCenterModel'; |
8 | import { getPageData } from '../../base'; | 8 | import { getPageData } from '../../base'; |
9 | import { FileUploadResponse } from '../../oem/model'; | 9 | import { FileUploadResponse } from '../../oem/model'; |
10 | enum API { | 10 | enum API { |
src/api/bigscreen/center/model/bigscreenCenterModel.ts
renamed from
src/api/bigscreen/center/model/bigscreenCenterModal.ts
1 | import { BasicPageParams } from '/@/api/model/baseModel'; | 1 | import { BasicPageParams } from '/@/api/model/baseModel'; |
2 | 2 | ||
3 | -export interface BigScreenCenterItemsModal { | 3 | +export interface BigScreenCenterItemsModel { |
4 | id: string; | 4 | id: string; |
5 | name: string; | 5 | name: string; |
6 | createTime: string; | 6 | createTime: string; |
@@ -13,7 +13,7 @@ export type queryPageParams = BasicPageParams & { | @@ -13,7 +13,7 @@ export type queryPageParams = BasicPageParams & { | ||
13 | }; | 13 | }; |
14 | 14 | ||
15 | export interface ConfigurationModal { | 15 | export interface ConfigurationModal { |
16 | - items: BigScreenCenterItemsModal[]; | 16 | + items: BigScreenCenterItemsModel[]; |
17 | total: number; | 17 | total: number; |
18 | } | 18 | } |
19 | 19 |
1 | -<script lang="ts" setup> | ||
2 | - import { Icon } from '/@/components/Icon'; | ||
3 | - import { computed, ExtractPropTypes, unref } from 'vue'; | ||
4 | - import { usePermission } from '/@/hooks/web/usePermission'; | ||
5 | - | ||
6 | - interface AuthIconProps extends ExtractPropTypes<typeof Icon> { | ||
7 | - auth?: string; | ||
8 | - } | ||
9 | - | ||
10 | - const props = defineProps<AuthIconProps>(); | ||
11 | - | ||
12 | - const emit = defineEmits(['click']); | ||
13 | - | ||
14 | - const { hasPermission } = usePermission(); | ||
15 | - | ||
16 | - const getHasPermission = computed(() => { | ||
17 | - const { auth } = props; | ||
18 | - return auth ? hasPermission(auth) : true; | ||
19 | - }); | ||
20 | - | ||
21 | - const getBindProps = computed(() => { | ||
22 | - return { | ||
23 | - ...props, | ||
24 | - ...(unref(getHasPermission) ? { onClick: (event: Event) => emit('click', event) } : {}), | ||
25 | - }; | ||
26 | - }); | ||
27 | -</script> | ||
28 | - | ||
29 | -<template> | ||
30 | - <Icon | ||
31 | - v-bind="getBindProps" | ||
32 | - class="justify-center items-center" | ||
33 | - :class="getHasPermission ? '' : '!cursor-not-allowed !text-gray-200'" | ||
34 | - /> | ||
35 | -</template> | 1 | +<script lang="ts" setup> |
2 | + import { Icon } from '/@/components/Icon'; | ||
3 | + import { computed, ExtractPropTypes, unref } from 'vue'; | ||
4 | + import { usePermission } from '/@/hooks/web/usePermission'; | ||
5 | + | ||
6 | + interface AuthIconProps extends ExtractPropTypes<typeof Icon> { | ||
7 | + auth?: string; | ||
8 | + } | ||
9 | + | ||
10 | + const props = defineProps<AuthIconProps>(); | ||
11 | + | ||
12 | + const emit = defineEmits(['click']); | ||
13 | + | ||
14 | + const { hasPermission } = usePermission(); | ||
15 | + | ||
16 | + const getHasPermission = computed(() => { | ||
17 | + const { auth } = props; | ||
18 | + console.log(auth); | ||
19 | + return auth ? hasPermission(auth) : true; | ||
20 | + }); | ||
21 | + | ||
22 | + const getBindProps = computed(() => { | ||
23 | + return { | ||
24 | + ...props, | ||
25 | + ...(unref(getHasPermission) ? { onClick: (event: Event) => emit('click', event) } : {}), | ||
26 | + }; | ||
27 | + }); | ||
28 | +</script> | ||
29 | + | ||
30 | +<template> | ||
31 | + <Icon | ||
32 | + v-bind="getBindProps" | ||
33 | + class="justify-center items-center" | ||
34 | + :class="getHasPermission ? '' : '!cursor-not-allowed !text-gray-200'" | ||
35 | + /> | ||
36 | +</template> |
src/views/dataview/TableMode.vue
deleted
100644 → 0
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 './BigScreenDrawer.vue'; | ||
80 | - import { useResetOrganizationTree, OrganizationIdTree } from '/@/views/common/organizationIdTree'; | ||
81 | - import { searchFormSchema, columns, Platform } from './config'; | ||
82 | - import { | ||
83 | - getPage, | ||
84 | - deleteConfigurationCenter, | ||
85 | - } from '/@/api/configuration/center/configurationCenter'; | ||
86 | - import { useBatchDelete } from '/@/hooks/web/useBatchDelete'; | ||
87 | - import { 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 | - import { useGlobSetting } from '/@/hooks/setting'; | ||
92 | - export default defineComponent({ | ||
93 | - components: { | ||
94 | - PageWrapper, | ||
95 | - OrganizationIdTree, | ||
96 | - BasicTable, | ||
97 | - TableAction, | ||
98 | - ContactDrawer, | ||
99 | - Authority, | ||
100 | - Popconfirm, | ||
101 | - Tag, | ||
102 | - }, | ||
103 | - setup() { | ||
104 | - const { configurationPrefix } = useGlobSetting(); | ||
105 | - const isDev = isDevMode(); | ||
106 | - const searchInfo = reactive<Recordable>({}); | ||
107 | - const { organizationIdTreeRef, resetFn } = useResetOrganizationTree(searchInfo); | ||
108 | - // 表格hooks | ||
109 | - const [registerTable, { reload, setProps }] = useTable({ | ||
110 | - title: '大屏中心列表', | ||
111 | - api: getPage, | ||
112 | - columns, | ||
113 | - clickToRowSelect: false, | ||
114 | - formConfig: { | ||
115 | - labelWidth: 120, | ||
116 | - schemas: searchFormSchema, | ||
117 | - resetFunc: resetFn, | ||
118 | - }, | ||
119 | - showIndexColumn: false, | ||
120 | - useSearchForm: true, | ||
121 | - showTableSetting: true, | ||
122 | - bordered: true, | ||
123 | - rowKey: 'id', | ||
124 | - actionColumn: { | ||
125 | - width: 200, | ||
126 | - title: '操作', | ||
127 | - dataIndex: 'action', | ||
128 | - slots: { customRender: 'action' }, | ||
129 | - fixed: 'right', | ||
130 | - }, | ||
131 | - }); | ||
132 | - const { hasBatchDelete, handleDeleteOrBatchDelete, selectionOptions } = useBatchDelete( | ||
133 | - deleteConfigurationCenter, | ||
134 | - handleSuccess, | ||
135 | - setProps | ||
136 | - ); | ||
137 | - nextTick(() => { | ||
138 | - setProps(selectionOptions); | ||
139 | - }); | ||
140 | - | ||
141 | - // 弹框 | ||
142 | - const [registerDrawer, { openDrawer }] = useDrawer(); | ||
143 | - | ||
144 | - // 刷新 | ||
145 | - function handleSuccess() { | ||
146 | - reload(); | ||
147 | - } | ||
148 | - // 新增或编辑 | ||
149 | - const handleCreateOrEdit = (record: Recordable | null) => { | ||
150 | - if (record) { | ||
151 | - openDrawer(true, { | ||
152 | - isUpdate: true, | ||
153 | - record, | ||
154 | - }); | ||
155 | - } else { | ||
156 | - openDrawer(true, { | ||
157 | - isUpdate: false, | ||
158 | - }); | ||
159 | - } | ||
160 | - }; | ||
161 | - // 树形选择器 | ||
162 | - const handleSelect = (organizationId: string) => { | ||
163 | - searchInfo.organizationId = organizationId; | ||
164 | - handleSuccess(); | ||
165 | - }; | ||
166 | - | ||
167 | - const handlePreview = (record: Recordable | null) => { | ||
168 | - window.open( | ||
169 | - `${configurationPrefix}/${isDev ? '?dev=1&' : '?'}configurationId=${ | ||
170 | - record!.id | ||
171 | - }&lightbox=1` | ||
172 | - ); | ||
173 | - }; | ||
174 | - const handleDesign = (record: Recordable | null) => { | ||
175 | - window.open( | ||
176 | - `${configurationPrefix}/${isDev ? '?dev=1&' : '?'}configurationId=${record!.id}` | ||
177 | - ); | ||
178 | - }; | ||
179 | - | ||
180 | - return { | ||
181 | - Platform, | ||
182 | - searchInfo, | ||
183 | - hasBatchDelete, | ||
184 | - handleCreateOrEdit, | ||
185 | - handleDeleteOrBatchDelete, | ||
186 | - handleSelect, | ||
187 | - handleSuccess, | ||
188 | - handlePreview, | ||
189 | - handleDesign, | ||
190 | - registerTable, | ||
191 | - registerDrawer, | ||
192 | - organizationIdTreeRef, | ||
193 | - }; | ||
194 | - }, | ||
195 | - }); | ||
196 | -</script> |
1 | <script setup lang="ts"> | 1 | <script setup lang="ts"> |
2 | import { List, Card, Button, PaginationProps, Tooltip } from 'ant-design-vue'; | 2 | import { List, Card, Button, PaginationProps, Tooltip } from 'ant-design-vue'; |
3 | import { ReloadOutlined } from '@ant-design/icons-vue'; | 3 | import { ReloadOutlined } from '@ant-design/icons-vue'; |
4 | - import { computed, onMounted, reactive, ref, unref } from 'vue'; | 4 | + import { onMounted, reactive, ref, unref } from 'vue'; |
5 | import { OrganizationIdTree, useResetOrganizationTree } from '../common/organizationIdTree'; | 5 | import { OrganizationIdTree, useResetOrganizationTree } from '../common/organizationIdTree'; |
6 | import { deleteBigScreenenter, getPage } from '/@/api/bigscreen/center/bigscreenCenter'; | 6 | import { deleteBigScreenenter, getPage } from '/@/api/bigscreen/center/bigscreenCenter'; |
7 | - import { BigScreenCenterItemsModal } from '/@/api/bigscreen/center/model/configurationCenterModal'; | 7 | + import { BigScreenCenterItemsModel } from '/@/api/bigscreen/center/model/bigscreenCenterModel'; |
8 | import { PageWrapper } from '/@/components/Page'; | 8 | import { PageWrapper } from '/@/components/Page'; |
9 | import { BasicForm, useForm } from '/@/components/Form'; | 9 | import { BasicForm, useForm } from '/@/components/Form'; |
10 | import { ConfigurationPermission, searchFormSchema } from './config'; | 10 | import { ConfigurationPermission, searchFormSchema } from './config'; |
11 | import { useMessage } from '/@/hooks/web/useMessage'; | 11 | import { useMessage } from '/@/hooks/web/useMessage'; |
12 | import { Authority } from '/@/components/Authority'; | 12 | import { Authority } from '/@/components/Authority'; |
13 | - import { isDevMode } from '/@/utils/env'; | ||
14 | import ConfigurationCenterDrawer from './BigScreenDrawer.vue'; | 13 | import ConfigurationCenterDrawer from './BigScreenDrawer.vue'; |
15 | import { useDrawer } from '/@/components/Drawer'; | 14 | import { useDrawer } from '/@/components/Drawer'; |
16 | import { getBoundingClientRect } from '/@/utils/domUtils'; | 15 | import { getBoundingClientRect } from '/@/utils/domUtils'; |
17 | import configurationSrc from '/@/assets/icons/configuration.svg'; | 16 | import configurationSrc from '/@/assets/icons/configuration.svg'; |
18 | import { cloneDeep } from 'lodash'; | 17 | import { cloneDeep } from 'lodash'; |
19 | - import { usePermission } from '/@/hooks/web/usePermission'; | ||
20 | import { useGlobSetting } from '/@/hooks/setting'; | 18 | import { useGlobSetting } from '/@/hooks/setting'; |
21 | import { AuthIcon, CardLayoutButton } from '/@/components/Widget'; | 19 | import { AuthIcon, CardLayoutButton } from '/@/components/Widget'; |
22 | import AuthDropDown from '/@/components/Widget/AuthDropDown.vue'; | 20 | import AuthDropDown from '/@/components/Widget/AuthDropDown.vue'; |
@@ -40,7 +38,7 @@ | @@ -40,7 +38,7 @@ | ||
40 | 38 | ||
41 | const loading = ref(false); | 39 | const loading = ref(false); |
42 | 40 | ||
43 | - const dataSource = ref<BigScreenCenterItemsModal[]>([]); | 41 | + const dataSource = ref<BigScreenCenterItemsModel[]>([]); |
44 | 42 | ||
45 | const [registerForm, { getFieldsValue }] = useForm({ | 43 | const [registerForm, { getFieldsValue }] = useForm({ |
46 | schemas: searchFormSchema, | 44 | schemas: searchFormSchema, |
@@ -90,17 +88,7 @@ | @@ -90,17 +88,7 @@ | ||
90 | 88 | ||
91 | const [registerDrawer, { openDrawer }] = useDrawer(); | 89 | const [registerDrawer, { openDrawer }] = useDrawer(); |
92 | 90 | ||
93 | - const { hasPermission } = usePermission(); | ||
94 | - | ||
95 | - const getPreviewFlag = computed(() => { | ||
96 | - return hasPermission(ConfigurationPermission.PREVIEW); | ||
97 | - }); | ||
98 | - | ||
99 | - const getDesignFlag = computed(() => { | ||
100 | - return hasPermission(ConfigurationPermission.DESIGN); | ||
101 | - }); | ||
102 | - | ||
103 | - const handleCreateOrUpdate = (record?: ConfigurationCenterItemsModal) => { | 91 | + const handleCreateOrUpdate = (record?: BigScreenCenterItemsModel) => { |
104 | if (record) { | 92 | if (record) { |
105 | openDrawer(true, { | 93 | openDrawer(true, { |
106 | isUpdate: true, | 94 | isUpdate: true, |
@@ -113,22 +101,17 @@ | @@ -113,22 +101,17 @@ | ||
113 | } | 101 | } |
114 | }; | 102 | }; |
115 | 103 | ||
116 | - const { configurationPrefix } = useGlobSetting(); | ||
117 | - const isDev = isDevMode(); | 104 | + const { largeDesignerPrefix } = useGlobSetting(); |
118 | 105 | ||
119 | - const handlePreview = (record: BigScreenCenterItemsModal) => { | ||
120 | - if (!unref(getPreviewFlag)) return; | ||
121 | - window.open( | ||
122 | - `${configurationPrefix}/${isDev ? '?dev=1&' : '?'}configurationId=${record!.id}&lightbox=1` | ||
123 | - ); | 106 | + const handlePreview = (record: BigScreenCenterItemsModel) => { |
107 | + window.open(`${largeDesignerPrefix}/${record.id}`); | ||
124 | }; | 108 | }; |
125 | 109 | ||
126 | - const handleDesign = (record: BigScreenCenterItemsModal) => { | ||
127 | - if (!unref(getDesignFlag)) return; | ||
128 | - window.open(`${configurationPrefix}/${isDev ? '?dev=1&' : '?'}configurationId=${record!.id}`); | 110 | + const handleDesign = (record: BigScreenCenterItemsModel) => { |
111 | + window.open(`${largeDesignerPrefix}/${record.id}`); | ||
129 | }; | 112 | }; |
130 | 113 | ||
131 | - const handleDelete = async (record: BigScreenCenterItemsModal) => { | 114 | + const handleDelete = async (record: BigScreenCenterItemsModel) => { |
132 | try { | 115 | try { |
133 | await deleteBigScreenenter([record.id]); | 116 | await deleteBigScreenenter([record.id]); |
134 | createMessage.success('删除成功'); | 117 | createMessage.success('删除成功'); |
@@ -207,7 +190,6 @@ | @@ -207,7 +190,6 @@ | ||
207 | <template class="ant-card-actions" #actions> | 190 | <template class="ant-card-actions" #actions> |
208 | <Tooltip title="预览"> | 191 | <Tooltip title="预览"> |
209 | <AuthIcon | 192 | <AuthIcon |
210 | - :auth="ConfigurationPermission.PREVIEW" | ||
211 | class="!text-lg" | 193 | class="!text-lg" |
212 | icon="ant-design:eye-outlined" | 194 | icon="ant-design:eye-outlined" |
213 | @click="handlePreview(item)" | 195 | @click="handlePreview(item)" |
@@ -215,7 +197,6 @@ | @@ -215,7 +197,6 @@ | ||
215 | </Tooltip> | 197 | </Tooltip> |
216 | <Tooltip title="设计"> | 198 | <Tooltip title="设计"> |
217 | <AuthIcon | 199 | <AuthIcon |
218 | - :auth="ConfigurationPermission.DESIGN" | ||
219 | class="!text-lg" | 200 | class="!text-lg" |
220 | icon="ant-design:edit-outlined" | 201 | icon="ant-design:edit-outlined" |
221 | @click="handleDesign(item)" | 202 | @click="handleDesign(item)" |