118 lines
4.9 KiB
Plaintext
118 lines
4.9 KiB
Plaintext
<scroll-view
|
||
class="page safe-bottom"
|
||
scroll-y
|
||
type="list"
|
||
refresher-enabled
|
||
refresher-triggered="{{refreshing}}"
|
||
bindrefresherrefresh="onPullDownRefresh"
|
||
>
|
||
<view class="header">
|
||
<text class="title">人员清单</text>
|
||
<text class="subtitle">电话号唯一,角色决定可用功能</text>
|
||
</view>
|
||
|
||
<view wx:if="{{!readonly}}" class="card">
|
||
<view class="button-row">
|
||
<button class="btn secondary full" bindtap="chooseFile">导入人员清单</button>
|
||
<button class="btn primary full" bindtap="exportFile">导出人员清单</button>
|
||
</view>
|
||
<button class="btn primary full add-btn" bindtap="openCreate">新增人员</button>
|
||
<text wx:if="{{importFileName}}" class="subtitle">已选择:{{importFileName}}</text>
|
||
</view>
|
||
|
||
<input class="input search" placeholder="搜索姓名、电话、角色" value="{{keyword}}" bindinput="onKeywordInput" />
|
||
|
||
<view wx:if="{{!rows.length}}" class="list-empty">暂无人员</view>
|
||
<view wx:for="{{rows}}" wx:key="phone" wx:for-index="index" class="card person-card {{item.temporaryExpired ? 'person-expired' : ''}}">
|
||
<view class="row">
|
||
<view class="row-left">
|
||
<text class="value">{{item.name}}</text>
|
||
<text class="subtitle">{{item.phone}}</text>
|
||
<text wx:if="{{item.role !== 'manager'}}" class="subtitle">考勤点 {{item.attendancePointsText || '-'}}</text>
|
||
<text wx:if="{{item.temporaryStatusText}}" class="temporary-status {{item.temporaryExpired ? 'expired' : ''}}">
|
||
{{item.temporaryStatusText}}
|
||
</text>
|
||
</view>
|
||
</view>
|
||
<view wx:if="{{readonly}}" class="role-row">
|
||
<view
|
||
wx:for="{{item.rolesDisplay}}"
|
||
wx:key="role"
|
||
wx:for-item="roleItem"
|
||
class="role-chip readonly-chip"
|
||
>
|
||
{{roleItem.roleName}}
|
||
</view>
|
||
</view>
|
||
<view wx:else class="role-row">
|
||
<button
|
||
wx:for="{{item.rolesDisplay}}"
|
||
wx:key="role"
|
||
wx:for-item="roleItem"
|
||
class="role-chip"
|
||
data-phone="{{item.phone}}"
|
||
data-role="{{roleItem.role}}"
|
||
data-role-name="{{roleItem.roleName}}"
|
||
bindtap="removeRole"
|
||
>
|
||
{{roleItem.roleName}} ×
|
||
</button>
|
||
</view>
|
||
<view wx:if="{{!readonly}}" class="button-row">
|
||
<button class="btn secondary full" data-index="{{index}}" bindtap="edit">编辑</button>
|
||
<button wx:if="{{currentUser.role === 'manager'}}" class="btn secondary full" data-index="{{index}}" bindtap="addRole">添加角色</button>
|
||
<button class="btn danger full" data-index="{{index}}" bindtap="removePerson">删除人员</button>
|
||
</view>
|
||
</view>
|
||
|
||
<view class="button-row pager-row" wx:if="{{rows.length}}">
|
||
<button class="btn secondary pager-nav" bindtap="prevPage" disabled="{{page <= 1}}">上一页</button>
|
||
<view class="page-jump-control">
|
||
<input class="page-jump-input" type="number" confirm-type="done" value="{{pageInput}}" bindinput="onPageInput" bindconfirm="jumpToPage" />
|
||
<text class="page-total-label">/ {{totalPages}}</text>
|
||
<text class="page-jump-action" bindtap="jumpToPage">跳</text>
|
||
</view>
|
||
<button class="btn secondary pager-nav" bindtap="nextPage" disabled="{{page >= totalPages}}">下一页</button>
|
||
</view>
|
||
</scroll-view>
|
||
|
||
<view wx:if="{{formVisible}}" class="modal-mask" catchtap="closeForm">
|
||
<view class="modal-panel" catchtap="noop">
|
||
<view class="modal-head">
|
||
<text class="modal-title">{{formTitle}}</text>
|
||
<button class="btn mini secondary modal-close" bindtap="clearForm">清空</button>
|
||
</view>
|
||
<view class="form-item">
|
||
<text class="label">电话号</text>
|
||
<input class="input" type="number" value="{{form.phone}}" disabled="{{!!form.originalPhone}}" data-field="phone" bindinput="onInput" />
|
||
</view>
|
||
<view class="form-item">
|
||
<text class="label">姓名</text>
|
||
<input class="input" value="{{form.name}}" data-field="name" bindinput="onInput" />
|
||
</view>
|
||
<view class="form-item">
|
||
<text class="label">角色</text>
|
||
<picker mode="selector" range="{{roleOptions}}" range-key="label" value="{{roleIndex}}" bindchange="onRoleChange">
|
||
<view class="picker">{{roleOptions[roleIndex].label}}</view>
|
||
</picker>
|
||
</view>
|
||
<view wx:if="{{form.role !== 'manager'}}" class="form-item">
|
||
<text class="label">考勤点</text>
|
||
<checkbox-group class="checkbox-grid" bindchange="onPointCheckboxChange">
|
||
<label
|
||
wx:for="{{attendancePoints}}"
|
||
wx:key="name"
|
||
class="checkbox-chip {{item.checked ? 'checked' : ''}}"
|
||
>
|
||
<checkbox value="{{item.name}}" checked="{{item.checked}}" color="#1463ff"></checkbox>
|
||
<text>{{item.name}}</text>
|
||
</label>
|
||
</checkbox-group>
|
||
</view>
|
||
<view class="button-row">
|
||
<button class="btn secondary full" bindtap="closeForm">关闭</button>
|
||
<button class="btn primary full" bindtap="save">保存人员</button>
|
||
</view>
|
||
</view>
|
||
</view>
|