| | |
| | | <view class="staff-list"> |
| | | <view class="staff-item" v-for="(staff, index) in selectedStaff" :key="staff.userId"> |
| | | <view class="staff-info"> |
| | | <text class="staff-name">{{ staff.nickName }}</text> |
| | | <text class="staff-name">{{ getStaffDisplayName(staff) }}</text> |
| | | </view> |
| | | <uni-icons |
| | | v-if="canRemove(index)" |
| | |
| | | emitChange() { |
| | | this.$emit('input', this.selectedStaff) |
| | | this.$emit('change', this.selectedStaff) |
| | | }, |
| | | |
| | | // 获取人员显示名称(优先显示姓名,如果姓名为空则显示手机号) |
| | | getStaffDisplayName(staff) { |
| | | if (!staff) { |
| | | return '未知人员' |
| | | } |
| | | // 优先显示 nickName,如果为空则显示手机号,都为空则显示 userId |
| | | if (staff.nickName && staff.nickName.trim()) { |
| | | return staff.nickName |
| | | } |
| | | if (staff.phonenumber && staff.phonenumber.trim()) { |
| | | return staff.phonenumber |
| | | } |
| | | return `用户${staff.userId || ''}` |
| | | } |
| | | } |
| | | } |