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

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() { 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
// //
if (that.conditionData.historyCondition) {
let tempUserArr = [...that.conditionData.historyCondition.createUsers]; let tempUserArr = [...that.conditionData.historyCondition.createUsers];
that.$store.commit('setCreateUsers',tempUserArr); that.$store.commit('setCreateUsers',tempUserArr);
let tempOrgIdArr = [...that.conditionData.historyCondition.orgIds]; let tempOrgIdArr = [...that.conditionData.historyCondition.orgIds];
that.$store.commit('setOrgIds',tempOrgIdArr); that.$store.commit('setOrgIds',tempOrgIdArr);
let tempMethodIdArr = [...that.conditionData.historyCondition.methodIds]; let tempMethodIdArr = [...that.conditionData.historyCondition.methodIds];
that.$store.commit('setMethodIds',tempMethodIdArr); that.$store.commit('setMethodIds',tempMethodIdArr);
that.conditionReFresh = true }
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();
}); });
} }
}, },

View File

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

View File

@ -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,6 +739,9 @@
that.createUserOptions = that.conditionData.createUsers; that.createUserOptions = that.conditionData.createUsers;
that.createUserList = that.createUserOptions; that.createUserList = that.createUserOptions;
//
if (that.conditionData.historyCondition) {
let checkMethodIdCount = that.conditionData.historyCondition.methodIds.length let checkMethodIdCount = that.conditionData.historyCondition.methodIds.length
let checkCreateUsersCount = that.conditionData.historyCondition.createUsers.length let checkCreateUsersCount = that.conditionData.historyCondition.createUsers.length
let index = that.conditionData.historyCondition.createUsers.indexOf(that.currentUser.userId); let index = that.conditionData.historyCondition.createUsers.indexOf(that.currentUser.userId);
@ -733,7 +756,6 @@
that.isIndeterminate = checkMethodIdCount > 0 && checkMethodIdCount < that.methodIds.length; that.isIndeterminate = checkMethodIdCount > 0 && checkMethodIdCount < that.methodIds.length;
that.userIndeterminate = checkCreateUsersCount > 0 && checkCreateUsersCount < that.createUserList.length; that.userIndeterminate = checkCreateUsersCount > 0 && checkCreateUsersCount < that.createUserList.length;
//
that.checkCreateUserIds = []; that.checkCreateUserIds = [];
that.conditionData.historyCondition.createUsers.forEach(userId => { that.conditionData.historyCondition.createUsers.forEach(userId => {
if (userId !== that.currentUser.userId) { if (userId !== that.currentUser.userId) {
@ -753,6 +775,7 @@
that.$refs.orgTree.setCheckedKeys(that.checkOrgIds); that.$refs.orgTree.setCheckedKeys(that.checkOrgIds);
} }
}) })
}
}, },
initData() { initData() {