提交给其他人

This commit is contained in:
2025-03-25 17:58:49 +08:00
parent ebd91433d9
commit 9d3945413a
6 changed files with 327 additions and 279 deletions

View File

@@ -38,6 +38,18 @@
>
<template #extra>
<a-space>
<!-- 修改源码添加向上和向下 -->
<a-tooltip content="向上移动" v-if="!(props.component.hideAdd ?? false)">
<a-button @click.stop="moveUp(itemIndex)" type="primary" size="small" shape="round">
<template #icon><icon-arrow-rise /></template>
</a-button>
</a-tooltip>
<a-tooltip content="向下移动" v-if="!(props.component.hideAdd ?? false)">
<a-button @click.stop="moveDown(itemIndex)" type="primary" size="small" shape="round">
<template #icon><icon-arrow-fall /></template>
</a-button>
</a-tooltip>
<icon-oblique-line />
<!-- 修改源码新增复制该项新增 -->
<a-tooltip content="复制该项添加" v-if="!(props.component.hideAdd ?? false)">
<a-button
@@ -136,7 +148,7 @@
</td>
<template v-for="component in viewFormList[index]">
<td class="arco-table-td">
{{ (component.hideLabel = true ? "" : "") }}
{{ component.hideLabel = true ? "" : "" }}
<span class="arco-table-cell">
<component
v-if="!containerItems.includes(component.formType)"
@@ -218,10 +230,37 @@ if (props.component.type == "table") {
})
}
// 辅助函数:交换数组两个元素
function swapItems(idx1, idx2) {
const arr = formModel.value[props.component.dataIndex]
;[arr[idx1], arr[idx2]] = [arr[idx2], arr[idx1]]
}
// 修改源码上移动和下移动
const moveUp = (itemIndex) => {
const itemLength = formModel.value[props.component.dataIndex].length
// 如果是第一个,不做操作
if (itemIndex === 0) {
return
}
// 进行移动
swapItems(itemIndex, itemIndex - 1)
}
const moveDown = (itemIndex) => {
const itemLength = formModel.value[props.component.dataIndex].length
// 如果是最后一个,不做操作
if (itemIndex === itemLength - 1) {
return
}
// 进行移动
swapItems(itemIndex, itemIndex + 1)
}
const addItem = async (data = {}) => {
// 修改源码:深度复制
let newData = cloneDeep(data)
let index = formModel.value[props.component.dataIndex].length
let index = formModel.value[props.component.dataIndex].length // 当前子项列表长度
viewFormList.value[index] = cloneDeep(formList)
rv("onAdd", { formList: viewFormList.value[index], newData, index }) // 修改源码深度复制data->newData
formModel.value[props.component.dataIndex].push(newData) // 修改源码深度复制data->newData

View File

@@ -22,7 +22,7 @@ export default function useTreeDrag(projectId, routeViewRef) {
const ondrop = ({ e, dragNode, dropNode, dropPosition }) => {
const data = treeData.value // 1.这是整体的树数据
// 提示用户只能拖拽用例节点
if (dragNode.level === "3") {
if (dragNode.level !== "4") {
Message.warning("只能拖拽用例节点")
return
}
@@ -59,7 +59,7 @@ export default function useTreeDrag(projectId, routeViewRef) {
}
}
}
// a-tree是否允许拖拽节点
// a-tree拖拽时是否允许在某级别节点上释放:目前支持在测试项节点、测试用例节点释放
const allowdrop = (options) => {
if (options.dropNode.level === "4" || options.dropNode.level === "3") {
return true

View File

@@ -85,6 +85,14 @@ export default function (crudOrFormRef: any) {
addDefaultValue:
"测试用例覆盖XX子项名称1、XX子项名称2、XX子项名称3子项要求的全部内容。\n所有用例执行完毕对于未执行的用例说明未执行原因。"
},
{
title: "测试项描述",
hide: true,
dataIndex: "testDesciption",
formType: "textarea",
maxLength: 256,
placeholder: "FPGA-老版本需填写!!!"
},
{
title: "测试子项",
hide: true,
@@ -111,8 +119,8 @@ export default function (crudOrFormRef: any) {
title: "子项描述",
dataIndex: "subDesc",
formType: "textarea",
placeholder: "对应大纲测试项表格的测试项描述",
rules: [{ required: true, message: "测试子项描述必填" }]
placeholder: "对应大纲测试项表格的测试项描述FPGA-老模版不用填写!!!"
// rules: [{ required: true, message: "测试子项描述必填" }]
},
{
title: "条件",