【add】-大屏:来款部分 + 制修订第一个模块

This commit is contained in:
fengchenchen
2022-12-01 10:38:00 +08:00
parent 820d06fd28
commit c5b7cff177
38 changed files with 3330 additions and 13 deletions
+33 -1
View File
@@ -679,4 +679,36 @@ export function processingTimestamp(value) {
minute = minute < 10 ? ('0' + minute) : minute
second = second < 10 ? ('0' + second) : second
return y + '-' + m + '-' + d + ' ' + h + ':' + minute + ':' + second
}
}
function isObject (obj) {
return Object.prototype.toString.call(obj) === '[object Object]'
}
function isArray (arr) {
return Array.isArray(arr)
}
// 深度合并功能
export function deepMerge (target, ...arg) {
return arg.reduce((acc, cur) => {
return Object.keys(cur).reduce((subAcc, key) => {
const srcVal = cur[key]
if (isObject(srcVal)) {
subAcc[key] = deepMerge(subAcc[key] ? subAcc[key] : {}, srcVal)
} else if (isArray(srcVal)) {
// series: [],下层数组直接赋值
subAcc[key] = srcVal.map((item, idx) => {
if (isObject(item)) {
const curAccVal = subAcc[key] ? subAcc[key] : []
return deepMerge(curAccVal[idx] ? curAccVal[idx] : {}, item)
} else {
return item
}
})
} else {
subAcc[key] = srcVal
}
return subAcc
}, acc)
}, target)
}