Merge remote-tracking branch 'origin/master'

This commit is contained in:
wenyann 2020-08-05 18:23:24 +08:00
commit de6a585d17
23 changed files with 167 additions and 72 deletions

View File

@ -318,11 +318,13 @@ public class APITestService {
List<String> resourceIds = schedules.stream() List<String> resourceIds = schedules.stream()
.map(Schedule::getResourceId) .map(Schedule::getResourceId)
.collect(Collectors.toList()); .collect(Collectors.toList());
ApiTestExample example = new ApiTestExample(); if (!resourceIds.isEmpty()) {
example.createCriteria().andIdIn(resourceIds); ApiTestExample example = new ApiTestExample();
List<ApiTest> apiTests = apiTestMapper.selectByExample(example); example.createCriteria().andIdIn(resourceIds);
Map<String, String> apiTestMap = apiTests.stream().collect(Collectors.toMap(ApiTest::getId, ApiTest::getName)); List<ApiTest> apiTests = apiTestMapper.selectByExample(example);
scheduleService.build(apiTestMap, schedules); Map<String, String> apiTestMap = apiTests.stream().collect(Collectors.toMap(ApiTest::getId, ApiTest::getName));
scheduleService.build(apiTestMap, schedules);
}
return schedules; return schedules;
} }
} }

View File

@ -18,6 +18,7 @@
import MsMainContainer from "../../../common/components/MsMainContainer"; import MsMainContainer from "../../../common/components/MsMainContainer";
import MsAsideItem from "../../../common/components/MsAsideItem"; import MsAsideItem from "../../../common/components/MsAsideItem";
import EnvironmentEdit from "./environment/EnvironmentEdit"; import EnvironmentEdit from "./environment/EnvironmentEdit";
import {listenGoBack, removeGoBackListener} from "../../../../../common/js/utils";
export default { export default {
name: "ApiEnvironmentConfig", name: "ApiEnvironmentConfig",
@ -45,10 +46,11 @@
} }
}, },
methods: { methods: {
open(projectId) { open: function (projectId) {
this.visible = true; this.visible = true;
this.projectId = projectId; this.projectId = projectId;
this.getEnvironments(); this.getEnvironments();
listenGoBack(this.close);
}, },
deleteEnvironment(environment, index) { deleteEnvironment(environment, index) {
if (environment.id) { if (environment.id) {
@ -134,6 +136,7 @@
this.$emit('close'); this.$emit('close');
this.visible = false; this.visible = false;
this.$refs.environmentEdit.clearValidate(); this.$refs.environmentEdit.clearValidate();
removeGoBackListener(this.close);
} }
} }
} }

View File

@ -95,6 +95,7 @@
<script> <script>
import MsDialogFooter from "../../../../common/components/MsDialogFooter"; import MsDialogFooter from "../../../../common/components/MsDialogFooter";
import ApiEnvironmentConfig from "../ApiEnvironmentConfig"; import ApiEnvironmentConfig from "../ApiEnvironmentConfig";
import {listenGoBack, removeGoBackListener} from "../../../../../../common/js/utils";
export default { export default {
name: "ApiImport", name: "ApiImport",
components: {ApiEnvironmentConfig, MsDialogFooter}, components: {ApiEnvironmentConfig, MsDialogFooter},
@ -174,6 +175,7 @@
methods: { methods: {
open() { open() {
this.visible = true; this.visible = true;
listenGoBack(this.close);
}, },
upload(file) { upload(file) {
this.formData.file = file.file; this.formData.file = file.file;
@ -255,6 +257,8 @@
swaggerUrl: '' swaggerUrl: ''
}; };
this.fileList = []; this.fileList = [];
removeGoBackListener(this.close);
this.visible = false;
} }
} }
} }

View File

