<template> <div> <el-form ref="form" :model="form" label-width="160px"> <div class="alarm-title">气象水文</div> <el-row> <el-col :span="10"> <el-form-item label="台风报警"> <el-input v-model="form.windDistance"> <template slot="prepend">小于</template> <template slot="append">海里</template> </el-input> </el-form-item> </el-col> <el-col :span="10"> <el-form-item label="风速报警"> <el-input v-model="form.windSpeed"> <template slot="prepend">大于</template> <template slot="append">m/s</template> </el-input> </el-form-item> </el-col> </el-row> <div class="alarm-title">AIS&电子海图</div> <el-row> <el-col :span="10"> <el-form-item label="船舶报警"> <el-input v-model="form.ship"> <template slot="prepend">小于</template> <template slot="append">海里</template> </el-input> </el-form-item> </el-col> <el-col :span="10"> <el-form-item label="岛屿报警"> <el-input v-model="form.islands"> <template slot="prepend">小于</template> <template slot="append">海里</template> </el-input> </el-form-item> </el-col> </el-row> <div class="alarm-title">水下机器人</div> <el-row> <el-col :span="10"> <el-form-item label="电量报警"> <el-input v-model="form.electric"> <template slot="prepend">小于</template> <template slot="append">%</template> </el-input> </el-form-item> </el-col> <el-col :span="10"> <el-form-item label="位置报警"> <el-input v-model="form.position"> <template slot="prepend">大于</template> <template slot="append">海里</template> </el-input> </el-form-item> </el-col> </el-row> <div class="alarm-title">通信信号</div> <el-row> <el-col :span="10"> <el-form-item label="通信信号强度"> <el-input v-model="form.socket"> <template slot="prepend">小于</template> <template slot="append">kb/s</template> </el-input> </el-form-item> </el-col> </el-row> <div style="text-align: center;"> <el-button class="setting-btn" type="primary" @click="onSubmit">应 用</el-button> <el-button class="setting-btn" @click="read" style="margin-left: 20px">读取配置</el-button> <!--<el-button @click="save">保存配置</el-button>--> </div> </el-form> </div> </template> <script> import axios from 'axios' export default { name: 'Alarm', components: {}, data() { return { list: [], form: { windDistance:'', windSpeed:'', ship:'', islands:'', electric :'', position:'', socket:'' } } }, created() { this.init() }, mounted() { this.init() }, methods: { init(){ console.log('获取当前值') }, read(){ var that = this axios.get('./config/alarm.json').then((result) => { that.form = result.data }).catch((error) => { console.error('get baseConfig error...' + error) }) } } } </script> <style rel="stylesheet/scss" lang="scss"> .el-input-group__append, .el-input-group__prepend { padding: 5px !important; min-width: 40px; font-size: 12px; background-color: white !important; /*border: 1px solid #DCDFE6;*/ } .alarm-title{ text-align: center; margin: 7px; margin-top:0px; font-size: 15px; font-weight: bold; max-width: 120px; color: white; padding: 5px; background-color: #409effee; border-radius: 6px; } .setting-btn{ width: 100px; } </style>