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

    <el-form label-position="top" 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="天然气城镇居民用量(万立方米)">
            <span v-if="detailInfo.fUrbanGasUsage">{{ detailInfo.fUrbanGasUsage }}</span>
            <span v-else>-</span>
          </el-form-item>
        </el-col>

        <el-col :span="12">
          <el-form-item label="天然气农村气代煤居民用量(万立方米)">
            <span v-if="detailInfo.fRuralReplaceResidentsGasUsage">{{ detailInfo.fRuralReplaceResidentsGasUsage }}</span>
            <span v-else>-</span>
          </el-form-item>
        </el-col>


        <el-col :span="12">
          <el-form-item label="天然气农村非气代煤居民用量(万立方米)">
            <span v-if="detailInfo.fNoRuralReplaceResidentsGasUsage">{{ detailInfo.fNoRuralReplaceResidentsGasUsage }}</span>
            <span v-else>-</span>
          </el-form-item>
        </el-col>

        <el-col :span="12">
          <el-form-item label="天然气工业用量(万立方米)">
            <span v-if="detailInfo.fIndustrialGasUsage">{{ detailInfo.fIndustrialGasUsage }}</span>
            <span v-else>-</span>
          </el-form-item>
        </el-col>

        <el-col :span="12">
          <el-form-item label="天然气商业用量(万立方米)">
            <span v-if="detailInfo.fCommercialGasUsage">{{ detailInfo.fCommercialGasUsage }}</span>
            <span v-else>-</span>
          </el-form-item>
        </el-col>

        <el-col :span="12">
          <el-form-item label="天然气公福用量(万立方米)">
            <span v-if="detailInfo.fPublicGasUsage">{{ detailInfo.fPublicGasUsage }}</span>
            <span v-else>-</span>
          </el-form-item>
        </el-col>

        <el-col :span="12">
          <el-form-item label="天然气城市集中供热锅炉用量(万立方米)">
            <span v-if="detailInfo.fCityHeatingGasUasge">{{ detailInfo.fCityHeatingGasUasge }}</span>
            <span v-else>-</span>
          </el-form-item>
        </el-col>

        <el-col :span="12">
          <el-form-item label="天然气汽车用户用量(万立方米)">
            <span v-if="detailInfo.fCarGasUsage">{{ detailInfo.fCarGasUsage }}</span>
            <span v-else>-</span>
          </el-form-item>
        </el-col>

        <el-col :span="12">
          <el-form-item label="出售给其他燃气企业的天然气量(万立方米)">
            <span v-if="detailInfo.fSoldGasVolume">{{ detailInfo.fSoldGasVolume }}</span>
            <span v-else>-</span>
          </el-form-item>
        </el-col>

        <el-col :span="12">
          <el-form-item label="天然气总气量(万立方米)">
            <span v-if="detailInfo.fGasUsage">{{ detailInfo.fGasUsage }}</span>
            <span v-else>-</span>
          </el-form-item>
        </el-col>


        <el-col :span="12">
          <el-form-item label="液化石油气城镇居民用量(万立方米)">
            <span v-if="detailInfo.fUrbanLpgUsage">{{ detailInfo.fUrbanLpgUsage }}</span>
            <span v-else>-</span>
          </el-form-item>
        </el-col>

        <el-col :span="12">
          <el-form-item label="液化石油气农村居民用量(吨)">
            <span v-if="detailInfo.fRuralLpgUsage">{{ detailInfo.fRuralLpgUsage }}</span>
            <span v-else>-</span>
          </el-form-item>
        </el-col>


        <el-col :span="12">
          <el-form-item label="液化石油气工业用量(吨)">
            <span v-if="detailInfo.fIndustrialLpgUsage">{{ detailInfo.fIndustrialLpgUsage }}</span>
            <span v-else>-</span>
          </el-form-item>
        </el-col>

        <el-col :span="12">
          <el-form-item label="液化石油气商业用量(吨)">
            <span v-if="detailInfo.fCommercialLpgUsage">{{ detailInfo.fCommercialLpgUsage }}</span>
            <span v-else>-</span>
          </el-form-item>
        </el-col>


        <el-col :span="12">
          <el-form-item label="液化石油气公福用量(吨)">
            <span v-if="detailInfo.fPublicLpgUsage">{{ detailInfo.fPublicLpgUsage }}</span>
            <span v-else>-</span>
          </el-form-item>
        </el-col>

        <el-col :span="12">
          <el-form-item label="液化石油气汽车用户用量(吨)">
            <span v-if="detailInfo.fCarLpgUsage">{{ detailInfo.fCarLpgUsage }}</span>
            <span v-else>-</span>
          </el-form-item>
        </el-col>


        <el-col :span="12">
          <el-form-item label="出售或调拨给其他燃气企业液化石油气量(吨)">
            <span v-if="detailInfo.fSoldLpgVolume">{{ detailInfo.fSoldLpgVolume }}</span>
            <span v-else>-</span>
          </el-form-item>
        </el-col>


        <el-col :span="12">
          <el-form-item label="液化石油气总量(吨)">
            <span v-if="detailInfo.fLpgUsage">{{ detailInfo.fLpgUsage }}</span>
            <span v-else>-</span>
          </el-form-item>
        </el-col>

        <el-col :span="12">
          <el-form-item label="创建时间">
            <span v-if="detailInfo.fCreateTime">{{ detailInfo.fCreateTime }}</span>
            <span v-else>-</span>
          </el-form-item>
        </el-col>

        <el-col :span="12">
          <el-form-item label="最后修改时间">
            <span v-if="detailInfo.fUpdateTime">{{ detailInfo.fUpdateTime }}</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.fReportTime }}</span>
            </el-form-item>
          </el-col>   
         
      </el-row>
    </el-form>


  </el-dialog>

</template>

<script>
  import { getDay } from "@/api/supplybalance/day";
  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){
        getDay(id).then(res =>{
          if(res.code == 200 && res.data){
            this.detailInfo = res.data;
            this.showUploadType();
            this.showUploadTime();
            this.detailOpen = true;
          }
        })
      }
    }
  }
</script>

<style scoped>

</style>
