Browse Source

chore: 按钮权限

main
刘凯 1 year ago
parent
commit
eec883215d
  1. 4
      src/views/device-manage/device/components/CloudCommand.vue
  2. 3
      src/views/device-manage/device/index.vue

4
src/views/device-manage/device/components/CloudCommand.vue

@ -9,6 +9,7 @@ import { useModal } from '@/components/Modal'
import { getCloudCommandLogs, getMessageContent } from '@/api/device-manage/device/cloud-command' import { getCloudCommandLogs, getMessageContent } from '@/api/device-manage/device/cloud-command'
import type { Device } from '@/api/device-manage/device/types' import type { Device } from '@/api/device-manage/device/types'
import { CloudCommandType } from '@/api/device-manage/device/types' import { CloudCommandType } from '@/api/device-manage/device/types'
import { usePermission } from '@/hooks/web/usePermission'
defineProps<{ device?: Device }>() defineProps<{ device?: Device }>()
@ -65,6 +66,8 @@ const [register, { reload }] = useTable({
inset: true, inset: true,
canResize: false, canResize: false,
}) })
const { hasPermission } = usePermission()
</script> </script>
<template> <template>
@ -72,6 +75,7 @@ const [register, { reload }] = useTable({
<div flex="~ items-center gap-12px" mb="12px"> <div flex="~ items-center gap-12px" mb="12px">
<Segmented v-model:value="selectedCommonType" :options="commandTypes" @change="() => reload()" /> <Segmented v-model:value="selectedCommonType" :options="commandTypes" @change="() => reload()" />
<a-button <a-button
v-if="hasPermission('device_cloud_command_action')"
type="primary" type="primary"
@click="openModal(true, { @click="openModal(true, {
deviceId: device!.id, deviceId: device!.id,

3
src/views/device-manage/device/index.vue

@ -36,7 +36,7 @@ const [register, { reload }] = useTable({
title: '操作', title: '操作',
dataIndex: 'action', dataIndex: 'action',
fixed: 'right', fixed: 'right',
auth: ['view', 'edit', 'delete'].map(code => `device_${code}`), auth: ['view', 'edit', 'delete', 'cmd_send'].map(code => `device_${code}`),
}, },
}) })
@ -79,6 +79,7 @@ async function handleDelete(id: string) {
{ {
icon: 'i-ant-design:cloud-sync-outlined', icon: 'i-ant-design:cloud-sync-outlined',
label: '指令下发', label: '指令下发',
auth: 'device_cmd_send',
onClick: () => openSendCommandModal(true, { onClick: () => openSendCommandModal(true, {
deviceId: record.id, deviceId: record.id,
productId: record.productId, productId: record.productId,

Loading…
Cancel
Save