<template>
  <el-link
    :type="type"
    :underline="false"
    @click="handleClick"
  >{{ text || '--' }}</el-link>
</template>

<script>
export default {
  props: {
    id: {
      type: [String, Number],
      default: null
    },
    text: {
      type: String,
      default: ''
    },
    type: {
      type: String,
      default: "primary"
    },
    queryBySn: {
      type: Boolean,
      default: false
    }
  },
  methods: {
    handleClick() {
      const path = this.queryBySn 
        ? `/system/device/detail?sn=${this.text}`
        : `/system/device/detail/${this.id}`;
      this.$router.push(path);
    }
  }
}
</script>
