Files
hb_pqs_web/src/views/componentschild/powerqualitybg.vue
2025-01-09 19:02:44 +08:00

162 lines
3.9 KiB
Vue

<template>
<div style="padding: 0px">
<el-col :span="24">
<el-table
stripe
ref="bgzh"
:data="tableData"
:height="vh"
border
v-loading="konzhi"
header-cell-class-name="table_header"
element-loading-text="拼命加载中"
>
<el-table-column
align="center"
prop="name"
label="名称"
></el-table-column>
<el-table-column align="center" prop="data" label="谐波电压(%)">
<template slot-scope="scope">
<span v-if="scope.row.data == 3.14159" type="primary" size="small"
>暂无数据</span
>
<span
v-if="scope.row.data !== 3.14159"
type="primary"
size="small"
>{{ scope.row.data }}</span
>
</template>
</el-table-column>
<el-table-column
align="center"
prop="monitors"
label="监测点个数(个)"
></el-table-column>
<el-table-column align="center" prop="level" label="评估">
</el-table-column>
</el-table>
</el-col>
</div>
</template>
<script>
import { dicData } from "@/assets/commjs/dictypeData";
import api from "@/api/integraliy/integraliy";
export default {
props: {
item: {
type: Object,
default: null,
},
item2: {
type: Object,
default: null,
},
height: {
type: Number,
default: null,
},
height2: {
type: Number,
default: null,
},
},
watch: {
height2(a, b) {
if (a == 24) {
this.vh = document.getElementById("conmentId").offsetHeight - 50;
this.queryData();
} else {
return;
}
},
height(a, b) {
if (a == 6 || a == 8 || a == 9 || a == 16) {
setTimeout(() => {
let str = document.getElementById("powerqualitybg").style.height;
let strsec = str.split("p");
let height = parseInt(strsec) - 50;
this.vh = height+10;
this.queryData();
}, 200);
} else {
return;
}
},
deep: true,
},
data() {
return {
konzhi: false,
vh: null,
h: 0,
tableData: [],
time: this.timefamt(),
formData: {
deptIndex: JSON.parse(window.sessionStorage.getItem("Info")).deptId,
id: "",
monitorFlag: 2,
powerFlag: 2,
reportFlag: 3,
statisticalType: null,
},
classificationData: [],
};
},
created() {
this.getIndexType();
this.queryData();
},
mounted() {
setTimeout(() => {
let str = document.getElementById("powerqualitybg").style.height;
let strsec = str.split("p");
let height = parseInt(strsec) - 50;
this.vh = height+10;
}, 200);
},
methods: {
//字典获取数据指标类型
getIndexType() {
var code = "Indicator_Type";
this.classificationData = dicData(code, [
"PLPC",
"DYPC",
"SXDYBPHD",
"CSSB",
"FXDL",
"JXBDY",
]);
this.formData.statisticalType = this.classificationData[0];
},
timefamt() {
var date = new Date();
var year = date.getFullYear();
var month = date.getMonth() + 1;
var day = date.getDate();
month = month > 9 ? month : "0" + month;
day = day < 10 ? "0" + day : day;
var arr = [];
var time1 = year + "-" + month + "-01";
arr.push(time1);
var time2 = year + "-" + month + "-" + day;
arr.push(time2);
return arr;
},
queryData() {
this.konzhi = true;
this.formData.searchBeginTime = this.time[0];
this.formData.searchEndTime = this.time[1];
api.getComAccessData(this.formData).then((res) => {
if (res.code == "A0000") {
this.tableData = res.data;
this.konzhi = false;
}
});
},
},
};
</script>