删除测试计划确认

This commit is contained in:
chenjianxing 2020-06-08 11:55:10 +08:00 committed by Captain.B
parent 88df2d6950
commit 8896c0730f
5 changed files with 192 additions and 106 deletions

View File

@ -0,0 +1,83 @@
<template>
<el-dialog :title="title"
:visible.sync="dialogVisible"
class="delete-confirm" >
<el-row>
<el-col>
<span>{{$t('commons.delete_confirm')}}</span>
<span class="delete-tip"> DELETE-{{record.name}}</span>
<br/>
</el-col>
</el-row>
<el-row>
<el-col :span="15">
<el-input v-model="value" :placeholder="$t('commons.input_content')"/>
</el-col>
</el-row>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false">{{$t('commons.cancel')}}</el-button>
<el-button type="primary" @click="confirm">{{$t('commons.confirm')}}</el-button>
</span>
</el-dialog>
</template>
<script>
export default {
name: "MsDeleteConfirm",
data() {
return {
dialogVisible: false,
value: '',
record: {},
}
},
props: {
title: {
type: String,
default() {
return this.$t('commons.title')
}
}
},
methods: {
open(record) {
this.dialogVisible = true;
this.value = '';
this.record = record;
},
confirm() {
if (this.value.trim() != 'DELETE-' + this.record.name) {
this.$warning(this.$t('commons.incorrect_input'));
return;
}
this.$emit('delete', this.record);
this.dialogVisible = false;
}
}
}
</script>
<style scoped>
.delete-confirm >>> .el-dialog {
width: 500px;
}
.delete-confirm .el-dialog:first-child {
margin-bottom: 10px;
}
.delete-confirm .el-row:first-child {
margin-bottom: 20px;
}
.delete-tip {
font-style: italic;
font-weight: bold;
}
</style>

View File

