From 95689baff9fde5a24a93948c42a2e945a1a8f4e0 Mon Sep 17 00:00:00 2001 From: aixianling Date: Tue, 7 Jan 2025 10:17:59 +0800 Subject: [PATCH] =?UTF-8?q?feat(AppAccountConfigManage):=20=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E8=AE=A4=E8=AF=81=E6=9D=90=E6=96=99=E5=AF=B9=E8=AF=9D?= =?UTF-8?q?=E6=A1=86=E6=A0=B7=E5=BC=8F=E5=92=8C=E5=8A=9F=E8=83=BD-=20?= =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=AF=B9=E8=AF=9D=E6=A1=86=E5=AE=BD=E5=BA=A6?= =?UTF-8?q?=E4=B8=BA=2050vw=EF=BC=8C=E4=BD=BF=E7=95=8C=E9=9D=A2=E6=9B=B4?= =?UTF-8?q?=E5=8A=A0=E5=93=8D=E5=BA=94=E5=BC=8F=20-=20=E4=B8=BA=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E6=8C=89=E9=92=AE=E6=B7=BB=E5=8A=A0=20v-if=20?= =?UTF-8?q?=E6=8C=87=E4=BB=A4=EF=BC=8C=E4=BB=85=E5=9C=A8=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E5=AD=90=E8=8A=82=E7=82=B9=E6=97=B6=E6=98=BE=E7=A4=BA=20-=20?= =?UTF-8?q?=E4=B8=BA=E5=88=A0=E9=99=A4=E6=8C=89=E9=92=AE=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=20del=20=E7=B1=BB=EF=BC=8C=E4=BB=A5=E5=BA=94=E7=94=A8=E7=89=B9?= =?UTF-8?q?=E5=AE=9A=E6=A0=B7=E5=BC=8F=20-=20=E5=9C=A8=20utils.js=20?= =?UTF-8?q?=E4=B8=AD=E6=B7=BB=E5=8A=A0=20$isEmpty=E5=87=BD=E6=95=B0?= =?UTF-8?q?=EF=BC=8C=E7=94=A8=E4=BA=8E=E6=A3=80=E6=9F=A5=E5=AF=B9=E8=B1=A1?= =?UTF-8?q?=E6=98=AF=E5=90=A6=E4=B8=BA=E7=A9=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AppAccountConfigManage.vue | 8 +++-- ui/lib/js/utils.js | 34 +++++++++++-------- 2 files changed, 26 insertions(+), 16 deletions(-) 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; } }