feat(userManagement): 运维模式隐藏一键添加本人并优化本人卡片与同步弹框

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
17792275749
2026-09-02 18:29:08 +08:00
co-authored by Claude Opus 4.7
parent e595ff9f64
commit 00394bf8c4
2 changed files with 31 additions and 27 deletions
@@ -95,7 +95,8 @@ Page({
groups: [] as GroupItem[], groups: [] as GroupItem[],
syncShow: false, syncShow: false,
syncPercent: 0, syncPercent: 0,
syncStatus: '' syncStatus: '',
isOps: false
}, },
onLoad(options: Record<string, string>) { onLoad(options: Record<string, string>) {
@@ -111,6 +112,7 @@ Page({
'device.deviceId': targetDevice.deviceId, 'device.deviceId': targetDevice.deviceId,
'device.sn': targetDevice.sn, 'device.sn': targetDevice.sn,
'device.status': targetDevice.connected, 'device.status': targetDevice.connected,
isOps: getApp<IAppOption>().globalData.operationsEngineer ?? false,
}) })
this._subscribeDeviceState() this._subscribeDeviceState()
this._loadMembers() this._loadMembers()
@@ -258,7 +260,7 @@ Page({
/** 同步完成后的统一处理:上报后刷新列表 + 关闭弹框 */ /** 同步完成后的统一处理:上报后刷新列表 + 关闭弹框 */
_finishSync(reportUsers: SyncUser[] | null, successText: string) { _finishSync(reportUsers: SyncUser[] | null, successText: string) {
this.setData({ syncPercent: 100, syncStatus: '同步完成' }) this.setData({ syncPercent: 100, syncStatus: '同步完成' })
wx.showToast({ title: successText, icon: 'success' }) // wx.showToast({ title: successText, icon: 'success' })
if (reportUsers && reportUsers.length && targetDevice?.sn) { if (reportUsers && reportUsers.length && targetDevice?.sn) {
const syncedIds = reportUsers.map(u => u.userId).filter(Boolean) const syncedIds = reportUsers.map(u => u.userId).filter(Boolean)
if (syncedIds.length) { if (syncedIds.length) {
@@ -271,7 +273,7 @@ Page({
syncCloseTimer = setTimeout(() => { syncCloseTimer = setTimeout(() => {
syncCloseTimer = null syncCloseTimer = null
this.setData({ syncShow: false }) this.setData({ syncShow: false })
}, 1000) }, 1500)
}, },
/** 同步用户至设备:有删除标记则清空重下发,否则只下发「待同步」 */ /** 同步用户至设备:有删除标记则清空重下发,否则只下发「待同步」 */
@@ -54,12 +54,12 @@
<view>{{ self.sync }}</view> <view>{{ self.sync }}</view>
</view> </view>
</view> </view>
<block wx:if="{{ self.delFlag !== 1 }}"> <!-- <block wx:if="{{ self.delFlag !== 1 }}">
<view class="member-divider"></view> <view class="member-divider"></view>
<view class="member-ops"> <view class="member-ops">
<view class="op-delete" bind:tap="onTapDelete" data-item="{{ self }}">删除</view> <view class="op-delete" bind:tap="onTapDelete" data-item="{{ self }}">删除</view>
</view> </view>
</block> </block> -->
</view> </view>
</block> </block>
@@ -108,7 +108,9 @@
<view class="btn-primary" bind:tap="onTapAddUser">添加用户(最多10位)</view> <view class="btn-primary" bind:tap="onTapAddUser">添加用户(最多10位)</view>
</block> </block>
<block wx:else> <block wx:else>
<block wx:if="{{ !isOps }}">
<view class="btn-primary" bind:tap="onTapAddSelf">一键添加本人</view> <view class="btn-primary" bind:tap="onTapAddSelf">一键添加本人</view>
</block>
<view class="btn-cancel" bind:tap="onTapAddNew">添加新用户</view> <view class="btn-cancel" bind:tap="onTapAddNew">添加新用户</view>
</block> </block>
</view> </view>