Przeglądaj źródła

报警分析页面接口数据展示优化

SunZehao 3 miesięcy temu
rodzic
commit
525baefd0d

+ 3 - 1
src/api/zhbj/index.js

@@ -239,9 +239,11 @@ export const getAdapterHistorysnap = (
 // 列表接口
 export const getAlarmCountList = (params) => {
   return request({
-    url: `alarm/history/findWtFeatureStat?timeType=${params.timeType}&begin=${params.begin}&end=${params.end}&stationid=${params.stationid}&components=${params.components}&modelId=${params.modelId}&alarmIds=${params.alarmIds}&alarmType=${params.alarmType}`,
+    url: `alarm/history/findWtFeatureStat?pageNum=${params.pageNum}&pageSize=${params.pageSize}&timeType=${params.timeType}&begin=${params.begin}&end=${params.end}&stationid=${params.stationid}&components=${params.components}&modelId=${params.modelId}&alarmIds=${params.alarmIds}&alarmType=${params.alarmType}`,
+    // url: 'alarm/history/findWtFeatureStat',
     baseURL: process.env.VUE_APP_ALARM,
     method: "get",
+    // params: params
   });
 };
 // 获取报警描述列表

+ 33 - 22
src/views/IntegratedAlarm/reliability/historyAnalyse/index.vue

@@ -221,7 +221,7 @@
           layout="total, sizes, prev, pager, next"
           :current-page="query.page"
           :page-size="query.limit"
-          :page-sizes="[21, 100, 500, 1000]"
+          :page-sizes="[10, 100, 500, 1000]"
           :total="query.pageTotal"
           @size-change="
             (value) => {
@@ -302,10 +302,11 @@ onMounted(() => {
 const pageTitle = "报警分析";
 const store = useStore();
 const changZhanArray = ref([]);
+const windName = ref([]);
 
 const query = reactive({
   page: 1,
-  limit: 21,
+  limit: 10,
   pageTotal: null,
 });
 const state = reactive({
@@ -331,7 +332,7 @@ const state = reactive({
   tableData: [],
   tHeard: [],
   changZhan: "",
-  components: ["LG"], //部件
+  components: ["FDJ", "CLX"], //部件
   modelId: "", //型号
   alarmIds: "",
   alarmIdList: [],
@@ -589,11 +590,11 @@ watch(
             return ele.nemCode === "FDJ";
           })?.nemCode || "";
         componenDefaultSelect
-          ? (state.components = ["LG"])
+          ? (state.components = ["FDJ", "CLX"])
           : arr[1]?.[0]?.nemCode
           ? (state.components = [arr[1]?.[0]?.nemCode])
           : (state.components = []);
-        // getAlarmId();
+        getAlarmId();
       }
     }
   },
@@ -661,8 +662,9 @@ function getTableList() {
       alarmIds: state.alarmIds,
       alarmType: state.typeVal,
     }).then((res) => {
-        if (res && res.length>0) {
-            changeTableData(res)
+        if (res && res.result.length>0) {
+            changeTableData(res.result)
+            query.pageTotal = res.total
         } else {
             state.tHeard = [];
             state.tableData = [];
@@ -678,32 +680,41 @@ function getTableList() {
 }
 
 const changeTableData = (res) => {
-      query.pageTotal = res.length
     if (res.length) {
+        if (query.page === 1) {
+            windName.value = []
+        }
         let tableData = [];
         let tHeard = [];
         let data = res;
-        data.forEach((pEle) => {
+        data.forEach((pEle, index) => {
           for (let wtId in pEle) {
             let wtItem = data.find((tableItem) => {
               return wtId === tableItem.windturbineId;
             });
             !wtItem && (wtItem = { wtId });
-            pEle[wtId].forEach((cEle) => {
-              let someRes = tHeard.some((findEle) => {
-                return findEle.label == cEle.alertText;
-              });
+            if (pEle[wtId].length>0) {
+                pEle[wtId].forEach((cEle) => {
+                    let someRes = tHeard.some((findEle) => {
+                        return findEle.label == cEle.alertText;
+                    });
 
-              if (!someRes) {
-                tHeard.push({
-                  label: cEle.alertText,
-                  code: cEle.alarmid,
+                    if (!someRes) {
+                        tHeard.push({
+                        label: cEle.alertText,
+                        code: cEle.alarmid,
+                        });
+                    }
+                    wtItem[`${cEle.alarmid}_count`] = cEle.count;
+                    wtItem[`${cEle.alarmid}_time`] = cEle.time;
+                    wtItem["wtname"] = cEle.windturbineCode
                 });
-              }
-              wtItem[`${cEle.alarmid}_count`] = cEle.count;
-              wtItem[`${cEle.alarmid}_time`] = cEle.time;
-              wtItem["wtname"] = cEle.windturbineCode;
-            });
+            } else {
+                wtItem["wtname"] = windName.value[index]
+            }
+            if (query.page === 1) {
+                windName.value.push(wtItem["wtname"])
+            }
             tableData.push(wtItem);
           }
         });