From 3a85b05333efc11fdec69b3e67ac0191b2952bad Mon Sep 17 00:00:00 2001
From: wangtao <1q2w3e4r>
Date: Tue, 26 Jul 2022 15:53:48 +0800
Subject: [PATCH] 修改为Vuex编写接口

---
 hg-monitor-web-base/src/main/resources/static/vue3/src/api/faultDiagnosisApi.js                           |  7 ++++++-
 hg-monitor-web-base/src/main/resources/static/vue3/src/store/modules/faultDiagnosisModule.js              |  3 +++
 hg-monitor-web-zj/src/main/resources/static/vue3/src/views/faultDiagnosis/components/diagnosis/index.html | 57 +++++++++++++++++++++++++++++++++------------------------
 hg-monitor-web-zj/src/main/resources/static/vue3/src/views/faultDiagnosis/components/diagnosis/index.js   | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------
 4 files changed, 106 insertions(+), 37 deletions(-)

diff --git a/hg-monitor-web-base/src/main/resources/static/vue3/src/api/faultDiagnosisApi.js b/hg-monitor-web-base/src/main/resources/static/vue3/src/api/faultDiagnosisApi.js
index 795dc95..cf0d538 100644
--- a/hg-monitor-web-base/src/main/resources/static/vue3/src/api/faultDiagnosisApi.js
+++ b/hg-monitor-web-base/src/main/resources/static/vue3/src/api/faultDiagnosisApi.js
@@ -11,7 +11,12 @@ let getRuleAdvanced = (ruleId) => {
     return get('/api-web/fault/conf/rule/getRuleAdvanced', {ruleId: ruleId});
 }
 
+let getFaultList = (params) => {
+    return get('/api-web/fault/result/tableList', params);
+}
+
 
 export default {
-    getRuleAdvanced
+    getRuleAdvanced,
+    getFaultList
 }
diff --git a/hg-monitor-web-base/src/main/resources/static/vue3/src/store/modules/faultDiagnosisModule.js b/hg-monitor-web-base/src/main/resources/static/vue3/src/store/modules/faultDiagnosisModule.js
index a92caf9..d1061ae 100644
--- a/hg-monitor-web-base/src/main/resources/static/vue3/src/store/modules/faultDiagnosisModule.js
+++ b/hg-monitor-web-base/src/main/resources/static/vue3/src/store/modules/faultDiagnosisModule.js
@@ -13,6 +13,9 @@ export default {
     actions: {
         getRuleAdvanced(context, ruleId) {
             return faultDiagnosisApi.getRuleAdvanced(ruleId);
+        },
+        getFaultList(context, params) {
+            return faultDiagnosisApi.getFaultList(params);
         }
     }
 };
diff --git a/hg-monitor-web-zj/src/main/resources/static/vue3/src/views/faultDiagnosis/components/diagnosis/index.html b/hg-monitor-web-zj/src/main/resources/static/vue3/src/views/faultDiagnosis/components/diagnosis/index.html
index 6b03eb5..392467d 100644
--- a/hg-monitor-web-zj/src/main/resources/static/vue3/src/views/faultDiagnosis/components/diagnosis/index.html
+++ b/hg-monitor-web-zj/src/main/resources/static/vue3/src/views/faultDiagnosis/components/diagnosis/index.html
@@ -63,7 +63,6 @@
 
                     <img src="./src/assets/images/faultDiagnosis/icon-gzdy.png" class="title-img">
                     <span>故障定义</span>
-
                 </div>
             </el-col>
         </el-row>
@@ -104,31 +103,41 @@
                         </div>
                     </el-col>
                 </el-row>
-                <el-row >
-                    <el-col :span="24" >
-
-                        <cm-table-page :columns="data.columns"
-                                       :dataList="data.tableData"
-                                       :total="data.count"
-                                       :pageSize="data.searchParams.limit"
-                                       @loaddata="loadTableDataList"
-                                       @selectionChange="selectionChange"
-                                       :showIndex="true"
-                                       :showSelection="true"
-                                       :showBorder="true"
-                                       :loading="loading"
-                                       :showPage="true"
-                                       :showTools="false"
-                                       :getRowKeys="'busId'"
-                                       :defaultExpand="true"
-                                       :height="(height - 200)">
-                            <template #default="{row,prop,column}">
-                            </template>
-                        </cm-table-page>
-                    </el-col>
-                </el-row>
             </el-col>
