Showing
37 changed files
with
539 additions
and
230 deletions
| @@ -14,14 +14,19 @@ enum Api { | @@ -14,14 +14,19 @@ enum Api { | ||
| 14 | * @description: Get user menu based on id | 14 | * @description: Get user menu based on id |
| 15 | */ | 15 | */ |
| 16 | 16 | ||
| 17 | -export const getMenuList = () => { | 17 | +export const getMenuList = (args) => { |
| 18 | const userStore = useUserStore(); | 18 | const userStore = useUserStore(); |
| 19 | let url = Api.GetMenuList; | 19 | let url = Api.GetMenuList; |
| 20 | try { | 20 | try { |
| 21 | if (userStore.getRoleList.find((v) => v == RoleEnum.SYS_ADMIN)) { | 21 | if (userStore.getRoleList.find((v) => v == RoleEnum.SYS_ADMIN)) { |
| 22 | url = Api.SysAdminMenuList; | 22 | url = Api.SysAdminMenuList; |
| 23 | } | 23 | } |
| 24 | - return defHttp.get<getMenuListResultModel>({ url }); | 24 | + return defHttp.get<getMenuListResultModel>({ |
| 25 | + url, | ||
| 26 | + params: { | ||
| 27 | + needButton: args == 1 ? false : null, | ||
| 28 | + }, | ||
| 29 | + }); | ||
| 25 | } catch (e) {} | 30 | } catch (e) {} |
| 26 | }; | 31 | }; |
| 27 | 32 |
| @@ -230,7 +230,7 @@ export const usePermissionStore = defineStore({ | @@ -230,7 +230,7 @@ export const usePermissionStore = defineStore({ | ||
| 230 | ] as AppRouteRecordRaw[]; | 230 | ] as AppRouteRecordRaw[]; |
| 231 | } else { | 231 | } else { |
| 232 | this.changePermissionCode(); | 232 | this.changePermissionCode(); |
| 233 | - routeList = (await getMenuList()) as AppRouteRecordRaw[]; | 233 | + routeList = (await getMenuList(1)) as AppRouteRecordRaw[]; |
| 234 | createStorage('MENU_LIST', JSON.stringify(routeList)); | 234 | createStorage('MENU_LIST', JSON.stringify(routeList)); |
| 235 | setAuthCache('MENU_LIST', routeList); | 235 | setAuthCache('MENU_LIST', routeList); |
| 236 | } | 236 | } |
| @@ -13,15 +13,19 @@ | @@ -13,15 +13,19 @@ | ||
| 13 | :clickToRowSelect="false" | 13 | :clickToRowSelect="false" |
| 14 | > | 14 | > |
| 15 | <template #toolbar> | 15 | <template #toolbar> |
| 16 | - <a-button type="primary" @click="handleCreateOrEdit(null)"> 新增告警配置 </a-button> | ||
| 17 | - <a-button | ||
| 18 | - type="primary" | ||
| 19 | - color="error" | ||
| 20 | - @click="handleDeleteOrBatchDelete(null)" | ||
| 21 | - :disabled="hasBatchDelete" | ||
| 22 | - > | ||
| 23 | - 批量删除 | ||
| 24 | - </a-button> | 16 | + <Authority value="api:yt:admin:addAlarmConfig"> |
| 17 | + <a-button type="primary" @click="handleCreateOrEdit(null)"> 新增告警配置 </a-button> | ||
| 18 | + </Authority> | ||
| 19 | + <Authority value="api:yt:admin:deleteAlarmConfig"> | ||
| 20 | + <a-button | ||
| 21 | + type="primary" | ||
| 22 | + color="error" | ||
| 23 | + @click="handleDeleteOrBatchDelete(null)" | ||
| 24 | + :disabled="hasBatchDelete" | ||
| 25 | + > | ||
| 26 | + 批量删除 | ||
| 27 | + </a-button> | ||
| 28 | + </Authority> | ||
| 25 | </template> | 29 | </template> |
| 26 | <template #alarmContact="{ record }"> | 30 | <template #alarmContact="{ record }"> |
| 27 | <a-button type="link" class="ml-2" @click="showAlarmContact(record)"> | 31 | <a-button type="link" class="ml-2" @click="showAlarmContact(record)"> |
| @@ -47,6 +51,7 @@ | @@ -47,6 +51,7 @@ | ||
| 47 | :actions="[ | 51 | :actions="[ |
| 48 | { | 52 | { |
| 49 | label: '编辑', | 53 | label: '编辑', |
| 54 | + auth: 'api:yt:admin:editAlarmConfig', | ||
| 50 | icon: 'clarity:note-edit-line', | 55 | icon: 'clarity:note-edit-line', |
| 51 | onClick: handleCreateOrEdit.bind(null, record), | 56 | onClick: handleCreateOrEdit.bind(null, record), |
| 52 | ifShow: () => { | 57 | ifShow: () => { |
| @@ -55,6 +60,7 @@ | @@ -55,6 +60,7 @@ | ||
| 55 | }, | 60 | }, |
| 56 | { | 61 | { |
| 57 | label: '删除', | 62 | label: '删除', |
| 63 | + auth: 'api:yt:admin:deleteAlarmConfig', | ||
| 58 | icon: 'ant-design:delete-outlined', | 64 | icon: 'ant-design:delete-outlined', |
| 59 | color: 'error', | 65 | color: 'error', |
| 60 | ifShow: () => { | 66 | ifShow: () => { |
| @@ -91,6 +97,7 @@ | @@ -91,6 +97,7 @@ | ||
| 91 | import { Switch } from 'ant-design-vue'; | 97 | import { Switch } from 'ant-design-vue'; |
| 92 | import { putAlarmConfigStatus } from '/@/api/alarm/config/alarmConfig'; | 98 | import { putAlarmConfigStatus } from '/@/api/alarm/config/alarmConfig'; |
| 93 | import { useMessage } from '/@/hooks/web/useMessage'; | 99 | import { useMessage } from '/@/hooks/web/useMessage'; |
| 100 | + import { Authority } from '/@/components/Authority'; | ||
| 94 | 101 | ||
| 95 | export default defineComponent({ | 102 | export default defineComponent({ |
| 96 | components: { | 103 | components: { |
| @@ -100,6 +107,7 @@ | @@ -100,6 +107,7 @@ | ||
| 100 | TableAction, | 107 | TableAction, |
| 101 | ContactDrawer, | 108 | ContactDrawer, |
| 102 | Switch, | 109 | Switch, |
| 110 | + Authority, | ||
| 103 | }, | 111 | }, |
| 104 | setup() { | 112 | setup() { |
| 105 | const searchInfo = reactive<Recordable>({}); | 113 | const searchInfo = reactive<Recordable>({}); |
| @@ -8,26 +8,32 @@ | @@ -8,26 +8,32 @@ | ||
| 8 | /> | 8 | /> |
| 9 | <BasicTable @register="registerTable" :searchInfo="searchInfo" class="w-3/4 xl:w-4/5"> | 9 | <BasicTable @register="registerTable" :searchInfo="searchInfo" class="w-3/4 xl:w-4/5"> |
| 10 | <template #toolbar> | 10 | <template #toolbar> |
| 11 | - <a-button type="primary" @click="handleCreateOrEdit(null)"> 新增告警联系人 </a-button> | ||
| 12 | - <a-button | ||
| 13 | - type="primary" | ||
| 14 | - color="error" | ||
| 15 | - @click="handleDeleteOrBatchDelete(null)" | ||
| 16 | - :disabled="hasBatchDelete" | ||
| 17 | - > | ||
| 18 | - 批量删除 | ||
| 19 | - </a-button> | 11 | + <Authority value="api:yt:admin:addAlarmContact"> |
| 12 | + <a-button type="primary" @click="handleCreateOrEdit(null)"> 新增告警联系人 </a-button> | ||
| 13 | + </Authority> | ||
| 14 | + <Authority value="api:yt:admin:deleteAlarmContact"> | ||
| 15 | + <a-button | ||
| 16 | + type="primary" | ||
| 17 | + color="error" | ||
| 18 | + @click="handleDeleteOrBatchDelete(null)" | ||
| 19 | + :disabled="hasBatchDelete" | ||
| 20 | + > | ||
| 21 | + 批量删除 | ||
| 22 | + </a-button> | ||
| 23 | + </Authority> | ||
| 20 | </template> | 24 | </template> |
| 21 | <template #action="{ record }"> | 25 | <template #action="{ record }"> |
| 22 | <TableAction | 26 | <TableAction |
| 23 | :actions="[ | 27 | :actions="[ |
| 24 | { | 28 | { |
| 25 | label: '编辑', | 29 | label: '编辑', |
| 30 | + auth: 'api:yt:admin:editAlarmContact', | ||
| 26 | icon: 'clarity:note-edit-line', | 31 | icon: 'clarity:note-edit-line', |
| 27 | onClick: handleCreateOrEdit.bind(null, record), | 32 | onClick: handleCreateOrEdit.bind(null, record), |
| 28 | }, | 33 | }, |
| 29 | { | 34 | { |
| 30 | label: '删除', | 35 | label: '删除', |
| 36 | + auth: 'api:yt:admin:deleteAlarmContact', | ||
| 31 | icon: 'ant-design:delete-outlined', | 37 | icon: 'ant-design:delete-outlined', |
| 32 | color: 'error', | 38 | color: 'error', |
| 33 | popConfirm: { | 39 | popConfirm: { |
| @@ -55,6 +61,8 @@ | @@ -55,6 +61,8 @@ | ||
| 55 | 61 | ||
| 56 | import { getAlarmContact, deleteAlarmContact } from '/@/api/alarm/contact/alarmContact'; | 62 | import { getAlarmContact, deleteAlarmContact } from '/@/api/alarm/contact/alarmContact'; |
| 57 | import { searchFormSchema, columns } from './config.data'; | 63 | import { searchFormSchema, columns } from './config.data'; |
| 64 | + import { Authority } from '/@/components/Authority'; | ||
| 65 | + | ||
| 58 | export default defineComponent({ | 66 | export default defineComponent({ |
| 59 | components: { | 67 | components: { |
| 60 | PageWrapper, | 68 | PageWrapper, |
| @@ -62,6 +70,7 @@ | @@ -62,6 +70,7 @@ | ||
| 62 | BasicTable, | 70 | BasicTable, |
| 63 | TableAction, | 71 | TableAction, |
| 64 | ContactDrawer, | 72 | ContactDrawer, |
| 73 | + Authority, | ||
| 65 | }, | 74 | }, |
| 66 | setup() { | 75 | setup() { |
| 67 | const searchInfo = reactive<Recordable>({}); | 76 | const searchInfo = reactive<Recordable>({}); |
| @@ -50,6 +50,7 @@ | @@ -50,6 +50,7 @@ | ||
| 50 | ...data, | 50 | ...data, |
| 51 | severity: alarmLevel(data.severity), | 51 | severity: alarmLevel(data.severity), |
| 52 | status: statusType(data.status), | 52 | status: statusType(data.status), |
| 53 | + details: JSON.stringify(data.details), | ||
| 53 | }); | 54 | }); |
| 54 | alarmStatus.value = data.status; | 55 | alarmStatus.value = data.status; |
| 55 | alarmId.value = data.id; | 56 | alarmId.value = data.id; |
| @@ -6,6 +6,7 @@ | @@ -6,6 +6,7 @@ | ||
| 6 | :actions="[ | 6 | :actions="[ |
| 7 | { | 7 | { |
| 8 | label: '详情', | 8 | label: '详情', |
| 9 | + auth: 'api:yt:admin:viewAlarmLog', | ||
| 9 | icon: 'ant-design:eye-outlined', | 10 | icon: 'ant-design:eye-outlined', |
| 10 | onClick: handleDetail.bind(null, record), | 11 | onClick: handleDetail.bind(null, record), |
| 11 | }, | 12 | }, |
src/views/camera/manage/CameraDrawer.vue
renamed from
src/views/camera/manage/ContactDrawer.vue
| @@ -13,15 +13,19 @@ | @@ -13,15 +13,19 @@ | ||
| 13 | class="w-3/4 xl:w-4/5" | 13 | class="w-3/4 xl:w-4/5" |
| 14 | > | 14 | > |
| 15 | <template #toolbar> | 15 | <template #toolbar> |
| 16 | - <a-button type="primary" @click="handleCreateOrEdit(null)"> 新增视频 </a-button> | ||
| 17 | - <a-button | ||
| 18 | - type="primary" | ||
| 19 | - color="error" | ||
| 20 | - @click="handleDeleteOrBatchDelete(null)" | ||
| 21 | - :disabled="hasBatchDelete" | ||
| 22 | - > | ||
| 23 | - 批量删除 | ||
| 24 | - </a-button> | 16 | + <Authority value="api:yt:admin:addCamera"> |
| 17 | + <a-button type="primary" @click="handleCreateOrEdit(null)"> 新增视频 </a-button> | ||
| 18 | + </Authority> | ||
| 19 | + <Authority value="api:yt:admin:deleteCamera"> | ||
| 20 | + <a-button | ||
| 21 | + type="primary" | ||
| 22 | + color="error" | ||
| 23 | + @click="handleDeleteOrBatchDelete(null)" | ||
| 24 | + :disabled="hasBatchDelete" | ||
| 25 | + > | ||
| 26 | + 批量删除 | ||
| 27 | + </a-button> | ||
| 28 | + </Authority> | ||
| 25 | </template> | 29 | </template> |
| 26 | <template #img="{ record }"> | 30 | <template #img="{ record }"> |
| 27 | <TableImg | 31 | <TableImg |
| @@ -41,15 +45,18 @@ | @@ -41,15 +45,18 @@ | ||
| 41 | { | 45 | { |
| 42 | label: '预览', | 46 | label: '预览', |
| 43 | icon: 'clarity:note-edit-line', | 47 | icon: 'clarity:note-edit-line', |
| 48 | + auth: 'api:yt:admin:viewCamera', | ||
| 44 | onClick: handleViewVideo.bind(null, record), | 49 | onClick: handleViewVideo.bind(null, record), |
| 45 | }, | 50 | }, |
| 46 | { | 51 | { |
| 47 | label: '编辑', | 52 | label: '编辑', |
| 53 | + auth: 'api:yt:admin:editCamera', | ||
| 48 | icon: 'clarity:note-edit-line', | 54 | icon: 'clarity:note-edit-line', |
| 49 | onClick: handleCreateOrEdit.bind(null, record), | 55 | onClick: handleCreateOrEdit.bind(null, record), |
| 50 | }, | 56 | }, |
| 51 | { | 57 | { |
| 52 | label: '删除', | 58 | label: '删除', |
| 59 | + auth: 'api:yt:admin:deleteCamera', | ||
| 53 | icon: 'ant-design:delete-outlined', | 60 | icon: 'ant-design:delete-outlined', |
| 54 | color: 'error', | 61 | color: 'error', |
| 55 | popConfirm: { | 62 | popConfirm: { |
| @@ -62,7 +69,7 @@ | @@ -62,7 +69,7 @@ | ||
| 62 | </template> | 69 | </template> |
| 63 | </BasicTable> | 70 | </BasicTable> |
| 64 | </PageWrapper> | 71 | </PageWrapper> |
| 65 | - <ContactDrawer @register="registerDrawer" @success="handleSuccess" /> | 72 | + <CameraDrawer @register="registerDrawer" @success="handleSuccess" /> |
| 66 | <VideoPreviewModal @register="registerModal" /> | 73 | <VideoPreviewModal @register="registerModal" /> |
| 67 | </div> | 74 | </div> |
| 68 | </template> | 75 | </template> |
| @@ -73,12 +80,13 @@ | @@ -73,12 +80,13 @@ | ||
| 73 | import { PageWrapper } from '/@/components/Page'; | 80 | import { PageWrapper } from '/@/components/Page'; |
| 74 | import { useMessage } from '/@/hooks/web/useMessage'; | 81 | import { useMessage } from '/@/hooks/web/useMessage'; |
| 75 | import { useDrawer } from '/@/components/Drawer'; | 82 | import { useDrawer } from '/@/components/Drawer'; |
| 76 | - import ContactDrawer from './ContactDrawer.vue'; | 83 | + import CameraDrawer from './CameraDrawer.vue'; |
| 77 | import { useResetOrganizationTree, OrganizationIdTree } from '/@/views/common/organizationIdTree'; | 84 | import { useResetOrganizationTree, OrganizationIdTree } from '/@/views/common/organizationIdTree'; |
| 78 | import { cameraPage, deleteCameraManage } from '/@/api/camera/cameraManager'; | 85 | import { cameraPage, deleteCameraManage } from '/@/api/camera/cameraManager'; |
| 79 | import { searchFormSchema, columns } from './config.data'; | 86 | import { searchFormSchema, columns } from './config.data'; |
| 80 | import VideoPreviewModal from './DialogPreviewVideo.vue'; | 87 | import VideoPreviewModal from './DialogPreviewVideo.vue'; |
| 81 | import { useModal } from '/@/components/Modal'; | 88 | import { useModal } from '/@/components/Modal'; |
| 89 | + import { Authority } from '/@/components/Authority'; | ||
| 82 | 90 | ||
| 83 | export default defineComponent({ | 91 | export default defineComponent({ |
| 84 | components: { | 92 | components: { |
| @@ -86,16 +94,22 @@ | @@ -86,16 +94,22 @@ | ||
| 86 | OrganizationIdTree, | 94 | OrganizationIdTree, |
| 87 | BasicTable, | 95 | BasicTable, |
| 88 | TableAction, | 96 | TableAction, |
| 89 | - ContactDrawer, | 97 | + CameraDrawer, |
| 90 | VideoPreviewModal, | 98 | VideoPreviewModal, |
| 91 | TableImg, | 99 | TableImg, |
| 100 | + Authority, | ||
| 92 | }, | 101 | }, |
| 93 | setup() { | 102 | setup() { |
| 94 | let selectedRowIds = ref<string[]>([]); | 103 | let selectedRowIds = ref<string[]>([]); |
| 95 | - const hasBatchDelete = computed(() => selectedRowIds.value.length <= 0); | 104 | + const hasBatchDelete = ref(true); |
| 96 | // 复选框事件 | 105 | // 复选框事件 |
| 97 | const onSelectRowChange = (selectedRowKeys: string[]) => { | 106 | const onSelectRowChange = (selectedRowKeys: string[]) => { |
| 98 | selectedRowIds.value = selectedRowKeys; | 107 | selectedRowIds.value = selectedRowKeys; |
| 108 | + if (selectedRowIds.value.length > 0) { | ||
| 109 | + hasBatchDelete.value = false; | ||
| 110 | + } else { | ||
| 111 | + hasBatchDelete.value = true; | ||
| 112 | + } | ||
| 99 | }; | 113 | }; |
| 100 | const searchInfo = reactive<Recordable>({}); | 114 | const searchInfo = reactive<Recordable>({}); |
| 101 | const { organizationIdTreeRef, resetFn } = useResetOrganizationTree(searchInfo); | 115 | const { organizationIdTreeRef, resetFn } = useResetOrganizationTree(searchInfo); |
| @@ -158,11 +172,15 @@ | @@ -158,11 +172,15 @@ | ||
| 158 | handleSuccess(); | 172 | handleSuccess(); |
| 159 | } catch (e) {} | 173 | } catch (e) {} |
| 160 | } else { | 174 | } else { |
| 175 | + hasBatchDelete.value = true; | ||
| 161 | try { | 176 | try { |
| 162 | await deleteCameraManage(selectedRowIds.value); | 177 | await deleteCameraManage(selectedRowIds.value); |
| 163 | createMessage.success('批量删除视频成功'); | 178 | createMessage.success('批量删除视频成功'); |
| 164 | selectedRowIds.value = []; | 179 | selectedRowIds.value = []; |
| 165 | handleSuccess(); | 180 | handleSuccess(); |
| 181 | + setTimeout(() => { | ||
| 182 | + hasBatchDelete.value = false; | ||
| 183 | + }, 3000); | ||
| 166 | } catch (e) {} | 184 | } catch (e) {} |
| 167 | } | 185 | } |
| 168 | }; | 186 | }; |
| @@ -13,36 +13,44 @@ | @@ -13,36 +13,44 @@ | ||
| 13 | class="w-3/4 xl:w-4/5" | 13 | class="w-3/4 xl:w-4/5" |
| 14 | > | 14 | > |
| 15 | <template #toolbar> | 15 | <template #toolbar> |
| 16 | - <a-button type="primary" @click="handleCreateOrEdit(null)"> 新增组态中心 </a-button> | ||
| 17 | - <a-button | ||
| 18 | - type="primary" | ||
| 19 | - color="error" | ||
| 20 | - @click="handleDeleteOrBatchDelete(null)" | ||
| 21 | - :disabled="hasBatchDelete" | ||
| 22 | - > | ||
| 23 | - 批量删除 | ||
| 24 | - </a-button> | 16 | + <Authority value="api:yt:admin:addConfiguration"> |
| 17 | + <a-button type="primary" @click="handleCreateOrEdit(null)"> 新增组态中心 </a-button> | ||
| 18 | + </Authority> | ||
| 19 | + <Authority value="api:yt:admin:deleteConfiguration"> | ||
| 20 | + <a-button | ||
| 21 | + type="primary" | ||
| 22 | + color="error" | ||
| 23 | + @click="handleDeleteOrBatchDelete(null)" | ||
| 24 | + :disabled="hasBatchDelete" | ||
| 25 | + > | ||
| 26 | + 批量删除 | ||
| 27 | + </a-button> | ||
| 28 | + </Authority> | ||
| 25 | </template> | 29 | </template> |
| 26 | <template #action="{ record }"> | 30 | <template #action="{ record }"> |
| 27 | <TableAction | 31 | <TableAction |
| 28 | :actions="[ | 32 | :actions="[ |
| 29 | { | 33 | { |
| 30 | label: '设计', | 34 | label: '设计', |
| 35 | + auth: 'api:yt:admin:designConfiguration', | ||
| 31 | icon: 'clarity:note-edit-line', | 36 | icon: 'clarity:note-edit-line', |
| 32 | onClick: handleDesign.bind(null, record), | 37 | onClick: handleDesign.bind(null, record), |
| 33 | }, | 38 | }, |
| 34 | { | 39 | { |
| 35 | label: '预览', | 40 | label: '预览', |
| 41 | + auth: 'api:yt:admin:viewConfiguration', | ||
| 36 | icon: 'ant-design:eye-outlined', | 42 | icon: 'ant-design:eye-outlined', |
| 37 | onClick: handlePreview.bind(null, record), | 43 | onClick: handlePreview.bind(null, record), |
| 38 | }, | 44 | }, |
| 39 | { | 45 | { |
| 40 | label: '编辑', | 46 | label: '编辑', |
| 47 | + auth: 'api:yt:admin:editConfiguration', | ||
| 41 | icon: 'clarity:note-edit-line', | 48 | icon: 'clarity:note-edit-line', |
| 42 | onClick: handleCreateOrEdit.bind(null, record), | 49 | onClick: handleCreateOrEdit.bind(null, record), |
| 43 | }, | 50 | }, |
| 44 | { | 51 | { |
| 45 | label: '删除', | 52 | label: '删除', |
| 53 | + auth: 'api:yt:admin:deleteConfiguration', | ||
| 46 | icon: 'ant-design:delete-outlined', | 54 | icon: 'ant-design:delete-outlined', |
| 47 | color: 'error', | 55 | color: 'error', |
| 48 | popConfirm: { | 56 | popConfirm: { |
| @@ -74,6 +82,8 @@ | @@ -74,6 +82,8 @@ | ||
| 74 | import { useBatchDelete } from '/@/hooks/web/useBatchDelete'; | 82 | import { useBatchDelete } from '/@/hooks/web/useBatchDelete'; |
| 75 | 83 | ||
| 76 | import { getAppEnvConfig } from '/@/utils/env'; | 84 | import { getAppEnvConfig } from '/@/utils/env'; |
| 85 | + import { Authority } from '/@/components/Authority'; | ||
| 86 | + | ||
| 77 | export default defineComponent({ | 87 | export default defineComponent({ |
| 78 | components: { | 88 | components: { |
| 79 | PageWrapper, | 89 | PageWrapper, |
| @@ -81,6 +91,7 @@ | @@ -81,6 +91,7 @@ | ||
| 81 | BasicTable, | 91 | BasicTable, |
| 82 | TableAction, | 92 | TableAction, |
| 83 | ContactDrawer, | 93 | ContactDrawer, |
| 94 | + Authority, | ||
| 84 | }, | 95 | }, |
| 85 | setup() { | 96 | setup() { |
| 86 | const { VITE_GLOB_CONFIGURATION } = getAppEnvConfig(); | 97 | const { VITE_GLOB_CONFIGURATION } = getAppEnvConfig(); |
| @@ -8,15 +8,21 @@ | @@ -8,15 +8,21 @@ | ||
| 8 | /> | 8 | /> |
| 9 | <BasicTable @register="registerTable" class="w-5/6 xl:w-4/5"> | 9 | <BasicTable @register="registerTable" class="w-5/6 xl:w-4/5"> |
| 10 | <template #toolbar> | 10 | <template #toolbar> |
| 11 | - <a-button type="primary" @click="handleCreate" v-if="authBtn(role)"> 新增设备 </a-button> | ||
| 12 | - <a-button | ||
| 13 | - color="error" | ||
| 14 | - v-if="authBtn(role)" | ||
| 15 | - @click="handleDeleteOrBatchDelete(null)" | ||
| 16 | - :disabled="hasBatchDelete" | ||
| 17 | - > | ||
| 18 | - 批量删除 | ||
| 19 | - </a-button> | 11 | + <Authority value="api:yt:admin:addDeviceList"> |
| 12 | + <a-button type="primary" @click="handleCreate" v-if="authBtn(role)"> | ||
| 13 | + 新增设备 | ||
| 14 | + </a-button> | ||
| 15 | + </Authority> | ||
| 16 | + <Authority value="api:yt:admin:deleteDeviceList"> | ||
| 17 | + <a-button | ||
| 18 | + color="error" | ||
| 19 | + v-if="authBtn(role)" | ||
| 20 | + @click="handleDeleteOrBatchDelete(null)" | ||
| 21 | + :disabled="hasBatchDelete" | ||
| 22 | + > | ||
| 23 | + 批量删除 | ||
| 24 | + </a-button> | ||
| 25 | + </Authority> | ||
| 20 | </template> | 26 | </template> |
| 21 | <template #img="{ record }"> | 27 | <template #img="{ record }"> |
| 22 | <TableImg | 28 | <TableImg |
| @@ -117,16 +123,19 @@ | @@ -117,16 +123,19 @@ | ||
| 117 | { | 123 | { |
| 118 | label: '详情', | 124 | label: '详情', |
| 119 | icon: 'ant-design:eye-outlined', | 125 | icon: 'ant-design:eye-outlined', |
| 126 | + auth: 'api:yt:admin:viewDeviceList', | ||
| 120 | onClick: handleDetail.bind(null, record), | 127 | onClick: handleDetail.bind(null, record), |
| 121 | }, | 128 | }, |
| 122 | { | 129 | { |
| 123 | label: '编辑', | 130 | label: '编辑', |
| 131 | + auth: 'api:yt:admin:editDeviceList', | ||
| 124 | icon: 'clarity:note-edit-line', | 132 | icon: 'clarity:note-edit-line', |
| 125 | ifShow: authBtn(role) && record.customerId === undefined, | 133 | ifShow: authBtn(role) && record.customerId === undefined, |
| 126 | onClick: handleEdit.bind(null, record), | 134 | onClick: handleEdit.bind(null, record), |
| 127 | }, | 135 | }, |
| 128 | { | 136 | { |
| 129 | label: '删除', | 137 | label: '删除', |
| 138 | + auth: 'api:yt:admin:deleteDeviceList', | ||
| 130 | icon: 'ant-design:delete-outlined', | 139 | icon: 'ant-design:delete-outlined', |
| 131 | ifShow: authBtn(role) && record.customerId === undefined, | 140 | ifShow: authBtn(role) && record.customerId === undefined, |
| 132 | color: 'error', | 141 | color: 'error', |
| @@ -174,6 +183,8 @@ | @@ -174,6 +183,8 @@ | ||
| 174 | import { useBatchDelete } from '/@/hooks/web/useBatchDelete'; | 183 | import { useBatchDelete } from '/@/hooks/web/useBatchDelete'; |
| 175 | import { useCopyToClipboard } from '/@/hooks/web/useCopyToClipboard'; | 184 | import { useCopyToClipboard } from '/@/hooks/web/useCopyToClipboard'; |
| 176 | import { QuestionCircleOutlined } from '@ant-design/icons-vue'; | 185 | import { QuestionCircleOutlined } from '@ant-design/icons-vue'; |
| 186 | + import { Authority } from '/@/components/Authority'; | ||
| 187 | + | ||
| 177 | export default defineComponent({ | 188 | export default defineComponent({ |
| 178 | name: 'DeviceManagement', | 189 | name: 'DeviceManagement', |
| 179 | components: { | 190 | components: { |
| @@ -189,6 +200,7 @@ | @@ -189,6 +200,7 @@ | ||
| 189 | Tooltip, | 200 | Tooltip, |
| 190 | QuestionCircleOutlined, | 201 | QuestionCircleOutlined, |
| 191 | Popover, | 202 | Popover, |
| 203 | + Authority, | ||
| 192 | }, | 204 | }, |
| 193 | setup(_) { | 205 | setup(_) { |
| 194 | const { createMessage } = useMessage(); | 206 | const { createMessage } = useMessage(); |
| @@ -8,13 +8,17 @@ | @@ -8,13 +8,17 @@ | ||
| 8 | :clickToRowSelect="false" | 8 | :clickToRowSelect="false" |
| 9 | > | 9 | > |
| 10 | <template #toolbar> | 10 | <template #toolbar> |
| 11 | - <a-button type="primary" @click="handleCreate"> 新增设备配置 </a-button> | 11 | + <Authority value="api:yt:admin:addDeviceConfig"> |
| 12 | + <a-button type="primary" @click="handleCreate"> 新增设备配置 </a-button> | ||
| 13 | + </Authority> | ||
| 12 | <ImpExcel @success="loadDataSuccess" dateFormat="YYYY-MM-DD"> | 14 | <ImpExcel @success="loadDataSuccess" dateFormat="YYYY-MM-DD"> |
| 13 | <a-button disabled @click="handleImport"> 导入设备配置 </a-button> | 15 | <a-button disabled @click="handleImport"> 导入设备配置 </a-button> |
| 14 | </ImpExcel> | 16 | </ImpExcel> |
| 15 | - <a-button danger color="error" @click="handleTableDel" :disabled="disabled"> | ||
| 16 | - 批量删除 | ||
| 17 | - </a-button> | 17 | + <Authority value="api:yt:admin:deleteDeviceConfig"> |
| 18 | + <a-button danger color="error" @click="handleTableDel" :disabled="disabled"> | ||
| 19 | + 批量删除 | ||
| 20 | + </a-button> | ||
| 21 | + </Authority> | ||
| 18 | </template> | 22 | </template> |
| 19 | <template #img="{ record }"> | 23 | <template #img="{ record }"> |
| 20 | <TableImg | 24 | <TableImg |
| @@ -41,11 +45,13 @@ | @@ -41,11 +45,13 @@ | ||
| 41 | }, | 45 | }, |
| 42 | { | 46 | { |
| 43 | label: '详情', | 47 | label: '详情', |
| 48 | + auth: 'api:yt:admin:viewDeviceConfig', | ||
| 44 | icon: 'ant-design:eye-outlined', | 49 | icon: 'ant-design:eye-outlined', |
| 45 | onClick: handleDetailView.bind(null, record), | 50 | onClick: handleDetailView.bind(null, record), |
| 46 | }, | 51 | }, |
| 47 | { | 52 | { |
| 48 | label: '编辑', | 53 | label: '编辑', |
| 54 | + auth: 'api:yt:admin:editDeviceConfig', | ||
| 49 | icon: 'clarity:note-edit-line', | 55 | icon: 'clarity:note-edit-line', |
| 50 | onClick: handleEdit.bind(null, record), | 56 | onClick: handleEdit.bind(null, record), |
| 51 | }, | 57 | }, |
| @@ -56,6 +62,7 @@ | @@ -56,6 +62,7 @@ | ||
| 56 | }, | 62 | }, |
| 57 | { | 63 | { |
| 58 | label: '删除', | 64 | label: '删除', |
| 65 | + auth: 'api:yt:admin:deleteDeviceConfig', | ||
| 59 | icon: 'ant-design:delete-outlined', | 66 | icon: 'ant-design:delete-outlined', |
| 60 | color: 'error', | 67 | color: 'error', |
| 61 | popConfirm: { | 68 | popConfirm: { |
| @@ -88,10 +95,11 @@ | @@ -88,10 +95,11 @@ | ||
| 88 | import DeviceProfileModal from '/@/views/device/profiles/DeviceProfileModal.vue'; | 95 | import DeviceProfileModal from '/@/views/device/profiles/DeviceProfileModal.vue'; |
| 89 | import { ImpExcel, ExcelData } from '/@/components/Excel'; | 96 | import { ImpExcel, ExcelData } from '/@/components/Excel'; |
| 90 | // import { jsonToSheetXlsx, ExportModalResult } from '/@/components/Excel'; | 97 | // import { jsonToSheetXlsx, ExportModalResult } from '/@/components/Excel'; |
| 98 | + import { Authority } from '/@/components/Authority'; | ||
| 91 | 99 | ||
| 92 | export default defineComponent({ | 100 | export default defineComponent({ |
| 93 | name: 'DeviceProfileManagement', | 101 | name: 'DeviceProfileManagement', |
| 94 | - components: { BasicTable, DeviceProfileModal, TableAction, ImpExcel, TableImg }, | 102 | + components: { BasicTable, DeviceProfileModal, TableAction, ImpExcel, TableImg, Authority }, |
| 95 | setup() { | 103 | setup() { |
| 96 | let selectedRowKeys: any = []; | 104 | let selectedRowKeys: any = []; |
| 97 | const deviceDetailRef = ref(null); | 105 | const deviceDetailRef = ref(null); |
| @@ -244,14 +252,21 @@ | @@ -244,14 +252,21 @@ | ||
| 244 | } | 252 | } |
| 245 | }; | 253 | }; |
| 246 | const handleTableDel = () => { | 254 | const handleTableDel = () => { |
| 255 | + disabled.value = true; | ||
| 247 | deviceConfigDelete(selectedRowKeys) | 256 | deviceConfigDelete(selectedRowKeys) |
| 248 | .then(() => { | 257 | .then(() => { |
| 249 | createMessage.success('删除设备配置成功'); | 258 | createMessage.success('删除设备配置成功'); |
| 250 | handleSuccess(); | 259 | handleSuccess(); |
| 260 | + setTimeout(() => { | ||
| 261 | + disabled.value = false; | ||
| 262 | + }, 3000); | ||
| 251 | selectedRowKeys.length = 0; | 263 | selectedRowKeys.length = 0; |
| 252 | }) | 264 | }) |
| 253 | .catch((e) => { | 265 | .catch((e) => { |
| 254 | selectedRowKeys.length = 0; | 266 | selectedRowKeys.length = 0; |
| 267 | + setTimeout(() => { | ||
| 268 | + disabled.value = false; | ||
| 269 | + }, 3000); | ||
| 255 | createMessage.error(e); | 270 | createMessage.error(e); |
| 256 | }); | 271 | }); |
| 257 | selectedRowKeys.length = 0; | 272 | selectedRowKeys.length = 0; |
| @@ -2,10 +2,18 @@ | @@ -2,10 +2,18 @@ | ||
| 2 | <div> | 2 | <div> |
| 3 | <BasicTable @register="registerTable" :clickToRowSelect="false"> | 3 | <BasicTable @register="registerTable" :clickToRowSelect="false"> |
| 4 | <template #toolbar> | 4 | <template #toolbar> |
| 5 | - <a-button type="primary" @click="handleCreate"> 新增消息配置 </a-button> | ||
| 6 | - <a-button color="error" @click="handleDeleteOrBatchDelete(null)" :disabled="hasBatchDelete"> | ||
| 7 | - 批量删除 | ||
| 8 | - </a-button> | 5 | + <Authority value="api:yt:admin:addMessageConfig"> |
| 6 | + <a-button type="primary" @click="handleCreate"> 新增消息配置 </a-button> | ||
| 7 | + </Authority> | ||
| 8 | + <Authority value="api:yt:admin:deleteMessageConfig"> | ||
| 9 | + <a-button | ||
| 10 | + color="error" | ||
| 11 | + @click="handleDeleteOrBatchDelete(null)" | ||
| 12 | + :disabled="hasBatchDelete" | ||
| 13 | + > | ||
| 14 | + 批量删除 | ||
| 15 | + </a-button> | ||
| 16 | + </Authority> | ||
| 9 | </template> | 17 | </template> |
| 10 | <template #config="{ record }"> | 18 | <template #config="{ record }"> |
| 11 | <a-button type="link" class="ml-2" @click="showData(record)"> 查看配置 </a-button> | 19 | <a-button type="link" class="ml-2" @click="showData(record)"> 查看配置 </a-button> |
| @@ -24,11 +32,13 @@ | @@ -24,11 +32,13 @@ | ||
| 24 | :actions="[ | 32 | :actions="[ |
| 25 | { | 33 | { |
| 26 | label: '编辑', | 34 | label: '编辑', |
| 35 | + auth: 'api:yt:admin:editMessageConfig', | ||
| 27 | icon: 'clarity:note-edit-line', | 36 | icon: 'clarity:note-edit-line', |
| 28 | onClick: handleEdit.bind(null, record), | 37 | onClick: handleEdit.bind(null, record), |
| 29 | }, | 38 | }, |
| 30 | { | 39 | { |
| 31 | label: '删除', | 40 | label: '删除', |
| 41 | + auth: 'api:yt:admin:deleteMessageConfig', | ||
| 32 | icon: 'ant-design:delete-outlined', | 42 | icon: 'ant-design:delete-outlined', |
| 33 | color: 'error', | 43 | color: 'error', |
| 34 | popConfirm: { | 44 | popConfirm: { |
| @@ -57,10 +67,11 @@ | @@ -57,10 +67,11 @@ | ||
| 57 | import { useBatchDelete } from '/@/hooks/web/useBatchDelete'; | 67 | import { useBatchDelete } from '/@/hooks/web/useBatchDelete'; |
| 58 | import { Switch } from 'ant-design-vue'; | 68 | import { Switch } from 'ant-design-vue'; |
| 59 | import { setMessageConfigStatus } from '/@/api/message/config'; | 69 | import { setMessageConfigStatus } from '/@/api/message/config'; |
| 70 | + import { Authority } from '/@/components/Authority'; | ||
| 60 | 71 | ||
| 61 | export default defineComponent({ | 72 | export default defineComponent({ |
| 62 | name: 'MessageConfigManagement', | 73 | name: 'MessageConfigManagement', |
| 63 | - components: { BasicTable, ConfigDrawer, TableAction, Switch }, | 74 | + components: { BasicTable, ConfigDrawer, TableAction, Switch, Authority }, |
| 64 | setup() { | 75 | setup() { |
| 65 | const [registerDrawer, { openDrawer }] = useDrawer(); | 76 | const [registerDrawer, { openDrawer }] = useDrawer(); |
| 66 | function handleSuccess() { | 77 | function handleSuccess() { |
| @@ -3,25 +3,29 @@ | @@ -3,25 +3,29 @@ | ||
| 3 | <BasicTable @register="registerTable"> | 3 | <BasicTable @register="registerTable"> |
| 4 | <template #toolbar> | 4 | <template #toolbar> |
| 5 | <a-button type="primary" @click="handleCreate"> 导出 </a-button> | 5 | <a-button type="primary" @click="handleCreate"> 导出 </a-button> |
| 6 | - <a-button | ||
| 7 | - type="primary" | ||
| 8 | - color="error" | ||
| 9 | - @click="handleDeleteOrBatchDelete(null)" | ||
| 10 | - :disabled="hasBatchDelete" | ||
| 11 | - > | ||
| 12 | - 批量删除 | ||
| 13 | - </a-button> | 6 | + <Authority value="api:yt:admin:deleteMessageLog"> |
| 7 | + <a-button | ||
| 8 | + type="primary" | ||
| 9 | + color="error" | ||
| 10 | + @click="handleDeleteOrBatchDelete(null)" | ||
| 11 | + :disabled="hasBatchDelete" | ||
| 12 | + > | ||
| 13 | + 批量删除 | ||
| 14 | + </a-button> | ||
| 15 | + </Authority> | ||
| 14 | </template> | 16 | </template> |
| 15 | <template #action="{ record }"> | 17 | <template #action="{ record }"> |
| 16 | <TableAction | 18 | <TableAction |
| 17 | :actions="[ | 19 | :actions="[ |
| 18 | { | 20 | { |
| 19 | label: '查看', | 21 | label: '查看', |
| 22 | + auth: 'api:yt:admin:viewMessageLog', | ||
| 20 | icon: 'ant-design:fund-view-outlined', | 23 | icon: 'ant-design:fund-view-outlined', |
| 21 | onClick: handleModal.bind(null, record), | 24 | onClick: handleModal.bind(null, record), |
| 22 | }, | 25 | }, |
| 23 | { | 26 | { |
| 24 | label: '删除', | 27 | label: '删除', |
| 28 | + auth: 'api:yt:admin:deleteMessageLog', | ||
| 25 | icon: 'ant-design:delete-outlined', | 29 | icon: 'ant-design:delete-outlined', |
| 26 | color: 'error', | 30 | color: 'error', |
| 27 | popConfirm: { | 31 | popConfirm: { |
| @@ -44,9 +48,11 @@ | @@ -44,9 +48,11 @@ | ||
| 44 | import { useModal } from '/@/components/Modal'; | 48 | import { useModal } from '/@/components/Modal'; |
| 45 | import EmailDetail from './EmailDetail.vue'; | 49 | import EmailDetail from './EmailDetail.vue'; |
| 46 | import { useBatchDelete } from '/@/hooks/web/useBatchDelete'; | 50 | import { useBatchDelete } from '/@/hooks/web/useBatchDelete'; |
| 51 | + import { Authority } from '/@/components/Authority'; | ||
| 52 | + | ||
| 47 | export default defineComponent({ | 53 | export default defineComponent({ |
| 48 | name: 'EmailLog', | 54 | name: 'EmailLog', |
| 49 | - components: { EmailDetail, BasicTable, TableAction }, | 55 | + components: { EmailDetail, BasicTable, TableAction, Authority }, |
| 50 | setup() { | 56 | setup() { |
| 51 | const [registerModal, { openModal }] = useModal(); | 57 | const [registerModal, { openModal }] = useModal(); |
| 52 | const [registerTable, { reload, setProps }] = useTable({ | 58 | const [registerTable, { reload, setProps }] = useTable({ |
| @@ -3,25 +3,29 @@ | @@ -3,25 +3,29 @@ | ||
| 3 | <BasicTable @register="registerTable"> | 3 | <BasicTable @register="registerTable"> |
| 4 | <template #toolbar> | 4 | <template #toolbar> |
| 5 | <a-button type="primary" @click="handleExport"> 导出 </a-button> | 5 | <a-button type="primary" @click="handleExport"> 导出 </a-button> |
| 6 | - <a-button | ||
| 7 | - type="primary" | ||
| 8 | - color="error" | ||
| 9 | - @click="handleDeleteOrBatchDelete(null)" | ||
| 10 | - :disabled="hasBatchDelete" | ||
| 11 | - > | ||
| 12 | - 批量删除 | ||
| 13 | - </a-button> | 6 | + <Authority value="api:yt:admin:deleteMessageLog"> |
| 7 | + <a-button | ||
| 8 | + type="primary" | ||
| 9 | + color="error" | ||
| 10 | + @click="handleDeleteOrBatchDelete(null)" | ||
| 11 | + :disabled="hasBatchDelete" | ||
| 12 | + > | ||
| 13 | + 批量删除 | ||
| 14 | + </a-button> | ||
| 15 | + </Authority> | ||
| 14 | </template> | 16 | </template> |
| 15 | <template #action="{ record }"> | 17 | <template #action="{ record }"> |
| 16 | <TableAction | 18 | <TableAction |
| 17 | :actions="[ | 19 | :actions="[ |
| 18 | { | 20 | { |
| 19 | label: '查看', | 21 | label: '查看', |
| 22 | + auth: 'api:yt:admin:viewMessageLog', | ||
| 20 | icon: 'ant-design:fund-view-outlined', | 23 | icon: 'ant-design:fund-view-outlined', |
| 21 | onClick: handleQuery.bind(null, record), | 24 | onClick: handleQuery.bind(null, record), |
| 22 | }, | 25 | }, |
| 23 | { | 26 | { |
| 24 | label: '删除', | 27 | label: '删除', |
| 28 | + auth: 'api:yt:admin:deleteMessageLog', | ||
| 25 | icon: 'ant-design:delete-outlined', | 29 | icon: 'ant-design:delete-outlined', |
| 26 | color: 'error', | 30 | color: 'error', |
| 27 | popConfirm: { | 31 | popConfirm: { |
| @@ -43,10 +47,11 @@ | @@ -43,10 +47,11 @@ | ||
| 43 | import { smsLogPage, deleteSmsLog } from '/@/api/message/records'; | 47 | import { smsLogPage, deleteSmsLog } from '/@/api/message/records'; |
| 44 | import { JsonPreview } from '/@/components/CodeEditor'; | 48 | import { JsonPreview } from '/@/components/CodeEditor'; |
| 45 | import { useBatchDelete } from '/@/hooks/web/useBatchDelete'; | 49 | import { useBatchDelete } from '/@/hooks/web/useBatchDelete'; |
| 50 | + import { Authority } from '/@/components/Authority'; | ||
| 46 | 51 | ||
| 47 | export default defineComponent({ | 52 | export default defineComponent({ |
| 48 | name: 'SmsLog', | 53 | name: 'SmsLog', |
| 49 | - components: { BasicTable, TableAction }, | 54 | + components: { BasicTable, TableAction, Authority }, |
| 50 | setup() { | 55 | setup() { |
| 51 | const [registerTable, { reload, setProps }] = useTable({ | 56 | const [registerTable, { reload, setProps }] = useTable({ |
| 52 | title: '短信发送列表', | 57 | title: '短信发送列表', |
| @@ -2,10 +2,18 @@ | @@ -2,10 +2,18 @@ | ||
| 2 | <div> | 2 | <div> |
| 3 | <BasicTable @register="registerTable" :clickToRowSelect="false"> | 3 | <BasicTable @register="registerTable" :clickToRowSelect="false"> |
| 4 | <template #toolbar> | 4 | <template #toolbar> |
| 5 | - <a-button type="primary" @click="handleCreate"> 新增消息模板 </a-button> | ||
| 6 | - <a-button color="error" @click="handleDeleteOrBatchDelete(null)" :disabled="hasBatchDelete"> | ||
| 7 | - 批量删除 | ||
| 8 | - </a-button> | 5 | + <Authority value="api:yt:admin:addMessageTemplate"> |
| 6 | + <a-button type="primary" @click="handleCreate"> 新增消息模板 </a-button> | ||
| 7 | + </Authority> | ||
| 8 | + <Authority value="api:yt:admin:deleteMessageTemplate"> | ||
| 9 | + <a-button | ||
| 10 | + color="error" | ||
| 11 | + @click="handleDeleteOrBatchDelete(null)" | ||
| 12 | + :disabled="hasBatchDelete" | ||
| 13 | + > | ||
| 14 | + 批量删除 | ||
| 15 | + </a-button> | ||
| 16 | + </Authority> | ||
| 9 | </template> | 17 | </template> |
| 10 | <template #config="{ record }"> | 18 | <template #config="{ record }"> |
| 11 | <a-button type="link" class="ml-2" @click="goConfig"> | 19 | <a-button type="link" class="ml-2" @click="goConfig"> |
| @@ -31,11 +39,13 @@ | @@ -31,11 +39,13 @@ | ||
| 31 | }, | 39 | }, |
| 32 | { | 40 | { |
| 33 | label: '编辑', | 41 | label: '编辑', |
| 42 | + auth: 'api:yt:admin:editMessageTemplate', | ||
| 34 | icon: 'clarity:note-edit-line', | 43 | icon: 'clarity:note-edit-line', |
| 35 | onClick: handleEdit.bind(null, record), | 44 | onClick: handleEdit.bind(null, record), |
| 36 | }, | 45 | }, |
| 37 | { | 46 | { |
| 38 | label: '删除', | 47 | label: '删除', |
| 48 | + auth: 'api:yt:admin:deleteMessageTemplate', | ||
| 39 | icon: 'ant-design:delete-outlined', | 49 | icon: 'ant-design:delete-outlined', |
| 40 | color: 'error', | 50 | color: 'error', |
| 41 | popConfirm: { | 51 | popConfirm: { |
| @@ -70,10 +80,11 @@ | @@ -70,10 +80,11 @@ | ||
| 70 | import { useBatchDelete } from '/@/hooks/web/useBatchDelete'; | 80 | import { useBatchDelete } from '/@/hooks/web/useBatchDelete'; |
| 71 | import { Switch } from 'ant-design-vue'; | 81 | import { Switch } from 'ant-design-vue'; |
| 72 | import { setMessageTemplateStatus } from '/@/api/message/template'; | 82 | import { setMessageTemplateStatus } from '/@/api/message/template'; |
| 83 | + import { Authority } from '/@/components/Authority'; | ||
| 73 | 84 | ||
| 74 | export default defineComponent({ | 85 | export default defineComponent({ |
| 75 | name: 'MessageTemplateManagement', | 86 | name: 'MessageTemplateManagement', |
| 76 | - components: { SendSms, SendEmail, BasicTable, TemplateDrawer, TableAction, Switch }, | 87 | + components: { SendSms, SendEmail, BasicTable, TemplateDrawer, TableAction, Switch, Authority }, |
| 77 | setup() { | 88 | setup() { |
| 78 | const [registerModal, { openModal: openModal }] = useModal(); | 89 | const [registerModal, { openModal: openModal }] = useModal(); |
| 79 | const [registerMailModal, { openModal: openMailModal }] = useModal(); | 90 | const [registerMailModal, { openModal: openMailModal }] = useModal(); |
| @@ -2,16 +2,25 @@ | @@ -2,16 +2,25 @@ | ||
| 2 | <div> | 2 | <div> |
| 3 | <BasicTable :clickToRowSelect="false" @register="registerTable"> | 3 | <BasicTable :clickToRowSelect="false" @register="registerTable"> |
| 4 | <template #toolbar> | 4 | <template #toolbar> |
| 5 | - <a-button type="primary" @click="handleAdd">新增通知</a-button> | ||
| 6 | - <a-button color="error" @click="handleDeleteOrBatchDelete(null)" :disabled="hasBatchDelete"> | ||
| 7 | - 批量删除 | ||
| 8 | - </a-button> | 5 | + <Authority value="api:yt:admin:addNotify"> |
| 6 | + <a-button type="primary" @click="handleAdd">新增通知</a-button> | ||
| 7 | + </Authority> | ||
| 8 | + <Authority value="api:yt:admin:deleteNotify"> | ||
| 9 | + <a-button | ||
| 10 | + color="error" | ||
| 11 | + @click="handleDeleteOrBatchDelete(null)" | ||
| 12 | + :disabled="hasBatchDelete" | ||
| 13 | + > | ||
| 14 | + 批量删除 | ||
| 15 | + </a-button> | ||
| 16 | + </Authority> | ||
| 9 | </template> | 17 | </template> |
| 10 | <template #action="{ record }"> | 18 | <template #action="{ record }"> |
| 11 | <TableAction | 19 | <TableAction |
| 12 | :actions="[ | 20 | :actions="[ |
| 13 | { | 21 | { |
| 14 | label: '查看', | 22 | label: '查看', |
| 23 | + auth: 'api:yt:admin:viewNotify', | ||
| 15 | icon: 'ant-design:eye-outlined', | 24 | icon: 'ant-design:eye-outlined', |
| 16 | onClick: handleView.bind(null, record), | 25 | onClick: handleView.bind(null, record), |
| 17 | ifShow: (_action) => { | 26 | ifShow: (_action) => { |
| @@ -21,6 +30,7 @@ | @@ -21,6 +30,7 @@ | ||
| 21 | }, | 30 | }, |
| 22 | { | 31 | { |
| 23 | label: '编辑', | 32 | label: '编辑', |
| 33 | + auth: 'api:yt:admin:editNotify', | ||
| 24 | icon: 'clarity:note-edit-line', | 34 | icon: 'clarity:note-edit-line', |
| 25 | onClick: handleEdit.bind(null, record), | 35 | onClick: handleEdit.bind(null, record), |
| 26 | ifShow: (_action) => { | 36 | ifShow: (_action) => { |
| @@ -30,6 +40,7 @@ | @@ -30,6 +40,7 @@ | ||
| 30 | }, | 40 | }, |
| 31 | { | 41 | { |
| 32 | label: '删除', | 42 | label: '删除', |
| 43 | + auth: 'api:yt:admin:deleteNotify', | ||
| 33 | icon: 'ant-design:delete-outlined', | 44 | icon: 'ant-design:delete-outlined', |
| 34 | color: 'error', | 45 | color: 'error', |
| 35 | ifShow: record.creator === userId, | 46 | ifShow: record.creator === userId, |
| @@ -61,10 +72,11 @@ | @@ -61,10 +72,11 @@ | ||
| 61 | import { useBatchDelete } from '/@/hooks/web/useBatchDelete'; | 72 | import { useBatchDelete } from '/@/hooks/web/useBatchDelete'; |
| 62 | import { USER_INFO_KEY } from '/@/enums/cacheEnum'; | 73 | import { USER_INFO_KEY } from '/@/enums/cacheEnum'; |
| 63 | import { getAuthCache } from '/@/utils/auth'; | 74 | import { getAuthCache } from '/@/utils/auth'; |
| 75 | + import { Authority } from '/@/components/Authority'; | ||
| 64 | 76 | ||
| 65 | export default defineComponent({ | 77 | export default defineComponent({ |
| 66 | name: 'Notificationmannager', | 78 | name: 'Notificationmannager', |
| 67 | - components: { BasicTable, NotifyManagerDrawer, TableAction, tableViewChild }, | 79 | + components: { BasicTable, NotifyManagerDrawer, TableAction, tableViewChild, Authority }, |
| 68 | setup() { | 80 | setup() { |
| 69 | const userInfo: any = getAuthCache(USER_INFO_KEY); | 81 | const userInfo: any = getAuthCache(USER_INFO_KEY); |
| 70 | const userId = userInfo.userId; | 82 | const userId = userInfo.userId; |
| @@ -40,7 +40,8 @@ | @@ -40,7 +40,8 @@ | ||
| 40 | schemas: formSchema, | 40 | schemas: formSchema, |
| 41 | showActionButtonGroup: false, | 41 | showActionButtonGroup: false, |
| 42 | }); | 42 | }); |
| 43 | - const [registerDrawer, { closeDrawer }] = useDrawerInner(async (data) => { | 43 | + const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => { |
| 44 | + setDrawerProps({ confirmLoading: false }); | ||
| 44 | await resetFields(); | 45 | await resetFields(); |
| 45 | isUpdate.value = data.isUpdate; | 46 | isUpdate.value = data.isUpdate; |
| 46 | //编辑 | 47 | //编辑 |
| @@ -63,6 +64,7 @@ | @@ -63,6 +64,7 @@ | ||
| 63 | const pointId = field.receiverType === 1 ? field.organizationId + '' : null; | 64 | const pointId = field.receiverType === 1 ? field.organizationId + '' : null; |
| 64 | // 新增情况 | 65 | // 新增情况 |
| 65 | try { | 66 | try { |
| 67 | + setDrawerProps({ confirmLoading: true }); | ||
| 66 | const editNotice = { | 68 | const editNotice = { |
| 67 | ...field, | 69 | ...field, |
| 68 | pointId, | 70 | pointId, |
| @@ -72,30 +74,39 @@ | @@ -72,30 +74,39 @@ | ||
| 72 | emit('success'); | 74 | emit('success'); |
| 73 | closeDrawer(); | 75 | closeDrawer(); |
| 74 | createMessage.success('发布成功'); | 76 | createMessage.success('发布成功'); |
| 75 | - } catch {} | 77 | + } catch { |
| 78 | + } finally { | ||
| 79 | + setDrawerProps({ confirmLoading: false }); | ||
| 80 | + } | ||
| 76 | }; | 81 | }; |
| 77 | // 保存草稿 | 82 | // 保存草稿 |
| 78 | const handleSaveDraft = async () => { | 83 | const handleSaveDraft = async () => { |
| 79 | - await validate(); | ||
| 80 | - const field = getFieldsValue(); | ||
| 81 | - const pointId = field.receiverType === 1 ? field.organizationId + '' : null; | ||
| 82 | - if (!unref(isUpdate)) { | ||
| 83 | - const saveDraft = { | ||
| 84 | - ...field, | ||
| 85 | - pointId, | ||
| 86 | - }; | ||
| 87 | - await notifyAddDraftApi(saveDraft); | ||
| 88 | - } else { | ||
| 89 | - const editDraft = { | ||
| 90 | - ...field, | ||
| 91 | - pointId, | ||
| 92 | - id: unref(noticeId), | ||
| 93 | - }; | ||
| 94 | - await notifyAddDraftApi(editDraft); | 84 | + try { |
| 85 | + setDrawerProps({ confirmLoading: true }); | ||
| 86 | + await validate(); | ||
| 87 | + const field = getFieldsValue(); | ||
| 88 | + const pointId = field.receiverType === 1 ? field.organizationId + '' : null; | ||
| 89 | + if (!unref(isUpdate)) { | ||
| 90 | + const saveDraft = { | ||
| 91 | + ...field, | ||
| 92 | + pointId, | ||
| 93 | + }; | ||
| 94 | + await notifyAddDraftApi(saveDraft); | ||
| 95 | + } else { | ||
| 96 | + const editDraft = { | ||
| 97 | + ...field, | ||
| 98 | + pointId, | ||
| 99 | + id: unref(noticeId), | ||
| 100 | + }; | ||
| 101 | + await notifyAddDraftApi(editDraft); | ||
| 102 | + } | ||
| 103 | + emit('success'); | ||
| 104 | + closeDrawer(); | ||
| 105 | + createMessage.success('保存草稿成功'); | ||
| 106 | + } catch { | ||
| 107 | + } finally { | ||
| 108 | + setDrawerProps({ confirmLoading: false }); | ||
| 95 | } | 109 | } |
| 96 | - emit('success'); | ||
| 97 | - closeDrawer(); | ||
| 98 | - createMessage.success('保存草稿成功'); | ||
| 99 | }; | 110 | }; |
| 100 | const handleCancel = () => { | 111 | const handleCancel = () => { |
| 101 | // resetFields(); | 112 | // resetFields(); |
| @@ -6,6 +6,7 @@ | @@ -6,6 +6,7 @@ | ||
| 6 | :actions="[ | 6 | :actions="[ |
| 7 | { | 7 | { |
| 8 | label: '查看', | 8 | label: '查看', |
| 9 | + auth: 'api:yt:admin:viewMyNotify', | ||
| 9 | tooltip: '查看', | 10 | tooltip: '查看', |
| 10 | icon: 'ant-design:eye-outlined', | 11 | icon: 'ant-design:eye-outlined', |
| 11 | onClick: handleView.bind(null, record), | 12 | onClick: handleView.bind(null, record), |
| @@ -26,9 +26,7 @@ | @@ -26,9 +26,7 @@ | ||
| 26 | /></div> | 26 | /></div> |
| 27 | </div> | 27 | </div> |
| 28 | <div style="float: right"> | 28 | <div style="float: right"> |
| 29 | - <Button :disabled="disStatus" type="primary" @click="handleSubmit" class="mr-2" | ||
| 30 | - >确认</Button | ||
| 31 | - > | 29 | + <Button type="primary" @click="handleSubmit" class="mr-2">确认</Button> |
| 32 | <Button type="default" @click="handleCancel" class="mr-2">取消</Button> | 30 | <Button type="default" @click="handleCancel" class="mr-2">取消</Button> |
| 33 | </div> | 31 | </div> |
| 34 | </BasicModal> | 32 | </BasicModal> |
| @@ -65,7 +63,6 @@ | @@ -65,7 +63,6 @@ | ||
| 65 | emits: ['success', 'register'], | 63 | emits: ['success', 'register'], |
| 66 | setup(_, { emit }) { | 64 | setup(_, { emit }) { |
| 67 | const { createMessage } = useMessage(); | 65 | const { createMessage } = useMessage(); |
| 68 | - const disStatus = ref(false); | ||
| 69 | const { proxy } = getCurrentInstance() as any; | 66 | const { proxy } = getCurrentInstance() as any; |
| 70 | let allPostForm: any = reactive({}); | 67 | let allPostForm: any = reactive({}); |
| 71 | const getNameObj = reactive({ | 68 | const getNameObj = reactive({ |
| @@ -106,9 +103,11 @@ | @@ -106,9 +103,11 @@ | ||
| 106 | editType.name = d.name; | 103 | editType.name = d.name; |
| 107 | }; | 104 | }; |
| 108 | 105 | ||
| 109 | - const [registerDrawer, { closeModal }] = useModalInner(async (data) => { | 106 | + const [registerDrawer, { setModalProps, closeModal }] = useModalInner(async (data) => { |
| 110 | isUpdate.value = !!data?.isUpdate; | 107 | isUpdate.value = !!data?.isUpdate; |
| 111 | current.value = 0; | 108 | current.value = 0; |
| 109 | + setModalProps({ confirmLoading: false }); | ||
| 110 | + | ||
| 112 | if (unref(isUpdate)) { | 111 | if (unref(isUpdate)) { |
| 113 | editPostId.value = data.record.id; | 112 | editPostId.value = data.record.id; |
| 114 | editNextType.type = data.record.type; | 113 | editNextType.type = data.record.type; |
| @@ -216,24 +215,26 @@ | @@ -216,24 +215,26 @@ | ||
| 216 | } | 215 | } |
| 217 | }; | 216 | }; |
| 218 | const handleSubmit = async () => { | 217 | const handleSubmit = async () => { |
| 219 | - if (!unref(isUpdate)) { | ||
| 220 | - disStatus.value = true; | ||
| 221 | - await addOrEditFunc(); | ||
| 222 | - await postAddConvertApi(allPostForm); | ||
| 223 | - createMessage.success('数据流转新增成功'); | ||
| 224 | - emit('success'); | ||
| 225 | - defineClearFunc(); | ||
| 226 | - closeModal(); | ||
| 227 | - setTimeout(() => { | ||
| 228 | - disStatus.value = false; | ||
| 229 | - }, 2000); | ||
| 230 | - } else { | ||
| 231 | - await addOrEditFunc(); | ||
| 232 | - await postAddConvertApi(allPostForm); | ||
| 233 | - createMessage.success('数据流转编辑成功'); | ||
| 234 | - emit('success'); | ||
| 235 | - defineClearFunc(); | ||
| 236 | - closeModal(); | 218 | + try { |
| 219 | + setModalProps({ confirmLoading: true }); | ||
| 220 | + if (!unref(isUpdate)) { | ||
| 221 | + await addOrEditFunc(); | ||
| 222 | + await postAddConvertApi(allPostForm); | ||
| 223 | + createMessage.success('数据流转新增成功'); | ||
| 224 | + emit('success'); | ||
| 225 | + defineClearFunc(); | ||
| 226 | + closeModal(); | ||
| 227 | + } else { | ||
| 228 | + await addOrEditFunc(); | ||
| 229 | + await postAddConvertApi(allPostForm); | ||
| 230 | + createMessage.success('数据流转编辑成功'); | ||
| 231 | + emit('success'); | ||
| 232 | + defineClearFunc(); | ||
| 233 | + closeModal(); | ||
| 234 | + } | ||
| 235 | + } catch { | ||
| 236 | + } finally { | ||
| 237 | + setModalProps({ confirmLoading: false }); | ||
| 237 | } | 238 | } |
| 238 | }; | 239 | }; |
| 239 | return { | 240 | return { |
| @@ -247,7 +248,6 @@ | @@ -247,7 +248,6 @@ | ||
| 247 | getModeSelectVal, | 248 | getModeSelectVal, |
| 248 | refTransferConfigParams, | 249 | refTransferConfigParams, |
| 249 | refTransferConfigMode, | 250 | refTransferConfigMode, |
| 250 | - disStatus, | ||
| 251 | }; | 251 | }; |
| 252 | }, | 252 | }, |
| 253 | }); | 253 | }); |
| @@ -8,14 +8,18 @@ | @@ -8,14 +8,18 @@ | ||
| 8 | :clickToRowSelect="false" | 8 | :clickToRowSelect="false" |
| 9 | > | 9 | > |
| 10 | <template #toolbar> | 10 | <template #toolbar> |
| 11 | - <a-button type="primary" @click="handleAdd"> 添加流转 </a-button> | ||
| 12 | - <a-button | ||
| 13 | - :disabled="disabledStatus1" | ||
| 14 | - @click="handleDelete" | ||
| 15 | - :type="disabledStatus1 ? 'default' : 'primary'" | ||
| 16 | - > | ||
| 17 | - <span :style="{ color: disabledStatus1 ? 'grey' : 'white' }">批量删除</span> | ||
| 18 | - </a-button> | 11 | + <Authority value="api:yt:admin:addDataFlow"> |
| 12 | + <a-button type="primary" @click="handleAdd"> 添加流转 </a-button> | ||
| 13 | + </Authority> | ||
| 14 | + <Authority value="api:yt:admin:deleteDataFlow"> | ||
| 15 | + <a-button | ||
| 16 | + :disabled="disabledStatus1" | ||
| 17 | + @click="handleDelete" | ||
| 18 | + :type="disabledStatus1 ? 'default' : 'primary'" | ||
| 19 | + > | ||
| 20 | + <span :style="{ color: disabledStatus1 ? 'grey' : 'white' }">批量删除</span> | ||
| 21 | + </a-button> | ||
| 22 | + </Authority> | ||
| 19 | <a-button | 23 | <a-button |
| 20 | :disabled="disabledStatus2" | 24 | :disabled="disabledStatus2" |
| 21 | @click="handleMutiuteDisable" | 25 | @click="handleMutiuteDisable" |
| @@ -36,6 +40,7 @@ | @@ -36,6 +40,7 @@ | ||
| 36 | :actions="[ | 40 | :actions="[ |
| 37 | { | 41 | { |
| 38 | label: '编辑', | 42 | label: '编辑', |
| 43 | + auth: 'api:yt:admin:editDataFlow', | ||
| 39 | icon: 'clarity:note-edit-line', | 44 | icon: 'clarity:note-edit-line', |
| 40 | onClick: handleEdit.bind(null, record), | 45 | onClick: handleEdit.bind(null, record), |
| 41 | ifShow: (_action) => { | 46 | ifShow: (_action) => { |
| @@ -45,6 +50,7 @@ | @@ -45,6 +50,7 @@ | ||
| 45 | 50 | ||
| 46 | { | 51 | { |
| 47 | label: '删除', | 52 | label: '删除', |
| 53 | + auth: 'api:yt:admin:deleteDataFlow', | ||
| 48 | icon: 'ant-design:delete-outlined', | 54 | icon: 'ant-design:delete-outlined', |
| 49 | color: 'error', | 55 | color: 'error', |
| 50 | popConfirm: { | 56 | popConfirm: { |
| @@ -99,10 +105,11 @@ | @@ -99,10 +105,11 @@ | ||
| 99 | deleteConvertApi, | 105 | deleteConvertApi, |
| 100 | } from '/@/api/datamanager/dataManagerApi'; | 106 | } from '/@/api/datamanager/dataManagerApi'; |
| 101 | import { useMessage } from '/@/hooks/web/useMessage'; | 107 | import { useMessage } from '/@/hooks/web/useMessage'; |
| 108 | + import { Authority } from '/@/components/Authority'; | ||
| 102 | 109 | ||
| 103 | export default defineComponent({ | 110 | export default defineComponent({ |
| 104 | name: 'Index', | 111 | name: 'Index', |
| 105 | - components: { BasicTable, TableAction, DataTransferDrawer }, | 112 | + components: { BasicTable, TableAction, DataTransferDrawer, Authority }, |
| 106 | setup() { | 113 | setup() { |
| 107 | const enableObj = reactive({ | 114 | const enableObj = reactive({ |
| 108 | convertIds: [], | 115 | convertIds: [], |
| @@ -258,20 +265,30 @@ | @@ -258,20 +265,30 @@ | ||
| 258 | 265 | ||
| 259 | const handleDelete = async () => { | 266 | const handleDelete = async () => { |
| 260 | try { | 267 | try { |
| 268 | + disabledStatus1.value = true; | ||
| 261 | setLoading(true); | 269 | setLoading(true); |
| 262 | const data = await deleteConvertApi(selectedRowKeys.value); | 270 | const data = await deleteConvertApi(selectedRowKeys.value); |
| 263 | if (data == true) { | 271 | if (data == true) { |
| 264 | createMessage.success('删除成功'); | 272 | createMessage.success('删除成功'); |
| 265 | setLoading(false); | 273 | setLoading(false); |
| 274 | + setTimeout(() => { | ||
| 275 | + disabledStatus1.value = false; | ||
| 276 | + }, 3000); | ||
| 266 | reload(); | 277 | reload(); |
| 267 | } else { | 278 | } else { |
| 268 | createMessage.error('删除失败'); | 279 | createMessage.error('删除失败'); |
| 269 | } | 280 | } |
| 270 | } catch (e: any) { | 281 | } catch (e: any) { |
| 271 | createMessage.error(e); | 282 | createMessage.error(e); |
| 283 | + setTimeout(() => { | ||
| 284 | + disabledStatus1.value = false; | ||
| 285 | + }, 3000); | ||
| 272 | } finally { | 286 | } finally { |
| 273 | setLoading(false); | 287 | setLoading(false); |
| 274 | clearSelectedRowKeys(); | 288 | clearSelectedRowKeys(); |
| 289 | + setTimeout(() => { | ||
| 290 | + disabledStatus1.value = false; | ||
| 291 | + }, 3000); | ||
| 275 | } | 292 | } |
| 276 | }; | 293 | }; |
| 277 | const handleMutiuteDisable = async () => { | 294 | const handleMutiuteDisable = async () => { |
| @@ -2,27 +2,38 @@ | @@ -2,27 +2,38 @@ | ||
| 2 | <div> | 2 | <div> |
| 3 | <BasicTable @register="registerTable"> | 3 | <BasicTable @register="registerTable"> |
| 4 | <template #toolbar> | 4 | <template #toolbar> |
| 5 | - <a-button type="primary" @click="handleAdd"> 新增场景联动 </a-button> | ||
| 6 | - <a-button color="error" @click="handleDeleteOrBatchDelete(null)" :disabled="hasBatchDelete"> | ||
| 7 | - 批量删除 | ||
| 8 | - </a-button> | 5 | + <Authority value="api:yt:admin:addLinkEdge"> |
| 6 | + <a-button type="primary" @click="handleAdd"> 新增场景联动 </a-button> | ||
| 7 | + </Authority> | ||
| 8 | + <Authority value="api:yt:admin:deleteLinkEdge"> | ||
| 9 | + <a-button | ||
| 10 | + color="error" | ||
| 11 | + @click="handleDeleteOrBatchDelete(null)" | ||
| 12 | + :disabled="hasBatchDelete" | ||
| 13 | + > | ||
| 14 | + 批量删除 | ||
| 15 | + </a-button> | ||
| 16 | + </Authority> | ||
| 9 | </template> | 17 | </template> |
| 10 | <template #action="{ record }"> | 18 | <template #action="{ record }"> |
| 11 | <TableAction | 19 | <TableAction |
| 12 | :actions="[ | 20 | :actions="[ |
| 13 | { | 21 | { |
| 14 | label: '查看', | 22 | label: '查看', |
| 23 | + auth: 'api:yt:admin:viewLinkEdge', | ||
| 15 | icon: 'ant-design:eye-outlined', | 24 | icon: 'ant-design:eye-outlined', |
| 16 | onClick: handleView.bind(null, record), | 25 | onClick: handleView.bind(null, record), |
| 17 | }, | 26 | }, |
| 18 | { | 27 | { |
| 19 | label: '编辑', | 28 | label: '编辑', |
| 29 | + auth: 'api:yt:admin:editLinkEdge', | ||
| 20 | icon: 'clarity:note-edit-line', | 30 | icon: 'clarity:note-edit-line', |
| 21 | onClick: handleEdit.bind(null, record), | 31 | onClick: handleEdit.bind(null, record), |
| 22 | ifShow: record.creator === userId && record.status !== 1, | 32 | ifShow: record.creator === userId && record.status !== 1, |
| 23 | }, | 33 | }, |
| 24 | { | 34 | { |
| 25 | label: '删除', | 35 | label: '删除', |
| 36 | + auth: 'api:yt:admin:deleteLinkEdge', | ||
| 26 | icon: 'ant-design:delete-outlined', | 37 | icon: 'ant-design:delete-outlined', |
| 27 | color: 'error', | 38 | color: 'error', |
| 28 | ifShow: record.creator === userId && record.status !== 1, | 39 | ifShow: record.creator === userId && record.status !== 1, |
| @@ -64,6 +75,7 @@ | @@ -64,6 +75,7 @@ | ||
| 64 | import { getAuthCache } from '/@/utils/auth'; | 75 | import { getAuthCache } from '/@/utils/auth'; |
| 65 | import SceneLinkAgeDrawer from './SceneLinkAgeDrawer.vue'; | 76 | import SceneLinkAgeDrawer from './SceneLinkAgeDrawer.vue'; |
| 66 | import { useMessage } from '/@/hooks/web/useMessage'; | 77 | import { useMessage } from '/@/hooks/web/useMessage'; |
| 78 | + import { Authority } from '/@/components/Authority'; | ||
| 67 | 79 | ||
| 68 | const userInfo: any = getAuthCache(USER_INFO_KEY); | 80 | const userInfo: any = getAuthCache(USER_INFO_KEY); |
| 69 | const userId = userInfo.userId; | 81 | const userId = userInfo.userId; |
| @@ -44,8 +44,9 @@ | @@ -44,8 +44,9 @@ | ||
| 44 | const aceEditor = ref(); | 44 | const aceEditor = ref(); |
| 45 | const aceRef = ref(); | 45 | const aceRef = ref(); |
| 46 | const getTitle = computed(() => (isUpdate.value ? '编辑转换脚本' : '新增转换脚本')); | 46 | const getTitle = computed(() => (isUpdate.value ? '编辑转换脚本' : '新增转换脚本')); |
| 47 | - const [register, { closeDrawer }] = useDrawerInner((data) => { | 47 | + const [register, { setDrawerProps, closeDrawer }] = useDrawerInner((data) => { |
| 48 | resetFields(); | 48 | resetFields(); |
| 49 | + setDrawerProps({ confirmLoading: false }); | ||
| 49 | isUpdate.value = data.isUpdate; | 50 | isUpdate.value = data.isUpdate; |
| 50 | initEditor(data.record?.configuration.jsScript); | 51 | initEditor(data.record?.configuration.jsScript); |
| 51 | if (isUpdate.value) { | 52 | if (isUpdate.value) { |
| @@ -85,6 +86,8 @@ | @@ -85,6 +86,8 @@ | ||
| 85 | const handleSubmit = async () => { | 86 | const handleSubmit = async () => { |
| 86 | const fieldsValue = getFieldsValue(); | 87 | const fieldsValue = getFieldsValue(); |
| 87 | try { | 88 | try { |
| 89 | + setDrawerProps({ confirmLoading: true }); | ||
| 90 | + | ||
| 88 | await createOrEditTransformScriptApi({ | 91 | await createOrEditTransformScriptApi({ |
| 89 | configuration: { | 92 | configuration: { |
| 90 | jsScript: aceEditor.value.getValue(), | 93 | jsScript: aceEditor.value.getValue(), |
| @@ -99,6 +102,8 @@ | @@ -99,6 +102,8 @@ | ||
| 99 | } catch (e) { | 102 | } catch (e) { |
| 100 | const { createMessage } = useMessage(); | 103 | const { createMessage } = useMessage(); |
| 101 | createMessage.success('保存失败'); | 104 | createMessage.success('保存失败'); |
| 105 | + } finally { | ||
| 106 | + setDrawerProps({ confirmLoading: false }); | ||
| 102 | } | 107 | } |
| 103 | }; | 108 | }; |
| 104 | const handleFormat = () => { | 109 | const handleFormat = () => { |
| @@ -2,10 +2,18 @@ | @@ -2,10 +2,18 @@ | ||
| 2 | <div> | 2 | <div> |
| 3 | <BasicTable @register="registerTable" v-show="isStatus === 0"> | 3 | <BasicTable @register="registerTable" v-show="isStatus === 0"> |
| 4 | <template #toolbar> | 4 | <template #toolbar> |
| 5 | - <a-button type="primary" @click="handleCreate"> 新增转换脚本 </a-button> | ||
| 6 | - <a-button color="error" @click="handleDeleteOrBatchDelete(null)" :disabled="hasBatchDelete"> | ||
| 7 | - 批量删除 | ||
| 8 | - </a-button> | 5 | + <Authority value="api:yt:admin:addScript"> |
| 6 | + <a-button type="primary" @click="handleCreate"> 新增转换脚本 </a-button> | ||
| 7 | + </Authority> | ||
| 8 | + <Authority value="api:yt:admin:deleteScript"> | ||
| 9 | + <a-button | ||
| 10 | + color="error" | ||
| 11 | + @click="handleDeleteOrBatchDelete(null)" | ||
| 12 | + :disabled="hasBatchDelete" | ||
| 13 | + > | ||
| 14 | + 批量删除 | ||
| 15 | + </a-button> | ||
| 16 | + </Authority> | ||
| 9 | </template> | 17 | </template> |
| 10 | <template #status="{ record }"> | 18 | <template #status="{ record }"> |
| 11 | <Switch | 19 | <Switch |
| @@ -21,12 +29,13 @@ | @@ -21,12 +29,13 @@ | ||
| 21 | :actions="[ | 29 | :actions="[ |
| 22 | { | 30 | { |
| 23 | label: '编辑', | 31 | label: '编辑', |
| 32 | + auth: 'api:yt:admin:editScript', | ||
| 24 | icon: 'clarity:note-edit-line', | 33 | icon: 'clarity:note-edit-line', |
| 25 | - | ||
| 26 | onClick: handleEdit.bind(null, record), | 34 | onClick: handleEdit.bind(null, record), |
| 27 | }, | 35 | }, |
| 28 | { | 36 | { |
| 29 | label: '删除', | 37 | label: '删除', |
| 38 | + auth: 'api:yt:admin:deleteScript', | ||
| 30 | icon: 'ant-design:delete-outlined', | 39 | icon: 'ant-design:delete-outlined', |
| 31 | ifShow: record.status == 0, | 40 | ifShow: record.status == 0, |
| 32 | color: 'error', | 41 | color: 'error', |
| @@ -61,6 +70,7 @@ | @@ -61,6 +70,7 @@ | ||
| 61 | import { useMessage } from '/@/hooks/web/useMessage'; | 70 | import { useMessage } from '/@/hooks/web/useMessage'; |
| 62 | import { updateTransformScriptStatusApi } from '/@/api/device/TransformScriptApi'; | 71 | import { updateTransformScriptStatusApi } from '/@/api/device/TransformScriptApi'; |
| 63 | import { useBatchDelete } from '/@/hooks/web/useBatchDelete'; | 72 | import { useBatchDelete } from '/@/hooks/web/useBatchDelete'; |
| 73 | + import { Authority } from '/@/components/Authority'; | ||
| 64 | 74 | ||
| 65 | const handleSuccess = () => { | 75 | const handleSuccess = () => { |
| 66 | reload(); | 76 | reload(); |
| @@ -8,14 +8,18 @@ | @@ -8,14 +8,18 @@ | ||
| 8 | /> | 8 | /> |
| 9 | <BasicTable :clickToRowSelect="false" @register="registerTable" class="w-3/4 xl:w-4/5"> | 9 | <BasicTable :clickToRowSelect="false" @register="registerTable" class="w-3/4 xl:w-4/5"> |
| 10 | <template #toolbar> | 10 | <template #toolbar> |
| 11 | - <a-button type="primary" @click="handleCreate">新增账号</a-button> | ||
| 12 | - <a-button | ||
| 13 | - color="error" | ||
| 14 | - @click="handleDeleteOrBatchDelete(null)" | ||
| 15 | - :disabled="hasBatchDelete" | ||
| 16 | - > | ||
| 17 | - 批量删除 | ||
| 18 | - </a-button> | 11 | + <Authority value="api:yt:admin:addAccount"> |
| 12 | + <a-button type="primary" @click="handleCreate">新增账号</a-button> | ||
| 13 | + </Authority> | ||
| 14 | + <Authority value="api:yt:admin:deleteAccount"> | ||
| 15 | + <a-button | ||
| 16 | + color="error" | ||
| 17 | + @click="handleDeleteOrBatchDelete(null)" | ||
| 18 | + :disabled="hasBatchDelete" | ||
| 19 | + > | ||
| 20 | + 批量删除 | ||
| 21 | + </a-button> | ||
| 22 | + </Authority> | ||
| 19 | </template> | 23 | </template> |
| 20 | <template #status="{ record }"> | 24 | <template #status="{ record }"> |
| 21 | <Tag | 25 | <Tag |
| @@ -41,6 +45,7 @@ | @@ -41,6 +45,7 @@ | ||
| 41 | :actions="[ | 45 | :actions="[ |
| 42 | { | 46 | { |
| 43 | label: '用户详情', | 47 | label: '用户详情', |
| 48 | + auth: 'api:yt:admin:viewAccount', | ||
| 44 | icon: 'clarity:info-standard-line', | 49 | icon: 'clarity:info-standard-line', |
| 45 | tooltip: '用户详情', | 50 | tooltip: '用户详情', |
| 46 | onClick: handleView.bind(null, record), | 51 | onClick: handleView.bind(null, record), |
| @@ -48,6 +53,7 @@ | @@ -48,6 +53,7 @@ | ||
| 48 | }, | 53 | }, |
| 49 | { | 54 | { |
| 50 | label: '编辑', | 55 | label: '编辑', |
| 56 | + auth: 'api:yt:admin:editAccount', | ||
| 51 | icon: 'clarity:note-edit-line', | 57 | icon: 'clarity:note-edit-line', |
| 52 | tooltip: '编辑', | 58 | tooltip: '编辑', |
| 53 | onClick: handleEdit.bind(null, record), | 59 | onClick: handleEdit.bind(null, record), |
| @@ -55,6 +61,7 @@ | @@ -55,6 +61,7 @@ | ||
| 55 | }, | 61 | }, |
| 56 | { | 62 | { |
| 57 | label: '删除', | 63 | label: '删除', |
| 64 | + auth: 'api:yt:admin:deleteAccount', | ||
| 58 | icon: 'ant-design:delete-outlined', | 65 | icon: 'ant-design:delete-outlined', |
| 59 | color: 'error', | 66 | color: 'error', |
| 60 | tooltip: '删除', | 67 | tooltip: '删除', |
| @@ -84,9 +91,19 @@ | @@ -84,9 +91,19 @@ | ||
| 84 | import { columns, searchFormSchema } from './account.data'; | 91 | import { columns, searchFormSchema } from './account.data'; |
| 85 | import { useGo } from '/@/hooks/web/usePage'; | 92 | import { useGo } from '/@/hooks/web/usePage'; |
| 86 | import { useBatchDelete } from '/@/hooks/web/useBatchDelete'; | 93 | import { useBatchDelete } from '/@/hooks/web/useBatchDelete'; |
| 94 | + import { Authority } from '/@/components/Authority'; | ||
| 95 | + | ||
| 87 | export default defineComponent({ | 96 | export default defineComponent({ |
| 88 | name: 'AccountManagement', | 97 | name: 'AccountManagement', |
| 89 | - components: { BasicTable, PageWrapper, OrganizationIdTree, AccountModal, TableAction, Tag }, | 98 | + components: { |
| 99 | + BasicTable, | ||
| 100 | + PageWrapper, | ||
| 101 | + OrganizationIdTree, | ||
| 102 | + AccountModal, | ||
| 103 | + TableAction, | ||
| 104 | + Tag, | ||
| 105 | + Authority, | ||
| 106 | + }, | ||
| 90 | setup() { | 107 | setup() { |
| 91 | const go = useGo(); | 108 | const go = useGo(); |
| 92 | const [registerModal, { openModal }] = useModal(); | 109 | const [registerModal, { openModal }] = useModal(); |
| @@ -2,10 +2,18 @@ | @@ -2,10 +2,18 @@ | ||
| 2 | <div> | 2 | <div> |
| 3 | <BasicTable :clickToRowSelect="false" @register="registerTable"> | 3 | <BasicTable :clickToRowSelect="false" @register="registerTable"> |
| 4 | <template #toolbar> | 4 | <template #toolbar> |
| 5 | - <a-button type="primary" @click="handleCreate"> 新增字典 </a-button> | ||
| 6 | - <a-button color="error" @click="handleDeleteOrBatchDelete(null)" :disabled="hasBatchDelete"> | ||
| 7 | - 批量删除 | ||
| 8 | - </a-button> | 5 | + <Authority value="api:yt:admin:addDict"> |
| 6 | + <a-button type="primary" @click="handleCreate"> 新增字典 </a-button> | ||
| 7 | + </Authority> | ||
| 8 | + <Authority value="api:yt:admin:deleteDict"> | ||
| 9 | + <a-button | ||
| 10 | + color="error" | ||
| 11 | + @click="handleDeleteOrBatchDelete(null)" | ||
| 12 | + :disabled="hasBatchDelete" | ||
| 13 | + > | ||
| 14 | + 批量删除 | ||
| 15 | + </a-button> | ||
| 16 | + </Authority> | ||
| 9 | </template> | 17 | </template> |
| 10 | <template #action="{ record }"> | 18 | <template #action="{ record }"> |
| 11 | <TableAction | 19 | <TableAction |
| @@ -17,11 +25,13 @@ | @@ -17,11 +25,13 @@ | ||
| 17 | }, | 25 | }, |
| 18 | { | 26 | { |
| 19 | label: '编辑', | 27 | label: '编辑', |
| 28 | + auth: 'api:yt:admin:editDict', | ||
| 20 | icon: 'clarity:note-edit-line', | 29 | icon: 'clarity:note-edit-line', |
| 21 | onClick: handleEdit.bind(null, record), | 30 | onClick: handleEdit.bind(null, record), |
| 22 | }, | 31 | }, |
| 23 | { | 32 | { |
| 24 | label: '删除', | 33 | label: '删除', |
| 34 | + auth: 'api:yt:admin:deleteDict', | ||
| 25 | icon: 'ant-design:delete-outlined', | 35 | icon: 'ant-design:delete-outlined', |
| 26 | color: 'error', | 36 | color: 'error', |
| 27 | popConfirm: { | 37 | popConfirm: { |
| @@ -47,19 +57,17 @@ | @@ -47,19 +57,17 @@ | ||
| 47 | 57 | ||
| 48 | import { BasicTable, useTable, TableAction } from '/@/components/Table'; | 58 | import { BasicTable, useTable, TableAction } from '/@/components/Table'; |
| 49 | import { sysDictPage, deleteDict } from '/@/api/system/dict'; | 59 | import { sysDictPage, deleteDict } from '/@/api/system/dict'; |
| 50 | - | ||
| 51 | import { useDrawer } from '/@/components/Drawer'; | 60 | import { useDrawer } from '/@/components/Drawer'; |
| 52 | import DictDrawer from './DictDrawer.vue'; | 61 | import DictDrawer from './DictDrawer.vue'; |
| 53 | import ItemIndex from './item/ItemIndex.vue'; | 62 | import ItemIndex from './item/ItemIndex.vue'; |
| 54 | - | ||
| 55 | import { columns, searchFormSchema } from './dict.data'; | 63 | import { columns, searchFormSchema } from './dict.data'; |
| 56 | import { Tag } from 'ant-design-vue'; | 64 | import { Tag } from 'ant-design-vue'; |
| 57 | - | ||
| 58 | import { useBatchDelete } from '/@/hooks/web/useBatchDelete'; | 65 | import { useBatchDelete } from '/@/hooks/web/useBatchDelete'; |
| 66 | + import { Authority } from '/@/components/Authority'; | ||
| 59 | 67 | ||
| 60 | export default defineComponent({ | 68 | export default defineComponent({ |
| 61 | name: 'DictManagement', | 69 | name: 'DictManagement', |
| 62 | - components: { BasicTable, DictDrawer, ItemIndex, TableAction, Tag }, | 70 | + components: { BasicTable, DictDrawer, ItemIndex, TableAction, Tag, Authority }, |
| 63 | setup() { | 71 | setup() { |
| 64 | const [registerDrawer, { openDrawer: openDrawer }] = useDrawer(); | 72 | const [registerDrawer, { openDrawer: openDrawer }] = useDrawer(); |
| 65 | const [registerItemDrawer, { openDrawer: openItemDrawer }] = useDrawer(); | 73 | const [registerItemDrawer, { openDrawer: openItemDrawer }] = useDrawer(); |
| @@ -2,14 +2,16 @@ | @@ -2,14 +2,16 @@ | ||
| 2 | <div> | 2 | <div> |
| 3 | <BasicTable :clickToRowSelect="false" @register="registerTable" :searchInfo="searchInfo"> | 3 | <BasicTable :clickToRowSelect="false" @register="registerTable" :searchInfo="searchInfo"> |
| 4 | <template #toolbar> | 4 | <template #toolbar> |
| 5 | - <a-button | ||
| 6 | - type="primary" | ||
| 7 | - color="error" | ||
| 8 | - @click="handleDeleteOrBatchDelete(null)" | ||
| 9 | - :disabled="hasBatchDelete" | ||
| 10 | - > | ||
| 11 | - 批量删除 | ||
| 12 | - </a-button> | 5 | + <Authority value="api:yt:admin:deleteFeedBack"> |
| 6 | + <a-button | ||
| 7 | + type="primary" | ||
| 8 | + color="error" | ||
| 9 | + @click="handleDeleteOrBatchDelete(null)" | ||
| 10 | + :disabled="hasBatchDelete" | ||
| 11 | + > | ||
| 12 | + 批量删除 | ||
| 13 | + </a-button> | ||
| 14 | + </Authority> | ||
| 13 | </template> | 15 | </template> |
| 14 | <template #config="{ record }"> | 16 | <template #config="{ record }"> |
| 15 | <a-button type="link" class="ml-2" @click="showData(record)"> 查看反馈方式 </a-button> | 17 | <a-button type="link" class="ml-2" @click="showData(record)"> 查看反馈方式 </a-button> |
| @@ -19,11 +21,13 @@ | @@ -19,11 +21,13 @@ | ||
| 19 | :actions="[ | 21 | :actions="[ |
| 20 | { | 22 | { |
| 21 | label: '预览', | 23 | label: '预览', |
| 24 | + auth: 'api:yt:admin:viewFeedBack', | ||
| 22 | icon: 'clarity:note-edit-line', | 25 | icon: 'clarity:note-edit-line', |
| 23 | onClick: handleViewVideo.bind(null, record), | 26 | onClick: handleViewVideo.bind(null, record), |
| 24 | }, | 27 | }, |
| 25 | { | 28 | { |
| 26 | label: '删除', | 29 | label: '删除', |
| 30 | + auth: 'api:yt:admin:deleteFeedBack', | ||
| 27 | icon: 'ant-design:delete-outlined', | 31 | icon: 'ant-design:delete-outlined', |
| 28 | color: 'error', | 32 | color: 'error', |
| 29 | popConfirm: { | 33 | popConfirm: { |
| @@ -50,19 +54,26 @@ | @@ -50,19 +54,26 @@ | ||
| 50 | import { useModal } from '/@/components/Modal'; | 54 | import { useModal } from '/@/components/Modal'; |
| 51 | import { Modal } from 'ant-design-vue'; | 55 | import { Modal } from 'ant-design-vue'; |
| 52 | import { JsonPreview } from '/@/components/CodeEditor'; | 56 | import { JsonPreview } from '/@/components/CodeEditor'; |
| 57 | + import { Authority } from '/@/components/Authority'; | ||
| 53 | 58 | ||
| 54 | export default defineComponent({ | 59 | export default defineComponent({ |
| 55 | components: { | 60 | components: { |
| 56 | BasicTable, | 61 | BasicTable, |
| 57 | TableAction, | 62 | TableAction, |
| 58 | FeedbackDrawer, | 63 | FeedbackDrawer, |
| 64 | + Authority, | ||
| 59 | }, | 65 | }, |
| 60 | setup() { | 66 | setup() { |
| 61 | let selectedRowIds = ref<string[]>([]); | 67 | let selectedRowIds = ref<string[]>([]); |
| 62 | - const hasBatchDelete = computed(() => selectedRowIds.value.length <= 0); | 68 | + const hasBatchDelete = ref(true); |
| 63 | // 复选框事件 | 69 | // 复选框事件 |
| 64 | const onSelectRowChange = (selectedRowKeys: string[]) => { | 70 | const onSelectRowChange = (selectedRowKeys: string[]) => { |
| 65 | selectedRowIds.value = selectedRowKeys; | 71 | selectedRowIds.value = selectedRowKeys; |
| 72 | + if (selectedRowIds.value.length > 0) { | ||
| 73 | + hasBatchDelete.value = false; | ||
| 74 | + } else { | ||
| 75 | + hasBatchDelete.value = true; | ||
| 76 | + } | ||
| 66 | }; | 77 | }; |
| 67 | const searchInfo = reactive<Recordable>({}); | 78 | const searchInfo = reactive<Recordable>({}); |
| 68 | const [registerModal] = useModal(); | 79 | const [registerModal] = useModal(); |
| @@ -123,11 +134,15 @@ | @@ -123,11 +134,15 @@ | ||
| 123 | handleSuccess(); | 134 | handleSuccess(); |
| 124 | } catch (e) {} | 135 | } catch (e) {} |
| 125 | } else { | 136 | } else { |
| 137 | + hasBatchDelete.value = true; | ||
| 126 | try { | 138 | try { |
| 127 | await deleteFeedbackManage(selectedRowIds.value); | 139 | await deleteFeedbackManage(selectedRowIds.value); |
| 128 | createMessage.success('批量删除成功'); | 140 | createMessage.success('批量删除成功'); |
| 129 | selectedRowIds.value = []; | 141 | selectedRowIds.value = []; |
| 130 | handleSuccess(); | 142 | handleSuccess(); |
| 143 | + setTimeout(() => { | ||
| 144 | + hasBatchDelete.value = false; | ||
| 145 | + }, 3000); | ||
| 131 | } catch (e) {} | 146 | } catch (e) {} |
| 132 | } | 147 | } |
| 133 | }; | 148 | }; |
| @@ -126,8 +126,7 @@ | @@ -126,8 +126,7 @@ | ||
| 126 | }; | 126 | }; |
| 127 | Reflect.set(values, 'meta', metaTemp); | 127 | Reflect.set(values, 'meta', metaTemp); |
| 128 | // saveMenu | 128 | // saveMenu |
| 129 | - const data = await saveMenuApi(values, isUpdate.value); | ||
| 130 | - console.log('_______保存返回结果____data:' + data); | 129 | + await saveMenuApi(values, isUpdate.value); |
| 131 | 130 | ||
| 132 | closeDrawer(); //关闭侧框 | 131 | closeDrawer(); //关闭侧框 |
| 133 | emit('success'); | 132 | emit('success'); |
| @@ -2,23 +2,33 @@ | @@ -2,23 +2,33 @@ | ||
| 2 | <div class="p-4"> | 2 | <div class="p-4"> |
| 3 | <BasicTable :clickToRowSelect="false" @register="registerTable" @fetch-success="onFetchSuccess"> | 3 | <BasicTable :clickToRowSelect="false" @register="registerTable" @fetch-success="onFetchSuccess"> |
| 4 | <template #toolbar> | 4 | <template #toolbar> |
| 5 | - <a-button type="primary" @click="handleCreate"> | ||
| 6 | - {{ getI18n }} | ||
| 7 | - </a-button> | ||
| 8 | - <a-button color="error" @click="handleDeleteOrBatchDelete(null)" :disabled="hasBatchDelete"> | ||
| 9 | - 批量删除 | ||
| 10 | - </a-button> | 5 | + <Authority value="api:yt:admin:addOrg"> |
| 6 | + <a-button type="primary" @click="handleCreate"> | ||
| 7 | + {{ getI18n }} | ||
| 8 | + </a-button> | ||
| 9 | + </Authority> | ||
| 10 | + <Authority value="api:yt:admin:deleteOrg"> | ||
| 11 | + <a-button | ||
| 12 | + color="error" | ||
| 13 | + @click="handleDeleteOrBatchDelete(null)" | ||
| 14 | + :disabled="hasBatchDelete" | ||
| 15 | + > | ||
| 16 | + 批量删除 | ||
| 17 | + </a-button> | ||
| 18 | + </Authority> | ||
| 11 | </template> | 19 | </template> |
| 12 | <template #action="{ record }"> | 20 | <template #action="{ record }"> |
| 13 | <TableAction | 21 | <TableAction |
| 14 | :actions="[ | 22 | :actions="[ |
| 15 | { | 23 | { |
| 16 | label: '编辑', | 24 | label: '编辑', |
| 25 | + auth: 'api:yt:admin:editOrg', | ||
| 17 | icon: 'clarity:note-edit-line', | 26 | icon: 'clarity:note-edit-line', |
| 18 | onClick: handleEdit.bind(null, record), | 27 | onClick: handleEdit.bind(null, record), |
| 19 | }, | 28 | }, |
| 20 | { | 29 | { |
| 21 | label: '删除', | 30 | label: '删除', |
| 31 | + auth: 'api:yt:admin:deleteOrg', | ||
| 22 | icon: 'ant-design:delete-outlined', | 32 | icon: 'ant-design:delete-outlined', |
| 23 | color: 'error', | 33 | color: 'error', |
| 24 | popConfirm: { | 34 | popConfirm: { |
| @@ -43,9 +53,11 @@ | @@ -43,9 +53,11 @@ | ||
| 43 | import { useI18n } from '/@/hooks/web/useI18n'; | 53 | import { useI18n } from '/@/hooks/web/useI18n'; |
| 44 | import { delOrganization, getOrganizationList } from '/@/api/system/system'; | 54 | import { delOrganization, getOrganizationList } from '/@/api/system/system'; |
| 45 | import { useBatchDelete } from '/@/hooks/web/useBatchDelete'; | 55 | import { useBatchDelete } from '/@/hooks/web/useBatchDelete'; |
| 56 | + import { Authority } from '/@/components/Authority'; | ||
| 57 | + | ||
| 46 | export default defineComponent({ | 58 | export default defineComponent({ |
| 47 | name: 'DeptManagement', | 59 | name: 'DeptManagement', |
| 48 | - components: { BasicTable, DeptDrawer, TableAction }, | 60 | + components: { BasicTable, DeptDrawer, TableAction, Authority }, |
| 49 | setup() { | 61 | setup() { |
| 50 | const [registerModal, { openDrawer }] = useDrawer(); | 62 | const [registerModal, { openDrawer }] = useDrawer(); |
| 51 | const { t } = useI18n(); //加载国际化 | 63 | const { t } = useI18n(); //加载国际化 |
| @@ -95,7 +95,9 @@ | @@ -95,7 +95,9 @@ | ||
| 95 | //通过角色id去获取角色对应的菜单的ids | 95 | //通过角色id去获取角色对应的菜单的ids |
| 96 | roleMenus.value = await getMenusIdsByRoleId(data.record.id); | 96 | roleMenus.value = await getMenusIdsByRoleId(data.record.id); |
| 97 | originMenus.value = [...roleMenus.value]; | 97 | originMenus.value = [...roleMenus.value]; |
| 98 | + | ||
| 98 | for (let m of treeData.value) { | 99 | for (let m of treeData.value) { |
| 100 | + console.log(m); | ||
| 99 | for (let m1 of roleMenus.value) { | 101 | for (let m1 of roleMenus.value) { |
| 100 | // 利用continue特性优化一下性能 | 102 | // 利用continue特性优化一下性能 |
| 101 | if (!(m.key === m1 && m.children.length)) continue; | 103 | if (!(m.key === m1 && m.children.length)) continue; |
| @@ -7,21 +7,27 @@ | @@ -7,21 +7,27 @@ | ||
| 7 | :clickToRowSelect="false" | 7 | :clickToRowSelect="false" |
| 8 | > | 8 | > |
| 9 | <template #toolbar> | 9 | <template #toolbar> |
| 10 | - <a-button type="primary" @click="handleCreate">新增角色</a-button> | ||
| 11 | - <a-button color="error" @click="handleDeleteOrBatchDelete(null)" :disabled="isStatus"> | ||
| 12 | - 批量删除 | ||
| 13 | - </a-button> | 10 | + <Authority value="api:yt:admin:addSysRole"> |
| 11 | + <a-button type="primary" @click="handleCreate">新增角色</a-button> | ||
| 12 | + </Authority> | ||
| 13 | + <Authority value="api:yt:admin:deleteSysRole"> | ||
| 14 | + <a-button color="error" @click="handleDeleteOrBatchDelete(null)" :disabled="isStatus"> | ||
| 15 | + 批量删除 | ||
| 16 | + </a-button> | ||
| 17 | + </Authority> | ||
| 14 | </template> | 18 | </template> |
| 15 | <template #action="{ record }"> | 19 | <template #action="{ record }"> |
| 16 | <TableAction | 20 | <TableAction |
| 17 | :actions="[ | 21 | :actions="[ |
| 18 | { | 22 | { |
| 19 | label: '编辑', | 23 | label: '编辑', |
| 24 | + auth: 'api:yt:admin:editSysRole', | ||
| 20 | icon: 'clarity:note-edit-line', | 25 | icon: 'clarity:note-edit-line', |
| 21 | onClick: handleEdit.bind(null, record), | 26 | onClick: handleEdit.bind(null, record), |
| 22 | }, | 27 | }, |
| 23 | { | 28 | { |
| 24 | label: '删除', | 29 | label: '删除', |
| 30 | + auth: 'api:yt:admin:deleteSysRole', | ||
| 25 | icon: 'ant-design:delete-outlined', | 31 | icon: 'ant-design:delete-outlined', |
| 26 | color: 'error', | 32 | color: 'error', |
| 27 | ifShow: record.roleType != RoleEnum.SYS_ADMIN, | 33 | ifShow: record.roleType != RoleEnum.SYS_ADMIN, |
| @@ -46,10 +52,11 @@ | @@ -46,10 +52,11 @@ | ||
| 46 | import { columns, searchFormSchema } from './role.data'; | 52 | import { columns, searchFormSchema } from './role.data'; |
| 47 | import { RoleEnum } from '/@/enums/roleEnum'; | 53 | import { RoleEnum } from '/@/enums/roleEnum'; |
| 48 | import { useMessage } from '/@/hooks/web/useMessage'; | 54 | import { useMessage } from '/@/hooks/web/useMessage'; |
| 55 | + import { Authority } from '/@/components/Authority'; | ||
| 49 | 56 | ||
| 50 | export default defineComponent({ | 57 | export default defineComponent({ |
| 51 | name: 'RoleManagement', | 58 | name: 'RoleManagement', |
| 52 | - components: { BasicTable, RoleDrawer, TableAction }, | 59 | + components: { BasicTable, RoleDrawer, TableAction, Authority }, |
| 53 | setup() { | 60 | setup() { |
| 54 | const { createMessage } = useMessage(); | 61 | const { createMessage } = useMessage(); |
| 55 | const [registerDrawer, { openDrawer }] = useDrawer(); | 62 | const [registerDrawer, { openDrawer }] = useDrawer(); |
| @@ -115,15 +122,25 @@ | @@ -115,15 +122,25 @@ | ||
| 115 | handleSuccess(); | 122 | handleSuccess(); |
| 116 | } catch (e: any) {} | 123 | } catch (e: any) {} |
| 117 | } else { | 124 | } else { |
| 125 | + isStatus.value = true; | ||
| 118 | try { | 126 | try { |
| 119 | await delRole(selectArray); | 127 | await delRole(selectArray); |
| 120 | createMessage.success('批量删除成功'); | 128 | createMessage.success('批量删除成功'); |
| 121 | handleSuccess(); | 129 | handleSuccess(); |
| 122 | selectArray.length = 0; | 130 | selectArray.length = 0; |
| 131 | + setTimeout(() => { | ||
| 132 | + isStatus.value = false; | ||
| 133 | + }, 3000); | ||
| 123 | } catch (e: any) { | 134 | } catch (e: any) { |
| 124 | selectArray.length = 0; | 135 | selectArray.length = 0; |
| 136 | + setTimeout(() => { | ||
| 137 | + isStatus.value = false; | ||
| 138 | + }, 3000); | ||
| 125 | } finally { | 139 | } finally { |
| 126 | selectArray.length = 0; | 140 | selectArray.length = 0; |
| 141 | + setTimeout(() => { | ||
| 142 | + isStatus.value = false; | ||
| 143 | + }, 3000); | ||
| 127 | } | 144 | } |
| 128 | } | 145 | } |
| 129 | }; | 146 | }; |
| @@ -7,10 +7,14 @@ | @@ -7,10 +7,14 @@ | ||
| 7 | :clickToRowSelect="false" | 7 | :clickToRowSelect="false" |
| 8 | > | 8 | > |
| 9 | <template #toolbar> | 9 | <template #toolbar> |
| 10 | - <a-button type="primary" @click="handleAdd"> 新增租户配置 </a-button> | ||
| 11 | - <a-button color="error" :disabled="disabled" @click="handleMutilteDelete"> | ||
| 12 | - 批量删除 | ||
| 13 | - </a-button> | 10 | + <Authority value="api:yt:admin:addTenantConfig"> |
| 11 | + <a-button type="primary" @click="handleAdd"> 新增租户配置 </a-button> | ||
| 12 | + </Authority> | ||
| 13 | + <Authority value="api:yt:admin:deleteTenantConfig"> | ||
| 14 | + <a-button color="error" :disabled="disabled" @click="handleMutilteDelete"> | ||
| 15 | + 批量删除 | ||
| 16 | + </a-button> | ||
| 17 | + </Authority> | ||
| 14 | </template> | 18 | </template> |
| 15 | <template #action="{ record }"> | 19 | <template #action="{ record }"> |
| 16 | <TableAction | 20 | <TableAction |
| @@ -23,11 +27,13 @@ | @@ -23,11 +27,13 @@ | ||
| 23 | }, | 27 | }, |
| 24 | { | 28 | { |
| 25 | label: '编辑', | 29 | label: '编辑', |
| 30 | + auth: 'api:yt:admin:editTenantConfig', | ||
| 26 | icon: 'clarity:note-edit-line', | 31 | icon: 'clarity:note-edit-line', |
| 27 | onClick: handleEdit.bind(null, record), | 32 | onClick: handleEdit.bind(null, record), |
| 28 | }, | 33 | }, |
| 29 | { | 34 | { |
| 30 | label: '删除', | 35 | label: '删除', |
| 36 | + auth: 'api:yt:admin:deleteTenantConfig', | ||
| 31 | icon: 'ant-design:delete-outlined', | 37 | icon: 'ant-design:delete-outlined', |
| 32 | color: 'error', | 38 | color: 'error', |
| 33 | popConfirm: { | 39 | popConfirm: { |
| @@ -59,10 +65,11 @@ | @@ -59,10 +65,11 @@ | ||
| 59 | deleteTenantProfileApi, | 65 | deleteTenantProfileApi, |
| 60 | setTenantProfileIsDefaultApi, | 66 | setTenantProfileIsDefaultApi, |
| 61 | } from '/@/api/tenant/tenantApi'; | 67 | } from '/@/api/tenant/tenantApi'; |
| 68 | + import { Authority } from '/@/components/Authority'; | ||
| 62 | 69 | ||
| 63 | export default defineComponent({ | 70 | export default defineComponent({ |
| 64 | name: 'Index', | 71 | name: 'Index', |
| 65 | - components: { BasicTable, TenantSettingDrawer, TableAction }, | 72 | + components: { BasicTable, TenantSettingDrawer, TableAction, Authority }, |
| 66 | setup() { | 73 | setup() { |
| 67 | const disabled = ref(true); | 74 | const disabled = ref(true); |
| 68 | let echoEditData = reactive({}); | 75 | let echoEditData = reactive({}); |
| @@ -123,11 +130,15 @@ | @@ -123,11 +130,15 @@ | ||
| 123 | } | 130 | } |
| 124 | }; | 131 | }; |
| 125 | const handleMutilteDelete = () => { | 132 | const handleMutilteDelete = () => { |
| 133 | + disabled.value = true; | ||
| 126 | selectedRowKeys.forEach(async (f: any) => { | 134 | selectedRowKeys.forEach(async (f: any) => { |
| 127 | await deleteTenantProfileApi(f.id.id); | 135 | await deleteTenantProfileApi(f.id.id); |
| 128 | createMessage.success('删除成功'); | 136 | createMessage.success('删除成功'); |
| 129 | reload(); | 137 | reload(); |
| 130 | selectedRowKeys.length = 0; | 138 | selectedRowKeys.length = 0; |
| 139 | + setTimeout(() => { | ||
| 140 | + disabled.value = false; | ||
| 141 | + }, 3000); | ||
| 131 | }); | 142 | }); |
| 132 | }; | 143 | }; |
| 133 | 144 |
| @@ -90,19 +90,25 @@ | @@ -90,19 +90,25 @@ | ||
| 90 | }; | 90 | }; |
| 91 | 91 | ||
| 92 | async function handleSubmit() { | 92 | async function handleSubmit() { |
| 93 | - if (!unref(isUpdate)) { | ||
| 94 | - getAllFieldsFunc(); | ||
| 95 | - await saveTenantProfileApi(postAllData); | ||
| 96 | - createMessage.success('租户配置新增成功'); | ||
| 97 | - closeDrawer(); | ||
| 98 | - emit('success'); | ||
| 99 | - resetFields(); | ||
| 100 | - } else { | ||
| 101 | - getAllFieldsFunc(); | ||
| 102 | - await saveTenantProfileApi(postAllData); | ||
| 103 | - createMessage.success('租户配置编辑成功'); | ||
| 104 | - closeDrawer(); | ||
| 105 | - emit('success'); | 93 | + try { |
| 94 | + setDrawerProps({ confirmLoading: true }); | ||
| 95 | + if (!unref(isUpdate)) { | ||
| 96 | + getAllFieldsFunc(); | ||
| 97 | + await saveTenantProfileApi(postAllData); | ||
| 98 | + createMessage.success('租户配置新增成功'); | ||
| 99 | + closeDrawer(); | ||
| 100 | + emit('success'); | ||
| 101 | + resetFields(); | ||
| 102 | + } else { | ||
| 103 | + getAllFieldsFunc(); | ||
| 104 | + await saveTenantProfileApi(postAllData); | ||
| 105 | + createMessage.success('租户配置编辑成功'); | ||
| 106 | + closeDrawer(); | ||
| 107 | + emit('success'); | ||
| 108 | + } | ||
| 109 | + } catch (e) { | ||
| 110 | + } finally { | ||
| 111 | + setDrawerProps({ confirmLoading: false }); | ||
| 106 | } | 112 | } |
| 107 | } | 113 | } |
| 108 | return { | 114 | return { |
| @@ -2,7 +2,9 @@ | @@ -2,7 +2,9 @@ | ||
| 2 | <div> | 2 | <div> |
| 3 | <BasicTable @register="tenantTable"> | 3 | <BasicTable @register="tenantTable"> |
| 4 | <template #toolbar> | 4 | <template #toolbar> |
| 5 | - <a-button type="primary" @click="handleCreate"> 新增租户</a-button> | 5 | + <Authority value="api:yt:admin:saveTenant"> |
| 6 | + <a-button type="primary" @click="handleCreate"> 新增租户</a-button> | ||
| 7 | + </Authority> | ||
| 6 | </template> | 8 | </template> |
| 7 | <template #img="{ record }"> | 9 | <template #img="{ record }"> |
| 8 | <TableImg | 10 | <TableImg |
| @@ -46,11 +48,13 @@ | @@ -46,11 +48,13 @@ | ||
| 46 | { | 48 | { |
| 47 | icon: 'clarity:note-edit-line', | 49 | icon: 'clarity:note-edit-line', |
| 48 | label: '编辑', | 50 | label: '编辑', |
| 51 | + auth: 'api:yt:admin:editTenant', | ||
| 49 | onClick: handleEdit.bind(null, record), | 52 | onClick: handleEdit.bind(null, record), |
| 50 | }, | 53 | }, |
| 51 | { | 54 | { |
| 52 | icon: 'ant-design:delete-outlined', | 55 | icon: 'ant-design:delete-outlined', |
| 53 | label: '删除', | 56 | label: '删除', |
| 57 | + auth: 'api:yt:admin:deleteTenant', | ||
| 54 | color: 'error', | 58 | color: 'error', |
| 55 | popConfirm: { | 59 | popConfirm: { |
| 56 | title: '是否确认删除', | 60 | title: '是否确认删除', |
| @@ -75,8 +79,18 @@ | @@ -75,8 +79,18 @@ | ||
| 75 | import TenantDrawer from './TenantDrawer.vue'; | 79 | import TenantDrawer from './TenantDrawer.vue'; |
| 76 | import TenantAdminDrawer from './TenantAdminDrawer.vue'; | 80 | import TenantAdminDrawer from './TenantAdminDrawer.vue'; |
| 77 | import { useMessage } from '/@/hooks/web/useMessage'; | 81 | import { useMessage } from '/@/hooks/web/useMessage'; |
| 82 | + import { Authority } from '/@/components/Authority'; | ||
| 83 | + | ||
| 78 | export default defineComponent({ | 84 | export default defineComponent({ |
| 79 | - components: { BasicTable, TableImg, Tag, TableAction, TenantDrawer, TenantAdminDrawer }, | 85 | + components: { |
| 86 | + BasicTable, | ||
| 87 | + TableImg, | ||
| 88 | + Tag, | ||
| 89 | + TableAction, | ||
| 90 | + TenantDrawer, | ||
| 91 | + TenantAdminDrawer, | ||
| 92 | + Authority, | ||
| 93 | + }, | ||
| 80 | setup() { | 94 | setup() { |
| 81 | const [tenantDrawer, { openDrawer }] = useDrawer(); | 95 | const [tenantDrawer, { openDrawer }] = useDrawer(); |
| 82 | const [tenantAdminDrawer, { openDrawer: openTenantAdminDrawer }] = useDrawer(); | 96 | const [tenantAdminDrawer, { openDrawer: openTenantAdminDrawer }] = useDrawer(); |
| @@ -18,7 +18,7 @@ | @@ -18,7 +18,7 @@ | ||
| 18 | checkable | 18 | checkable |
| 19 | toolbar | 19 | toolbar |
| 20 | ref="treeRef" | 20 | ref="treeRef" |
| 21 | - title="菜单分配" | 21 | + title="权限分配" |
| 22 | :defaultExpandAll="true" | 22 | :defaultExpandAll="true" |
| 23 | /> | 23 | /> |
| 24 | </template> | 24 | </template> |
| @@ -26,7 +26,7 @@ | @@ -26,7 +26,7 @@ | ||
| 26 | </BasicDrawer> | 26 | </BasicDrawer> |
| 27 | </template> | 27 | </template> |
| 28 | <script lang="ts"> | 28 | <script lang="ts"> |
| 29 | - import { defineComponent, ref, computed, unref } from 'vue'; | 29 | + import { defineComponent, ref, computed, unref, nextTick } from 'vue'; |
| 30 | import { BasicForm, useForm } from '/@/components/Form/index'; | 30 | import { BasicForm, useForm } from '/@/components/Form/index'; |
| 31 | import { formSchema } from './role.data'; | 31 | import { formSchema } from './role.data'; |
| 32 | import { BasicDrawer, useDrawerInner } from '/@/components/Drawer'; | 32 | import { BasicDrawer, useDrawerInner } from '/@/components/Drawer'; |
| @@ -79,6 +79,7 @@ | @@ -79,6 +79,7 @@ | ||
| 79 | } | 79 | } |
| 80 | const originMenus = ref(); | 80 | const originMenus = ref(); |
| 81 | const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => { | 81 | const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => { |
| 82 | + setDrawerProps({ confirmLoading: false }); | ||
| 82 | resetFields(); | 83 | resetFields(); |
| 83 | roleId.value = ''; | 84 | roleId.value = ''; |
| 84 | // 在打开弹窗时清除所有选择的菜单 | 85 | // 在打开弹窗时清除所有选择的菜单 |
| @@ -96,14 +97,27 @@ | @@ -96,14 +97,27 @@ | ||
| 96 | //通过角色id去获取角色对应的菜单的ids | 97 | //通过角色id去获取角色对应的菜单的ids |
| 97 | roleMenus.value = await getMenusIdsByRoleId(data.record.id); | 98 | roleMenus.value = await getMenusIdsByRoleId(data.record.id); |
| 98 | originMenus.value = [...roleMenus.value]; | 99 | originMenus.value = [...roleMenus.value]; |
| 100 | + console.log('Query role ids', roleMenus.value); | ||
| 101 | + console.log('TreeData ids', treeData.value); | ||
| 99 | for (let m of treeData.value) { | 102 | for (let m of treeData.value) { |
| 103 | + console.log('m', m); | ||
| 100 | for (let m1 of roleMenus.value) { | 104 | for (let m1 of roleMenus.value) { |
| 101 | - // 利用continue特性优化一下性能 | ||
| 102 | - if (!(m.key === m1 && m.children.length)) continue; | ||
| 103 | - useChildrenIdsRemoveParentId(m1, roleMenus.value); | 105 | + if (m?.key != m1 && m?.children.length == 0) { |
| 106 | + useChildrenIdsRemoveParentId(m1, roleMenus.value); | ||
| 107 | + } | ||
| 104 | } | 108 | } |
| 105 | } | 109 | } |
| 106 | - treeRef.value.setCheckedKeys(roleMenus.value); | 110 | + // for (let m of treeData.value) { |
| 111 | + // for (let m1 of roleMenus.value) { | ||
| 112 | + // if (m.key != m1 && m?.children.length == 0) { | ||
| 113 | + // useChildrenIdsRemoveParentId(m1, roleMenus.value); | ||
| 114 | + // } | ||
| 115 | + // } | ||
| 116 | + // } | ||
| 117 | + nextTick(() => { | ||
| 118 | + console.log('Finally data', roleMenus.value); | ||
| 119 | + treeRef.value.setCheckedKeys(roleMenus.value); | ||
| 120 | + }); | ||
| 107 | roleId.value = data.record.id; | 121 | roleId.value = data.record.id; |
| 108 | setFieldsValue(data.record); | 122 | setFieldsValue(data.record); |
| 109 | } | 123 | } |
| @@ -124,10 +138,12 @@ | @@ -124,10 +138,12 @@ | ||
| 124 | roleType: RoleEnum.TENANT_ADMIN, | 138 | roleType: RoleEnum.TENANT_ADMIN, |
| 125 | menu: allCheckedKeys.value.length ? allCheckedKeys.value : originMenus.value, | 139 | menu: allCheckedKeys.value.length ? allCheckedKeys.value : originMenus.value, |
| 126 | }; | 140 | }; |
| 127 | - await saveOrUpdateRoleInfoWithMenu(req); | ||
| 128 | - closeDrawer(); | ||
| 129 | - emit('success'); | ||
| 130 | - createMessage.success(`${unref(isUpdate) ? '编辑' : '新增'}成功`); | 141 | + saveOrUpdateRoleInfoWithMenu(req).then(() => { |
| 142 | + closeDrawer(); | ||
| 143 | + emit('success'); | ||
| 144 | + createMessage.success(`${unref(isUpdate) ? '编辑' : '新增'}成功`); | ||
| 145 | + }); | ||
| 146 | + } catch { | ||
| 131 | } finally { | 147 | } finally { |
| 132 | setDrawerProps({ confirmLoading: false }); | 148 | setDrawerProps({ confirmLoading: false }); |
| 133 | } | 149 | } |
| @@ -7,21 +7,27 @@ | @@ -7,21 +7,27 @@ | ||
| 7 | :clickToRowSelect="false" | 7 | :clickToRowSelect="false" |
| 8 | > | 8 | > |
| 9 | <template #toolbar> | 9 | <template #toolbar> |
| 10 | - <a-button type="primary" @click="handleCreate"> 新增角色 </a-button> | ||
| 11 | - <a-button type="default" :disabled="disabled" @click="handleBatchDelete"> | ||
| 12 | - 批量删除 | ||
| 13 | - </a-button> | 10 | + <Authority value="api:yt:admin:addTenantRole"> |
| 11 | + <a-button type="primary" @click="handleCreate"> 新增角色 </a-button> | ||
| 12 | + </Authority> | ||
| 13 | + <Authority value="api:yt:admin:deleteTenantRole"> | ||
| 14 | + <a-button type="default" :disabled="disabled" @click="handleBatchDelete"> | ||
| 15 | + 批量删除 | ||
| 16 | + </a-button> | ||
| 17 | + </Authority> | ||
| 14 | </template> | 18 | </template> |
| 15 | <template #action="{ record }"> | 19 | <template #action="{ record }"> |
| 16 | <TableAction | 20 | <TableAction |
| 17 | :actions="[ | 21 | :actions="[ |
| 18 | { | 22 | { |
| 19 | label: '编辑', | 23 | label: '编辑', |
| 24 | + auth: 'api:yt:admin:editTenantRole', | ||
| 20 | icon: 'clarity:note-edit-line', | 25 | icon: 'clarity:note-edit-line', |
| 21 | onClick: handleEdit.bind(null, record), | 26 | onClick: handleEdit.bind(null, record), |
| 22 | }, | 27 | }, |
| 23 | { | 28 | { |
| 24 | label: '删除', | 29 | label: '删除', |
| 30 | + auth: 'api:yt:admin:deleteTenantRole', | ||
| 25 | icon: 'ant-design:delete-outlined', | 31 | icon: 'ant-design:delete-outlined', |
| 26 | color: 'error', | 32 | color: 'error', |
| 27 | popConfirm: { | 33 | popConfirm: { |
| @@ -45,10 +51,11 @@ | @@ -45,10 +51,11 @@ | ||
| 45 | import RoleDrawer from './RoleDrawer.vue'; | 51 | import RoleDrawer from './RoleDrawer.vue'; |
| 46 | import { columns, searchFormSchema } from './role.data'; | 52 | import { columns, searchFormSchema } from './role.data'; |
| 47 | import { RoleEnum } from '/@/enums/roleEnum'; | 53 | import { RoleEnum } from '/@/enums/roleEnum'; |
| 54 | + import { Authority } from '/@/components/Authority'; | ||
| 48 | 55 | ||
| 49 | export default defineComponent({ | 56 | export default defineComponent({ |
| 50 | name: 'TenantRoleManagement', | 57 | name: 'TenantRoleManagement', |
| 51 | - components: { BasicTable, RoleDrawer, TableAction }, | 58 | + components: { BasicTable, RoleDrawer, TableAction, Authority }, |
| 52 | setup() { | 59 | setup() { |
| 53 | const [registerDrawer, { openDrawer }] = useDrawer(); | 60 | const [registerDrawer, { openDrawer }] = useDrawer(); |
| 54 | let selectedRowKeys: Array<string> = []; | 61 | let selectedRowKeys: Array<string> = []; |
| @@ -106,12 +113,16 @@ | @@ -106,12 +113,16 @@ | ||
| 106 | } | 113 | } |
| 107 | }; | 114 | }; |
| 108 | const handleBatchDelete = async () => { | 115 | const handleBatchDelete = async () => { |
| 116 | + disabled.value = true; | ||
| 109 | let roleIds = selectedRowKeys.map((m: any) => { | 117 | let roleIds = selectedRowKeys.map((m: any) => { |
| 110 | return m.id; | 118 | return m.id; |
| 111 | }); | 119 | }); |
| 112 | await delRole(roleIds); | 120 | await delRole(roleIds); |
| 113 | createMessage.success('批量删除成功'); | 121 | createMessage.success('批量删除成功'); |
| 114 | reload(); | 122 | reload(); |
| 123 | + setTimeout(() => { | ||
| 124 | + disabled.value = false; | ||
| 125 | + }, 3000); | ||
| 115 | }; | 126 | }; |
| 116 | function handleSuccess() { | 127 | function handleSuccess() { |
| 117 | reload(); | 128 | reload(); |