Commit 8e425590715dc2aff7d8806b223b65f8feb5cffb

Authored by fengtao
1 parent 0dc39dc4

fix:修改所有的子页面按钮权限

@@ -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>({});
@@ -13,26 +13,32 @@ @@ -13,26 +13,32 @@
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:addAlarmContact">
  17 + <a-button type="primary" @click="handleCreateOrEdit(null)"> 新增告警联系人 </a-button>
  18 + </Authority>
  19 + <Authority value="api:yt:admin:deleteAlarmContact">
  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:editAlarmContact',
31 icon: 'clarity:note-edit-line', 36 icon: 'clarity:note-edit-line',
32 onClick: handleCreateOrEdit.bind(null, record), 37 onClick: handleCreateOrEdit.bind(null, record),
33 }, 38 },
34 { 39 {
35 label: '删除', 40 label: '删除',
  41 + auth: 'api:yt:admin:deleteAlarmContact',
36 icon: 'ant-design:delete-outlined', 42 icon: 'ant-design:delete-outlined',
37 color: 'error', 43 color: 'error',
38 popConfirm: { 44 popConfirm: {
@@ -57,9 +63,10 @@ @@ -57,9 +63,10 @@
57 import { useDrawer } from '/@/components/Drawer'; 63 import { useDrawer } from '/@/components/Drawer';
58 import ContactDrawer from './ContactDrawer.vue'; 64 import ContactDrawer from './ContactDrawer.vue';
59 import { useResetOrganizationTree, OrganizationIdTree } from '/@/views/common/organizationIdTree'; 65 import { useResetOrganizationTree, OrganizationIdTree } from '/@/views/common/organizationIdTree';
60 -  
61 import { getAlarmContact, deleteAlarmContact } from '/@/api/alarm/contact/alarmContact'; 66 import { getAlarmContact, deleteAlarmContact } from '/@/api/alarm/contact/alarmContact';
62 import { searchFormSchema, columns } from './config.data'; 67 import { searchFormSchema, columns } from './config.data';
  68 + import { Authority } from '/@/components/Authority';
  69 +
63 export default defineComponent({ 70 export default defineComponent({
64 components: { 71 components: {
65 PageWrapper, 72 PageWrapper,
@@ -67,6 +74,7 @@ @@ -67,6 +74,7 @@
67 BasicTable, 74 BasicTable,
68 TableAction, 75 TableAction,
69 ContactDrawer, 76 ContactDrawer,
  77 + Authority,
70 }, 78 },
71 setup() { 79 setup() {
72 let selectedRowIds = ref<string[]>([]); 80 let selectedRowIds = ref<string[]>([]);
@@ -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 },
@@ -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: {
@@ -79,6 +86,7 @@ @@ -79,6 +86,7 @@
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: {
@@ -89,13 +97,19 @@ @@ -89,13 +97,19 @@
89 CameraDrawer, 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: {
@@ -73,6 +81,8 @@ @@ -73,6 +81,8 @@
73 deleteConfigurationCenter, 81 deleteConfigurationCenter,
74 } from '/@/api/configuration/center/configurationCenter'; 82 } from '/@/api/configuration/center/configurationCenter';
75 import { getAppEnvConfig } from '/@/utils/env'; 83 import { getAppEnvConfig } from '/@/utils/env';
  84 + import { Authority } from '/@/components/Authority';
  85 +
76 export default defineComponent({ 86 export default defineComponent({
77 components: { 87 components: {
78 PageWrapper, 88 PageWrapper,
@@ -80,6 +90,7 @@ @@ -80,6 +90,7 @@
80 BasicTable, 90 BasicTable,
81 TableAction, 91 TableAction,
82 ContactDrawer, 92 ContactDrawer,
  93 + Authority,
83 }, 94 },
84 setup() { 95 setup() {
85 const { VITE_GLOB_CONFIGURATION } = getAppEnvConfig(); 96 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',
@@ -173,6 +182,8 @@ @@ -173,6 +182,8 @@
173 import { useBatchDelete } from '/@/hooks/web/useBatchDelete'; 182 import { useBatchDelete } from '/@/hooks/web/useBatchDelete';
174 import { useCopyToClipboard } from '/@/hooks/web/useCopyToClipboard'; 183 import { useCopyToClipboard } from '/@/hooks/web/useCopyToClipboard';
175 import { QuestionCircleOutlined } from '@ant-design/icons-vue'; 184 import { QuestionCircleOutlined } from '@ant-design/icons-vue';
  185 + import { Authority } from '/@/components/Authority';
  186 +
176 export default defineComponent({ 187 export default defineComponent({
177 name: 'DeviceManagement', 188 name: 'DeviceManagement',
178 components: { 189 components: {
@@ -188,6 +199,7 @@ @@ -188,6 +199,7 @@
188 Tooltip, 199 Tooltip,
189 QuestionCircleOutlined, 200 QuestionCircleOutlined,
190 Popover, 201 Popover,
  202 + Authority,
191 }, 203 },
192 setup(_) { 204 setup(_) {
193 const { hasBatchDelete, handleDeleteOrBatchDelete, selectionOptions, resetSelectedRowKeys } = 205 const { hasBatchDelete, handleDeleteOrBatchDelete, selectionOptions, resetSelectedRowKeys } =
@@ -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: {
@@ -45,9 +49,11 @@ @@ -45,9 +49,11 @@
45 import { useModal } from '/@/components/Modal'; 49 import { useModal } from '/@/components/Modal';
46 import EmailDetail from './EmailDetail.vue'; 50 import EmailDetail from './EmailDetail.vue';
47 import { useBatchDelete } from '/@/hooks/web/useBatchDelete'; 51 import { useBatchDelete } from '/@/hooks/web/useBatchDelete';
  52 + import { Authority } from '/@/components/Authority';
  53 +
48 export default defineComponent({ 54 export default defineComponent({
49 name: 'EmailLog', 55 name: 'EmailLog',
50 - components: { EmailDetail, BasicTable, TableAction }, 56 + components: { EmailDetail, BasicTable, TableAction, Authority },
51 setup() { 57 setup() {
52 const [registerModal, { openModal }] = useModal(); 58 const [registerModal, { openModal }] = useModal();
53 const { hasBatchDelete, selectionOptions, handleDeleteOrBatchDelete } = useBatchDelete( 59 const { hasBatchDelete, selectionOptions, handleDeleteOrBatchDelete } = useBatchDelete(
@@ -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 // 批量删除的hooks 56 // 批量删除的hooks
52 const { hasBatchDelete, handleDeleteOrBatchDelete, selectionOptions } = useBatchDelete( 57 const { hasBatchDelete, handleDeleteOrBatchDelete, selectionOptions } = useBatchDelete(
@@ -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: {
@@ -69,10 +79,11 @@ @@ -69,10 +79,11 @@
69 import { useBatchDelete } from '/@/hooks/web/useBatchDelete'; 79 import { useBatchDelete } from '/@/hooks/web/useBatchDelete';
70 import { Switch } from 'ant-design-vue'; 80 import { Switch } from 'ant-design-vue';
71 import { setMessageTemplateStatus } from '/@/api/message/template'; 81 import { setMessageTemplateStatus } from '/@/api/message/template';
  82 + import { Authority } from '/@/components/Authority';
72 83
73 export default defineComponent({ 84 export default defineComponent({
74 name: 'MessageTemplateManagement', 85 name: 'MessageTemplateManagement',
75 - components: { SendSms, SendEmail, BasicTable, TemplateDrawer, TableAction, Switch }, 86 + components: { SendSms, SendEmail, BasicTable, TemplateDrawer, TableAction, Switch, Authority },
76 setup() { 87 setup() {
77 const [registerModal, { openModal: openModal }] = useModal(); 88 const [registerModal, { openModal: openModal }] = useModal();
78 const [registerMailModal, { openModal: openMailModal }] = useModal(); 89 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),
@@ -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,
@@ -63,6 +74,7 @@ @@ -63,6 +74,7 @@
63 import { getAuthCache } from '/@/utils/auth'; 74 import { getAuthCache } from '/@/utils/auth';
64 import SceneLinkAgeDrawer from './SceneLinkAgeDrawer.vue'; 75 import SceneLinkAgeDrawer from './SceneLinkAgeDrawer.vue';
65 import { useMessage } from '/@/hooks/web/useMessage'; 76 import { useMessage } from '/@/hooks/web/useMessage';
  77 + import { Authority } from '/@/components/Authority';
66 78
67 const { hasBatchDelete, handleDeleteOrBatchDelete, selectionOptions, resetSelectedRowKeys } = 79 const { hasBatchDelete, handleDeleteOrBatchDelete, selectionOptions, resetSelectedRowKeys } =
68 useBatchDelete(screenLinkPageDeleteApi, handleSuccess); 80 useBatchDelete(screenLinkPageDeleteApi, handleSuccess);
@@ -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 { hasBatchDelete, handleDeleteOrBatchDelete, selectionOptions } = useBatchDelete( 109 const { hasBatchDelete, handleDeleteOrBatchDelete, selectionOptions } = useBatchDelete(
@@ -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: {
@@ -44,22 +54,19 @@ @@ -44,22 +54,19 @@
44 </template> 54 </template>
45 <script lang="ts"> 55 <script lang="ts">
46 import { defineComponent } from 'vue'; 56 import { defineComponent } from 'vue';
47 -  
48 import { BasicTable, useTable, TableAction } from '/@/components/Table'; 57 import { BasicTable, useTable, TableAction } from '/@/components/Table';
49 import { sysDictPage, deleteDict } from '/@/api/system/dict'; 58 import { sysDictPage, deleteDict } from '/@/api/system/dict';
50 -  
51 import { useDrawer } from '/@/components/Drawer'; 59 import { useDrawer } from '/@/components/Drawer';
52 import DictDrawer from './DictDrawer.vue'; 60 import DictDrawer from './DictDrawer.vue';
53 import ItemIndex from './item/ItemIndex.vue'; 61 import ItemIndex from './item/ItemIndex.vue';
54 -  
55 import { columns, searchFormSchema } from './dict.data'; 62 import { columns, searchFormSchema } from './dict.data';
56 import { Tag } from 'ant-design-vue'; 63 import { Tag } from 'ant-design-vue';
57 -  
58 import { useBatchDelete } from '/@/hooks/web/useBatchDelete'; 64 import { useBatchDelete } from '/@/hooks/web/useBatchDelete';
  65 + import { Authority } from '/@/components/Authority';
59 66
60 export default defineComponent({ 67 export default defineComponent({
61 name: 'DictManagement', 68 name: 'DictManagement',
62 - components: { BasicTable, DictDrawer, ItemIndex, TableAction, Tag }, 69 + components: { BasicTable, DictDrawer, ItemIndex, TableAction, Tag, Authority },
63 setup() { 70 setup() {
64 const [registerDrawer, { openDrawer: openDrawer }] = useDrawer(); 71 const [registerDrawer, { openDrawer: openDrawer }] = useDrawer();
65 const [registerItemDrawer, { openDrawer: openItemDrawer }] = useDrawer(); 72 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 };
@@ -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(); //加载国际化
@@ -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
@@ -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>
@@ -97,21 +97,25 @@ @@ -97,21 +97,25 @@
97 //通过角色id去获取角色对应的菜单的ids 97 //通过角色id去获取角色对应的菜单的ids
98 roleMenus.value = await getMenusIdsByRoleId(data.record.id); 98 roleMenus.value = await getMenusIdsByRoleId(data.record.id);
99 originMenus.value = [...roleMenus.value]; 99 originMenus.value = [...roleMenus.value];
100 - const copyData = [];  
101 - Object.assign(copyData, roleMenus.value.slice(0, 5));  
102 - console.log('Query role ids', copyData); 100 + console.log('Query role ids', roleMenus.value);
103 console.log('TreeData ids', treeData.value); 101 console.log('TreeData ids', treeData.value);
104 for (let m of treeData.value) { 102 for (let m of treeData.value) {
  103 + console.log('m', m);
105 for (let m1 of roleMenus.value) { 104 for (let m1 of roleMenus.value) {
106 - // 利用continue特性优化一下性能  
107 - if (m.key != m1 && m?.children.length == 0) {  
108 - console.log(m1); 105 + if (m?.key != m1 && m?.children.length == 0) {
109 useChildrenIdsRemoveParentId(m1, roleMenus.value); 106 useChildrenIdsRemoveParentId(m1, roleMenus.value);
110 } 107 }
111 } 108 }
112 } 109 }
113 - console.log('Rolemenus', 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 + // }
114 nextTick(() => { 117 nextTick(() => {
  118 + console.log('Finally data', roleMenus.value);
115 treeRef.value.setCheckedKeys(roleMenus.value); 119 treeRef.value.setCheckedKeys(roleMenus.value);
116 }); 120 });
117 roleId.value = data.record.id; 121 roleId.value = data.record.id;
@@ -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();