| | |
| | | <template> |
| | | <flex-layout> |
| | | <div class="table-layout filter-box-table" slot="header"> |
| | | <div class="table-row"> |
| | | <div class="table-cell text-right">维护区:</div> |
| | | <div class="table-cell"> |
| | | <el-select |
| | | v-model="selectValue1" |
| | | @change="changeSelect1" |
| | | :placeholder="this.selectPlace1" |
| | | class="weihu" |
| | | size="small" |
| | | > |
| | | <el-option |
| | | v-for="item in devss" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | ></el-option> |
| | | </el-select> |
| | | </div> |
| | | <div class="table-cell text-right">机房名称:</div> |
| | | <div class="table-cell"> |
| | | <el-select v-model="selectValue2" class="rooms" @change="alramData" size="small"> |
| | | <el-option |
| | | v-for="item in opt" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | ></el-option> |
| | | </el-select> |
| | | </div> |
| | | <div class="table-cell text-right">操作记录时间段:</div> |
| | | <div class="table-cell"> |
| | | <el-date-picker v-model="valueTime1" size="small" class="time_box" :picker-options="pickerOptions0" type="date" placeholder="选择日期" value-format="yyyy-MM-dd"> </el-date-picker> |
| | | 至 <el-date-picker v-model="valueTime2" size="small" class="time_box" :picker-options="pickerOptions1" type="date" placeholder="选择日期" value-format="yyyy-MM-dd"> </el-date-picker> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <!-- 表单 --> |
| | | <div class="flex-page-content"> |
| | | <el-table stripe size="small" :data="table.datas" height="100%" class="tableCent"> |
| | | <el-table-column |
| | | v-for="header in table.headers" |
| | | :key="header.prop" |
| | | :prop="header.prop" |
| | | :label="header.label" |
| | | :width="header.width" |
| | | align="center" |
| | | > |
| | | <template slot-scope="scope"> |
| | | <div> |
| | | <div v-if="header.prop == 'alm_type'"> |
| | | <span v-if="scope.row.alm_type == 119020">通信故障</span> |
| | | <span v-if="scope.row.alm_type == 618501">继电器K1告警</span> |
| | | <span v-if="scope.row.alm_type == 618502">通讯告警</span> |
| | | <span v-if="scope.row.alm_type == 618503">设备过温告警</span> |
| | | <span v-if="scope.row.alm_type == 618504">二极管D1告警</span> |
| | | <span v-if="scope.row.alm_type == 618505">干接点告警</span> |
| | | <span v-if="scope.row.alm_type == 618506">异常核容或养护终止告警</span> |
| | | <span v-if="scope.row.alm_type == 119023">续航不足告警</span> |
| | | <span v-if="scope.row.alm_type == 119024">基站停电告警</span> |
| | | <span v-if="scope.row.alm_type == 119025">基站发电告警</span> |
| | | <span v-if="scope.row.alm_type == 119026">基站掉站告警</span> |
| | | <span v-if="scope.row.alm_type == 119027">基站开门告警</span> |
| | | <span v-if="scope.row.alm_type == 119028">设备高温告警</span> |
| | | <span v-if="scope.row.alm_type == 119032">设备SD卡故障</span> |
| | | <span v-if="scope.row.alm_type == 119033">采集线告警</span> |
| | | </div> |
| | | <div v-else-if="header.prop == 'alm_level'"> |
| | | <span v-if="scope.row.alm_level == 1">一级告警</span> |
| | | <span v-if="scope.row.alm_level == 2">二级告警</span> |
| | | <span v-if="scope.row.alm_level == 3">三级告警</span> |
| | | <span v-if="scope.row.alm_level == 4">四级告警</span> |
| | | </div> |
| | | <div v-else-if="header.prop =='alm_is_confirmed'"> |
| | | <input type="checkbox" :checked='scope.row.alm_is_confirmed ===1?true:false' disabled> |
| | | </div> |
| | | <div v-else> |
| | | {{ scope.row[header.prop] }} |
| | | </div> |
| | | |
| | | <flex-layout> |
| | | <div class="table-layout filter-box-table" slot="header"> |
| | | <div class="table-row"> |
| | | <div class="table-cell text-right">维护区:</div> |
| | | <div class="table-cell"> |
| | | <el-select |
| | | v-model="selectValue1" |
| | | @change="changeSelect1" |
| | | :placeholder="this.selectPlace1" |
| | | class="weihu" |
| | | size="small" |
| | | > |
| | | <el-option |
| | | v-for="item in devss" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | ></el-option> |
| | | </el-select> |
| | | </div> |
| | | <div class="table-cell text-right">机房名称:</div> |
| | | <div class="table-cell"> |
| | | <el-select v-model="selectValue2" class="rooms" @change="alramData" size="small"> |
| | | <el-option |
| | | v-for="item in opt" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | ></el-option> |
| | | </el-select> |
| | | </div> |
| | | <div class="table-cell text-right">操作记录时间段:</div> |
| | | <div class="table-cell"> |
| | | <el-date-picker v-model="valueTime1" size="small" class="time_box" :picker-options="pickerOptions0" |
| | | type="date" placeholder="选择日期" value-format="yyyy-MM-dd"></el-date-picker> |
| | | 至 |
| | | <el-date-picker v-model="valueTime2" size="small" class="time_box" :picker-options="pickerOptions1" |
| | | type="date" placeholder="选择日期" value-format="yyyy-MM-dd"></el-date-picker> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="cztime" fixed="right" width="80px" align="center" label="操作"> |
| | | <template slot-scope="scope"> |
| | | <el-button type="danger" size="mini" @click="deleteUser(scope.row)">删除</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </div> |
| | | <!-- 底部分页 --> |
| | | <div class="flex-page-footer" slot="footer"> |
| | | <div class="el-pagination-btns"> |
| | | <el-button type="primary" @click="alramData" round size="mini" icon="el-icon-search">查询</el-button> |
| | | <el-button type="primary" round size="mini" icon="el-icon-wallet" @click="exportFile">导出</el-button> |
| | | </div> |
| | | <el-pagination |
| | | class="pagess" |
| | | @size-change="handleSizeChange" |
| | | @current-change="handleCurrentChange" |
| | | :current-page="queryInfo.pageCurr" |
| | | :page-sizes="[10, 20,30, 50,100]" |
| | | :page-size="queryInfo.pagesize" |
| | | layout="total, sizes, prev, pager, next, jumper" |
| | | :total="total" |
| | | ></el-pagination> |
| | | <!-- <el-button type="primary" round size="mini" icon="el-icon-wallet">全部选中</el-button> --> |
| | | </div> |
| | | </flex-layout> |
| | | </div> |
| | | <!-- 表单 --> |
| | | <div class="flex-page-content"> |
| | | <el-table stripe size="small" :data="table.datas" height="100%" class="tableCent"> |
| | | <el-table-column |
| | | v-for="header in table.headers" |
| | | :key="header.prop" |
| | | :prop="header.prop" |
| | | :label="header.label" |
| | | :width="header.width" |
| | | align="center" |
| | | > |
| | | <template slot-scope="scope"> |
| | | <div> |
| | | <div v-if="header.prop == 'alm_type'"> |
| | | <span v-if="scope.row.alm_type == 119020">通信故障</span> |
| | | <span v-if="scope.row.alm_type == 618501">继电器K1告警</span> |
| | | <span v-if="scope.row.alm_type == 618502">通讯告警</span> |
| | | <span v-if="scope.row.alm_type == 618503">设备过温告警</span> |
| | | <span v-if="scope.row.alm_type == 618504">二极管D1告警</span> |
| | | <span v-if="scope.row.alm_type == 618505">干接点告警</span> |
| | | <span v-if="scope.row.alm_type == 618506">异常核容或养护终止告警</span> |
| | | <span v-if="scope.row.alm_type == 119023">续航不足告警</span> |
| | | <span v-if="scope.row.alm_type == 119024">基站停电告警</span> |
| | | <span v-if="scope.row.alm_type == 119025">基站发电告警</span> |
| | | <span v-if="scope.row.alm_type == 119026">基站掉站告警</span> |
| | | <span v-if="scope.row.alm_type == 119027">基站开门告警</span> |
| | | <span v-if="scope.row.alm_type == 119028">设备高温告警</span> |
| | | <span v-if="scope.row.alm_type == 119032">设备SD卡故障</span> |
| | | <span v-if="scope.row.alm_type == 119033">采集线告警</span> |
| | | </div> |
| | | <div v-else-if="header.prop == 'alm_level'"> |
| | | <span v-if="scope.row.alm_level == 1">一级告警</span> |
| | | <span v-if="scope.row.alm_level == 2">二级告警</span> |
| | | <span v-if="scope.row.alm_level == 3">三级告警</span> |
| | | <span v-if="scope.row.alm_level == 4">四级告警</span> |
| | | </div> |
| | | <div v-else-if="header.prop =='alm_is_confirmed'"> |
| | | <input type="checkbox" :checked='scope.row.alm_is_confirmed ===1?true:false' disabled> |
| | | </div> |
| | | <div v-else> |
| | | {{ scope.row[header.prop] }} |
| | | </div> |
| | | |
| | | </div> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="cztime" fixed="right" width="80px" align="center" label="操作"> |
| | | <template slot-scope="scope"> |
| | | <el-button :disabled="!isCanDel" type="danger" size="mini" @click="deleteUser(scope.row)">删除</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </div> |
| | | <!-- 底部分页 --> |
| | | <div class="flex-page-footer" slot="footer"> |
| | | <div class="el-pagination-btns"> |
| | | <el-button type="primary" @click="alramData" round size="mini" icon="el-icon-search">查询</el-button> |
| | | <el-button type="primary" round size="mini" icon="el-icon-wallet" @click="exportFile">导出</el-button> |
| | | </div> |
| | | <el-pagination |
| | | class="pagess" |
| | | @size-change="handleSizeChange" |
| | | @current-change="handleCurrentChange" |
| | | :current-page="queryInfo.pageCurr" |
| | | :page-sizes="[10, 20,30, 50,100]" |
| | | :page-size="queryInfo.pagesize" |
| | | layout="total, sizes, prev, pager, next, jumper" |
| | | :total="total" |
| | | ></el-pagination> |
| | | <!-- <el-button type="primary" round size="mini" icon="el-icon-wallet">全部选中</el-button> --> |
| | | </div> |
| | | </flex-layout> |
| | | </template> |
| | | |
| | | <script> |
| | | import { |
| | | deviceArea /* 维护区 */, |
| | | deviserchSeions /* 机房站点 */, |
| | | deviceRecord /* 告警记录 */, |
| | | deviceArarmdel /* 删除*/ |
| | | deviceArea /* 维护区 */, |
| | | deviserchSeions /* 机房站点 */, |
| | | deviceRecord /* 告警记录 */, |
| | | deviceArarmdel /* 删除*/ |
| | | } from "@/assets/js/alarmAdmian/deviceHistoryquery.js"; |
| | | // 引入导出表格 |
| | | import { |
| | | export_json_to_excel |
| | | export_json_to_excel |
| | | } from '../../assets/js/excel/Export2Excel.js' |
| | | export default { |
| | | data() { |
| | | let newTime = new Date().format('yyyy-MM-dd'); |
| | | let oldTime = new Date(new Date(newTime).getTime() - 7*24*3600*1000).format('yyyy-MM-dd'); |
| | | return { |
| | | queryInfo: { |
| | | pageCurr: 1, |
| | | pagesize: 10 |
| | | }, |
| | | total: 0, |
| | | /* 日期 */ |
| | | valueTime1: oldTime, |
| | | valueTime2: newTime, |
| | | pickerOptions0: { |
| | | disabledDate: (time) => { |
| | | let vm = this; |
| | | if (vm.valueTime2) { |
| | | return new Date(time.getTime()) > new Date(vm.valueTime2); |
| | | } else { |
| | | // return time.getTime() > Date.now(); |
| | | } |
| | | } |
| | | }, |
| | | pickerOptions1: { |
| | | disabledDate: (time) => { |
| | | return new Date(time.getTime()+24*60*60*1000) < new Date(this.valueTime1); |
| | | } |
| | | }, |
| | | /* 维护区 */ |
| | | devss: [ |
| | | { |
| | | value: null, |
| | | label: null |
| | | } |
| | | ], |
| | | /* 机房站点 */ |
| | | opt: [ |
| | | { |
| | | value: null, |
| | | label: null |
| | | } |
| | | ], |
| | | selectValue1: "", |
| | | selectPlace1: "", |
| | | selectValue2: "", |
| | | selectPlace2: "", |
| | | /* 表单 */ |
| | | table: { |
| | | headers: [ |
| | | { |
| | | prop: "room1", |
| | | label: "编号", |
| | | width: "50px" |
| | | }, |
| | | { |
| | | prop: "battery1", |
| | | label: "设备ID", |
| | | width: "" |
| | | }, |
| | | { |
| | | prop: "tes1", |
| | | label: "设备名", |
| | | width: "" |
| | | }, |
| | | { |
| | | prop: "tester1", |
| | | label: "设备IP", |
| | | width: "" |
| | | }, |
| | | { |
| | | prop: "sessdion1", |
| | | label: "机房名称", |
| | | width: "270px" |
| | | }, |
| | | { |
| | | prop: "alm_type", |
| | | label: "告警事件", |
| | | width: "" |
| | | }, |
| | | { |
| | | prop: "alm_level", |
| | | label: "告警等级", |
| | | width: "" |
| | | }, |
| | | { |
| | | prop: "alm_is_confirmed", |
| | | label: "告警确认", |
| | | width: "" |
| | | }, |
| | | { |
| | | prop: "monomer1", |
| | | label: "告警确认时间", |
| | | width: "" |
| | | }, |
| | | { |
| | | prop: "start1", |
| | | label: "告警开始时间", |
| | | width: "" |
| | | }, |
| | | { |
| | | prop: "end1", |
| | | label: "告警结束时间", |
| | | width: "" |
| | | } |
| | | ], |
| | | datas: [] |
| | | } |
| | | }; |
| | | }, |
| | | mounted() { |
| | | this.deviceList(); /* 维护区 */ |
| | | this.sesston(); /* 机房站点 */ |
| | | this.alramData(); /* 告警记录 */ |
| | | }, |
| | | methods: { |
| | | // 导出表格 |
| | | exportFile() { |
| | | let tHeader = []; |
| | | let filterVal = ['rooms1','batterys1','tesa1','dev1','tester1','alm_name','alm_level_name','monomers1','starts1']; |
| | | this.table.headers.map((item, index) => { |
| | | tHeader.push(item.label) |
| | | }) |
| | | let list = this.table.datas; |
| | | if (list.length > 0) { |
| | | list.map((item, index) => { |
| | | if (item.alm_type == 119020) { |
| | | item.alm_name = '通信故障' |
| | | }else if(item.alm_type == 618501){ |
| | | item.alm_name = '继电器K1告警' |
| | | }else if(item.alm_type == 618502){ |
| | | item.alm_name = '通讯告警' |
| | | }else if(item.alm_type == 618503){ |
| | | item.alm_name = '设备过温告警' |
| | | }else if(item.alm_type == 618504){ |
| | | item.alm_name = '二极管D1告警' |
| | | }else if(item.alm_type == 618505){ |
| | | item.alm_name = '干接点告警' |
| | | }else if(item.alm_type == 618506){ |
| | | item.alm_name = '异常核容或养护终止告警' |
| | | }else if(item.alm_type == 119023){ |
| | | item.alm_name = '续航不足告警' |
| | | }else if(item.alm_type == 119024){ |
| | | item.alm_name = '基站停电告警' |
| | | }else if(item.alm_type == 119025){ |
| | | item.alm_name = '基站发电告警' |
| | | }else if(item.alm_type == 119026){ |
| | | item.alm_name = '基站掉站告警' |
| | | }else if(item.alm_type == 119027){ |
| | | item.alm_name = '基站开门告警' |
| | | }else if(item.alm_type == 119028){ |
| | | item.alm_name = '设备高温告警' |
| | | }else if(item.alm_type == 119032){ |
| | | item.alm_name = '设备SD卡故障' |
| | | }else if(item.alm_type == 119033){ |
| | | item.alm_name = '采集线告警' |
| | | } |
| | | |
| | | if (item.alm_level == 1) { |
| | | item.alm_level_name = '一级告警' |
| | | }else if(item.alm_level == 2){ |
| | | item.alm_level_name = '二级告警' |
| | | }else if(item.alm_level == 3){ |
| | | item.alm_level_name = '三级告警' |
| | | }else if(item.alm_level == 4){ |
| | | item.alm_level_name = '四级告警' |
| | | } |
| | | |
| | | }) |
| | | } |
| | | let excelData = this.formatJson(filterVal, list); |
| | | export_json_to_excel(tHeader, excelData, "设备告警历史数据"); |
| | | }, |
| | | formatJson(filterVal, jsonData) { |
| | | return jsonData.map(v => filterVal.map(j => v[j])); |
| | | }, |
| | | /* 维护区 */ |
| | | async deviceList() { |
| | | const newdevice = await deviceArea(); |
| | | if ( |
| | | newdevice.data.result && |
| | | JSON.parse(newdevice.data.result).code == 1 |
| | | ) { |
| | | let devss = JSON.parse(newdevice.data.result).data.map(item => { |
| | | return { label: item, value: item }; |
| | | }); |
| | | devss.unshift({ |
| | | label: `全部共${devss.length}种`, |
| | | value: "" |
| | | }); |
| | | this.devss = devss; |
| | | this.selectPlace1 = `全部(共${devss.length}种)`; |
| | | } |
| | | }, |
| | | /* 机房站点 */ |
| | | async sesston(status) { |
| | | const newss = await deviserchSeions({ UNote: this.selectValue1 }); |
| | | let opt = JSON.parse(newss.data.result).data.map(item => { |
| | | return { label: item, value: item }; |
| | | }); |
| | | opt.unshift({ |
| | | label: `全部共${opt.length}种`, |
| | | value: "" |
| | | }); |
| | | this.opt = opt; |
| | | this.selectPlace2 = `全部(共${opt.length}种)`; |
| | | if(status == 1){ |
| | | this.alramData(); |
| | | } |
| | | }, |
| | | /*查询设备历史告警记录 */ |
| | | alramData:function() { |
| | | let loading = this.$layer.loading(1); |
| | | deviceRecord({ |
| | | |
| | | binf: { |
| | | StationName: this.selectValue2, |
| | | StationName1: this.selectValue1, |
| | | BattProductDate: this.valueTime1 + ' 00:00:00', |
| | | BattProductDate1: this.valueTime2 + ' 23:59:59' |
| | | }, |
| | | page: { |
| | | pageCurr: this.queryInfo.pageCurr, |
| | | pageSize: this.queryInfo.pagesize |
| | | } |
| | | }).then((res)=>{ |
| | | this.$layer.close(loading); |
| | | let alramaa = res; |
| | | if(alramaa.data.result && JSON.parse(alramaa.data.result).code == 1){ |
| | | const newAlrams = JSON.parse(alramaa.data.result).data; |
| | | this.total = newAlrams[newAlrams.length - 1].usr_id; |
| | | const oldSalrams = newAlrams.map((item, index) => { |
| | | item.index = index + 1; |
| | | return { |
| | | room1: item.index, |
| | | battery1: item.dev_id, |
| | | tes1: item.dev_name, |
| | | tester1: item.dev_ip, |
| | | sessdion1: item.stationName, |
| | | monomer1: item.alm_confirmed_time, |
| | | start1: item.alm_start_time, |
| | | end1: item.alm_end_time, |
| | | num: item.num, |
| | | alm_is_confirmed:item.alm_is_confirmed, |
| | | alm_level:item.alm_level, |
| | | alm_type:item.alm_type, |
| | | alm_value:item.alm_value |
| | | }; |
| | | }); |
| | | this.table.datas = oldSalrams; |
| | | }else{ |
| | | this.table.datas = []; |
| | | this.total = 0; |
| | | } |
| | | }).catch((err)=>{ |
| | | this.$layer.close(loading); |
| | | this.table.datas = []; |
| | | this.total = 0; |
| | | }); |
| | | |
| | | import {isHasPermit} from "@/assets/js/tools"; |
| | | |
| | | |
| | | |
| | | export default { |
| | | data() { |
| | | let permits = this.$store.state.user.permits; |
| | | let isCanDel = isHasPermit('dev_alm_delete_permit', permits); |
| | | let newTime = new Date().format('yyyy-MM-dd'); |
| | | let oldTime = new Date(new Date(newTime).getTime() - 7 * 24 * 3600 * 1000).format('yyyy-MM-dd'); |
| | | return { |
| | | isCanDel: isCanDel, |
| | | queryInfo: { |
| | | pageCurr: 1, |
| | | pagesize: 10 |
| | | }, |
| | | total: 0, |
| | | /* 日期 */ |
| | | valueTime1: oldTime, |
| | | valueTime2: newTime, |
| | | pickerOptions0: { |
| | | disabledDate: (time) => { |
| | | let vm = this; |
| | | if (vm.valueTime2) { |
| | | return new Date(time.getTime()) > new Date(vm.valueTime2); |
| | | } else { |
| | | // return time.getTime() > Date.now(); |
| | | } |
| | | } |
| | | }, |
| | | pickerOptions1: { |
| | | disabledDate: (time) => { |
| | | return new Date(time.getTime() + 24 * 60 * 60 * 1000) < new Date(this.valueTime1); |
| | | } |
| | | }, |
| | | /* 维护区 */ |
| | | devss: [ |
| | | { |
| | | value: null, |
| | | label: null |
| | | } |
| | | ], |
| | | /* 机房站点 */ |
| | | opt: [ |
| | | { |
| | | value: null, |
| | | label: null |
| | | } |
| | | ], |
| | | selectValue1: "", |
| | | selectPlace1: "", |
| | | selectValue2: "", |
| | | selectPlace2: "", |
| | | /* 表单 */ |
| | | table: { |
| | | headers: [ |
| | | { |
| | | prop: "room1", |
| | | label: "编号", |
| | | width: "50px" |
| | | }, |
| | | { |
| | | prop: "battery1", |
| | | label: "设备ID", |
| | | width: "" |
| | | }, |
| | | { |
| | | prop: "tes1", |
| | | label: "设备名", |
| | | width: "" |
| | | }, |
| | | { |
| | | prop: "tester1", |
| | | label: "设备IP", |
| | | width: "" |
| | | }, |
| | | { |
| | | prop: "sessdion1", |
| | | label: "机房名称", |
| | | width: "270px" |
| | | }, |
| | | { |
| | | prop: "alm_type", |
| | | label: "告警事件", |
| | | width: "" |
| | | }, |
| | | { |
| | | prop: "alm_level", |
| | | label: "告警等级", |
| | | width: "" |
| | | }, |
| | | { |
| | | prop: "alm_is_confirmed", |
| | | label: "告警确认", |
| | | width: "" |
| | | }, |
| | | { |
| | | prop: "monomer1", |
| | | label: "告警确认时间", |
| | | width: "" |
| | | }, |
| | | { |
| | | prop: "start1", |
| | | label: "告警开始时间", |
| | | width: "" |
| | | }, |
| | | { |
| | | prop: "end1", |
| | | label: "告警结束时间", |
| | | width: "" |
| | | } |
| | | ], |
| | | datas: [] |
| | | } |
| | | }; |
| | | }, |
| | | /* 删除 */ |
| | | async deleteUser(value) { |
| | | const confirmResult = await this.$confirm( |
| | | "确定删除这条告警记录吗, 是否继续?", |
| | | "提示", |
| | | { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning" |
| | | mounted() { |
| | | this.deviceList(); /* 维护区 */ |
| | | this.sesston(); /* 机房站点 */ |
| | | this.alramData(); /* 告警记录 */ |
| | | }, |
| | | methods: { |
| | | // 导出表格 |
| | | exportFile() { |
| | | let tHeader = []; |
| | | let filterVal = ['rooms1', 'batterys1', 'tesa1', 'dev1', 'tester1', 'alm_name', 'alm_level_name', 'monomers1', 'starts1']; |
| | | this.table.headers.map((item, index) => { |
| | | tHeader.push(item.label) |
| | | }) |
| | | let list = this.table.datas; |
| | | if (list.length > 0) { |
| | | list.map((item, index) => { |
| | | if (item.alm_type == 119020) { |
| | | item.alm_name = '通信故障' |
| | | } else if (item.alm_type == 618501) { |
| | | item.alm_name = '继电器K1告警' |
| | | } else if (item.alm_type == 618502) { |
| | | item.alm_name = '通讯告警' |
| | | } else if (item.alm_type == 618503) { |
| | | item.alm_name = '设备过温告警' |
| | | } else if (item.alm_type == 618504) { |
| | | item.alm_name = '二极管D1告警' |
| | | } else if (item.alm_type == 618505) { |
| | | item.alm_name = '干接点告警' |
| | | } else if (item.alm_type == 618506) { |
| | | item.alm_name = '异常核容或养护终止告警' |
| | | } else if (item.alm_type == 119023) { |
| | | item.alm_name = '续航不足告警' |
| | | } else if (item.alm_type == 119024) { |
| | | item.alm_name = '基站停电告警' |
| | | } else if (item.alm_type == 119025) { |
| | | item.alm_name = '基站发电告警' |
| | | } else if (item.alm_type == 119026) { |
| | | item.alm_name = '基站掉站告警' |
| | | } else if (item.alm_type == 119027) { |
| | | item.alm_name = '基站开门告警' |
| | | } else if (item.alm_type == 119028) { |
| | | item.alm_name = '设备高温告警' |
| | | } else if (item.alm_type == 119032) { |
| | | item.alm_name = '设备SD卡故障' |
| | | } else if (item.alm_type == 119033) { |
| | | item.alm_name = '采集线告警' |
| | | } |
| | | |
| | | if (item.alm_level == 1) { |
| | | item.alm_level_name = '一级告警' |
| | | } else if (item.alm_level == 2) { |
| | | item.alm_level_name = '二级告警' |
| | | } else if (item.alm_level == 3) { |
| | | item.alm_level_name = '三级告警' |
| | | } else if (item.alm_level == 4) { |
| | | item.alm_level_name = '四级告警' |
| | | } |
| | | |
| | | }) |
| | | } |
| | | let excelData = this.formatJson(filterVal, list); |
| | | export_json_to_excel(tHeader, excelData, "设备告警历史数据"); |
| | | }, |
| | | formatJson(filterVal, jsonData) { |
| | | return jsonData.map(v => filterVal.map(j => v[j])); |
| | | }, |
| | | /* 维护区 */ |
| | | async deviceList() { |
| | | const newdevice = await deviceArea(); |
| | | if ( |
| | | newdevice.data.result && |
| | | JSON.parse(newdevice.data.result).code == 1 |
| | | ) { |
| | | let devss = JSON.parse(newdevice.data.result).data.map(item => { |
| | | return {label: item, value: item}; |
| | | }); |
| | | devss.unshift({ |
| | | label: `全部共${devss.length}种`, |
| | | value: "" |
| | | }); |
| | | this.devss = devss; |
| | | this.selectPlace1 = `全部(共${devss.length}种)`; |
| | | } |
| | | }, |
| | | /* 机房站点 */ |
| | | async sesston(status) { |
| | | const newss = await deviserchSeions({UNote: this.selectValue1}); |
| | | let opt = JSON.parse(newss.data.result).data.map(item => { |
| | | return {label: item, value: item}; |
| | | }); |
| | | opt.unshift({ |
| | | label: `全部共${opt.length}种`, |
| | | value: "" |
| | | }); |
| | | this.opt = opt; |
| | | this.selectPlace2 = `全部(共${opt.length}种)`; |
| | | if (status == 1) { |
| | | this.alramData(); |
| | | } |
| | | }, |
| | | /*查询设备历史告警记录 */ |
| | | alramData: function () { |
| | | let loading = this.$layer.loading(1); |
| | | deviceRecord({ |
| | | |
| | | binf: { |
| | | StationName: this.selectValue2, |
| | | StationName1: this.selectValue1, |
| | | BattProductDate: this.valueTime1 + ' 00:00:00', |
| | | BattProductDate1: this.valueTime2 + ' 23:59:59' |
| | | }, |
| | | page: { |
| | | pageCurr: this.queryInfo.pageCurr, |
| | | pageSize: this.queryInfo.pagesize |
| | | } |
| | | }).then((res) => { |
| | | this.$layer.close(loading); |
| | | let alramaa = res; |
| | | if (alramaa.data.result && JSON.parse(alramaa.data.result).code == 1) { |
| | | const newAlrams = JSON.parse(alramaa.data.result).data; |
| | | this.total = newAlrams[newAlrams.length - 1].usr_id; |
| | | const oldSalrams = newAlrams.map((item, index) => { |
| | | item.index = index + 1; |
| | | return { |
| | | room1: item.index, |
| | | battery1: item.dev_id, |
| | | tes1: item.dev_name, |
| | | tester1: item.dev_ip, |
| | | sessdion1: item.stationName, |
| | | monomer1: item.alm_confirmed_time, |
| | | start1: item.alm_start_time, |
| | | end1: item.alm_end_time, |
| | | num: item.num, |
| | | alm_is_confirmed: item.alm_is_confirmed, |
| | | alm_level: item.alm_level, |
| | | alm_type: item.alm_type, |
| | | alm_value: item.alm_value |
| | | }; |
| | | }); |
| | | this.table.datas = oldSalrams; |
| | | } else { |
| | | this.table.datas = []; |
| | | this.total = 0; |
| | | } |
| | | }).catch((err) => { |
| | | this.$layer.close(loading); |
| | | this.table.datas = []; |
| | | this.total = 0; |
| | | }); |
| | | |
| | | |
| | | }, |
| | | /* 删除 */ |
| | | async deleteUser(value) { |
| | | const confirmResult = await this.$confirm( |
| | | "确定删除这条告警记录吗, 是否继续?", |
| | | "提示", |
| | | { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning" |
| | | } |
| | | ).catch(err => err); |
| | | if (confirmResult !== "confirm") { |
| | | return this.$message.info("已取消删除"); |
| | | } |
| | | const wa = await deviceArarmdel([ |
| | | { |
| | | num: value.num, |
| | | stationName: value.sessdion1, |
| | | note: " " |
| | | } |
| | | ]); |
| | | if (JSON.parse(wa.data.result).code !== 1) { |
| | | return this.$message.error("删除失败"); |
| | | } |
| | | this.$message.success("删除成功"); |
| | | this.alramData(); |
| | | }, |
| | | //维护区改变事件 |
| | | changeSelect1() { |
| | | this.selectValue2 = ''; |
| | | this.sesston(1); |
| | | }, |
| | | /* 显示条数改变时 */ |
| | | handleSizeChange(val) { |
| | | this.queryInfo.pagesize = val; |
| | | this.alramData(); |
| | | }, |
| | | /* 翻页 */ |
| | | handleCurrentChange(val2) { |
| | | this.queryInfo.pageCurr = val2; |
| | | this.alramData(); |
| | | } |
| | | ).catch(err => err); |
| | | if (confirmResult !== "confirm") { |
| | | return this.$message.info("已取消删除"); |
| | | } |
| | | const wa = await deviceArarmdel([ |
| | | { |
| | | num: value.num, |
| | | stationName: value.sessdion1, |
| | | note: " " |
| | | } |
| | | ]); |
| | | if (JSON.parse(wa.data.result).code !== 1) { |
| | | return this.$message.error("删除失败"); |
| | | } |
| | | this.$message.success("删除成功"); |
| | | this.alramData(); |
| | | }, |
| | | //维护区改变事件 |
| | | changeSelect1() { |
| | | this.selectValue2 = ''; |
| | | this.sesston(1); |
| | | }, |
| | | /* 显示条数改变时 */ |
| | | handleSizeChange(val) { |
| | | this.queryInfo.pagesize = val; |
| | | this.alramData(); |
| | | }, |
| | | /* 翻页 */ |
| | | handleCurrentChange(val2) { |
| | | this.queryInfo.pageCurr = val2; |
| | | this.alramData(); |
| | | } |
| | | } |
| | | }; |
| | | </script> |
| | | |