提交 0f7657a4 authored 作者: 姚鑫国's avatar 姚鑫国

优化 upObjKey 函数

上级 df7cd9cf
...@@ -758,7 +758,9 @@ export function upObjKey(obj, setKey = {}, defaultValue = "") { ...@@ -758,7 +758,9 @@ export function upObjKey(obj, setKey = {}, defaultValue = "") {
obj, e, newKey, type, timeFormat, defaultValue obj, e, newKey, type, timeFormat, defaultValue
}) })
}; };
delete nowObj[e]; if (e != newKey) {
delete nowObj[e];
}
} }
} }
if (objType === "[object Array]" && Array.isArray(obj) && obj.length > 0) { if (objType === "[object Array]" && Array.isArray(obj) && obj.length > 0) {
...@@ -774,7 +776,9 @@ export function upObjKey(obj, setKey = {}, defaultValue = "") { ...@@ -774,7 +776,9 @@ export function upObjKey(obj, setKey = {}, defaultValue = "") {
obj: v, e, newKey, type, timeFormat, defaultValue obj: v, e, newKey, type, timeFormat, defaultValue
}) })
}; };
delete newJson[e]; if (e != newKey) {
delete newJson[e];
}
} }
nowObj.push(newJson); nowObj.push(newJson);
}) })
...@@ -821,6 +825,7 @@ function getSetKeyJson({ ...@@ -821,6 +825,7 @@ function getSetKeyJson({
// delete obj[e]; // delete obj[e];
switch (type) { switch (type) {
case "time": case "time":
debugger
newKeyObj[newKey] = (timeFormat && value ? moment(value).format(timeFormat) : value) || defaultValue; newKeyObj[newKey] = (timeFormat && value ? moment(value).format(timeFormat) : value) || defaultValue;
break; break;
default: default:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论