<template>
  <el-link type="primary" @click="handleClick" :disabled="disabled">{{name | dv}}</el-link>
</template>

<script>

import { checkPermi } from '@/utils/permission'

export default {
  name: 'OrderLink',
  props: {
    id: {
      type: String,
      default: null
    },
    name: {
      type: String,
      default: null,
    },
  },
  computed: {
    // 禁用的情况：1.没有id 2.没有权限
    disabled() {
      return this.id == null || !checkPermi(['bst:order:query']);
    }
  },
  methods: {
    handleClick() {
      this.$emit('click');
      this.$router.push(`/view/order/${this.id}`)
    }
  }
}
</script>
