From 9b669aa486b8ea0f3d897a1ff4227fb12b572787 Mon Sep 17 00:00:00 2001 From: 17792275749 <812100002@qq.com> Date: Fri, 12 Jun 2026 18:09:44 +0800 Subject: [PATCH] =?UTF-8?q?fix(addMember):=20=E5=91=98=E5=B7=A5=E7=BC=96?= =?UTF-8?q?=E5=8F=B7=E6=9F=A5=E8=AF=A2=E7=BB=93=E6=9E=9C=E4=BF=9D=E5=AD=98?= =?UTF-8?q?=E5=AE=8C=E6=95=B4=E6=95=B0=E6=8D=AE=EF=BC=8C=E6=8F=90=E4=BA=A4?= =?UTF-8?q?=E6=97=B6=E4=BD=9C=E4=B8=BA=20base=20=E5=90=88=E5=B9=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 员工 tab 提交时使用 employeeQueryResult(getUserInfoByWkno 返回的完整数据) 作为 payload base,确保 userId、deviceId 等字段不丢失。 Co-Authored-By: Claude Opus 4.7 --- miniprogram/pages/addMember/addMember.ts | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/miniprogram/pages/addMember/addMember.ts b/miniprogram/pages/addMember/addMember.ts index 918fc81..1666c53 100644 --- a/miniprogram/pages/addMember/addMember.ts +++ b/miniprogram/pages/addMember/addMember.ts @@ -114,6 +114,8 @@ Page({ employeeNotFound: false, /** 部门展示文案 */ unitDisplay: '', + /** 员工编号查询返回的完整数据,提交时作为 base 合并 */ + employeeQueryResult: null as Record | 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 = { ...(baseSpread), - ...(serverResult ?? {}), dataType: userType === 'family' ? 1 : 0, parentUserId: userInfo?.userId ?? '', sn: lefuService.deviceInfo?.serialNumber ?? '',