This commit is contained in:
2023-08-24 17:05:21 +08:00
parent f76e67c8fb
commit 5c39fb35f2
8 changed files with 157 additions and 41 deletions

View File

@@ -22,6 +22,7 @@
"monaco-editor": "^0.33.0",
"nprogress": "^0.2.0",
"pinia": "^2.1.3",
"pinyin-match": "^1.2.4",
"postcss-import": "^15.1.0",
"qs": "^6.11.2",
"sortablejs": "^1.15.0",
@@ -3576,6 +3577,11 @@
}
}
},
"node_modules/pinyin-match": {
"version": "1.2.4",
"resolved": "https://registry.npmmirror.com/pinyin-match/-/pinyin-match-1.2.4.tgz",
"integrity": "sha512-HpUiaSxcG3rrpKAMZXq/rMHbEp7wvfu9B64lHJBy+63xAr/hVdBC8xqkWWPnNyjSb19ihdh8FnXo+9m6jAr9Mg=="
},
"node_modules/pirates": {
"version": "4.0.5",
"resolved": "https://registry.npmmirror.com/pirates/-/pirates-4.0.5.tgz",

View File

@@ -25,6 +25,7 @@
"monaco-editor": "^0.33.0",
"nprogress": "^0.2.0",
"pinia": "^2.1.3",
"pinyin-match": "^1.2.4",
"postcss-import": "^15.1.0",
"qs": "^6.11.2",
"sortablejs": "^1.15.0",

9
cdTMP/pnpm-lock.yaml generated
View File

@@ -47,6 +47,9 @@ dependencies:
pinia:
specifier: ^2.1.3
version: registry.npmmirror.com/pinia@2.1.3(vue@3.3.0)
pinyin-match:
specifier: ^1.2.4
version: registry.npmmirror.com/pinyin-match@1.2.4
postcss-import:
specifier: ^15.1.0
version: registry.npmmirror.com/postcss-import@15.1.0(postcss@8.4.24)
@@ -3012,6 +3015,12 @@ packages:
vue-demi: registry.npmmirror.com/vue-demi@0.14.5(vue@3.3.0)
dev: false
registry.npmmirror.com/pinyin-match@1.2.4:
resolution: {integrity: sha512-HpUiaSxcG3rrpKAMZXq/rMHbEp7wvfu9B64lHJBy+63xAr/hVdBC8xqkWWPnNyjSb19ihdh8FnXo+9m6jAr9Mg==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/pinyin-match/-/pinyin-match-1.2.4.tgz}
name: pinyin-match
version: 1.2.4
dev: false
registry.npmmirror.com/pirates@4.0.5:
resolution: {integrity: sha512-8V9+HQPupnaXMA23c5hvl69zXvTwTzyAYasnkb0Tts4XvO4CliqONMOnvlq26rkhLC3nWDFBJf73LU1e1VZLaQ==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/pirates/-/pirates-4.0.5.tgz}
name: pirates

View File

@@ -15,7 +15,7 @@
{{ expandedKeys?.length ? "全部收缩" : "全部展开" }}
</a-button>
<a-tree
class="h-10/12"
class="h-10/12 select-none"
:data="treeData"
size="small"
block-node
@@ -160,9 +160,70 @@ const projectId = ref(route.query.id)
onMounted(async () => {
treeDataStore.initTreeData(projectId.value)
})
// 1.定义展开的tree-key 2.定义全部展开的数据 3.定义展开收缩函数 -> 注意在treeStore里面使用递归处理
const expandedKeys = ref([])
const allExpandedKeys = ref([])
const toggleExpanded = () => {
allExpandedKeys.value = treeDataStore.outExpandNode()
expandedKeys.value = expandedKeys?.value.length ? [] : allExpandedKeys.value
}
/// 点击树状节点-参数1:节点数组参数2:树node对象 - 添加双击处理方式
let timerId = null
let count = 0
const pointNode = (value, data) => {
count++
if (timerId) {
return
}
timerId = setTimeout(async () => {
if (count > 1) {
// 双击触发 value是点击的节点data是节点数据
if (data.node.level == "0") {
projectApi.getDutInfo(projectInfo.value.id, data.node.key, data.node.level).then((res) => {
treeData.value[value].children = res.data
// 添加需要展开数据注意不要一直push判断在已展开节点是否包含点击的节点
if (!expandedKeys.value.includes(value[0])) {
expandedKeys.value.push(value[0])
}
})
}
if (data.node.level == "1") {
projectApi.getDemandInfo(projectInfo.value.id, data.node.key, data.node.level).then((res) => {
data.node.children = res.data
if (!expandedKeys.value.includes(value[0])) {
expandedKeys.value.push(value[0])
}
})
}
if (data.node.level == "2") {
projectApi.getTestInfo(projectInfo.value.id, data.node.key, data.node.level).then((res) => {
data.node.children = res.data
if (!expandedKeys.value.includes(value[0])) {
expandedKeys.value.push(value[0])
}
})
}
if (data.node.level == "3") {
projectApi.getCaseInfo(projectInfo.value.id, data.node.key, data.node.level).then((res) => {
data.node.children = res.data
if (!expandedKeys.value.includes(value[0])) {
expandedKeys.value.push(value[0])
}
})
}
if (data.node.level == "4") {
projectApi.getProblemInfo(projectInfo.value.id, data.node.key, data.node.level).then((res) => {
data.node.children = res.data
if (!expandedKeys.value.includes(value[0])) {
expandedKeys.value.push(value[0])
}
})
}
count = 0
clearTimeout(timerId)
timerId = null
} else {
// 单击触发
if (data.node.level === "0") {
router.push({ name: "round", query: { ...projectInfo.value, key: data.node.key } })
}
@@ -182,6 +243,11 @@ const pointNode = (value, data) => {
router.push({ name: "problem", query: { ...projectInfo.value, key: data.node.key } })
}
treeDataStore.setCurrentNode(data.node.key)
count = 0
clearTimeout(timerId)
timerId = null
}
}, 250)
}
/// 动态加载函数-参数1:树node对象
const loadMore = (nodeData) => {
@@ -282,14 +348,6 @@ const handleRoundSubmit = async (value) => {
}
}
// 1.定义展开的tree-key 2.定义全部展开的数据 3.定义展开收缩函数 -> 注意在treeStore里面使用递归处理
const expandedKeys = ref([])
const allExpandedKeys = ref([])
const toggleExpanded = () => {
allExpandedKeys.value = treeDataStore.outExpandNode()
expandedKeys.value = expandedKeys?.value.length ? [] : allExpandedKeys.value
}
/// 设置轮次弹窗的列信息
const roundColumn = ref([
{

View File

@@ -17,6 +17,8 @@ import { useRoute, useRouter } from "vue-router"
import testDemandApi from "@/api/project/testDemand"
import { useTreeDataStore } from "@/store"
import commonApi from "@/api/common"
import PinYinMatch from "pinyin-match"
const treeDataStore = useTreeDataStore()
const route = useRoute()
const router = useRouter()
@@ -38,16 +40,16 @@ const showType = (record) => {
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]
return item.show_title + "-" + record.ident + "-" + key_string.toString().padStart(3,"0")
return "XQ-" + record.ident + "-" + item.show_title + "-" + key_string.toString().padStart(3, "0")
}
}
}
// crud组件
const crudOptions = ref({
api: testDemandApi.getTestDemandList,
add: { show: true ,api:testDemandApi.save},
add: { show: true, api: testDemandApi.save },
edit: { show: true, api: testDemandApi.update },
delete: { show: true,api:testDemandApi.delete },
delete: { show: true, api: testDemandApi.delete },
afterAdd: (res) => {
let id = projectId.value
treeDataStore.updateTestDemandTreeData(res.data, id)
@@ -84,11 +86,13 @@ const crudColumns = ref([
},
{
title: "标识",
width: 150,
dataIndex: "ident",
sortable: { sortDirections: ["ascend"] },
align: "center",
search: true,
commonRules: [{ required: true, message: "标识是必填" }],
addDisabled: true,
editDisabled: true,
validateTrigger: "blur"
},
{
@@ -125,13 +129,23 @@ const crudColumns = ref([
maxLength: 200,
commonRules: [{ required: true, message: "测试类型必选" }],
dict: { name: "testType", translation: true, props: { label: "title", value: "key" } },
extra: "请保证测试类型选择正确"
extra: "请保证测试类型选择正确",
filterOption: function (inputValue, selectedOption) {
if(inputValue){
let matchRes = PinYinMatch.match(selectedOption.label,inputValue)
if(matchRes){
return true
}
}
}
},
{
title: "充分条件",
hide: true,
addDefaultValue: "覆盖需求相关功能",
dataIndex: "adequacy",
formType: "textarea",
maxLength: 256,
commonRules: [{ required: true, message: "充分性描述必填" }]
},
{
@@ -140,7 +154,7 @@ const crudColumns = ref([
dataIndex: "termination",
formType: "textarea",
showWordLimit: true,
maxLength: 200,
maxLength: 1024,
addDefaultValue:
"1.测试正常终止:测试项分解的所有用例执行完毕,达到充分性要求,相关记录完整;\n2.测试异常终止:由于某些特殊原因导致该测试项分解的测试用例不能完全执行,无法执行的原因已记录",
commonRules: [{ required: true, message: "前提条件必填" }]
@@ -150,13 +164,17 @@ const crudColumns = ref([
hide: true,
addDefaultValue: "软件正常运行,外部接口通信正常",
dataIndex: "premise",
formType: "textarea",
maxLength: 256,
commonRules: [{ required: true, message: "前提条件必填" }]
},
{
title: "测试方法",
align: "center",
dataIndex: "testMethod",
commonRules: [{ required: true, message: "测试方法必填" }]
formType: "select",
multiple: true,
dict: { name: "testMethod", props: { label: "title", value: "key" }, translation: true }
},
{
title: "测试内容",

View File

@@ -37,7 +37,7 @@ const showType = (record) => {
if (demandTypeDict.value.data[i].key === record.demandType) {
let key_string = parseInt(record.key.substring(record.key.lastIndexOf("-") + 1)) + 1
let item = demandTypeDict.value.data[i]
return item.show_title + "-" + record.ident + "-" + key_string.toString().padStart(3,"0")
return "SJ-" + record.ident + "-" + item.show_title + "-" + key_string.toString().padStart(3, "0")
}
}
}

View File

@@ -27,7 +27,7 @@ const projectId = ref(route.query.id)
// 标识显示字段
const showType = (record) => {
let key_string = parseInt(record.key.substring(record.key.lastIndexOf("-") + 1)) + 1
return record.ident + "-" + "YL" + key_string.toString().padStart(3,"0")
return "YL-" + record.ident + "-" + key_string.toString().padStart(3,"0")
}
// crud设置
const crudOptions = ref({
@@ -125,7 +125,6 @@ const crudColumns = ref([
align: "center",
search: true,
formType: "select",
commonRules: [{ required: true, message: "设计人员必填" }],
dict: { url: "system/user/list", translation: true, props: { label: "name", value: "name" } }
},
{
@@ -135,7 +134,6 @@ const crudColumns = ref([
align: "center",
search: true,
formType: "select",
commonRules: [{ required: true, message: "执行人员必填" }],
dict: { url: "system/user/list", translation: true, props: { label: "name", value: "name" } }
},
{
@@ -145,7 +143,6 @@ const crudColumns = ref([
align: "center",
search: true,
formType: "select",
commonRules: [{ required: true, message: "审核人员必填" }],
dict: { url: "system/user/list", translation: true, props: { label: "name", value: "name" } }
},
{

View File

@@ -59,7 +59,10 @@ const crudOptions = ref({
{ span: 8, formList: [{ dataIndex: "beginTime" }] },
{ span: 8, formList: [{ dataIndex: "endTime" }] },
{ span: 8, formList: [{ dataIndex: "duty_person" }] },
{ span: 8, formList: [{ dataIndex: "member" }] }
{ span: 24, formList: [{ dataIndex: "member" }] },
{ span: 8, formList: [{ dataIndex: "quality_person" }] },
{ span: 8, formList: [{ dataIndex: "vise_person" }] },
{ span: 8, formList: [{ dataIndex: "config_person" }] },
]
},
{
@@ -203,6 +206,30 @@ const crudColumns = ref([
dict: { url: "system/user/list", props: { label: "name", value: "name" }, translation: true },
commonRules: [{ required: true, message: "成员至少选择一个" }]
},
{
title: "质量保证",
dataIndex: "quality_person",
hide: true,
formType: "select",
dict: { url: "system/user/list", props: { label: "name", value: "name" }, translation: true },
commonRules: [{ required: true, message: "至少选择一个质量保证员" }]
},
{
title: "质量监督",
dataIndex: "vise_person",
hide: true,
formType: "select",
dict: { url: "system/user/list", props: { label: "name", value: "name" }, translation: true },
commonRules: [{ required: true, message: "至少选择一个质量监督员" }]
},
{
title: "配置管理",
dataIndex: "config_person",
hide: true,
formType: "select",
dict: { url: "system/user/list", props: { label: "name", value: "name" }, translation: true },
commonRules: [{ required: true, message: "至少选择一个配置管理员" }]
},
{
title: "关键等级",
dataIndex: "security_level",