fix(userManagement): 补传添加成员 relationType 并修复删除后同步空列表报错
- 一键添加本人传 relationType=1,其他添加新增传 relationType=2 - _clearAndSync 待下发列表为空时跳过 syncMembersToDevice,避免空列表 reject Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Code
parent
9332990a77
commit
9d56e63ce0
@@ -420,6 +420,7 @@ Page({
|
|||||||
|
|
||||||
const payload: Record<string, any> = {
|
const payload: Record<string, any> = {
|
||||||
...baseSpread,
|
...baseSpread,
|
||||||
|
...(editId ? {} : { relationType: 2 }),
|
||||||
dataType: userType === 'family' ? 1 : 0,
|
dataType: userType === 'family' ? 1 : 0,
|
||||||
parentUserId: userInfo?.userId ?? '',
|
parentUserId: userInfo?.userId ?? '',
|
||||||
sn: targetSn,
|
sn: targetSn,
|
||||||
|
|||||||
@@ -391,12 +391,15 @@ Page({
|
|||||||
|
|
||||||
this.setData({ syncShow: true, syncPercent: 0, syncStatus: '正在清空并重新下发...' })
|
this.setData({ syncShow: true, syncPercent: 0, syncStatus: '正在清空并重新下发...' })
|
||||||
leFuService.clearDeviceMembers()
|
leFuService.clearDeviceMembers()
|
||||||
.then(() => leFuService.syncMembersToDevice(syncDataList, (current, total) => {
|
.then(() => {
|
||||||
this.setData({
|
if (!syncDataList.length) return
|
||||||
syncPercent: Math.round((current / total) * 100),
|
return leFuService.syncMembersToDevice(syncDataList, (current, total) => {
|
||||||
syncStatus: `正在同步 ${current}/${total}...`,
|
this.setData({
|
||||||
|
syncPercent: Math.round((current / total) * 100),
|
||||||
|
syncStatus: `正在同步 ${current}/${total}...`,
|
||||||
|
})
|
||||||
})
|
})
|
||||||
}))
|
})
|
||||||
.then(() => this._finishSync(reportUsers, '重新下发成功'))
|
.then(() => this._finishSync(reportUsers, '重新下发成功'))
|
||||||
.catch((err: Error) => {
|
.catch((err: Error) => {
|
||||||
this.setData({ syncShow: false })
|
this.setData({ syncShow: false })
|
||||||
@@ -485,6 +488,7 @@ Page({
|
|||||||
if (!sn) return
|
if (!sn) return
|
||||||
|
|
||||||
addSelfUser({
|
addSelfUser({
|
||||||
|
relationType: 1,
|
||||||
dataType: 0,
|
dataType: 0,
|
||||||
parentUserId: userInfo.userId,
|
parentUserId: userInfo.userId,
|
||||||
sn,
|
sn,
|
||||||
|
|||||||
Reference in New Issue
Block a user