From 3c15e684416e06a7351eeb2d756e5be778a893fd Mon Sep 17 00:00:00 2001
From: jinlin <jinlin>
Date: 星期三, 17 七月 2024 10:37:23 +0800
Subject: [PATCH] 修改
---
web/packages/components/zt-dict-tag/src/zt-dict-tag.vue | 27 +++++++++++++++++++++++----
1 files changed, 23 insertions(+), 4 deletions(-)
diff --git a/web/packages/components/zt-dict-tag/src/zt-dict-tag.vue b/web/packages/components/zt-dict-tag/src/zt-dict-tag.vue
index a294a2c..2515d69 100644
--- a/web/packages/components/zt-dict-tag/src/zt-dict-tag.vue
+++ b/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,
@@ -33,11 +39,24 @@
return {
tagType: 'primary',
tagColor: '',
- colorArr:['primary','success','info','warning','danger']
+ colorArr: ['primary', 'success', 'info', 'warning', 'danger']
}
},
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() {
@@ -61,8 +80,8 @@
if (!this.typeS && !this.typeI && !this.typeW && !this.typeD && !this.typeColor) { // 娌℃湁鎸囧畾棰滆壊
if (this.value === false || this.value === 0 || this.value === '0' || this.value === 'false') {
this.tagType = 'primary'
- }else{
- this.tagType = this.colorArr[this.value%5]
+ } else {
+ this.tagType = this.colorArr[this.value % 5]
}
}
}
--
Gitblit v1.9.1