Commit 8195ab32713331b87a96067205f874a9bd6a01e5

Authored by loveumiko
1 parent f66dd1ed

fix: 一些权管理的问题

@@ -48,6 +48,7 @@ @@ -48,6 +48,7 @@
48 'update:value', 48 'update:value',
49 'change', 49 'change',
50 'check', 50 'check',
  51 + 'unSelectAll',
51 'update:searchValue', 52 'update:searchValue',
52 ], 53 ],
53 setup(props, { attrs, slots, emit, expose }) { 54 setup(props, { attrs, slots, emit, expose }) {
@@ -188,6 +189,7 @@ @@ -188,6 +189,7 @@
188 } 189 }
189 190
190 function checkAll(checkAll: boolean) { 191 function checkAll(checkAll: boolean) {
  192 + if (!checkAll) emit('unSelectAll');
191 state.checkedKeys = checkAll ? getEnabledKeys() : ([] as Keys); 193 state.checkedKeys = checkAll ? getEnabledKeys() : ([] as Keys);
192 } 194 }
193 195
@@ -22,6 +22,16 @@ export enum ConfigurationPermission { @@ -22,6 +22,16 @@ export enum ConfigurationPermission {
22 PREVIEW = 'api:yt:dataview:center:get_configuration_info:preview', 22 PREVIEW = 'api:yt:dataview:center:get_configuration_info:preview',
23 PUBLISH = 'api:yt:dataview:center:publish', 23 PUBLISH = 'api:yt:dataview:center:publish',
24 // CANCEL_PUBLISH = 'api:yt:dataview:center:cancel_publish', 24 // CANCEL_PUBLISH = 'api:yt:dataview:center:cancel_publish',
  25 + PUBLISH_INTERFACE = 'api:yt:dataview:center:public_interface',
  26 +}
  27 +
  28 +export enum PublicInterface {
  29 + CREATE = 'api:yt:dataview:center:public_interface:post',
  30 + LIST = 'api:yt:dataview:center:public_interface:list',
  31 + UPDATE = 'api:yt:dataview:center:public_interface:update',
  32 + DELETE = 'api:yt:dataview:center:public_interface:delete',
  33 + PUBLISH = 'api:yt:dataview:center:public_interface:publish',
  34 + CANCEL_PUBLISH = 'api:yt:dataview:center:public_interface:cancel',
25 } 35 }
26 36
27 // 查询字段 37 // 查询字段
@@ -218,7 +218,10 @@ @@ -218,7 +218,10 @@
218 <Authority v-if="!isCustomerUser" :value="ConfigurationPermission.CREATE"> 218 <Authority v-if="!isCustomerUser" :value="ConfigurationPermission.CREATE">
219 <Button type="primary" @click="handleCreateOrUpdate()"> 新增大屏 </Button> 219 <Button type="primary" @click="handleCreateOrUpdate()"> 新增大屏 </Button>
220 </Authority> 220 </Authority>
221 - <Authority v-if="hasPublicInterfacePermission" :value="ConfigurationPermission.CREATE"> 221 + <Authority
  222 + v-if="hasPublicInterfacePermission"
  223 + :value="ConfigurationPermission.PUBLISH_INTERFACE"
  224 + >
222 <Button type="primary" @click="handleCreateOrUpdatePublicApi()">公共接口管理</Button> 225 <Button type="primary" @click="handleCreateOrUpdatePublicApi()">公共接口管理</Button>
223 </Authority> 226 </Authority>
224 <CardLayoutButton v-model:value="listColumn" @change="handleCardLayoutChange" /> 227 <CardLayoutButton v-model:value="listColumn" @change="handleCardLayoutChange" />
@@ -9,23 +9,30 @@ @@ -9,23 +9,30 @@
9 <a-button type="link" class="ml-2" @click="handleRecordContent(record)"> 查看 </a-button> 9 <a-button type="link" class="ml-2" @click="handleRecordContent(record)"> 查看 </a-button>
10 </template> 10 </template>
11 <template #toolbar> 11 <template #toolbar>
12 - <a-button type="primary" @click="handleCreateOrEdit(null)"> 新增公共接口 </a-button>  
13 - <Popconfirm  
14 - title="您确定要批量删除数据"  
15 - ok-text="确定"  
16 - cancel-text="取消"  
17 - @confirm="handleDeleteOrBatchDelete(null)"  
18 - >  
19 - <a-button color="error" :disabled="hasBatchDelete"> 批量删除 </a-button>  
20 - </Popconfirm>  
21 - <Popconfirm  
22 - title="您确定要批量发布"  
23 - ok-text="确定"  
24 - cancel-text="取消"  
25 - @confirm="handleBatchPublish('batchPublish')"  
26 - >  
27 - <a-button color="error" :disabled="hasBatchPublish"> 批量发布 </a-button>  
28 - </Popconfirm> 12 + <Authority :value="PublicInterface.CREATE">
  13 + <a-button type="primary" @click="handleCreateOrEdit(null)"> 新增公共接口 </a-button>
  14 + </Authority>
  15 +
  16 + <Authority :value="PublicInterface.DELETE">
  17 + <Popconfirm
  18 + title="您确定要批量删除数据"
  19 + ok-text="确定"
  20 + cancel-text="取消"
  21 + @confirm="handleDeleteOrBatchDelete(null)"
  22 + >
  23 + <a-button color="error" :disabled="hasBatchDelete"> 批量删除 </a-button>
  24 + </Popconfirm>
  25 + </Authority>
  26 + <Authority :value="PublicInterface.PUBLISH">
  27 + <Popconfirm
  28 + title="您确定要批量发布"
  29 + ok-text="确定"
  30 + cancel-text="取消"
  31 + @confirm="handleBatchPublish('batchPublish')"
  32 + >
  33 + <a-button color="error" :disabled="hasBatchPublish"> 批量发布 </a-button>
  34 + </Popconfirm>
  35 + </Authority>
