[AI Generated]: feat(Comp): 新增添加用户弹窗的用户类型切换功能,支持员工模式(工号查询)与家庭用户模式(手动填写),切换时自动清空已填数据
This commit is contained in:
@@ -8,76 +8,158 @@
|
||||
<view>添加用户</view>
|
||||
</view>
|
||||
<view class="seaction">
|
||||
<view class="input">
|
||||
<view>工号:</view>
|
||||
<view>
|
||||
<input type="text" maxlength="8" placeholder="输入工号自动显示员工信息" value="{{workNo}}" bindinput="onWorkNoInput" bindconfirm="searchUser" />
|
||||
</view>
|
||||
<!-- <view class="searchBtn" bind:tap="searchUser">查询</view>-->
|
||||
<!-- 用户类型切换 -->
|
||||
<view class="select">
|
||||
<view
|
||||
class="{{userType === 'employee' ? 'selectActive' : ''}}"
|
||||
bindtap="switchUserType"
|
||||
data-type="employee"
|
||||
>员工</view>
|
||||
<view
|
||||
class="{{userType === 'family' ? 'selectActive' : ''}}"
|
||||
bindtap="switchUserType"
|
||||
data-type="family"
|
||||
>家庭用户</view>
|
||||
</view>
|
||||
<view class="only">
|
||||
<view>姓名:</view>
|
||||
<view>
|
||||
|
||||
<!-- 员工模式 -->
|
||||
<block wx:if="{{userType === 'employee'}}">
|
||||
<!-- 工号输入 -->
|
||||
<view class="input">
|
||||
<view>工号:</view>
|
||||
<view>
|
||||
<block wx:if="{{userInfo}}">
|
||||
{{userInfo.realname || ''}}
|
||||
</block>
|
||||
<block wx:else>
|
||||
<text style="color: #808080;">请先输入工号</text>
|
||||
</block>
|
||||
<input type="text" maxlength="8" placeholder="输入工号自动显示员工信息" value="{{workNo}}" bindinput="onWorkNoInput" bindconfirm="searchUser" />
|
||||
</view>
|
||||
<view></view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="only">
|
||||
<view>性别:</view>
|
||||
<view>
|
||||
<!-- 姓名(只读) -->
|
||||
<view class="only">
|
||||
<view>姓名:</view>
|
||||
<view>
|
||||
<block wx:if="{{userInfo}}">
|
||||
{{userInfo.sex === 1 ? '男' : userInfo.sex === 2 ? '女' : ''}}
|
||||
</block>
|
||||
<block wx:else>
|
||||
<text style="color: #808080;">请先输入工号</text>
|
||||
</block>
|
||||
<view>
|
||||
<block wx:if="{{userInfo}}">
|
||||
{{userInfo.realname || ''}}
|
||||
</block>
|
||||
<block wx:else>
|
||||
<text style="color: #808080;">请先输入工号</text>
|
||||
</block>
|
||||
</view>
|
||||
<view></view>
|
||||
</view>
|
||||
<view></view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="only">
|
||||
<view>生日:</view>
|
||||
<view>
|
||||
<!-- 性别(只读) -->
|
||||
<view class="only">
|
||||
<view>性别:</view>
|
||||
<view>
|
||||
<block wx:if="{{userInfo}}">
|
||||
{{userInfo.birthday || ''}}
|
||||
</block>
|
||||
<block wx:else>
|
||||
<text style="color: #808080;">请先输入工号</text>
|
||||
</block>
|
||||
<view>
|
||||
<block wx:if="{{userInfo}}">
|
||||
{{userInfo.sex === 1 ? '男' : userInfo.sex === 2 ? '女' : ''}}
|
||||
</block>
|
||||
<block wx:else>
|
||||
<text style="color: #808080;">请先输入工号</text>
|
||||
</block>
|
||||
</view>
|
||||
<view></view>
|
||||
</view>
|
||||
<view></view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="inputUnit">
|
||||
<view>身高:</view>
|
||||
<view>
|
||||
<!-- 生日(只读) -->
|
||||
<view class="only">
|
||||
<view>生日:</view>
|
||||
<view>
|
||||
<input type="digit" value="{{userInfo.height || ''}}" bindinput="onHeightInput" placeholder="请输入身高" />
|
||||
<view>
|
||||
<block wx:if="{{userInfo}}">
|
||||
{{userInfo.birthday || ''}}
|
||||
</block>
|
||||
<block wx:else>
|
||||
<text style="color: #808080;">请先输入工号</text>
|
||||
</block>
|
||||
</view>
|
||||
<view></view>
|
||||
</view>
|
||||
<view>cm</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="inputUnit">
|
||||
<view>体重:</view>
|
||||
<view>
|
||||
<!-- 身高(可输入) -->
|
||||
<view class="inputUnit">
|
||||
<view>身高:</view>
|
||||
<view>
|
||||
<input type="digit" value="{{userInfo.weight || ''}}" bindinput="onWeightInput" placeholder="请输入体重" />
|
||||
<view>
|
||||
<input type="digit" value="{{userInfo.height || ''}}" bindinput="onHeightInput" placeholder="请输入身高" />
|
||||
</view>
|
||||
<view>cm</view>
|
||||
</view>
|
||||
<view>kg</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 体重(可输入) -->
|
||||
<view class="inputUnit">
|
||||
<view>体重:</view>
|
||||
<view>
|
||||
<view>
|
||||
<input type="digit" value="{{userInfo.weight || ''}}" bindinput="onWeightInput" placeholder="请输入体重" />
|
||||
</view>
|
||||
<view>kg</view>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
<!-- 家庭用户模式 -->
|
||||
<block wx:elif="{{userType === 'family'}}">
|
||||
<!-- 姓名(手动输入) -->
|
||||
<view class="input">
|
||||
<view>姓名:</view>
|
||||
<view>
|
||||
<input type="text" placeholder="请输入姓名" value="{{familyInfo.name}}" bindinput="onFamilyNameInput" />
|
||||
</view>
|
||||
</view>
|
||||
<!-- 性别(picker 选择) -->
|
||||
<view class="only">
|
||||
<view>性别:</view>
|
||||
<view>
|
||||
<view>
|
||||
<picker range="{{genderOptions}}" value="{{genderIndex}}" bindchange="onFamilyGenderChange">
|
||||
<view style="color: #252535; font-size: 32rpx; font-weight: 500; height: 100rpx; line-height: 100rpx;">
|
||||
{{genderOptions[genderIndex]}}
|
||||
</view>
|
||||
</picker>
|
||||
</view>
|
||||
<view></view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 生日(picker date 选择) -->
|
||||
<view class="only">
|
||||
<view>生日:</view>
|
||||
<view>
|
||||
<view>
|
||||
<picker mode="date" value="{{familyInfo.birthday}}" start="1900-01-01" bindchange="onFamilyBirthdayChange">
|
||||
<view style="color: {{familyInfo.birthday ? '#252535' : '#808080'}}; font-size: 32rpx; font-weight: 500; height: 100rpx; line-height: 100rpx;">
|
||||
{{familyInfo.birthday || '请选择生日'}}
|
||||
</view>
|
||||
</picker>
|
||||
</view>
|
||||
<view></view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 身高(手动输入) -->
|
||||
<view class="inputUnit">
|
||||
<view>身高:</view>
|
||||
<view>
|
||||
<view>
|
||||
<input type="digit" value="{{familyInfo.height}}" bindinput="onFamilyHeightInput" placeholder="请输入身高" />
|
||||
</view>
|
||||
<view>cm</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 体重(手动输入) -->
|
||||
<view class="inputUnit">
|
||||
<view>体重:</view>
|
||||
<view>
|
||||
<view>
|
||||
<input type="digit" value="{{familyInfo.weight}}" bindinput="onFamilyWeightInput" placeholder="请输入体重" />
|
||||
</view>
|
||||
<view>kg</view>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
</view>
|
||||
<view class="footer">
|
||||
<view bind:tap="closeModal">取消</view>
|
||||
<view bind:tap="submit">确定</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
Reference in New Issue
Block a user