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 testDemandApi from "@/api/project/testDemand"
|
2023-08-15 17:15:52 +08:00
|
|
|
|
import { useTreeDataStore } from "@/store"
|
2023-08-23 20:45:44 +08:00
|
|
|
|
import commonApi from "@/api/common"
|
2023-08-24 17:05:21 +08:00
|
|
|
|
import PinYinMatch from "pinyin-match"
|
|
|
|
|
|
|
2023-08-15 17:15:52 +08:00
|
|
|
|
const treeDataStore = useTreeDataStore()
|
2023-06-15 20:13:46 +08:00
|
|
|
|
const route = useRoute()
|
|
|
|
|
|
const router = useRouter()
|
2023-08-24 19:24:00 +08:00
|
|
|
|
const crudRef = ref()
|
2023-06-15 20:13:46 +08:00
|
|
|
|
// 根据传参获取key,分别为轮次、设计需求的key
|
|
|
|
|
|
const roundNumber = route.query.key.split("-")[0]
|
2023-08-02 13:38:09 +08:00
|
|
|
|
const dutNumber = route.query.key.split("-")[1]
|
2023-06-19 19:51:12 +08:00
|
|
|
|
const designDemandNumber = route.query.key.split("-")[2]
|
2023-08-15 17:15:52 +08:00
|
|
|
|
const projectId = ref(route.query.id)
|
2023-08-23 20:45:44 +08:00
|
|
|
|
// 标识显示字段
|
|
|
|
|
|
const testTypeDict = ref([])
|
|
|
|
|
|
!(function () {
|
|
|
|
|
|
commonApi.getDict("testType").then((res) => {
|
|
|
|
|
|
testTypeDict.value = res
|
|
|
|
|
|
})
|
|
|
|
|
|
})()
|
|
|
|
|
|
const showType = (record) => {
|
|
|
|
|
|
let len = testTypeDict.value.data.length
|
|
|
|
|
|
for (let i = 0; i < len; i++) {
|
|
|
|
|
|
if (testTypeDict.value.data[i].key === record.testType) {
|
|
|
|
|
|
let key_string = parseInt(record.key.substring(record.key.lastIndexOf("-") + 1)) + 1
|
|
|
|
|
|
let item = testTypeDict.value.data[i]
|
2023-08-24 17:05:21 +08:00
|
|
|
|
return "XQ-" + record.ident + "-" + item.show_title + "-" + 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: testDemandApi.getTestDemandList,
|
2023-08-24 17:05:21 +08:00
|
|
|
|
add: { show: true, api: testDemandApi.save },
|
2023-08-02 13:38:09 +08:00
|
|
|
|
edit: { show: true, api: testDemandApi.update },
|
2023-08-24 17:05:21 +08:00
|
|
|
|
delete: { show: true, api: testDemandApi.delete },
|
2023-08-24 19:24:00 +08:00
|
|
|
|
beforeOpenAdd: function () {
|
2023-08-25 13:28:24 +08:00
|
|
|
|
let key_split = route.query.key.split("-")
|
|
|
|
|
|
let round_key = key_split[0]
|
|
|
|
|
|
let dut_key = key_split[1]
|
|
|
|
|
|
let design_key = key_split[2]
|
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} > 测试项-`
|
|
|
|
|
|
return true
|
|
|
|
|
|
},
|
|
|
|
|
|
beforeOpenEdit: function (record) {
|
2023-08-25 13:28:24 +08:00
|
|
|
|
let key_split = route.query.key.split("-")
|
|
|
|
|
|
let round_key = key_split[0]
|
|
|
|
|
|
let dut_key = key_split[1]
|
|
|
|
|
|
let design_key = key_split[2]
|
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} >测试项[${record.name}]-`
|
|
|
|
|
|
return true
|
|
|
|
|
|
},
|
2023-08-15 17:15:52 +08:00
|
|
|
|
afterAdd: (res) => {
|
|
|
|
|
|
let id = projectId.value
|
|
|
|
|
|
treeDataStore.updateTestDemandTreeData(res.data, id)
|
|
|
|
|
|
},
|
|
|
|
|
|
afterEdit: (res) => {
|
|
|
|
|
|
let id = projectId.value
|
|
|
|
|
|
treeDataStore.updateTestDemandTreeData(res.data, id)
|
|
|
|
|
|
},
|
|
|
|
|
|
afterDelete: (res, record) => {
|
|
|
|
|
|
let id = projectId.value
|
|
|
|
|
|
treeDataStore.updateTestDemandTreeData(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
|
|
|
|
|
|
},
|
|
|
|
|
|
showIndex: false,
|
|
|
|
|
|
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
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
const crudColumns = ref([
|
|
|
|
|
|
{
|
|
|
|
|
|
title: "ID",
|
|
|
|
|
|
align: "center",
|
|
|
|
|
|
width: 50,
|
|
|
|
|
|
dataIndex: "id"
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
title: "标识",
|
2023-08-24 17:05:21 +08:00
|
|
|
|
width: 150,
|
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
|
|
|
|
align: "center",
|
|
|
|
|
|
search: true,
|
2023-08-24 17:05:21 +08:00
|
|
|
|
addDisabled: true,
|
|
|
|
|
|
editDisabled: true,
|
2023-06-15 20:13:46 +08:00
|
|
|
|
validateTrigger: "blur"
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
title: "名称",
|
|
|
|
|
|
dataIndex: "name",
|
|
|
|
|
|
width: 120,
|
|
|
|
|
|
align: "center",
|
|
|
|
|
|
search: true,
|
|
|
|
|
|
commonRules: [{ required: true, message: "名称是必填" }],
|
|
|
|
|
|
validateTrigger: "blur"
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
title: "优先级",
|
|
|
|
|
|
dataIndex: "priority",
|
|
|
|
|
|
search: true,
|
|
|
|
|
|
formType: "radio",
|
|
|
|
|
|
align: "center",
|
|
|
|
|
|
addDefaultValue: "1",
|
|
|
|
|
|
dict: {
|
|
|
|
|
|
name: "priority",
|
|
|
|
|
|
props: { label: "title", value: "key" },
|
|
|
|
|
|
translation: true,
|
|
|
|
|
|
tagColors: { 1: "red", 2: "blue", 3: "green" }
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
title: "测试类型",
|
|
|
|
|
|
dataIndex: "testType",
|
|
|
|
|
|
search: true,
|
|
|
|
|
|
align: "center",
|
|
|
|
|
|
formType: "select",
|
|
|
|
|
|
sortable: { sortDirections: ["ascend", "descend"] },
|
|
|
|
|
|
addDefaultValue: "3",
|
|
|
|
|
|
maxLength: 200,
|
|
|
|
|
|
commonRules: [{ required: true, message: "测试类型必选" }],
|
|
|
|
|
|
dict: { name: "testType", translation: true, props: { label: "title", value: "key" } },
|
2023-08-24 17:05:21 +08:00
|
|
|
|
extra: "请保证测试类型选择正确",
|
|
|
|
|
|
filterOption: function (inputValue, selectedOption) {
|
2023-08-24 19:24:00 +08:00
|
|
|
|
if (inputValue) {
|
|
|
|
|
|
let matchRes = PinYinMatch.match(selectedOption.label, inputValue)
|
|
|
|
|
|
if (matchRes) {
|
2023-08-24 17:05:21 +08:00
|
|
|
|
return true
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2023-06-15 20:13:46 +08:00
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
title: "充分条件",
|
|
|
|
|
|
hide: true,
|
2023-06-19 19:51:12 +08:00
|
|
|
|
addDefaultValue: "覆盖需求相关功能",
|
2023-06-15 20:13:46 +08:00
|
|
|
|
dataIndex: "adequacy",
|
2023-08-24 17:05:21 +08:00
|
|
|
|
formType: "textarea",
|
|
|
|
|
|
maxLength: 256,
|
2023-06-15 20:13:46 +08:00
|
|
|
|
commonRules: [{ required: true, message: "充分性描述必填" }]
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
title: "终止条件",
|
|
|
|
|
|
hide: true,
|
|
|
|
|
|
dataIndex: "termination",
|
|
|
|
|
|
formType: "textarea",
|
|
|
|
|
|
showWordLimit: true,
|
2023-08-24 17:05:21 +08:00
|
|
|
|
maxLength: 1024,
|
2023-06-15 20:13:46 +08:00
|
|
|
|
addDefaultValue:
|
|
|
|
|
|
"1.测试正常终止:测试项分解的所有用例执行完毕,达到充分性要求,相关记录完整;\n2.测试异常终止:由于某些特殊原因导致该测试项分解的测试用例不能完全执行,无法执行的原因已记录",
|
|
|
|
|
|
commonRules: [{ required: true, message: "前提条件必填" }]
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
title: "前提条件",
|
|
|
|
|
|
hide: true,
|
2023-06-19 19:51:12 +08:00
|
|
|
|
addDefaultValue: "软件正常运行,外部接口通信正常",
|
2023-06-15 20:13:46 +08:00
|
|
|
|
dataIndex: "premise",
|
2023-08-24 17:05:21 +08:00
|
|
|
|
formType: "textarea",
|
|
|
|
|
|
maxLength: 256,
|
2023-06-15 20:13:46 +08:00
|
|
|
|
commonRules: [{ required: true, message: "前提条件必填" }]
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
title: "测试方法",
|
|
|
|
|
|
align: "center",
|
|
|
|
|
|
dataIndex: "testMethod",
|
2023-08-24 17:05:21 +08:00
|
|
|
|
formType: "select",
|
|
|
|
|
|
multiple: true,
|
|
|
|
|
|
dict: { name: "testMethod", props: { label: "title", value: "key" }, translation: true }
|
2023-06-15 20:13:46 +08:00
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
title: "测试内容",
|
|
|
|
|
|
hide: true,
|
2023-06-19 19:51:12 +08:00
|
|
|
|
dataIndex: "testContent",
|
2023-06-15 20:13:46 +08:00
|
|
|
|
commonRules: [{ required: true, message: "测试内容必填" }],
|
|
|
|
|
|
formType: "children-form",
|
|
|
|
|
|
type: "table",
|
|
|
|
|
|
formList: [
|
|
|
|
|
|
{
|
|
|
|
|
|
title: "测试分解",
|
|
|
|
|
|
dataIndex: "testXuQiu"
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
title: "预期",
|
|
|
|
|
|
dataIndex: "testYuQi"
|
|
|
|
|
|
}
|
|
|
|
|
|
]
|
|
|
|
|
|
}
|
|
|
|
|
|
])
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style lang="less" scoped></style>
|