|
@@ -22,9 +22,13 @@
|
|
|
<view class="list-tow">
|
|
|
<view class="list-tow-li">
|
|
|
<view class="list-tow-li-t">被授权人</view>
|
|
|
- <input class="list-tow-li-b" type="text" @change="authorizedChange()"
|
|
|
+ <view class="list-user-name-box" v-if="addForm.userId">
|
|
|
+ <view>{{addForm.userName}}{{account?'-'+account:''}}</view>
|
|
|
+ <view @click="delUserData()">更改</view>
|
|
|
+ </view>
|
|
|
+ <input class="list-tow-li-b" v-if="!addForm.userId" type="text" @change="authorizedChange()"
|
|
|
v-model="getDataTow.searchValue" placeholder="被授权人搜索,最少两个字">
|
|
|
- <uni-data-picker @change="bindPickerChange" :localdata="dataListTow" ref='picker'>
|
|
|
+ <uni-data-picker @change="bindPickerChange":localdata="dataListTow" ref='picker'>
|
|
|
</uni-data-picker>
|
|
|
</view>
|
|
|
<view class="list-tow-li">
|
|
@@ -105,8 +109,8 @@
|
|
|
successVisible: false,
|
|
|
timer: null,
|
|
|
count: '',
|
|
|
-
|
|
|
-
|
|
|
+ //展示用工号
|
|
|
+ account:false,
|
|
|
}
|
|
|
},
|
|
|
onLoad(option) {
|
|
@@ -139,6 +143,12 @@
|
|
|
var currentdate = year + "-" + month + "-" + strDate;
|
|
|
return currentdate;
|
|
|
},
|
|
|
+ //清空选项
|
|
|
+ delUserData(){
|
|
|
+ this.$set(this.addForm,'userName',null);
|
|
|
+ this.$set(this.addForm,'userId',null);
|
|
|
+ this.$set(this,'account',false);
|
|
|
+ },
|
|
|
//被授权人搜索
|
|
|
async authorizedChange() {
|
|
|
let self = this
|
|
@@ -149,8 +159,10 @@
|
|
|
if (data.code == 200) {
|
|
|
data.data.forEach(function(item) {
|
|
|
self.dataListTow.push({
|
|
|
- text: item.userName,
|
|
|
+ text: item.userName+(item.account?'-'+item.account:''),
|
|
|
value: item.userId,
|
|
|
+ userName: item.userName,
|
|
|
+ account: item.account,
|
|
|
})
|
|
|
})
|
|
|
self.$refs.picker.show()
|
|
@@ -158,13 +170,14 @@
|
|
|
},
|
|
|
bindPickerChange: function(e) {
|
|
|
let self = this;
|
|
|
- console.log('picker发送选择改变,携带值为', e.detail.value)
|
|
|
- let data = e.detail.value;
|
|
|
- data.forEach(function(item) {
|
|
|
- self.addForm.userName = item.text
|
|
|
- self.addForm.userId = item.value
|
|
|
-
|
|
|
- })
|
|
|
+ for(let i=0;i<self.dataListTow.length;i++){
|
|
|
+ if(e.detail.value[0].value == self.dataListTow[i].value){
|
|
|
+ this.$set(self.addForm,'userName',self.dataListTow[i].userName);
|
|
|
+ this.$set(self.addForm,'userId',self.dataListTow[i].value);
|
|
|
+ this.$set(self,'account',self.dataListTow[i].account?self.dataListTow[i].account:false);
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
},
|
|
|
//授权点击
|
|
|
authorizedClick(row) {
|
|
@@ -198,6 +211,22 @@
|
|
|
//授权提交
|
|
|
async submitForm() {
|
|
|
let self = this;
|
|
|
+ if(!self.addForm.userId){
|
|
|
+ uni.showToast({
|
|
|
+ title: '请选择被授权人',
|
|
|
+ icon: "none",
|
|
|
+ duration: 2000
|
|
|
+ });
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if(!self.addForm.validBeginTime || !self.addForm.validEndTime){
|
|
|
+ uni.showToast({
|
|
|
+ title: '请选择授权时间',
|
|
|
+ icon: "none",
|
|
|
+ duration: 2000
|
|
|
+ });
|
|
|
+ return
|
|
|
+ }
|
|
|
let obj={
|
|
|
userId:this.addForm.userId,
|
|
|
subId: this.addForm.subId,
|
|
@@ -339,7 +368,27 @@
|
|
|
text-align: left;
|
|
|
margin: 24rpx 0;
|
|
|
}
|
|
|
-
|
|
|
+ .list-user-name-box{
|
|
|
+ display: flex;
|
|
|
+ width: 690rpx;
|
|
|
+ height: 80rpx;
|
|
|
+ border-radius: 10rpx 10rpx 10rpx 10rpx;
|
|
|
+ border: 1rpx solid #e0e0e0;
|
|
|
+ padding-left: 20rpx;
|
|
|
+ box-sizing: border-box;
|
|
|
+ view{
|
|
|
+ line-height:78rpx;
|
|
|
+ }
|
|
|
+ view:nth-child(1){
|
|
|
+ paddin:0 10rpx;
|
|
|
+ flex:1;
|
|
|
+ }
|
|
|
+ view:nth-child(2){
|
|
|
+ width:100rpx;
|
|
|
+ text-align: center;
|
|
|
+ border-left: 1rpx solid #e0e0e0;
|
|
|
+ }
|
|
|
+ }
|
|
|
.list-tow-li-b {
|
|
|
width: 690rpx;
|
|
|
height: 80rpx;
|