@ -1,106 +1,107 @@
<template> <template>
<el-card class="table-card" v-loading="result.loading"> <el-card class="table-card" v-loading="result.loading">
<template v-slot:header> <template v-slot:header>
<ms-table-header :is-tester-permission="true" :condition.sync="condition" <ms-table-header :is-tester-permission="true" :condition.sync="condition"
@search="initTableData" @create="testPlanCreate" @search="initTableData" @create="testPlanCreate"
:create-tip="$t('test_track.plan.create_plan')" :create-tip="$t('test_track.plan.create_plan')"
:title="$t('test_track.plan.test_plan')"/> :title="$t('test_track.plan.test_plan')"/>
</template>
<el-table
:data="tableData"
@filter-change="filter"
@sort-change="sort"
@row-click="intoPlan">
<el-table-column
prop="name"
:label="$t('commons.name')"
show-overflow-tooltip>
</el-table-column>
<el-table-column
prop="principal"
:label="$t('test_track.plan.plan_principal')"
show-overflow-tooltip>
</el-table-column>
<el-table-column
prop="status"
column-key="status"
:filters="statusFilters"
:label="$t('test_track.plan.plan_status')"
show-overflow-tooltip>
<template v-slot:default="scope">
<el-dropdown class="test-case-status" @command="statusChange">
<span class="el-dropdown-link">
<plan-status-table-item :value="scope.row.status"/>
</span>
<el-dropdown-menu slot="dropdown" chang>
<el-dropdown-item :command="{id: scope.row.id, status: 'Prepare'}">
{{$t('test_track.plan.plan_status_prepare')}}
</el-dropdown-item>
<el-dropdown-item :command="{id: scope.row.id, status: 'Underway'}">
{{$t('test_track.plan.plan_status_running')}}
</el-dropdown-item>
<el-dropdown-item :command="{id: scope.row.id, status: 'Completed'}">
{{$t('test_track.plan.plan_status_completed')}}
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</template> </template>
</el-table-column>
<el-table <el-table-column
:data="tableData" prop="stage"
@filter-change="filter" column-key="stage"
@sort-change="sort" :filters="stageFilters"
@row-click="intoPlan"> :label="$t('test_track.plan.plan_stage')"
<el-table-column show-overflow-tooltip>
prop="name" <template v-slot:default="scope">
:label="$t('commons.name')" <plan-stage-table-item :stage="scope.row.stage"/>
show-overflow-tooltip> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="principal" prop="projectName"
:label="$t('test_track.plan.plan_principal')" :label="$t('test_track.plan.plan_project')"
show-overflow-tooltip> show-overflow-tooltip>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="status" sortable
column-key="status" prop="createTime"
:filters="statusFilters" :label="$t('commons.create_time')"
:label="$t('test_track.plan.plan_status')" show-overflow-tooltip>
show-overflow-tooltip> <template v-slot:default="scope">
<template v-slot:default="scope"> <span>{{ scope.row.createTime | timestampFormatDate }}</span>
<el-dropdown class="test-case-status" @command="statusChange"> </template>
<span class="el-dropdown-link"> </el-table-column>
<plan-status-table-item :value="scope.row.status"/> <el-table-column
</span> sortable
<el-dropdown-menu slot="dropdown" chang> prop="updateTime"
<el-dropdown-item :command="{id: scope.row.id, status: 'Prepare'}"> :label="$t('commons.update_time')"
{{$t('test_track.plan.plan_status_prepare')}} show-overflow-tooltip>
</el-dropdown-item> <template v-slot:default="scope">
<el-dropdown-item :command="{id: scope.row.id, status: 'Underway'}"> <span>{{ scope.row.updateTime | timestampFormatDate }}</span>
{{$t('test_track.plan.plan_status_running')}} </template>
</el-dropdown-item> </el-table-column>
<el-dropdown-item :command="{id: scope.row.id, status: 'Completed'}"> <el-table-column
{{$t('test_track.plan.plan_status_completed')}} :label="$t('commons.operating')">
</el-dropdown-item> <template v-slot:default="scope">
</el-dropdown-menu> <ms-table-operator :is-tester-permission="true" @editClick="handleEdit(scope.row)" @deleteClick="handleDelete(scope.row)">
</el-dropdown> <template v-slot:middle>
<ms-table-operator-button type="success" v-if="!scope.row.reportId" :tip="$t('test_track.plan_view.create_report')" icon="el-icon-document" @exec="openTestReportTemplate(scope.row)"/>
<ms-table-operator-button type="success" v-if="scope.row.reportId" :tip="$t('test_track.plan_view.view_report')" icon="el-icon-document" @exec="openReport(scope.row.id, scope.row.reportId)"/>
</template> </template>
</el-table-column> </ms-table-operator>
<el-table-column </template>
prop="stage" </el-table-column>
column-key="stage" </el-table>
:filters="stageFilters"
:label="$t('test_track.plan.plan_stage')"
show-overflow-tooltip>
<template v-slot:default="scope">
<plan-stage-table-item :stage="scope.row.stage"/>
</template>
</el-table-column>
<el-table-column
prop="projectName"
:label="$t('test_track.plan.plan_project')"
show-overflow-tooltip>
</el-table-column>
<el-table-column
sortable
prop="createTime"
:label="$t('commons.create_time')"
show-overflow-tooltip>
<template v-slot:default="scope">
<span>{{ scope.row.createTime | timestampFormatDate }}</span>
</template>
</el-table-column>
<el-table-column
sortable
prop="updateTime"
:label="$t('commons.update_time')"
show-overflow-tooltip>
<template v-slot:default="scope">
<span>{{ scope.row.updateTime | timestampFormatDate }}</span>
</template>
</el-table-column>
<el-table-column
:label="$t('commons.operating')">
<template v-slot:default="scope">
<ms-table-operator :is-tester-permission="true" @editClick="handleEdit(scope.row)" @deleteClick="handleDelete(scope.row)">
<template v-slot:middle>
<ms-table-operator-button type="success" v-if="!scope.row.reportId" :tip="$t('test_track.plan_view.create_report')" icon="el-icon-document" @exec="openTestReportTemplate(scope.row)"/>
<ms-table-operator-button type="success" v-if="scope.row.reportId" :tip="$t('test_track.plan_view.view_report')" icon="el-icon-document" @exec="openReport(scope.row.id, scope.row.reportId)"/>
</template>
</ms-table-operator>
</template>
</el-table-column>
</el-table>
<ms-table-pagination :change="initTableData" :current-page.sync="currentPage" :page-size.sync="pageSize" <ms-table-pagination :change="initTableData" :current-page.sync="currentPage" :page-size.sync="pageSize"
:total="total"/> :total="total"/>
<test-report-template-list @openReport="openReport" ref="testReporTtemplateList"/> <test-report-template-list @openReport="openReport" ref="testReporTtemplateList"/>
<test-case-report-view @refresh="initTableData" ref="testCaseReportView"/> <test-case-report-view @refresh="initTableData" ref="testCaseReportView"/>
<ms-delete-confirm :title="$t('test_track.plan.plan_delete')" @delete="_handleDelete" ref="deleteConfirm"/>
</el-card> </el-card>
</template> </template>
<script> <script>
@ -115,10 +116,12 @@
import {_filter, _sort} from "../../../../../common/js/utils"; import {_filter, _sort} from "../../../../../common/js/utils";
import TestReportTemplateList from "../view/comonents/TestReportTemplateList"; import TestReportTemplateList from "../view/comonents/TestReportTemplateList";
import TestCaseReportView from "../view/comonents/report/TestCaseReportView"; import TestCaseReportView from "../view/comonents/report/TestCaseReportView";
import MsDeleteConfirm from "../../../common/components/MsDeleteConfirm";
export default { export default {
name: "TestPlanList", name: "TestPlanList",
components: { components: {
MsDeleteConfirm,
TestCaseReportView, TestCaseReportView,
TestReportTemplateList, TestReportTemplateList,
PlanStageTableItem, PlanStageTableItem,
@ -185,14 +188,7 @@
}); });
}, },
handleDelete(testPlan) { handleDelete(testPlan) {
this.$alert(this.$t('test_track.plan.plan_delete_confirm') + testPlan.name + "", '', { this.$refs.deleteConfirm.open(testPlan);
confirmButtonText: this.$t('commons.confirm'),
callback: (action) => {
if (action === 'confirm') {
this._handleDelete(testPlan);
}
}
});
}, },
_handleDelete(testPlan) { _handleDelete(testPlan) {
let testPlanId = testPlan.id; let testPlanId = testPlan.id;

View File

@ -96,7 +96,8 @@ export default {
'remove_success': 'Remove Success', 'remove_success': 'Remove Success',
'tips': 'The authentication information has expired, please login again', 'tips': 'The authentication information has expired, please login again',
'not_performed_yet': 'Not performed yet', 'not_performed_yet': 'Not performed yet',
'incorrect_input': 'Incorrect input',
'delete_confirm': 'Please enter the following to confirm deletion:',
}, },
workspace: { workspace: {
'create': 'Create Workspace', 'create': 'Create Workspace',
@ -447,6 +448,7 @@ export default {
plan_status_running: "Starting", plan_status_running: "Starting",
plan_status_completed: "Completed", plan_status_completed: "Completed",
plan_delete_confirm: "All use cases under this plan will be deleted,confirm delete test plan: ", plan_delete_confirm: "All use cases under this plan will be deleted,confirm delete test plan: ",
plan_delete: "Delete test plan",
}, },
module: { module: {
search: "Search module", search: "Search module",

View File

@ -95,7 +95,8 @@ export default {
'remove_success': '移除成功', 'remove_success': '移除成功',
'tips': '认证信息已过期,请重新登录', 'tips': '认证信息已过期,请重新登录',
'not_performed_yet': '尚未执行', 'not_performed_yet': '尚未执行',
'incorrect_input': '输入内容不正确',
'delete_confirm': '请输入以下内容,确认删除:',
}, },
workspace: { workspace: {
'create': '创建工作空间', 'create': '创建工作空间',
@ -445,6 +446,7 @@ export default {
plan_status_running: "进行中", plan_status_running: "进行中",
plan_status_completed: "已完成", plan_status_completed: "已完成",
plan_delete_confirm: "将删除该测试计划下所有用例,确认删除测试计划: ", plan_delete_confirm: "将删除该测试计划下所有用例,确认删除测试计划: ",
plan_delete: "删除计划",
}, },
module: { module: {
search: "搜索模块", search: "搜索模块",

View File

@ -95,6 +95,8 @@ export default {
'remove_success': '移除成功', 'remove_success': '移除成功',
'tips': '认認證資訊已過期,請重新登入', 'tips': '认認證資訊已過期,請重新登入',
'not_performed_yet': '尚未執行', 'not_performed_yet': '尚未執行',
'incorrect_input': '輸入內容不正確',
'delete_confirm': '請輸入以下內容,確認刪除:',
}, },
workspace: { workspace: {
'create': '創建工作空間', 'create': '創建工作空間',
@ -445,6 +447,7 @@ export default {
plan_status_running: "進行中", plan_status_running: "進行中",
plan_status_completed: "已完成", plan_status_completed: "已完成",
plan_delete_confirm: "將刪除該測試計劃下所有用例,確認刪除測試計劃: ", plan_delete_confirm: "將刪除該測試計劃下所有用例,確認刪除測試計劃: ",
plan_delete: "刪除計劃",
}, },
module: { module: {
search: "搜索模塊", search: "搜索模塊",