<!--异常记录-详情-->
<template>
  <div class="addPage">
    <div class="addPage_title">
      <p>查看气瓶</p>
      <p  class="reset-button-one" @click="backPage">返回</p>
    </div>
    <div class="small_title">气瓶信息</div>
     <!--基本信息-->
    <div class="info"   v-if="form">
      <div class="info_l">
        <img src="@/assets/ZDimages/gasManage_syd/icon_qp.png">
        <p>{{form.storageStatus == 1?'闲置':(form.storageStatus == 2?'使用':(form.storageStatus == 3?'出库':''))}}</p>
      </div>
      <div class="info_r">
        <li><i>识别码：</i><i>{{form.electronicTag}}</i></li>
        <li><i>气瓶编号：</i><i>{{form.airNumber}}</i></li>
        <li><i>气体名称：</i><i>{{form.airName}}</i></li>
        <li><i>气瓶规格：</i><i>{{form.configName}}</i></li>
        <li><i>最低气压值：</i><i>{{form.minPressure}}Mpa</i></li>
        <li><i>气体组分：</i><i>{{form.airComponent}}</i></li>
      </div>
    </div>
    <div class="small_title">异常信息</div>
    <div class="info2">
      <li><i>操作人：</i><i>{{form.createBy}}</i></li>
      <li><i>联系方式：</i><i>{{form.phone}}</i></li>
      <li><i>原气压值：</i><i>{{form.beforeEdit}}Mpa</i></li>
      <li><i>修改后气压值：</i><i>{{form.afterEdit}}Mpa</i></li>
      <li><i>操作时间：</i><i>{{form.opTime}}</i></li>
    </div>
    <div class="small_title">使用记录</div>
    <div class="addPage_b">
      <el-table border v-loading="loading" :data="form.recordVos" height="300px">
        <el-table-column label="使用量" align="left" prop="amount">
          <template slot-scope="scope">
            <span>{{scope.row.amount}}Mpa</span>
          </template>
        </el-table-column>
        <el-table-column label="使用前气压" align="left" prop="beforeUsePic">
          <template slot-scope="scope">
            <span>{{scope.row.beforeUse}}Mpa</span>
<!--            <span v-if="scope.row.beforeUse" style="color: #0183FA;margin-left: 10px;cursor: pointer;"   @click="handleClick('',scope.row,'before')">查看图片</span>-->
          </template>
        </el-table-column>
        <el-table-column label="使用后气压" align="left" prop="afterUse">
          <template slot-scope="scope">
            <span>{{scope.row.afterUse}}Mpa</span>
<!--            <span v-if="scope.row.afterUse" style="color: #0183FA;margin-left: 10px;cursor: pointer;" @click="handleClick('',scope.row,'after')">查看图片</span>-->
          </template>
        </el-table-column>
        <el-table-column label="使用时间" align="left" prop="useTime">
          <template slot-scope="scope">
            <span >{{scope.row.useTime?scope.row.useTime:'-'}}</span>
          </template>
        </el-table-column>
        <el-table-column label="归还时间" align="left" prop="backTime">
          <template slot-scope="scope">
            <span >{{scope.row.backTime?scope.row.backTime:'-'}}</span>
          </template>
        </el-table-column>
      </el-table>

    </div>
  </div>
</template>
<script>

