<template>
  <div class="visual-con">
    <!--头部-->
    <vheader></vheader>
    <!--主体-->
    <div class="visual-body">
      <button @click="showResourcesDialog"
              style="position: absolute; left:50%;top: 50vh; transform: translateX(-50%);">
      </button>
      <!-- 弹层 -->
      <el-dialog title="资源详情" :visible.sync="eventDialog" customClass="diaWidth" v-if="eventDialog" @close="cancelEventShow()">
        <div class="dia-event-info">
          <el-form>
            <el-form-item label="名称">
              <el-input v-model="name" readonly placeholder="未查询到数据"/>
            </el-form-item>
            <el-form-item label="用途" v-if="label=='warning_sign'">
              <el-input v-model="effect" readonly placeholder="未查询到数据"/>
            </el-form-item>
            <el-form-item label="设置时间" v-if="label=='warning_sign'">
              <el-input v-model="setTime" readonly placeholder="未查询到数据"/>
            </el-form-item>
            <el-form-item label="竣工日期" v-if="label!='warning_sign'">
              <el-input v-model="completionDate" readonly placeholder="未查询到数据"/>
            </el-form-item>
            <el-form-item label="养护单位" v-if="label!='warning_sign'">
              <el-input v-model="maintenanceUnit" readonly placeholder="未查询到数据"/>
            </el-form-item>
            <el-form-item label="联系电话" v-if="label!='warning_sign'">
              <el-input v-model="mainTel" readonly placeholder="未查询到数据"/>
            </el-form-item>
            <el-form-item label="管理单位" v-if="label!='warning_sign'">
              <el-input v-model="managementUnit" readonly placeholder="未查询到数据"/>
            </el-form-item>
            <el-form-item label="联系电话" v-if="label!='warning_sign'">
              <el-input v-model="manaTel" readonly placeholder="未查询到数据"/>
            </el-form-item>
            <el-form-item label="备注">
              <el-input v-model="remark" :autosize="{minRows:2,maxRows:5}" readonly placeholder="未查询到数据" type="textarea"/>
            </el-form-item>
          </el-form>
        </div>
      </el-dialog>
    </div>
  </div>
</template>

<script>
import {
  selectResourcesByIdLabel
} from '@/api/resources'
export default {
  dicts: ['task_source'],
  watch: {},
  components: {},
  data() {
    return {
      id: null,
      label: null,
      eventDialog: false,
      name:"",
      effect:"",
      setTime:"",
      completionDate:"",
      maintenanceUnit:"",
      mainTel:"",
      managementUnit:"",
      manaTel:"",
      remark:"",
    }
  },
  props: {},
  methods: {
    cancelEventShow() {
      console.log('关闭事件弹窗')
      this.eventLogList = []
    },
    showResourcesDialog(param) {
      this.id = param.split(",")[0];
      this.label = param.split(",")[1];
      selectResourcesByIdLabel(this.id,this.label).then(res => {
        console.log(this.label)
        this.name = res.data.name;
        if(this.label == 'warning_sign'){
          this.effect = res.data.effect;
          this.setTime = res.data.setTime;
        }else{
          this.completionDate = res.data.completionDate;
          this.maintenanceUnit = res.data.maintenanceUnit;
          this.mainTel = res.data.mainTel;
          this.managementUnit = res.data.managementUnit;
          this.manaTel = res.data.manaTel;
        }
        this.remark = res.data.remark;
      })
      //获取事件详情
      this.eventDialog = true
    }
  }
}
</script>
