Commit 99928fdb authored by xuke's avatar xuke

报警参数-第二次提交

parent fd1e8cdf
...@@ -242,8 +242,8 @@ import { ref, reactive, onMounted, onUnmounted } from 'vue'; ...@@ -242,8 +242,8 @@ import { ref, reactive, onMounted, onUnmounted } from 'vue';
import http from '../../api/http'; import http from '../../api/http';
import store from "../../store/index"; import store from "../../store/index";
import { ElMessage } from 'element-plus'; import { ElMessage } from 'element-plus';
import { watch } from 'fs';
import { watchEffect } from 'vue'; import { watchEffect } from 'vue';
import { add } from 'lodash';
//分页设置 //分页设置
const currentPage = ref(1) const currentPage = ref(1)
...@@ -505,33 +505,6 @@ console.log("AlarmInfo.value:::", AlarmInfo.value); ...@@ -505,33 +505,6 @@ console.log("AlarmInfo.value:::", AlarmInfo.value);
let cnNames_before = ref([]) let cnNames_before = ref([])
let cnNames_after = ref([]) let cnNames_after = ref([])
console.log("---------------------AlarmInfo.value:", AlarmInfo.value); console.log("---------------------AlarmInfo.value:", AlarmInfo.value);
let newType = ref(0)
watchEffect(() => {
console.log("监听::::", type.value);
if (type.value === "GetPipeAlarmStatusData") {
newType.value = 1
} else if (type.value === "GetBoilerAlarmStatusData") {
newType.value = 2
} else {
newType.value = 3
}
})
// 接口2:换热站基础参数编号(transParaBaseId) -> 接口1:baseId
const getCnNames = () => {
// console.log('dept-------------------', dept.value);
// console.log("++++++++++++++++++++++++", newType.value);
let data = http.post("api/alarm/para/GetAlarmPara", { type: newType.value, id: dept.value }, false);
data.then(function (val) {
cnNames_before.value = val.data.before
cnNames_after.value = val.data.after
// console.log("cnNames_before@@@@", cnNames_before);
// console.log("cnNames_after@@@@", cnNames_after);
// console.log("cnNames_before.transParaBaseId:", cnNames_before.transParaBaseId)
});
}
let params = ref({ let params = ref({
"pipeAlarmParaId": "", "pipeAlarmParaId": "",
...@@ -550,11 +523,10 @@ let params = ref({ ...@@ -550,11 +523,10 @@ let params = ref({
"isActive": "", "isActive": "",
"updateNullFields": "", "updateNullFields": "",
}) })
let addParams = ref({ let addParams = ref({
"updateNullFields": "", "updateNullFields": "",
"pipeParaBaseId": "",
"pipeId": dept.value,
"gatherType": "",
"voicePath": "", "voicePath": "",
"isVoice": "", "isVoice": "",
"topMost": "", "topMost": "",
...@@ -566,24 +538,84 @@ let addParams = ref({ ...@@ -566,24 +538,84 @@ let addParams = ref({
"isAlarm": "", "isAlarm": "",
"isActive": "" "isActive": ""
}) })
const reset = () => {
addParams.value = {
"updateNullFields": "",
"voicePath": "",
"isVoice": "",
"topMost": "",
"upper": "",
"lower": "",
"downMost": "",
"alarmPlan": "",
"isShortMessage": "",
"isAlarm": "",
"isActive": ""
}
}
let param = ref({ let param = ref({
"cnName": "", "cnName": "",
"transParaBaseId": "" "baseId": ""
})
let newType = ref(0)
watchEffect(() => {
console.log("监听::::", type.value);
if (type.value === "GetPipeAlarmStatusData") {
newType.value = 1
param.value.baseId = "pipeParaBaseId"
} else if (type.value === "GetBoilerAlarmStatusData") {
newType.value = 2
param.value.baseId = "boilerParaBaseId"
} else {
newType.value = 3
param.value.baseId = "transParaBaseId"
}
}) })
// 接口2:换热站基础参数编号(transParaBaseId) -> 接口1:baseId
const getCnNames = () => {
// console.log('dept-------------------', dept.value);
// console.log("++++++++++++++++++++++++", newType.value);
let data = http.post("api/alarm/para/GetAlarmPara", { type: newType.value, id: dept.value }, false);
data.then(function (val) {
cnNames_before.value = val.data.before
cnNames_after.value = val.data.after
console.log("cnNames_before@@@@", cnNames_before);
console.log("cnNames_after@@@@", cnNames_after);
// console.log("cnNames_before.transParaBaseId:", cnNames_before.transParaBaseId)
});
}
// 点击确定查询数据 // 点击确定查询数据
const paramsSetting = () => { const paramsSetting = () => {
getCnNames() getCnNames()
} }
let newRow = ref({})
const selectParams = (row) => { const selectParams = (row) => {
param.value.transParaBaseId = row.transParaBaseId
console.log("param.value.transParaBaseId========", param.value.transParaBaseId);
if (param.value.transParaBaseId) {
const data = http.post("/api/alarm/para/GetAlarmParaInfo", { type: newType.value, id: dept.value, baseid: param.value.transParaBaseId }, false) if (type.value === "GetPipeAlarmStatusData") {
console.log("dataaaaa:", data); newType.value = 1
param.value.baseId = "pipeParaBaseId"
} else if (type.value === "GetBoilerAlarmStatusData") {
newType.value = 2
param.value.baseId = "boilerParaBaseId"
} else {
newType.value = 3
param.value.baseId = "transParaBaseId"
}
console.log("+++++++++++++++++", param.value.baseId);
param.value.baseId = row[param.value.baseId]
newRow.value = param.value.baseId
if (param.value.baseId) {
const data = http.post("/api/alarm/para/GetAlarmParaInfo", { type: newType.value, id: dept.value, baseid: param.value.baseId }, false)
console.log("查看baseId --- dataaaaa:", data);
data.then(function (val) { data.then(function (val) {
console.log("valllll:", val); console.log("valllll:", val);
params.value = val.data params.value = val.data
...@@ -595,28 +627,69 @@ const selectParams = (row) => { ...@@ -595,28 +627,69 @@ const selectParams = (row) => {
} }
} }
watchEffect(() => {
addParams.value.pipeId = dept.value
console.log(addParams.value.pipeId);
})
//"pipeId": "",
// "boilerId": "",
// "unitId": "",
// 总管
const onAdd = () => { const onAdd = () => {
// const data = http.post("api/alarm/para/pipesave", { ...addParams.value }, false) console.log("!!!!!!!", addParams.value);
// console.log("新增data:::", data); if (newType.value === 1) {
// if (data.success) { addParams.value.pipeId = dept.value
// ElMessage.success("修改成功!!") addParams.value.pipeParaBaseId = newRow.value
// } else { addParams.value.gatherType = 1
// ElMessage.error("修改失败!!") addParams.value.voicePath = 1
// }
http.post("api/alarm/para/pipesave", { ...addParams.value }, false).then((res) => { http.post("api/alarm/para/pipesave", { ...addParams.value }, false).then((res) => {
if (res.success) { if (res.success) {
ElMessage.success("修改成功!!") ElMessage.success("总管新增成功!!")
getCnNames() delete addParams.value.pipeId
} else { delete addParams.value.pipeParaBaseId
ElMessage.error("修改失败!!") delete addParams.value.gatherType
} delete addParams.value.voicePath
}) reset()
param.value.cnName = ""
getCnNames()
} else {
ElMessage.error("总管修改失败!!")
}
})
} else if (newType.value === 2) {
addParams.value.boilerParaBaseId = newRow.value
addParams.value.boilerId = dept.value
http.post("api/alarm/para/boilersave", { ...addParams.value }, false).then((res) => {
if (res.success) {
ElMessage.success("锅炉修改成功!!")
delete addParams.value.boilerParaBaseId
delete addParams.value.boilerId
reset()
param.value.cnName = ""
getCnNames()
} else {
ElMessage.error("锅炉修改失败!!")
}
})
} else if (newType.value === 3) {
addParams.value.transParaBaseId = newRow.value
addParams.value.unitId = dept.value
http.post("api/alarm/para/transsave", { ...addParams.value }, false).then((res) => {
if (res.success) {
ElMessage.success("换热机修改成功!!")
delete addParams.value.transParaBaseId
delete addParams.value.unitId
reset()
param.value.cnName = ""
getCnNames()
} else {
ElMessage.error("换热机修改失败!!")
}
})
}
} }
// 按钮 // 按钮
const button = ref(true) const button = ref(true)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment