浏览代码

报警处理优化

wyh 1 年之前
父节点
当前提交
38e51f342e
共有 1 个文件被更改,包括 159 次插入119 次删除
  1. 159 119
      src/views/module_tpm/messageAlarm/MessageAlarmList.vue

+ 159 - 119
src/views/module_tpm/messageAlarm/MessageAlarmList.vue

@@ -4,7 +4,7 @@
     <div class="table-page-search-wrapper">
       <a-form layout="inline" @keyup.enter.native="searchQuery">
         <a-row :gutter="24">
-          <!-- <a-col :xl="10" :lg="7" :md="8" :sm="24">
+          <a-col :xl="10" :lg="7" :md="8" :sm="24">
             <a-form-item label="设备名称">
               <a-select
               v-model="queryParam.id"
@@ -19,33 +19,29 @@
               </a-select-option>
               </a-select>
             </a-form-item>
-          </a-col> -->
-          <!-- <template v-if="toggleSearchStatus">
+          </a-col>
+          <template v-if="toggleSearchStatus">
             <a-col :xl="6" :lg="7" :md="8" :sm="24">
-              <a-form-item label="规格型号">
-                <a-input placeholder="请输入规格型号" v-model="queryParam.spec"></a-input>
+              <a-form-item label="报警日期">
+                <j-date v-model="queryParam.alarmtime" placeholder="请选择报警日期" style="width:100%;"></j-date>
               </a-form-item>
             </a-col>
             <a-col :xl="6" :lg="7" :md="8" :sm="24">
-              <a-form-item label="安装地点">
-                <a-input placeholder="请输入安装地点" v-model="queryParam.address"></a-input>
+              <a-form-item label="报警等级">
+                <j-dict-select-tag v-model="queryParam.alarmlevel" placeholder="请选择报警等级" dictCode="alarm_level"/>
               </a-form-item>
             </a-col>
             <a-col :xl="6" :lg="7" :md="8" :sm="24">
-              <a-form-item label="区域">
-                <j-tree-select
-                  ref="treeSelect"
-                  placeholder="请选择区域"
-                  v-model="queryParam.spaceid"
-                  dict="base_space,name,id"
-                  pidField="parentid"
-                  pidValue="0"
-                  hasChildField="has_child"
-                  >
-                </j-tree-select>
+              <a-form-item label="报警类型">
+                <j-dict-select-tag v-model="queryParam.alarmtype" placeholder="请选择报警类型" dictCode="alarm_type"/>
               </a-form-item>
             </a-col>
-          </template> -->
+            <a-col :xl="6" :lg="7" :md="8" :sm="24">
+              <a-form-item label="处理状态">
+                <j-dict-select-tag v-model="queryParam.status" placeholder="请选择处理状态" dictCode="alarm_status"/>
+              </a-form-item>
+            </a-col>
+          </template>
           <a-col :xl="6" :lg="7" :md="8" :sm="24">
             <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
               <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
@@ -62,28 +58,28 @@
     <!-- 查询区域-END -->
 
     <!-- 操作按钮区域 -->
-    <div class="table-operator">
+    <!-- <div class="table-operator">
       <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
       <a-button type="primary" icon="download" @click="handleExportXls('tpm_message_alarm')">导出</a-button>
       <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
         <a-button type="primary" icon="import">导入</a-button>
-      </a-upload>
+      </a-upload> -->
       <!-- 高级查询区域 -->
-      <j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query>
+      <!-- <j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query>
       <a-dropdown v-if="selectedRowKeys.length > 0">
         <a-menu slot="overlay">
           <a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>
         </a-menu>
         <a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button>
       </a-dropdown>
-    </div>
+    </div> -->
 
     <!-- table区域-begin -->
     <div>
-      <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
+      <!-- <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
         <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
         <a style="margin-left: 24px" @click="onClearSelected">清空</a>
-      </div>
+      </div> -->
 
       <a-table
         ref="table"
@@ -95,7 +91,6 @@
         :dataSource="dataSource"
         :pagination="ipagination"
         :loading="loading"
-        :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
         class="j-table-force-nowrap"
         @change="handleTableChange">
 
@@ -120,9 +115,9 @@
         </template>
 
         <span slot="action" slot-scope="text, record">
-          <a @click="handleEdit(record)">编辑</a>
+          <a @click="handleEdit(record)">处理</a>
 
-          <a-divider type="vertical" />
+          <!-- <a-divider type="vertical" />
           <a-dropdown>
             <a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
             <a-menu slot="overlay">
@@ -135,7 +130,7 @@
                 </a-popconfirm>
               </a-menu-item>
             </a-menu>
-          </a-dropdown>
+          </a-dropdown> -->
         </span>
 
       </a-table>
@@ -150,6 +145,7 @@
   import '@/assets/less/TableExpand.less'
   import { mixinDevice } from '@/utils/mixin'
   import { JeecgListMixin } from '@/mixins/JeecgListMixin'
+  import { httpAction, getAction } from '@/api/manage'
   import MessageAlarmModal from './modules/MessageAlarmModal'
 
   export default {
@@ -174,48 +170,48 @@
             }
           },
           {
-            title:'备注',
-            align:"center",
-            dataIndex: 'remark'
-          },
-          {
-            title:'设备id',
+            title:'设备',
             align:"center",
             dataIndex: 'equipmentid'
           },
           {
-            title:'报警时间',
-            align:"center",
-            dataIndex: 'alarmtime',
-            customRender:function (text) {
-              return !text?"":(text.length>10?text.substr(0,10):text)
-            }
-          },
-          {
             title:'报警类型',
             align:"center",
             dataIndex: 'alarmtype'
           },
           {
-            title:'报警等级',
+            title:'报警描述',
             align:"center",
-            dataIndex: 'alarmlevel'
-          },
-          {
-            title:'消息码',
-            align:"center",
-            dataIndex: 'msgcode'
+            dataIndex: 'remark'
           },
           {
-            title:'参数编号',
+            title:'报警时间',
             align:"center",
-            dataIndex: 'paramcode'
+            dataIndex: 'alarmtime',
+            // customRender:function (text) {
+            //   return !text?"":(text.length>10?text.substr(0,10):text)
+            // }
           },
           {
-            title:'参数名称',
+            title:'报警等级',
             align:"center",
-            dataIndex: 'paramname'
+            dataIndex: 'alarmlevel'
           },
+          // {
+          //   title:'消息码',
+          //   align:"center",
+          //   dataIndex: 'msgcode'
+          // },
+          // {
+          //   title:'参数编号',
+          //   align:"center",
+          //   dataIndex: 'paramcode'
+          // },
+          // {
+          //   title:'参数名称',
+          //   align:"center",
+          //   dataIndex: 'paramname'
+          // },
           {
             title:'当前值',
             align:"center",
@@ -232,73 +228,73 @@
             dataIndex: 'vmax'
           },
           {
-            title:'状态',
+            title:'处理状态',
             align:"center",
             dataIndex: 'status'
           },
