|
|
@ -1,4 +1,7 @@ |
|
|
|
<template> |
|
|
|
<!-- 设置站点选择 和 设备下发状态 --> |
|
|
|
<DeviceSelectAndSelect @search="onSearch" :status="data.status" /> |
|
|
|
|
|
|
|
<el-form label-position="top" :model="data" ref="functionForm"> |
|
|
|
<el-row :gutter="20"> |
|
|
|
<el-col :span="12"> |
|
|
@ -81,22 +84,45 @@ |
|
|
|
|
|
|
|
<el-row :gutter="20"> |
|
|
|
<el-col :span="12"> |
|
|
|
<el-form-item label="设置安全模式" prop="securityMode"> |
|
|
|
<!-- <el-input v-model="data.securityMode"></el-input> --> |
|
|
|
<el-radio v-model="data.securityMode" :label="0">不加密</el-radio> |
|
|
|
<el-radio v-model="data.securityMode" :label="1">加密</el-radio> |
|
|
|
<el-form-item label="选择金属通道1类型" prop="securityMode"> |
|
|
|
<el-select v-model="data.corrosiveType1" placeholder="选择金属腐蚀类型"> |
|
|
|
<el-option v-for="type in types" :key="type.value" :label="type.type" :value="type.value"></el-option> |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="12"> |
|
|
|
<el-form-item label="选择金属通道2类型" prop="corrosiveType"> |
|
|
|
<el-select v-model="data.corrosiveType2" placeholder="选择金属腐蚀类型"> |
|
|
|
<el-option v-for="type in types" :key="type.value" :label="type.type" :value="type.value"></el-option> |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="12"> |
|
|
|
<el-form-item label="选择金属通道3类型" prop="securityMode"> |
|
|
|
<el-select v-model="data.corrosiveType3" placeholder="选择金属腐蚀类型"> |
|
|
|
<el-option v-for="type in types" :key="type.value" :label="type.type" :value="type.value"></el-option> |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="12"> |
|
|
|
<el-form-item label="设置金属腐蚀类型" prop="corrosiveType"> |
|
|
|
<!-- <el-input v-model="data.corrosiveType"></el-input> --> |
|
|
|
<el-select v-model="data.corrosiveType" placeholder="选择金属腐蚀类型"> |
|
|
|
<el-form-item label="选择金属通道4类型" prop="corrosiveType"> |
|
|
|
<el-select v-model="data.corrosiveType4" placeholder="选择金属腐蚀类型"> |
|
|
|
<el-option v-for="type in types" :key="type.value" :label="type.type" :value="type.value"></el-option> |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
</el-row> |
|
|
|
|
|
|
|
<el-row :gutter="20"> |
|
|
|
<el-col :span="12"> |
|
|
|
<el-form-item label="设置安全模式" prop="securityMode"> |
|
|
|
<!-- <el-input v-model="data.securityMode"></el-input> --> |
|
|
|
<el-radio v-model="data.securityMode" :label="0">不加密</el-radio> |
|
|
|
<el-radio v-model="data.securityMode" :label="1">加密</el-radio> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
</el-row> |
|
|
|
|
|
|
|
<el-row :gutter="20"> |
|
|
|
<el-col :span="12"> |
|
|
|
<el-form-item label="设置上报时间" prop="report.type" style="margin-bottom: 0 !important"> |
|
|
@ -131,13 +157,19 @@ |
|
|
|
</el-form-item> |
|
|
|
</el-row> |
|
|
|
</el-form> |
|
|
|
|
|
|
|
<!-- 刷新下发按钮 --> |
|
|
|
<Refresh @refresh="onSearch(currentDeviceId, 1)" /> |
|
|
|
</template> |
|
|
|
|
|
|
|
<script setup> |
|
|
|
import { ref } from 'vue'; |
|
|
|
import { computed, ref } from 'vue'; |
|
|
|
import { useStore } from 'vuex'; |
|
|
|
import { ElMessage } from 'element-plus'; |
|
|
|
import { cloneDeep, isDate } from 'lodash'; |
|
|
|
import { getConfigFunction, createConfigFunction } from 'apis/index'; |
|
|
|
import DeviceSelectAndSelect from 'components/device-select-and-status.vue'; |
|
|
|
import Refresh from 'components/refresh.vue'; |
|
|
|
|
|
|
|
const data = ref({ |
|
|
|
frequency: { |
|
|
@ -155,23 +187,29 @@ const data = ref({ |
|
|
|
temperatureLow: 0, // 温度低阈值 |
|
|
|
temperatureHigh: 0, // 温度高阈值 |
|
|
|
securityMode: 0, // 安全模式 0->不加密 1->加密 |
|
|
|
corrosiveType: '', // 金属腐蚀类型 |
|
|
|
corrosiveType1: '', // 金属腐蚀类型 |
|
|
|
corrosiveType2: '', // 金属腐蚀类型 |
|
|
|
corrosiveType3: '', // 金属腐蚀类型 |
|
|
|
corrosiveType4: '', // 金属腐蚀类型 |
|
|
|
report: { |
|
|
|
type: 0, // 上报周期类型 0->时间点 1->周期 |
|
|
|
timePoints: [0, 0, 0, 0, 0, 0], // 设置时间点 |
|
|
|
cycle: 0, // 上报周期分钟数 |
|
|
|
}, |
|
|
|
status: { get: 0, set: 0 }, |
|
|
|
}); |
|
|
|
|
|
|
|
// 金属腐蚀的类型 |
|
|
|
const types = ref([ |
|
|
|
{ value: 0, type: '金属腐蚀通道 1 类型' }, |
|
|
|
{ value: 1, type: '金属腐蚀通道 2 类型' }, |
|
|
|
{ value: 2, type: '金属腐蚀通道 3 类型' }, |
|
|
|
{ value: 3, type: '金属腐蚀通道 4 类型' }, |
|
|
|
{ value: 0, type: '锌' }, |
|
|
|
{ value: 1, type: '铝' }, |
|
|
|
{ value: 2, type: '铜' }, |
|
|
|
{ value: 3, type: '钢' }, |
|
|
|
]); |
|
|
|
|
|
|
|
const functionForm = ref(null); // form |
|
|
|
const store = useStore(); |
|
|
|
const currentDeviceId = computed(() => store.state.device.currentDeviceId); |
|
|
|
|
|
|
|
/** |
|
|
|
* 格式化时间 |
|
|
@ -186,7 +224,7 @@ const formatTime = date => { |
|
|
|
const onSubmit = () => { |
|
|
|
functionForm.value.validate(async () => { |
|
|
|
try { |
|
|
|
const param = cloneDeep({ ...data.value }); |
|
|
|
const param = cloneDeep({ ...data.value, deviceId: currentDeviceId.value }); |
|
|
|
if (param.report.type === 0) { |
|
|
|
// 按时间点上报 格式化时间格式 |
|
|
|
const points = [...param.report.timePoints]; |
|
|
@ -211,8 +249,15 @@ const onReset = () => { |
|
|
|
functionForm.value.resetFields(); |
|
|
|
}; |
|
|
|
|
|
|
|
// 获取功能参数 |
|
|
|
getConfigFunction().then(res => { |
|
|
|
data.value = res; |
|
|
|
}); |
|
|
|
/** |
|
|
|
* 查询网络参数配置 |
|
|
|
* @param {string} deviceId 设备id |
|
|
|
* @param {number} type 0数据库查询 1刷新查询 |
|
|
|
*/ |
|
|
|
const onSearch = async (deviceId, type = 0) => { |
|
|
|
const params = { deviceId, type }; |
|
|
|
store.commit('device/setCurrentDeviceId', deviceId); |
|
|
|
const resData = await getConfigFunction(params); |
|
|
|
data.value = resData; |
|
|
|
}; |
|
|
|
</script> |
|
|
|