作者 RuoYi

空值不进行回显数据字典

  1 +
  2 +
1 /** 3 /**
2 * 通用js方法封装处理 4 * 通用js方法封装处理
3 * Copyright (c) 2019 ruoyi 5 * Copyright (c) 2019 ruoyi
@@ -16,7 +18,7 @@ export function parseTime(time, pattern) { @@ -16,7 +18,7 @@ export function parseTime(time, pattern) {
16 if ((typeof time === 'string') && (/^[0-9]+$/.test(time))) { 18 if ((typeof time === 'string') && (/^[0-9]+$/.test(time))) {
17 time = parseInt(time) 19 time = parseInt(time)
18 } else if (typeof time === 'string') { 20 } else if (typeof time === 'string') {
19 - time = time.replace(new RegExp(/-/gm), '/').replace('T', ' ').replace(new RegExp(/\.[\d]{3}/gm),''); 21 + time = time.replace(new RegExp(/-/gm), '/').replace('T', ' ').replace(new RegExp(/\.[\d]{3}/gm), '');
20 } 22 }
21 if ((typeof time === 'number') && (time.toString().length === 10)) { 23 if ((typeof time === 'number') && (time.toString().length === 10)) {
22 time = time * 1000 24 time = time * 1000
@@ -80,6 +82,9 @@ export function selectDictLabel(datas, value) { @@ -80,6 +82,9 @@ export function selectDictLabel(datas, value) {
80 82
81 // 回显数据字典(字符串数组) 83 // 回显数据字典(字符串数组)
82 export function selectDictLabels(datas, value, separator) { 84 export function selectDictLabels(datas, value, separator) {
  85 + if(value === undefined) {
  86 + return "";
  87 + }
83 var actions = []; 88 var actions = [];
84 var currentSeparator = undefined === separator ? "," : separator; 89 var currentSeparator = undefined === separator ? "," : separator;
85 var temp = value.split(currentSeparator); 90 var temp = value.split(currentSeparator);
@@ -124,7 +129,7 @@ export function mergeRecursive(source, target) { @@ -124,7 +129,7 @@ export function mergeRecursive(source, target) {
124 } else { 129 } else {
125 source[p] = target[p]; 130 source[p] = target[p];
126 } 131 }
127 - } catch(e) { 132 + } catch (e) {
128 source[p] = target[p]; 133 source[p] = target[p];
129 } 134 }
130 } 135 }