增加测试平台功能,系统设置,支持多个角色,分配菜单
This commit is contained in:
69
src/components/TestPlatform/Plan/PlanBuilder.vue
Normal file
69
src/components/TestPlatform/Plan/PlanBuilder.vue
Normal file
@@ -0,0 +1,69 @@
|
||||
<template>
|
||||
<div class="page-wrap">
|
||||
<page-section title="计划构建">
|
||||
<el-form :model="form" label-width="120px" size="small">
|
||||
<el-form-item label="项目ID">
|
||||
<el-input v-model="projectId" style="width: 200px;"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="计划名称">
|
||||
<el-input v-model="form.name"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="版本">
|
||||
<el-input v-model="form.version"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="负责人ID">
|
||||
<el-input v-model="form.owner_id"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="环境ID">
|
||||
<el-input v-model="form.environment_id"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="描述">
|
||||
<el-input v-model="form.description" type="textarea" :rows="4"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" :loading="saving" @click="submitForm">保存计划</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</page-section>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import PageSection from '@/components/TestPlatform/common/PageSection'
|
||||
import { createPlan } from '@/api/planApi'
|
||||
|
||||
export default {
|
||||
name: 'PlanBuilder',
|
||||
components: { PageSection },
|
||||
data() {
|
||||
return {
|
||||
saving: false,
|
||||
projectId: this.$route.query.projectId || 1,
|
||||
form: {
|
||||
name: '',
|
||||
version: '',
|
||||
owner_id: '',
|
||||
environment_id: '',
|
||||
description: ''
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
submitForm() {
|
||||
this.saving = true
|
||||
createPlan(this.projectId, this.form).then(() => {
|
||||
this.$message({ type: 'success', message: '计划创建成功' })
|
||||
this.$router.push({ path: '/test-platform/plans', query: { projectId: this.projectId } })
|
||||
}).finally(() => {
|
||||
this.saving = false
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.page-wrap {
|
||||
padding: 20px;
|
||||
}
|
||||
</style>
|
||||
114
src/components/TestPlatform/Plan/PlanExecute.vue
Normal file
114
src/components/TestPlatform/Plan/PlanExecute.vue
Normal file
@@ -0,0 +1,114 @@
|
||||
<template>
|
||||
<div class="page-wrap">
|
||||
<page-section title="计划执行">
|
||||
<el-form :inline="true" size="small" @submit.native.prevent>
|
||||
<el-form-item label="项目ID">
|
||||
<el-input v-model="projectId" style="width: 120px;"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="计划ID">
|
||||
<el-input v-model="planId" style="width: 120px;"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="fetchDetail">刷新</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<key-value-descriptions :items="summaryItems"></key-value-descriptions>
|
||||
<el-divider></el-divider>
|
||||
<el-form :model="executeForm" label-width="120px" size="small">
|
||||
<el-form-item label="计划用例ID">
|
||||
<el-input v-model="executeForm.planCaseId"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="执行状态">
|
||||
<el-select v-model="executeForm.status">
|
||||
<el-option label="通过" :value="1"></el-option>
|
||||
<el-option label="失败" :value="2"></el-option>
|
||||
<el-option label="阻塞" :value="3"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="实际结果">
|
||||
<el-input v-model="executeForm.actual_result" type="textarea" :rows="4"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="缺陷链接">
|
||||
<el-input v-model="defectLinksText" placeholder="多个缺陷号用逗号分隔"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" :loading="submitting" @click="submitExecute">提交执行</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</page-section>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import PageSection from '@/components/TestPlatform/common/PageSection'
|
||||
import KeyValueDescriptions from '@/components/TestPlatform/common/KeyValueDescriptions'
|
||||
import { executePlanCase, getPlanDetail } from '@/api/planApi'
|
||||
|
||||
export default {
|
||||
name: 'PlanExecute',
|
||||
components: { PageSection, KeyValueDescriptions },
|
||||
data() {
|
||||
return {
|
||||
projectId: this.$route.query.projectId || 1,
|
||||
planId: this.$route.query.planId || '',
|
||||
detail: {},
|
||||
submitting: false,
|
||||
defectLinksText: '',
|
||||
executeForm: {
|
||||
planCaseId: '',
|
||||
status: 1,
|
||||
actual_result: ''
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
summaryItems() {
|
||||
return [
|
||||
{ label: '计划ID', value: this.detail.id },
|
||||
{ label: '计划名称', value: this.detail.name },
|
||||
{ label: '总用例数', value: this.detail.total_cases },
|
||||
{ label: '已完成', value: this.detail.completed },
|
||||
{ label: '通过率', value: this.detail.pass_rate }
|
||||
]
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
fetchDetail() {
|
||||
if (!this.planId) {
|
||||
return
|
||||
}
|
||||
getPlanDetail(this.projectId, this.planId).then(res => {
|
||||
this.detail = (res && res.data) || res || {}
|
||||
}).catch(() => {
|
||||
this.detail = {}
|
||||
})
|
||||
},
|
||||
submitExecute() {
|
||||
if (!this.executeForm.planCaseId) {
|
||||
this.$message({ type: 'warning', message: '请输入计划用例ID' })
|
||||
return
|
||||
}
|
||||
this.submitting = true
|
||||
executePlanCase(this.projectId, this.planId, this.executeForm.planCaseId, {
|
||||
status: this.executeForm.status,
|
||||
actual_result: this.executeForm.actual_result,
|
||||
defect_links: this.defectLinksText ? this.defectLinksText.split(',').map(item => item.trim()).filter(Boolean) : [],
|
||||
attachments: []
|
||||
}).then(() => {
|
||||
this.$message({ type: 'success', message: '执行结果已提交' })
|
||||
}).finally(() => {
|
||||
this.submitting = false
|
||||
})
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.fetchDetail()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.page-wrap {
|
||||
padding: 20px;
|
||||
}
|
||||
</style>
|
||||
106
src/components/TestPlatform/Plan/PlanList.vue
Normal file
106
src/components/TestPlatform/Plan/PlanList.vue
Normal file
@@ -0,0 +1,106 @@
|
||||
<template>
|
||||
<div class="page-wrap">
|
||||
<page-section title="测试计划">
|
||||
<template slot="extra">
|
||||
<el-button type="primary" size="small" @click="goBuilder()">新建计划</el-button>
|
||||
</template>
|
||||
<el-form :inline="true" :model="queryForm" size="small" @submit.native.prevent>
|
||||
<el-form-item label="项目ID">
|
||||
<el-input v-model="projectId" style="width: 120px;"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="关键词">
|
||||
<el-input v-model="queryForm.keyword" clearable></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="状态">
|
||||
<el-select v-model="queryForm.status" clearable>
|
||||
<el-option label="草稿" :value="0"></el-option>
|
||||
<el-option label="进行中" :value="1"></el-option>
|
||||
<el-option label="已完成" :value="2"></el-option>
|
||||
<el-option label="已归档" :value="3"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="fetchList">查询</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-table v-loading="loading" :data="tableData" border style="margin-top: 16px;">
|
||||
<el-table-column prop="name" label="计划名称" min-width="180"></el-table-column>
|
||||
<el-table-column prop="version" label="版本" width="120"></el-table-column>
|
||||
<el-table-column prop="owner_id" label="负责人" width="120"></el-table-column>
|
||||
<el-table-column prop="status" label="状态" width="100"></el-table-column>
|
||||
<el-table-column label="操作" width="260">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text" @click="goExecute(scope.row)">执行</el-button>
|
||||
<el-button type="text" @click="goProgress(scope.row)">进度</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div style="margin-top: 16px; text-align: right;">
|
||||
<el-pagination
|
||||
:current-page="pageNo"
|
||||
:page-size="pageSize"
|
||||
:page-sizes="[10, 20, 50, 100]"
|
||||
:total="total"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange">
|
||||
</el-pagination>
|
||||
</div>
|
||||
</page-section>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import PageSection from '@/components/TestPlatform/common/PageSection'
|
||||
import { getPlanList } from '@/api/planApi'
|
||||
|
||||
export default {
|
||||
name: 'PlanList',
|
||||
components: { PageSection },
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
projectId: this.$route.query.projectId || 1,
|
||||
queryForm: {
|
||||
keyword: '',
|
||||
status: ''
|
||||
},
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
total: 0,
|
||||
tableData: []
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
fetchList() {
|
||||
this.loading = true
|
||||
getPlanList(this.projectId, this.queryForm).then(res => {
|
||||
const data = (res && res.data) || res || {}
|
||||
this.tableData = data.items || data.list || []
|
||||
}).catch(() => {
|
||||
this.tableData = []
|
||||
}).finally(() => {
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
goBuilder() {
|
||||
this.$router.push({ path: '/test-platform/plans/builder', query: { projectId: this.projectId } })
|
||||
},
|
||||
goExecute(row) {
|
||||
this.$router.push({ path: '/test-platform/plans/execute', query: { projectId: this.projectId, planId: row.id } })
|
||||
},
|
||||
goProgress(row) {
|
||||
this.$router.push({ path: '/test-platform/plans/progress', query: { projectId: this.projectId, planId: row.id } })
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.fetchList()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.page-wrap {
|
||||
padding: 20px;
|
||||
}
|
||||
</style>
|
||||
73
src/components/TestPlatform/Plan/PlanProgress.vue
Normal file
73
src/components/TestPlatform/Plan/PlanProgress.vue
Normal file
@@ -0,0 +1,73 @@
|
||||
<template>
|
||||
<div class="page-wrap">
|
||||
<page-section title="计划进度">
|
||||
<el-form :inline="true" size="small">
|
||||
<el-form-item label="项目ID">
|
||||
<el-input v-model="projectId" style="width: 120px;"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="计划ID">
|
||||
<el-input v-model="planId" style="width: 120px;"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="fetchProgress">刷新</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="8">
|
||||
<page-section title="轮次汇总">
|
||||
<json-viewer :value="progress.round_summary || []"></json-viewer>
|
||||
</page-section>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<page-section title="人员负载">
|
||||
<json-viewer :value="progress.assignee_load || []"></json-viewer>
|
||||
</page-section>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<page-section title="每日趋势">
|
||||
<json-viewer :value="progress.daily_trend || []"></json-viewer>
|
||||
</page-section>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</page-section>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import PageSection from '@/components/TestPlatform/common/PageSection'
|
||||
import JsonViewer from '@/components/TestPlatform/common/JsonViewer'
|
||||
import { getPlanProgress } from '@/api/planApi'
|
||||
|
||||
export default {
|
||||
name: 'PlanProgress',
|
||||
components: { PageSection, JsonViewer },
|
||||
data() {
|
||||
return {
|
||||
projectId: this.$route.query.projectId || 1,
|
||||
planId: this.$route.query.planId || '',
|
||||
progress: {}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
fetchProgress() {
|
||||
if (!this.planId) {
|
||||
return
|
||||
}
|
||||
getPlanProgress(this.projectId, this.planId).then(res => {
|
||||
this.progress = (res && res.data) || res || {}
|
||||
}).catch(() => {
|
||||
this.progress = {}
|
||||
})
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.fetchProgress()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.page-wrap {
|
||||
padding: 20px;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user