优化 uitls/ruoyi.js 中 selectDictLabel 方法,数组迭代器换为 some
提高性能
正在显示
1 个修改的文件
包含
3 行增加
和
3 行删除
| @@ -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 | + |
-
请 注册 或 登录 后发表评论