Sfoglia il codice sorgente

故障诊断、数据预处理结果

Rmengdi 7 mesi fa
parent
commit
ccf6201035

+ 35 - 25
src/views/als/components/Charts/playBackChart.vue

@@ -1,5 +1,5 @@
 <template>
-  <div :ref="chartRef" :style="{ height: height, width: width }"></div>
+  <div ref="preResultRef" :style="{ height: height, width: width }"></div>
 </template>
 
 <script>
@@ -7,10 +7,10 @@ import * as echarts from 'echarts'
 export default {
   name: 'PlayBackChart',
   props: {
-    chartRef: {
-      type: String,
-      required: true
-    },
+    // chartRef: {
+    //   type: String,
+    //   required: true
+    // },
     width: {
       type: String,
       default: '100%'
@@ -37,14 +37,15 @@ export default {
       chart: null
     }
   },
-  watch: {
-    chartData: {
-      deep: true,
-      handler(val) {
-        this.setOptions(val)
-      }
-    }
-  },
+  // watch: {
+  //   chartData: {
+  //     deep: true,
+  //     handler(val) {
+  //       this.initChart()
+  //       this.setOptions(val)
+  //     }
+  //   }
+  // },
   mounted() {
     this.$nextTick(() => {
       this.initChart()
@@ -60,12 +61,12 @@ export default {
   computed: {},
   methods: {
     initChart() {
-      if (!this.chart) {
-        return
+      if (this.chart) {
+        this.chart.dispose()
+        this.chart = null
       }
-      this.chart.dispose()
-      this.chart = null
-      this.chart = echarts.init(this.$refs.chartRef)
+      // console.log('66', this.chartRef)
+      this.chart = echarts.init(this.$refs.preResultRef)
       this.setOptions(this.chartData)
     },
     setOptions({ title, legendData, xAxisData, yAxisData, seriesData } = {}) {
@@ -77,23 +78,32 @@ export default {
           trigger: 'axis'
         },
         legend: {
-          data: legendData,
+          // data: legendData,
           textStyle: {
             //图例文字的样式
             color: '#fff'
           }
         },
-        color: color,
         xAxis: {
           type: 'category',
-          data: xAxisData,
-          name: 'Index'
+          data: xAxisData
         },
         yAxis: {
-          type: 'value',
-          name: 'Value',
-          data: yAxisData
+          type: 'value'
+          // data: yAxisData
         },
+        dataZoom: [
+          {
+            type: 'slider',
+            start: 0,
+            end: 100
+          },
+          {
+            type: 'inside',
+            start: 0,
+            end: 100
+          }
+        ],
         // series: series
         series: seriesData
       })

+ 4 - 2
src/views/als/falseAlarm/index.vue

@@ -480,6 +480,8 @@ export default {
 
     handleClose() {
       this.dialogVisible = false
+      this.transferRightData = []
+      this.$refs.sortieNoTableRef.clearSelection()
       this.executeForm = {
         modelId: '',
         modelType: '',
@@ -583,10 +585,10 @@ export default {
     async changeAircraftId(aircraftId) {
       try {
         const {
-          data: { list, totalCount }
+          data: { list, total }
         } = await getDataImport({ aircraftId })
         this.sortieNoList = list
-        this.SortieNoTableRequset.total = totalCount
+        this.SortieNoTableRequset.total = total
       } catch (error) {}
     },
 

+ 99 - 46
src/views/als/faultDiagnosis/index.vue

@@ -68,8 +68,8 @@
       <el-dialog title="执行进度" :visible.sync="progressVisible" width="800px" :before-close="handleClose">
         <el-progress :text-inside="true" :stroke-width="24" :percentage="percentage" status="success"></el-progress>
       </el-dialog>
-      <el-dialog title="结果展示" :visible.sync="resultVisible" width="800px">
-        展示结果
+      <el-dialog title="结果展示" :visible.sync="resultVisible" width="1200px">
+        <LTable ref="resultTableRef" :columns="resultColumns" :dataSource="resultTableData" :options="resultOptions"></LTable>
         <span slot="footer" class="dialog-footer">
           <el-button @click="resultVisible = false">取 消</el-button>
           <el-button type="primary" @click="resultVisible = false">确 定</el-button>
@@ -118,7 +118,6 @@ export default {
       },
       searchValue: '',
       columns: [
-        { prop: 'id', label: '编号' },
         {
           prop: 'sortieNo',
           label: '架次号'
@@ -137,7 +136,15 @@ export default {
         },
         {
           prop: 'modelType',
-          label: '模型类型'
+          label: '模型类型',
+          render: (h, params) => {
+            const matchedItem = this.$enumData.agloModelList.find((item) => params.row.modelType === item.key)
+            if (matchedItem) {
+              return h('span', matchedItem.name)
+            } else {
+              return h('span', {}, '')
+            }
+          }
         },
         {
           prop: 'param',
@@ -151,25 +158,20 @@ export default {
         //   prop: 'ossId',
         //   label: '文件Id'
         // },
-        {
-          prop: 'resultContent',
-          label: '结果'
-        },
+        // {
+        //   prop: 'result',
+        //   label: '结果'
+        // },
         {
           prop: 'status',
-          label: '状态'
-        },
-        {
-          prop: 'modelType1',
-          label: '模型类型'
-        },
-        {
-          prop: 'param1',
-          label: '参数'
-        },
-        {
-          prop: 'columnData1',
-          label: '数据列'
+          label: '状态',
+          render: (h, params) => {
+            if (params.row.status == 0) {
+              return h('span', { class: 'warning-state' }, '失败')
+            } else {
+              return h('span', { class: 'success-state' }, '成功')
+            }
+          }
         },
         {
           button: true,
@@ -185,15 +187,6 @@ export default {
                 this.checkResultList(row)
               }
             },
-            {
-              name: '执行',
-              type: 'text',
-              round: false,
-              plain: false,
-              onClick: (row, index, scope) => {
-                this.executeAglo(row)
-              }
-            },
             {
               name: '删除',
               type: 'text',
@@ -206,6 +199,40 @@ export default {
           ]
         }
       ],
+      resultColumns: [
+        {
+          prop: 'sortieNo',
+          label: '架次号'
+        },
+        {
+          prop: 'aircraftId',
+          label: '编目',
+          render: (h, params) => {
+            const matchedItem = this.aircaftCatalogAll.find((item) => params.row.aircraftId.trim() === item.aircaftCatalogId.trim())
+            if (matchedItem) {
+              return h('span', matchedItem.aircaftCatalogCode)
+            } else {
+              return h('span', {}, '')
+            }
+          }
+        },
+        {
+          prop: 'modelType',
+          label: '模型类型',
+          render: (h, params) => {
+            const matchedItem = this.$enumData.agloModelList.find((item) => params.row.modelType === item.key)
+            if (matchedItem) {
+              return h('span', matchedItem.name)
+            } else {
+              return h('span', {}, '')
+            }
+          }
+        },
+        {
+          prop: 'resultContent',
+          label: '结果'
+        }
+      ],
       sortieNoColumns: [
         {
           prop: 'sortieNo',
@@ -238,6 +265,15 @@ export default {
         border: true,
         height: '250px'
       },
+      resultOptions: {
+        stripe: true,
+        mutiSelect: false,
+        index: false,
+        loading: false,
+        initTable: false,
+        border: true,
+        height: '300px'
+      },
       SortieNoTableRequset: {
         total: 0,
         pageIndex: 1,
@@ -246,6 +282,7 @@ export default {
       },
       tableCheckItems: [],
       tableData: [],
+      resultTableData: [],
       tableRequset: {
         total: 0,
         pageIndex: 1,
@@ -346,6 +383,7 @@ export default {
           }
         })
       }
+
       getLeaf(list, newArr)
       return newArr
     },
@@ -417,6 +455,8 @@ export default {
 
     handleClose() {
       this.dialogVisible = false
+      this.transferRightData = []
+      this.$refs.sortieNoTableRef.clearSelection()
       this.executeForm = {
         sortieNo: '',
         aircraftId: '',
@@ -464,16 +504,19 @@ export default {
     },
 
     checkResultList(row) {
-      this.form = deepClone(row)
+      if (row.status === '0') {
+        this.$message({
+          type: 'warning',
+          message: '执行失败,无法查看结果!'
+        })
+        return
+      }
+      this.resultTableData = [row]
       this.resultVisible = true
     },
-    executeAglo(row) {
-      // this.executeVisible = true
-      // this.agloForm.sortieNo = row.sortieNo
-      // this.agloForm.aircraftId = row.aircraftId
-    },
     async beginExecute() {
       this.progressVisible = true
+      this.percentage += 1
       try {
         const res = await executeFault(this.executeForm)
         this.percentage += 1
@@ -487,6 +530,10 @@ export default {
               type: 'success',
               message: '执行成功!'
             })
+            const result = res.data
+            this.$alert(`故障诊断结果为:${result}`, '故障诊断结果', {
+              confirmButtonText: '确定'
+            })
             this.getFaultDiagnosisAPI({ aircraftId: this.aircaftModelIdList })
           } else {
             this.percentage += 1
@@ -510,9 +557,10 @@ export default {
     async changeAircraftId(aircraftId) {
       try {
         const {
-          data: { list }
+          data: { list, total }
         } = await getDataImport({ aircraftId })
         this.sortieNoList = list
+        this.SortieNoTableRequset.total = total
       } catch (error) {}
     },
 
@@ -520,16 +568,21 @@ export default {
       this.executeForm.ossId = val.ossId
       this.executeForm.sortieNo = val.sortieNo
       if (val.ossId) {
-        const res = await getColumnDataAPI(val.ossId)
-        if (res.code === 200) {
-          this.transferData = []
-          res.data.forEach((item, index) => {
-            this.transferData.push({
-              key: index,
-              label: item
+        try {
+          const res = await getColumnDataAPI(val.ossId)
+          if (res.code === 200) {
+            this.transferData = []
+            res.data.forEach((item, index) => {
+              this.transferData.push({
+                key: index,
+                label: item
+              })
             })
-          })
-        }
+            if (this.executeForm.modelId) {
+              this.changeModelId(this.executeForm.modelId)
+            }
+          }
+        } catch (error) {}
       }
     },
 

+ 31 - 9
src/views/als/preProcessing/index.vue

@@ -69,8 +69,8 @@
       <el-dialog title="执行进度" :visible.sync="progressVisible" width="800px" :before-close="handleClose">
         <el-progress :text-inside="true" :stroke-width="24" :percentage="percentage" status="success"></el-progress>
       </el-dialog>
-      <el-dialog title="结果展示" :visible.sync="resultVisible" width="800px">
-        <PlayBackChart chartRef="preResultRef" :chartData="chartData" />
+      <el-dialog title="结果展示" :visible.sync="resultVisible" width="1200px">
+        <PlayBackChart :chartData="chartData" />
         <span slot="footer" class="dialog-footer">
           <el-button @click="resultVisible = false">取 消</el-button>
           <el-button type="primary" @click="resultVisible = false">确 定</el-button>
@@ -96,6 +96,7 @@ export default {
   data() {
     // 这里存放数据
     return {
+      preResultRef: 'preResultRef',
       dialogTitle: '新增',
       dialogVisible: false,
       progressVisible: false,
@@ -296,7 +297,13 @@ export default {
       modelList: [],
       percentage: 0,
       sortieNoList: [],
-      chartData: {}
+      chartData: {
+        title: '',
+        legendData: [],
+        xAxisData: [],
+        yAxisData: [],
+        seriesData: []
+      }
     }
   },
   watch: {
@@ -429,6 +436,8 @@ export default {
 
     handleClose() {
       this.dialogVisible = false
+      this.transferRightData = []
+      this.$refs.sortieNoTableRef.clearSelection()
       this.executeForm = {
         sortieNo: '',
         aircraftId: '',
@@ -487,9 +496,22 @@ export default {
       }
       try {
         const { data } = await getOssIdPlaybackDataAPI(row.ossId)
-        this.handleResultData(JSON.parse(data))
+        const { contentData, headData } = this.handleResultData(JSON.parse(data))
+        this.chartData.legendData = headData
+        for (var key in contentData) {
+          if (key === '时间') {
+            this.chartData.xAxisData = contentData['时间']
+          } else {
+            this.chartData.seriesData.push({
+              name: key,
+              type: 'line',
+              data: contentData[key],
+              connectNulls: true
+            })
+          }
+        }
+        this.resultVisible = true
       } catch (error) {}
-      this.resultVisible = true
     },
     handleResultData(resultData) {
       const headData = Object.keys(resultData[0])
@@ -503,9 +525,7 @@ export default {
           contentData[key].push(item[key])
         }
       })
-      console.log('contentData', contentData)
-      console.log('headData', headData)
-      // return { contentData, headData }
+      return { contentData, headData }
     },
     executeAglo(row) {
       // this.executeVisible = true
@@ -514,6 +534,7 @@ export default {
     },
     async beginExecute() {
       this.progressVisible = true
+      this.percentage += 1
       try {
         const res = await executePreProcessing(this.executeForm)
         this.percentage += 1
@@ -550,9 +571,10 @@ export default {
     async changeAircraftId(aircraftId) {
       try {
         const {
-          data: { list }
+          data: { list, total }
         } = await getDataImport({ aircraftId })
         this.sortieNoList = list
+        this.SortieNoTableRequset.total = total
       } catch (error) {}
     },