Commit 043628e0ab5555bdfed9a647a71197cafb65a3bd
1 parent
95e6bb26
fix: DEFECT-984 button not set auth key
Showing
3 changed files
with
20 additions
and
8 deletions
| @@ -11,10 +11,10 @@ | @@ -11,10 +11,10 @@ | ||
| 11 | > | 11 | > |
| 12 | <template #toolbar> | 12 | <template #toolbar> |
| 13 | <a-button type="primary" @click="handleSwitchMode">分屏模式</a-button> | 13 | <a-button type="primary" @click="handleSwitchMode">分屏模式</a-button> |
| 14 | - <Authority value="api:yt:video:post"> | 14 | + <Authority :value="CameraPermission.CREATE"> |
| 15 | <a-button type="primary" @click="handleCreateOrEdit(null)"> 新增视频 </a-button> | 15 | <a-button type="primary" @click="handleCreateOrEdit(null)"> 新增视频 </a-button> |
| 16 | </Authority> | 16 | </Authority> |
| 17 | - <Authority value="api:yt:video:delete"> | 17 | + <Authority :value="CameraPermission.DELETE"> |
| 18 | <Popconfirm | 18 | <Popconfirm |
| 19 | title="您确定要批量删除数据" | 19 | title="您确定要批量删除数据" |
| 20 | ok-text="确定" | 20 | ok-text="确定" |
| @@ -50,12 +50,12 @@ | @@ -50,12 +50,12 @@ | ||
| 50 | { | 50 | { |
| 51 | label: '预览', | 51 | label: '预览', |
| 52 | icon: 'clarity:note-edit-line', | 52 | icon: 'clarity:note-edit-line', |
| 53 | - auth: 'api:yt:video:get', | 53 | + auth: CameraPermission.PREVIEW, |
| 54 | onClick: handleViewVideo.bind(null, record), | 54 | onClick: handleViewVideo.bind(null, record), |
| 55 | }, | 55 | }, |
| 56 | { | 56 | { |
| 57 | label: '编辑', | 57 | label: '编辑', |
| 58 | - auth: 'api:yt:video:update', | 58 | + auth: CameraPermission.UPDATE, |
| 59 | icon: 'clarity:note-edit-line', | 59 | icon: 'clarity:note-edit-line', |
| 60 | onClick: handleCreateOrEdit.bind(null, record), | 60 | onClick: handleCreateOrEdit.bind(null, record), |
| 61 | }, | 61 | }, |
| @@ -63,7 +63,7 @@ | @@ -63,7 +63,7 @@ | ||
| 63 | :drop-down-actions="[ | 63 | :drop-down-actions="[ |
| 64 | { | 64 | { |
| 65 | label: '删除', | 65 | label: '删除', |
| 66 | - auth: 'api:yt:video:delete', | 66 | + auth: CameraPermission.DELETE, |
| 67 | icon: 'ant-design:delete-outlined', | 67 | icon: 'ant-design:delete-outlined', |
| 68 | color: 'error', | 68 | color: 'error', |
| 69 | popConfirm: { | 69 | popConfirm: { |
| @@ -89,7 +89,7 @@ | @@ -89,7 +89,7 @@ | ||
| 89 | import CameraDrawer from './CameraDrawer.vue'; | 89 | import CameraDrawer from './CameraDrawer.vue'; |
| 90 | import { useResetOrganizationTree, OrganizationIdTree } from '/@/views/common/organizationIdTree'; | 90 | import { useResetOrganizationTree, OrganizationIdTree } from '/@/views/common/organizationIdTree'; |
| 91 | import { cameraPage, deleteCameraManage } from '/@/api/camera/cameraManager'; | 91 | import { cameraPage, deleteCameraManage } from '/@/api/camera/cameraManager'; |
| 92 | - import { searchFormSchema, columns, AccessMode, PageMode } from './config.data'; | 92 | + import { searchFormSchema, columns, AccessMode, PageMode, CameraPermission } from './config.data'; |
| 93 | import VideoPreviewModal from './DialogPreviewVideo.vue'; | 93 | import VideoPreviewModal from './DialogPreviewVideo.vue'; |
| 94 | import { useModal } from '/@/components/Modal'; | 94 | import { useModal } from '/@/components/Modal'; |
| 95 | import { Authority } from '/@/components/Authority'; | 95 | import { Authority } from '/@/components/Authority'; |
| @@ -199,6 +199,7 @@ | @@ -199,6 +199,7 @@ | ||
| 199 | registerModal, | 199 | registerModal, |
| 200 | AccessMode, | 200 | AccessMode, |
| 201 | handleSwitchMode, | 201 | handleSwitchMode, |
| 202 | + CameraPermission, | ||
| 202 | }; | 203 | }; |
| 203 | }, | 204 | }, |
| 204 | }); | 205 | }); |
| @@ -8,13 +8,14 @@ | @@ -8,13 +8,14 @@ | ||
| 8 | import { useFullscreen } from '@vueuse/core'; | 8 | import { useFullscreen } from '@vueuse/core'; |
| 9 | import CameraDrawer from './CameraDrawer.vue'; | 9 | import CameraDrawer from './CameraDrawer.vue'; |
| 10 | import { useDrawer } from '/@/components/Drawer'; | 10 | import { useDrawer } from '/@/components/Drawer'; |
| 11 | - import { AccessMode, PageMode } from './config.data'; | 11 | + import { AccessMode, CameraPermission, PageMode } from './config.data'; |
| 12 | import SvgIcon from '/@/components/Icon/src/SvgIcon.vue'; | 12 | import SvgIcon from '/@/components/Icon/src/SvgIcon.vue'; |
| 13 | import { getStreamingPlayUrl } from '/@/api/camera/cameraManager'; | 13 | import { getStreamingPlayUrl } from '/@/api/camera/cameraManager'; |
| 14 | import { buildUUID } from '/@/utils/uuid'; | 14 | import { buildUUID } from '/@/utils/uuid'; |
| 15 | import { BasicVideoPlay, getVideoTypeByUrl } from '/@/components/Video'; | 15 | import { BasicVideoPlay, getVideoTypeByUrl } from '/@/components/Video'; |
| 16 | import { VideoJsPlayerOptions } from 'video.js'; | 16 | import { VideoJsPlayerOptions } from 'video.js'; |
| 17 | import { getBoundingClientRect } from '/@/utils/domUtils'; | 17 | import { getBoundingClientRect } from '/@/utils/domUtils'; |
| 18 | + import { Authority } from '/@/components/Authority'; | ||
| 18 | 19 | ||
| 19 | type CameraRecordItem = CameraRecord & { | 20 | type CameraRecordItem = CameraRecord & { |
| 20 | canPlay?: boolean; | 21 | canPlay?: boolean; |
| @@ -220,7 +221,9 @@ | @@ -220,7 +221,9 @@ | ||
| 220 | </div> | 221 | </div> |
| 221 | <div class="flex items-center gap-4"> | 222 | <div class="flex items-center gap-4"> |
| 222 | <div class="flex"> | 223 | <div class="flex"> |
| 223 | - <Button type="primary" @click="handleAddCamera">新增视频</Button> | 224 | + <Authority :value="CameraPermission.CREATE"> |
| 225 | + <Button type="primary" @click="handleAddCamera">新增视频</Button> | ||
| 226 | + </Authority> | ||
| 224 | </div> | 227 | </div> |
| 225 | <Space> | 228 | <Space> |
| 226 | <Button type="primary" @click="handleChangeMode(PageMode.SPLIT_SCREEN_MODE)"> | 229 | <Button type="primary" @click="handleChangeMode(PageMode.SPLIT_SCREEN_MODE)"> |
| @@ -6,6 +6,14 @@ import type { FormSchema as QFormSchema } from '/@/components/Form/index'; | @@ -6,6 +6,14 @@ import type { FormSchema as QFormSchema } from '/@/components/Form/index'; | ||
| 6 | import { CameraVideoUrl, CameraMaxLength, MediaTypeValidate } from '/@/utils/rules'; | 6 | import { CameraVideoUrl, CameraMaxLength, MediaTypeValidate } from '/@/utils/rules'; |
| 7 | import { h } from 'vue'; | 7 | import { h } from 'vue'; |
| 8 | import SnHelpMessage from './SnHelpMessage.vue'; | 8 | import SnHelpMessage from './SnHelpMessage.vue'; |
| 9 | + | ||
| 10 | +export enum CameraPermission { | ||
| 11 | + PREVIEW = 'api:yt:video:get', | ||
| 12 | + CREATE = 'api:yt:video:post', | ||
| 13 | + UPDATE = 'api:yt:video:update', | ||
| 14 | + DELETE = 'api:yt:video:delete', | ||
| 15 | +} | ||
| 16 | + | ||
| 9 | export enum AccessMode { | 17 | export enum AccessMode { |
| 10 | ManuallyEnter = 0, | 18 | ManuallyEnter = 0, |
| 11 | Streaming = 1, | 19 | Streaming = 1, |