+        </el-row>
+        <el-row>
+            <el-col :span="6">
+                <div class="title-text">
+                    <i class="iconfont icon-liebiao"></i>
+                    <span>高级规则</span>
+                </div>
+            </el-col>
+        </el-row>
+        <el-row>
+            <el-col :span="6">
 
+            </el-col>
+        </el-row>
+        <el-row >
+            <el-col :span="24" >
+                <cm-table-page :columns="durationTimeObj.data.columns"
+                               :dataList="durationTimeObj.data.list"
+                               :total="durationTimeObj.data.total"
+                               @loaddata="loadTableDataList"
+                               @selectionChange="selectionChange"
+                               :showIndex="true"
+                               :showSelection="true"
+                               :showBorder="true"
+                               :loading="loading"
+                               :showPage="false"
+                               :showTools="false"
+                               :getRowKeys="'busId'"
+                               :defaultExpand="true"
+                               :height="400">
+                    <template #default="{row,prop,column}">
+                    </template>
+                </cm-table-page>
+            </el-col>
         </el-row>
         <!--<el-row>
             <el-col :span="3">
diff --git a/hg-monitor-web-zj/src/main/resources/static/vue3/src/views/faultDiagnosis/components/diagnosis/index.js b/hg-monitor-web-zj/src/main/resources/static/vue3/src/views/faultDiagnosis/components/diagnosis/index.js
index 349397e..d37c1ff 100644
--- a/hg-monitor-web-zj/src/main/resources/static/vue3/src/views/faultDiagnosis/components/diagnosis/index.js
+++ b/hg-monitor-web-zj/src/main/resources/static/vue3/src/views/faultDiagnosis/components/diagnosis/index.js
@@ -1,4 +1,3 @@
-
 import store from '/vue3/src/store/index.js'
 
 export default {
@@ -210,24 +209,79 @@ export default {
 
         // 2022-7-26 10.47 故障功能优化新增功能 --start
         let durationTimeObj = Vue.ref({
-            ruleId: '1aa9e18147e54f0bb8b24b7c96ad60ae', // 故障定义规则ID
-            startTime: '',
-            endTime: '',
-            status: '', //  状态0禁用1启用
+            params: {
+                ruleId: '1aa9e18147e54f0bb8b24b7c96ad60ae', // 故障定义规则ID
+                startTime: '',
+                endTime: '',
+                status: '', //  状态0禁用1启用
+            },
+            data: {
+                columns: [{
+                    prop: 'startTime',
+                    label: '开始时间',
+                    sortable: true,
+                    align: 'center',
+                    click: function (row) {
+
+                    },
+                    render: function (row) {
+                    }
+                }, {
+                    prop: 'endTime',
+                    label: '结束时间',
+                    sortable: true,
+                    align: 'center',
+                    click: function (row) {
+
+                    },
+                    render: function (row) {
+                    }
+                }, {
+                    prop: 'status',
+                    label: '状态',
+                    sortable: true,
+                    align: 'center',
+                    click: function (row) {
+
+                    },
+                    render: function (row) {
+                    }
+                }],
+                list: [],
+                total: 0
+            }
         });
 
         // 获取列表
-        store.dispatch('getRuleAdvanced',durationTimeObj.value.ruleId).then((res) =>{
-            //
+        const getRuleList = () => {
+            debugger
+            // store.dispatch('getFaultList', {}).then((res) => {
+            //     debugger
+            //     if (res && res.success) {
+            //         durationTimeObj.value.data.list = res.data;
+            //     }
+            // }).catch(e => {
+            //     debugger
+            //     console.log(e);
+            // })
+            store.dispatch('getRuleAdvanced', durationTimeObj.value.params.ruleId).then((res) => {
+                debugger
+                if (res && res.success) {
+                    durationTimeObj.value.data.list = res.data;
+                }
+            }).catch(e => {
+                console.log(e);
+            })
+        }
 
-        }).catch(e =>{
-            console.log(e);
+        Vue.onMounted(() => {
+            getRuleList();
         })
 
-
         // 2022-7-26 10.47 故障功能优化新增功能 --end
 
         return {
+            durationTimeObj,
             baseList,
             callbackBaseList,
             count,
@@ -739,8 +793,6 @@ export default {
         addAPM() {
             // this.APMVisible=true;
             this.postPropsData('apm')
-
-
         },
 
         //关闭APM弹框
--
libgit2 0.24.0