@ -25,6 +25,7 @@
import Crontab from "../cron/Crontab"; import Crontab from "../cron/Crontab";
import CrontabResult from "../cron/CrontabResult"; import CrontabResult from "../cron/CrontabResult";
import {cronValidate} from "../../../../common/js/cron"; import {cronValidate} from "../../../../common/js/cron";
import {listenGoBack, removeGoBackListener} from "../../../../common/js/utils";
function defaultCustomValidate() {return {pass: true};} function defaultCustomValidate() {return {pass: true};}
@ -80,6 +81,7 @@
open() { open() {
this.dialogVisible = true; this.dialogVisible = true;
this.form.cronValue = this.schedule.value; this.form.cronValue = this.schedule.value;
listenGoBack(this.close);
}, },
crontabFill(value, resultList) { crontabFill(value, resultList) {
// //
@ -108,6 +110,7 @@
if (!this.schedule.value) { if (!this.schedule.value) {
this.$refs.crontabResult.resultList = []; this.$refs.crontabResult.resultList = [];
} }
removeGoBackListener(this.close);
}, },
intervalShortValidate() { intervalShortValidate() {
if (this.getIntervalTime() < 3*60*1000) { if (this.getIntervalTime() < 3*60*1000) {

View File

@ -48,7 +48,7 @@
</el-card> </el-card>
</ms-main-container> </ms-main-container>
<el-dialog :title="title" :visible.sync="createVisible" destroy-on-close> <el-dialog :title="title" :visible.sync="createVisible" destroy-on-close @close="handleClose">
<el-form :model="form" :rules="rules" ref="form" label-position="right" label-width="100px" size="small"> <el-form :model="form" :rules="rules" ref="form" label-position="right" label-width="100px" size="small">
<el-form-item :label="$t('commons.name')" prop="name"> <el-form-item :label="$t('commons.name')" prop="name">
<el-input v-model="form.name" autocomplete="off"></el-input> <el-input v-model="form.name" autocomplete="off"></el-input>
@ -80,7 +80,7 @@
import MsTableHeader from "../common/components/MsTableHeader"; import MsTableHeader from "../common/components/MsTableHeader";
import MsTableOperator from "../common/components/MsTableOperator"; import MsTableOperator from "../common/components/MsTableOperator";
import MsDialogFooter from "../common/components/MsDialogFooter"; import MsDialogFooter from "../common/components/MsDialogFooter";
import {_sort, getCurrentUser} from "../../../common/js/utils"; import {_sort, getCurrentUser, listenGoBack, removeGoBackListener} from "../../../common/js/utils";
import MsContainer from "../common/components/MsContainer"; import MsContainer from "../common/components/MsContainer";
import MsMainContainer from "../common/components/MsMainContainer"; import MsMainContainer from "../common/components/MsMainContainer";
import MsDeleteConfirm from "../common/components/MsDeleteConfirm"; import MsDeleteConfirm from "../common/components/MsDeleteConfirm";
@ -162,12 +162,14 @@
return false; return false;
} }
this.title = this.$t('project.create'); this.title = this.$t('project.create');
listenGoBack(this.handleClose);
this.createVisible = true; this.createVisible = true;
this.form = {}; this.form = {};
}, },
edit(row) { edit(row) {
this.title = this.$t('project.edit'); this.title = this.$t('project.edit');
this.createVisible = true; this.createVisible = true;
listenGoBack(this.handleClose);
this.form = Object.assign({}, row); this.form = Object.assign({}, row);
}, },
submit(formName) { submit(formName) {
@ -207,6 +209,10 @@
}); });
}); });
}, },
handleClose() {
removeGoBackListener(this.handleClose);
this.createVisible = false;
},
search() { search() {
this.list(); this.list();
}, },

View File

