<template>
  <el-dialog
    :visible.sync="dialogVisible"
    width="460px"
    custom-class="view-dialog"
    :modal-append-to-body="false"
    :append-to-body="true">
    <el-divider class="dialog-divider"></el-divider>
      <div class="dialog-content">
        <el-row class="dialog-row">
          <div class="dialog-row-title">告警信息</div>
          <div class="dialog-row-content">
            <!-- <span class="content-row"> <span class="name-item"> 设备名称: </span> <span>{{alarmInfo.realname}}</span> </span>
            <span class="content-row"> <span class="name-item"> 设备编号: </span> <span>{{alarmInfo.device_number}}</span> </span>
            <span class="content-row" style="color:red"> <span class="name-item"> 告警原因: </span> <span>{{alarmInfo.alarm_type_name}}</span> </span>
            <span class="content-row"> <span class="name-item"> 告警时间: </span> <span>{{alarmInfo.alarm_time}}</span> </span> -->
            <span class="content-row"> <span class="name-item"> 设备名称: </span> <span>测试设备1</span> </span>
            <span class="content-row"> <span class="name-item"> 设备编号: </span> <span>10001</span> </span>
            <span class="content-row" style="color:red"> <span class="name-item"> 告警原因: </span> <span>液压油偏低</span> </span>
            <span class="content-row"> <span class="name-item"> 告警时间: </span> <span>2022-05-16 14:43:00</span> </span>
          </div>
        </el-row>


      </div>
    <el-divider class="dialog-divider"></el-divider>
    <span slot="footer" class="dialog-footer">
      <!-- <el-button @click="dialogVisible = false">取 消</el-button> -->
      <el-button style="margin-left:20px" type="primary" @click="dialogVisible = false">确 定</el-button>
    </span>
    <device-dialog 
    :deviceVisible="innerVisible" 
    @sendVal="closeDeviceDialog" 
    :assetNo="dialogAssetNo"
    />
  </el-dialog>

</template>
<script>
import {  CodeToText } from "element-china-area-data";
import deviceDialog from "./deviceDialog"
  export default {
    props:['detailVisible',"alarmId"],
    components: {
      deviceDialog
    },
    data() {
      return {
        alarmInfo:{},
        deviceInfo:{},
        dialogAssetNo:'',
        path:"",
        innerVisible: false,
      };
    },
    methods: {
      handleDeviceInfo(){
        // console.log(this.deviceInfo)
        this.innerVisible=true
        this.dialogAssetNo=this.deviceInfo.asset_no
      },
      closeDeviceDialog(){
        this.innerVisible=false
      }
    },
    watch:{
      alarmId(newVal){

        this.$http.get('alarmReport/getDetail/'+newVal).then(response => {
          if (response.code === 10000) {
            this.alarmInfo = response.data || {}
          }
        })
        
      }
    }, 
    computed: {
      dialogVisible: {
      set (val) {

        this.$emit('sendVal', val) 
      },
      get () {

        return this.detailVisible
      }
    },
    }
  };
</script>
<style scoped>
::v-deep .el-dialog{
  min-width: 360px;
}
 .el-dialog__body{
  padding: 0px!important;
  /* padding-bottom: 0px!important; */
}


.dialog-divider{
  margin:0px;
}
.dialog-content{
  padding: 5px;
}

.dialog-row{
  display: flex;
  flex-direction: column;
  padding: 10px;
  font-size: 12px;
}
.dialog-row-title{
  margin-left: 20px;
  margin-bottom: 10px;
  font-size: 15px;
  color: black;
}
.dialog-row-content{
  margin-left: 50px;
  display: flex;
  flex-direction: column; 
}
.content-row{
  margin-top: 5px;
}
.name-item{
  width: 60px;
  white-space:pre;
  word-wrap: break-word;
}
.el-drawer__body{
  max-height:100vh;
  overflow: hidden;
   overflow-y: auto;
   width:100%;

}
.primary-btn{
  color: #fff;
  background-color: #409eff;
  border-color: #98a9b9;
  margin-left:5px;
}
</style>