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