@ -116,7 +116,7 @@
import MsRolesTag from "../../common/components/MsRolesTag"; import MsRolesTag from "../../common/components/MsRolesTag";
import MsTableOperator from "../../common/components/MsTableOperator"; import MsTableOperator from "../../common/components/MsTableOperator";
import MsDialogFooter from "../../common/components/MsDialogFooter"; import MsDialogFooter from "../../common/components/MsDialogFooter";
import {getCurrentUser} from "../../../../common/js/utils"; import {getCurrentUser, listenGoBack, removeGoBackListener} from "../../../../common/js/utils";
export default { export default {
name: "MsOrganizationMember", name: "MsOrganizationMember",
@ -177,6 +177,9 @@
handleClose() { handleClose() {
this.form = {}; this.form = {};
this.options = []; this.options = [];
removeGoBackListener(this.handleClose);
this.updateVisible = false;
this.createVisible = false;
}, },
edit(row) { edit(row) {
this.updateVisible = true; this.updateVisible = true;
@ -187,6 +190,7 @@
}); });
// 使 // 使
this.$set(this.form, 'roleIds', roleIds); this.$set(this.form, 'roleIds', roleIds);
listenGoBack(this.handleClose);
}, },
updateOrgMember(formName) { updateOrgMember(formName) {
let param = { let param = {
@ -231,7 +235,8 @@
this.createVisible = true; this.createVisible = true;
this.result = this.$get('/role/list/org', response => { this.result = this.$get('/role/list/org', response => {
this.$set(this.form, "roles", response.data); this.$set(this.form, "roles", response.data);
}) });
listenGoBack(this.handleClose);
}, },
submitForm(formName) { submitForm(formName) {
this.$refs[formName].validate((valid) => { this.$refs[formName].validate((valid) => {

View File

@ -24,7 +24,7 @@
:total="total"/> :total="total"/>
</el-card> </el-card>
<el-dialog :title="$t('workspace.create')" :visible.sync="dialogWsAddVisible" width="30%"> <el-dialog :title="$t('workspace.create')" :visible.sync="dialogWsAddVisible" width="30%" @close="close">
<el-form :model="form" :rules="rules" ref="form" label-position="right" label-width="100px" size="small"> <el-form :model="form" :rules="rules" ref="form" label-position="right" label-width="100px" size="small">
<el-form-item :label="$t('commons.name')" prop="name"> <el-form-item :label="$t('commons.name')" prop="name">
<el-input v-model="form.name" autocomplete="off"/> <el-input v-model="form.name" autocomplete="off"/>
@ -56,7 +56,7 @@
</el-dialog> </el-dialog>
<!-- dialog of workspace member --> <!-- dialog of workspace member -->
<el-dialog :visible.sync="dialogWsMemberVisible" width="70%" :destroy-on-close="true" @close="closeMemberFunc" <el-dialog :visible.sync="dialogWsMemberVisible" width="70%" :destroy-on-close="true" @close="close"
class="dialog-css"> class="dialog-css">
<ms-table-header :condition.sync="dialogCondition" @create="addMember" @search="dialogSearch" <ms-table-header :condition.sync="dialogCondition" @create="addMember" @search="dialogSearch"
:create-tip="$t('member.create')" :title="$t('commons.member')"/> :create-tip="$t('member.create')" :title="$t('commons.member')"/>
@ -178,8 +178,8 @@
import { import {
getCurrentOrganizationId, getCurrentOrganizationId,
getCurrentUser, getCurrentUser,
getCurrentWorkspaceId, getCurrentWorkspaceId, listenGoBack,
refreshSessionAndCookies refreshSessionAndCookies, removeGoBackListener
} from "../../../../common/js/utils"; } from "../../../../common/js/utils";
import MsDeleteConfirm from "../../common/components/MsDeleteConfirm"; import MsDeleteConfirm from "../../common/components/MsDeleteConfirm";
@ -299,6 +299,7 @@
this.result = this.$get('/role/list/test', response => { this.result = this.$get('/role/list/test', response => {
this.$set(this.memberForm, "roles", response.data); this.$set(this.memberForm, "roles", response.data);
}) })
listenGoBack(this.close);
}, },
cellClick(row) { cellClick(row) {
// currentRow // currentRow
@ -346,10 +347,6 @@
closeFunc() { closeFunc() {
this.form = {}; this.form = {};
}, },
closeMemberFunc() {
this.memberLineData = [];
this.list();
},
submitForm(formName) { submitForm(formName) {
this.$refs[formName].validate((valid) => { this.$refs[formName].validate((valid) => {
if (valid) { if (valid) {
@ -388,6 +385,7 @@
}) })
// //
this.$set(this.memberForm, 'roleIds', roleIds); this.$set(this.memberForm, 'roleIds', roleIds);
listenGoBack(this.close);
}, },
delMember(row) { delMember(row) {
this.$confirm(this.$t('member.remove_member'), '', { this.$confirm(this.$t('member.remove_member'), '', {
@ -422,6 +420,13 @@
} }
}) })
}, },
close: function () {
removeGoBackListener(this.close);
this.dialogWsMemberUpdateVisible = false;
this.dialogWsMemberAddVisible = false;
this.memberLineData = [];
this.list();
},
buildPagePath(path) { buildPagePath(path) {
return path + "/" + this.dialogCurrentPage + "/" + this.dialogPageSize; return path + "/" + this.dialogCurrentPage + "/" + this.dialogPageSize;
}, },

View File

@ -81,7 +81,7 @@
<script> <script>
import {TokenKey} from "../../../../common/js/constants"; import {TokenKey} from "../../../../common/js/constants";
import MsDialogFooter from "../../common/components/MsDialogFooter"; import MsDialogFooter from "../../common/components/MsDialogFooter";
import {getCurrentUser} from "../../../../common/js/utils"; import {getCurrentUser, listenGoBack, removeGoBackListener} from "../../../../common/js/utils";
import MsTableOperatorButton from "../../common/components/MsTableOperatorButton"; import MsTableOperatorButton from "../../common/components/MsTableOperatorButton";
export default { export default {
@ -154,9 +154,11 @@
edit(row) { edit(row) {
this.updateVisible = true; this.updateVisible = true;
this.form = Object.assign({}, row); this.form = Object.assign({}, row);
listenGoBack(this.handleClose);
}, },
editPassword(row) { editPassword(row) {
this.editPasswordVisible = true; this.editPasswordVisible = true;
listenGoBack(this.handleClose);
}, },
cancel(){ cancel(){
this.editPasswordVisible = false; this.editPasswordVisible = false;
@ -209,6 +211,9 @@
handleClose() { handleClose() {
this.form = {}; this.form = {};
this.ruleForm = {}; this.ruleForm = {};
removeGoBackListener(this.handleClose);
this.editPasswordVisible = false;
this.updateVisible = false;
} }
} }
} }

View File

@ -38,7 +38,7 @@
</div> </div>
<el-dialog :title="$t('ldap.test_login')" :visible.sync="loginVisible" width="30%" destroy-on-close <el-dialog :title="$t('ldap.test_login')" :visible.sync="loginVisible" width="30%" destroy-on-close
v-loading="result.loading"> v-loading="result.loading" @close="close">
<el-form :model="loginForm" :rules="loginFormRules" ref="loginForm" label-width="90px"> <el-form :model="loginForm" :rules="loginFormRules" ref="loginForm" label-width="90px">
<el-form-item :label="$t('commons.username')" prop="username"> <el-form-item :label="$t('commons.username')" prop="username">
<el-input v-model="loginForm.username" autocomplete="off" :placeholder="$t('ldap.input_username')"/> <el-input v-model="loginForm.username" autocomplete="off" :placeholder="$t('ldap.input_username')"/>
@ -61,6 +61,7 @@
<script> <script>
import MsDialogFooter from "../../common/components/MsDialogFooter"; import MsDialogFooter from "../../common/components/MsDialogFooter";
import {listenGoBack, removeGoBackListener} from "../../../../common/js/utils";
export default { export default {
name: "LdapSetting", name: "LdapSetting",
@ -118,6 +119,10 @@
this.show = true; this.show = true;
this.init(); this.init();
}, },
close() {
removeGoBackListener(this.close);
this.loginVisible = false;
},
testConnection() { testConnection() {
if (!this.checkParam()) { if (!this.checkParam()) {
return false; return false;
@ -151,6 +156,7 @@
this.loginForm = {}; this.loginForm = {};
this.loginVisible = true; this.loginVisible = true;
listenGoBack(this.close);
}, },
checkParam() { checkParam() {
if (!this.form.url) { if (!this.form.url) {

View File

@ -27,7 +27,7 @@
</el-card> </el-card>
<!-- dialog of organization member --> <!-- dialog of organization member -->
<el-dialog :visible.sync="dialogOrgMemberVisible" width="70%" :destroy-on-close="true" @close="closeMemberFunc" class="dialog-css"> <el-dialog :visible.sync="dialogOrgMemberVisible" width="70%" :destroy-on-close="true" @close="closeFunc" class="dialog-css">
<ms-table-header :condition.sync="dialogCondition" @create="addMember" @search="dialogSearch" <ms-table-header :condition.sync="dialogCondition" @create="addMember" @search="dialogSearch"
:create-tip="$t('member.create')" :title="$t('commons.member')"/> :create-tip="$t('member.create')" :title="$t('commons.member')"/>
<!-- organization member table --> <!-- organization member table -->
@ -178,7 +178,12 @@
import MsTableOperator from "../../common/components/MsTableOperator"; import MsTableOperator from "../../common/components/MsTableOperator";
import MsTableOperatorButton from "../../common/components/MsTableOperatorButton"; import MsTableOperatorButton from "../../common/components/MsTableOperatorButton";
import MsDialogFooter from "../../common/components/MsDialogFooter"; import MsDialogFooter from "../../common/components/MsDialogFooter";
import {getCurrentOrganizationId, getCurrentUser, refreshSessionAndCookies} from "../../../../common/js/utils"; import {
getCurrentOrganizationId,
getCurrentUser, listenGoBack,
refreshSessionAndCookies,
removeGoBackListener
} from "../../../../common/js/utils";
import {DEFAULT, ORGANIZATION} from "../../../../common/js/constants"; import {DEFAULT, ORGANIZATION} from "../../../../common/js/constants";
import MsDeleteConfirm from "../../common/components/MsDeleteConfirm"; import MsDeleteConfirm from "../../common/components/MsDeleteConfirm";
@ -251,6 +256,7 @@
methods: { methods: {
create() { create() {
this.dialogOrgAddVisible = true; this.dialogOrgAddVisible = true;
listenGoBack(this.closeFunc);
}, },
addMember() { addMember() {
this.dialogOrgMemberAddVisible = true; this.dialogOrgMemberAddVisible = true;
@ -265,6 +271,7 @@
edit(row) { edit(row) {
this.dialogOrgUpdateVisible = true; this.dialogOrgUpdateVisible = true;
this.form = Object.assign({}, row); this.form = Object.assign({}, row);
listenGoBack(this.closeFunc);
}, },
editMember(row) { editMember(row) {
this.dialogOrgMemberUpdateVisible = true; this.dialogOrgMemberUpdateVisible = true;
@ -275,6 +282,7 @@
}) })
// //
this.$set(this.memberForm, 'roleIds', roleIds); this.$set(this.memberForm, 'roleIds', roleIds);
listenGoBack(this.closeFunc);
}, },
cellClick(row) { cellClick(row) {
// currentRow // currentRow
@ -297,6 +305,7 @@
} }
this.dialogTotal = data.itemCount; this.dialogTotal = data.itemCount;
}); });
listenGoBack(this.closeFunc);
}, },
dialogSearch() { dialogSearch() {
let row = this.currentRow; let row = this.currentRow;
@ -409,11 +418,15 @@
}) })
}, },
closeFunc() { closeFunc() {
this.form = {};
},
closeMemberFunc() {
this.memberLineData = []; this.memberLineData = [];
this.initTableData(); this.initTableData();
this.form = {};
removeGoBackListener(this.closeFunc);
this.dialogOrgAddVisible = false;
this.dialogOrgUpdateVisible = false;
this.dialogOrgMemberVisible = false;
this.dialogOrgMemberAddVisible = false;
this.dialogOrgMemberUpdateVisible = false;
}, },
handleSelectionChange(val) { handleSelectionChange(val) {
this.multipleSelection = val; this.multipleSelection = val;

View File

@ -28,7 +28,7 @@
</el-card> </el-card>
<!-- add workspace dialog --> <!-- add workspace dialog -->
<el-dialog :title="$t('workspace.create')" :visible.sync="dialogWsAddVisible" width="30%"> <el-dialog :title="$t('workspace.create')" :visible.sync="dialogWsAddVisible" width="30%" @close="close">
<el-form :model="form" :rules="rules" ref="form" label-position="right" label-width="100px" size="small"> <el-form :model="form" :rules="rules" ref="form" label-position="right" label-width="100px" size="small">
<el-form-item :label="$t('commons.name')" prop="name"> <el-form-item :label="$t('commons.name')" prop="name">
<el-input v-model="form.name" autocomplete="off"/> <el-input v-model="form.name" autocomplete="off"/>
@ -56,7 +56,7 @@
</el-dialog> </el-dialog>
<!-- update workspace dialog --> <!-- update workspace dialog -->
<el-dialog :title="$t('workspace.update')" :visible.sync="dialogWsUpdateVisible" width="30%"> <el-dialog :title="$t('workspace.update')" :visible.sync="dialogWsUpdateVisible" width="30%" @close="close">
<el-form :model="form" :rules="rules" ref="updateForm" label-position="right" label-width="100px" size="small"> <el-form :model="form" :rules="rules" ref="updateForm" label-position="right" label-width="100px" size="small">
<el-form-item :label="$t('commons.name')" prop="name"> <el-form-item :label="$t('commons.name')" prop="name">
<el-input v-model="form.name" autocomplete="off"/> <el-input v-model="form.name" autocomplete="off"/>
@ -202,8 +202,8 @@
import { import {
getCurrentOrganizationId, getCurrentOrganizationId,
getCurrentUser, getCurrentUser,
getCurrentWorkspaceId, getCurrentWorkspaceId, listenGoBack,
refreshSessionAndCookies refreshSessionAndCookies, removeGoBackListener
} from "../../../../common/js/utils"; } from "../../../../common/js/utils";
import {DEFAULT, WORKSPACE} from "../../../../common/js/constants"; import {DEFAULT, WORKSPACE} from "../../../../common/js/constants";
import MsDeleteConfirm from "../../common/components/MsDeleteConfirm"; import MsDeleteConfirm from "../../common/components/MsDeleteConfirm";
@ -230,6 +230,7 @@
this.$get("/organization/list", response => { this.$get("/organization/list", response => {
this.$set(this.form, "orgList", response.data); this.$set(this.form, "orgList", response.data);
}) })
listenGoBack(this.close);
}, },
submit(formName) { submit(formName) {
this.$refs[formName].validate((valid) => { this.$refs[formName].validate((valid) => {
@ -255,7 +256,8 @@
}); });
this.result = this.$get('/role/list/test', response => { this.result = this.$get('/role/list/test', response => {
this.$set(this.memberForm, "roles", response.data); this.$set(this.memberForm, "roles", response.data);
}) });
listenGoBack(this.handleClose);
}, },
cellClick(row) { cellClick(row) {
// currentRow // currentRow
@ -279,6 +281,7 @@
} }
this.dialogTotal = data.itemCount; this.dialogTotal = data.itemCount;
}); });
listenGoBack(this.closeWsMemberDialog);
}, },
dialogSearch() { dialogSearch() {
let row = this.currentWorkspaceRow; let row = this.currentWorkspaceRow;
@ -307,6 +310,12 @@
this.$get("/organization/list", response => { this.$get("/organization/list", response => {
this.$set(this.form, "orgList1", response.data); this.$set(this.form, "orgList1", response.data);
}) })
listenGoBack(this.close);
},
close() {
this.dialogWsAddVisible = false;
this.dialogWsUpdateVisible = false;
removeGoBackListener(this.close);
}, },
updateWorkspace(updateForm) { updateWorkspace(updateForm) {
this.$refs[updateForm].validate(valid => { this.$refs[updateForm].validate(valid => {
@ -323,10 +332,15 @@
}, },
handleClose() { handleClose() {
this.memberForm = {}; this.memberForm = {};
this.dialogWsMemberAddVisible = false;
this.dialogWsMemberUpdateVisible = false;
removeGoBackListener(this.handleClose);
}, },
closeWsMemberDialog() { closeWsMemberDialog() {
this.memberLineData = []; this.memberLineData = [];
this.list(); this.list();
removeGoBackListener(this.closeWsMemberDialog);
this.dialogWsMemberVisible = false;
}, },
list() { list() {
let url = '/workspace/list/all/' + this.currentPage + '/' + this.pageSize; let url = '/workspace/list/all/' + this.currentPage + '/' + this.pageSize;
@ -373,6 +387,7 @@
}) })
// //
this.$set(this.memberForm, 'roleIds', roleIds); this.$set(this.memberForm, 'roleIds', roleIds);
listenGoBack(this.handleClose);
}, },
handleDelete(workspace) { handleDelete(workspace) {
this.$refs.deleteConfirm.open(workspace); this.$refs.deleteConfirm.open(workspace);

View File

@ -178,6 +178,7 @@
import MsTableHeader from "../../common/components/MsTableHeader"; import MsTableHeader from "../../common/components/MsTableHeader";
import MsTableOperator from "../../common/components/MsTableOperator"; import MsTableOperator from "../../common/components/MsTableOperator";
import MsDialogFooter from "../../common/components/MsDialogFooter"; import MsDialogFooter from "../../common/components/MsDialogFooter";
import {listenGoBack, removeGoBackListener} from "../../../../common/js/utils";
export default { export default {
name: "MsTestResourcePool", name: "MsTestResourcePool",
@ -272,11 +273,13 @@
}, },
create() { create() {
this.createVisible = true; this.createVisible = true;
listenGoBack(this.closeFunc);
}, },
edit(row) { edit(row) {
this.updateVisible = true; this.updateVisible = true;
this.form = JSON.parse(JSON.stringify(row)); this.form = JSON.parse(JSON.stringify(row));
this.convertResources(); this.convertResources();
listenGoBack(this.closeFunc);
}, },
convertResources() { convertResources() {
let resources = []; let resources = [];
@ -364,6 +367,9 @@
}, },
closeFunc() { closeFunc() {
this.form = {}; this.form = {};
this.updateVisible = false;
this.createVisible = false;
removeGoBackListener(this.closeFunc);
}, },
changeSwitch(row) { changeSwitch(row) {
this.result.loading = true; this.result.loading = true;

View File

@ -296,7 +296,7 @@
import MsTableOperator from "../../common/components/MsTableOperator"; import MsTableOperator from "../../common/components/MsTableOperator";
import MsDialogFooter from "../../common/components/MsDialogFooter"; import MsDialogFooter from "../../common/components/MsDialogFooter";
import MsTableOperatorButton from "../../common/components/MsTableOperatorButton"; import MsTableOperatorButton from "../../common/components/MsTableOperatorButton";
import {getCurrentUser} from "../../../../common/js/utils"; import {getCurrentUser, listenGoBack, removeGoBackListener} from "../../../../common/js/utils";
import MsRolesTag from "../../common/components/MsRolesTag"; import MsRolesTag from "../../common/components/MsRolesTag";
export default { export default {
@ -404,6 +404,7 @@
this.createVisible = true; this.createVisible = true;
this.getOrgList(); this.getOrgList();
this.getWsList(); this.getWsList();
listenGoBack(this.handleClose);
}, },
edit(row) { edit(row) {
this.updateVisible = true; this.updateVisible = true;
@ -418,10 +419,12 @@
let data = response.data; let data = response.data;
this.$set(this.form, "roles", data); this.$set(this.form, "roles", data);
}); });
listenGoBack(this.handleClose);
}, },
editPassword(row) { editPassword(row) {
this.editPasswordVisible = true; this.editPasswordVisible = true;
this.ruleForm = Object.assign({}, row); this.ruleForm = Object.assign({}, row);
listenGoBack(this.handleClose);
}, },
del(row) { del(row) {
this.$confirm(this.$t('user.delete_confirm'), '', { this.$confirm(this.$t('user.delete_confirm'), '', {
@ -497,6 +500,10 @@
handleClose() { handleClose() {
this.form = {roles: [{id: ''}]}; this.form = {roles: [{id: ''}]};
this.btnAddRole = false; this.btnAddRole = false;
removeGoBackListener(this.handleClose);
this.editPasswordVisible = false;
this.createVisible = false;
this.updateVisible = false;
}, },
changeSwitch(row) { changeSwitch(row) {
this.$post('/user/special/update_status', row, () => { this.$post('/user/special/update_status', row, () => {

View File

@ -108,7 +108,7 @@
import MsRolesTag from "../../common/components/MsRolesTag"; import MsRolesTag from "../../common/components/MsRolesTag";
import MsTableOperator from "../../common/components/MsTableOperator"; import MsTableOperator from "../../common/components/MsTableOperator";
import MsDialogFooter from "../../common/components/MsDialogFooter"; import MsDialogFooter from "../../common/components/MsDialogFooter";
import {getCurrentUser} from "../../../../common/js/utils"; import {getCurrentUser, listenGoBack, removeGoBackListener} from "../../../../common/js/utils";
export default { export default {
name: "MsMember", name: "MsMember",
@ -173,6 +173,9 @@
}, },
handleClose() { handleClose() {
this.form = {}; this.form = {};
this.createVisible = false;
this.updateVisible = false;
removeGoBackListener(this.handleClose);
}, },
del(row) { del(row) {
this.$confirm(this.$t('member.remove_member'), '', { this.$confirm(this.$t('member.remove_member'), '', {
@ -197,6 +200,7 @@
}) })
// 使 // 使
this.$set(this.form, 'roleIds', roleIds); this.$set(this.form, 'roleIds', roleIds);
listenGoBack(this.handleClose);
}, },
updateWorkspaceMember(formName) { updateWorkspaceMember(formName) {
let param = { let param = {
@ -239,6 +243,7 @@
this.result = this.$get('/role/list/test', response => { this.result = this.$get('/role/list/test', response => {
this.$set(this.form, "roles", response.data); this.$set(this.form, "roles", response.data);
}) })
listenGoBack(this.handleClose);
}, },
submitForm(formName) { submitForm(formName) {
this.$refs[formName].validate((valid) => { this.$refs[formName].validate((valid) => {

View File

@ -36,6 +36,7 @@
<script> <script>
import MsDialogFooter from "../../../common/components/MsDialogFooter"; import MsDialogFooter from "../../../common/components/MsDialogFooter";
import {WORKSPACE_ID} from "../../../../../common/js/constants"; import {WORKSPACE_ID} from "../../../../../common/js/constants";
import {listenGoBack, removeGoBackListener} from "../../../../../common/js/utils";
export default { export default {
name: "BatchEdit", name: "BatchEdit",
@ -88,9 +89,11 @@
open() { open() {
this.dialogVisible = true; this.dialogVisible = true;
this.size = this.$parent.selectRows.size; this.size = this.$parent.selectRows.size;
listenGoBack(this.handleClose);
}, },
handleClose() { handleClose() {
this.form = {}; this.form = {};
removeGoBackListener(this.handleClose);
}, },
changeType(val) { changeType(val) {
this.$set(this.form, "value", ""); this.$set(this.form, "value", "");

View File

@ -224,6 +224,7 @@
import {WORKSPACE_ID, TokenKey} from '../../../../../common/js/constants'; import {WORKSPACE_ID, TokenKey} from '../../../../../common/js/constants';
import MsDialogFooter from '../../../common/components/MsDialogFooter' import MsDialogFooter from '../../../common/components/MsDialogFooter'
import {listenGoBack, removeGoBackListener, removeListenGoBack} from "../../../../../common/js/utils";
export default { export default {
name: "TestCaseEdit", name: "TestCaseEdit",
@ -302,7 +303,12 @@
methods: { methods: {
open(testCase) { open(testCase) {
this.resetForm(); this.resetForm();
this.listenGoBack();
if (window.history && window.history.pushState) {
history.pushState(null, null, document.URL);
window.addEventListener('popstate', this.close);
}
listenGoBack(this.close);
this.operationType = 'add'; this.operationType = 'add';
if (testCase) { if (testCase) {
// //
@ -354,16 +360,9 @@
} }
}); });
}, },
listenGoBack() {
//
if (window.history && window.history.pushState) {
history.pushState(null, null, document.URL);
window.addEventListener('popstate', this.close, false);
}
},
close() { close() {
// //
window.removeEventListener('popstate', this.goBack, false); removeGoBackListener(this.close);
this.dialogFormVisible = false; this.dialogFormVisible = false;
}, },
saveCase() { saveCase() {

View File

@ -1,6 +1,6 @@
<template> <template>
<el-dialog class="testcase-import" :title="$t('test_track.case.import.case_import')" :visible.sync="dialogVisible" <el-dialog class="testcase-import" :title="$t('test_track.case.import.case_import')" :visible.sync="dialogVisible"
@close="init"> @close="close">
<el-row> <el-row>
<el-link type="primary" class="download-template" <el-link type="primary" class="download-template"
@ -44,6 +44,7 @@
<script> <script>
import ElUploadList from "element-ui/packages/upload/src/upload-list"; import ElUploadList from "element-ui/packages/upload/src/upload-list";
import MsTableButton from '../../../../components/common/components/MsTableButton'; import MsTableButton from '../../../../components/common/components/MsTableButton';
import {listenGoBack, removeGoBackListener} from "../../../../../common/js/utils";
export default { export default {
name: "TestCaseImport", name: "TestCaseImport",
@ -85,13 +86,16 @@
this.isLoading = false; this.isLoading = false;
this.$error(err.message); this.$error(err.message);
}, },
init() { open() {
listenGoBack(this.close);
this.dialogVisible = true;
},
close() {
removeGoBackListener(this.close);
this.dialogVisible = false;
this.fileList = []; this.fileList = [];
this.errList = []; this.errList = [];
}, },
open() {
this.dialogVisible = true;
},
downloadTemplate() { downloadTemplate() {
this.$fileDownload('/test/case/export/template'); this.$fileDownload('/test/case/export/template');
}, },

View File

@ -172,7 +172,6 @@
currentPage: 1, currentPage: 1,
pageSize: 10, pageSize: 10,
total: 0, total: 0,
// selectIds: new Set(),
selectRows: new Set(), selectRows: new Set(),
priorityFilters: [ priorityFilters: [
{text: 'P0', value: 'P0'}, {text: 'P0', value: 'P0'},
@ -274,14 +273,8 @@
confirmButtonText: this.$t('commons.confirm'), confirmButtonText: this.$t('commons.confirm'),
callback: (action) => { callback: (action) => {
if (action === 'confirm') { if (action === 'confirm') {
// this.$post('/test/case/batch/delete', {ids: [...this.selectIds]}, () => {
// this.selectIds.clear();
// this.$emit("refresh");
// this.$success(this.$t('commons.delete_success'));
// });
let ids = Array.from(this.selectRows).map(row => row.id); let ids = Array.from(this.selectRows).map(row => row.id);
this.$post('/test/case/batch/delete', {ids: ids}, () => { this.$post('/test/case/batch/delete', {ids: ids}, () => {
// this.selectIds.clear();
this.selectRows.clear(); this.selectRows.clear();
this.$emit("refresh"); this.$emit("refresh");
this.$success(this.$t('commons.delete_success')); this.$success(this.$t('commons.delete_success'));
@ -375,17 +368,12 @@
}); });
}, },
handleBatch(type) { handleBatch(type) {
// if (this.selectIds.size < 1) {
// this.$warning(this.$t('test_track.plan_view.select_manipulate'));
// return;
// }
if (this.selectRows.size < 1) { if (this.selectRows.size < 1) {
this.$warning(this.$t('test_track.plan_view.select_manipulate')); this.$warning(this.$t('test_track.plan_view.select_manipulate'));
return; return;
} }
if (type === 'move') { if (type === 'move') {
let ids = Array.from(this.selectRows).map(row => row.id); let ids = Array.from(this.selectRows).map(row => row.id);
// this.$emit('moveToNode', this.selectIds);
this.$emit('moveToNode', ids); this.$emit('moveToNode', ids);
} else if (type === 'delete') { } else if (type === 'delete') {
this.handleDeleteBatch(); this.handleDeleteBatch();

View File

@ -25,6 +25,7 @@
<script> <script>
import MsDialogFooter from '../../../common/components/MsDialogFooter'; import MsDialogFooter from '../../../common/components/MsDialogFooter';
import {listenGoBack, removeGoBackListener} from "../../../../../common/js/utils";
export default { export default {
name: "TestCaseMove", name: "TestCaseMove",
@ -62,11 +63,13 @@
this.moduleOptions = moduleOptions; this.moduleOptions = moduleOptions;
this.selectIds = selectIds; this.selectIds = selectIds;
this.dialogVisible = true; this.dialogVisible = true;
listenGoBack(this.close);
}, },
close() { close() {
this.module = ''; this.module = '';
this.selectIds = []; this.selectIds = [];
this.dialogVisible = false; this.dialogVisible = false;
removeGoBackListener(this.close);
} }
} }
} }

View File

@ -30,8 +30,8 @@
</template> </template>
<script> <script>
import {CURRENT_PROJECT} from '../../../../common/js/constants';
import MsDialogFooter from '../../common/components/MsDialogFooter'; import MsDialogFooter from '../../common/components/MsDialogFooter';
import {listenGoBack, removeGoBackListener} from "../../../../common/js/utils";
export default { export default {
components: {MsDialogFooter}, components: {MsDialogFooter},
@ -70,6 +70,7 @@
this.form.name = this.node.name; this.form.name = this.node.name;
} }
this.nodeIds = nodeIds; this.nodeIds = nodeIds;
listenGoBack(this.close);
this.dialogFormVisible = true; this.dialogFormVisible = true;
}, },
saveNode() { saveNode() {
@ -118,6 +119,7 @@
}, },
close() { close() {
this.form.name = ''; this.form.name = '';
removeGoBackListener(this.close);
this.dialogFormVisible = false; this.dialogFormVisible = false;
} }
} }

View File

@ -4,6 +4,7 @@
<el-dialog :title="operationType == 'edit' ? $t('test_track.plan.edit_plan') : $t('test_track.plan.create_plan')" <el-dialog :title="operationType == 'edit' ? $t('test_track.plan.edit_plan') : $t('test_track.plan.create_plan')"
:visible.sync="dialogFormVisible" :visible.sync="dialogFormVisible"
@close="close"
width="65%"> width="65%">
<el-form :model="form" :rules="rules" ref="planFrom"> <el-form :model="form" :rules="rules" ref="planFrom">
@ -111,6 +112,7 @@
import {WORKSPACE_ID} from '../../../../../common/js/constants'; import {WORKSPACE_ID} from '../../../../../common/js/constants';
import TestPlanStatusButton from "../common/TestPlanStatusButton"; import TestPlanStatusButton from "../common/TestPlanStatusButton";
import {listenGoBack, removeGoBackListener} from "../../../../../common/js/utils";
export default { export default {
name: "TestPlanEdit", name: "TestPlanEdit",
@ -154,6 +156,7 @@
Object.assign(tmp, testPlan); Object.assign(tmp, testPlan);
Object.assign(this.form, tmp); Object.assign(this.form, tmp);
} }
listenGoBack(this.close);
this.dialogFormVisible = true; this.dialogFormVisible = true;
}, },
savePlan(){ savePlan(){
@ -196,6 +199,10 @@
this.form.status = status; this.form.status = status;
this.$forceUpdate(); this.$forceUpdate();
}, },
close() {
removeGoBackListener(this.close);
this.dialogFormVisible = false;
},
resetForm() { resetForm() {
// //
if (this.$refs['planFrom']) { if (this.$refs['planFrom']) {

View File

@ -225,6 +225,7 @@
import ApiTestResult from "./test/ApiTestResult"; import ApiTestResult from "./test/ApiTestResult";
import PerformanceTestDetail from "./test/PerformanceTestDetail"; import PerformanceTestDetail from "./test/PerformanceTestDetail";
import PerformanceTestResult from "./test/PerformanceTestResult"; import PerformanceTestResult from "./test/PerformanceTestResult";
import {listenGoBack, removeGoBackListener} from "../../../../../../common/js/utils";
export default { export default {
name: "TestPlanTestCaseEdit", name: "TestPlanTestCaseEdit",
@ -265,19 +266,8 @@
} }
}, },
methods: { methods: {
listenGoBack() {
//
if (window.history && window.history.pushState) {
history.pushState(null, null, document.URL);
window.addEventListener('popstate', this.goBack, false);
}
},
goBack() {
this.handleClose();
},
handleClose() { handleClose() {
// removeGoBackListener(this.handleClose);
window.removeEventListener('popstate', this.goBack, false);
this.showDialog = false; this.showDialog = false;
}, },
cancel() { cancel() {
@ -359,7 +349,7 @@
openTestCaseEdit(testCase) { openTestCaseEdit(testCase) {
this.showDialog = true; this.showDialog = true;
this.activeTab = 'detail'; this.activeTab = 'detail';
this.listenGoBack(); listenGoBack(this.handleClose);
this.initData(testCase); this.initData(testCase);
}, },
initTest() { initTest() {

View File

@ -174,3 +174,17 @@ export function downloadFile(name, content) {
navigator.msSaveBlob(blob, name) navigator.msSaveBlob(blob, name)
} }
} }
export function listenGoBack( callback) {
//监听浏览器返回操作,关闭该对话框
if (window.history && window.history.pushState) {
history.pushState(null, null, document.URL);
window.addEventListener('popstate', callback);
}
}
export function removeGoBackListener(callback) {
window.removeEventListener('popstate', callback);
}