|
@@ -252,6 +252,7 @@
|
|
|
size="mini"
|
|
|
type="text"
|
|
|
icon="el-icon-edit"
|
|
|
+ v-if="scope.row.agentFlag == 1"
|
|
|
@click="handleAgent(scope.row)"
|
|
|
v-hasPermi="['system:user:edit']"
|
|
|
>代理</el-button
|
|
@@ -485,6 +486,9 @@ import {
|
|
|
changeUserStatus,
|
|
|
importTemplate,
|
|
|
changeAgentFlag,
|
|
|
+ agentChangeGroup,
|
|
|
+ getLeftData,
|
|
|
+ getRightData
|
|
|
} from "@/api/system/user";
|
|
|
import { getToken } from "@/utils/auth";
|
|
|
import { treeselect } from "@/api/system/dept";
|
|
@@ -573,7 +577,8 @@ export default {
|
|
|
deptName: "李哈哈",
|
|
|
},
|
|
|
],
|
|
|
- value: ["55"],
|
|
|
+ value: [55],
|
|
|
+ currentUserId:null
|
|
|
},
|
|
|
// 表单校验
|
|
|
rules: {
|
|
@@ -629,7 +634,12 @@ export default {
|
|
|
},
|
|
|
methods: {
|
|
|
handleAgent(row) {
|
|
|
+ this.getLeftAgent(row.userId).then((response) => {
|
|
|
+ this.getRightAgent(row.userId)
|
|
|
+ })
|
|
|
+ this.agent.currentUserId = row.userId
|
|
|
this.agent.open = true;
|
|
|
+
|
|
|
},
|
|
|
// 代理状态修改
|
|
|
handleAgentFlagChange(row) {
|
|
@@ -865,19 +875,55 @@ export default {
|
|
|
submitFileForm() {
|
|
|
this.$refs.upload.submit();
|
|
|
},
|
|
|
- agentChange(q,direction,e){
|
|
|
- console.log(q,direction,e);
|
|
|
+ agentChange(q,direction,changeArr){
|
|
|
+ const data = {
|
|
|
+ "userId": this.agent.currentUserId,
|
|
|
+ "flag":"0",
|
|
|
+ "list":changeArr
|
|
|
+ }
|
|
|
if(direction == 'right'){
|
|
|
+ data.flag = 1
|
|
|
// 向右添加
|
|
|
}else if(direction == 'left'){
|
|
|
// 向左减少
|
|
|
+ data.flag = 0
|
|
|
}
|
|
|
+ agentChangeGroup(data).then((res)=>{
|
|
|
+ if(res.code == 200){
|
|
|
+ this.getRightAgent()
|
|
|
+ }else{
|
|
|
+ throw new Error("");
|
|
|
+ }
|
|
|
+ }).catch(()=>{
|
|
|
+ this.msgError("操作失败,请关闭弹窗后重新操作~")
|
|
|
+ })
|
|
|
},
|
|
|
- getLeftAgent(){
|
|
|
-
|
|
|
+ async getLeftAgent(id){
|
|
|
+ try {
|
|
|
+ const leftDataPro = await getLeftData({userId:id})
|
|
|
+ if(leftDataPro.code != 200){
|
|
|
+ throw new Error("")
|
|
|
+ }
|
|
|
+ this.agent.data = leftDataPro.data
|
|
|
+ return Promise.resolve()
|
|
|
+ } catch (error) {
|
|
|
+ this.msgError("拉取可代理的集团失败,请关闭弹窗后重新操作")
|
|
|
+ }
|
|
|
},
|
|
|
- getRightAgent(){
|
|
|
+ async getRightAgent(id){
|
|
|
+ try {
|
|
|
+ this.agent.value = []
|
|
|
+ const rightDataPro = await getRightData({ userId:id})
|
|
|
+ if(rightDataPro.code != 200){
|
|
|
+ throw new Error("")
|
|
|
+ }
|
|
|
+ this.agent.value = rightDataPro.data
|
|
|
+ console.log(this.agent.value);
|
|
|
+ return Promise.resolve()
|
|
|
|
|
|
+ } catch (error) {
|
|
|
+ this.msgError("拉取已代理的集团失败,请关闭弹窗后重新操作")
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
};
|
|
@@ -886,10 +932,14 @@ export default {
|
|
|
.agentDialog {
|
|
|
.el-transfer-panel {
|
|
|
height: 500px !important;
|
|
|
+ .el-transfer-panel__body{
|
|
|
+ height: 500px !important;
|
|
|
+ .el-transfer-panel__list.is-filterable {
|
|
|
+ height: 500px !important;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- .app-container-user .el-transfer-panel__list.is-filterable {
|
|
|
- height: 400px !important;
|
|
|
- }
|
|
|
+
|
|
|
}
|
|
|
</style>
|