|
@ -42,6 +42,7 @@ import { onMounted, reactive, toRaw, UnwrapRef, watch } from 'vue'; |
|
|
import * as cameraApi from '@/axios/cameraBase/cameraApi'; |
|
|
import * as cameraApi from '@/axios/cameraBase/cameraApi'; |
|
|
import Msg from '@/utils/message'; |
|
|
import Msg from '@/utils/message'; |
|
|
interface FormState { |
|
|
interface FormState { |
|
|
|
|
|
id: string |
|
|
name: string; |
|
|
name: string; |
|
|
ip: string; |
|
|
ip: string; |
|
|
CbCameraParamsId: string; |
|
|
CbCameraParamsId: string; |
|
@ -58,6 +59,7 @@ const props = defineProps({ |
|
|
let labelCol = { span: 6 } |
|
|
let labelCol = { span: 6 } |
|
|
let wrapperCol = { span: 14 } |
|
|
let wrapperCol = { span: 14 } |
|
|
const formState: UnwrapRef<FormState> = reactive({ |
|
|
const formState: UnwrapRef<FormState> = reactive({ |
|
|
|
|
|
id: '', |
|
|
name: '', |
|
|
name: '', |
|
|
ip: '', |
|
|
ip: '', |
|
|
CbCameraParamsId: '', |
|
|
CbCameraParamsId: '', |
|
@ -90,6 +92,20 @@ function add() { |
|
|
//编辑 |
|
|
//编辑 |
|
|
function edit() { |
|
|
function edit() { |
|
|
console.log('编辑!', toRaw(formState)); |
|
|
console.log('编辑!', toRaw(formState)); |
|
|
|
|
|
return cameraApi.Update(toRaw(formState)).then(res => { |
|
|
|
|
|
console.log(res); |
|
|
|
|
|
if (res.data.data == true) { |
|
|
|
|
|
Msg.success('编辑成功') |
|
|
|
|
|
return true |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
Msg.error('编辑失败,' + res.data.message) |
|
|
|
|
|
return false |
|
|
|
|
|
} |
|
|
|
|
|
}).catch((err: any) => { |
|
|
|
|
|
Msg.error('编辑失败,' + err) |
|
|
|
|
|
return false |
|
|
|
|
|
}) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
//暴露方法 |
|
|
//暴露方法 |
|
@ -102,6 +118,7 @@ defineExpose({ |
|
|
onMounted(() => { |
|
|
onMounted(() => { |
|
|
console.log("收到了", props.editData); |
|
|
console.log("收到了", props.editData); |
|
|
if (props.editData != null || props.editData != undefined){ |
|
|
if (props.editData != null || props.editData != undefined){ |
|
|
|
|
|
formState.id = props.editData.id; |
|
|
formState.name = props.editData.name; |
|
|
formState.name = props.editData.name; |
|
|
formState.ip = props.editData.ip; |
|
|
formState.ip = props.editData.ip; |
|
|
formState.CbCameraParamsId = props.editData.cbCameraParamsId; |
|
|
formState.CbCameraParamsId = props.editData.cbCameraParamsId; |
|
|