伊利项目 架构筛选条件初始默认取消选中
This commit is contained in:
parent
208f602491
commit
bd7352fe78
@ -36,9 +36,10 @@
|
|||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.getRouteParam(this.$route.query);
|
this.getRouteParam(this.$route.query);
|
||||||
|
let that = this;
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.initConditionData();
|
that.initConditionData();
|
||||||
},300)
|
},300);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
// 获取历史
|
// 获取历史
|
||||||
@ -57,13 +58,15 @@
|
|||||||
if (ro.result === 'ok') {
|
if (ro.result === 'ok') {
|
||||||
that.conditionData = ro.data
|
that.conditionData = ro.data
|
||||||
// 历史查询条件保存
|
// 历史查询条件保存
|
||||||
let tempUserArr = [...that.conditionData.historyCondition.createUsers];
|
if (that.conditionData.historyCondition) {
|
||||||
that.$store.commit('setCreateUsers',tempUserArr);
|
let tempUserArr = [...that.conditionData.historyCondition.createUsers];
|
||||||
let tempOrgIdArr = [...that.conditionData.historyCondition.orgIds];
|
that.$store.commit('setCreateUsers',tempUserArr);
|
||||||
that.$store.commit('setOrgIds',tempOrgIdArr);
|
let tempOrgIdArr = [...that.conditionData.historyCondition.orgIds];
|
||||||
let tempMethodIdArr = [...that.conditionData.historyCondition.methodIds];
|
that.$store.commit('setOrgIds',tempOrgIdArr);
|
||||||
that.$store.commit('setMethodIds',tempMethodIdArr);
|
let tempMethodIdArr = [...that.conditionData.historyCondition.methodIds];
|
||||||
that.conditionReFresh = true
|
that.$store.commit('setMethodIds',tempMethodIdArr);
|
||||||
|
}
|
||||||
|
that.conditionReFresh = true;
|
||||||
}else {
|
}else {
|
||||||
that.$message({message: ro.msg, type: 'warning'});
|
that.$message({message: ro.msg, type: 'warning'});
|
||||||
}
|
}
|
||||||
@ -110,23 +113,35 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch : {
|
watch : {
|
||||||
|
'$route': function (newd,old) {
|
||||||
|
this.conditionReFresh = false;
|
||||||
|
this.$nextTick(()=>{
|
||||||
|
this.initConditionData();
|
||||||
|
});
|
||||||
|
},
|
||||||
listenTopMainHeight: function (newd, old) {
|
listenTopMainHeight: function (newd, old) {
|
||||||
this.mainHeight = (parseInt(newd)) + 'px';
|
this.mainHeight = (parseInt(newd)) + 'px';
|
||||||
},
|
},
|
||||||
listenWsId: function(newd, old) {
|
listenWsId: function(newd, old) {
|
||||||
this.reFresh = false;
|
this.reFresh = false;
|
||||||
this.mainContent = '';
|
this.mainContent = '';
|
||||||
|
this.conditionReFresh = false;
|
||||||
this.$nextTick(()=>{
|
this.$nextTick(()=>{
|
||||||
this.reFresh = true;
|
this.reFresh = true;
|
||||||
this.mainContent = 'RepositoryMainList';
|
this.mainContent = 'RepositoryMainList';
|
||||||
|
|
||||||
|
this.initConditionData();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
listenTeamId: function(newd, old) {
|
listenTeamId: function(newd, old) {
|
||||||
this.reFresh = false;
|
this.reFresh = false;
|
||||||
this.mainContent = '';
|
this.mainContent = '';
|
||||||
|
this.conditionReFresh = false;
|
||||||
this.$nextTick(()=>{
|
this.$nextTick(()=>{
|
||||||
this.reFresh = true;
|
this.reFresh = true;
|
||||||
this.mainContent = 'RepositoryMainList';
|
this.mainContent = 'RepositoryMainList';
|
||||||
|
|
||||||
|
this.initConditionData();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@ -478,7 +478,8 @@
|
|||||||
havingRemovePerm:false,
|
havingRemovePerm:false,
|
||||||
havingVersionManagePerm: false,
|
havingVersionManagePerm: false,
|
||||||
havingWritePerm: false
|
havingWritePerm: false
|
||||||
}
|
},
|
||||||
|
imgPath: ''
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
|||||||
@ -324,7 +324,7 @@
|
|||||||
isLoading:false,
|
isLoading:false,
|
||||||
multiple: true,
|
multiple: true,
|
||||||
// 创建人
|
// 创建人
|
||||||
currentUserCheck: true,
|
currentUserCheck: false,
|
||||||
currentUser: '',
|
currentUser: '',
|
||||||
searchUserName: '',
|
searchUserName: '',
|
||||||
createUserOptions: [],
|
createUserOptions: [],
|
||||||
@ -346,7 +346,7 @@
|
|||||||
addressType: 'department',
|
addressType: 'department',
|
||||||
searchOrgName: '',
|
searchOrgName: '',
|
||||||
checkOrgIds: [],
|
checkOrgIds: [],
|
||||||
currentUserDeptCheck: true,
|
currentUserDeptCheck: false,
|
||||||
|
|
||||||
dis: false,
|
dis: false,
|
||||||
headerHeight1: '88px',
|
headerHeight1: '88px',
|
||||||
@ -459,9 +459,11 @@
|
|||||||
this.$store.commit('setCreateUsers',this.checkCreateUserIds);
|
this.$store.commit('setCreateUsers',this.checkCreateUserIds);
|
||||||
this.checkMethodIds = [];
|
this.checkMethodIds = [];
|
||||||
this.isIndeterminate = false;
|
this.isIndeterminate = false;
|
||||||
|
this.userIndeterminate = false;
|
||||||
this.checkAll = false;
|
this.checkAll = false;
|
||||||
this.$store.commit('setMethodIds',this.checkMethodIds);
|
this.$store.commit('setMethodIds',this.checkMethodIds);
|
||||||
this.checkOrgIds = [];
|
this.checkOrgIds = [];
|
||||||
|
this.currentUserDeptCheck = false;
|
||||||
this.$refs.orgTree.setCheckedKeys(this.checkOrgIds);
|
this.$refs.orgTree.setCheckedKeys(this.checkOrgIds);
|
||||||
this.$store.commit('setOrgIds',this.checkOrgIds);
|
this.$store.commit('setOrgIds',this.checkOrgIds);
|
||||||
// 刷新左侧文件树以及右侧最近编辑与收藏
|
// 刷新左侧文件树以及右侧最近编辑与收藏
|
||||||
@ -483,6 +485,11 @@
|
|||||||
temp = [...this.checkOrgIds];
|
temp = [...this.checkOrgIds];
|
||||||
if (val) {
|
if (val) {
|
||||||
temp.push(this.currentUser.deptId);
|
temp.push(this.currentUser.deptId);
|
||||||
|
}else {
|
||||||
|
let index = temp.indexOf(this.currentUser.deptId);
|
||||||
|
if (index !== -1) {
|
||||||
|
temp.splice(index,1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this.$refs.orgTree.setCheckedKeys(temp)
|
this.$refs.orgTree.setCheckedKeys(temp)
|
||||||
this.$store.commit('setOrgIds',temp);
|
this.$store.commit('setOrgIds',temp);
|
||||||
@ -503,6 +510,10 @@
|
|||||||
if (this.checkOrgIds.indexOf(data.id) === -1) {
|
if (this.checkOrgIds.indexOf(data.id) === -1) {
|
||||||
this.checkOrgIds.push(data.id)
|
this.checkOrgIds.push(data.id)
|
||||||
}
|
}
|
||||||
|
// 如果与当前人的部门一致 当前人部门选中
|
||||||
|
if (this.currentUser.deptId === data.id) {
|
||||||
|
this.currentUserDeptCheck = true;
|
||||||
|
}
|
||||||
}else {
|
}else {
|
||||||
node.expanded = false
|
node.expanded = false
|
||||||
node.isLeaf = false
|
node.isLeaf = false
|
||||||
@ -510,6 +521,10 @@
|
|||||||
if (this.checkOrgIds.indexOf(data.id) !== -1) { // 删除取消勾选节点
|
if (this.checkOrgIds.indexOf(data.id) !== -1) { // 删除取消勾选节点
|
||||||
this.checkOrgIds.splice(this.checkOrgIds.indexOf(data.id),1)
|
this.checkOrgIds.splice(this.checkOrgIds.indexOf(data.id),1)
|
||||||
}
|
}
|
||||||
|
// 如果与当前人的部门一致 当前人部门取消选中
|
||||||
|
if (this.currentUser.deptId === data.id) {
|
||||||
|
this.currentUserDeptCheck = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this.$refs.orgTree.setCheckedKeys(this.checkOrgIds)
|
this.$refs.orgTree.setCheckedKeys(this.checkOrgIds)
|
||||||
this.$store.commit('setOrgIds',this.checkOrgIds);
|
this.$store.commit('setOrgIds',this.checkOrgIds);
|
||||||
@ -596,6 +611,11 @@
|
|||||||
temp = [...this.checkCreateUserIds];
|
temp = [...this.checkCreateUserIds];
|
||||||
if (val) {
|
if (val) {
|
||||||
temp.push(this.currentUser.userId);
|
temp.push(this.currentUser.userId);
|
||||||
|
}else {
|
||||||
|
let index = temp.indexOf(this.currentUser.userId);
|
||||||
|
if (index !== -1) {
|
||||||
|
temp.splice(index,1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this.$store.commit('setCreateUsers',temp);
|
this.$store.commit('setCreateUsers',temp);
|
||||||
// 刷新左侧文件树以及右侧最近编辑与收藏
|
// 刷新左侧文件树以及右侧最近编辑与收藏
|
||||||
@ -719,40 +739,43 @@
|
|||||||
that.createUserOptions = that.conditionData.createUsers;
|
that.createUserOptions = that.conditionData.createUsers;
|
||||||
that.createUserList = that.createUserOptions;
|
that.createUserList = that.createUserOptions;
|
||||||
|
|
||||||
let checkMethodIdCount = that.conditionData.historyCondition.methodIds.length
|
|
||||||
let checkCreateUsersCount = that.conditionData.historyCondition.createUsers.length
|
|
||||||
let index = that.conditionData.historyCondition.createUsers.indexOf(that.currentUser.userId);
|
|
||||||
if (index !== -1) {
|
|
||||||
checkCreateUsersCount = checkCreateUsersCount - 1;
|
|
||||||
that.currentUserCheck = true
|
|
||||||
}else {
|
|
||||||
that.currentUserCheck = false
|
|
||||||
}
|
|
||||||
that.checkAll = checkMethodIdCount === that.methodIds.length;
|
|
||||||
that.userCheckAll = checkCreateUsersCount === that.createUserList.length;
|
|
||||||
that.isIndeterminate = checkMethodIdCount > 0 && checkMethodIdCount < that.methodIds.length;
|
|
||||||
that.userIndeterminate = checkCreateUsersCount > 0 && checkCreateUsersCount < that.createUserList.length;
|
|
||||||
|
|
||||||
// 根据历史筛选条件初始化多选框
|
// 根据历史筛选条件初始化多选框
|
||||||
that.checkCreateUserIds = [];
|
if (that.conditionData.historyCondition) {
|
||||||
that.conditionData.historyCondition.createUsers.forEach(userId => {
|
|
||||||
if (userId !== that.currentUser.userId) {
|
let checkMethodIdCount = that.conditionData.historyCondition.methodIds.length
|
||||||
that.checkCreateUserIds.push(userId);
|
let checkCreateUsersCount = that.conditionData.historyCondition.createUsers.length
|
||||||
|
let index = that.conditionData.historyCondition.createUsers.indexOf(that.currentUser.userId);
|
||||||
|
if (index !== -1) {
|
||||||
|
checkCreateUsersCount = checkCreateUsersCount - 1;
|
||||||
|
that.currentUserCheck = true
|
||||||
|
}else {
|
||||||
|
that.currentUserCheck = false
|
||||||
}
|
}
|
||||||
})
|
that.checkAll = checkMethodIdCount === that.methodIds.length;
|
||||||
that.checkMethodIds = [...that.conditionData.historyCondition.methodIds];
|
that.userCheckAll = checkCreateUsersCount === that.createUserList.length;
|
||||||
that.checkOrgIds = [...that.conditionData.historyCondition.orgIds];
|
that.isIndeterminate = checkMethodIdCount > 0 && checkMethodIdCount < that.methodIds.length;
|
||||||
let orgIdIndex = that.conditionData.historyCondition.orgIds.indexOf(that.currentUser.deptId);
|
that.userIndeterminate = checkCreateUsersCount > 0 && checkCreateUsersCount < that.createUserList.length;
|
||||||
if (orgIdIndex !== -1) {
|
|
||||||
that.currentUserDeptCheck = true;
|
that.checkCreateUserIds = [];
|
||||||
}else {
|
that.conditionData.historyCondition.createUsers.forEach(userId => {
|
||||||
that.currentUserDeptCheck = false;
|
if (userId !== that.currentUser.userId) {
|
||||||
|
that.checkCreateUserIds.push(userId);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
that.checkMethodIds = [...that.conditionData.historyCondition.methodIds];
|
||||||
|
that.checkOrgIds = [...that.conditionData.historyCondition.orgIds];
|
||||||
|
let orgIdIndex = that.conditionData.historyCondition.orgIds.indexOf(that.currentUser.deptId);
|
||||||
|
if (orgIdIndex !== -1) {
|
||||||
|
that.currentUserDeptCheck = true;
|
||||||
|
}else {
|
||||||
|
that.currentUserDeptCheck = false;
|
||||||
|
}
|
||||||
|
that.$nextTick(() => {
|
||||||
|
if (that.$refs.orgTree) {
|
||||||
|
that.$refs.orgTree.setCheckedKeys(that.checkOrgIds);
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
that.$nextTick(() => {
|
|
||||||
if (that.$refs.orgTree) {
|
|
||||||
that.$refs.orgTree.setCheckedKeys(that.checkOrgIds);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
|
|
||||||
initData() {
|
initData() {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user