29 <!-- <Popconfirm 36 <!-- <Popconfirm
30 title="您确定要批量取消发布" 37 title="您确定要批量取消发布"
31 ok-text="确定" 38 ok-text="确定"
@@ -41,6 +48,7 @@ @@ -41,6 +48,7 @@
41 { 48 {
42 label: '发布', 49 label: '发布',
43 icon: 'ant-design:node-expand-outlined', 50 icon: 'ant-design:node-expand-outlined',
  51 + auth: PublicInterface.PUBLISH,
44 onClick: handlePublish.bind(null, 'publish', record), 52 onClick: handlePublish.bind(null, 'publish', record),
45 ifShow: () => { 53 ifShow: () => {
46 return record.state === 0 && record.creator === userId; 54 return record.state === 0 && record.creator === userId;
@@ -49,6 +57,7 @@ @@ -49,6 +57,7 @@
49 { 57 {
50 label: '取消发布', 58 label: '取消发布',
51 icon: 'ant-design:node-collapse-outlined', 59 icon: 'ant-design:node-collapse-outlined',
  60 + auth: PublicInterface.CANCEL_PUBLISH,
52 onClick: handlePublish.bind(null, 'canelPublish', record), 61 onClick: handlePublish.bind(null, 'canelPublish', record),
53 ifShow: () => { 62 ifShow: () => {
54 return record.state === 1 && record.creator === userId; 63 return record.state === 1 && record.creator === userId;
@@ -57,6 +66,7 @@ @@ -57,6 +66,7 @@
57 { 66 {
58 label: '修改', 67 label: '修改',
59 icon: 'clarity:note-edit-line', 68 icon: 'clarity:note-edit-line',
  69 + auth: PublicInterface.UPDATE,
60 onClick: handleCreateOrEdit.bind(null, record), 70 onClick: handleCreateOrEdit.bind(null, record),
61 ifShow: () => { 71 ifShow: () => {
62 return record.state === 0 && record.creator === userId; 72 return record.state === 0 && record.creator === userId;
@@ -65,6 +75,7 @@ @@ -65,6 +75,7 @@
65 { 75 {
66 label: '删除', 76 label: '删除',
67 icon: 'ant-design:delete-outlined', 77 icon: 'ant-design:delete-outlined',
  78 + auth: PublicInterface.DELETE,
68 color: 'error', 79 color: 'error',
69 ifShow: () => { 80 ifShow: () => {
70 return record.state === 0 && record.creator === userId; 81 return record.state === 0 && record.creator === userId;
@@ -99,6 +110,8 @@ @@ -99,6 +110,8 @@
99 import { useMessage } from '/@/hooks/web/useMessage'; 110 import { useMessage } from '/@/hooks/web/useMessage';
100 import { USER_INFO_KEY } from '/@/enums/cacheEnum'; 111 import { USER_INFO_KEY } from '/@/enums/cacheEnum';
101 import { getAuthCache } from '/@/utils/auth'; 112 import { getAuthCache } from '/@/utils/auth';
  113 + import { PublicInterface } from '../config';
  114 + import { Authority } from '/@/components/Authority';
102 115
103 const userInfo = getAuthCache(USER_INFO_KEY) as any; 116 const userInfo = getAuthCache(USER_INFO_KEY) as any;
104 117
@@ -119,7 +132,7 @@ @@ -119,7 +132,7 @@
119 }, 132 },
120 useSearchForm: true, 133 useSearchForm: true,
121 actionColumn: { 134 actionColumn: {
122 - width: 150, 135 + width: 180,
123 title: '操作', 136 title: '操作',
124 dataIndex: 'action', 137 dataIndex: 'action',
125 slots: { customRender: 'action' }, 138 slots: { customRender: 'action' },
@@ -16,6 +16,7 @@ @@ -16,6 +16,7 @@
16 :replaceFields="{ title: 'name', key: 'id' }" 16 :replaceFields="{ title: 'name', key: 'id' }"
17 :checkedKeys="roleMenus" 17 :checkedKeys="roleMenus"
18 @check="handleCheckClick" 18 @check="handleCheckClick"
  19 + @unSelectAll="handleUnSelectAll"
19 checkable 20 checkable
20 toolbar 21 toolbar
21 ref="treeRef" 22 ref="treeRef"
@@ -128,6 +129,11 @@ @@ -128,6 +129,11 @@
128 }); 129 });
129 const getTitle = computed(() => (!unref(isUpdate) ? '新增角色' : '编辑角色')); 130 const getTitle = computed(() => (!unref(isUpdate) ? '新增角色' : '编辑角色'));
130 131
  132 + // 取消全部的时候清除回显时获取的
  133 + const handleUnSelectAll = () => {
  134 + checkedKeysWithHalfChecked.value = [];
  135 + };
  136 +
131 async function handleSubmit() { 137 async function handleSubmit() {
132 setDrawerProps({ loading: true, confirmLoading: true }); 138 setDrawerProps({ loading: true, confirmLoading: true });
133 const { createMessage } = useMessage(); 139 const { createMessage } = useMessage();
@@ -143,7 +149,9 @@ @@ -143,7 +149,9 @@
143 roleType: RoleEnum.TENANT_ADMIN, 149 roleType: RoleEnum.TENANT_ADMIN,
144 menu, 150 menu,
145 }; 151 };
146 - if (req.menu == undefined) return createMessage.error('请勾选权限菜单'); 152 + // return;
  153 + if (req.menu == undefined || !req.menu.length)
  154 + return createMessage.error('请勾选权限菜单');
147 const res = await saveOrUpdateRoleInfoWithMenu(req); 155 const res = await saveOrUpdateRoleInfoWithMenu(req);
148 if (res) { 156 if (res) {
149 closeDrawer(); 157 closeDrawer();
@@ -247,6 +255,7 @@ @@ -247,6 +255,7 @@
247 roleMenus, 255 roleMenus,
248 treeRef, 256 treeRef,
249 handleCheckClick, 257 handleCheckClick,
  258 + handleUnSelectAll,
250 }; 259 };
251 }, 260 },
252 }); 261 });
@@ -9,6 +9,7 @@ export enum VisualBoardPermission { @@ -9,6 +9,7 @@ export enum VisualBoardPermission {
9 UPDATE = 'api:yt:data_board:update:update', 9 UPDATE = 'api:yt:data_board:update:update',
10 DELETE = 'api:yt:data_board:delete', 10 DELETE = 'api:yt:data_board:delete',
11 CREATE = '', 11 CREATE = '',
  12 + SHARE = 'api:yt:data_board:share',
12 DETAIL = 'api:yt:data_component:list', 13 DETAIL = 'api:yt:data_component:list',
13 } 14 }
14 15
@@ -99,19 +99,22 @@ @@ -99,19 +99,22 @@
99 const dropMenuList = computed<DropMenu[]>(() => { 99 const dropMenuList = computed<DropMenu[]>(() => {
100 const hasUpdatePermission = hasPermission(VisualBoardPermission.UPDATE); 100 const hasUpdatePermission = hasPermission(VisualBoardPermission.UPDATE);
101 const hasDeletePermission = hasPermission(VisualBoardPermission.DELETE); 101 const hasDeletePermission = hasPermission(VisualBoardPermission.DELETE);
102 - const basicMenu: DropMenu[] = [  
103 - {  
104 - text: '分享',  
105 - event: MoreActionEvent.SHARE,  
106 - icon: 'ant-design:share-alt-outlined',  
107 - },  
108 - ]; 102 + const hasSharePermission = hasPermission(VisualBoardPermission.SHARE);
  103 + let basicMenu: DropMenu[] = [];
109 if (hasUpdatePermission) 104 if (hasUpdatePermission)
110 basicMenu.push({ 105 basicMenu.push({
111 text: '编辑', 106 text: '编辑',
112 event: MoreActionEvent.EDIT, 107 event: MoreActionEvent.EDIT,
113 icon: 'ant-design:edit-outlined', 108 icon: 'ant-design:edit-outlined',
114 }); 109 });
  110 + if (hasSharePermission) {
  111 + basicMenu.push({
  112 + text: '分享',
  113 + event: MoreActionEvent.SHARE,
  114 + icon: 'ant-design:share-alt-outlined',
  115 + });
  116 + }
  117 +
115 if (hasDeletePermission) 118 if (hasDeletePermission)
116 basicMenu.push({ 119 basicMenu.push({
117 text: '删除', 120 text: '删除',
@@ -99,6 +99,7 @@ @@ -99,6 +99,7 @@
99 componentKey: TextComponent1Config.key, 99 componentKey: TextComponent1Config.key,
100 categoryKey: PackagesCategoryEnum.TEXT, 100 categoryKey: PackagesCategoryEnum.TEXT,
101 }; 101 };
  102 + activeKey.value = TabKeyEnum.BASIC;
102 dataSource.value = [genNewDataSourceItem()]; 103 dataSource.value = [genNewDataSourceItem()];
103 } 104 }
104 } 105 }