|
|
@@ -124,10 +124,13 @@ export function getAllParentKeys(treeData: Array<any>, key: string) {
|
|
|
// 获取字典值
|
|
|
export function formatDictValue(options: Array<any>, value: string) {
|
|
|
if (!value) {
|
|
|
- if (value != '0' || !options) {
|
|
|
+ if (value != '0') {
|
|
|
return '';
|
|
|
}
|
|
|
}
|
|
|
+ if (!options) {
|
|
|
+ return '';
|
|
|
+ }
|
|
|
let matchItem = '';
|
|
|
if (typeof value == 'boolean') {
|
|
|
matchItem = value ? '是' : '否';
|
|
|
@@ -140,10 +143,13 @@ export function formatDictValue(options: Array<any>, value: string) {
|
|
|
// 获取字典颜色
|
|
|
export function formatDictColor(options: Array<any>, value: string) {
|
|
|
if (!value) {
|
|
|
- if (value != '0' || !options) {
|
|
|
+ if (value != '0') {
|
|
|
return '';
|
|
|
}
|
|
|
}
|
|
|
+ if (!options) {
|
|
|
+ return '';
|
|
|
+ }
|
|
|
let matchItem = '';
|
|
|
matchItem = options.find(item => item['value'] == value);
|
|
|
return matchItem && matchItem['color'] ? matchItem['color'] : '';
|