Authored by 鲁尚清

机房详情页告警及资源名称下探

@@ -55,6 +55,15 @@ @@ -55,6 +55,15 @@
55 margin-top: 20px; 55 margin-top: 20px;
56 border-collapse:collapse; 56 border-collapse:collapse;
57 } 57 }
  58 +.machine-room-parent .search-table table{
  59 + margin-top:0;
  60 +}
  61 +.dataCenter-container .alarm-dialog .el-dialog{
  62 + background: #ffffff;
  63 +}
  64 +.dataCenter-container .alarm-dialog .el-dialog__title{
  65 + color:#1e9fff;
  66 +}
58 .machine-room-parent table tr{ 67 .machine-room-parent table tr{
59 height: 50px; 68 height: 50px;
60 } 69 }
@@ -57,16 +57,51 @@ @@ -57,16 +57,51 @@
57 <div class='info-contain'> 57 <div class='info-contain'>
58 <div class='info-text'>设备信息</div> 58 <div class='info-text'>设备信息</div>
59 <div class='info-text-bot'> 59 <div class='info-text-bot'>
60 - <p>资源名称:{{deviceDataInfo.resName}}</p> 60 + <p v-if="!isRes">资源名称:<span>{{deviceDataInfo.resName}}</span></p>
  61 + <p v-if="isRes">资源名称:<span style="cursor: pointer;color: #1e9fff;" @click="goResDetail(deviceDataInfo.resId,deviceDataInfo.resType)">{{deviceDataInfo.resName}}</span></p>
61 <p>品 牌:{{deviceDataInfo.brand}}</p> 62 <p>品 牌:{{deviceDataInfo.brand}}</p>
62 <p>型 号:{{deviceDataInfo.model}}</p> 63 <p>型 号:{{deviceDataInfo.model}}</p>
63 <p>序 列 号:{{deviceDataInfo.serialnumber}}</p> 64 <p>序 列 号:{{deviceDataInfo.serialnumber}}</p>
64 <p>业 务 IP:{{deviceDataInfo.ip}}</p> 65 <p>业 务 IP:{{deviceDataInfo.ip}}</p>
65 <p>用 途:{{deviceDataInfo.purpose}}</p> 66 <p>用 途:{{deviceDataInfo.purpose}}</p>
66 - <p >告警量111:{{deviceDataInfo.alarmNum == 1 }}</p> 67 + <p >告警量<span style="cursor: pointer;color: #1e9fff;" @click="alarmList(deviceDataInfo.resId)">{{deviceDataInfo.alarmNum }}</span></p>
67 </div> 68 </div>
68 </div> 69 </div>
69 </div> 70 </div>
70 </div> 71 </div>
  72 + <div class="alarm-dialog">
  73 + <cm-dialog title="告警列表" width="60%" :showDialogVisible="dialogVisible" @hidedialog="hidedialog" :showFooter="false" :top="'15vh'" >
  74 + <template v-slot>
  75 + <div class="search-table">
  76 + <cm-table-page :columns="columns" :dataList="tableDataList" @loaddata="loadTableDataList"
  77 + :showIndex="true" :total="count" :showSelection="false"
  78 + :showBorder="true" :loading="false" :pageSize="pageSize"
  79 + :showPage="true" :showTools="false" :height="(height - 400)" >
  80 + <template #default="{row,prop,column}">
  81 + <div v-if="prop == 'alarmLevel'" style="color:#fff;">
  82 + <span style="background: #1e9fff;padding:20px;" v-if="row.alarmLevel == 1">
  83 + 一般
  84 + </span>
  85 + <span style="background: #FF7E00;padding:20px;" v-if="row.alarmLevel == 2">
  86 + 重要
  87 + </span>
  88 + <span style="background: #d81e06;padding:20px;" v-if="row.alarmLevel == 3">
  89 + 严重
  90 + </span>
  91 + </div>
  92 + </template>
  93 + <!-- <template #tools="{scope}">
  94 + <div class="list-handle">
  95 + <span class="icon-bg" style="color: #1e9fff;cursor: pointer;text-decoration: underline;">
  96 + 告警消除
  97 + </span>
  98 + </div>
  99 + </template>-->
  100 + </cm-table-page>
  101 + </div>
  102 + </template>
  103 + </cm-dialog>
  104 + </div>
  105 +
