123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193 |
- <template>
- <div class="bigBox">
- <div class="header">
- <h1>{{ flashName + '——' + scdName + '——SLC效验' }}</h1>
- </div>
- <div class="main">
- <div class="treeBox">
- <el-tree :data="treeData" :props="defaultProps" @node-click="handleNodeClick" />
- </div>
- <div class="tableBox">
- <div class="allMis">
- <el-button type="primary" plain>导出所有结果</el-button>
- <el-button style="margin-right: 10px;" type="primary" plain>导出当前节点结果</el-button>
- <span style="margin-right: 10px;">全部:{{ errorNum - 0 + warningNum - 0 }}</span>
- <span style="margin-right: 10px;">错误:<em style="color: red;">{{ errorNum ? errorNum : 0 }}</em></span>
- <span style="margin-right: 10px;">告警:<em style="color: green;">{{ warningNum ? warningNum : 0 }}</em></span>
- </div>
- <div class="table">
-
- </div>
- </div>
- </div>
- </div>
- </template>
- <script>
- import { ref, onMounted, toRefs, watch, reactive } from "vue"
- import scd from "@/api/scd";
- import slc from "@/api/slc/slc"
- import systemRow from "@/api/systemRow";
- import Pagnation from "../utils/Pagnation.vue";
- import { ElMessage, ElLoading } from "element-plus";
- export default {
- props: {
- nowScdId: {
- type: String,
- required: true
- }
- },
- setup(props, { emit }) {
- let scdid = ref('')//scdid
- let scdName = ref('')//scd名称
- let flashName = ref("")//变电站名称
- let treeData = ref([
- // {
- // label: "1号主变差动",
- // children: [],
- // pids: '6871',
- // name: "area"
- // }, {
- // label: '一号主变本体',
- // children: [],
- // pids: "6875",
- // name: "area"
- // }, {
- // label: "公用",
- // children: [],
- // pids: "6890",
- // name: "area"
- // }, {
- // label: "SCL",
- // pids: "572000161",
- // children: [],
- // name: "SCL"
- // }
- ])//tree数据
- let defaultProps = ref({
- label: "title",
- id: "id",
- pids: "pid",
- children: "children",
- area: "area_id"
- })
- let errorNum = ref(0)
- let warningNum = ref(0)
- watch(() => props.nowScdId, (newVal) => {
- scdid.value = newVal
- })
- let indexs = 0
- function reload() {
- scdid.value = props.nowScdId
- let loading = ElLoading.service({
- text: "等待数据中",
- lock: true,
- background: "rgba(0, 0, 0, 0.7)"
- })
- Promise.all([
- scd.getScdById({ scd_id: scdid.value - 0 }),//获取scd详细信息scd1
- slc.getAllMission({ scd_id: scdid.value - 0 }),//slc1
- slc.getErrorByLevel({ scd_id: scdid.value - 0 }),//获取报错总数slc2
- slc.getScdByIdFromMission({ pageno: 1, pagesize: 20, scd_id: scdid.value - 0 }),//slc3
- slc.getScdByIdTree({ scd_id: scdid.value - 0 }),//获取tree数据slc4
- systemRow.getChildren({ code: "voltage_level" })
- ]).then(([scd1, slc1, slc2, slc3, slc4, flash]) => {
- if (scd1.data != null) {
- scdName.value = scd1.data.scd_name
- flashName.value = scd1.data.station_name
- }
- if (slc4.data != null) {
- treeData.value = slc4.data
- }
- if (slc2.data != null) {
- errorNum.value = slc2.data[0].cnt//错误
- warningNum.value = slc2.data[1].cnt//告警
- }
- // treeData.value[3].children = slc4.data.slice(0, 3).map(item => {
- // return {
- // label: item.title,
- // id: item.id,
- // pids: item.pid
- // }
- // })
- // let a = slc4.data.map(item => {
- // return flash.data.find(param => item.voltage_level - 0 === param.id - 0);
- // })
- // a = a.filter((item, index, arr) => item !== undefined && arr.indexOf(item) === index);
- // a.forEach(item => {
- // // 判断 treeData.value[3].children 是否已经存在相同的元素
- // const existingItem = treeData.value[3].children.find(child => child.id === item.id);
- // if (!existingItem) {
- // // 如果不存在相同元素,则将当前项插入到 children 中
- // treeData.value[3].children.splice(indexs, 0, {
- // label: item.name,
- // id: item.id,
- // });
- // indexs++; // 插入位置后移
- // }
- // });
- loading.close()
- })
- }
- function handleNodeClick(e) {
- console.log(e, 'hand');
- }
- onMounted(() => {
- reload()
- })
- return {
- scdid,//scdid
- reload,//初始化组件
- scdName,//scd名称
- flashName,//变电站名称
- treeData,//树形数据
- defaultProps,//树形展示
- handleNodeClick,//树形每行点击
- errorNum,//错误数量
- warningNum,//告警数量
- }
- },
- components: {
- Pagnation,
- }
- }
- </script>
- <style scoped>
- em{
- font-style: normal;
- }
- .bigBox {
- width: 97%;
- height: calc(100vh - 200px);
- margin-left: 18px;
- }
- .header {
- width: 100%;
- height: auto;
- text-align: center;
- }
- .main {
- width: 100%;
- height: calc(100vh - 260px);
- margin: 0 auto;
- border: 1px solid salmon;
- display: flex;
- justify-content: space-around;
- align-items: center;
- }
- .treeBox {
- width: 20%;
- height: calc(100vh - 260px);
- overflow-y: auto;
- overflow-x: hidden;
- }
- .tableBox {
- width: 80%;
- height: calc(100vh - 260px);
- }
- </style>
|