jinlin
2024-06-06 8c834663344b1cc9c2ca569e6911900edd407f73
web/packages/components/zt-dict-tag/src/zt-dict-tag.vue
@@ -1,5 +1,5 @@
<template>
  <el-tag :color="tagColor"  v-if="$store.getters.getDictLabel(dict, value)!=null" :type="tagType" :size="size" :effect="effect" :hit="hit">{{$store.getters.getDictLabel(dict, value)}}
  <el-tag :color="tagColor" :type="tagType" :size="size" :effect="effect" :hit="hit">{{dictLabel}}
  </el-tag>
</template>
<script>
@@ -9,6 +9,12 @@
      dict: { // 字典类型
        type: String,
        required: true
      },
      additional: {// 添加的
        type: Array,
        default: function () {
          return []
        }
      },
      value: [String, Number, Boolean],
      typeS: String,
@@ -39,6 +45,19 @@
    mounted() {
      this.init()
    },
    computed: {
      dictLabel() {
        let result = this.$store.getters.getDictLabel(this.dict, this.value)
        if ("" + result == "" + this.value) {
          for (let item of this.additional) {
            if (item.dictValue == "" + this.value) {
              result = item.dictLabel
            }
          }
        }
        return result
      }
    },
    methods: {
      async init() {
        let value = this.value + ''