2023-06-15 20:13:46 +08:00
|
|
|
|
<template>
|
|
|
|
|
|
<div class="ma-content-block lg:flex justify-between p-4">
|
|
|
|
|
|
<div class="lg:w-full w-full lg:ml-4 mt-5 lg:mt-0">
|
|
|
|
|
|
<!-- CRUD组件 -->
|
2023-08-24 19:24:00 +08:00
|
|
|
|
<ma-crud :options="crudOptions" :columns="crudColumns" ref="crudRef">
|
2023-08-23 20:45:44 +08:00
|
|
|
|
<template #ident="{ record }">
|
|
|
|
|
|
{{ showType(record) }}
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</ma-crud>
|
2023-06-15 20:13:46 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script setup>
|
|
|
|
|
|
import { ref } from "vue"
|
|
|
|
|
|
import { useRoute, useRouter } from "vue-router"
|
|
|
|
|
|
import caseApi from "@/api/project/case"
|
2023-08-15 17:15:52 +08:00
|
|
|
|
import { useTreeDataStore } from "@/store"
|
|
|
|
|
|
const treeDataStore = useTreeDataStore()
|
2023-06-15 20:13:46 +08:00
|
|
|
|
const route = useRoute()
|
|
|
|
|
|
const router = useRouter()
|
|
|
|
|
|
const roundNumber = route.query.key.split("-")[0]
|
2023-06-19 19:51:12 +08:00
|
|
|
|
const dutNumber = route.query.key.split("-")[1]
|
|
|
|
|
|
const designDemandNumber = route.query.key.split("-")[2]
|
|
|
|
|
|
const testDemandNumber = route.query.key.split("-")[3]
|
2023-08-24 19:24:00 +08:00
|
|
|
|
const crudRef = ref()
|
2023-08-15 17:15:52 +08:00
|
|
|
|
const projectId = ref(route.query.id)
|
2024-05-11 18:11:56 +08:00
|
|
|
|
// 标识显示字段-用例比较特殊让后端返回了“FT”字样,因为FT是在测试项里面标识的
|
2023-08-23 20:45:44 +08:00
|
|
|
|
const showType = (record) => {
|
|
|
|
|
|
let key_string = parseInt(record.key.substring(record.key.lastIndexOf("-") + 1)) + 1
|
2024-05-11 18:11:56 +08:00
|
|
|
|
return "YL-" + record.testType + "-" + record.ident + "-" + key_string.toString().padStart(3, "0")
|
2023-08-23 20:45:44 +08:00
|
|
|
|
}
|
2023-06-15 20:13:46 +08:00
|
|
|
|
// crud设置
|
|
|
|
|
|
const crudOptions = ref({
|
|
|
|
|
|
api: caseApi.getCaseList,
|
2024-04-19 18:53:52 +08:00
|
|
|
|
add: { show: true, api: caseApi.save, text: "新增用例" },
|
2024-04-26 19:06:14 +08:00
|
|
|
|
edit: { show: true, api: caseApi.update, text: "修改用例" },
|
2023-08-02 20:48:36 +08:00
|
|
|
|
delete: { show: true, api: caseApi.delete },
|
2023-08-15 17:15:52 +08:00
|
|
|
|
// 处理新增删除后树状图显示
|
2023-08-24 19:24:00 +08:00
|
|
|
|
beforeOpenAdd: function () {
|
2024-03-29 19:03:35 +08:00
|
|
|
|
let key_split = route.query.key.split("-")
|
2023-08-25 13:28:24 +08:00
|
|
|
|
let round_key = key_split[0]
|
|
|
|
|
|
let dut_key = key_split[1]
|
|
|
|
|
|
let design_key = key_split[2]
|
|
|
|
|
|
let test_key = key_split[3]
|
2023-08-24 19:24:00 +08:00
|
|
|
|
let td = treeDataStore.treeData
|
|
|
|
|
|
crudRef.value.crudFormRef.actionTitle = `${route.query.ident} >
|
|
|
|
|
|
${td[round_key].title} > ${td[round_key].children[dut_key].title} >
|
|
|
|
|
|
${td[round_key].children[dut_key].children[design_key].title} >
|
|
|
|
|
|
${td[round_key].children[dut_key].children[design_key].children[test_key].title} > 用例-`
|
|
|
|
|
|
return true
|
|
|
|
|
|
},
|
|
|
|
|
|
beforeOpenEdit: function (record) {
|
2024-03-29 19:03:35 +08:00
|
|
|
|
let key_split = route.query.key.split("-")
|
2023-08-25 13:28:24 +08:00
|
|
|
|
let round_key = key_split[0]
|
|
|
|
|
|
let dut_key = key_split[1]
|
|
|
|
|
|
let design_key = key_split[2]
|
|
|
|
|
|
let test_key = key_split[3]
|
2023-08-24 19:24:00 +08:00
|
|
|
|
let td = treeDataStore.treeData
|
|
|
|
|
|
crudRef.value.crudFormRef.actionTitle = `${route.query.ident} >
|
|
|
|
|
|
${td[round_key].title} > ${td[round_key].children[dut_key].title} >
|
|
|
|
|
|
${td[round_key].children[dut_key].children[design_key].title} >
|
|
|
|
|
|
${td[round_key].children[dut_key].children[design_key].children[test_key].title}
|
|
|
|
|
|
>用例[${record.name}]-`
|
|
|
|
|
|
return true
|
|
|
|
|
|
},
|
2023-08-15 17:15:52 +08:00
|
|
|
|
afterAdd: (res) => {
|
|
|
|
|
|
let id = projectId.value
|
|
|
|
|
|
treeDataStore.updateCaseTreeData(res.data, id)
|
|
|
|
|
|
},
|
|
|
|
|
|
afterEdit: (res) => {
|
|
|
|
|
|
let id = projectId.value
|
|
|
|
|
|
treeDataStore.updateCaseTreeData(res.data, id)
|
|
|
|
|
|
},
|
|
|
|
|
|
afterDelete: (res, record) => {
|
|
|
|
|
|
let id = projectId.value
|
2024-05-11 18:11:56 +08:00
|
|
|
|
if (!record) {
|
|
|
|
|
|
record = { key: route.query.key + "-X" }
|
|
|
|
|
|
}
|
2023-08-15 17:15:52 +08:00
|
|
|
|
treeDataStore.updateCaseTreeData(record, id)
|
|
|
|
|
|
},
|
2023-06-15 20:13:46 +08:00
|
|
|
|
parameters: {
|
|
|
|
|
|
projectId: route.query.id,
|
|
|
|
|
|
round: roundNumber,
|
2023-06-19 19:51:12 +08:00
|
|
|
|
dut: dutNumber,
|
2023-06-15 20:13:46 +08:00
|
|
|
|
designDemand: designDemandNumber,
|
|
|
|
|
|
testDemand: testDemandNumber
|
|
|
|
|
|
},
|
|
|
|
|
|
showIndex: false,
|
2024-05-11 18:11:56 +08:00
|
|
|
|
showTools: false,
|
2023-06-15 20:13:46 +08:00
|
|
|
|
rowSelection: { showCheckedAll: true },
|
|
|
|
|
|
searchColNumber: 3,
|
2023-07-25 20:03:06 +08:00
|
|
|
|
tablePagination: false,
|
2023-06-15 20:13:46 +08:00
|
|
|
|
operationColumn: true,
|
|
|
|
|
|
formOption: {
|
|
|
|
|
|
width: 1200,
|
|
|
|
|
|
layout: [
|
|
|
|
|
|
{
|
|
|
|
|
|
formType: "grid",
|
|
|
|
|
|
cols: [
|
|
|
|
|
|
{ span: 12, formList: [{ dataIndex: "ident" }] },
|
|
|
|
|
|
{ span: 12, formList: [{ dataIndex: "name" }] }
|
|
|
|
|
|
]
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
formType: "card",
|
|
|
|
|
|
customClass: ["ml-10", "mb-3", "py-0", "px-0"],
|
|
|
|
|
|
title: "人员信息",
|
|
|
|
|
|
formList: [
|
|
|
|
|
|
{
|
|
|
|
|
|
formType: "grid",
|
|
|
|
|
|
cols: [
|
|
|
|
|
|
{ span: 8, formList: [{ dataIndex: "designPerson" }] },
|
|
|
|
|
|
{ span: 8, formList: [{ dataIndex: "testPerson" }] },
|
|
|
|
|
|
{ span: 8, formList: [{ dataIndex: "monitorPerson" }] }
|
|
|
|
|
|
]
|
|
|
|
|
|
}
|
|
|
|
|
|
]
|
2024-05-31 18:29:29 +08:00
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
formType: "grid",
|
|
|
|
|
|
cols: [{ span: 24, formList: [{ dataIndex: "summarize" }] }]
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
formType: "grid",
|
|
|
|
|
|
cols: [{ span: 24, formList: [{ dataIndex: "initialization" }] }]
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
formType: "grid",
|
|
|
|
|
|
cols: [
|
|
|
|
|
|
{ span: 12, formList: [{ dataIndex: "premise" }] },
|
|
|
|
|
|
{ span: 12, formList: [{ dataIndex: "exe_time" }] }
|
|
|
|
|
|
]
|
2023-06-15 20:13:46 +08:00
|
|
|
|
}
|
|
|
|
|
|
]
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
const crudColumns = ref([
|
|
|
|
|
|
{
|
|
|
|
|
|
title: "ID",
|
|
|
|
|
|
width: 50,
|
|
|
|
|
|
align: "center",
|
|
|
|
|
|
dataIndex: "id",
|
|
|
|
|
|
fixed: "left"
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
2024-05-11 18:11:56 +08:00
|
|
|
|
title: "用例标识",
|
2023-06-15 20:13:46 +08:00
|
|
|
|
dataIndex: "ident",
|
2023-08-21 19:57:49 +08:00
|
|
|
|
sortable: { sortDirections: ["ascend"] },
|
2023-06-15 20:13:46 +08:00
|
|
|
|
width: 140,
|
|
|
|
|
|
align: "center",
|
2023-08-23 20:45:44 +08:00
|
|
|
|
addDisabled: true,
|
|
|
|
|
|
addDefaultValue: route.query.key,
|
|
|
|
|
|
editDefaultValue: route.query.key,
|
|
|
|
|
|
editDisabled: true,
|
2023-06-15 20:13:46 +08:00
|
|
|
|
search: true,
|
|
|
|
|
|
validateTrigger: "blur"
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
title: "名称",
|
|
|
|
|
|
dataIndex: "name",
|
|
|
|
|
|
width: 120,
|
|
|
|
|
|
align: "center",
|
|
|
|
|
|
search: true,
|
|
|
|
|
|
commonRules: [{ required: true, message: "名称是必填" }],
|
|
|
|
|
|
validateTrigger: "blur"
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
title: "设计人员",
|
|
|
|
|
|
width: 80,
|
|
|
|
|
|
dataIndex: "designPerson",
|
|
|
|
|
|
align: "center",
|
|
|
|
|
|
search: true,
|
|
|
|
|
|
formType: "select",
|
2023-07-21 16:08:08 +08:00
|
|
|
|
dict: { url: "system/user/list", translation: true, props: { label: "name", value: "name" } }
|
2023-06-15 20:13:46 +08:00
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
title: "执行人员",
|
|
|
|
|
|
dataIndex: "testPerson",
|
|
|
|
|
|
width: 80,
|
|
|
|
|
|
align: "center",
|
|
|
|
|
|
search: true,
|
|
|
|
|
|
formType: "select",
|
2023-07-21 16:08:08 +08:00
|
|
|
|
dict: { url: "system/user/list", translation: true, props: { label: "name", value: "name" } }
|
2023-06-15 20:13:46 +08:00
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
title: "审核人员",
|
|
|
|
|
|
dataIndex: "monitorPerson",
|
|
|
|
|
|
width: 80,
|
|
|
|
|
|
align: "center",
|
|
|
|
|
|
search: true,
|
|
|
|
|
|
formType: "select",
|
2023-07-21 16:08:08 +08:00
|
|
|
|
dict: { url: "system/user/list", translation: true, props: { label: "name", value: "name" } }
|
2023-06-15 20:13:46 +08:00
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
title: "用例综述",
|
|
|
|
|
|
align: "center",
|
|
|
|
|
|
dataIndex: "summarize",
|
2023-08-09 21:06:19 +08:00
|
|
|
|
search: true,
|
|
|
|
|
|
addDefaultValue: ""
|
2023-06-15 20:13:46 +08:00
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
title: "用例初始化",
|
|
|
|
|
|
dataIndex: "initialization",
|
|
|
|
|
|
hide: true,
|
|
|
|
|
|
addDefaultValue: "软件正常启动,正常登录进软件"
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
title: "前提和约束",
|
|
|
|
|
|
dataIndex: "premise",
|
|
|
|
|
|
hide: true,
|
|
|
|
|
|
addDefaultValue: "软件正常启动,各界面显示工作正常"
|
|
|
|
|
|
},
|
2024-05-31 18:29:29 +08:00
|
|
|
|
{
|
|
|
|
|
|
title: "执行时间",
|
|
|
|
|
|
dataIndex: "exe_time",
|
|
|
|
|
|
hide: true,
|
|
|
|
|
|
formType: "date",
|
|
|
|
|
|
},
|
2023-06-15 20:13:46 +08:00
|
|
|
|
{
|
|
|
|
|
|
title: "测试步骤",
|
|
|
|
|
|
dataIndex: "testStep",
|
|
|
|
|
|
hide: true,
|
|
|
|
|
|
addDefaultValue: [
|
|
|
|
|
|
{
|
|
|
|
|
|
operation: "",
|
|
|
|
|
|
expect: "",
|
|
|
|
|
|
result: "",
|
|
|
|
|
|
passed: "3",
|
|
|
|
|
|
status: "3"
|
|
|
|
|
|
}
|
|
|
|
|
|
],
|
|
|
|
|
|
formType: "children-form",
|
|
|
|
|
|
type: "group",
|
|
|
|
|
|
formList: [
|
|
|
|
|
|
{
|
|
|
|
|
|
title: "操作",
|
|
|
|
|
|
dataIndex: "operation",
|
2024-05-11 18:11:56 +08:00
|
|
|
|
formType: "editor",
|
|
|
|
|
|
height: 180
|
2023-06-15 20:13:46 +08:00
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
title: "预期",
|
|
|
|
|
|
placeholder: "请输入预期结果",
|
|
|
|
|
|
dataIndex: "expect"
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
title: "结果",
|
|
|
|
|
|
dataIndex: "result",
|
2024-05-11 18:11:56 +08:00
|
|
|
|
formType: "editor",
|
|
|
|
|
|
height: 180
|
2023-06-15 20:13:46 +08:00
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
title: "是否通过",
|
|
|
|
|
|
dataIndex: "passed",
|
|
|
|
|
|
formType: "radio",
|
2024-04-19 18:53:52 +08:00
|
|
|
|
dict: { name: "passType", props: { label: "title", value: "key" } },
|
|
|
|
|
|
commonRules: [{ required: true, message: "是否通过必填" }]
|
2023-06-15 20:13:46 +08:00
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
title: "执行状态",
|
|
|
|
|
|
dataIndex: "status",
|
|
|
|
|
|
formType: "radio",
|
2024-04-19 18:53:52 +08:00
|
|
|
|
dict: { name: "execType", props: { label: "title", value: "key" } },
|
|
|
|
|
|
commonRules: [{ required: true, message: "执行状态必填" }]
|
2023-06-15 20:13:46 +08:00
|
|
|
|
}
|
|
|
|
|
|
]
|
|
|
|
|
|
}
|
|
|
|
|
|
])
|
2024-05-11 18:11:56 +08:00
|
|
|
|
// 暴露刷新表格方法给外部
|
|
|
|
|
|
const refreshCrudTable = () => {
|
|
|
|
|
|
crudRef.value.refresh()
|
|
|
|
|
|
}
|
|
|
|
|
|
defineExpose({ refreshCrudTable })
|
2023-06-15 20:13:46 +08:00
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style lang="less" scoped></style>
|