|
|
|
|
@ -44,6 +44,16 @@
|
|
|
|
|
<el-option v-for="item in modelList" :key="item.id" :label="item.name" :value="item.id" />
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="设备类型" prop="deviceType">
|
|
|
|
|
<el-select v-model="formData.deviceType" placeholder="请选择设备类型">
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="dict in getStrDictOptions(DICT_TYPE.IOT_DEVICE_TYPE)"
|
|
|
|
|
:key="dict.value"
|
|
|
|
|
:label="dict.label"
|
|
|
|
|
:value="dict.value"
|
|
|
|
|
/>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item :label="t('EquipmentManagement.EquipmentLedger.images')" prop="images">
|
|
|
|
|
<UploadImg style="height: 100px" v-model="formData.images" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
@ -102,10 +112,9 @@
|
|
|
|
|
</Dialog>
|
|
|
|
|
</template>
|
|
|
|
|
<script setup lang="ts">
|
|
|
|
|
import { getBoolDictOptions, DICT_TYPE } from '@/utils/dict'
|
|
|
|
|
import { getStrDictOptions,getBoolDictOptions, DICT_TYPE } from '@/utils/dict'
|
|
|
|
|
import { DeviceApi, DeviceVO } from '@/api/iot/device'
|
|
|
|
|
import {DeviceModelApi, DeviceModelVO} from "@/api/iot/devicemodel";
|
|
|
|
|
|
|
|
|
|
/** 物联设备 表单 */
|
|
|
|
|
defineOptions({ name: 'DeviceForm' })
|
|
|
|
|
|
|
|
|
|
@ -193,12 +202,13 @@ const submitForm = async () => {
|
|
|
|
|
// 提交请求
|
|
|
|
|
formLoading.value = true
|
|
|
|
|
try {
|
|
|
|
|
const { id, deviceCode, deviceName, deviceModelId, sampleCycle, remark, isEnable, topic,images } = formData.value as any
|
|
|
|
|
const { id, deviceCode, deviceName,deviceType, deviceModelId, sampleCycle, remark, isEnable, topic,images } = formData.value as any
|
|
|
|
|
|
|
|
|
|
if (formType.value === 'create') {
|
|
|
|
|
const data: Partial<DeviceVO> = {
|
|
|
|
|
deviceCode,
|
|
|
|
|
deviceName,
|
|
|
|
|
deviceType,
|
|
|
|
|
deviceModelId,
|
|
|
|
|
sampleCycle,
|
|
|
|
|
remark,
|
|
|
|
|
@ -208,11 +218,11 @@ const submitForm = async () => {
|
|
|
|
|
await DeviceApi.createDevice(data as DeviceVO)
|
|
|
|
|
message.success(t('common.createSuccess'))
|
|
|
|
|
} else if (formType.value === 'update') {
|
|
|
|
|
const data: any = { id, deviceCode, deviceName, deviceModelId, sampleCycle, isEnable,images}
|
|
|
|
|
const data: any = { id, deviceCode, deviceName,deviceType, deviceModelId, sampleCycle, isEnable,images}
|
|
|
|
|
await DeviceApi.updateDevice(data)
|
|
|
|
|
message.success(t('common.updateSuccess'))
|
|
|
|
|
} else {
|
|
|
|
|
const data: any = { id, deviceCode, deviceName, deviceModelId, isEnable, topic,images}
|
|
|
|
|
const data: any = { id, deviceCode, deviceName,deviceType, deviceModelId, isEnable, topic,images}
|
|
|
|
|
await DeviceApi.updateDevice(data)
|
|
|
|
|
message.success(t('common.updateSuccess'))
|
|
|
|
|
}
|
|
|
|
|
|