refactor(测试跟踪): 删除功能二次提醒弹框信息优化

--bug=1015400 --user=陈建星 【所有模块】删除功能二次提醒弹框信息优化 https://www.tapd.cn/55049933/s/1214477
This commit is contained in:
chenjianxing 2022-07-28 14:20:19 +08:00 committed by f2c-ci-robot[bot]
parent f2b6332636
commit e07bd91c7a
29 changed files with 111 additions and 342 deletions

View File

@ -250,31 +250,6 @@ export default {
this.resourcePools = response.data;
});
},
scheduleChange() {
let flag = this.schedule.enable;
let param = {};
param.taskID = this.schedule.id;
param.enable = flag;
let that = this;
if (flag == false) {
this.$confirm(this.$t('api_test.home_page.running_task_list.confirm.close_title'), this.$t('commons.prompt'), {
confirmButtonText: this.$t('commons.confirm'),
cancelButtonText: this.$t('commons.cancel'),
type: 'warning',
beforeClose(action, instance, done) {
if (action == 'cancel') { // messageBox switch
that.schedule.enable = param.enable = true;
}
done(); // done messageBox
},
}).then(() => {
this.updateTask(param);
}).catch(() => {
});
} else {
this.updateTask(param);
}
},
updateTask(param) {
this.result = this.$post('/api/schedule/updateEnableByPrimyKey', param, response => {
let paramTestId = "";

View File

@ -10,8 +10,6 @@
width="60"
:label="$t('api_test.home_page.running_task_list.table_coloum.index')"
show-overflow-tooltip/>
<!-- <el-table-column prop="SwaggerUrlId">-->
<!-- </el-table-column>-->
<el-table-column
prop="swaggerUrl"
:label="$t('swaggerUrl')"
@ -53,7 +51,7 @@
</template>
<script>
import {getCurrentProjectID} from "../../../../../../common/js/utils";
import {getCurrentProjectID, operationConfirm} from "../../../../../../common/js/utils";
export default {
name: "SwaggerTaskList",
@ -82,23 +80,11 @@ export default {
this.$emit('rowClick', row);
},
closeTaskConfirm(row) {
let flag = row.enable;
row.enable = !flag;
if (row.enable) {
this.$confirm(this.$t('api_test.home_page.running_task_list.confirm.close_title'), this.$t('commons.prompt'), {
confirmButtonText: this.$t('commons.confirm'),
cancelButtonText: this.$t('commons.cancel'),
type: 'warning'
}).then(() => {
row.enable = !row.enable
operationConfirm(this, this.$t('api_test.home_page.running_task_list.confirm.close_title'), () => {
row.enable = !row.enable
this.updateTask(row);
}).catch(() => {
});
} else {
row.enable = !row.enable
this.updateTask(row);
}
},
updateTask(taskRow) {
let schedule = {

View File

@ -156,8 +156,8 @@ import MsInputTag from "@/business/components/api/automation/scenario/MsInputTag
import MsCodeEdit from "@/business/components/api/definition/components/MsCodeEdit";
import MsApiVariableAdvance from "@/business/components/api/test/components/ApiVariableAdvance";
import MsTag from "@/business/components/common/components/MsTag";
import {Scenario} from "@/business/components/api/test/model/ScenarioModel";
import {REQUEST_HEADERS} from "@/common/js/constants";
import {operationConfirm} from "@/common/js/utils";
export default {
@ -221,11 +221,7 @@ export default {
},
removeExpect(row) {
this.$confirm(this.$t('api_test.mock.delete_mock_expect'), this.$t('commons.prompt'), {
confirmButtonText: this.$t('commons.confirm'),
cancelButtonText: this.$t('commons.cancel'),
type: 'warning'
}).then(() => {
operationConfirm(this, this.$t('api_test.mock.delete_mock_expect'), () => {
let mockInfoId = row.mockConfigId;
let selectUrl = "/mockConfig/deleteMockExpectConfig/" + row.id;
this.$get(selectUrl, response => {
@ -236,9 +232,7 @@ export default {
message: this.$t('commons.delete_success'),
});
});
}).catch(() => {
});
},
saveMockExpectConfig() {
let mockConfigId = this.mockConfigData.mockConfig.id;

View File

@ -81,7 +81,7 @@
<script>
import {getCurrentProjectID, hasLicense} from "@/common/js/utils";
import {getCurrentProjectID, hasLicense, operationConfirm} from "@/common/js/utils";
import MockEditDrawer from "@/business/components/api/definition/components/mock/MockEditDrawer";
import MsTable from "@/business/components/common/components/table/MsTable";
import MsTableColumn from "@/business/components/common/components/table/MsTableColumn";
@ -327,11 +327,7 @@ export default {
});
},
removeExpect(row) {
this.$confirm(this.$t('api_test.mock.delete_mock_expect'), this.$t('commons.prompt'), {
confirmButtonText: this.$t('commons.confirm'),
cancelButtonText: this.$t('commons.cancel'),
type: 'warning'
}).then(() => {
operationConfirm(this, this.$t('api_test.mock.delete_mock_expect'), () => {
let mockInfoId = row.mockConfigId;
let selectUrl = "/mockConfig/deleteMockExpectConfig/" + row.id;
this.$get(selectUrl, response => {
@ -341,7 +337,6 @@ export default {
message: this.$t('commons.delete_success'),
});
});
}).catch(() => {
});
},
refreshMockInfo(mockConfigId) {

View File

@ -125,7 +125,7 @@ import MsApiVariableAdvance from "@/business/components/api/test/components/ApiV
import MsTag from "@/business/components/common/components/MsTag";
import {REQUEST_HEADERS} from "@/common/js/constants";
import TcpParams from "@/business/components/api/definition/components/request/tcp/TcpParams";
import {getCurrentProjectID} from "@/common/js/utils";
import {operationConfirm} from "@/common/js/utils";
export default {
@ -225,11 +225,7 @@ export default {
});
},
removeExpect(row) {
this.$confirm(this.$t('api_test.mock.delete_mock_expect'), this.$t('commons.prompt'), {
confirmButtonText: this.$t('commons.confirm'),
cancelButtonText: this.$t('commons.cancel'),
type: 'warning'
}).then(() => {
operationConfirm(this, this.$t('api_test.mock.delete_mock_expect'), () => {
let mockInfoId = row.mockConfigId;
let selectUrl = "/mockConfig/deleteMockExpectConfig/" + row.id;
this.$get(selectUrl, response => {
@ -240,9 +236,7 @@ export default {
message: this.$t('commons.delete_success'),
});
});
}).catch(() => {
});
},
saveMockExpectConfig() {
let mockConfigId = this.mockConfigData.mockConfig.id;

View File

@ -68,7 +68,7 @@
<script>
import MsTag from "@/business/components/common/components/MsTag";
import {getCurrentProjectID} from "@/common/js/utils";
import {getCurrentProjectID, operationConfirm} from "@/common/js/utils";
import MsTable from "@/business/components/common/components/table/MsTable";
import MsTableColumn from "@/business/components/common/components/table/MsTableColumn";
@ -135,13 +135,8 @@ export default {
closeTaskConfirm(row) {
let flag = row.taskStatus;
row.taskStatus = !flag; //switch
this.$confirm(this.$t('api_test.home_page.running_task_list.confirm.close_title'), this.$t('commons.prompt'), {
confirmButtonText: this.$t('commons.confirm'),
cancelButtonText: this.$t('commons.cancel'),
type: 'warning'
}).then(() => {
operationConfirm(this, this.$t('api_test.home_page.running_task_list.confirm.close_title'), () => {
this.updateTask(row);
}).catch(() => {
});
},

View File

@ -66,7 +66,7 @@
<script>
import MsTag from "@/business/components/common/components/MsTag";
import {getCurrentProjectID} from "@/common/js/utils";
import {getCurrentProjectID, operationConfirm} from "@/common/js/utils";
import MsTable from "@/business/components/common/components/table/MsTable";
import MsTableColumn from "@/business/components/common/components/table/MsTableColumn";
export default {
@ -134,13 +134,8 @@ export default {
closeTaskConfirm(row){
let flag = row.taskStatus;
row.taskStatus = !flag; //switch
this.$confirm(this.$t('api_test.home_page.running_task_list.confirm.close_title'), this.$t('commons.prompt'), {
confirmButtonText: this.$t('commons.confirm'),
cancelButtonText: this.$t('commons.cancel'),
type: 'warning'
}).then(() => {
operationConfirm(this, this.$t('api_test.home_page.running_task_list.confirm.close_title'), () => {
this.updateTask(row);
}).catch(() => {
});
},

View File

@ -169,7 +169,7 @@ import MsReportTestOverview from './components/TestOverview';
import MsContainer from "../../common/components/MsContainer";
import MsMainContainer from "../../common/components/MsMainContainer";
import MsTag from "@/business/components/common/components/MsTag";
import {exportPdf, getCurrentProjectID, hasPermission} from "@/common/js/utils";
import {exportPdf, getCurrentProjectID, hasPermission, operationConfirm} from "@/common/js/utils";
import html2canvas from 'html2canvas';
import MsPerformanceReportExport from "./PerformanceReportExport";
import {Message} from "element-ui";
@ -336,17 +336,12 @@ export default {
this.dialogFormVisible = false;
},
rerun(testId) {
this.$confirm(this.$t('report.test_rerun_confirm'), '', {
confirmButtonText: this.$t('commons.confirm'),
cancelButtonText: this.$t('commons.cancel'),
type: 'warning'
}).then(() => {
operationConfirm(this, this.$t('report.test_rerun_confirm'), () => {
this.result = this.$post('/performance/run', {id: testId, triggerMode: 'MANUAL'}, (response) => {
this.reportId = response.data;
this.$router.push({path: '/performance/report/view/' + this.reportId});
this.clearData();
});
}).catch(() => {
});
},
onOpen() {

View File

@ -102,7 +102,7 @@
<script>
import MsDialogFooter from "@/business/components/common/components/MsDialogFooter";
import MsTablePagination from "@/business/components/common/pagination/TablePagination";
import {getCurrentProjectID} from "@/common/js/utils";
import {getCurrentProjectID, operationConfirm} from "@/common/js/utils";
import {findThreadGroup} from "@/business/components/performance/test/model/ThreadGroup";
import MsTableButton from "@/business/components/common/components/MsTableButton";
import axios from "axios";
@ -330,17 +330,11 @@ export default {
this.currentRow = row;
},
handleDelete(row) {
this.$confirm(this.$t('project.file_delete_tip', [row.name]), '', {
confirmButtonText: this.$t('commons.confirm'),
cancelButtonText: this.$t('commons.cancel'),
type: 'warning'
}).then(() => {
operationConfirm(this, this.$t('project.file_delete_tip', [row.name]), () => {
this.$get('/project/delete/file/' + row.id, response => {
Message.success(this.$t('commons.delete_success'));
this.getProjectFiles();
});
}).catch(() => {
});
},
handleExceed() {

View File

@ -83,7 +83,7 @@
import MsTablePagination from "@/business/components/common/pagination/TablePagination";
import MsTableButton from "@/business/components/common/components/MsTableButton";
import MsDialogFooter from "@/business/components/common/components/MsDialogFooter";
import {getCurrentProjectID} from "@/common/js/utils";
import {getCurrentProjectID, operationConfirm} from "@/common/js/utils";
import MsTableOperatorButton from "@/business/components/common/components/MsTableOperatorButton";
import {Message} from "element-ui";
import MsTableHeader from "@/business/components/common/components/MsTableHeader";
@ -197,17 +197,11 @@ export default {
this.currentRow = row;
},
handleDelete(row) {
this.$confirm(this.$t('project.file_delete_tip', [row.name]), '', {
confirmButtonText: this.$t('commons.confirm'),
cancelButtonText: this.$t('commons.cancel'),
type: 'warning'
}).then(() => {
operationConfirm(this, this.$t('project.file_delete_tip', [row.name]), () => {
this.$get('/project/delete/file/' + row.id, response => {
Message.success(this.$t('commons.delete_success'));
this.getProjectFiles();
});
}).catch(() => {
});
}
}

View File

@ -87,7 +87,7 @@ import {
getCurrentUser,
getCurrentUserId,
getCurrentWorkspaceId,
listenGoBack,
listenGoBack, operationConfirm,
removeGoBackListener
} from "@/common/js/utils";
@ -288,11 +288,7 @@ export default {
this.$refs.deleteConfirm.open(project);
},
_handleDelete(project) {
this.$confirm(this.$t('project.delete_tip'), '', {
confirmButtonText: this.$t('commons.confirm'),
cancelButtonText: this.$t('commons.cancel'),
type: 'warning'
}).then(() => {
operationConfirm(this, this.$t('project.delete_tip'), () => {
this.$get('/project/delete/' + project.id, () => {
if (project.id === getCurrentProjectID()) {
localStorage.removeItem(PROJECT_ID);
@ -301,11 +297,6 @@ export default {
this.$success(this.$t('commons.delete_success'));
this.list();
});
}).catch(() => {
this.$message({
type: 'info',
message: this.$t('commons.delete_cancelled')
});
});
},
handleClose() {

View File

@ -128,7 +128,7 @@ import EnvironmentEdit from "@/business/components/api/test/components/environme
import MsAsideItem from "@/business/components/common/components/MsAsideItem";
import MsAsideContainer from "@/business/components/common/components/MsAsideContainer";
import ProjectSwitch from "@/business/components/common/head/ProjectSwitch";
import {downloadFile, getCurrentProjectID} from "@/common/js/utils";
import {downloadFile, getCurrentProjectID, operationConfirm} from "@/common/js/utils";
import EnvironmentImport from "@/business/components/project/menu/EnvironmentImport";
import MsMainContainer from "@/business/components/common/components/MsMainContainer";
import MsContainer from "@/business/components/common/components/MsContainer";
@ -295,18 +295,12 @@ export default {
},
deleteEnv(environment) {
if (environment.id) {
this.$confirm(this.$t('commons.confirm_delete') + environment.name, {
confirmButtonText: this.$t('commons.confirm'),
cancelButtonText: this.$t('commons.cancel'),
type: "warning"
}).then(() => {
operationConfirm(this, this.$t('commons.confirm_delete') + environment.name, () => {
this.result = this.$get('/api/environment/delete/' + environment.id, () => {
this.$success(this.$t('commons.delete_success'));
this.list();
});
}).catch(() => {
this.$info(this.$t('commons.delete_cancelled'));
})
});
}
},
getNoRepeatName(name) {

View File

@ -91,7 +91,7 @@ import MsTableHeaderSelectPopover from "@/business/components/common/components/
import ShowMoreBtn from "@/business/components/track/case/components/ShowMoreBtn";
import EditMember from "@/business/components/project/menu/EditMember";
import {GROUP_PROJECT} from "@/common/js/constants";
import {getCurrentProjectID, getCurrentUserId, getCurrentWorkspaceId} from "@/common/js/utils";
import {getCurrentProjectID, getCurrentUserId, getCurrentWorkspaceId, operationConfirm} from "@/common/js/utils";
import MsContainer from "@/business/components/common/components/MsContainer";
import MsMainContainer from "@/business/components/common/components/MsMainContainer";
@ -164,11 +164,7 @@ export default {
this.$set(this.form, 'groupIds', groupIds);
},
del(row) {
this.$confirm(this.$t('member.remove_member'), '', {
confirmButtonText: this.$t('commons.confirm'),
cancelButtonText: this.$t('commons.cancel'),
type: 'warning'
}).then(() => {
operationConfirm(this, this.$t('member.remove_member'), () => {
if (row.id === getCurrentUserId()) {
this.$warning(this.$t('group.unable_to_remove_current_member'));
return;
@ -177,8 +173,6 @@ export default {
this.$success(this.$t('commons.remove_success'));
this.initTableData();
});
}).catch(() => {
this.$info(this.$t('commons.remove_cancel'));
});
},
handleClose() {

View File

@ -81,7 +81,7 @@
import MsTablePagination from "@/business/components/common/pagination/TablePagination";
import MsTableButton from "@/business/components/common/components/MsTableButton";
import MsDialogFooter from "@/business/components/common/components/MsDialogFooter";
import {getCurrentProjectID} from "@/common/js/utils";
import {getCurrentProjectID, operationConfirm} from "@/common/js/utils";
import MsTableOperatorButton from "@/business/components/common/components/MsTableOperatorButton";
import {Message} from "element-ui";
import MsTableHeader from "@/business/components/common/components/MsTableHeader";
@ -204,17 +204,11 @@ export default {
this.currentRow = row;
},
handleDelete(row) {
this.$confirm(this.$t('project.file_delete_tip', [row.name]), '', {
confirmButtonText: this.$t('commons.confirm'),
cancelButtonText: this.$t('commons.cancel'),
type: 'warning'
}).then(() => {
operationConfirm(this, this.$t('project.file_delete_tip', [row.name]), () => {
this.$get('/project/delete/file/' + row.id, response => {
Message.success(this.$t('commons.delete_success'));
this.getProjectFiles();
});
}).catch(() => {
});
}
}

View File

@ -71,7 +71,7 @@
<script>
import MsDialogFooter from "../../common/components/MsDialogFooter";
import {getCurrentUser} from "@/common/js/utils";
import {getCurrentUser, operationConfirm} from "@/common/js/utils";
import MsTableOperatorButton from "../../common/components/MsTableOperatorButton";
import MsTableHeader from "../../common/components/MsTableHeader";
@ -109,19 +109,12 @@ export default {
)
},
deleteApiKey(row) {
this.$confirm(this.$t('user.apikey_delete_confirm'), '', {
confirmButtonText: this.$t('commons.confirm'),
cancelButtonText: this.$t('commons.cancel'),
type: 'warning'
}).then(() => {
operationConfirm(this, this.$t('user.apikey_delete_confirm'), () => {
this.result = this.$get("/user/key/delete/" + row.id, response => {
this.$success(this.$t('commons.delete_success'));
this.search();
})
}).catch(() => {
this.$info(this.$t('commons.delete_cancel'));
});
},
createApiKey() {

View File

@ -70,6 +70,7 @@ import MsTableOperatorButton from "../../common/components/MsTableOperatorButton
import MsTableHeader from "../../common/components/MsTableHeader";
import MsJarConfig from "./JarConfig";
import MsScriptView from "./ScriptView";
import {operationConfirm} from "@/common/js/utils";
export default {
name: "PluginConfig",
@ -128,20 +129,11 @@ export default {
this.$refs.scriptView.open(row.scriptId);
},
handleDelete(id) {
this.$confirm(this.$t('api_test.jar_config.delete_tip'), '', {
confirmButtonText: this.$t('commons.confirm'),
cancelButtonText: this.$t('commons.cancel'),
type: 'warning'
}).then(() => {
operationConfirm(this, this.$t('api_test.jar_config.delete_tip'), () => {
this.result = this.$get("/plugin/delete/" + id, () => {
this.$success(this.$t('commons.delete_success'));
this.initPlugins();
});
}).catch(() => {
this.$message({
type: 'info',
message: this.$t('commons.delete_cancelled')
});
});
},
}

View File

@ -161,7 +161,7 @@ import MsTableOperatorButton from "../../common/components/MsTableOperatorButton
import MsDialogFooter from "../../common/components/MsDialogFooter";
import {
getCurrentWorkspaceId, hasPermission,
listenGoBack,
listenGoBack, operationConfirm,
removeGoBackListener
} from "@/common/js/utils";
import {GROUP_WORKSPACE} from "@/common/js/constants";
@ -345,34 +345,19 @@ export default {
this.$refs.deleteConfirm.open(workspace);
},
_handleDelete(workspace) {
this.$confirm(this.$t('workspace.delete_confirm'), '', {
confirmButtonText: this.$t('commons.confirm'),
cancelButtonText: this.$t('commons.cancel'),
type: 'warning'
}).then(() => {
operationConfirm(this, this.$t('workspace.delete_confirm'), () => {
this.$get('/workspace/special/delete/' + workspace.id, () => {
Message.success(this.$t('commons.delete_success'));
this.list();
});
}).catch(() => {
this.$message({
type: 'info',
message: this.$t('commons.delete_cancelled')
});
});
},
delMember(row) {
this.$confirm(this.$t('member.remove_member'), '', {
confirmButtonText: this.$t('commons.confirm'),
cancelButtonText: this.$t('commons.cancel'),
type: 'warning'
}).then(() => {
operationConfirm(this, this.$t('member.remove_member'), () => {
this.result = this.$get('/user/special/ws/member/delete/' + this.currentWorkspaceRow.id + '/' + encodeURIComponent(row.id), () => {
this.$success(this.$t('commons.remove_success'));
this.cellClick(this.currentWorkspaceRow);
});
}).catch(() => {
this.$info(this.$t('commons.remove_cancel'));
});
},
updateWorkspaceMember(formName) {

View File

@ -281,7 +281,7 @@ import MsTablePagination from "../../common/pagination/TablePagination";
import MsTableHeader from "../../common/components/MsTableHeader";
import MsTableOperator from "../../common/components/MsTableOperator";
import MsDialogFooter from "../../common/components/MsDialogFooter";
import {listenGoBack, removeGoBackListener} from "@/common/js/utils";
import {listenGoBack, operationConfirm, removeGoBackListener} from "@/common/js/utils";
import BatchAddResource from "@/business/components/settings/system/components/BatchAddResource";
import {getYaml} from "@/business/components/settings/system/test-resource-pool";
@ -465,17 +465,11 @@ export default {
this.infoList = resources;
},
del(row) {
this.$confirm(this.$t('test_resource_pool.delete_prompt'), this.$t('commons.prompt'), {
confirmButtonText: this.$t('commons.confirm'),
cancelButtonText: this.$t('commons.cancel'),
type: 'warning'
}).then(() => {
operationConfirm(this, this.$t('test_resource_pool.delete_prompt'), () => {
this.result = this.$get(`/testresourcepool/delete/${row.id}`, () => {
this.initTableData();
this.$success(this.$t('commons.delete_success'));
});
}).catch(() => {
this.$info(this.$t('commons.delete_cancel'));
});
},
createTestResourcePool() {
@ -555,16 +549,11 @@ export default {
if (row.status === 'INVALID') {
this.checkHaveTestUsePool(row).then(() => {
if (this.updatePool && this.updatePool.haveTestUsePool) {
this.$confirm(this.$t('test_resource_pool.update_prompt', [this.updatePool.testName]), this.$t('commons.prompt'), {
confirmButtonText: this.$t('commons.confirm'),
cancelButtonText: this.$t('commons.cancel'),
type: 'warning'
}).then(() => {
operationConfirm(this, this.$t('test_resource_pool.update_prompt', [this.updatePool.testName]), () => {
this.updatePoolStatus(row);
}).catch(() => {
}, () => {
row.status = 'VALID';
this.result.loading = false;
this.$info(this.$t('commons.cancel'));
});
} else {
this.updatePoolStatus(row);

View File

@ -114,7 +114,13 @@ import MsTableHeader from "../../common/components/MsTableHeader";
import MsTableOperator from "../../common/components/MsTableOperator";
import MsDialogFooter from "../../common/components/MsDialogFooter";
import MsTableOperatorButton from "../../common/components/MsTableOperatorButton";
import {getCurrentProjectID, getCurrentUser, listenGoBack, removeGoBackListener} from "@/common/js/utils";
import {
getCurrentProjectID,
getCurrentUser,
listenGoBack,
operationConfirm,
removeGoBackListener
} from "@/common/js/utils";
import MsRolesTag from "../../common/components/MsRolesTag";
import {PHONE_REGEX} from "@/common/js/regex";
import UserImport from "@/business/components/settings/system/components/UserImport";
@ -134,6 +140,7 @@ import GroupCascader from "@/business/components/settings/system/components/Grou
import {logout} from "@/network/user";
import WorkspaceCascader from "@/business/components/settings/system/components/WorkspaceCascader";
import BatchToProjectGroupCascader from "@/business/components/settings/system/components/BatchToProjectGroupCascader";
import {Message} from "element-ui";
export default {
name: "MsUser",
@ -296,17 +303,11 @@ export default {
listenGoBack(this.handleClose);
},
del(row) {
this.$confirm(this.$t('user.delete_confirm'), '', {
confirmButtonText: this.$t('commons.confirm'),
cancelButtonText: this.$t('commons.cancel'),
type: 'warning'
}).then(() => {
operationConfirm(this, this.$t('user.delete_confirm'), () => {
this.result = this.$get(this.deletePath + encodeURIComponent(row.id), () => {
this.$success(this.$t('commons.delete_success'));
this.search();
});
}).catch(() => {
this.$info(this.$t('commons.delete_cancel'));
});
},
createUser(createUserForm) {

View File

@ -100,7 +100,7 @@ import MsTablePagination from "@/business/components/common/pagination/TablePagi
import {GROUP_PROJECT, GROUP_SYSTEM, GROUP_WORKSPACE} from "@/common/js/constants";
import MsTableOperator from "@/business/components/common/components/MsTableOperator";
import UserOptionItem from "@/business/components/settings/common/UserOptionItem";
import {getCurrentProjectID, getCurrentUserId} from "@/common/js/utils";
import {getCurrentProjectID, getCurrentUserId, operationConfirm} from "@/common/js/utils";
export default {
name: "GroupMember",
@ -230,11 +230,7 @@ export default {
});
},
removeMember(row) {
this.$confirm(this.$t('member.remove_member').toString(), '', {
confirmButtonText: this.$t('commons.confirm'),
cancelButtonText: this.$t('commons.cancel'),
type: 'warning'
}).then(() => {
operationConfirm(this, this.$t('member.remove_member'), () => {
if (this.initUserUrl === 'user/ws/current/member/list') {
if (row.id === getCurrentUserId()) {
this.$warning(this.$t('group.unable_to_remove_current_member'));
@ -245,8 +241,6 @@ export default {
this.$success(this.$t('commons.remove_success'));
this.init();
});
}).catch(() => {
this.$info(this.$t('commons.remove_cancel'));
});
},
getGroupSource(row) {

View File

@ -196,7 +196,7 @@ import {
getCurrentProjectID,
getCurrentUser,
getCurrentUserId,
getCurrentWorkspaceId,
getCurrentWorkspaceId, operationConfirm,
removeGoBackListener
} from "@/common/js/utils";
import MsContainer from "../../common/components/MsContainer";
@ -350,11 +350,7 @@ export default {
this.$refs.deleteConfirm.open(project);
},
_handleDelete(project) {
this.$confirm(this.$t('project.delete_tip'), '', {
confirmButtonText: this.$t('commons.confirm'),
cancelButtonText: this.$t('commons.cancel'),
type: 'warning'
}).then(() => {
operationConfirm(this, this.$t('project.delete_tip'), () => {
this.$get('/project/delete/' + project.id, () => {
if (project.id === getCurrentProjectID()) {
localStorage.removeItem(PROJECT_ID);
@ -363,11 +359,6 @@ export default {
Message.success(this.$t('commons.delete_success'));
this.list();
});
}).catch(() => {
this.$message({
type: 'info',
message: this.$t('commons.delete_cancelled')
});
});
},
handleClose() {
@ -471,17 +462,11 @@ export default {
this.$set(this.form, 'groupIds', groupIds);
},
delMember(row) {
this.$confirm(this.$t('member.remove_member'), '', {
confirmButtonText: this.$t('commons.confirm'),
cancelButtonText: this.$t('commons.cancel'),
type: 'warning'
}).then(() => {
operationConfirm(this, this.$t('member.remove_member'), () => {
this.result = this.$get('/user/project/member/delete/' + this.currentProjectId + '/' + encodeURIComponent(row.id), () => {
this.$success(this.$t('commons.remove_success'));
this.dialogSearch();
});
}).catch(() => {
this.$info(this.$t('commons.remove_cancel'));
});
},
close: function () {

View File

@ -103,7 +103,7 @@ import {
getCurrentProjectID,
getCurrentUser,
getCurrentWorkspaceId, hasPermission,
listenGoBack,
listenGoBack, operationConfirm,
removeGoBackListener
} from "@/common/js/utils";
import MsTableHeaderSelectPopover from "@/business/components/common/components/table/MsTableHeaderSelectPopover";
@ -236,17 +236,11 @@ export default {
removeGoBackListener(this.handleClose);
},
del(row) {
this.$confirm(this.$t('member.remove_member'), '', {
confirmButtonText: this.$t('commons.confirm'),
cancelButtonText: this.$t('commons.cancel'),
type: 'warning'
}).then(() => {
operationConfirm(this, this.$t('member.remove_member'), () => {
this.result = this.$get('/user/ws/member/delete/' + getCurrentWorkspaceId() + '/' + encodeURIComponent(row.id), () => {
this.$success(this.$t('commons.remove_success'));
this.initTableData();
});
}).catch(() => {
this.$info(this.$t('commons.remove_cancel'));
});
},
edit(row) {

View File

@ -143,7 +143,7 @@ import EnvironmentEdit from "@/business/components/api/test/components/environme
import MsAsideItem from "@/business/components/common/components/MsAsideItem";
import MsAsideContainer from "@/business/components/common/components/MsAsideContainer";
import ProjectSwitch from "@/business/components/common/head/ProjectSwitch";
import {downloadFile, strMapToObj} from "@/common/js/utils";
import {downloadFile, operationConfirm, strMapToObj} from "@/common/js/utils";
import EnvironmentImport from "@/business/components/project/menu/EnvironmentImport";
import ShowMoreBtn from "@/business/components/track/case/components/ShowMoreBtn";
import {_handleSelect, _handleSelectAll, getSelectDataCounts, setUnSelectIds} from "@/common/js/tableUtils";
@ -341,17 +341,11 @@ export default {
},
deleteEnv(environment) {
if (environment.id) {
this.$confirm(this.$t('commons.confirm_delete') + environment.name, {
confirmButtonText: this.$t('commons.confirm'),
cancelButtonText: this.$t('commons.cancel'),
type: "warning"
}).then(() => {
operationConfirm(this, this.$t('commons.confirm_delete') + environment.name, () => {
this.result = this.$get('/api/environment/delete/' + environment.id, () => {
this.$success(this.$t('commons.delete_success'));
this.list();
});
}).catch(() => {
this.$info(this.$t('commons.delete_cancelled'));
});
}
},

View File

@ -262,7 +262,7 @@ import {
getCurrentUserId,
getCurrentWorkspaceId,
getUUID,
hasLicense,
hasLicense, operationConfirm,
parseTag
} from "@/common/js/utils";
import {getTestTemplate} from "@/network/custom-field-template";
@ -920,13 +920,8 @@ export default {
});
},
handleDelete(testCase) {
this.$alert(this.$t('test_track.case.delete_confirm') + '\'' + testCase.name + '\'' + "", '', {
confirmButtonText: this.$t('commons.confirm'),
callback: (action) => {
if (action === 'confirm') {
operationConfirm(this, this.$t('test_track.case.delete_confirm') + '\'' + testCase.name + '\'', () => {
this._handleDelete(testCase);
}
}
});
},
reduction(testCase) {
@ -945,13 +940,8 @@ export default {
//
this.$refs.apiDeleteConfirm.open(testCase, this.$t('test_track.case.delete_confirm'));
} else {
this.$alert(this.$t('test_track.case.delete_confirm') + '\'' + testCase.name + '\'' + "", '', {
confirmButtonText: this.$t('commons.confirm'),
callback: (action) => {
if (action === 'confirm') {
operationConfirm(this, this.$t('test_track.case.delete_confirm') + '\'' + testCase.name + '\'', () => {
this._handleDeleteVersion(testCase, false);
}
}
});
}
});
@ -965,10 +955,7 @@ export default {
});
},
handleDeleteBatch() {
this.$alert(this.$t('test_track.case.delete_confirm') + "", '', {
confirmButtonText: this.$t('commons.confirm'),
callback: (action) => {
if (action === 'confirm') {
operationConfirm(this, this.$t('test_track.case.delete_confirm'), () => {
let param = buildBatchParam(this, this.$refs.table.selectIds);
this.$post('/test/case/batch/delete', param, () => {
this.$refs.table.clear();
@ -976,8 +963,6 @@ export default {
this.initTableData();
this.$success(this.$t('commons.delete_success'));
});
}
}
});
},
generateGraph() {
@ -991,18 +976,13 @@ export default {
});
},
handleDeleteBatchToGc() {
this.$alert(this.$t('test_track.case.delete_confirm') + "", '', {
confirmButtonText: this.$t('commons.confirm'),
callback: (action) => {
if (action === 'confirm') {
operationConfirm(this, this.$t('test_track.case.delete_confirm'), () => {
let param = buildBatchParam(this, this.$refs.table.selectIds);
this.$post('/test/case/batch/deleteToGc', param, () => {
this.$refs.table.clear();
this.$emit("refresh");
this.$success(this.$t('commons.delete_success'));
});
}
}
});
},
_handleDelete(testCase) {
@ -1170,18 +1150,13 @@ export default {
});
},
handleDeleteBatchToPublic() {
this.$alert(this.$t('test_track.case.delete_confirm') + "", '', {
confirmButtonText: this.$t('commons.confirm'),
callback: (action) => {
if (action === 'confirm') {
operationConfirm(this, this.$t('test_track.case.delete_confirm'), () => {
let param = buildBatchParam(this, this.$refs.table.selectIds);
this.$post('/test/case/batch/movePublic/deleteToGc', param, () => {
this.$refs.table.clear();
this.$emit("refreshPublic");
this.$success(this.$t('commons.delete_success'));
});
}
}
});
},
handleBatchMove() {

View File

@ -66,7 +66,7 @@
<script>
import MsTag from "@/business/components/common/components/MsTag";
import {getCurrentProjectID} from "@/common/js/utils";
import {getCurrentProjectID, operationConfirm} from "@/common/js/utils";
import MsTable from "@/business/components/common/components/table/MsTable";
import MsTableColumn from "@/business/components/common/components/table/MsTableColumn";
export default {
@ -132,13 +132,8 @@ export default {
closeTaskConfirm(row){
let flag = row.taskStatus;
row.taskStatus = !flag; //switch
this.$confirm(this.$t('api_test.home_page.running_task_list.confirm.close_title'), this.$t('commons.prompt'), {
confirmButtonText: this.$t('commons.confirm'),
cancelButtonText: this.$t('commons.cancel'),
type: 'warning'
}).then(() => {
operationConfirm(this, this.$t('api_test.home_page.running_task_list.confirm.close_title'), () => {
this.updateTask(row);
}).catch(() => {
});
},

View File

@ -323,31 +323,6 @@ export default {
}
return true;
},
scheduleChange() {
let flag = this.schedule.enable;
let param = {};
param.taskID = this.schedule.id;
param.enable = flag;
let that = this;
if (flag === false) {
this.$confirm(this.$t('api_test.home_page.running_task_list.confirm.close_title'), this.$t('commons.prompt'), {
confirmButtonText: this.$t('commons.confirm'),
cancelButtonText: this.$t('commons.cancel'),
type: 'warning',
beforeClose(action, instance, done) {
if (action === 'cancel') { // messageBox switch
that.schedule.enable = param.enable = true;
}
done(); // done messageBox
},
}).then(() => {
this.updateTask(param);
}).catch(() => {
});
} else {
this.updateTask(param);
}
},
updateTask(param) {
this.result = this.$post('/test/plan/schedule/updateEnableByPrimyKey', param, response => {
let paramTestId = "";

View File

@ -361,7 +361,7 @@ import {
getCurrentProjectID,
getCurrentUser,
getCurrentUserId,
hasPermission
hasPermission, operationConfirm
} from "@/common/js/utils";
import PlanRunModeWithEnv from "@/business/components/track/plan/common/PlanRunModeWithEnv";
import TestPlanReportReview from "@/business/components/track/report/components/TestPlanReportReview";
@ -690,11 +690,8 @@ export default {
if (row.scheduleOpen) {
message = this.$t('api_test.home_page.running_task_list.confirm.open_title');
}
this.$confirm(message, this.$t('commons.prompt'), {
confirmButtonText: this.$t('commons.confirm'),
cancelButtonText: this.$t('commons.cancel'),
type: 'warning',
}).then(() => {
operationConfirm(this, message, () => {
this.result = this.$post('/test/plan/update/scheduleByEnable', param, response => {
if (row.scheduleOpen) {
row.scheduleStatus = 'OPEN'
@ -705,8 +702,8 @@ export default {
}
this.$success(this.$t('commons.save_success'));
});
}).catch(() => {
row.scheduleOpen = param.enable = !param.enable;
}, () => {
row.scheduleOpen = !row.scheduleOpen;
});
},
handleDelete(testPlan) {

View File

@ -391,15 +391,6 @@ export default {
});
this.dialogFormVisible = false;
},
rerun(testId) {
this.$confirm(this.$t('report.test_rerun_confirm'), '', {
confirmButtonText: this.$t('commons.confirm'),
cancelButtonText: this.$t('commons.cancel'),
type: 'warning'
}).then(() => {
}).catch(() => {
});
},
onOpen() {
},
onError(e) {

View File

@ -600,5 +600,24 @@ export function getTypeByFileName(filename) {
return type.toUpperCase();
}
export function operationConfirm(v, tip, success, cancel) {
if (tip[tip.length - 1] !== '?' && tip[tip.length - 1] !== '') {
tip += '?';
}
return v.$confirm(tip, '', {
confirmButtonText: v.$t('commons.confirm'),
cancelButtonText: v.$t('commons.cancel'),
type: 'warning'
}).then(() => {
if (success) {
success();
}
}).catch(() => {
if (cancel) {
cancel();
}
});
}