<template>
  <el-dialog title="详情" :visible.sync="detailOpen" width="900px" append-to-body destroy-on-close :close-on-click-modal="false">

    <el-form label-width="120px">
      <el-row class="el-row-table">
        <el-col :span="12">
          <el-form-item label="企业名称">
            <span v-if="detailInfo.enterpriseName">{{ detailInfo.enterpriseName }}</span>
            <span v-else>-</span>
          </el-form-item>
        </el-col>

        <el-col :span="12">
          <el-form-item label="天然气计划量/wm³">
            <span v-if="detailInfo.fPlanQuan">{{ detailInfo.fPlanQuan }}</span>
            <span v-else>-</span>
          </el-form-item>
        </el-col>

        <el-col :span="12">
          <el-form-item label="天然气批复量/wm³">
            <span v-if="detailInfo.fApprQuan">{{ detailInfo.fApprQuan }}</span>
            <span v-else>-</span>
          </el-form-item>
        </el-col>

        <el-col :span="12">
          <el-form-item label="天然气供气量/wm³">
            <span v-if="detailInfo.fSupGasVol">{{ detailInfo.fSupGasVol }}</span>
            <span v-else>-</span>
          </el-form-item>
        </el-col>

        <el-col :span="12">
          <el-form-item label="天然气存储量/wm³">
            <span v-if="detailInfo.fStorageVol">{{ detailInfo.fStorageVol }}</span>
            <span v-else>-</span>
          </el-form-item>
        </el-col>

        <el-col :span="12">
          <el-form-item label="液化气计划量/吨">
            <span v-if="detailInfo.fPlanYhq">{{ detailInfo.fPlanYhq }}</span>
            <span v-else>-</span>
          </el-form-item>
        </el-col>

        <el-col :span="12">
          <el-form-item label="液化气批复量/吨">
            <span v-if="detailInfo.fApprYhq">{{ detailInfo.fApprYhq }}</span>
            <span v-else>-</span>
          </el-form-item>
        </el-col>

        <el-col :span="12">
          <el-form-item label="液化气供气量/吨">
            <span v-if="detailInfo.fSupGasYhq">{{ detailInfo.fSupGasYhq }}</span>
            <span v-else>-</span>
          </el-form-item>
        </el-col>

        <el-col :span="12">
          <el-form-item label="液化气存储量/吨">
            <span v-if="detailInfo.fStorageYhq">{{ detailInfo.fStorageYhq }}</span>
            <span v-else>-</span>
          </el-form-item>
        </el-col>

        <el-col :span="12">
          <el-form-item label="监管气量日期">
            <span v-if="detailInfo.fSupDate">{{ detailInfo.fSupDate }}</span>
            <span v-else>-</span>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="创建时间">
            <span v-if="detailInfo.createTime">{{ detailInfo.createTime }}</span>
            <span v-else>-</span>
          </el-form-item>
        </el-col>

        <el-col :span="12">
          <el-form-item label="更新时间">
            <span v-if="detailInfo.updateTime">{{ detailInfo.updateTime }}</span>
            <span v-else>-</span>
          </el-form-item>
        </el-col>

        <el-col :span="12">
          <el-form-item label="所属区域">
            <span v-if="detailInfo.township">{{ $parent.townshipFormat(detailInfo) }}</span>
            <span v-else>-</span>
          </el-form-item>
        </el-col>

        <el-col :span="12">
          <el-form-item label="备注">
            <span v-if="detailInfo.remarks">{{ detailInfo.remarks }}</span>
            <span v-else>-</span>
          </el-form-item>
        </el-col>
      </el-row>

    </el-form>

    <el-divider content-position="left">上报时态</el-divider>
    <el-form label-width="170px">
      <el-row class="el-row-table">

        <el-col :span="12">
                <el-form-item label="上报省厅状态" >
                  <span>{{fUploadType}}</span>
                </el-form-item>
          </el-col>

          <el-col :span="12">
              <el-form-item label="上报省厅时间" >
                <span>{{ fUploadTime }}</span>
              </el-form-item>
          </el-col>

          <el-col :span="12">
            <el-form-item  v-if="this.$store.state.user.roleId == 3" label="企业端上报时间" >
              <span>{{ detailInfo.fRepDate }}</span>
            </el-form-item>
          </el-col>

      </el-row>
    </el-form>


  </el-dialog>

</template>

<script>
  import { getSup } from "@/api/supplybalance/gas";
  export default {
    name: "detail-info",
    data(){
        return{
          fUploadType: "",
          fUploadTime: null,
          detailInfo: {
            fDeleteFlag: 0
          },
          detailOpen: false
        }
    },
    methods:{
      //根据不同角色显示不同字段
      showUploadType() {
        let roleId = this.$store.state.user.roleId;
        if (roleId == 3) {
          this.fUploadType =  this.detailInfo.fGovUploadStatus
        }
        if (roleId == 5) {
          this.fUploadType =  this.detailInfo.fRepStatus
        }

        if (this.fUploadType == '0') {
          this.fUploadType = "未上报"
        }
        if (this.fUploadType == '1') {
          this.fUploadType = "已上报"
        }
      },
      showUploadTime() {

        let roleId = this.$store.state.user.roleId;
        if (roleId == 3) {
          this.fUploadTime =  this.detailInfo.fGovUploadTime
        }
        if (roleId == 5) {
          this.fUploadTime =  this.detailInfo.entRepTime
        }
      },
      getDetailInfo(id){
        getSup(id).then(res =>{
          if(res.code == 200 && res.data){
            this.detailInfo = res.data;
            this.showUploadType();
            this.showUploadTime();
            this.detailOpen = true;
          }
        })
      }
    }
  }
</script>

<style scoped>

</style>
