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