!245 feat: 【antd】【iot】启用状态的产品不能删除
Merge pull request !245 from haohaoMT/dev
This commit is contained in:
@@ -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 },
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
@@ -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"
|
||||
>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user