Commit b1fbced21bfccaf1f9c77f4b3114cfb7638efa38

Authored by xp.Huang
2 parents 6ad966bc 2d08158c

Merge branch 'perf/permission-05-31' into 'v1.4.0_dev'

perf: 移除数据流转的组织,并且租户子管理员不能分配规则链转换脚本和规则链以及数据流转

See merge request yunteng/thingskit-front!1357
... ... @@ -26,6 +26,8 @@ export enum DictEnum {
26 26 DISABLED_TENANT_AUTH = 'disabled_tenant_auth',
27 27 // 客户禁用的权限
28 28 DISABLE_CUSTOMER_AUTH = 'disabled_customer_auth',
  29 + // 普通租户禁用的权限
  30 + DISABLE_COMMON_TENANT_AUTH = 'disabled_common_tenant_auth',
29 31 // 寄存器数据格式
30 32 REGISTER_DATA_FORMAT = 'register_data_format',
31 33 // 消息类型 规则节点 Filter message type switch
... ...
... ... @@ -3,6 +3,7 @@ export enum RoleEnum {
3 3 PLATFORM_ADMIN = 'PLATFORM_ADMIN',
4 4 TENANT_ADMIN = 'TENANT_ADMIN',
5 5 CUSTOMER_USER = 'CUSTOMER_USER',
  6 + COMMON_TENANT = 'COMMON_TENANT',
6 7 }
7 8
8 9 export function isAdmin(role: string) {
... ...
1   -import { FormSchema, useComponentRegister } from '/@/components/Form';
  1 +import { FormSchema } from '/@/components/Form';
2 2 import { findDictItemByCode } from '/@/api/system/dict';
3 3 import { getDeviceProfile } from '/@/api/alarm/position';
4 4 import { BasicInfoFormField, DataSourceType } from '../enum';
5 5 import { DeviceRecord } from '/@/api/device/model/deviceModel';
6 6 import { useMessage } from '/@/hooks/web/useMessage';
7   -import { OrgTreeSelect } from '/@/views/common/OrgTreeSelect';
8   -
9   -useComponentRegister('OrgTreeSelect', OrgTreeSelect);
10 7
11 8 export const stepConfig = ['选择流转方式', '完善配置参数'];
12 9
... ... @@ -60,13 +57,6 @@ export const modeForm = (disabled: boolean): FormSchema[] => {
60 57 },
61 58 },
62 59 {
63   - required: true,
64   - field: BasicInfoFormField.ORGANIZATION_ID,
65   - label: '所属组织',
66   - colProps: { span: 24 },
67   - component: 'OrgTreeSelect',
68   - },
69   - {
70 60 field: BasicInfoFormField.DATA_SOURCE_PRODUCT,
71 61 label: '数据源产品',
72 62 component: 'TransferModal',
... ...
... ... @@ -129,13 +129,6 @@ export const formSchema: FormSchema[] = [
129 129 },
130 130 },
131 131 {
132   - required: true,
133   - field: 'organizationId',
134   - label: '所属组织',
135   - colProps: { span: 24 },
136   - component: 'OrgTreeSelect',
137   - },
138   - {
139 132 field: 'remark',
140 133 label: '说明',
141 134 component: 'InputTextArea',
... ...
... ... @@ -5,12 +5,15 @@
5 5 import { BasicForm, useForm } from '/@/components/Form';
6 6 import { searchFormSchema } from './config/config.data';
7 7 import { nextTick, ref, unref } from 'vue';
  8 + import { usePermission } from '/@/hooks/web/usePermission';
8 9
9 10 enum ActiveKey {
10 11 RULE = 'rule',
11 12 TCP = 'tco',
12 13 }
13 14
  15 + const { hasPermission } = usePermission();
  16 +
14 17 const ruleChainTableRefEl = ref<Nullable<InstanceType<typeof RuleChainConversionScript>>>(null);
15 18 const tcpTableRefEl = ref<Nullable<InstanceType<typeof TcpConversionScript>>>(null);
16 19
... ... @@ -70,7 +73,18 @@
70 73 class="p-4 bg-neutral-100 dark:bg-dark-700"
71 74 />
72 75 </Tabs.TabPane>
73   - <Tabs.TabPane tab="规则链转换脚本" :key="ActiveKey.RULE">
  76 + <Tabs.TabPane
  77 + tab="规则链转换脚本"
  78 + v-if="
  79 + hasPermission([
  80 + 'api:yt:convert:js:delete',
  81 + 'api:yt:convert:js:post',
  82 + 'api:yt:convert:js:update',
  83 + 'api:yt:convert:js:get',
  84 + ])
  85 + "
  86 + :key="ActiveKey.RULE"
  87 + >
74 88 <RuleChainConversionScript
75 89 ref="ruleChainTableRefEl"
76 90 :search-info="searchInfo"
... ...
... ... @@ -16,6 +16,10 @@ export const RoleMenuDictEnum: Recordable<{ key: string; keyType: KeysTypeEnum }
16 16 [RoleEnum.SYS_ADMIN]: { key: DictEnum.ENABLED_SYSADMIN_AUTH, keyType: KeysTypeEnum.ENABLED },
17 17 [RoleEnum.TENANT_ADMIN]: { key: DictEnum.DISABLED_TENANT_AUTH, keyType: KeysTypeEnum.DISABLED },
18 18 [RoleEnum.CUSTOMER_USER]: { key: DictEnum.DISABLE_CUSTOMER_AUTH, keyType: KeysTypeEnum.DISABLED },
  19 + [RoleEnum.COMMON_TENANT]: {
  20 + key: DictEnum.DISABLE_COMMON_TENANT_AUTH,
  21 + keyType: KeysTypeEnum.DISABLED,
  22 + },
19 23 };
20 24
21 25 export const columns: BasicColumn[] = [
... ...
... ... @@ -16,6 +16,10 @@ export const RoleMenuDictEnum: Recordable<{ key: string; keyType: KeysTypeEnum }
16 16 [RoleEnum.SYS_ADMIN]: { key: DictEnum.ENABLED_SYSADMIN_AUTH, keyType: KeysTypeEnum.ENABLED },
17 17 [RoleEnum.TENANT_ADMIN]: { key: DictEnum.DISABLED_TENANT_AUTH, keyType: KeysTypeEnum.DISABLED },
18 18 [RoleEnum.CUSTOMER_USER]: { key: DictEnum.DISABLE_CUSTOMER_AUTH, keyType: KeysTypeEnum.DISABLED },
  19 + [RoleEnum.COMMON_TENANT]: {
  20 + key: DictEnum.DISABLE_COMMON_TENANT_AUTH,
  21 + keyType: KeysTypeEnum.DISABLED,
  22 + },
19 23 };
20 24
21 25 export const columns: BasicColumn[] = [
... ...
... ... @@ -109,6 +109,7 @@
109 109 treeRef.value && treeRef.value?.setCheckedKeys([]);
110 110 isUpdate.value = data.isUpdate;
111 111 const roleType = RoleEnum.TENANT_ADMIN;
  112 + const commonTenantRoleType = RoleEnum.COMMON_TENANT;
112 113 try {
113 114 spinning.value = true;
114 115
... ... @@ -120,10 +121,12 @@
120 121 treeData.value = transformName(menuListModel as unknown as TreeData[]);
121 122 }
122 123 const keys = await getPermissionByRole(roleType);
  124 + const commonTenantkeys = await getPermissionByRole(commonTenantRoleType);
  125 + const mergeKeys = [...keys, ...commonTenantkeys];
123 126 const { keyType } = RoleMenuDictEnum[roleType];
124 127 treeData.value = filterPermissionTreeData(
125 128 unref(treeData) as unknown as TreeData[],
126   - keys,
  129 + mergeKeys,
127 130 keyType
128 131 );
129 132
... ...