|
@@ -7,13 +7,17 @@ interface Option {
|
|
|
listValue: string
|
|
|
}
|
|
|
|
|
|
-const defaultValue: Option = {listCode: 'code', listValue: 'name'}
|
|
|
+const defaultValue: Option = {
|
|
|
+ listCode: 'code',
|
|
|
+ listValue: 'name'
|
|
|
+}
|
|
|
|
|
|
/**
|
|
|
*
|
|
|
* @param arr 数组
|
|
|
* @param code 需要寻找的值
|
|
|
* @param option 配置
|
|
|
+ * @return str {string} name
|
|
|
*/
|
|
|
const findValueByListCode = (arr: any[] | object, code: string | number, option: Option = defaultValue): string => {
|
|
|
const {listCode, listValue} = option
|
|
@@ -25,7 +29,6 @@ const findValueByListCode = (arr: any[] | object, code: string | number, option:
|
|
|
return '';
|
|
|
}
|
|
|
|
|
|
-
|
|
|
if (typeof code === 'undefined' || code === null) {
|
|
|
return '';
|
|
|
}
|