diff --git a/cdTMP/src/api/system/user.js b/cdTMP/src/api/system/user.js index b92c2fc..4287641 100644 --- a/cdTMP/src/api/system/user.js +++ b/cdTMP/src/api/system/user.js @@ -112,5 +112,16 @@ export default { method: "get", params }) + }, + /** + * 获取用户分组group的id和层级信息 + * @returns + */ + getGroupList(params = {}) { + return request({ + url: "system/user/group/list", + method: "get", + params + }) } } diff --git a/cdTMP/src/directives/copy/index.js b/cdTMP/src/directives/copy/index.js index e271b6e..aa3eb7e 100644 --- a/cdTMP/src/directives/copy/index.js +++ b/cdTMP/src/directives/copy/index.js @@ -1,3 +1,4 @@ +// 复制到粘贴板 import useClipboard from "vue-clipboard3" import { Message } from "@arco-design/web-vue" diff --git a/cdTMP/src/layout/hooks/tools.js b/cdTMP/src/layout/hooks/tools.js new file mode 100644 index 0000000..739e816 --- /dev/null +++ b/cdTMP/src/layout/hooks/tools.js @@ -0,0 +1,17 @@ +export function getContextNodeInfo(element) { + const pElement = element.parentElement + if (pElement.dataset.key) { + const title = pElement.querySelector("span.arco-tree-node-title-text").innerText + const isLeaf = pElement.classList.contains("arco-tree-node-is-leaf") + return { + nodekey: pElement.dataset.key, + level: pElement.dataset.level, + title, + isLeaf + } + } else { + if (pElement.parentElement) { + return getContextNodeInfo(pElement) // 易错点,必须返回调用无用 + } + } +} diff --git a/cdTMP/src/layout/project-layout.vue b/cdTMP/src/layout/project-layout.vue index 42d9d8e..3fd719a 100644 --- a/cdTMP/src/layout/project-layout.vue +++ b/cdTMP/src/layout/project-layout.vue @@ -23,6 +23,7 @@ class="h-10/12 select-none my-arco-wrap-class" :data="treeData" size="mini" + showLine checkable block-node draggable @@ -35,7 +36,6 @@ v-model:expanded-keys="expandedKeys" v-model:selected-keys="selectedKeys" v-model:checked-keys="checkedKeys" - showLine ref="treeRef" border @contextmenu="displayRightMenu" @@ -239,6 +239,7 @@ import { useTreeDataStore } from "@/store" import { storeToRefs } from "pinia" import dayjs from "dayjs" import Progress from "@/views/testmanage/projmanage/cpns/progress.vue" +import { getContextNodeInfo } from "@/layout/hooks/tools" // router-view里面组件的ref const routeViewRef = ref() /// 初始化round轮次数据 @@ -783,10 +784,9 @@ const roundRightContainer = ref(null) const problemTitle = ref("第1轮问题单") /// 紧点击测试项节点显示右键菜单 const displayRightMenu = (e) => { - const { proxy } = e.target.__vueParentComponent - const { level, isLeaf, nodekey, title } = proxy + const { nodekey, level, title, isLeaf } = getContextNodeInfo(e.target) // 如果是测试项则弹出【1.根据测试项步骤生成当前测试项用例 2.复制测试项到设计需求】 - if (level === 3) { + if (+level === 3) { e.preventDefault() // 首先将被右键点击的node储存到组件全局 rightClickNode.level = level @@ -797,7 +797,7 @@ const displayRightMenu = (e) => { popupContainer.value = e.target popupVisible.value = true } - if (level === 0) { + if (+level === 0) { // 测试显示下拉框 e.preventDefault() rightClickNode.level = level @@ -1062,4 +1062,7 @@ const problemRoundRef = ref(null) text-overflow: ellipsis; overflow: hidden; } +.chen-node-title { + cursor: help; +} diff --git a/cdTMP/src/views/dashboard/usermanage/index.vue b/cdTMP/src/views/dashboard/usermanage/index.vue index da923e8..4b48036 100644 --- a/cdTMP/src/views/dashboard/usermanage/index.vue +++ b/cdTMP/src/views/dashboard/usermanage/index.vue @@ -1,14 +1,6 @@