Selaa lähdekoodia

fix: 加入获取字典前缀颜色方法

Tong 2 vuotta sitten
vanhempi
commit
b0a1f705ea
1 muutettua tiedostoa jossa 15 lisäystä ja 0 poistoa
  1. 15 0
      src/utils/index.ts

+ 15 - 0
src/utils/index.ts

@@ -187,6 +187,21 @@ export function formatDictFontColor(options: Array<any>, value: string) {
   return matchItem && matchItem['fontColor'] ? matchItem['fontColor'] : '';
 }
 
+// 获取字段前缀颜色
+export function formatDictPreColor(options: Array<any>, value: string) {
+  if (!value) {
+    if (value != '0') {
+      return '';
+    }
+  }
+  if (!options) {
+    return '';
+  }
+  let matchItem = '';
+  matchItem = options.find(item => item['value'] == value);
+  return matchItem && matchItem['prefixColor'] ? matchItem['prefixColor'] : '';
+}
+
 // 获取字典数组
 export function formatDictTags(options: Array<any>, value: Array<any>) {
   if (!value.length) {