后端的查询和添加编辑接口得到的数据不是同一种格式,所以提交会报错,现在想要把从查询接口得到数据变为添加接口的格式(把数据分为faceUserInfo 和 roleIds)方便提交
添加接口 参数:
查询接口 参数:
{ "code": "string", "data": { "accountStatus": 0, "address": "string", "birth": "2020-04-20T05:56:33.168Z", "companyId": "string", "companyName": "string", "departmentId": "string", "departmentName": "string", "email": "string", "mobile": "string", "phone": "string", "positionId": "string", "positionName": "string", "realName": "string", "roleInfos": [ { "actionInfos": [ { "actionKey": "string", "actionName": "string", "isCategory": 0, "parentId": "string" } ], "roleKey": "string", "roleName": "string" } ], "userName": "string" }, "mesg": "string", "timestamp": "2020-04-20T05:56:33.168Z" }
这是查询接口的方法;
watch: { 'visible': { handler: function (newVal, oldVal) { console.log(newVal) if (newVal) { console.log(this.userId) if (this.userId && this.userId !== '') { getFacUserById(this.userId).then(res => { const _data = res.data // 略 this.info = _data }) } else { this.info = { //略~~~~ } } } } } },
已解决
悬赏分:40
- 解决时间 2022-01-04 13:48
点赞 0反对 0举报 0
收藏 0
分享 0
回答1
最佳
-
const facUserInfo = Object.assign({}, this.info); const roleIds = facUserInfo.roleInfos this.info.facUserInfo = facUserInfo this.info.roleIds = roleIds
支持 0 反对 0 举报2022-01-04 08:16