Commit ca7e400aa3e26aba1ae3c827ca96ca8b83d0a961

Authored by xp.Huang
2 parents 13b41e9f 5fb3aae1

Merge branch 'ft' into 'main_dev'

feat: 管理台新增部分缺失的权限标识

See merge request yunteng/thingskit-front!825
... ... @@ -37,13 +37,21 @@
37 37 </a-button>
38 38 </template>
39 39 <template #status="{ record }">
40   - <Switch
41   - :checked="record.status === 1"
42   - :loading="record.pendingStatus"
43   - checkedChildren="启用"
44   - unCheckedChildren="禁用"
45   - @change="(checked:boolean)=>statusChange(checked,record)"
46   - />
  40 + <Authority value="api:yt:alarm:profile:status">
  41 + <Switch
  42 + :checked="record.status === 1"
  43 + :loading="record.pendingStatus"
  44 + checkedChildren="启用"
  45 + unCheckedChildren="禁用"
  46 + @change="(checked:boolean)=>statusChange(checked,record)"
  47 + />
  48 + </Authority>
  49 + <Tag
  50 + v-if="!hasPermission('api:yt:alarm:profile:status')"
  51 + :color="record.status ? 'green' : 'red'"
  52 + >
  53 + {{ record.status ? '启用' : '禁用' }}
  54 + </Tag>
47 55 </template>
48 56 <template #action="{ record }">
49 57 <TableAction
... ... @@ -88,7 +96,7 @@
88 96 import { useResetOrganizationTree, OrganizationIdTree } from '/@/views/common/organizationIdTree';
89 97 import { deleteAlarmConfig, queryAlarmConfig } from '/@/api/alarm/config/alarmConfig';
90 98 import { searchFormSchema, columns } from './config.data';
91   - import { Modal, Popconfirm } from 'ant-design-vue';
  99 + import { Modal, Popconfirm, Tag } from 'ant-design-vue';
92 100 import { JsonPreview } from '/@/components/CodeEditor';
93 101 import { findDictItemByCode } from '/@/api/system/dict';
94 102 import { alarmContactGetPage } from '/@/api/device/deviceConfigApi';
... ... @@ -97,6 +105,7 @@
97 105 import { putAlarmConfigStatus } from '/@/api/alarm/config/alarmConfig';
98 106 import { useMessage } from '/@/hooks/web/useMessage';
99 107 import { Authority } from '/@/components/Authority';
  108 + import { usePermission } from '/@/hooks/web/usePermission';
100 109
101 110 export default defineComponent({
102 111 components: {
... ... @@ -108,8 +117,10 @@
108 117 Switch,
109 118 Authority,
110 119 Popconfirm,
  120 + Tag,
111 121 },
112 122 setup() {
  123 + const { hasPermission } = usePermission();
113 124 const searchInfo = reactive<Recordable>({});
114 125 const { organizationIdTreeRef, resetFn } = useResetOrganizationTree(searchInfo);
115 126 // 刷新
... ... @@ -250,6 +261,7 @@
250 261 showAlarmContact,
251 262 showMessageMode,
252 263 statusChange,
  264 + hasPermission,
253 265 };
254 266 },
255 267 });
... ...
... ... @@ -52,7 +52,9 @@
52 52 <div class="mt-4" v-if="!isCustomer">
53 53 <a-button type="primary" class="mr-4" @click="copyTbDeviceId">复制设备ID</a-button>
54 54 <a-button type="primary" class="mr-4" @click="copyDeviceToken">复制访问令牌</a-button>
55   - <a-button type="primary" class="mr-4" @click="manageDeviceToken">管理设备凭证</a-button>
  55 + <Authority value="api:yt:device:equipment">
  56 + <a-button type="primary" class="mr-4" @click="manageDeviceToken">管理设备凭证</a-button>
  57 + </Authority>