71 </div> 106 </div>
72 107
@@ -6,7 +6,21 @@ export default { @@ -6,7 +6,21 @@ export default {
6 () => myImport('views/commonComponents/machineRoomDetail/index') 6 () => myImport('views/commonComponents/machineRoomDetail/index')
7 ), 7 ),
8 }, 8 },
9 - props:['detailData','machineData'], 9 + props:{
  10 + detailData: {
  11 + type: Object,
  12 + default: {}
  13 + },
  14 + machineData: {
  15 + type: Object,
  16 + default: {}
  17 + },
  18 + //是否需要资源名称下探
  19 + isRes: {
  20 + type: Boolean,
  21 + default: false
  22 + },
  23 + },
10 data(){ 24 data(){
11 return { 25 return {
12 domainName:sessionStorage.getItem('domainName'), 26 domainName:sessionStorage.getItem('domainName'),
@@ -237,8 +251,85 @@ export default { @@ -237,8 +251,85 @@ export default {
237 proxy.isShowDevice=true; 251 proxy.isShowDevice=true;
238 proxy.deviceDataInfo=item; 252 proxy.deviceDataInfo=item;
239 } 253 }
  254 + let height = window.innerHeight;
  255 + let pageSize=Vue.ref(10);
  256 + let count=Vue.ref(0);
  257 + let columns=Vue.ref([
  258 + {
  259 + prop: 'alarmLevel',
  260 + label: '告警级别',
  261 + sortable: true,
  262 + align: 'center',
  263 + },
  264 + {
  265 + prop: 'alarmContent',
  266 + label: '告警内容',
  267 + sortable: true,
  268 + align: 'center',
  269 + },
  270 + {
  271 + prop: 'kpiName',
  272 + label: '指标名称',
  273 + sortable: true,
  274 + align: 'center',
  275 + },
  276 + {
  277 + prop: 'updateTime',
  278 + label: '告警时间',
  279 + sortable: true,
  280 + align: 'center',
  281 + },
  282 + ])
  283 + let tableDataList=Vue.ref([]);
  284 + let currentPage=Vue.ref(1);
  285 + //重新加载表格数据
  286 + let loadTableDataList = ({page, limit}) => {
  287 + currentPage.value = page;
  288 + pageSize.value = limit;
  289 + alarmList()
  290 + }
  291 + //展示告警列表
  292 + let alarmList=(resId)=>{
  293 + hidedialog(true);
  294 + let params={
  295 + page:currentPage.value,
  296 + limit:pageSize.value,
  297 + resId:resId
  298 + }
  299 + proxy.$http.get(`/api-web/home/alarm/alarmListPage`, params, function (res) {
  300 + if (res && res.success == true && res.data) {
  301 + tableDataList.value = res.data;
  302 + count.value=res.count;
  303 + }else{
  304 + tableDataList.value = [];
  305 + count.value=0;
  306 +
  307 + }
  308 + })
  309 + }
  310 + //告警列表弹框操作
  311 + let dialogVisible=Vue.ref(false);
  312 + let hidedialog = (flg) => {
  313 + dialogVisible.value = flg;
  314 + }
  315 + //资源名称下探
  316 + let goResDetail=(resId,resType)=>{
  317 + if(props.isRes){
  318 + proxy.$global.openDetail(resId, resType, proxy);
  319 + }
240 320
  321 + }
241 return{ 322 return{
  323 + height,
  324 + pageSize,
  325 + count,
  326 + columns,
  327 + tableDataList,
  328 + loadTableDataList,
  329 + alarmList,
  330 + dialogVisible,
  331 + goResDetail,
  332 + hidedialog,
242 showDevice, 333 showDevice,
243 isShowDevice, 334 isShowDevice,
244 getDeviceInfo, 335 getDeviceInfo,