let obj = {
"email": {
"col": "j",
"title": "邮箱",
"width": 13
},
"phone": {
"col": "i",
"title": "联系电话",
"width": 13
},
"reply": {
"col": "l",
"title": "回复意见",
"width": 20
},
"handle": {
"col": "g",
"title": "处理方式",
"width": 10
},
"number": {
"col": "c",
"title": "投诉单号",
"width": 22
},
"status": {
"col": "n",
"title": "是否完成"
},
"content": {
"col": "k",
"title": "投诉内容",
"width": 50
},
"_NUMBER_": {
"col": "a",
"title": "序号"
},
"username": {
"col": "d",
"title": "用户账号",
"width": 13
},
"reply_time": {
"col": "m",
"title": "回复时间"
},
"create_time": {
"col": "b",
"title": "创建时间",
"width": 18
},
"order_number": {
"col": "e",
"title": "订单号码",
"width": 22
},"problem": {
"col": "e",
"title": "问题类型",
"width": 8
},
"refund_amount": {
"col": "h",
"title": "退款总金额"
},
"detail.goods_qty": {
"col": "s",
"title": "购买数量"
},
"detail.goods_name": {
"col": "o",
"title": "商品名称",
"width": 20
},
"detail.refund_qty": {
"col": "u",
"title": "退款数量"
},
"detail.goods_model": {
"col": "p",
"title": "规格型号"
},
"detail.goods_price": {
"col": "q",
"title": "购买单价"
},
"detail.payable_price": {
"col": "r",
"title": "实付单价"
},
"detail.refund_amount": {
"col": "v",
"title": "退款金额"
},
"detail.payable_amount": {
"col": "t",
"title": "实付金额"
}
}
const xArr = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'];
let arr = [], obj1 = {}
for (let i in obj) {
let item = obj[i]
item.i = i
arr.push(item)
}
// console.log(arr);
console.log(
arr.sort((a, b) => {
return a.col.localeCompare(b.col);
}).map((item, i) => {
item.col = xArr[i]
// delete item.i
let obj = {
...item
}
delete obj.i
obj1[item.i] = obj
return item.title
}))
console.log(obj1)
console