56 58 <ManageDeviceTokenModal @register="registerModal" />
57 59 </div>
58 60 <div class="mt-4">
... ... @@ -84,10 +86,10 @@
84 86 import { DeviceTypeEnum } from '/@/api/device/model/deviceModel';
85 87 import { useAuthDeviceDetail } from '../../hook/useAuthDeviceDetail';
86 88 import { useClipboard } from '@vueuse/core';
87   -
88 89 import wz from '/@/assets/images/wz.png';
89 90 import { useAsyncQueue } from '../../../localtion/useAsyncQueue';
90 91 import locationImage from '/@/assets/icons/location.svg';
  92 + import { Authority } from '/@/components/Authority';
91 93
92 94 export default defineComponent({
93 95 components: {
... ... @@ -98,6 +100,7 @@
98 100 BasicModal,
99 101 Tooltip,
100 102 Empty,
  103 + Authority,
101 104 },
102 105 props: {
103 106 deviceDetail: {
... ...
... ... @@ -5,7 +5,9 @@
5 5 >
6 6 <template #toolbar>
7 7 <Space>
8   - <Button type="primary" @click="openModal(true)">命令下发</Button>
  8 + <Authority value="api:yt:device:rpc">
  9 + <Button type="primary" @click="openModal(true)">命令下发</Button>
  10 + </Authority>
9 11 </Space>
10 12 </template>
11 13 <template #recordContent="{ record }">
... ... @@ -43,6 +45,7 @@
43 45 import { DeviceRecord } from '/@/api/device/model/deviceModel';
44 46 import { BasicModal, useModal } from '/@/components/Modal';
45 47 import CommandIssuance from '../CommandIssuance.vue';
  48 + import { Authority } from '/@/components/Authority';
46 49
47 50 const props = defineProps({
48 51 fromId: {
... ...
... ... @@ -24,14 +24,16 @@
24 24 <Authority value="api:yt:device:import">
25 25 <Button type="primary" @click="handleBatchImport">导入</Button>
26 26 </Authority>
27   - <a-button
28   - v-if="authBtn(role)"
29   - type="primary"
30   - @click="handleBatchAssign"
31   - :disabled="!isExistOption"
32   - >
33   - 批量分配
34   - </a-button>
  27 + <Authority value="api:yt:device:assign">
  28 + <a-button
  29 + v-if="authBtn(role)"
  30 + type="primary"
  31 + @click="handleBatchAssign"
  32 + :disabled="!isExistOption"
  33 + >
  34 + 批量分配
  35 + </a-button>
  36 + </Authority>
35 37 </template>
36 38 <template #img="{ record }">
37 39 <TableImg
... ... @@ -134,6 +136,7 @@
134 136 label: '分配客户',
135 137 icon: 'mdi:account-arrow-right',
136 138 ifShow: authBtn(role),
  139 + auth: 'api:yt:device:assign',
137 140 onClick: handleDispatchCustomer.bind(null, record),
138 141 },
139 142 {
... ...
... ... @@ -135,10 +135,14 @@
135 135 <Tabs.TabPane tab="详情" key="detail">
136 136 <Space>
137 137 <!-- <Button type="primary" @click="openDetailPage">打开详情页</Button> -->
138   - <Button type="primary" @click="downloadPackage" :disabled="!!otaRecord.url">
139   - 下载包
140   - </Button>
141   - <Button type="primary" @click="deletePackage" danger>删除包</Button>
  138 + <Authority :value="OtaPermissionKey.DOWNLOAD">
  139 + <Button type="primary" @click="downloadPackage" :disabled="!!otaRecord.url">
  140 + 下载包
  141 + </Button>
  142 + </Authority>
  143 + <Authority :value="OtaPermissionKey.DELETE">
  144 + <Button type="primary" @click="deletePackage" danger>删除包</Button>
  145 + </Authority>
142 146 </Space>
143 147 <div class="mt-3">
144 148 <Space>
... ...
... ... @@ -8,6 +8,7 @@ export enum PermissionDataFlowEnum {
8 8 PERMISSION_GET = 'api:yt:convert:config:get',
9 9 PERMISSION_DELETE = 'api:yt:convert:config:delete',
10 10 PERMISSION_UPDATE = 'api:yt:convert:config:update',
  11 + PERMISSION_STATUS = 'api:yt:convert:config:status',
11 12 }
12 13
13 14 //业务文字描述配置枚举
... ...
... ... @@ -79,13 +79,21 @@
79 79 />
80 80 </template>
81 81 <template #status="{ record }">
82   - <Switch
83   - :checked="record.status === 1"
84   - :loading="record.pendingStatus"
85   - checkedChildren="启用"
86   - unCheckedChildren="禁用"
87   - @change="(checked:boolean)=>hanldeSwitch(checked,record)"
88   - />
  82 + <Authority :value="PermissionDataFlowEnum.PERMISSION_STATUS">
  83 + <Switch
  84 + :checked="record.status === 1"
  85 + :loading="record.pendingStatus"
  86 + checkedChildren="启用"
  87 + unCheckedChildren="禁用"
  88 + @change="(checked:boolean)=>hanldeSwitch(checked,record)"
  89 + />
  90 + </Authority>
  91 + <Tag
  92 + v-if="!hasPermission(PermissionDataFlowEnum.PERMISSION_STATUS)"
  93 + :color="record.status ? 'green' : 'red'"
  94 + >
  95 + {{ record.status ? '启用' : '禁用' }}
  96 + </Tag>
89 97 </template>
90 98 </BasicTable>
91 99 <DataFlowModal @register="registerModal" @success="handleSuccess" />
... ... @@ -103,15 +111,18 @@
103 111 import { useMessage } from '/@/hooks/web/useMessage';
104 112 import { Authority } from '/@/components/Authority';
105 113 import { useBatchDelete } from '/@/hooks/web/useBatchDelete';
106   - import { Switch, Popconfirm } from 'ant-design-vue';
  114 + import { Switch, Popconfirm, Tag } from 'ant-design-vue';
107 115 import { PermissionDataFlowEnum, BusinessDataFlowTextEnum } from './enum';
108 116 import { DataFlowModal } from './components/dataflowmodal';
109 117 import { defaultTableAttribute } from './config';
  118 + import { usePermission } from '/@/hooks/web/usePermission';
110 119
111 120 const { createMessage } = useMessage();
112 121
113 122 const loading = ref(true);
114 123
  124 + const { hasPermission } = usePermission();
  125 +
115 126 const handleSuccess = () => {
116 127 reload();
117 128 };
... ...
... ... @@ -50,13 +50,21 @@
50 50 </template>
51 51
52 52 <template #status="{ record }">
53   - <Switch
54   - :checked="record.status === 1"
55   - :loading="record.pendingStatus"
56   - checkedChildren="启用"
57   - unCheckedChildren="禁用"
58   - @change="(checked:boolean)=>statusChange(checked,record)"
59   - />
  53 + <Authority value="api:yt:sceneLinkage:status">
  54 + <Switch
  55 + :checked="record.status === 1"
  56 + :loading="record.pendingStatus"
  57 + checkedChildren="启用"
  58 + unCheckedChildren="禁用"
  59 + @change="(checked:boolean)=>statusChange(checked,record)"
  60 + />
  61 + </Authority>
  62 + <Tag
  63 + v-if="!hasPermission('api:yt:sceneLinkage:status')"
  64 + :color="record.status ? 'green' : 'red'"
  65 + >
  66 + {{ record.status ? '启用' : '禁用' }}
  67 + </Tag>
60 68 </template>
61 69 </BasicTable>
62 70 <SceneLinkAgeDrawer @register="registerDrawer" @success="handleSuccess" />
... ... @@ -72,16 +80,18 @@
72 80 screenLinkPagePutApi,
73 81 } from '/@/api/ruleengine/ruleengineApi';
74 82 import { useBatchDelete } from '/@/hooks/web/useBatchDelete';
75   - import { Switch, Popconfirm } from 'ant-design-vue';
  83 + import { Switch, Popconfirm, Tag } from 'ant-design-vue';
76 84 import { columns, searchFormSchema } from './config/config.data';
77 85 import { USER_INFO_KEY } from '/@/enums/cacheEnum';
78 86 import { getAuthCache } from '/@/utils/auth';
79 87 import SceneLinkAgeDrawer from './SceneLinkAgeDrawer.vue';
80 88 import { useMessage } from '/@/hooks/web/useMessage';
81 89 import { Authority } from '/@/components/Authority';
  90 + import { usePermission } from '/@/hooks/web/usePermission';
82 91
83 92 const userInfo: any = getAuthCache(USER_INFO_KEY);
84 93 const userId = userInfo.userId;
  94 + const { hasPermission } = usePermission();
85 95
86 96 const [registerDrawer, { openDrawer }] = useDrawer();
87 97 const [registerTable, { reload, setProps, setSelectedRowKeys }] = useTable({
... ...
... ... @@ -17,13 +17,21 @@
17 17 </Authority>
18 18 </template>
19 19 <template #status="{ record }">
20   - <Switch
21   - :checked="record.status === 1"
22   - :loading="record.pendingStatus"
23   - checkedChildren="启用"
24   - unCheckedChildren="禁用"
25   - @change="(checked:boolean)=>statusChange(checked,record)"
26   - />
  20 + <Authority value="api:yt:convert:js:status">
  21 + <Switch
  22 + :checked="record.status === 1"
  23 + :loading="record.pendingStatus"
  24 + checkedChildren="启用"
  25 + unCheckedChildren="禁用"
  26 + @change="(checked:boolean)=>statusChange(checked,record)"
  27 + />
  28 + </Authority>
  29 + <Tag
  30 + v-if="!hasPermission('api:yt:convert:js:status')"
  31 + :color="record.status ? 'green' : 'red'"
  32 + >
  33 + {{ record.status ? '启用' : '禁用' }}
  34 + </Tag>
27 35 </template>
28 36 <template #action="{ record }">
29 37 <TableAction
... ... @@ -69,7 +77,7 @@
69 77
70 78 <script lang="ts" setup>
71 79 import { ref, nextTick } from 'vue';
72   - import { Switch, Popconfirm } from 'ant-design-vue';
  80 + import { Switch, Popconfirm, Tag } from 'ant-design-vue';
73 81 import { BasicTable, useTable, TableAction } from '/@/components/Table';
74 82 import { columns } from '../config/config.data';
75 83 import { getConvertApi, deleteTransformApi } from '/@/api/device/TransformScriptApi';
... ... @@ -81,11 +89,14 @@
81 89 import { useBatchDelete } from '/@/hooks/web/useBatchDelete';
82 90 import { Authority } from '/@/components/Authority';
83 91 import { computed, unref } from 'vue';
  92 + import { usePermission } from '/@/hooks/web/usePermission';
84 93
85 94 const props = defineProps<{ searchInfo: Recordable }>();
86 95
87 96 const getSearchInfo = computed(() => props.searchInfo);
88 97
  98 + const { hasPermission } = usePermission();
  99 +
89 100 const handleSuccess = () => {
90 101 reload();
91 102 };
... ...
... ... @@ -133,6 +133,7 @@
133 133 text: '详情',
134 134 event: DropMenuEvent.DETAIL,
135 135 icon: 'ant-design:eye-outlined',
  136 + auth: PermissionEnum.DETAIL,
136 137 onClick: emit.bind(null, 'detail', getRecord),
137 138 },
138 139 {
... ...
... ... @@ -7,6 +7,7 @@ export enum PermissionEnum {
7 7 DELETE = 'api:yt:task_center:delete',
8 8 ALLOW = 'api:yt:task_center:cancel:allow',
9 9 EXECUTE = 'api:yt:task_center:immediate:execute',
  10 + DETAIL = 'api:yt:task_center:get',
10 11 }
11 12
12 13 export enum FormFieldsEnum {
... ...