作者 fungleo

优化 uitls/ruoyi.js 中 selectDictLabel 方法,数组迭代器换为 some

提高性能
@@ -68,10 +68,10 @@ export function addDateRange(params, dateRange) { @@ -68,10 +68,10 @@ export function addDateRange(params, dateRange) {
68 // 回显数据字典 68 // 回显数据字典
69 export function selectDictLabel(datas, value) { 69 export function selectDictLabel(datas, value) {
70 var actions = []; 70 var actions = [];
71 - Object.keys(datas).map((key) => { 71 + Object.keys(datas).some((key) => {
72 if (datas[key].dictValue == ('' + value)) { 72 if (datas[key].dictValue == ('' + value)) {
73 actions.push(datas[key].dictLabel); 73 actions.push(datas[key].dictLabel);
74 - return false; 74 + return true;
75 } 75 }
76 }) 76 })
77 return actions.join(''); 77 return actions.join('');
@@ -131,4 +131,4 @@ export function handleTree(data, id, parentId, children, rootId) { @@ -131,4 +131,4 @@ export function handleTree(data, id, parentId, children, rootId) {
131 }); 131 });
132 return treeData != '' ? treeData : data; 132 return treeData != '' ? treeData : data;
133 } 133 }
134 -  
  134 +