diff --git a/project/xumu/AppAccountConfigManage/AppAccountConfigManage.vue b/project/xumu/AppAccountConfigManage/AppAccountConfigManage.vue index 1f195796..47901170 100644 --- a/project/xumu/AppAccountConfigManage/AppAccountConfigManage.vue +++ b/project/xumu/AppAccountConfigManage/AppAccountConfigManage.vue @@ -100,7 +100,7 @@ export default { - 新增根节点 @@ -108,7 +108,7 @@ export default {
增加子节点 - 删除 + 删除
@@ -120,5 +120,9 @@ export default { diff --git a/ui/lib/js/utils.js b/ui/lib/js/utils.js index fe929360..ffca0d91 100644 --- a/ui/lib/js/utils.js +++ b/ui/lib/js/utils.js @@ -15,12 +15,12 @@ import $reg from "./regular" */ const addChild = (parent, pending, config) => { let conf = { - key: 'id', - parent: 'parentId', - children: 'children', - ...config - }, - doBeforeCount = pending.length + key: 'id', + parent: 'parentId', + children: 'children', + ...config + }, + doBeforeCount = pending.length for (let i = pending.length - 1; i >= 0; i--) { let e = pending[i] if (e[conf.parent] == parent[conf.key]) { @@ -58,7 +58,7 @@ const $decimalCalc = (...arr) => { return ('' + e).length - index }) let maxDecimal = Math.max(...decimalLengthes), - precision = Math.pow(10, maxDecimal) + precision = Math.pow(10, maxDecimal) // 计算 let intArr = arr.map(e => (Number(e) || 0) * precision) // 返回计算值 @@ -86,10 +86,10 @@ const $colorUtils = { if (color.length == 4) { // 检测诸如#FFF简写格式 color = - '#' + - color.charAt(1).repeat(2) + - color.charAt(2).repeat(2) + - color.charAt(3).repeat(2) + '#' + + color.charAt(1).repeat(2) + + color.charAt(2).repeat(2) + + color.charAt(3).repeat(2) } hex = parseInt(color.slice(1), 16) } @@ -170,8 +170,8 @@ export default { }, $dateFormat: (time, format) => { return $moment(time) - .format(format || 'YYYY-MM-DD') - .replace('Invalid Date', '') + .format(format || 'YYYY-MM-DD') + .replace('Invalid Date', '') }, $copy, $download: (url, name) => { @@ -190,7 +190,7 @@ export default { $arr2tree: (list, config = {}) => { let result = [] const {key = 'id', parent = 'parentId', children = 'children'} = config, itemMap = {}, - ids = list?.map(e => `#${e[key]}#`)?.toString() + ids = list?.map(e => `#${e[key]}#`)?.toString() for (const e of list) { const id = e[key], pid = e[parent] itemMap[id] = {...e, [children]: [itemMap[id]?.[children]].flat().filter(Boolean)} @@ -230,5 +230,11 @@ export default { } return max } else return 0 + }, + $isEmpty(obj) { + if (obj === null || obj === undefined) return true; + if (typeof obj === 'string' && obj.trim() === '') return true; + if (Array.isArray(obj) && obj.length === 0) return true; + return typeof obj === 'object' && Object.keys(obj).length === 0; } }