diff --git a/src/views/mdp/sys/branch/BranchSelect.vue b/src/views/mdp/sys/branch/BranchSelect.vue index 60a8c6ae..9ad06788 100644 --- a/src/views/mdp/sys/branch/BranchSelect.vue +++ b/src/views/mdp/sys/branch/BranchSelect.vue @@ -52,7 +52,8 @@ pageSize:10,//每页数据 pageNum:1,//当前页码、从1开始计算 orderFields:[],//排序列 如 ['sex','student_id'],必须为数据库字段 - orderDirs:[]//升序 asc,降序desc 如 性别 升序、学生编号降序 ['asc','desc'] + orderDirs:[],//升序 asc,降序desc 如 性别 升序、学生编号降序 ['asc','desc'] + count:false, }, load:{ list: false, edit: false, del: false, add: false },//查询中... sels: [],//列表选中数据 @@ -109,7 +110,7 @@ let params = { pageSize: this.pageInfo.pageSize, pageNum: this.pageInfo.pageNum, - total: this.pageInfo.total,countSql:this.pageInfo.countSql + total: this.pageInfo.total,count:this.pageInfo.count }; if(this.pageInfo.orderFields!=null && this.pageInfo.orderFields.length>0){ let orderBys=[]; @@ -119,10 +120,8 @@ params.orderBy= orderBys.join(",") } if(this.filters.key!==""){ - //params.xxx=this.filters.key - }else{ - //params.xxx=xxxxx - } + params.key=this.filters.key + } if( !this.userInfo.isSuperAdmin){ params.id=this.userInfo.branchId; } @@ -130,7 +129,7 @@ listBranch(params).then((res) => { var tips=res.data.tips; if(tips.isOk){ - this.pageInfo.total = res.data.data.total;this.pageInfo.countSql=false; + this.pageInfo.total = res.data.total;this.pageInfo.count=false; this.branchs = res.data.data; }else{ this.$notify({position:'bottom-left',showClose:true,message: tips.msg, type: 'error' }); diff --git a/src/views/mdp/sys/dept/DeptTree.vue b/src/views/mdp/sys/dept/DeptTree.vue index ad003e4a..2b01bdc8 100644 --- a/src/views/mdp/sys/dept/DeptTree.vue +++ b/src/views/mdp/sys/dept/DeptTree.vue @@ -1,394 +1,343 @@ - - - - + //获取分类树列表 + getDeptTreeData(refresh) { + this.root.childNodes=[] + this.loadNode(this.root,this.resolve) + }, + filterDeptNode(value, data) { + if (!value) return true; + if( data.deptid.indexOf(value)>=0 || data.deptName.indexOf(value)>=0 ){ + return true; + }else{ + if( data.pdeptid && data.pdeptid.indexOf(value)>=0){ + return true; + } + } + return false; + }, + renderContent(h, { node, data, store }) { + var countMsg=''; + if(this.countTips){ + countMsg=this.countTips; + } + if(this.showCount==true || this.showCount=='true'){ + + + return h('span',node.label+'('+data.childrenNum+')') ; + }else{ + return h('span',node.label+'('+data.childrenNum+')') ; + } + + }, + showBranchSelect: function(){ + this.branchVisible=true + }, + confirm(){ + var nodes= this.$refs.deptTree.getCheckedNodes(false,false) + this.$emit('confirm',nodes) + }, + loadNode(node, resolve) { + if (node.level === 0) { + this.root=node + this.resolve=resolve + let params = { + levelTypes:['L1'] + }; + params.branchId=this.branchId + if(this.userInfo.isSuperAdmin==true || this.userInfo.isPlatformAdmin==true){ + if(this.branch!=null){ + params.branchId=this.branch.id + }else if(params.branchId==null || params.branchId==''){ + params.branchId=this.userInfo.branchId + } + }else{ + if(params.branchId==null || params.branchId==''){ + params.branchId=this.userInfo.branchId + } + // params.autoDetectParentDeptid="1" + } + this.listLoading = true; + listTreeDept(params).then((res) => { + var tips=res.data.tips; + var data=res.data.data; + this.listLoading = false; + var tempData=this.translateDataToTree(data); + this.expandRowKeys=tempData.map(i=>i.deptid) + return resolve(tempData ) + + }).catch(() => { + this.listLoading = false; + }); + }else { + if(node.data.childrenNum>0 && (!node.data.children||node.data.children.length==0)){ + setTimeout(() => { + let params = { + pdeptid:node.data.deptid + }; + params.branchId=this.branchId + if(this.userInfo.isSuperAdmin==true || this.userInfo.isPlatformAdmin==true){ + if(this.branch!=null){ + params.branchId=this.branch.id + }else if(params.branchId==null || params.branchId==''){ + params.branchId=this.userInfo.branchId + } + }else{ + if(params.branchId==null || params.branchId==''){ + params.branchId=this.userInfo.branchId + } + // params.autoDetectParentDeptid="1" + } + this.listLoading = true; + listTreeDept(params).then((res) => { + var tips=res.data.tips; + var data=res.data.data; + this.listLoading = false; + resolve(this.translateDataToTree(data)) + + }).catch(() => { + this.listLoading = false; + }); + }, 500); + }else if(node.data.childrenNum>0 && (node.data.children&&node.data.children.length>0)){ + return resolve(node.data.children) + }else { + return resolve([]) + } + + } + } + }, + mounted() { + this.deptid=this.value; + //this.getDeptTreeData(); + } + } + + + + + \ No newline at end of file diff --git a/src/views/mdp/sys/user/UserMng.vue b/src/views/mdp/sys/user/UserMng.vue index 1f0385c9..c847b210 100644 --- a/src/views/mdp/sys/user/UserMng.vue +++ b/src/views/mdp/sys/user/UserMng.vue @@ -454,6 +454,10 @@ export default { if (params.deptid == null || params.deptid == "") { //params.deptid=this.userInfo.deptid; } + }else{ + if(this.branch && this.branch.id){ + params.branchId=this.branch.id + } } console.log("kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk"); console.log(params); diff --git a/src/views/mdp/sys/user/UsersSelectOnly.vue b/src/views/mdp/sys/user/UsersSelectOnly.vue index 61787526..dbf365ae 100644 --- a/src/views/mdp/sys/user/UsersSelectOnly.vue +++ b/src/views/mdp/sys/user/UsersSelectOnly.vue @@ -184,6 +184,9 @@ if( deptids && deptids.length>0){ params.deptid=deptids[0] } + if(this.branch && this.branch.id){ + params.branchId=this.branch.id + } this.load.list = true; listUser(params).then((res) => { var tips=res.data.tips;