|
@ -1,108 +1,120 @@ |
|
|
<template> |
|
|
<template> |
|
|
<el-form label-position="top" :model="data" ref="deviceEdit"> |
|
|
<el-form ref="deviceEdit" :model="data" :rules="deviceRules" label-position="top"> |
|
|
<el-row :gutter="20"> |
|
|
<el-row :gutter="20"> |
|
|
<el-col :span="12" :xs="24" :md="12" :lg="8" :xl="6"> |
|
|
<el-col :lg="8" :md="12" :span="12" :xl="6" :xs="24"> |
|
|
<el-form-item label="设备ID号" prop="deviceId"> |
|
|
<el-form-item label="设备ID" prop="deviceId"> |
|
|
<el-input v-model="data.deviceId" disabled></el-input> |
|
|
<el-input v-model="data.deviceId" disabled></el-input> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
</el-col> |
|
|
</el-col> |
|
|
<el-col :span="12" :xs="24" :md="12" :lg="8" :xl="6"> |
|
|
|
|
|
|
|
|
<el-col :lg="8" :md="12" :span="12" :xl="6" :xs="24"> |
|
|
|
|
|
<el-form-item label="站点名称" prop="address"> |
|
|
|
|
|
<el-input v-model="data.address"></el-input> |
|
|
|
|
|
</el-form-item> |
|
|
|
|
|
</el-col> |
|
|
|
|
|
|
|
|
|
|
|
<el-col :lg="8" :md="12" :span="12" :xl="6" :xs="24"> |
|
|
<el-form-item label="设备完整ID" prop="deviceFullId"> |
|
|
<el-form-item label="设备完整ID" prop="deviceFullId"> |
|
|
<el-input v-model="data.deviceFullId"></el-input> |
|
|
<el-input v-model="data.deviceFullId"></el-input> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
</el-col> |
|
|
</el-col> |
|
|
|
|
|
|
|
|
<el-col :span="12" :xs="24" :md="12" :lg="8" :xl="6"> |
|
|
<el-col :lg="8" :md="12" :span="12" :xl="6" :xs="24"> |
|
|
<el-form-item label="地区" prop="area"> |
|
|
<el-form-item label="地区" prop="area"> |
|
|
<el-input v-model="data.area"></el-input> |
|
|
<el-input v-model="data.area"></el-input> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
</el-col> |
|
|
</el-col> |
|
|
<el-col :span="12" :xs="24" :md="12" :lg="8" :xl="6"> |
|
|
|
|
|
<el-form-item label="安装地点名称" prop="address"> |
|
|
|
|
|
<el-input v-model="data.address"></el-input> |
|
|
|
|
|
</el-form-item> |
|
|
|
|
|
</el-col> |
|
|
|
|
|
|
|
|
|
|
|
<el-col :span="12" :xs="24" :md="12" :lg="8" :xl="6"> |
|
|
<el-col :lg="8" :md="12" :span="12" :xl="6" :xs="24"> |
|
|
<el-form-item label="联系人" prop="contact"> |
|
|
<el-form-item label="联系人" prop="contact"> |
|
|
<el-input v-model="data.contact"></el-input> |
|
|
<el-input v-model="data.contact"></el-input> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
</el-col> |
|
|
</el-col> |
|
|
<el-col :span="12" :xs="24" :md="12" :lg="8" :xl="6"> |
|
|
<el-col :lg="8" :md="12" :span="12" :xl="6" :xs="24"> |
|
|
<el-form-item label="电话" prop="phone"> |
|
|
<el-form-item label="电话" prop="phone"> |
|
|
<el-input v-model="data.phone"></el-input> |
|
|
<el-input v-model="data.phone"></el-input> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
</el-col> |
|
|
</el-col> |
|
|
|
|
|
|
|
|
<el-col :span="12" :xs="24" :md="12" :lg="8" :xl="6"> |
|
|
<el-col :lg="8" :md="12" :span="12" :xl="6" :xs="24"> |
|
|
<el-form-item label="经度" prop="lon"> |
|
|
<el-form-item label="经度" prop="lon"> |
|
|
<el-input v-model="data.lon"></el-input> |
|
|
<el-input v-model="data.lon"></el-input> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
</el-col> |
|
|
</el-col> |
|
|
<el-col :span="12" :xs="24" :md="12" :lg="8" :xl="6"> |
|
|
<el-col :lg="8" :md="12" :span="12" :xl="6" :xs="24"> |
|
|
<el-form-item label="纬度" prop="lat"> |
|
|
<el-form-item label="纬度" prop="lat"> |
|
|
<el-input v-model="data.lat"></el-input> |
|
|
<el-input v-model="data.lat"></el-input> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
</el-col> |
|
|
</el-col> |
|
|
|
|
|
|
|
|
<el-col :span="12" :xs="24" :md="12" :lg="8" :xl="6"> |
|
|
<el-col :lg="8" :md="12" :span="12" :xl="6" :xs="24"> |
|
|
<el-form-item label="负责人" prop="head"> |
|
|
<el-form-item label="负责人" prop="head"> |
|
|
<el-input v-model="data.head"></el-input> |
|
|
<el-input v-model="data.head"></el-input> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
</el-col> |
|
|
</el-col> |
|
|
<el-col :span="12" :xs="24" :md="12" :lg="8" :xl="6"> |
|
|
<el-col :lg="8" :md="12" :span="12" :xl="6" :xs="24"> |
|
|
<el-form-item label="安装位置" prop="installLocation"> |
|
|
<el-form-item label="安装位置" prop="installLocation"> |
|
|
<el-input v-model="data.installLocation"></el-input> |
|
|
<el-input v-model="data.installLocation"></el-input> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
</el-col> |
|
|
</el-col> |
|
|
|
|
|
|
|
|
<el-col :span="12" :xs="24" :md="12" :lg="8" :xl="6"> |
|
|
<el-col :lg="8" :md="12" :span="12" :xl="6" :xs="24"> |
|
|
<el-form-item label="安装时间" prop="installTime"> |
|
|
<el-form-item label="安装时间" prop="installTime"> |
|
|
<el-date-picker style="width: 100%" v-model="data.installTime" type="datetime" placeholder="安装时间"></el-date-picker> |
|
|
<el-date-picker v-model="data.installTime" placeholder="安装时间" style="width: 100%" type="datetime"></el-date-picker> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
</el-col> |
|
|
</el-col> |
|
|
<el-col :span="12" :xs="24" :md="12" :lg="8" :xl="6"> |
|
|
<el-col :lg="8" :md="12" :span="12" :xl="6" :xs="24"> |
|
|
<el-form-item label="正式运行时间" prop="runTime"> |
|
|
<el-form-item label="正式运行时间" prop="runTime"> |
|
|
<el-date-picker style="width: 100%" v-model="data.runTime" type="datetime" placeholder="正式运行时间"></el-date-picker> |
|
|
<el-date-picker v-model="data.runTime" placeholder="正式运行时间" style="width: 100%" type="datetime"></el-date-picker> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
</el-col> |
|
|
</el-col> |
|
|
|
|
|
|
|
|
<el-col :span="12" :xs="24" :md="12" :lg="8" :xl="6"> |
|
|
<el-col :lg="8" :md="12" :span="12" :xl="6" :xs="24"> |
|
|
<el-form-item label="链路地址" prop="linkAddress"> |
|
|
<el-form-item label="链路地址" prop="linkAddress"> |
|
|
<el-input v-model="data.linkAddress"></el-input> |
|
|
<el-input v-model="data.linkAddress"></el-input> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
</el-col> |
|
|
</el-col> |
|
|
<el-col :span="12" :xs="24" :md="12" :lg="8" :xl="6"> |
|
|
<el-col :lg="8" :md="12" :span="12" :xl="6" :xs="24"> |
|
|
<el-form-item label="探头编号" prop="probNo"> |
|
|
<el-form-item label="探头编号" prop="probNo"> |
|
|
<el-input v-model="data.probNo"></el-input> |
|
|
<el-input v-model="data.probNo"></el-input> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
</el-col> |
|
|
</el-col> |
|
|
|
|
|
|
|
|
<el-col :span="12" :xs="24" :md="12" :lg="8" :xl="6"> |
|
|
<el-col :lg="8" :md="12" :span="12" :xl="6" :xs="24"> |
|
|
<el-form-item label="试样" prop="simple"> |
|
|
<el-form-item label="试样" prop="simple"> |
|
|
<el-input v-model="data.simple"></el-input> |
|
|
<el-input v-model="data.simple"></el-input> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
</el-col> |
|
|
</el-col> |
|
|
<el-col :span="12" :xs="24" :md="12" :lg="8" :xl="6"> |
|
|
<el-col :lg="8" :md="12" :span="12" :xl="6" :xs="24"> |
|
|
<el-form-item label="sim卡1" prop="sim1"> |
|
|
<el-form-item label="sim卡1" prop="sim1"> |
|
|
<el-input v-model="data.sim1"></el-input> |
|
|
<el-input v-model="data.sim1"></el-input> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
</el-col> |
|
|
</el-col> |
|
|
|
|
|
|
|
|
<el-col :span="12" :xs="24" :md="12" :lg="8" :xl="6"> |
|
|
<el-col :lg="8" :md="12" :span="12" :xl="6" :xs="24"> |
|
|
<el-form-item label="设备朝向" prop="deviceDirection"> |
|
|
<el-form-item label="设备朝向" prop="deviceDirection"> |
|
|
<el-input v-model="data.deviceDirection"></el-input> |
|
|
<el-input v-model="data.deviceDirection"></el-input> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
</el-col> |
|
|
</el-col> |
|
|
<el-col :span="12" :xs="24" :md="12" :lg="8" :xl="6"> |
|
|
<el-col :lg="8" :md="12" :span="12" :xl="6" :xs="24"> |
|
|
<el-form-item label="与主站后台联调情况" prop="joint"> |
|
|
<el-form-item label="协议版本" prop="protocolVersion"> |
|
|
<el-input v-model="data.joint"></el-input> |
|
|
<el-input v-model="data.protocolVersion"></el-input> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
</el-col> |
|
|
</el-col> |
|
|
</el-row> |
|
|
</el-row> |
|
|
|
|
|
|
|
|
<el-row :gutter="20"> |
|
|
<el-row :gutter="20"> |
|
|
<el-col :span="12" :xs="24" :md="12" :lg="8" :xl="6"> |
|
|
<el-col :lg="8" :md="12" :span="12" :xl="6" :xs="24"> |
|
|
|
|
|
<el-form-item label="与主站后台联调情况" prop="joint"> |
|
|
|
|
|
<el-input v-model="data.joint" type="textarea"></el-input> |
|
|
|
|
|
</el-form-item> |
|
|
|
|
|
</el-col> |
|
|
|
|
|
<el-col :lg="8" :md="12" :span="12" :xl="6" :xs="24"> |
|
|
|
|
|
<el-form-item label="维修记录" prop="operationRecord"> |
|
|
|
|
|
<el-input v-model="data.operationRecord" type="textarea"></el-input> |
|
|
|
|
|
</el-form-item> |
|
|
|
|
|
</el-col> |
|
|
|
|
|
<el-col :lg="8" :md="12" :span="12" :xl="6" :xs="24"> |
|
|
<el-form-item label="备注" prop="remark"> |
|
|
<el-form-item label="备注" prop="remark"> |
|
|
<el-input v-model="data.remark" type="textarea"></el-input> |
|
|
<el-input v-model="data.remark" type="textarea"></el-input> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
@ -119,11 +131,11 @@ |
|
|
</template> |
|
|
</template> |
|
|
|
|
|
|
|
|
<script setup> |
|
|
<script setup> |
|
|
import { reactive, ref, computed, watch, defineEmits } from 'vue'; |
|
|
import { computed, defineEmits, reactive, ref, watch } from 'vue'; |
|
|
import { useStore } from 'vuex'; |
|
|
import { useStore } from 'vuex'; |
|
|
import { updateDevice } from 'apis'; |
|
|
import { updateDevice } from 'apis'; |
|
|
import { ElMessage } from 'element-plus'; |
|
|
import { ElMessage } from 'element-plus'; |
|
|
import { deviceData } from '@/config/config'; |
|
|
import { deviceData, deviceRules } from '@/config/config'; |
|
|
|
|
|
|
|
|
let data = reactive(deviceData); |
|
|
let data = reactive(deviceData); |
|
|
|
|
|
|
|
@ -131,7 +143,6 @@ const deviceEdit = ref(null); // form |
|
|
const store = useStore(); |
|
|
const store = useStore(); |
|
|
const device = computed(() => store.getters['device/current']); |
|
|
const device = computed(() => store.getters['device/current']); |
|
|
const currentDeviceId = computed(() => store.state.device.currentDeviceId); |
|
|
const currentDeviceId = computed(() => store.state.device.currentDeviceId); |
|
|
|
|
|
|
|
|
const emit = defineEmits(['cancel']); |
|
|
const emit = defineEmits(['cancel']); |
|
|
|
|
|
|
|
|
watch( |
|
|
watch( |
|
@ -139,27 +150,32 @@ watch( |
|
|
newValue => { |
|
|
newValue => { |
|
|
data = newValue; |
|
|
data = newValue; |
|
|
}, |
|
|
}, |
|
|
{ immediate: true, deep: true }, |
|
|
{ |
|
|
|
|
|
immediate: true, |
|
|
|
|
|
deep: true, |
|
|
|
|
|
}, |
|
|
); |
|
|
); |
|
|
|
|
|
|
|
|
// 提交表单 |
|
|
// 提交表单 |
|
|
const onSubmit = () => { |
|
|
const onSubmit = () => { |
|
|
deviceEdit.value.validate(async () => { |
|
|
deviceEdit.value.validate(async valid => { |
|
|
if (data.installTime) { |
|
|
if (valid) { |
|
|
data.installTime = new Date(data.installTime).getTime(); |
|
|
if (data.installTime) { |
|
|
} |
|
|
data.installTime = new Date(data.installTime).getTime(); |
|
|
if (data.runTime) { |
|
|
} |
|
|
data.runTime = new Date(data.runTime).getTime(); |
|
|
if (data.runTime) { |
|
|
} |
|
|
data.runTime = new Date(data.runTime).getTime(); |
|
|
try { |
|
|
} |
|
|
await updateDevice(currentDeviceId.value, data); |
|
|
try { |
|
|
ElMessage.success('更新成功'); |
|
|
await updateDevice(currentDeviceId.value, data); |
|
|
emit('cancel'); |
|
|
ElMessage.success('更新成功'); |
|
|
store.commit('device/updateDevice', data); |
|
|
emit('cancel'); |
|
|
await store.dispatch('device/getDevices'); // 更新站点列表 |
|
|
store.commit('device/updateDevice', data); |
|
|
} catch (error) { |
|
|
await store.dispatch('device/getDevices'); // 更新站点列表 |
|
|
ElMessage.error('更新失败, 请稍后重试'); |
|
|
} catch (error) { |
|
|
throw new Error(error); |
|
|
ElMessage.error('更新失败, 请稍后重试'); |
|
|
|
|
|
throw new Error(error); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
}; |
|
|
}; |
|
|