feat(AppAccountConfigManage): 优化认证材料对话框样式和功能- 调整对话框宽度为 50vw,使界面更加响应式

- 为删除按钮添加 v-if 指令,仅在没有子节点时显示
- 为删除按钮添加 del 类,以应用特定样式
- 在 utils.js 中添加 $isEmpty函数,用于检查对象是否为空
This commit is contained in:
aixianling
2025-01-07 10:17:59 +08:00
parent d39650eca5
commit 95689baff9
2 changed files with 26 additions and 16 deletions

View File

@@ -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;
}
}