refactor: 优化页面刷新代码

This commit is contained in:
Captain.B 2021-06-05 21:28:50 +08:00 committed by 刘瑞斌
parent aa620032f1
commit ace55e4ed1
6 changed files with 28 additions and 10 deletions

View File

@ -77,6 +77,9 @@ export default {
MsMainContainer,
MsChangeHistory
},
inject: [
'reload'
],
data() {
return {
result: {},
@ -107,7 +110,7 @@ export default {
'$route'(to) {
//
if (to.name === 'createPerTest') {
window.location.reload();
this.reload();
return;
}

View File

@ -120,6 +120,9 @@ export default {
scenarios: Array,
isReadOnly: Boolean,
},
inject: [
'reload'
],
data() {
return {
loadFileVisible: false,
@ -321,7 +324,7 @@ export default {
this.getProjectFiles();
// 线
if (this.tableData.filter(f => f.id === this.currentRow.id).length > 0) {
window.location.reload();
this.reload();
}
this.currentRow = null;
});

View File

@ -232,6 +232,9 @@ export default {
return getCurrentWorkspaceId();
}
},
inject: [
'reload'
],
methods: {
create() {
this.dialogWsAddVisible = true;
@ -249,7 +252,7 @@ export default {
this.dialogWsUpdateVisible = false;
if (saveType == 'add') {
Message.success(this.$t('commons.save_success'));
window.location.reload();
this.reload();
} else if (saveType == 'update') {
Message.success(this.$t('commons.modify_success'));
this.list();

View File

@ -93,6 +93,9 @@ import {EMAIL_REGEX, PHONE_REGEX} from "@/common/js/regex";
export default {
name: "MsPersonSetting",
components: {MsDialogFooter, MsTableOperatorButton},
inject: [
'reload'
],
data() {
return {
result: {},
@ -192,7 +195,7 @@ export default {
localStorage.setItem(TokenKey, JSON.stringify(response.data));
this.updateVisible = false;
this.initTableData();
window.location.reload();
this.reload();
});
} else {
return false;
@ -210,7 +213,7 @@ export default {
this.$success(this.$t('commons.modify_success'));
this.editPasswordVisible = false;
this.initTableData();
window.location.reload();
this.reload();
});
} else {
return false;

View File

@ -142,13 +142,16 @@ export default {
UserCascader,
ShowMoreBtn
},
inject: [
'reload'
],
data() {
const validateConfirmPwd = (rule, value, callback) => {
if(value === ''){
if (value === '') {
callback(new Error(this.$t('user.input_password')));
}else if((value !== this.ruleForm.newpassword)){
} else if ((value !== this.ruleForm.newpassword)) {
callback(new Error(this.$t('member.inconsistent_passwords')));
}else{
} else {
callback();
}
};
@ -325,7 +328,7 @@ export default {
this.$success(this.$t('commons.modify_success'));
this.editPasswordVisible = false;
this.search();
window.location.reload();
this.reload();
});
} else {
return false;

View File

@ -298,6 +298,9 @@ export default {
MsMainContainer, MsRolesTag,
MsContainer, MsTableOperator, MsCreateBox, MsTablePagination, MsTableHeader, MsDialogFooter
},
inject: [
'reload'
],
data() {
return {
createVisible: false,
@ -431,7 +434,7 @@ export default {
this.createVisible = false;
Message.success(this.$t('commons.save_success'));
if (saveType === 'add') {
window.location.reload();
this.reload();
} else {
this.list();
}