From 2111e14e317fd25d7f66cf18f69c2efb1526cc93 Mon Sep 17 00:00:00 2001 From: xingyu Date: Mon, 24 Apr 2023 20:13:08 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96dict=20tag=20?= =?UTF-8?q?=E9=A2=9C=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/DictTag/src/DictTag.vue | 19 +++++++++--- src/views/system/dict/dict.data.ts | 43 +++++++++++++++++++++----- 2 files changed, 50 insertions(+), 12 deletions(-) diff --git a/src/components/DictTag/src/DictTag.vue b/src/components/DictTag/src/DictTag.vue index dcca5db5..2f17cf55 100644 --- a/src/components/DictTag/src/DictTag.vue +++ b/src/components/DictTag/src/DictTag.vue @@ -19,7 +19,8 @@ export default defineComponent({ type: String as PropType, required: false, default: () => 'number' - } + }, + icon: { type: String } }, setup(props) { const dictData = ref() @@ -34,8 +35,8 @@ export default defineComponent({ } dictOptions.forEach((dict: DictDataType) => { if (dict.value === value) { - if (dict.colorType + '' === 'primary' || dict.colorType + '' === 'default') { - dict.colorType = '' + if (dict.colorType + '' === 'primary' || dict.colorType + '' === 'info') { + dict.colorType = 'processing' } dictData.value = dict } @@ -50,9 +51,17 @@ export default defineComponent({ return null } getDictObj(props.type, props.value.toString()) - // 添加标签的文字颜色为白色,解决自定义背景颜色时标签文字看不清的问题 + // 添加标签的文字颜色为白色,解决自定义背景颜色时标签文字看不清的问题 && isHexColor(dictData.value?.cssClass) return ( - + {dictData.value?.label} ) diff --git a/src/views/system/dict/dict.data.ts b/src/views/system/dict/dict.data.ts index db5b1203..7030490b 100644 --- a/src/views/system/dict/dict.data.ts +++ b/src/views/system/dict/dict.data.ts @@ -121,11 +121,11 @@ export const dataFormSchema: FormSchema[] = [ componentProps: { options: [ { - value: 'default', - label: '默认' + value: '', + label: '空' }, { - value: 'primary', + value: 'processing', label: '主要' }, { @@ -133,16 +133,44 @@ export const dataFormSchema: FormSchema[] = [ label: '成功' }, { - value: 'info', - label: '信息' + value: 'default', + label: '默认' }, { value: 'warning', label: '警告' }, { - value: 'danger', + value: 'error', label: '危险' + }, + { + value: 'pink', + label: 'pink' + }, + { + value: 'red', + label: 'red' + }, + { + value: 'orange', + label: 'orange' + }, + { + value: 'green', + label: 'green' + }, + { + value: 'cyan', + label: 'cyan' + }, + { + value: 'blue', + label: 'blue' + }, + { + value: 'purple', + label: 'purple' } ] } @@ -150,7 +178,8 @@ export const dataFormSchema: FormSchema[] = [ { label: 'CSS Class', field: 'cssClass', - component: 'Input' + component: 'Input', + helpMessage: '输入hex模式的颜色,例如#108ee9' }, { label: '备注',