<template>
  <el-dialog width="400px" title="型号参数" :visible.sync="isLoad.paramShow" append-to-body>
    <h3 class="lag-h3">当前型号： {{data.brand || "--"}} - {{data.name || "--"}}</h3>
    <div style="max-height: 400px;overflow-y:auto;">
      <p
        class="saga-poent"
        v-for="item in labelArr"
        v-if="!!data.infos && data.infos[item.infoPointCode]"
      >{{item.infoPointName}}：{{data.infos ? data.infos[item.infoPointCode] || "--" : "--"}}</p>
    </div>
  </el-dialog>
</template>
<script>

import { getSpaceHeader } from "@/api/scan/request"

export default {
  props: {
    isLoad: {
      type: Object,
      default: function () {
        return {
          paramShow: false
        }
      }
    },
    data: {
      type: Object,
      default: function () {
        return {
        }
      }
    }
  },
  data() {
    return {
      labelArr: []
    }
  },
  created() { },
  mounted() { },
  methods: {
    getData() {
      let param = {
        ProjId: this.$route.query.projId,
        code: this.data.eqFamily
      }
      getSpaceHeader(param).then(res => {
        if (res.data.Result == "success") {
          this.labelArr = res.data.Content.map(item => {
            if (item.firstTag == "台账信息") {
              return item
            } else {
              return undefined
            }
          }).filter(d => d)
        } else {
          this.$message.error("请求失败：" + res.data.ResultMsg)
        }
      }).catch(_ => {
        this.$message.error("请求失败")
      })
    }
  },
  watch: {
    isLoad: {
      deep: true,
      handler: function () {
        if (this.isLoad.paramShow) {
          this.getData()
        }
      }
    }
  }
}
</script>
<style lang="less" scoped>
.lag-h3 {
  height: 35px;
  line-height: 35px;
  font-size: 20px;
  font-weight: 500;
  margin-bottom: 8px;
}
.saga-poent {
  line-height: 28px;
}
</style>
