Commit 6d9796c0612ea3dbe0b259edf52ab04be37f5901

Authored by xp.Huang
2 parents ca7e400a ff8748b2

Merge branch 'fix/permission-issues-zfl' into 'main_dev'

新增部分权限标识和租户管理员编辑新增租户角色字段

See merge request yunteng/thingskit-front!826
@@ -17,7 +17,8 @@ export enum ConfigurationPermission { @@ -17,7 +17,8 @@ export enum ConfigurationPermission {
17 UPDATE = 'api:yt:dataview:center:update', 17 UPDATE = 'api:yt:dataview:center:update',
18 DELETE = 'api:yt:dataview:center:delete', 18 DELETE = 'api:yt:dataview:center:delete',
19 SHARE = 'api:yt:dataview:center:share', 19 SHARE = 'api:yt:dataview:center:share',
20 - DESIGN = 'api:yt:dataview:center:get_configuration_info:design', 20 + // DESIGN = 'api:yt:dataview:center:get_configuration_info:design',
  21 + DESIGN = 'api:yt:dataview:center:get_dataview_info:design',
21 PREVIEW = 'api:yt:dataview:center:get_configuration_info:preview', 22 PREVIEW = 'api:yt:dataview:center:get_configuration_info:preview',
22 PUBLISH = 'api:yt:dataview:center:publish', 23 PUBLISH = 'api:yt:dataview:center:publish',
23 // CANCEL_PUBLISH = 'api:yt:dataview:center:cancel_publish', 24 // CANCEL_PUBLISH = 'api:yt:dataview:center:cancel_publish',
@@ -280,6 +280,7 @@ @@ -280,6 +280,7 @@
280 </Tooltip> 280 </Tooltip>
281 <Tooltip v-if="!isCustomerUser" title="设计"> 281 <Tooltip v-if="!isCustomerUser" title="设计">
282 <AuthIcon 282 <AuthIcon
  283 + :auth="ConfigurationPermission.DESIGN"
283 :disabled="item.state === 1" 284 :disabled="item.state === 1"
284 icon="ant-design:edit-outlined" 285 icon="ant-design:edit-outlined"
285 @click="handleDesign(item)" 286 @click="handleDesign(item)"
@@ -33,9 +33,15 @@ @@ -33,9 +33,15 @@
33 </Button> 33 </Button>
34 </Authority> 34 </Authority>
35 <Button type="primary" @click="handleOpenTsl"> 物模型TSL </Button> 35 <Button type="primary" @click="handleOpenTsl"> 物模型TSL </Button>
36 - <Upload v-if="isShowBtn" :show-upload-list="false" :customRequest="handleImportModel">  
37 - <Button type="primary" :loading="importLoading"> 导入物模型 </Button>  
38 - </Upload> 36 + <Authority value="api:yt:things_model:import">
  37 + <Upload
  38 + v-if="isShowBtn"
  39 + :show-upload-list="false"
  40 + :customRequest="handleImportModel"
  41 + >
  42 + <Button type="primary" :loading="importLoading"> 导入物模型 </Button>
  43 + </Upload>
  44 + </Authority>
39 </div> 45 </div>
40 <div class="flex gap-2"> 46 <div class="flex gap-2">
41 <Authority :value="ModelOfMatterPermission.RELEASE"> 47 <Authority :value="ModelOfMatterPermission.RELEASE">
@@ -18,6 +18,9 @@ @@ -18,6 +18,9 @@
18 import { UserDTO } from '/@/api/tenant/tenantInfo'; 18 import { UserDTO } from '/@/api/tenant/tenantInfo';
19 import { ChineseRegexp, EmailRegexp, emailRule, phoneRule } from '/@/utils/rules'; 19 import { ChineseRegexp, EmailRegexp, emailRule, phoneRule } from '/@/utils/rules';
20 import { chineseAndEnlishRule } from '/@/utils/rules'; 20 import { chineseAndEnlishRule } from '/@/utils/rules';
  21 + import { findCurrentUserRelation, getAllRoleList } from '/@/api/system/system';
  22 + import { RoleEnum } from '/@/enums/roleEnum';
  23 + import { RoleOrOrganizationParam } from '/@/api/system/model/systemModel';
21 24
22 export default defineComponent({ 25 export default defineComponent({
23 name: 'TenantAdminFormDrawer', 26 name: 'TenantAdminFormDrawer',
@@ -99,6 +102,22 @@ @@ -99,6 +102,22 @@
99 component: 'Input', 102 component: 'Input',
100 rules: phoneRule, 103 rules: phoneRule,
101 }, 104 },
  105 +
  106 + {
  107 + field: 'roleIds',
  108 + label: '租户角色',
  109 + component: 'ApiSelect',
  110 + required: true,
  111 + componentProps: {
  112 + mode: 'multiple',
  113 + api: getAllRoleList,
  114 + params: {
  115 + roleType: RoleEnum.TENANT_ADMIN,
  116 + },
  117 + labelField: 'name',
  118 + valueField: 'id',
  119 + },
  120 + },
102 { 121 {
103 field: 'email', 122 field: 'email',
104 label: '邮件', 123 label: '邮件',
@@ -132,9 +151,12 @@ @@ -132,9 +151,12 @@
132 tenantId.value = data?.tenantId; 151 tenantId.value = data?.tenantId;
133 isJudgeUserNameExist.value = data.judgeExistUserName; 152 isJudgeUserNameExist.value = data.judgeExistUserName;
134 if (unref(isUpdate)) { 153 if (unref(isUpdate)) {
  154 + const roleParams = new RoleOrOrganizationParam(data.record.id, true, false);
  155 + const roleIds = await findCurrentUserRelation(roleParams);
135 await updateSchema({ field: 'username', componentProps: { disabled: true } }); 156 await updateSchema({ field: 'username', componentProps: { disabled: true } });
136 await setFieldsValue({ 157 await setFieldsValue({
137 ...data.record, 158 ...data.record,
  159 + roleIds,
138 }); 160 });
139 } else { 161 } else {
140 await updateSchema({ field: 'username', componentProps: { disabled: false } }); 162 await updateSchema({ field: 'username', componentProps: { disabled: false } });
@@ -159,6 +181,7 @@ @@ -159,6 +181,7 @@
159 ? values.tenantExpireTime.format('YYYY-MM-DD HH:mm:ss') 181 ? values.tenantExpireTime.format('YYYY-MM-DD HH:mm:ss')
160 : null, 182 : null,
161 tenantId: tenantId.value, 183 tenantId: tenantId.value,
  184 + roleIds: values.roleIds,
162 }; 185 };
163 await saveTenantAdmin(requestParams as any as UserDTO); 186 await saveTenantAdmin(requestParams as any as UserDTO);
164 closeDrawer(); //关闭侧框 187 closeDrawer(); //关闭侧框