diff --git a/snowy-admin-web/src/components/DictColorPicker/index.vue b/snowy-admin-web/src/components/DictColorPicker/index.vue
new file mode 100644
index 00000000..cac4a06c
--- /dev/null
+++ b/snowy-admin-web/src/components/DictColorPicker/index.vue
@@ -0,0 +1,85 @@
+
+
+
+
+
+
+
+
diff --git a/snowy-admin-web/src/utils/tool.js b/snowy-admin-web/src/utils/tool.js
index efb97d1b..be09361b 100644
--- a/snowy-admin-web/src/utils/tool.js
+++ b/snowy-admin-web/src/utils/tool.js
@@ -106,6 +106,24 @@ tool.dictTypeData = (dictValue, value) => {
return dict ? dict.dictLabel : ''
}
+// 字典翻译color方法,界面插槽使用方法,一般建议配合自定义标签组件使用 {{ $TOOL.dictTypeDataColor('sex', record.sex) }}
+tool.dictTypeDataColor = (dictValue, value) => {
+ const dictTypeTree = tool.dictDataAll()
+ if (!dictTypeTree) {
+ return '需重新登录'
+ }
+ const tree = dictTypeTree.find((item) => item.dictValue === dictValue)
+ if (!tree) {
+ return ''
+ }
+ const children = tree.children
+ if (!tree.children) {
+ return ''
+ }
+ const dict = children.find((item) => item.dictValue === value)
+ return dict ? dict.dictColor : ''
+}
+
// 获取某个code下字典的列表,多用于字典下拉框
tool.dictTypeList = (dictValue) => {
const dictTypeTree = tool.dictDataAll()
@@ -135,6 +153,7 @@ tool.dictList = (dictValue) => {
return tree.children.map((item) => {
return {
value: item['dictValue'],
+ color: item['dictColor'],
label: item['name']
}
})
diff --git a/snowy-admin-web/src/views/dev/dict/category/form.vue b/snowy-admin-web/src/views/dev/dict/category/form.vue
index ff117f00..652876a6 100644
--- a/snowy-admin-web/src/views/dev/dict/category/form.vue
+++ b/snowy-admin-web/src/views/dev/dict/category/form.vue
@@ -36,6 +36,9 @@
:disabled="formData.parentId === '0'"
/>
+
+
+
@@ -48,6 +51,7 @@