伊利项目 架构筛选条件初始默认取消选中

This commit is contained in:
qinoy 2022-08-24 14:24:02 +08:00
parent 208f602491
commit bd7352fe78
3 changed files with 82 additions and 43 deletions

View File

@ -36,9 +36,10 @@
},
created() {
this.getRouteParam(this.$route.query);
let that = this;
setTimeout(() => {
this.initConditionData();
},300)
that.initConditionData();
},300);
},
methods: {
//
@ -57,13 +58,15 @@
if (ro.result === 'ok') {
that.conditionData = ro.data
//
let tempUserArr = [...that.conditionData.historyCondition.createUsers];
that.$store.commit('setCreateUsers',tempUserArr);
let tempOrgIdArr = [...that.conditionData.historyCondition.orgIds];
that.$store.commit('setOrgIds',tempOrgIdArr);
let tempMethodIdArr = [...that.conditionData.historyCondition.methodIds];
that.$store.commit('setMethodIds',tempMethodIdArr);
that.conditionReFresh = true
if (that.conditionData.historyCondition) {
let tempUserArr = [...that.conditionData.historyCondition.createUsers];
that.$store.commit('setCreateUsers',tempUserArr);
let tempOrgIdArr = [...that.conditionData.historyCondition.orgIds];
that.$store.commit('setOrgIds',tempOrgIdArr);
let tempMethodIdArr = [...that.conditionData.historyCondition.methodIds];
that.$store.commit('setMethodIds',tempMethodIdArr);
}
that.conditionReFresh = true;
}else {
that.$message({message: ro.msg, type: 'warning'});
}
@ -110,23 +113,35 @@
}
},
watch : {
'$route': function (newd,old) {
this.conditionReFresh = false;
this.$nextTick(()=>{
this.initConditionData();
});
},
listenTopMainHeight: function (newd, old) {
this.mainHeight = (parseInt(newd)) + 'px';
},
listenWsId: function(newd, old) {
this.reFresh = false;
this.mainContent = '';
this.conditionReFresh = false;
this.$nextTick(()=>{
this.reFresh = true;
this.mainContent = 'RepositoryMainList';
this.initConditionData();
});
},
listenTeamId: function(newd, old) {
this.reFresh = false;
this.mainContent = '';
this.conditionReFresh = false;
this.$nextTick(()=>{
this.reFresh = true;
this.mainContent = 'RepositoryMainList';
this.initConditionData();
});
}
},

View File

@ -478,7 +478,8 @@
havingRemovePerm:false,
havingVersionManagePerm: false,
havingWritePerm: false
}
},
imgPath: ''
}
},
created() {

View File

@ -324,7 +324,7 @@
isLoading:false,
multiple: true,
//
currentUserCheck: true,
currentUserCheck: false,
currentUser: '',
searchUserName: '',
createUserOptions: [],
@ -346,7 +346,7 @@
addressType: 'department',
searchOrgName: '',
checkOrgIds: [],
currentUserDeptCheck: true,
currentUserDeptCheck: false,
dis: false,
headerHeight1: '88px',
@ -459,9 +459,11 @@
this.$store.commit('setCreateUsers',this.checkCreateUserIds);
this.checkMethodIds = [];
this.isIndeterminate = false;
this.userIndeterminate = false;
this.checkAll = false;
this.$store.commit('setMethodIds',this.checkMethodIds);
this.checkOrgIds = [];
this.currentUserDeptCheck = false;
this.$refs.orgTree.setCheckedKeys(this.checkOrgIds);
this.$store.commit('setOrgIds',this.checkOrgIds);
//
@ -483,6 +485,11 @@
temp = [...this.checkOrgIds];
if (val) {
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.$store.commit('setOrgIds',temp);
@ -503,6 +510,10 @@
if (this.checkOrgIds.indexOf(data.id) === -1) {
this.checkOrgIds.push(data.id)
}
//
if (this.currentUser.deptId === data.id) {
this.currentUserDeptCheck = true;
}
}else {
node.expanded = false
node.isLeaf = false
@ -510,6 +521,10 @@
if (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.$store.commit('setOrgIds',this.checkOrgIds);
@ -596,6 +611,11 @@
temp = [...this.checkCreateUserIds];
if (val) {
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);
//
@ -719,40 +739,43 @@
that.createUserOptions = that.conditionData.createUsers;
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 = [];
that.conditionData.historyCondition.createUsers.forEach(userId => {
if (userId !== that.currentUser.userId) {
that.checkCreateUserIds.push(userId);
if (that.conditionData.historyCondition) {
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.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.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 = [];
that.conditionData.historyCondition.createUsers.forEach(userId => {
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() {