Browse Source

feat:标签字典渲染

feature/tsjb-1.0
parent
commit
79ce29d984
  1. 33
      src/components/negative/description.vue

33
src/components/negative/description.vue

@ -64,7 +64,7 @@
</div>
<div class="col col-6" v-if="negative.sourceType === '2' && negative.currentRow?.tag">
<label>标签</label>
<span>{{ getDictLable(dict.sfssTags, negative.currentRow.tag) }}</span>
<span>{{ getDictLabel(dict.sfssTags, negative.currentRow.tag) }}</span>
</div>
<div class="col col-6" v-if="negative.sourceType === '2' && negative.currentRow?.handleMethod">
<label>办理方式</label>
@ -102,6 +102,37 @@ const dict = catchSotre.getDicts([
"specialSupervision", "suspectProblem", "yesNo", "sfssTags", "handleMethodType"
]);
function getDictLabel(list, value) {
if (!Array.isArray(list)) return '/'
if (value === null || value === undefined || value === '') return '/'
let values = []
// 1 value
if (Array.isArray(value)) {
values = value
}
// 2 value "1,2,3"
else if (typeof value === 'string' && value.includes(',')) {
values = value.split(',').map(v => v.trim())
}
// 3 string / number
else {
values = [value]
}
// 4
const labels = values
.map(v => {
const item = list.find(d => d.dictValue == v)
return item?.dictLabel
})
.filter(Boolean)
return labels.length ? labels.join(',') : '/'
}
console.log('negative',negative)
</script>
<style lang="scss" scoped>

Loading…
Cancel
Save