|
@@ -9,35 +9,35 @@
|
|
|
</el-form-item>
|
|
|
|
|
|
<el-form-item label="分配员工" prop="users">
|
|
|
- <el-row :gutter="10" class="mb8">
|
|
|
- <el-col :span="1.5">
|
|
|
- <el-button @click="handleUserSelect">添加员工</el-button>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
- <el-table border :data="users" >
|
|
|
- <el-table-column label="ID" align="center" prop="userId" />
|
|
|
- <el-table-column label="员工帐号" align="center" prop="userName" />
|
|
|
- <el-table-column label="员工姓名" align="center" prop="nickName" />
|
|
|
- <el-table-column label="所属部门" align="center" prop="deptName" />
|
|
|
- <el-table-column label="手机号码" align="center" prop="phonenumber" width="120" />
|
|
|
- <el-table-column label="今日分配数" align="center" prop="nowDayCustomerCount" />
|
|
|
- <el-table-column label="分配数量" align="center" prop="count" width="200px" >
|
|
|
+ <el-row :gutter="10" class="mb8">
|
|
|
+ <el-col :span="1.5">
|
|
|
+ <el-button @click="handleUserSelect">添加员工</el-button>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-table border :data="users" >
|
|
|
+ <el-table-column label="ID" align="center" prop="userId" />
|
|
|
+ <el-table-column label="员工帐号" align="center" prop="userName" />
|
|
|
+ <el-table-column label="员工姓名" align="center" prop="nickName" />
|
|
|
+ <el-table-column label="所属部门" align="center" prop="deptName" />
|
|
|
+ <el-table-column label="手机号码" align="center" prop="phonenumber" width="120" />
|
|
|
+ <el-table-column label="今日分配数" align="center" prop="nowDayCustomerCount" />
|
|
|
+ <el-table-column label="分配数量" align="center" prop="count" width="200px" >
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <div>
|
|
|
+ <el-input-number ref="stepTxtNum" :min="0" v-model="scope.row.count" @change="changeVal(scope.row)" size="mini" ></el-input-number>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="操作" align="center" fixed="right" width="120px" class-name="small-padding fixed-width">
|
|
|
<template slot-scope="scope">
|
|
|
- <div>
|
|
|
- <el-input-number :min="0" v-model="scope.row.count" @change="changeVal(scope.row)" size="mini" ></el-input-number>
|
|
|
- </div>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column label="操作" align="center" fixed="right" width="120px" class-name="small-padding fixed-width">
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-button
|
|
|
- size="mini"
|
|
|
- type="text"
|
|
|
- @click="handleRemoveUser(scope.row.$index)"
|
|
|
- >删除</el-button>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- </el-table>
|
|
|
+ <el-button
|
|
|
+ size="mini"
|
|
|
+ type="text"
|
|
|
+ @click="handleRemoveUser(scope.row.$index)"
|
|
|
+ >删除</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
<div class="footer">
|
|
@@ -77,21 +77,23 @@
|
|
|
},
|
|
|
created() {
|
|
|
|
|
|
-
|
|
|
},
|
|
|
methods: {
|
|
|
changeVal(row) {
|
|
|
-
|
|
|
this.$forceUpdate();//解决点击计数器失效问题
|
|
|
- this.computeCount()
|
|
|
+ this.computeCount();
|
|
|
if(this.assignCount>this.customerIds.length){
|
|
|
- row.count=0;
|
|
|
- this.computeCount()
|
|
|
+ this.$nextTick(() => {
|
|
|
+ row.count=0;
|
|
|
+ this.computeCount();
|
|
|
+ });
|
|
|
+
|
|
|
}
|
|
|
},
|
|
|
handleRemoveUser(index){
|
|
|
this.users.splice(index,1);
|
|
|
- this.computeCount()
|
|
|
+ this.computeCount();
|
|
|
+ this.$refs.userSelects.delUser(index);
|
|
|
},
|
|
|
selectUser(data){
|
|
|
var users=[];
|
|
@@ -109,7 +111,6 @@
|
|
|
users.push(user)
|
|
|
});
|
|
|
this.users=users;
|
|
|
- console.log("qxj selectUser",JSON.stringify(users));
|
|
|
this.userSelect.open=false;
|
|
|
this.computeCount()
|
|
|
},
|
|
@@ -125,13 +126,13 @@
|
|
|
var that=this;
|
|
|
this.userSelect.open=true;
|
|
|
setTimeout(() => {
|
|
|
- console.log()
|
|
|
that.$refs.userSelects.getList();
|
|
|
}, 500);
|
|
|
},
|
|
|
init(customerIds,type){
|
|
|
this.type=type,
|
|
|
this.customerIds = customerIds;
|
|
|
+ this.assignCount=0;
|
|
|
this.noAssignCount=this.customerIds.length;
|
|
|
this.users=[];
|
|
|
},
|
|
@@ -143,21 +144,28 @@
|
|
|
var users=[];
|
|
|
var customerIds=[];
|
|
|
var idIndex=0;
|
|
|
+ var totalAssignCount=0;
|
|
|
+ console.log("qxj users",JSON.stringify(this.users));
|
|
|
this.users.forEach(element => {
|
|
|
if(element.count>0){
|
|
|
var ids=that.customerIds.slice(idIndex,idIndex+element.count)
|
|
|
- console.log(that.customerIds)
|
|
|
- console.log(ids)
|
|
|
+ console.log("qxj customerIds:"+that.customerIds+" count:"+element.count);
|
|
|
+ console.log("qxj ids:"+ids);
|
|
|
customerIds=customerIds.concat(ids);
|
|
|
idIndex=idIndex+element.count;
|
|
|
var data={companyUserId:element.userId,count:element.count};
|
|
|
- users.push(data)
|
|
|
+ users.push(data);
|
|
|
+ totalAssignCount+=element.count;
|
|
|
}
|
|
|
});
|
|
|
if(users.length==0){
|
|
|
this.msgError("请选择员工");
|
|
|
return;
|
|
|
}
|
|
|
+ if(totalAssignCount>(this.assignCount+this.noAssignCount)){
|
|
|
+ this.msgError("分配数量有误");
|
|
|
+ return;
|
|
|
+ }
|
|
|
this.myloading = this.$loading({
|
|
|
lock: true,
|
|
|
text: '处理中...',
|
|
@@ -176,7 +184,9 @@
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
-
|
|
|
+ closeAction(){
|
|
|
+ this.$refs.userSelects.users=[];
|
|
|
+ }
|
|
|
}
|
|
|
};
|
|
|
</script>
|