|
@ -1,9 +1,9 @@ |
|
|
<template> |
|
|
<template> |
|
|
<a-spin :spinning="confirmLoading"> |
|
|
<a-spin :spinning="confirmLoading"> |
|
|
<a-form ref="formRef" class="antd-modal-form" :labelCol="labelCol" :wrapperCol="wrapperCol"> |
|
|
<a-form ref="formRef" class="antd-modal-form" :labelCol="labelCol" :wrapperCol="wrapperCol" :rules="rules" :model="formData"> |
|
|
<a-row> |
|
|
<a-row> |
|
|
<a-col :span="24"> |
|
|
<a-col :span="24"> |
|
|
<a-form-item label="监控相机" v-bind="validateInfos.cameraId"> |
|
|
<a-form-item label="监控相机" v-bind="validateInfos.cameraId" name="cameraId"> |
|
|
<a-tree-select |
|
|
<a-tree-select |
|
|
ref="cameraTree" |
|
|
ref="cameraTree" |
|
|
v-model:value="formData.cameraId" |
|
|
v-model:value="formData.cameraId" |
|
@ -60,17 +60,22 @@ |
|
|
<a-textarea v-model:value="formData.drawdata" :rows="4" placeholder="请输入画图数据" :disabled="disabled"></a-textarea> |
|
|
<a-textarea v-model:value="formData.drawdata" :rows="4" placeholder="请输入画图数据" :disabled="disabled"></a-textarea> |
|
|
</a-form-item> |
|
|
</a-form-item> |
|
|
</a-col> |
|
|
</a-col> |
|
|
|
|
|
<a-col :span="24"> |
|
|
|
|
|
<a-form-item label="所属场景" v-bind="validateInfos.sceneId" name="sceneId"> |
|
|
|
|
|
<!-- <a-input v-model:value="formData.sceneId" placeholder="请输入所属场景" :disabled="disabled"></a-input> --> |
|
|
|
|
|
<a-select v-model:value="formData.sceneId" placeholder="请选择所属场景" :disabled="disabled"> |
|
|
|
|
|
<template :key="code.sceneCode" v-for="code in sceneCodeList"> |
|
|
|
|
|
<a-select-option :value="code.sceneCode">{{ code.sceneName }}</a-select-option> |
|
|
|
|
|
</template> |
|
|
|
|
|
</a-select> |
|
|
|
|
|
</a-form-item> |
|
|
|
|
|
</a-col> |
|
|
<!-- <a-col :span="24"> |
|
|
<!-- <a-col :span="24"> |
|
|
<a-form-item label="备注" v-bind="validateInfos.remark"> |
|
|
<a-form-item label="备注" v-bind="validateInfos.remark"> |
|
|
<a-input v-model:value="formData.remark" placeholder="请输入备注" :disabled="disabled"></a-input> |
|
|
<a-input v-model:value="formData.remark" placeholder="请输入备注" :disabled="disabled"></a-input> |
|
|
</a-form-item> |
|
|
</a-form-item> |
|
|
</a-col> --> |
|
|
</a-col> --> |
|
|
<!-- |
|
|
<!-- |
|
|
<a-col :span="24"> |
|
|
|
|
|
<a-form-item label="备用2" v-bind="validateInfos.field2"> |
|
|
|
|
|
<a-input v-model:value="formData.field2" placeholder="请输入备用2" :disabled="disabled"></a-input> |
|
|
|
|
|
</a-form-item> |
|
|
|
|
|
</a-col> |
|
|
|
|
|
<a-col :span="24"> |
|
|
<a-col :span="24"> |
|
|
<a-form-item label="备用3" v-bind="validateInfos.field3"> |
|
|
<a-form-item label="备用3" v-bind="validateInfos.field3"> |
|
|
<a-input v-model:value="formData.field3" placeholder="请输入备用3" :disabled="disabled"></a-input> |
|
|
<a-input v-model:value="formData.field3" placeholder="请输入备用3" :disabled="disabled"></a-input> |
|
@ -100,6 +105,7 @@ |
|
|
import { saveOrUpdate } from '../DtAiMonitorArea.api'; |
|
|
import { saveOrUpdate } from '../DtAiMonitorArea.api'; |
|
|
import { Form } from 'ant-design-vue'; |
|
|
import { Form } from 'ant-design-vue'; |
|
|
import locationPng from '@/assets/images/getLocation.png'; |
|
|
import locationPng from '@/assets/images/getLocation.png'; |
|
|
|
|
|
import type { Rule } from 'ant-design-vue/es/form'; |
|
|
// 引入视频标注组件 |
|
|
// 引入视频标注组件 |
|
|
import SelectCom from '../selectCom/SelectCom.vue'; |
|
|
import SelectCom from '../selectCom/SelectCom.vue'; |
|
|
|
|
|
|
|
@ -123,6 +129,15 @@ |
|
|
const getmodelCodeList = () => { |
|
|
const getmodelCodeList = () => { |
|
|
return defHttp.get({ url: '/military/dtAiModel/list' }, { isTransformResponse: false }); |
|
|
return defHttp.get({ url: '/military/dtAiModel/list' }, { isTransformResponse: false }); |
|
|
}; |
|
|
}; |
|
|
|
|
|
// 场景编码 |
|
|
|
|
|
const sceneCodeList: any = ref([]); |
|
|
|
|
|
// 获取场景编码 |
|
|
|
|
|
const getsceneCodeList = () => { |
|
|
|
|
|
defHttp.get({ url: '/military/msMapScene/list' }, { isTransformResponse: false }).then((res) => { |
|
|
|
|
|
sceneCodeList.value = res.result.records; |
|
|
|
|
|
}); |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
const props = defineProps({ |
|
|
const props = defineProps({ |
|
|
formDisabled: { type: Boolean, default: false }, |
|
|
formDisabled: { type: Boolean, default: false }, |
|
|
formData: { type: Object, default: () => {} }, |
|
|
formData: { type: Object, default: () => {} }, |
|
@ -137,10 +152,10 @@ |
|
|
modelName: '', |
|
|
modelName: '', |
|
|
areaData: '', |
|
|
areaData: '', |
|
|
drawdata: '', |
|
|
drawdata: '', |
|
|
|
|
|
sceneId: '', |
|
|
// rtspUrl: '', |
|
|
// rtspUrl: '', |
|
|
cameraId: undefined, |
|
|
cameraId: undefined, |
|
|
remark: '', |
|
|
remark: '', |
|
|
field2: '', |
|
|
|
|
|
field3: '', |
|
|
field3: '', |
|
|
sysAreaCode: '', |
|
|
sysAreaCode: '', |
|
|
sysUnitCode: '', |
|
|
sysUnitCode: '', |
|
@ -151,11 +166,18 @@ |
|
|
const confirmLoading = ref<boolean>(false); |
|
|
const confirmLoading = ref<boolean>(false); |
|
|
//表单验证 |
|
|
//表单验证 |
|
|
const validatorRules = {}; |
|
|
const validatorRules = {}; |
|
|
|
|
|
const rules: Record<string, Rule[]> = { |
|
|
|
|
|
cameraId: [{ required: true, message: '请选择监控相机!' }], |
|
|
|
|
|
modelCode: [{ required: true, message: '请输入监控模型!' }], |
|
|
|
|
|
sceneId: [{ required: true, message: '请选择所属场景!' }], |
|
|
|
|
|
}; |
|
|
const { resetFields, validate, validateInfos } = useForm(formData, validatorRules, { immediate: true }); |
|
|
const { resetFields, validate, validateInfos } = useForm(formData, validatorRules, { immediate: true }); |
|
|
|
|
|
|
|
|
onMounted(() => { |
|
|
onMounted(() => { |
|
|
// 获取相机数据 |
|
|
// 获取相机数据 |
|
|
getCameraList(); |
|
|
getCameraList(); |
|
|
|
|
|
// 获取场景编码 |
|
|
|
|
|
getsceneCodeList(); |
|
|
//获取模型编码 |
|
|
//获取模型编码 |
|
|
getmodelCodeList().then((response) => { |
|
|
getmodelCodeList().then((response) => { |
|
|
if (response.success) { |
|
|
if (response.success) { |
|
@ -286,37 +308,40 @@ |
|
|
*/ |
|
|
*/ |
|
|
async function submitForm() { |
|
|
async function submitForm() { |
|
|
// 触发表单验证 |
|
|
// 触发表单验证 |
|
|
await validate(); |
|
|
// await validate(); |
|
|
confirmLoading.value = true; |
|
|
|
|
|
const isUpdate = ref<boolean>(false); |
|
|
formRef.value.validate().then(async () => { |
|
|
//时间格式化 |
|
|
confirmLoading.value = true; |
|
|
let model = formData; |
|
|
const isUpdate = ref<boolean>(false); |
|
|
if (model.id) { |
|
|
//时间格式化 |
|
|
isUpdate.value = true; |
|
|
let model = formData; |
|
|
} |
|
|
if (model.id) { |
|
|
//循环数据 |
|
|
isUpdate.value = true; |
|
|
for (let data in model) { |
|
|
|
|
|
//如果该数据是数组并且是字符串类型 |
|
|
|
|
|
if (model[data] instanceof Array) { |
|
|
|
|
|
let valueType = getValueType(formRef.value.getProps, data); |
|
|
|
|
|
//如果是字符串类型的需要变成以逗号分割的字符串 |
|
|
|
|
|
if (valueType === 'string') { |
|
|
|
|
|
model[data] = model[data].join(','); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
//循环数据 |
|
|
await saveOrUpdate(model, isUpdate.value) |
|
|
for (let data in model) { |
|
|
.then((res) => { |
|
|
//如果该数据是数组并且是字符串类型 |
|
|
if (res.success) { |
|
|
if (model[data] instanceof Array) { |
|
|
createMessage.success(res.message); |
|
|
let valueType = getValueType(formRef.value.getProps, data); |
|
|
emit('ok'); |
|
|
//如果是字符串类型的需要变成以逗号分割的字符串 |
|
|
} else { |
|
|
if (valueType === 'string') { |
|
|
createMessage.warning(res.message); |
|
|
model[data] = model[data].join(','); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
}) |
|
|
} |
|
|
.finally(() => { |
|
|
await saveOrUpdate(model, isUpdate.value) |
|
|
confirmLoading.value = false; |
|
|
.then((res) => { |
|
|
}); |
|
|
if (res.success) { |
|
|
|
|
|
createMessage.success(res.message); |
|
|
|
|
|
emit('ok'); |
|
|
|
|
|
} else { |
|
|
|
|
|
createMessage.warning(res.message); |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
.finally(() => { |
|
|
|
|
|
confirmLoading.value = false; |
|
|
|
|
|
}); |
|
|
|
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
defineExpose({ |
|
|
defineExpose({ |
|
|