Преглед изворни кода

虚警抑制、故障诊断状态、问答联调、判故逻辑增加持续时间

Rmengdi пре 3 месеци
родитељ
комит
537d0df7da

+ 14 - 11
src/views/als/falseAlarm/index.vue

@@ -109,13 +109,16 @@ export default {
           label: '架次号'
         },
         {
-          prop: 'status',
+          prop: 'dataStatus',
           label: '状态',
+          // 1 未处理,2  已处理
           render: (h, params) => {
-            if (params.row.status == '4') {
+            if (params.row.dataStatus == '1') {
+              return h('span', '未处理')
+            } else if (params.row.dataStatus == '2') {
               return h('span', { class: 'success-state' }, '已处理')
             } else {
-              return h('span', { class: 'warning-state' }, '未处理')
+              return h('span', { class: 'warning-state' }, '异常')
             }
           }
         },
@@ -132,8 +135,8 @@ export default {
             {
               name: '虚警判断',
               type: 'text',
-              statusKey: 'status',
-              disableKey: '4',
+              statusKey: 'dataStatus',
+              disableKey: '2',
               round: false,
               plain: false,
               onClick: (row, index, scope) => {
@@ -143,8 +146,8 @@ export default {
             {
               name: '查看',
               type: 'text',
-              statusKey: 'status',
-              unDisableKey: '4',
+              statusKey: 'dataStatus',
+              unDisableKey: '2',
               round: false,
               plain: false,
               onClick: (row, index, scope) => {
@@ -254,7 +257,7 @@ export default {
         sortieNo: '',
         aircraftId: '',
         ossId: '',
-        status: '',
+        dataStatus: '',
         flightDate: ''
       },
       isFalseAlarm: '0',
@@ -355,7 +358,7 @@ export default {
         sortieNo: '',
         aircraftId: '',
         ossId: '',
-        status: '',
+        dataStatus: '',
         flightDate: ''
       }
     },
@@ -373,7 +376,7 @@ export default {
     },
 
     submit() {
-      this.form.status = this.isFalseAlarm
+      this.form.dataStatus = this.isFalseAlarm
       this.updateWarningAPI()
     },
 
@@ -424,7 +427,7 @@ export default {
     },
 
     async checkCurve(row) {
-      this.isFalseAlarm = row.status
+      this.isFalseAlarm = row.dataStatus
       this.form = deepClone(row)
       try {
         const { code, data } = await getCurveData(row.code, row.sortieNo)

+ 28 - 20
src/views/als/faultDiagnosis/index.vue

@@ -104,17 +104,20 @@ export default {
             }
           }
         },
-        // {
-        //   prop: 'status',
-        //   label: '状态',
-        //   render: (h, params) => {
-        //     if (params.row.status == '1') {
-        //       return h('span', { class: 'success-state' }, '已处理')
-        //     } else {
-        //       return h('span', { class: 'warning-state' }, '未处理')
-        //     }
-        //   }
-        // },
+        {
+          prop: 'status',
+          label: '状态',
+          // 1 未处理,2  已处理
+          render: (h, params) => {
+            if (params.row.status == '1') {
+              return h('span', '未处理')
+            } else if (params.row.status == '2') {
+              return h('span', { class: 'success-state' }, '已处理')
+            } else {
+              return h('span', { class: 'warning-state' }, '异常')
+            }
+          }
+        },
         {
           button: true,
           label: '操作',
@@ -123,6 +126,8 @@ export default {
             {
               name: '故障诊断',
               type: 'text',
+              statusKey: 'status',
+              disableKey: '2',
               round: false,
               plain: false,
               onClick: (row, index, scope) => {
@@ -132,6 +137,8 @@ export default {
             {
               name: '查看',
               type: 'text',
+              statusKey: 'status',
+              unDisableKey: '2',
               round: false,
               plain: false,
               onClick: (row, index, scope) => {
@@ -165,15 +172,15 @@ export default {
         },
         {
           prop: 'param',
-          label: '部件'
-          // render: (h, params) => {
-          //   const matchedItem = this.allAirConfig.find((item) => params.row.param === item.id)
-          //   if (matchedItem) {
-          //     return h('span', matchedItem.name)
-          //   } else {
-          //     return h('span', {}, '')
-          //   }
-          // }
+          label: '部件',
+          render: (h, params) => {
+            const matchedItem = this.allAirConfig.find((item) => params.row.param === item.id)
+            if (matchedItem) {
+              return h('span', matchedItem.name)
+            } else {
+              return h('span', {}, '')
+            }
+          }
         },
         {
           prop: 'remarks',
@@ -453,6 +460,7 @@ export default {
           // this.resultShowVisible = true
           this.resultVisible = true
           this.getFaultDiagnosisResultAPI({ sortieNo: this.currentSortieNo })
+          this.getDataImportAPI({ aircraftId: this.aircaftModelIdList })
           this.handleClose()
         }
       } catch (error) {

+ 6 - 4
src/views/als/flightData/index.vue

@@ -222,8 +222,7 @@ export default {
         source: '1',
         aircraftId: '',
         sortieNo: '',
-        flightDate: '',
-        status: ''
+        flightDate: ''
       },
       debounceFn: debounce(this.fetch, 500),
       aircaftCatalogAll: [],
@@ -337,6 +336,8 @@ export default {
           })
           this.uploadFlag = true
           this.handleClose()
+          this.handleFileSuccess()
+          this.warnFileList = []
           this.getDataImportAPI({ aircraftId: this.aircaftModelIdList })
           this.submitBtnLoading = false
         }
@@ -355,6 +356,8 @@ export default {
           })
           this.handleClose()
           this.submitBtnLoading = false
+          this.handleFileSuccess()
+          this.warnFileList = []
           this.getDataImportAPI({ aircraftId: this.aircaftModelIdList })
         }
       } catch (error) {
@@ -430,8 +433,7 @@ export default {
         source: '1',
         sortieNo: '',
         aircraftId: '',
-        flightDate: '',
-        status: ''
+        flightDate: ''
       }
     },
 

+ 5 - 0
src/views/als/intelligentQA/index.scss

@@ -35,6 +35,11 @@
       line-height: 40px;
       overflow: hidden;
 
+      .question{
+        float: left;
+        width: 73%;
+      }
+
       .historyMore{
         font-size: 1.2rem;
         float: right;

+ 19 - 16
src/views/als/intelligentQA/index.vue

@@ -4,7 +4,7 @@
       <div class="historyTitle">历史记录</div>
       <div class="historyContent">
         <div v-for="item in historyData" :key="item.id" class="historyItem">
-          <span style="float: left"> {{ item.question }}</span>
+          <span class="question"> {{ item.question }}</span>
           <i class="el-icon-delete historyMore" style="margin-left: 10px" @click="deleteHistory(item.id)"></i>
           <i class="el-icon-more historyMore" @click="historyDetail(item.id)"></i>
           <!-- <el-tooltip class="item" effect="dark" content="详情" placement="top">
@@ -26,7 +26,7 @@
                 <div class="answer">{{ item.answer }}</div>
                 <!-- <div class="graph"></div> -->
                 <graphECharts v-if="item.graph" :graphData="item.graph" class="charts"></graphECharts>
-                <i v-if="(item.user_id && item.ossID) || (item.userId && item.ossId)" class="el-icon-more more" @click="handleMore(item)"></i>
+                <i v-if="item.userId && item.ossId" class="el-icon-more more" @click="handleMore(item)"></i>
               </div>
             </div>
           </div>
@@ -60,7 +60,7 @@
             <div class="source">
               <el-link :href="`${fileInfo.url}`" style="color: #209cc1" :underline="false" target="_blank">
                 <el-tooltip class="item" effect="dark" content="点击可下载" placement="top">
-                  <span> 来源:《{{ moreData.file_name }}{{ moreData.fileName }}》</span>
+                  <span> 来源:《{{ moreData.fileName }}》</span>
                 </el-tooltip>
               </el-link>
             </div>
@@ -70,9 +70,9 @@
               </div>
               <div v-if="fileInfo.fileSuffix == '.pdf'">
                 <!-- <VueOfficePdf style="width: 100%; height: calc(100vh - 400px)" :src="fileInfo.url" /> -->
-                <pdfvuer :src="fileInfo.url" class="pdf" :page="filePage"> </pdfvuer>
+                <pdfvuer :src="fileInfo.url" class="pdf" :page="moreData.filePage"> </pdfvuer>
               </div>
-              <el-pagination style="margin-top: 5px" v-if="fileInfo.fileSuffix == '.pdf'" background small layout="prev, pager, next" :current-page="filePage" :page-count="fileTotalPage" @current-change="handleIndexChange"> </el-pagination>
+              <el-pagination style="margin-top: 5px" v-if="fileInfo.fileSuffix == '.pdf'" background small layout="prev, pager, next" :current-page="moreData.filePage" :page-count="fileTotalPage" @current-change="handleIndexChange"> </el-pagination>
             </div>
           </div>
         </div>
@@ -112,17 +112,18 @@ export default {
       lastScrollHeight: 0,
       isScrollable: false,
       moreData: {
-        user_id: '',
+        userId: '',
         answer: '',
-        file_name: '',
-        ossID: null,
+        fileName: '',
+        ossId: null,
+        filePage: null,
         graph: {}
       },
       historyData: [],
       fileInfo: {},
       statisticsData: [],
       // TODO 问答给数据后将该字段替换
-      filePage: 2,
+      filePage: '2',
       fileTotalPage: null
     }
   },
@@ -231,6 +232,7 @@ export default {
 
         if (code == 200) {
           const newData = this.handleData(JSON.parse(data))
+          console.log('newData', newData)
           // const newData = this.handleData(data)
           this.chatInfo.pop()
           this.chatInfo.push(newData)
@@ -263,26 +265,27 @@ export default {
     },
 
     handleMore(data) {
-      this.getListById(data.ossID)
+      this.getListById(data.ossId)
       this.moreData = data
+      console.log('this.moreData', this.moreData)
       this.dialogVisible = true
     },
 
     async getListById(id) {
-      // const { data } = await getListByIdsApi(id)
+      const { data } = await getListByIdsApi(id)
       // pdf测试:250091300051144704,word测试:250122767632355328
-      const { data } = await getListByIdsApi('250122767632355328')
+      // const { data } = await getListByIdsApi('254798739581349888')
       this.fileInfo = data[0]
-      if (this.fileInfo.fileSuffix == '.pdf') {
+      if (this.fileInfo?.fileSuffix == '.pdf') {
         pdfvuer
-          .createLoadingTask(this.fileInfo.url)
+          .createLoadingTask(this.fileInfo?.url)
           .then((pdf) => {
             this.fileTotalPage = pdf.numPages
           })
           .catch((err) => {
             console.error('PDF 加载失败:', err)
           })
-      } else if (this.fileInfo.fileSuffix == '.docx' || this.fileInfo.fileSuffix == '.doc') {
+      } else if (this.fileInfo?.fileSuffix == '.docx' || this.fileInfo?.fileSuffix == '.doc') {
         // this.$nextTick(() => {
         //   console.log('this.$refs.docxShow', this.$refs.docxShow)
         //   console.log('this.$refs.docxShow.children', this.$refs.docxShow.children)
@@ -332,7 +335,7 @@ export default {
 
     // currentPage 改变时触发事件
     handleIndexChange(current) {
-      this.filePage = current
+      this.moreData.filePage = current
       // this.fetch()
     }
 

+ 86 - 12
src/views/als/judgeFaultLogic/index.vue

@@ -53,7 +53,7 @@
       </div>
       <!-- 添加或修改判故逻辑对话框 -->
       <el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="60%" :before-close="handleClose">
-        <el-form ref="form" :model="form" :rules="rules" label-width="80px">
+        <el-form ref="formRef" :model="form" :rules="rules" label-width="80px">
           <el-form-item label="机型" prop="model">
             <el-select disabled v-model="form.model" placeholder="请选择机型">
               <el-option v-for="item in aircaftModelAll" :key="item.aircaftModelId" :label="item.aircaftModelName" :value="item.aircaftModelId"> </el-option>
@@ -96,7 +96,36 @@
               <el-button @click="addSymbol(item)" type="primary" v-for="(item, index) in operatorList" :key="index">{{ item }}</el-button>
             </el-form-item>
           </el-col>
+          <el-col :span="24">
+            <el-form-item label="持续判据">
+              <el-button @click="innerVisible = true" type="primary">增加持续判据</el-button>
+            </el-form-item>
+          </el-col>
         </el-form>
+        <el-dialog width="30%" title="增加持续判据" :visible.sync="innerVisible" :before-close="sustainClose" append-to-body>
+          <el-form ref="sustainDataFormRef" :model="sustainDataForm" :rules="sustainRules" label-width="80px">
+            <el-form-item label="参数">
+              <el-select v-model="sustainDataForm.params" placeholder="请选择参数">
+                <el-option v-for="item in paramsList" :key="item" :label="item" :value="item"> </el-option>
+              </el-select>
+            </el-form-item>
+            <el-form-item label="符号">
+              <el-select v-model="sustainDataForm.symbol" placeholder="请选择符号">
+                <el-option v-for="(item, index) in symbolList" :key="index" :label="item" :value="item"> </el-option>
+              </el-select>
+            </el-form-item>
+            <el-form-item label="数值">
+              <el-input v-model="sustainDataForm.number" placeholder="请输入数值" />
+            </el-form-item>
+            <el-form-item label-width="100px" label="持续时间(s)">
+              <el-input-number v-model="sustainDataForm.sustainTime" :min="0" :precision="1" :step="0.5" placeholder="请输入持续时间(s)"></el-input-number>
+            </el-form-item>
+          </el-form>
+          <span slot="footer" class="dialog-footer">
+            <el-button @click="sustainClose">取 消</el-button>
+            <el-button type="primary" @click="submitSustainData">确 定</el-button>
+          </span>
+        </el-dialog>
         <span slot="footer" class="dialog-footer">
           <el-button @click="handleClose">取 消</el-button>
           <el-button type="primary" @click="submit">确 定</el-button>
@@ -123,6 +152,7 @@ export default {
     return {
       dialogTitle: '新增',
       dialogVisible: false,
+      innerVisible: false,
       keyWordData: '',
       aircaftModelIdList: [],
       currentNodeKey: '',
@@ -177,11 +207,25 @@ export default {
         hmcCode: [{ required: true, message: 'HMC码不能为空', trigger: 'blur' }],
         name: [{ required: true, message: '判据名称不能为空', trigger: 'blur' }]
       },
+      sustainRules: {
+        params: [{ required: true, message: '参数不能为空', trigger: 'change' }],
+        symbol: [{ required: true, message: '符号不能为空', trigger: 'change' }],
+        number: [{ required: true, message: '数值不能为空', trigger: 'blur' }],
+        sustainTime: [{ required: true, message: '持续时间不能为空', trigger: 'blur' }]
+      },
       aircaftModelAll: [],
       allAirConfig: [],
       operatorList: ['+', '-', '*', '/', '>', '<', '≥', '≤', '(', ')', '&&', '||', '==', '≠', '删除', '清空'],
       numberList: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '.'],
-      paramsList: []
+      paramsList: [],
+      symbolList: ['>', '<', '≥', '≤', '≠', '=='],
+      // 持续时间内容
+      sustainDataForm: {
+        params: '',
+        symbol: '',
+        number: '',
+        sustainTime: ''
+      }
     }
   },
   mounted() {
@@ -203,7 +247,6 @@ export default {
     },
 
     async removeJudgeFaultLogicAPI(params) {
-      console.log('params', params)
       try {
         const { code } = await removeJudgeFaultLogic(params)
         if (code === 200) {
@@ -314,13 +357,11 @@ export default {
     },
 
     submit() {
-      this.$refs['form'].validate((valid) => {
+      this.$refs['formRef'].validate((valid) => {
         if (valid) {
           let c = this.form.remarks.slice(2, this.form.remarks.length - 2).split(' ')
-          console.log('c', c)
           let newFormula = c.map((item) => (item === '\\&\\&' ? '&&' : item))
           this.form.remarks = newFormula.join(' ')
-          console.log('this.form', this.form)
           switch (this.dialogTitle) {
             case '编辑':
               this.updateJudgeFaultLogicAPI()
@@ -409,17 +450,27 @@ export default {
       let formula = deepClone(this.form.remarks)
       // 先拿到当前的字符 去除前后 $$ 符号 以空格分隔
       let c = formula.slice(2, formula.length - 2).split(' ')
-      if (number == '.' && !this.numberList.find((i) => i == c[c.length - 1])) {
+      const lastData = c[c.length - 1]
+      const lastIsNumber = this.numberList.find((i) => i == lastData.charAt(lastData.length - 1))
+      if (number == '.' && !lastIsNumber) {
         useMessage('error', '小数点前必须为数字')
         return
       }
-      if (this.paramsList.find((i) => i == c[c.length - 1])) {
+      if (this.paramsList.find((i) => i == lastData)) {
         useMessage('error', '参数和数字不能相邻')
         return
       } else {
-        c.push(number)
-        const str = c.join(' ')
-        this.form.remarks = `$$${str}$$`
+        // 判断最后一位是不是数字
+        if (lastIsNumber) {
+          const newLastData = lastData + number
+          c[c.length - 1] = newLastData
+          const str = c.join(' ')
+          this.form.remarks = `$$${str}$$`
+        } else {
+          c.push(number)
+          const str = c.join(' ')
+          this.form.remarks = `$$${str}$$`
+        }
       }
     },
 
@@ -485,8 +536,31 @@ export default {
         }
       })
       const str = newFormula.join(' ')
-      console.log('str', `$$${str}$$`)
       return `$$${str}$$`
+    },
+
+    // 增加判据
+    submitSustainData() {
+      this.$refs['sustainDataFormRef'].validate((valid) => {
+        if (valid) {
+          const number = Number(this.sustainDataForm.number)
+          const sustainTime = Number(this.sustainDataForm.sustainTime)
+          const formula = this.form.remarks.slice(2, this.form.remarks.length - 2)
+          const newFormula = formula + ` \\&\\&checkVibrationDuration(${this.sustainDataForm.params},'${this.sustainDataForm.symbol}',${number},${sustainTime},时间)`
+          this.form.remarks = `$$${newFormula}$$`
+          this.sustainClose()
+        }
+      })
+    },
+
+    sustainClose() {
+      this.innerVisible = false
+      this.sustainDataForm = {
+        params: '',
+        symbol: '',
+        number: '',
+        sustainTime: ''
+      }
     }
   }
 }