增加测试平台功能,系统设置,支持多个角色,分配菜单

This commit is contained in:
qiaoxinjiu
2026-04-22 10:00:17 +08:00
parent 6d5d69cbde
commit 4395d9fb22
42 changed files with 4239 additions and 81 deletions

View File

@@ -0,0 +1,110 @@
<template>
<div class="page-wrap">
<page-section title="用例管理">
<template slot="extra">
<el-button type="primary" size="small" @click="goEditor()">新建用例</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 @keyup.enter.native="fetchList"></el-input>
</el-form-item>
<el-form-item label="优先级">
<el-select v-model="queryForm.priority" clearable>
<el-option label="P0" :value="0"></el-option>
<el-option label="P1" :value="1"></el-option>
<el-option label="P2" :value="2"></el-option>
<el-option label="P3" :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="case_key" label="用例编号" min-width="120"></el-table-column>
<el-table-column prop="title" label="标题" min-width="220"></el-table-column>
<el-table-column prop="priority" label="优先级" width="100"></el-table-column>
<el-table-column prop="case_type" label="类型" width="100"></el-table-column>
<el-table-column prop="status" label="状态" width="100"></el-table-column>
<el-table-column label="操作" width="240">
<template slot-scope="scope">
<el-button type="text" @click="goEditor(scope.row)">编辑</el-button>
<el-button type="text" @click="goReview(scope.row)">评审</el-button>
<el-button type="text" style="color: #F56C6C;" @click="remove(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 { deleteCase, getCaseList } from '@/api/caseApi'
export default {
name: 'CaseList',
components: { PageSection },
data() {
return {
loading: false,
projectId: this.$route.query.projectId || 1,
queryForm: {
keyword: '',
priority: ''
},
tableData: []
}
},
methods: {
fetchList() {
this.loading = true
getCaseList(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
})
},
goEditor(row) {
this.$router.push({ path: '/test-platform/cases/editor', query: { projectId: this.projectId, caseId: row && row.id } })
},
goReview(row) {
this.$router.push({ path: '/test-platform/cases/review', query: { projectId: this.projectId, caseId: row.id } })
},
remove(row) {
this.$confirm('确认删除该用例吗?', '提示', { type: 'warning' }).then(() => {
deleteCase(this.projectId, row.id).then(() => {
this.$message({ type: 'success', message: '删除成功' })
this.fetchList()
})
}).catch(() => {})
}
},
created() {
this.fetchList()
}
}
</script>
<style scoped>
.page-wrap {
padding: 20px;
}
</style>