feat(iot):优化 device 的权限校验
parent
cfb1f8401e
commit
81b4690998
|
|
@ -400,7 +400,6 @@ onMounted(async () => {
|
|||
type: 'primary',
|
||||
icon: 'ant-design:folder-add-outlined',
|
||||
auth: ['iot:device:update'],
|
||||
ifShow: isListView,
|
||||
disabled: isEmpty(checkedIds),
|
||||
onClick: handleAddToGroup,
|
||||
},
|
||||
|
|
@ -410,7 +409,6 @@ onMounted(async () => {
|
|||
danger: true,
|
||||
icon: ACTION_ICON.DELETE,
|
||||
auth: ['iot:device:delete'],
|
||||
ifShow: isListView,
|
||||
disabled: isEmpty(checkedIds),
|
||||
onClick: handleDeleteBatch,
|
||||
},
|
||||
|
|
@ -463,17 +461,20 @@ onMounted(async () => {
|
|||
{
|
||||
label: $t('common.detail'),
|
||||
type: 'link',
|
||||
auth: ['iot:device:query'],
|
||||
onClick: openDetail.bind(null, row.id!),
|
||||
},
|
||||
{
|
||||
label: '日志',
|
||||
type: 'link',
|
||||
auth: ['iot:device:message-query'],
|
||||
onClick: openModel.bind(null, row.id!),
|
||||
},
|
||||
{
|
||||
label: $t('common.edit'),
|
||||
type: 'link',
|
||||
icon: ACTION_ICON.EDIT,
|
||||
auth: ['iot:device:update'],
|
||||
onClick: handleEdit.bind(null, row),
|
||||
},
|
||||
{
|
||||
|
|
@ -481,6 +482,7 @@ onMounted(async () => {
|
|||
type: 'link',
|
||||
danger: true,
|
||||
icon: ACTION_ICON.DELETE,
|
||||
auth: ['iot:device:delete'],
|
||||
popConfirm: {
|
||||
title: $t('ui.actionMessage.deleteConfirm', [row.deviceName]),
|
||||
confirm: handleDelete.bind(null, row),
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import type { IotDeviceApi } from '#/api/iot/device/device';
|
|||
|
||||
import { onMounted, ref } from 'vue';
|
||||
|
||||
import { useAccess } from '@vben/access';
|
||||
import { DICT_TYPE } from '@vben/constants';
|
||||
import { IconifyIcon } from '@vben/icons';
|
||||
|
||||
|
|
@ -47,6 +48,8 @@ const emit = defineEmits<{
|
|||
productDetail: [productId: number];
|
||||
}>();
|
||||
|
||||
const { hasAccessByCodes } = useAccess();
|
||||
|
||||
const loading = ref(false);
|
||||
const list = ref<IotDeviceApi.Device[]>([]);
|
||||
const total = ref(0);
|
||||
|
|
@ -184,6 +187,7 @@ onMounted(() => {
|
|||
<!-- 按钮组 -->
|
||||
<div class="action-buttons">
|
||||
<Button
|
||||
v-if="hasAccessByCodes(['iot:device:update'])"
|
||||
size="small"
|
||||
class="action-btn action-btn-edit"
|
||||
@click="emit('edit', item)"
|
||||
|
|
@ -192,6 +196,7 @@ onMounted(() => {
|
|||
编辑
|
||||
</Button>
|
||||
<Button
|
||||
v-if="hasAccessByCodes(['iot:device:query'])"
|
||||
size="small"
|
||||
class="action-btn action-btn-detail"
|
||||
@click="emit('detail', item.id!)"
|
||||
|
|
@ -200,6 +205,7 @@ onMounted(() => {
|
|||
详情
|
||||
</Button>
|
||||
<Button
|
||||
v-if="hasAccessByCodes(['iot:device:message-query'])"
|
||||
size="small"
|
||||
class="action-btn action-btn-data"
|
||||
@click="emit('model', item.id!)"
|
||||
|
|
@ -208,6 +214,7 @@ onMounted(() => {
|
|||
数据
|
||||
</Button>
|
||||
<Popconfirm
|
||||
v-if="hasAccessByCodes(['iot:device:delete'])"
|
||||
:title="`确认删除设备 ${item.deviceName} 吗?`"
|
||||
@confirm="emit('delete', item)"
|
||||
>
|
||||
|
|
|
|||
Loading…
Reference in New Issue