refactor(项目设置): 优化删除误报的提示
--bug=1019782 --user=王孝刚 【项目设置】删除误报提示优化 https://www.tapd.cn/55049933/s/1300816
This commit is contained in:
parent
ab63f3867e
commit
4ff72c0b7f
|
@ -1,13 +1,18 @@
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<el-card class="table-card" v-loading="loading">
|
<el-card class="table-card" v-loading="loading">
|
||||||
<ms-table-header :condition.sync="condition" @search="initTableData"
|
<ms-table-header
|
||||||
|
:condition.sync="condition"
|
||||||
|
@search="initTableData"
|
||||||
style="margin-bottom: 10px"
|
style="margin-bottom: 10px"
|
||||||
v-permission="['PROJECT_ERROR_REPORT_LIBRARY:READ+CREATE']"
|
v-permission="['PROJECT_ERROR_REPORT_LIBRARY:READ+CREATE']"
|
||||||
@create="createErrorReport"
|
@create="createErrorReport"
|
||||||
:createTip="$t('error_report_library.option.create')">
|
:createTip="$t('error_report_library.option.create')"
|
||||||
|
>
|
||||||
<template v-slot:button>
|
<template v-slot:button>
|
||||||
<span style="margin-left: 10px;">{{$t("error_report_library.tips")}}</span>
|
<span style="margin-left: 10px">{{
|
||||||
|
$t("error_report_library.tips")
|
||||||
|
}}</span>
|
||||||
</template>
|
</template>
|
||||||
</ms-table-header>
|
</ms-table-header>
|
||||||
|
|
||||||
|
@ -27,18 +32,30 @@
|
||||||
@refresh="initTableData"
|
@refresh="initTableData"
|
||||||
ref="caseTable"
|
ref="caseTable"
|
||||||
>
|
>
|
||||||
|
<ms-table-column
|
||||||
|
min-width="300"
|
||||||
|
prop="errorCode"
|
||||||
|
:label="$t('error_report_library.option.error_code')"
|
||||||
|
:show-overflow-tooltip="true"
|
||||||
|
/>
|
||||||
|
|
||||||
<ms-table-column min-width="300" prop="errorCode" :label="$t('error_report_library.option.error_code')"
|
<ms-table-column
|
||||||
:show-overflow-tooltip="true"/>
|
prop="matchType"
|
||||||
|
:label="$t('error_report_library.option.match_type')"
|
||||||
<ms-table-column prop="matchType" :label="$t('error_report_library.option.match_type')">
|
>
|
||||||
<template v-slot:default="scope">
|
<template v-slot:default="scope">
|
||||||
<ms-tag v-if="scope.row.matchType == 'Text'" effect="plain"
|
<ms-tag
|
||||||
:content="$t('error_report_library.match_type.text')"/>
|
v-if="scope.row.matchType == 'Text'"
|
||||||
|
effect="plain"
|
||||||
|
:content="$t('error_report_library.match_type.text')"
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
</ms-table-column>
|
</ms-table-column>
|
||||||
|
|
||||||
<ms-table-column width="100" :label="$t('error_report_library.option.status')">
|
<ms-table-column
|
||||||
|
width="100"
|
||||||
|
:label="$t('error_report_library.option.status')"
|
||||||
|
>
|
||||||
<template v-slot:default="scope">
|
<template v-slot:default="scope">
|
||||||
<div>
|
<div>
|
||||||
<el-switch
|
<el-switch
|
||||||
|
@ -50,66 +67,95 @@
|
||||||
</template>
|
</template>
|
||||||
</ms-table-column>
|
</ms-table-column>
|
||||||
|
|
||||||
<ms-table-column prop="createTime"
|
<ms-table-column
|
||||||
:label="$t('commons.create_time' )"
|
prop="createTime"
|
||||||
show-overflow-tooltip>
|
:label="$t('commons.create_time')"
|
||||||
|
show-overflow-tooltip
|
||||||
|
>
|
||||||
<template v-slot:default="scope">
|
<template v-slot:default="scope">
|
||||||
<span>{{ scope.row.createTime | datetimeFormat }}</span>
|
<span>{{ scope.row.createTime | datetimeFormat }}</span>
|
||||||
</template>
|
</template>
|
||||||
</ms-table-column>
|
</ms-table-column>
|
||||||
|
|
||||||
<ms-table-column prop="updateTime"
|
<ms-table-column
|
||||||
:label="$t('commons.update_time' )"
|
prop="updateTime"
|
||||||
show-overflow-tooltip>
|
:label="$t('commons.update_time')"
|
||||||
|
show-overflow-tooltip
|
||||||
|
>
|
||||||
<template v-slot:default="scope">
|
<template v-slot:default="scope">
|
||||||
<span>{{ scope.row.updateTime | datetimeFormat }}</span>
|
<span>{{ scope.row.updateTime | datetimeFormat }}</span>
|
||||||
</template>
|
</template>
|
||||||
</ms-table-column>
|
</ms-table-column>
|
||||||
|
|
||||||
<ms-table-column prop="createUser" :label="$t('commons.create_user')" show-overflow-tooltip/>
|
<ms-table-column
|
||||||
<ms-table-column prop="description" :label="$t('commons.description')" show-overflow-tooltip/>
|
prop="createUser"
|
||||||
|
:label="$t('commons.create_user')"
|
||||||
|
show-overflow-tooltip
|
||||||
|
/>
|
||||||
|
<ms-table-column
|
||||||
|
prop="description"
|
||||||
|
:label="$t('commons.description')"
|
||||||
|
show-overflow-tooltip
|
||||||
|
/>
|
||||||
|
|
||||||
<ms-table-column min-width="150" :label="$t('commons.operating')">
|
<ms-table-column min-width="150" :label="$t('commons.operating')">
|
||||||
<template v-slot:default="scope">
|
<template v-slot:default="scope">
|
||||||
<div>
|
<div>
|
||||||
<ms-table-operator-button :tip="$t('commons.edit')" icon="el-icon-edit"
|
<ms-table-operator-button
|
||||||
|
:tip="$t('commons.edit')"
|
||||||
|
icon="el-icon-edit"
|
||||||
:disabled="scope.row.status === 'SENDED'"
|
:disabled="scope.row.status === 'SENDED'"
|
||||||
v-permission="['PROJECT_ERROR_REPORT_LIBRARY:READ+EDIT']"
|
v-permission="['PROJECT_ERROR_REPORT_LIBRARY:READ+EDIT']"
|
||||||
@exec="editErrorReport(scope.row)"/>
|
@exec="editErrorReport(scope.row)"
|
||||||
<ms-table-operator-button type="danger"
|
/>
|
||||||
|
<ms-table-operator-button
|
||||||
|
type="danger"
|
||||||
@exec="deleteReport(scope.row)"
|
@exec="deleteReport(scope.row)"
|
||||||
v-permission="['PROJECT_ERROR_REPORT_LIBRARY:READ+DELETE']"
|
v-permission="['PROJECT_ERROR_REPORT_LIBRARY:READ+DELETE']"
|
||||||
:tip="$t('commons.delete')" icon="el-icon-delete"/>
|
:tip="$t('commons.delete')"
|
||||||
|
icon="el-icon-delete"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</ms-table-column>
|
</ms-table-column>
|
||||||
</ms-table>
|
</ms-table>
|
||||||
<ms-table-pagination :change="initTableData" :current-page.sync="page.currentPage" :page-size.sync="page.pageSize"
|
<ms-table-pagination
|
||||||
:total="page.total"/>
|
:change="initTableData"
|
||||||
|
:current-page.sync="page.currentPage"
|
||||||
|
:page-size.sync="page.pageSize"
|
||||||
|
:total="page.total"
|
||||||
|
/>
|
||||||
</el-card>
|
</el-card>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import {getPageInfo} from "metersphere-frontend/src/utils/tableUtils";
|
import { getPageInfo } from "metersphere-frontend/src/utils/tableUtils";
|
||||||
import {getCurrentProjectID} from "metersphere-frontend/src/utils/token";
|
import { getCurrentProjectID } from "metersphere-frontend/src/utils/token";
|
||||||
import MsTable from "metersphere-frontend/src/components/table/MsTable";
|
import MsTable from "metersphere-frontend/src/components/table/MsTable";
|
||||||
import MsTableColumn from "metersphere-frontend/src/components/table/MsTableColumn";
|
import MsTableColumn from "metersphere-frontend/src/components/table/MsTableColumn";
|
||||||
import ShowMoreBtn from "metersphere-frontend/src/components/table/ShowMoreBtn";
|
import ShowMoreBtn from "metersphere-frontend/src/components/table/ShowMoreBtn";
|
||||||
import MsTableHeader from "metersphere-frontend/src/components/MsTableHeader";
|
import MsTableHeader from "metersphere-frontend/src/components/MsTableHeader";
|
||||||
import {hasPermission} from "metersphere-frontend/src/utils/permission";
|
import { hasPermission } from "metersphere-frontend/src/utils/permission";
|
||||||
import MsTableOperatorButton from "metersphere-frontend/src/components/MsTableOperatorButton";
|
import MsTableOperatorButton from "metersphere-frontend/src/components/MsTableOperatorButton";
|
||||||
import MsTag from "metersphere-frontend/src/components/MsTag";
|
import MsTag from "metersphere-frontend/src/components/MsTag";
|
||||||
import MsTablePagination from "metersphere-frontend/src/components/pagination/TablePagination";
|
import MsTablePagination from "metersphere-frontend/src/components/pagination/TablePagination";
|
||||||
import {
|
import {
|
||||||
deleteErrorReportLibrary,
|
deleteErrorReportLibrary,
|
||||||
getErrorReportLibraryById,
|
getErrorReportLibraryById,
|
||||||
getErrorReportLibraryPages, modifyErrorReportLibrary
|
getErrorReportLibraryPages,
|
||||||
|
modifyErrorReportLibrary,
|
||||||
} from "../../../../../api/error-report-library";
|
} from "../../../../../api/error-report-library";
|
||||||
|
import { operationConfirm } from "metersphere-frontend/src/utils";
|
||||||
export default {
|
export default {
|
||||||
name: "ProjectReportList",
|
name: "ProjectReportList",
|
||||||
components: {
|
components: {
|
||||||
MsTable, MsTableColumn, ShowMoreBtn, MsTableHeader, MsTableOperatorButton, MsTag, MsTablePagination
|
MsTable,
|
||||||
|
MsTableColumn,
|
||||||
|
ShowMoreBtn,
|
||||||
|
MsTableHeader,
|
||||||
|
MsTableOperatorButton,
|
||||||
|
MsTag,
|
||||||
|
MsTablePagination,
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
@ -118,29 +164,31 @@ export default {
|
||||||
page: getPageInfo(),
|
page: getPageInfo(),
|
||||||
condition: {
|
condition: {
|
||||||
filters: {},
|
filters: {},
|
||||||
orders: [{name: "create_time", type: "desc"}]
|
orders: [{ name: "create_time", type: "desc" }],
|
||||||
},
|
},
|
||||||
tableData: [],
|
tableData: [],
|
||||||
buttons: [{
|
buttons: [
|
||||||
name: this.$t('api_test.definition.request.batch_delete'),
|
{
|
||||||
|
name: this.$t("api_test.definition.request.batch_delete"),
|
||||||
handleClick: this.handleBatchDelete,
|
handleClick: this.handleBatchDelete,
|
||||||
permissions: ['PROJECT_ERROR_REPORT_LIBRARY:READ+BATCH_DELETE']
|
permissions: ["PROJECT_ERROR_REPORT_LIBRARY:READ+BATCH_DELETE"],
|
||||||
}],
|
},
|
||||||
|
],
|
||||||
selectNodeIds: [],
|
selectNodeIds: [],
|
||||||
screenHeight: 'calc(100vh - 150px)',//屏幕高度
|
screenHeight: "calc(100vh - 150px)", //屏幕高度
|
||||||
selectRows: new Set(),
|
selectRows: new Set(),
|
||||||
selectDataCounts: 0,
|
selectDataCounts: 0,
|
||||||
}
|
};
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.initTableData();
|
this.initTableData();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
callBackSelectAll(selections){
|
callBackSelectAll(selections) {
|
||||||
this.selectNodeIds = Array.from(selections).map(o => o.id);
|
this.selectNodeIds = Array.from(selections).map((o) => o.id);
|
||||||
},
|
},
|
||||||
callBackSelect(selections){
|
callBackSelect(selections) {
|
||||||
this.selectNodeIds = Array.from(selections).map(o => o.id);
|
this.selectNodeIds = Array.from(selections).map((o) => o.id);
|
||||||
},
|
},
|
||||||
initTableData() {
|
initTableData() {
|
||||||
if (!getCurrentProjectID()) {
|
if (!getCurrentProjectID()) {
|
||||||
|
@ -149,12 +197,15 @@ export default {
|
||||||
this.selectDataCounts = 0;
|
this.selectDataCounts = 0;
|
||||||
this.selectRows = new Set();
|
this.selectRows = new Set();
|
||||||
this.condition.projectId = getCurrentProjectID();
|
this.condition.projectId = getCurrentProjectID();
|
||||||
let selectParam = {"condition":this.condition};
|
let selectParam = { condition: this.condition };
|
||||||
if(this.condition.name){
|
if (this.condition.name) {
|
||||||
selectParam.errorCode = this.condition.name;
|
selectParam.errorCode = this.condition.name;
|
||||||
}
|
}
|
||||||
this.loading = getErrorReportLibraryPages(this.page.currentPage, this.page.pageSize, selectParam)
|
this.loading = getErrorReportLibraryPages(
|
||||||
.then(response => {
|
this.page.currentPage,
|
||||||
|
this.page.pageSize,
|
||||||
|
selectParam
|
||||||
|
).then((response) => {
|
||||||
let data = response.data;
|
let data = response.data;
|
||||||
this.page.total = data.itemCount;
|
this.page.total = data.itemCount;
|
||||||
this.tableData = data.listObject;
|
this.tableData = data.listObject;
|
||||||
|
@ -164,38 +215,39 @@ export default {
|
||||||
this.$emit("createErrorReport");
|
this.$emit("createErrorReport");
|
||||||
},
|
},
|
||||||
deleteReport(row) {
|
deleteReport(row) {
|
||||||
this.$alert(this.$t('commons.confirm') + this.$t('commons.delete') + row.errorCode + "?", '', {
|
operationConfirm(
|
||||||
confirmButtonText: this.$t('commons.confirm'),
|
this,
|
||||||
callback: (action) => {
|
this.$t("commons.confirm") +
|
||||||
if (action === 'confirm') {
|
this.$t("commons.delete") +
|
||||||
let param = {id: row.id, projectId: getCurrentProjectID()};
|
row.errorCode +
|
||||||
|
"?",
|
||||||
|
() => {
|
||||||
|
let param = { id: row.id, projectId: getCurrentProjectID() };
|
||||||
deleteErrorReportLibrary(param).then(() => {
|
deleteErrorReportLibrary(param).then(() => {
|
||||||
this.$success(this.$t('commons.delete_success'));
|
this.$success(this.$t("commons.delete_success"));
|
||||||
this.initTableData();
|
this.initTableData();
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
);
|
||||||
},
|
},
|
||||||
handleBatchDelete() {
|
handleBatchDelete() {
|
||||||
this.$alert(this.$t('pj_batch_delete.error_library') + "?", '', {
|
operationConfirm(
|
||||||
confirmButtonText: this.$t('commons.confirm'),
|
this,
|
||||||
callback: (action) => {
|
this.$t("pj_batch_delete.error_library") + "?",
|
||||||
if (action === 'confirm') {
|
() => {
|
||||||
let sendParam = {};
|
let sendParam = {};
|
||||||
sendParam.ids = this.selectNodeIds;
|
sendParam.ids = this.selectNodeIds;
|
||||||
sendParam.projectId = getCurrentProjectID();
|
sendParam.projectId = getCurrentProjectID();
|
||||||
sendParam.condition = this.condition;
|
sendParam.condition = this.condition;
|
||||||
deleteErrorReportLibrary(sendParam).then(() => {
|
deleteErrorReportLibrary(sendParam).then(() => {
|
||||||
this.$success(this.$t('commons.delete_success'));
|
this.$success(this.$t("commons.delete_success"));
|
||||||
this.initTableData();
|
this.initTableData();
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
);
|
||||||
},
|
},
|
||||||
editErrorReport(row) {
|
editErrorReport(row) {
|
||||||
getErrorReportLibraryById(row.id).then(response => {
|
getErrorReportLibraryById(row.id).then((response) => {
|
||||||
if (response.data) {
|
if (response.data) {
|
||||||
let libraryData = response.data;
|
let libraryData = response.data;
|
||||||
this.$emit("editErrorReport", libraryData);
|
this.$emit("editErrorReport", libraryData);
|
||||||
|
@ -203,23 +255,22 @@ export default {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
changeStatus(row) {
|
changeStatus(row) {
|
||||||
if (!hasPermission('PROJECT_ERROR_REPORT_LIBRARY:READ+EDIT')) {
|
if (!hasPermission("PROJECT_ERROR_REPORT_LIBRARY:READ+EDIT")) {
|
||||||
row.status = !row.status;
|
row.status = !row.status;
|
||||||
this.$alert(this.$t('commons.project_permission'));
|
this.$alert(this.$t("commons.project_permission"));
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
let param = {id: row.id, status: row.status};
|
let param = { id: row.id, status: row.status };
|
||||||
this.loading = modifyErrorReportLibrary(param).then(() => {
|
this.loading = modifyErrorReportLibrary(param).then(() => {
|
||||||
this.$success(this.$t('commons.save_success'));
|
this.$success(this.$t("commons.save_success"));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|
||||||
.table-page {
|
.table-page {
|
||||||
padding-top: 20px;
|
padding-top: 20px;
|
||||||
margin-right: -9px;
|
margin-right: -9px;
|
||||||
|
@ -237,7 +288,6 @@ export default {
|
||||||
|
|
||||||
.request-method {
|
.request-method {
|
||||||
padding: 0 5px;
|
padding: 0 5px;
|
||||||
color: #1E90FF;
|
color: #1e90ff;
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
Loading…
Reference in New Issue