This commit is contained in:
2024-05-16 18:44:00 +08:00
parent 2ea8213335
commit c25e8b5421
3 changed files with 77 additions and 34 deletions

View File

@@ -12,7 +12,7 @@ export default {
}) })
}, },
/** /**
* 添加轮次 * 添加轮次,并自动添加文档审查、代码审查、静态分析设计需求
* @returns * @returns
*/ */
save(project_id, params = {}) { save(project_id, params = {}) {

View File

@@ -120,7 +120,7 @@
<!-- 如果没有第一轮的SO_dut则弹窗 --> <!-- 如果没有第一轮的SO_dut则弹窗 -->
<ma-form-modal <ma-form-modal
ref="soDutFormRef" ref="soDutFormRef"
title="新增第一轮源代码被测件" :title="soDutModalTitle"
:column="soDutColumn" :column="soDutColumn"
width="800px" width="800px"
:submit="handleSoDutSubmit" :submit="handleSoDutSubmit"
@@ -253,6 +253,20 @@ const projectId = ref(route.query.id)
const checkedKeys = ref([]) const checkedKeys = ref([])
/// 点击复制按钮 /// 点击复制按钮
const handleCopyNode = async () => { const handleCopyNode = async () => {
// 0.先判断是否是同一个轮次的节点
let firstNodeRoundKey = ""
let isFirst = true
checkedKeys.value.forEach((item) => {
if (isFirst) {
firstNodeRoundKey = item.split("-")[0]
isFirst = false
} else {
if (item.split("-")[0] !== firstNodeRoundKey) {
Message.error("请选择同一轮次的节点进行复制")
return
}
}
})
// 1.先判断是否选中了节点 // 1.先判断是否选中了节点
if (checkedKeys.value.length < 1) { if (checkedKeys.value.length < 1) {
Message.error("您未选择节点,请选择后再试...") Message.error("您未选择节点,请选择后再试...")
@@ -269,10 +283,13 @@ const handleCopyNode = async () => {
}) })
isComplete.value = true isComplete.value = true
Message.success(st.message) Message.success(st.message)
Notification.warning("请注意自动生成的设计需求、测试项、用例信息重复,需要修改")
// 清空checkedKeys
checkedKeys.value = []
// 处理完后需要更新树结构 // 处理完后需要更新树结构
treeDataStore.resetTreeData(projectId.value) treeDataStore.resetTreeData(projectId.value)
// 清除右侧路由的组件显示,不然会因为数据而出错 // 清除右侧路由的组件显示,不然会因为数据而出错当然直接复制query可能是错误信息
router.replace({ name: "project" }) router.replace({ name: "project", query: route.query })
} }
/// 进度条变量 /// 进度条变量
const visible = ref(false) const visible = ref(false)
@@ -323,7 +340,7 @@ const handleSoDutSubmit = async (data) => {
const res = await dutApi.createR1SoDut(input_data) const res = await dutApi.createR1SoDut(input_data)
if (res.code == 200) { if (res.code == 200) {
treeDataStore.updateDutTreeData(res.data, projectId.value) treeDataStore.updateDutTreeData(res.data, projectId.value)
Message.success("添加成功...") Message.success("添加源代码被测件成功,并自动创建第一轮的文档审查、静态分析、代码审查测试项和用例")
setTimeout(() => { setTimeout(() => {
location.reload() location.reload()
}, 500) }, 500)
@@ -333,24 +350,32 @@ const handleSoDutSubmit = async (data) => {
} }
// ~~~~定义弹出a-form-modal的cancel方法-返回false则无法关闭弹窗~~~~ // ~~~~定义弹出a-form-modal的cancel方法-返回false则无法关闭弹窗~~~~
const handleSoDutCancel = () => { const handleSoDutCancel = () => {
Notification.error("必须添加第一轮源代码信息,无法关闭!") Notification.error("必须按要求添加源代码信息,无法关闭!")
return false return false
} }
// 初始化树状数据 // 初始化树状数据
// so_dut弹窗ref对象 // so_dut弹窗ref对象
const soDutFormRef = ref() const soDutFormRef = ref()
onMounted(async () => { /// 强制弹窗的标题
await treeDataStore.initTreeData(projectId.value) const soDutModalTitle = ref("强制添加第一轮源代码信息")
// 检查是否存在第一轮的源代码dut // 辅助函数传入res.data来判断是否强制弹窗
const handleSoDutExistsForceModal = async () => {
/// 主动后端请求 /// 主动后端请求
const res = await dutApi.getSoExists({ id: projectId.value }) const res = await dutApi.getSoExists({ id: projectId.value })
/// 如果包含第一轮源代码则不处理不包含则弹窗必须添加dut res.data.round_list.forEach((item) => {
if (!res.data.exists) { if (!item.isExists) {
// 这里就必须让用户选择添加了 Message.warning(`识别到您未添加第${parseInt(item.key) + 1}轮源代码的信息,请填写信息自动创建`)
Message.warning("识别到您未添加第一轮源代码的信息,此信息必填") soDutModalTitle.value = `强制添加第${parseInt(item.key) + 1}轮源代码的信息`
soDutFormRef.value.open({}) soDutFormRef.value.open({ round_key: item.key })
return
} }
}) })
}
onMounted(async () => {
await treeDataStore.initTreeData(projectId.value)
// 依次找轮次里面是否有源代码被测件,如果没有则强制弹窗让用户创建
handleSoDutExistsForceModal()
})
// v-model绑定选中节点 // v-model绑定选中节点
const selectedKeys = ref([]) const selectedKeys = ref([])
const previousKey = ref(null) const previousKey = ref(null)
@@ -522,10 +547,10 @@ const handleRoundDelClick = async (value) => {
await roundApi.delete(projectId.value, value) await roundApi.delete(projectId.value, value)
Message.success("删除成功!") Message.success("删除成功!")
treeDataStore.resetTreeData(projectId.value) treeDataStore.resetTreeData(projectId.value)
router.replace({ name: "project" }) router.replace({ name: "project", query: route.query })
} catch {} } catch {}
} }
/// Ma-form-Modal的提交按钮 /// Ma-form-Modal的提交按钮 - 轮次新增/编辑逻辑
const handleRoundSubmit = async (value) => { const handleRoundSubmit = async (value) => {
if (title.value.slice(0, 1) === "编") { if (title.value.slice(0, 1) === "编") {
try { try {
@@ -540,6 +565,8 @@ const handleRoundSubmit = async (value) => {
await roundApi.save(projectId.value, value) await roundApi.save(projectId.value, value)
Message.success("新增成功!") Message.success("新增成功!")
treeDataStore.resetTreeData(projectId.value) treeDataStore.resetTreeData(projectId.value)
// 调用判断函数判断是否轮次有源代码dut
handleSoDutExistsForceModal()
} catch { } catch {
Message.error("新增失败!") Message.error("新增失败!")
} }
@@ -571,8 +598,7 @@ const roundColumn = ref([
{ {
title: "速度等级", title: "速度等级",
dataIndex: "speedGrade", dataIndex: "speedGrade",
placeholder: "请填入速度等级", placeholder: "请填入速度等级"
rules: [{ required: true, message: "速度等级必填" }]
} }
] ]
}, },
@@ -590,8 +616,7 @@ const roundColumn = ref([
{ {
title: "封装", title: "封装",
dataIndex: "package", dataIndex: "package",
placeholder: "请填入封装", placeholder: "请填入封装"
rules: [{ required: true, message: "封装必填" }]
} }
] ]
} }
@@ -686,10 +711,17 @@ const roundOption = ref({
}) })
// 源代码so_dut的弹窗 // 源代码so_dut的弹窗
const soDutColumn = ref([ const soDutColumn = ref([
{
title: "轮次key",
dataIndex: "round_key",
placeholder: "非用户填写",
disabled: true,
rules: [{ required: true, message: "非用户填写,但必填" }]
},
{ {
title: "代码版本", title: "代码版本",
dataIndex: "version", dataIndex: "version",
placeholder: "请输入代码版本", placeholder: "请输入代码版本注意不要带V",
rules: [{ required: true, message: "代码版本必填" }] rules: [{ required: true, message: "代码版本必填" }]
}, },
{ {
@@ -862,6 +894,11 @@ let dragDropPosition = 0
/// 节点在可释放目标释放的操作 - drapNode是被拖拽的节点dropNone是释放在哪个节点下dropPosition是释放的位置-1,0... /// 节点在可释放目标释放的操作 - drapNode是被拖拽的节点dropNone是释放在哪个节点下dropPosition是释放的位置-1,0...
const ondrop = ({ e, dragNode, dropNode, dropPosition }) => { const ondrop = ({ e, dragNode, dropNode, dropPosition }) => {
const data = treeData.value // 1.这是整体的树数据 const data = treeData.value // 1.这是整体的树数据
// 提示用户只能拖拽用例节点
if (dragNode.level === "3") {
Message.warning("只能拖拽用例节点")
return
}
// 拖拽逻辑: // 拖拽逻辑:
// 1.首先只能拖拽用例节点才能实现功能 // 1.首先只能拖拽用例节点才能实现功能
if (dragNode.level === "4") { if (dragNode.level === "4") {
@@ -876,6 +913,12 @@ const ondrop = ({ e, dragNode, dropNode, dropPosition }) => {
dropNodeGlobal = dropNode dropNodeGlobal = dropNode
paoContainer.value = e.target.parentElement paoContainer.value = e.target.parentElement
paoVisible.value = true paoVisible.value = true
} else if (dropNode.children.includes(dragNode)) {
// 这里就用例拖拽到当前的测试项节点,则可弹出复制弹窗
dragNodeGlobal = dragNode
dropNodeGlobal = dropNode
paoContainer.value = e.target.parentElement
paoVisible.value = true
} }
} }
} else if (dropNode.level === "4") { } else if (dropNode.level === "4") {

View File

@@ -138,28 +138,28 @@ const createJLItem = async (record) => {
// 说明生成二级文档 // 说明生成二级文档
const createSmItem = async (record) => { const createSmItem = async (record) => {
// 生成测评对象 - 和大纲一样 - 可能会删除 // 生成测评对象 - 和大纲一样 - 可能会删除
const st = await dgGenerateApi.createSoftComposition({ id: record.id }) await dgGenerateApi.createSoftComposition({ id: record.id })
// 生成被测软件功能 - 和大纲重复 - 可能会删除 // 生成被测软件功能 - 和大纲重复 - 可能会删除
const st1 = await dgGenerateApi.createFuncList({ id: record.id }) await dgGenerateApi.createFuncList({ id: record.id })
// 生成被测软件接口 - 和大纲重复 - 可能会删除 // 生成被测软件接口 - 和大纲重复 - 可能会删除
const st2 = await dgGenerateApi.createInterface({ id: record.id }) await dgGenerateApi.createInterface({ id: record.id })
// 生成被测软件性能 - 和大纲重复 - 可能会删除 // 生成被测软件性能 - 和大纲重复 - 可能会删除
const st3 = await dgGenerateApi.createPerformance({ id: record.id }) await dgGenerateApi.createPerformance({ id: record.id })
// 生成被测软件基本信息 - 和大纲重复 - 可能会删除 // 生成被测软件基本信息 - 和大纲重复 - 可能会删除
const st4 = await dgGenerateApi.createBaseInformation({ id: record.id }) await dgGenerateApi.createBaseInformation({ id: record.id })
// 生成标准类引用文档 - 和大纲重复 - 可能会删除 // 生成标准类引用文档 - 和大纲重复 - 可能会删除
const st5 = await dgGenerateApi.createYiju({ id: record.id }) await dgGenerateApi.createYiju({ id: record.id })
// 生成技术类引用文档列表 -> 在大纲基础上添加《测评大纲》 // 生成技术类引用文档列表 -> 在大纲基础上添加《测评大纲》
const st6 = await smGenerateApi.createSMTechyiju({ id: record.id }) await smGenerateApi.createSMTechyiju({ id: record.id })
// 生成软硬件环境(注意标题级别不一样,这个在最后处理) // 生成软硬件环境(注意标题级别不一样,这个在最后处理)
const st7 = await dgGenerateApi.createEnvironment({ id: record.id }) await dgGenerateApi.createEnvironment({ id: record.id })
// 生成用例全 // 生成用例全
const st8 = await smGenerateApi.createSMCaseList({ id: record.id }) await smGenerateApi.createSMCaseList({ id: record.id })
// 生成用例列表-那个表格 // 生成用例列表-那个表格
const st9 = await smGenerateApi.createSMCaseBreifList({ id: record.id }) await smGenerateApi.createSMCaseBreifList({ id: record.id })
// 生成说明追踪 // 生成说明追踪
const st10 = await smGenerateApi.createSMTrack({ id: record.id }) const st = await smGenerateApi.createSMTrack({ id: record.id })
Message.success(st10.message) Message.success(st.message)
} }
// 大纲生成二级文档 // 大纲生成二级文档
const createDgItem = async (record) => { const createDgItem = async (record) => {