|
|
|
@ -1,51 +1,40 @@
|
|
|
|
|
<template>
|
|
|
|
|
<div>
|
|
|
|
|
|
|
|
|
|
<el-form style="margin-top: 24px" ref="postRef" :label-width=" locale ? '250px':'300px'" :model="form" :rules="rules">
|
|
|
|
|
<el-form ref="postRef" :label-width=" locale ? '250px':'300px'" :model="form" :rules="rules"
|
|
|
|
|
style="margin-top: 24px">
|
|
|
|
|
<el-form-item v-if="false" prop="id">
|
|
|
|
|
<el-input v-model="form.id"/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="第一轴高气压阀值" prop="internationalization1">
|
|
|
|
|
<el-input-number v-model="form.internationalization1" :step="5" />
|
|
|
|
|
<el-form-item label="选择车辆" prop="internationalization8">
|
|
|
|
|
<el-cascader
|
|
|
|
|
:options="options"
|
|
|
|
|
:props="{ multiple: true, checkStrictly: true,value:'id',label:'title',children:'baseCarList', }"
|
|
|
|
|
clearable
|
|
|
|
|
@change="cascaderChange"></el-cascader>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="第一轴高气压阀值" prop="z1PressureHigh;">
|
|
|
|
|
<el-input-number v-model="form.z1PressureHigh" :min="0" :step="5"/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="第一轴低气压阀值" prop="internationalization2">
|
|
|
|
|
<el-input-number v-model="form.internationalization2" :step="5" />
|
|
|
|
|
<el-form-item label="第一轴低气压阀值" prop="z1PressureLow">
|
|
|
|
|
<el-input-number v-model="form.z1PressureLow" :min="0" :step="5"/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="其他轴高气压阀值" prop="internationalization3">
|
|
|
|
|
<el-input-number v-model="form.internationalization3" :step="5" />
|
|
|
|
|
<el-form-item label="其他轴高气压阀值" prop="zPressureHigh">
|
|
|
|
|
<el-input-number v-model="form.zPressureHigh" :min="0" :step="5"/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="其他轴低气压阀值" prop="internationalization4">
|
|
|
|
|
<el-input-number v-model="form.internationalization4" :step="5" />
|
|
|
|
|
<el-form-item label="其他轴低气压阀值" prop="zPressureLow">
|
|
|
|
|
<el-input-number v-model="form.zPressureLow" :min="0" :step="5"/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="高温阀值" prop="internationalization5">
|
|
|
|
|
<el-input-number v-model="form.internationalization5" :step="5" />
|
|
|
|
|
<el-form-item label="高温阀值" prop="temperatureHigh">
|
|
|
|
|
<el-input-number v-model="form.temperatureHigh" :min="0" :step="5"/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="设置生效时间" prop="internationalization6">
|
|
|
|
|
<el-date-picker
|
|
|
|
|
v-model="form.internationalization6"
|
|
|
|
|
type="date"
|
|
|
|
|
placeholder="选择日期"
|
|
|
|
|
type="date"
|
|
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="失败无限定时推送" prop="internationalization7">
|
|
|
|
|
<el-switch v-model="form.internationalization7" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="选择车辆" prop="internationalization8">
|
|
|
|
|
<el-select
|
|
|
|
|
filterable
|
|
|
|
|
:remote-method="remoteMethod"
|
|
|
|
|
v-model="form.internationalization8"
|
|
|
|
|
class="m-2"
|
|
|
|
|
placeholder="请选择车辆" >
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="item in options"
|
|
|
|
|
:key="item.value"
|
|
|
|
|
:label="item.label"
|
|
|
|
|
:value="item.value"
|
|
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label=" ">
|
|
|
|
|
<el-button icon="Search" type="primary" @click="handleQuery">立即创建</el-button>
|
|
|
|
|
<el-button icon="Refresh" @click="resetQuery">{{ t('option.reset') }}</el-button>
|
|
|
|
@ -56,7 +45,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<script name="Test" setup>
|
|
|
|
|
import {listBaseCar} from "@/api/realTimeMonitoring/alarmSendingSettings";
|
|
|
|
|
import {listBaseCar, setAttributes, getInfoById} from "@/api/realTimeMonitoring/alarmSendingSettings";
|
|
|
|
|
|
|
|
|
|
import {useI18n} from 'vue-i18n';
|
|
|
|
|
import Cookies from "js-cookie";
|
|
|
|
@ -67,48 +56,82 @@ const {t} = useI18n();
|
|
|
|
|
const locale = (Cookies.get('language') || 'zhCn') === 'zhCn'
|
|
|
|
|
const {proxy} = getCurrentInstance();
|
|
|
|
|
|
|
|
|
|
const ids = ref([])
|
|
|
|
|
const axleTotals = ref([])
|
|
|
|
|
const deviceIds = ref([])
|
|
|
|
|
|
|
|
|
|
const remoteMethod = (e) => {
|
|
|
|
|
console.log(form.value.internationalization8)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const options = ref([
|
|
|
|
|
{
|
|
|
|
|
value: 'Option1',
|
|
|
|
|
label: 'Option1',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
value: 'Option2',
|
|
|
|
|
label: 'Option2',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
value: 'Option3',
|
|
|
|
|
label: 'Option3',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
value: 'Option4',
|
|
|
|
|
label: 'Option4',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
value: 'Option5',
|
|
|
|
|
label: 'Option5',
|
|
|
|
|
},
|
|
|
|
|
])
|
|
|
|
|
const options = ref([])
|
|
|
|
|
const form = ref({
|
|
|
|
|
internationalization1:10,
|
|
|
|
|
internationalization2:10,
|
|
|
|
|
internationalization3:10,
|
|
|
|
|
internationalization4:10,
|
|
|
|
|
internationalization5:10,
|
|
|
|
|
z1PressureHigh: 0,
|
|
|
|
|
z1PressureLow: 0,
|
|
|
|
|
zPressureHigh: 0,
|
|
|
|
|
zPressureLow: 0,
|
|
|
|
|
temperatureHigh: 0,
|
|
|
|
|
internationalization6: parseTime(new Date(), '{y}-{m}-{d}'),
|
|
|
|
|
internationalization7: true,
|
|
|
|
|
internationalization8: '',
|
|
|
|
|
})
|
|
|
|
|
const setDisabled = (arr) => {
|
|
|
|
|
arr.forEach(e => {
|
|
|
|
|
if (e.baseCarList) {
|
|
|
|
|
e.disabled = true
|
|
|
|
|
setDisabled(e.baseCarList)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
listBaseCar().then(e => {
|
|
|
|
|
options.value = e.rows.map(val => {
|
|
|
|
|
return {
|
|
|
|
|
label: val.carLicense,
|
|
|
|
|
value: val.id,
|
|
|
|
|
let res = JSON.stringify(e.rows)
|
|
|
|
|
let newObj = JSON.parse(res.replace(/"carLicense":/g, '"title":'))
|
|
|
|
|
setDisabled(newObj)
|
|
|
|
|
options.value = newObj
|
|
|
|
|
})
|
|
|
|
|
const cascaderChange = (e) => {
|
|
|
|
|
let lastIds = ids.value || []
|
|
|
|
|
let nowIds = e.map(val => val.at(-1))
|
|
|
|
|
let nowClick = nowIds.filter(val => !(lastIds.includes(val)))?.[0]
|
|
|
|
|
ids.value = e.map(val => val.at(-1))
|
|
|
|
|
if (!nowClick) return
|
|
|
|
|
getInfoById(nowClick)
|
|
|
|
|
.then(val => {
|
|
|
|
|
console.log(val)
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
const handleQuery = (e) => {
|
|
|
|
|
let axleTotalsChange = []
|
|
|
|
|
let deviceIdsChange = []
|
|
|
|
|
let list = []
|
|
|
|
|
if (ids.value.length === 0) return
|
|
|
|
|
let recursion = (arr) => {
|
|
|
|
|
arr.forEach(val => {
|
|
|
|
|
list.push(val)
|
|
|
|
|
if (val.baseCarList?.[0]) {
|
|
|
|
|
recursion(val.baseCarList)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
recursion(options.value)
|
|
|
|
|
ids.value.forEach(v => {
|
|
|
|
|
let filer = list.find(res => res.id === v)
|
|
|
|
|
axleTotalsChange.push(filer.axleTotal)
|
|
|
|
|
deviceIdsChange.push(filer.deviceId)
|
|
|
|
|
})
|
|
|
|
|
axleTotals.value = axleTotalsChange
|
|
|
|
|
deviceIds.value = deviceIdsChange
|
|
|
|
|
setAttributes({
|
|
|
|
|
carIds: ids.value,
|
|
|
|
|
axleTotals: axleTotals.value,
|
|
|
|
|
deviceIds: deviceIds.value,
|
|
|
|
|
z1PressureHigh: form.value.z1PressureHigh,
|
|
|
|
|
z1PressureLow: form.value.z1PressureLow,
|
|
|
|
|
zPressureHigh: form.value.zPressureHigh,
|
|
|
|
|
zPressureLow: form.value.zPressureLow,
|
|
|
|
|
temperatureHigh: form.value.temperatureHigh,
|
|
|
|
|
}).then(val => {
|
|
|
|
|
console.log(val)
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
</script>
|