cac添加监测设备
parent
7fa87a1df7
commit
7fb6e3f0e1
@ -0,0 +1,177 @@
|
|||||||
|
<template>
|
||||||
|
<div class="monitoringAddBox">
|
||||||
|
<el-dialog
|
||||||
|
class="monitoringAddDialogBox"
|
||||||
|
:title="title"
|
||||||
|
:visible.sync="monitoringDialogshow"
|
||||||
|
width="520px"
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
>
|
||||||
|
<el-form
|
||||||
|
label-position="left"
|
||||||
|
ref="formInfo"
|
||||||
|
label-width="104px"
|
||||||
|
:model="formInfo"
|
||||||
|
:rules="rules"
|
||||||
|
>
|
||||||
|
<el-form-item label="主设备名称:" prop="zsbName">
|
||||||
|
<el-input v-model="formInfo.zsbName"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="名称:" prop="name">
|
||||||
|
<el-input v-model="formInfo.name"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="相位:" prop="phase">
|
||||||
|
<el-input v-model="formInfo.phase"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="选择表名:">
|
||||||
|
<el-select v-model="formInfo.tablename" @change="changetablename">
|
||||||
|
<el-option
|
||||||
|
v-for="item in tableOptions"
|
||||||
|
:key="item.name"
|
||||||
|
:label="item.name"
|
||||||
|
:value="item.name"
|
||||||
|
>
|
||||||
|
{{ item.name
|
||||||
|
}}<span v-if="item.comment != '' && item.comment != null"
|
||||||
|
>({{ item.comment }})</span
|
||||||
|
>
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="传感器代码:" prop="sensorCode">
|
||||||
|
<el-input v-model="formInfo.sensorCode"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button @click="hide">取 消</el-button>
|
||||||
|
<el-button type="primary" @click="submitForm()">确 定</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
import {
|
||||||
|
monitoringAddApi,
|
||||||
|
monitoringUpdateApi,
|
||||||
|
tableListApi,
|
||||||
|
} from "@/utils/api/index";
|
||||||
|
export default {
|
||||||
|
props: ["title"],
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
monitoringDialogshow: false,
|
||||||
|
formInfo: "",
|
||||||
|
rules: {
|
||||||
|
mc: [{ required: true, message: "请输入名称", trigger: "blur" }],
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
created() {},
|
||||||
|
mounted() {},
|
||||||
|
watch: {},
|
||||||
|
methods: {
|
||||||
|
//判断
|
||||||
|
getdataform(val) {
|
||||||
|
console.log(val);
|
||||||
|
if (val == null) {
|
||||||
|
this.formInfo = {
|
||||||
|
mc: "",
|
||||||
|
coordinate: "",
|
||||||
|
voltagegrade: "",
|
||||||
|
note: "",
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
this.formInfo = JSON.parse(JSON.stringify(val));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
submitForm() {
|
||||||
|
this.$refs.formInfo.validate((valid) => {
|
||||||
|
if (valid) {
|
||||||
|
if (this.title == "添加监测设备") {
|
||||||
|
console.log(this.formInfo);
|
||||||
|
monitoringAddApi(this.formInfo)
|
||||||
|
.then((res) => {
|
||||||
|
if (res.success) {
|
||||||
|
this.$message({
|
||||||
|
duration: 1500,
|
||||||
|
showClose: true,
|
||||||
|
message: "添加成功",
|
||||||
|
type: "success",
|
||||||
|
});
|
||||||
|
this.hide();
|
||||||
|
this.$parent.getmonitoringAllList(); //刷新
|
||||||
|
} else {
|
||||||
|
this.$message({
|
||||||
|
duration: 1500,
|
||||||
|
showClose: true,
|
||||||
|
message: res.errorMsg,
|
||||||
|
type: "error",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((err) => {});
|
||||||
|
} else {
|
||||||
|
monitoringUpdateApi(this.formInfo)
|
||||||
|
.then((res) => {
|
||||||
|
if (res.success) {
|
||||||
|
this.$message({
|
||||||
|
duration: 1500,
|
||||||
|
showClose: true,
|
||||||
|
message: "修改成功",
|
||||||
|
type: "success",
|
||||||
|
});
|
||||||
|
this.hide();
|
||||||
|
this.$parent.getmonitoringAllList(); //刷新
|
||||||
|
} else {
|
||||||
|
this.$message({
|
||||||
|
duration: 1500,
|
||||||
|
showClose: true,
|
||||||
|
message: res.errorMsg,
|
||||||
|
type: "error",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((err) => {});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
console.log("error submit!!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
display() {
|
||||||
|
this.monitoringDialogshow = true;
|
||||||
|
// if (this.title == "添加电站") {
|
||||||
|
// this.formInfo.mc = "";
|
||||||
|
// this.formInfo.coordinate = "";
|
||||||
|
// this.formInfo.voltagegrade = "";
|
||||||
|
// this.formInfo.scale = "";
|
||||||
|
// this.formInfo.note = "";
|
||||||
|
// }
|
||||||
|
},
|
||||||
|
hide() {
|
||||||
|
//this.$refs.formInfo.resetFields(); // 重置表单字段值
|
||||||
|
this.monitoringDialogshow = false;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<style lang="less">
|
||||||
|
.monitoringAddBox {
|
||||||
|
.monitoringAddDialogBox {
|
||||||
|
.el-input-number--small {
|
||||||
|
width: 374px;
|
||||||
|
.el-input__inner {
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.el-select {
|
||||||
|
width: 374px;
|
||||||
|
}
|
||||||
|
.el-input-number.is-controls-right[class*="small"] [class*="decrease"],
|
||||||
|
.el-input-number.is-controls-right[class*="small"] [class*="increase"] {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
Loading…
Reference in New Issue