import { getToken } from "@/utils/auth";
import { abnormalRecordDetail,} from '@/api/gasManage_syd/index'
let Base64 = require('js-base64').Base64;
export default {
  name: "addPage",
  props:{
    pageData2:{},
  },
  data() {
    return {
      pageType:1,
      uploadImgUrl: this.uploadUrl(), // 上传的图片服务器地址
      headers: {
        Authorization: "Bearer " + getToken(),
      },
      // 设置只能选择当前日期及之后的日期
      pickerOptions0: {
        disabledDate(time) {
          return time.getTime() < Date.now() - 8.64e7;//如果没有后面的-8.64e7就是不可以选择今天的
        }
      },
      loading:false,
      form:{
        validTime:12,
        subjectId:"",
        subjectName:"",
        validBegin_time:"",//开始时间
        validEnd_time:"",//结束时间
        applyCause:"",//备注
      },
      infoParams:{
        radio:1,
      },
      dateRange:[],

      // 查询参数
      queryParams: {
        page: 1,
        pageSize:20,
      },
      total:0,
      tableData:[],
    };
  },
  created() {

  },
  methods: {
    //返回
    backPage(){
      this.$parent.handleClick('','','back');
    },
    handleClick(index,row,doType){
      let _this=this;
      if(doType=='before'){
        _this.lookFile(row.beforeUsePic)
      }else if(doType=='after'){
        _this.lookFile(row.afterUsePic)
      }
    },
    /**查看图片  */
    lookFile(item){
      let visitUrl=window.location.href.split('://')[0]+'://'+this.judgmentNetworkReturnAddress()+'/admin/'+item;
      window.open(localStorage.getItem('filePreviewUrl') + '/onlinePreview?url='+encodeURIComponent(Base64.encode(visitUrl)));
    },
    /* 详情 */
    getInfo(id){
      let _this=this;
      abnormalRecordDetail(id).then( response => {
        let res=response.data;
        if(response.code==200){
          _this.form=res;
        }
      });

    },

  },
  mounted() {
    this.formInfo=this.pageData2.item
    this.getInfo(this.pageData2.item.id);
  }

};
</script>

<style scoped lang="scss">
.addPage {
  flex:1;
  display: flex!important;
  flex-direction: column;
  box-shadow: 0 0 8px 2px rgba(0, 0, 0, 0.1);
  border-radius:10px;
  /*顶部*/
  .addPage_title{
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #E0E0E0;
    padding-top:20px;
    p:nth-child(1){
      flex: 1;
      line-height:60px;
      color: #0045AF;
      font-size:18px;
      margin:0 12px 0 20px;
    }
    p:nth-child(2){
      margin-right:20px;
    }
    p:nth-child(3){
      margin-right:20px;
    }
  }
  /*小标题*/
  .small_title{
    font-size: 16px;
    font-family: Microsoft YaHei;
    font-weight: bold;
    color: #333333;
    line-height: 16px;
    margin: 20px 0 0 20px;
  }
  /*基本信息*/
  .info{
    display: flex;
    justify-content: flex-start;
    flex-wrap: wrap;
    margin: 20px;
    box-sizing: border-box;
    border: 1px solid #E0E0E0;
    .info_l{
      margin-right: 92px;
      width: 100px;
      text-align: center;
      margin-left: 100px;
      margin-top: 20px;
      >img{
        width: 38px;
        height: 80px;
      }
      >P{
        font-size: 16px;
        font-family: Microsoft YaHei;
        font-weight: 400;
        color: #0183FA;
        line-height: 16px;
        margin-top: 12px;
      }
    }
    .info_r{
      display: flex;
      flex: 1;
      justify-content: flex-start;
      flex-wrap: wrap;
      >li{
        list-style-type: none;
        margin: 20px 0;
        >i{
          font-style: normal;
          display: inline-block;
          vertical-align:text-top;
        }
        >i:nth-of-type(1){
          font-size: 16px;
          font-family: Microsoft YaHei;
          font-weight: 400;
          color: #999999;
          line-height: 16px;
          width: 120px;
          text-align: right;
        }
        >i:nth-of-type(2){
          font-size: 16px;
          font-family: Microsoft YaHei;
          font-weight: 400;
          color: #333333;
          line-height: 16px;
          width: 200px;
          text-align: left;

        }
      }
    }

    .look_img{
      >i:nth-of-type(2){
        color: #0183FA;
      }
    }
  }
  .info2{
    display: flex;
    justify-content: flex-start;
    flex-wrap: wrap;
    height: 130px;
    border: 1px solid #E0E0E0;
    margin: 20px;
    padding: 30px 48px;
    box-sizing: border-box;
    >li{
      list-style-type: none;
      margin-right: 30px;
      >i{
        font-style: normal;
      }
      >i:nth-of-type(1){
        font-size: 16px;
        font-family: Microsoft YaHei;
        font-weight: 400;
        color: #999999;
        line-height: 16px;
      }
      >i:nth-of-type(2){
        font-size: 16px;
        font-family: Microsoft YaHei;
        font-weight: 400;
        color: #333333;
        line-height: 16px;
      }
    }
    .look_img{
      >i:nth-of-type(2){
        color: #0183FA;
      }
    }
  }
  /*入库信息*/
  .addPage_b{
    margin: 20px;
  }

}
</style>
