双击打开详情修复
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
>
|
||||
测试管理平台
|
||||
</a-typography-title>
|
||||
<a-typography-title :heading="6" class="version">V0.0.3</a-typography-title>
|
||||
<a-typography-title :heading="6" class="version">V0.0.4</a-typography-title>
|
||||
<icon-menu-fold
|
||||
v-if="!topMenu && appStore.device === 'mobile'"
|
||||
style="font-size: 22px; cursor: pointer"
|
||||
|
||||
@@ -20,14 +20,13 @@ import Empty from "@/components/Empty/index.vue"
|
||||
// 获取缓存列表
|
||||
const tabBarStore = useTabBarStore()
|
||||
const cacheList = computed(() => tabBarStore.getCacheList)
|
||||
// 调用router-view组件的刷新方法
|
||||
const viewChildRef = ref()
|
||||
// 调用router-view组件的刷新方法 - 并暴露给子节点
|
||||
const viewChildRef = ref(null)
|
||||
const refresh = () => {
|
||||
try {
|
||||
viewChildRef.value.refreshCrudTable()
|
||||
} catch (err) {
|
||||
console.log("无法找到router-view动态组件的刷新函数")
|
||||
} finally {
|
||||
}
|
||||
}
|
||||
defineExpose({ refresh })
|
||||
|
||||
@@ -231,6 +231,8 @@
|
||||
></roundRight>
|
||||
<!-- w2:轮次的问题单ma-crud,这里要传参2个,首先是请求另外一个接口,然后取消是否关联字段 -->
|
||||
<problem-choose ref="problemRoundRef" hasRelated="roundProblem" :title="problemTitle"></problem-choose>
|
||||
<!-- 下面都是对应被测件、设计需求、测试项、测试用例、问题单的SubForm -->
|
||||
<DutSubForm ref="dutSubFormRef"></DutSubForm>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
@@ -246,6 +248,8 @@ import { useRoute } from "vue-router"
|
||||
import { useTreeDataStore } from "@/store"
|
||||
import { storeToRefs } from "pinia"
|
||||
import Progress from "@/views/testmanage/projmanage/cpns/progress.vue"
|
||||
// 导入单独节点类型单独对应的Modal组件
|
||||
import DutSubForm from "@/views/project/round/DutSubForm"
|
||||
// hooks模块化
|
||||
import useTreeDrag from "@/layout/treeHooks/treeDrag.js"
|
||||
import { useRightClick } from "./treeHooks/rightClick"
|
||||
@@ -258,6 +262,7 @@ import useLoadTreeNode from "./treeHooks/useLoadTreeNodes"
|
||||
import useRoundMaForm from "./treeHooks/useRoundMaForm"
|
||||
// router-view里面组件的ref -> 多个hook使用
|
||||
const routeViewRef = ref()
|
||||
provide("rightViewRef", routeViewRef)
|
||||
const treeDataStore = useTreeDataStore()
|
||||
const { treeData, currentNode } = storeToRefs(treeDataStore)
|
||||
const route = useRoute()
|
||||
@@ -291,7 +296,7 @@ const {
|
||||
const { expandedKeys, toggleExpanded } = useNodeExpand()
|
||||
|
||||
//~~~~~~大功能:单击/双击节点逻辑~~~~~~
|
||||
const { selectedKeys, pointNode } = useNodeClick(expandedKeys)
|
||||
const { selectedKeys, pointNode, dutSubFormRef } = useNodeClick(expandedKeys)
|
||||
|
||||
//~~~~~~大功能:动态加载a-tree节点函数~~~~~~
|
||||
const { loadMore } = useLoadTreeNode()
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -5,7 +5,6 @@ export default function useLoadTreeNode() {
|
||||
// global
|
||||
const route = useRoute()
|
||||
const projectInfo = ref({ ...route.query })
|
||||
|
||||
// Events
|
||||
const loadMore = (nodeData) => {
|
||||
if (nodeData.level == "0") {
|
||||
|
||||
@@ -4,6 +4,8 @@ import { useRoute } from "vue-router"
|
||||
import { useTreeDataStore } from "@/store"
|
||||
import { storeToRefs } from "pinia"
|
||||
import { useRouter } from "vue-router"
|
||||
// 导入组件用于类型
|
||||
import type { DutSubFormInstance } from "@/views/project/round/DutSubForm"
|
||||
export default function useNodeClick(expandedKeys: Ref<string[]>) {
|
||||
// global
|
||||
const route = useRoute()
|
||||
@@ -17,8 +19,10 @@ export default function useNodeClick(expandedKeys: Ref<string[]>) {
|
||||
// refs
|
||||
const selectedKeys = ref<any>([]) // 中间变量用于判断
|
||||
const previousKey = ref<any>() // 上一次点击
|
||||
// 点击事件
|
||||
const pointNode = (value, data) => {
|
||||
// SubFormRefs
|
||||
const dutSubFormRef = ref<DutSubFormInstance | null>(null)
|
||||
// 点击节点事件
|
||||
const pointNode = (value: any, data: any) => {
|
||||
// 获取处理单击不选中,双击选中的变量
|
||||
let catch_selected_key = selectedKeys.value
|
||||
selectedKeys.value = previousKey.value
|
||||
@@ -39,28 +43,12 @@ export default function useNodeClick(expandedKeys: Ref<string[]>) {
|
||||
})
|
||||
}
|
||||
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])
|
||||
}
|
||||
})
|
||||
// 打开弹窗
|
||||
dutSubFormRef.value!.open(data.node)
|
||||
}
|
||||
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])
|
||||
}
|
||||
})
|
||||
}
|
||||
count = 0
|
||||
if (timerId) clearTimeout(timerId)
|
||||
@@ -98,6 +86,7 @@ export default function useNodeClick(expandedKeys: Ref<string[]>) {
|
||||
}
|
||||
return {
|
||||
selectedKeys,
|
||||
pointNode
|
||||
pointNode,
|
||||
dutSubFormRef
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user