!245 feat: 【antd】【iot】启用状态的产品不能删除

Merge pull request !245 from haohaoMT/dev
This commit is contained in:
芋道源码
2025-11-02 00:46:34 +00:00
committed by Gitee
6 changed files with 26 additions and 10 deletions

View File

@@ -239,7 +239,7 @@ export function useGridFormSchema(): VbenFormSchema[] {
label: '设备状态',
component: 'Select',
componentProps: {
options: getDictOptions(DICT_TYPE.IOT_DEVICE_STATUS, 'number'),
options: getDictOptions(DICT_TYPE.IOT_DEVICE_STATE, 'number'),
placeholder: '请选择设备状态',
allowClear: true,
},
@@ -295,12 +295,12 @@ export function useGridColumns(): VxeTableGridOptions['columns'] {
slots: { default: 'groups' },
},
{
field: 'status',
field: 'state',
title: '设备状态',
minWidth: 100,
cellRender: {
name: 'CellDict',
props: { type: DICT_TYPE.IOT_DEVICE_STATUS },
props: { type: DICT_TYPE.IOT_DEVICE_STATE },
},
},
{

View File

@@ -307,7 +307,7 @@ onMounted(async () => {
style="width: 200px"
>
<Select.Option
v-for="dict in getIntDictOptions(DICT_TYPE.IOT_DEVICE_STATUS)"
v-for="dict in getIntDictOptions(DICT_TYPE.IOT_DEVICE_STATE)"
:key="dict.value"
:value="dict.value"
>

View File

@@ -294,7 +294,7 @@ onMounted(async () => {
style="width: 240px"
>
<Select.Option
v-for="dict in getIntDictOptions(DICT_TYPE.IOT_DEVICE_STATUS)"
v-for="dict in getIntDictOptions(DICT_TYPE.IOT_DEVICE_STATE)"
:key="dict.value"
:value="dict.value"
>
@@ -373,7 +373,7 @@ onMounted(async () => {
</template>
<template v-else-if="column.key === 'status'">
<DictTag
:type="DICT_TYPE.IOT_DEVICE_STATUS"
:type="DICT_TYPE.IOT_DEVICE_STATE"
:value="record.status"
/>
</template>

View File

@@ -106,7 +106,7 @@ function handleAuthInfoDialogClose() {
</Descriptions.Item>
<Descriptions.Item label="当前状态">
<DictTag
:type="DICT_TYPE.IOT_DEVICE_STATUS"
:type="DICT_TYPE.IOT_DEVICE_STATE"
:value="device.state"
/>
</Descriptions.Item>

View File

@@ -195,16 +195,33 @@ defineExpose({
/>
物模型
</Button>
<Tooltip v-if="item.status === 1" title="启用状态的产品不能删除">
<Button
size="small"
danger
disabled
class="action-btn action-btn-delete !w-[32px]"
>
<IconifyIcon
icon="ant-design:delete-outlined"
class="text-[14px]"
/>
</Button>
</Tooltip>
<Popconfirm
v-else
:title="`确认删除产品 ${item.name} 吗?`"
@confirm="emit('delete', item)"
>
<Button
size="small"
danger
class="action-btn action-btn-delete"
class="action-btn action-btn-delete !w-[32px]"
>
<IconifyIcon icon="ant-design:delete-outlined" />
<IconifyIcon
icon="ant-design:delete-outlined"
class="text-[14px]"
/>
</Button>
</Popconfirm>
</div>