<template>
|
<div class="SZ_box">
|
<div class="SZ_title">数值设置</div>
|
<div class="form_box">
|
<div class="inp_box">
|
<span>报警值设置</span>
|
<el-input v-model="data.BJ" size="large" />
|
</div>
|
<div class="inp_box">
|
<span>预警值设置</span>
|
<el-input v-model="data.YJ" size="large" />
|
</div>
|
<div class="button_box">
|
<el-button size="small" @click="selectList" class="button"
|
>确认</el-button
|
>
|
</div>
|
</div>
|
</div>
|
</template>
|
|
<script>
|
import { reactive, onMounted, watch, ref } from "vue";
|
import { useStore } from "vuex";
|
import { bjyjControllerUpdate, bjyjControllerGetAll } from "@/api/api.js";
|
import { FormInstance, ElMessage, ElMessageBox } from "element-plus";
|
export default {
|
//import引入的组件需要注入到对象中才能使用
|
components: {},
|
setup(props) {
|
let data = reactive({
|
BJ: "",
|
YJ: "",
|
bjData: {},
|
});
|
|
const selectList = async () => {
|
ElMessageBox.confirm("确定是否修改", "Warning", {
|
confirmButtonText: "确定",
|
cancelButtonText: "取消",
|
type: "warning",
|
})
|
.then(async () => {
|
data.bjData.jcbj = data.BJ;
|
data.bjData.jcyj = data.YJ;
|
const dt = await bjyjControllerUpdate(data.bjData);
|
if (dt.code != 200) {
|
return ElMessage.error("修改失败");
|
}
|
ElMessage({
|
message: "修改成功",
|
type: "success",
|
});
|
})
|
.catch(() => {});
|
};
|
const getBJ = async () => {
|
// debugger
|
const dt = await bjyjControllerGetAll();
|
data.bjData = dt.result[0];
|
data.BJ = data.bjData.jcbj;
|
data.YJ = data.bjData.jcyj;
|
};
|
getBJ();
|
return { data, selectList, getBJ };
|
},
|
};
|
</script>
|
<style lang="less" scoped>
|
//@import url(); 引入公共css类
|
.SZ_box {
|
// width: calc(742px * 1);
|
height: calc(200px * 1);
|
// position: absolute;
|
// right: 70px;
|
// top: 730px;
|
background: url("../assets/img/d.png") no-repeat center;
|
background-size: 100% 100%;
|
padding: 40px;
|
box-sizing: border-box;
|
.SZ_title {
|
font-size: 30px;
|
font-weight: bold;
|
color: #ffffff;
|
padding-bottom: 30px;
|
}
|
}
|
.form_box {
|
display: flex;
|
justify-content: space-around;
|
align-items: center;
|
.inp_box {
|
margin-right: 20px;
|
span {
|
font-size: 24px;
|
font-weight: 400;
|
color: #ffffff;
|
padding-right: 10px;
|
}
|
.el-input {
|
width: 140px;
|
}
|
.el-input /deep/ .el-input__wrapper {
|
background: rgba(0, 0, 0, 0.2);
|
border: 2px solid #2e58cc;
|
border-radius: 10px;
|
color: #ffffff;
|
padding: 0;
|
padding-left: 3px;
|
}
|
.el-input /deep/ .el-input__inner {
|
color: #ffffff;
|
font-size: 24px;
|
}
|
}
|
}
|
.el-button {
|
background: rgba(0, 0, 0, 0.2);
|
border: 2px solid #2e58cc;
|
border-radius: 10px;
|
color: #ffffff;
|
}
|
</style>
|