-          {
-            title:'处理日期',
-            align:"center",
-            dataIndex: 'handletime',
-            customRender:function (text) {
-              return !text?"":(text.length>10?text.substr(0,10):text)
-            }
-          },
-          {
-            title:'处理人',
-            align:"center",
-            dataIndex: 'handleuser'
-          },
-          {
-            title:'处理信息',
-            align:"center",
-            dataIndex: 'handleremark'
-          },
-          {
-            title:'图片地址',
-            align:"center",
-            dataIndex: 'url'
-          },
-          {
-            title:'距离(摄像头用)',
-            align:"center",
-            dataIndex: 'distance'
-          },
-          {
-            title:'方位(摄像头用)',
-            align:"center",
-            dataIndex: 'position'
-          },
-          {
-            title:'所属年',
-            align:"center",
-            dataIndex: 'year'
-          },
-          {
-            title:'所属月',
-            align:"center",
-            dataIndex: 'month'
-          },
-          {
-            title:'所属周',
-            align:"center",
-            dataIndex: 'week'
-          },
-          {
-            title:'日期',
-            align:"center",
-            dataIndex: 'day'
-          },
-          {
-            title:'周几',
-            align:"center",
-            dataIndex: 'dayofweek'
-          },
-          {
-            title:'所属年月',
-            align:"center",
-            dataIndex: 'yearmonth'
-          },
+          // {
+          //   title:'处理日期',
+          //   align:"center",
+          //   dataIndex: 'handletime',
+          //   customRender:function (text) {
+          //     return !text?"":(text.length>10?text.substr(0,10):text)
+          //   }
+          // },
+          // {
+          //   title:'处理人',
+          //   align:"center",
+          //   dataIndex: 'handleuser'
+          // },
+          // {
+          //   title:'处理信息',
+          //   align:"center",
+          //   dataIndex: 'handleremark'
+          // },
+          // {
+          //   title:'图片地址',
+          //   align:"center",
+          //   dataIndex: 'url'
+          // },
+          // {
+          //   title:'距离(摄像头用)',
+          //   align:"center",
+          //   dataIndex: 'distance'
+          // },
+          // {
+          //   title:'方位(摄像头用)',
+          //   align:"center",
+          //   dataIndex: 'position'
+          // },
+          // {
+          //   title:'所属年',
+          //   align:"center",
+          //   dataIndex: 'year'
+          // },
+          // {
+          //   title:'所属月',
+          //   align:"center",
+          //   dataIndex: 'month'
+          // },
+          // {
+          //   title:'所属周',
+          //   align:"center",
+          //   dataIndex: 'week'
+          // },
+          // {
+          //   title:'日期',
+          //   align:"center",
+          //   dataIndex: 'day'
+          // },
+          // {
+          //   title:'周几',
+          //   align:"center",
+          //   dataIndex: 'dayofweek'
+          // },
+          // {
+          //   title:'所属年月',
+          //   align:"center",
+          //   dataIndex: 'yearmonth'
+          // },
           {
             title: '操作',
             dataIndex: 'action',
@@ -318,10 +314,13 @@
         },
         dictOptions:{},
         superFieldList:[],
+        deviceOptions: [],
+        deviceOptionsAll: [],
       }
     },
     created() {
     this.getSuperFieldList();
+    this.getDeviceOption();
     },
     computed: {
       importExcelUrl: function(){
@@ -329,11 +328,52 @@
       },
     },
     methods: {
+      // 获取设备下拉列表
+      getDeviceOption(){
+        getAction(`/tpmEquipment/tpmEquipment/selectEquipmentList`).then(res=>{
+          console.log(111,res.result)
+          this.deviceOptions = res.result.map((res) => {
+            return {
+              id: res.id,
+              equipmentname: res.equipmentname,
+              equipmentcode: res.equipmentcode,
+            }
+          })
+          // 存一个完整的设备表
+          this.deviceOptionsAll = this.deviceOptions
+          // console.log(7878,this.deviceOptionsAll)
+        })
+      },
+      // 筛选设备
+      searchDevice(value) {
+        console.log(1212,value,value.trim().length)
+        // 若输入的值删除,则重新赋完整的设备列表
+        if (value.trim().length === 0) {
+          this.deviceOptions = this.deviceOptionsAll
+        }
+        // 通过判断字符串中是数字还是文字进而判断是通过设备名筛选还是设备编号筛选
+        let panDuan = isNaN(parseFloat(value))
+        if (!panDuan) {
+          // 数字
+          // console.log(777)
+          let filteredArray = this.deviceOptionsAll.filter(item => item.equipmentcode.includes(value));
+          this.deviceOptions = filteredArray
+        } else {
+          // console.log(888)
+          let filteredArray = this.deviceOptionsAll.filter(item => item.equipmentname.includes(value));
+          this.deviceOptions = filteredArray
+        }
+        // console.log(999,this.deviceOptions)
+      },
+      // 解决筛选后option不回显问题
+      filterOptions(input, option) {                    
+        return this.deviceOptions
+      },
       initDictConfig(){
       },
       getSuperFieldList(){
         let fieldList=[];
-        fieldList.push({type:'string',value:'remark',text:'备注'})
+        fieldList.push({type:'string',value:'remark',text:'报警描述'})
         fieldList.push({type:'string',value:'equipmentid',text:'设备id'})
         fieldList.push({type:'date',value:'alarmtime',text:'报警时间'})
         fieldList.push({type:'string',value:'alarmtype',text:'报警类型:0通讯状态,1现场报警,2设备故障,3消防报警,4环境报警,5安全报警'})