fix(addMember): 员工编号查询结果保存完整数据,提交时作为 base 合并
员工 tab 提交时使用 employeeQueryResult(getUserInfoByWkno 返回的完整数据) 作为 payload base,确保 userId、deviceId 等字段不丢失。 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
24fda6becc
commit
9b669aa486
@@ -114,6 +114,8 @@ Page({
|
||||
employeeNotFound: false,
|
||||
/** 部门展示文案 */
|
||||
unitDisplay: '',
|
||||
/** 员工编号查询返回的完整数据,提交时作为 base 合并 */
|
||||
employeeQueryResult: null as Record<string, any> | null,
|
||||
},
|
||||
|
||||
/** tabs 切换:清空查询结果、重置表单 */
|
||||
@@ -124,6 +126,7 @@ Page({
|
||||
employeeQueried: false,
|
||||
employeeNotFound: false,
|
||||
unitDisplay: '',
|
||||
employeeQueryResult: null,
|
||||
readonly: false,
|
||||
hasQueried: false,
|
||||
serverResult: null,
|
||||
@@ -147,6 +150,7 @@ Page({
|
||||
employeeQueried: false,
|
||||
employeeNotFound: false,
|
||||
unitDisplay: '',
|
||||
employeeQueryResult: null,
|
||||
'form.name': '',
|
||||
'form.gender': '',
|
||||
'form.age': '',
|
||||
@@ -177,6 +181,7 @@ Page({
|
||||
employeeQueried: true,
|
||||
employeeNotFound: true,
|
||||
unitDisplay: '',
|
||||
employeeQueryResult: null,
|
||||
'form.name': '',
|
||||
'form.gender': '',
|
||||
'form.age': '',
|
||||
@@ -191,6 +196,7 @@ Page({
|
||||
this.setData({
|
||||
employeeQueried: true,
|
||||
employeeNotFound: false,
|
||||
employeeQueryResult: result,
|
||||
unitDisplay: [result.secondDepart, result.thirdDepart].filter(Boolean).join(' / '),
|
||||
'form.name': result.realname || '',
|
||||
'form.idCard': idCard,
|
||||
@@ -207,6 +213,7 @@ Page({
|
||||
employeeQueried: true,
|
||||
employeeNotFound: true,
|
||||
unitDisplay: '',
|
||||
employeeQueryResult: null,
|
||||
})
|
||||
})
|
||||
.finally(() => {
|
||||
@@ -462,15 +469,17 @@ Page({
|
||||
|
||||
const userInfo = wx.getStorageSync('userInfo')
|
||||
const connectDeviceInfoRaw = wx.getStorageSync('connectDeviceInfo')
|
||||
const serverResult = this.data.serverResult
|
||||
|
||||
const baseSpread = userType === 'family' ? (this.data.selectedMember ?? {}) : {}
|
||||
// 员工:以查询接口返回为 base;家庭:以选中的已有用户 + 身份证查询结果为 base
|
||||
const baseSpread = userType === 'employee'
|
||||
? (this.data.employeeQueryResult ?? {})
|
||||
: { ...(this.data.selectedMember ?? {}), ...(this.data.serverResult ?? {}) }
|
||||
|
||||
const birthday = this.data.birthday
|
||||
const finalSex = userType === 'family' ? sex : this.data.form.sex
|
||||
|
||||
const payload: Record<string, any> = {
|
||||
...(baseSpread),
|
||||
...(serverResult ?? {}),
|
||||
dataType: userType === 'family' ? 1 : 0,
|
||||
parentUserId: userInfo?.userId ?? '',
|
||||
sn: lefuService.deviceInfo?.serialNumber ?? '',
|
||||
|
||||
Reference in New Issue
Block a user