From 8c834663344b1cc9c2ca569e6911900edd407f73 Mon Sep 17 00:00:00 2001 From: jinlin <jinlin> Date: 星期四, 06 六月 2024 16:44:14 +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