ZaiZai 2 years ago
parent
commit
b9e9f0ecd8

+ 2 - 2
package.json

@@ -20,8 +20,8 @@
         "pinia": "^2.0.18",
         "vue": "^3.2.37",
         "vue-router": "^4.1.3",
-        "vuedraggable": "^4.1.0",
-        "vue-utils-plus": "^0.0.62"
+        "vue-utils-plus": "^0.0.63",
+        "vuedraggable": "^4.1.0"
     },
     "devDependencies": {
         "@vitejs/plugin-vue": "^3.0.1",

+ 10 - 32
src/views/data-fill/components/nodeTree/children.vue

@@ -1,23 +1,18 @@
 <template>
     <div class="cu-tree-node-children">
-        <div class="cu-tree-node-view is-leaf" v-for="item in nodes" :key="item[format.key]">
+        <div class="cu-tree-node-view is-leaf" v-for="item in nodes" :key="item['primaryKeyId']">
             <div class="cu-tree-node-label">
                 <div class="cu-tree-node-label-text">
                     <div class="cu-tree-node-label-name" :id="`node-tree-${item.key}`" @click="nodeLabelClick(item)" @dblclick="nodeLabelDblClick(item)" @contextmenu="nodeLabelContextMenu($event,item)">
-                        <template v-if="TreeIsColor">
-                            <el-button hc-btn color="#0081ff" :loading="item.loading" v-if="item?.colorStatus === 2">{{item.label}}</el-button>
-                            <el-button hc-btn color="#f37b1d" :loading="item.loading" v-else-if="item?.colorStatus === 3">{{item.label}}</el-button>
-                            <el-button type="primary" hc-btn :loading="item.loading" v-else-if="item?.colorStatus === 4">{{item.label}}</el-button>
-                            <el-button type="info" hc-btn :loading="item.loading" v-else>{{item.label}}</el-button>
-                        </template>
-                        <template v-if="!TreeIsColor">
-                            <el-button type="info" hc-btn :loading="item.loading">{{item.label}}</el-button>
-                        </template>
+                        <el-button hc-btn color="#0081ff" :loading="item.loading" v-if="item?.colorStatus === 2">{{item.label}}</el-button>
+                        <el-button hc-btn color="#f37b1d" :loading="item.loading" v-else-if="item?.colorStatus === 3">{{item.label}}</el-button>
+                        <el-button type="primary" hc-btn :loading="item.loading" v-else-if="item?.colorStatus === 4">{{item.label}}</el-button>
+                        <el-button type="info" hc-btn :loading="item.loading" v-else>{{item.label}}</el-button>
                     </div>
                     <span class="cu-tree-node-label-btn" :class="[ifExpanded(item)?'expanded':'']" v-if="isExpanded(item)" @click="expandedClick(item)"/>
                 </div>
             </div>
-            <TreeNodeChildren :data="item.childNodes" :format="format" :menus="menusData" :isMark="menuMark" :parentNodes="item" v-if="ifExpanded(item)" :isColor="TreeIsColor"
+            <TreeNodeChildren :data="item.childNodes" :menus="menusData" :isMark="menuMark" :parentNodes="item" v-if="ifExpanded(item)"
                               @expandClick="ChildrenExpandedClick" @nodeClick="ChildrenNodeLabelClick" @nodeDblClick="ChildrenNodeLabelDblClick" @menuClick="ChildrenCpoverMenuClick"/>
         </div>
     </div>
@@ -31,7 +26,6 @@ import TreeNodeChildren from "./children.vue"
 import {hIconJs} from "~src/plugins/renderele";
 import {isType} from "vue-utils-plus"
 import { NDropdown } from 'naive-ui';
-
 const { isObject, isBoolean } = isType()
 const props = defineProps({
     data: {
@@ -42,14 +36,6 @@ const props = defineProps({
         type: Object,
         default: () => ({})
     },
-    format: {
-        type: Object,
-        default: () => ({
-            key: "key",
-            label: "label",
-            children: "children",
-        })
-    },
     menus: {
         type: Array,
         default: () => ([])
@@ -62,10 +48,6 @@ const props = defineProps({
         type: Boolean,
         default: false
     },
-    isColor: {
-        type: Boolean,
-        default: false
-    },
 })
 
 //初始数据
@@ -74,7 +56,6 @@ const parent = ref(props.parentNodes)
 const menusData = ref(props.menus)
 const menuMark = ref(props.isMark)
 const nodes = ref([])
-const TreeIsColor = ref(props.isColor)
 
 //树的菜单相关变量
 const showDropdown = ref(false)
@@ -88,12 +69,10 @@ watch(() => [
     props.parentNodes,
     props.menus,
     props.isMark,
-    props.isColor,
-], ([val,Nodes,menus,isMark,isColor]) => {
+], ([val,Nodes,menus,isMark]) => {
     datas.value = val
     menusData.value = menus
     menuMark.value = isMark
-    TreeIsColor.value = isColor
     if (isDataType(Nodes)) {
         parent.value = Nodes
         setDatasToNodes()
@@ -124,10 +103,9 @@ const isDataType = (data) => {
 //处理为node节点类型的数据
 const setDatasToNodes = () => {
     let nodesArr = [];
-    const {key,label,children} = props.format
     const deepData = datas.value
     for (let i = 0; i < deepData.length; i++) {
-        let childNodes = deepData[i][children] //子级数据
+        let childNodes = deepData[i]['children'] //子级数据
         let ifChildren = !!(childNodes && childNodes.length > 0);
         nodesArr.push({
             childNodes: childNodes, //子节点原始数据
@@ -139,8 +117,8 @@ const setDatasToNodes = () => {
             isLeaf: deepData[i]['isLeaf'] || false,     //是否为最后一节
             loading: deepData[i]['loading'] || false,   //加载状态
             colorStatus: deepData[i]['colorStatus'] || 1,   //颜色状态
-            key: deepData[i][key],      //节点的key
-            label: deepData[i][label]   //节点显示的名称
+            key: deepData[i]['primaryKeyId'],      //节点的key
+            label: deepData[i]['title']   //节点显示的名称
         })
     }
     nodes.value = nodesArr //渲染使用

+ 141 - 76
src/views/data-fill/components/nodeTree/index.vue

@@ -1,5 +1,5 @@
 <template>
-    <div class="cu-tree-node-container" @mousewheel.prevent="treeNodeMousewheel">
+    <div class="cu-tree-node-container" v-loading="treeNodeLoading" @mousewheel.prevent="treeNodeMousewheel">
         <div class="cu-tree-node-box horizontal collapsable" :id="'tree-node-' + uuid" @mousedown="treeNodeMouseDown" :style="{zoom: zoomRef + '%'}" v-if="!!nodes.label">
             <div class="cu-tree-node-view">
                 <div class="cu-tree-node-label">
@@ -9,33 +9,23 @@
                         </div>
                     </div>
                 </div>
-                <TreeNodeChildren :data="nodes.childNodes" :format="format" :menus="menus" :parentNodes="nodes" :isMark="isMark" :isColor="TreeIsColor"
-                                  @expandClick="expandClick" @nodeClick="nodeLabelClick" @nodeDblClick="nodeLabelDblClick" @menuClick="poverMenuClick"/>
+                <TreeNodeChildren :data="nodes.childNodes" :menus="menus" :parentNodes="nodes" :isMark="menuMark" @expandClick="expandClick" @nodeClick="nodeLabelClick" @nodeDblClick="nodeLabelDblClick" @menuClick="poverMenuClick"/>
             </div>
         </div>
     </div>
 </template>
 
 <script setup>
-import {watch,ref,onMounted} from "vue";
+import {watch,ref,onMounted,nextTick} from "vue";
+import wbsApi from "~api/data-fill/wbs"
 import TreeNodeChildren from "./children.vue";
-import {isType,utilsRandom} from "vue-utils-plus"
+import {isType, utilsArray, utilsRandom} from "vue-utils-plus"
 //初始变量
-const { isObject } = isType()
-const { getRandom } = utilsRandom()
+const {getObjValue,getArrValue} = isType()
+const {getRandom} = utilsRandom()
+const {isItem} = utilsArray()
+//参数
 const props = defineProps({
-    data: {
-        type: Object,
-        default: () => ({})
-    },
-    format: {
-        type: Object,
-        default: () => ({
-            key: "key",
-            label: "label",
-            children: "children",
-        })
-    },
     autoExpandKeys: {
         type: Array,
         default: () => ([])
@@ -52,67 +42,103 @@ const props = defineProps({
         type: Boolean,
         default: false
     },
-    isColor: {
-        type: Boolean,
-        default: false
+    projectId: {
+        type: [String,Number],
+        default: ''
+    },
+    contractId: {
+        type: [String,Number],
+        default: ''
     },
 })
 
 //初始数据
 const uuid = getRandom()
-const datas = ref(props.data)
+const datas = ref({})
 const nodes = ref({})
+const menuMark = ref(props.isMark)
+const projectId = ref(props.projectId);
+const contractId = ref(props.contractId);
 const TreeExpandKey = ref(props.autoExpandKeys)
-const TreeIsColor = ref(props.isColor)
 
 //监听
 watch(() => [
-    props.data,
     props.autoExpandKeys,
-    props.isColor,
-], ([val,expandKeys,isColor]) => {
-    TreeIsColor.value = isColor
-    if (isDataType(val)) {
-        datas.value = val
-        setDatasToNodes()
-    } else {
-        datas.value = {}
-        nodes.value = {}
-    }
+    props.isMark,
+    props.projectId,
+    props.contractId,
+], ([expandKeys, isMark, UserProjectId, UserContractId]) => {
     TreeExpandKey.value = expandKeys
-    if (expandKeys?.length > 0) {
-        setTreeAutoExpandKey()
-    }
+    menuMark.value = isMark
+    projectId.value = UserProjectId
+    contractId.value = UserContractId
 })
 
 //渲染完成
 onMounted(()=> {
-    if (isDataType(props.data)) {
-        datas.value = props.data
-        setDatasToNodes()
-    } else {
-        datas.value = {}
-        nodes.value = {}
-    }
-    if (TreeExpandKey.value?.length > 0) {
-        setTreeAutoExpandKey()
-    }
+    getTreeOneLevel()
 })
 
-//检查数据类型
-const isDataType = (data) => {
-    if (isObject(data)) {
-        return Object.keys(data).length !== 0;
-    } else {
-        return false
+//导图结构树节点查询
+const treeNodeLoading = ref(false)
+const getTreeOneLevel = async () => {
+    treeNodeLoading.value = true
+    const data = await queryMappingStructureTree({
+        contractId: contractId.value,
+        contractIdRelation: '',
+        parentId: '0',
+    })
+    //处理数据
+    const res = getObjValue(data[0])
+    //自动展开第二级
+    const keys = TreeExpandKey.value || []
+    if (keys.length > 0) {
+        const children = await queryMappingStructureTree({
+            contractId: contractId.value,
+            contractIdRelation: res?.contractIdRelation,
+            parentId: res?.contractIdRelation ? res?.primaryKeyId: res?.id,
+        })
+        if (children.length > 0) {
+            await setTreeExpandKey(children, res)
+        }
+    }
+    datas.value = res
+    setDatasToNodes()
+    treeNodeLoading.value = false
+}
+
+//设置自动展开
+const setTreeExpandKey = async (arr,res) => {
+    const keys = TreeExpandKey.value || []
+    res.children = []
+    for (const item of arr) {
+        if (isItem(keys, item?.primaryKeyId)) {
+            const children = await queryMappingStructureTree({
+                contractId: contractId.value,
+                contractIdRelation: item?.contractIdRelation,
+                parentId: item?.contractIdRelation ? item?.primaryKeyId: item?.id,
+            })
+            if (children.length > 0) {
+                await setTreeExpandKey(children, item)
+            }
+        }
+        res.children.push(item)
     }
 }
 
+//获取数据
+const queryMappingStructureTree = async (form) => {
+    const {data} = await wbsApi.queryMappingStructureTree({
+        ...form,
+        wbsType: 1
+    })
+    return getArrValue(data?.data)
+}
+
 //处理为node节点类型的数据
 const setDatasToNodes = () => {
-    const {key,label,children} = props.format
     const deepData = datas.value
-    let childNodes = deepData[children]
+    let childNodes = getArrValue(deepData['children'])
     nodes.value = {
         childNodes: childNodes,
         childrenNodes: [],
@@ -122,25 +148,11 @@ const setDatasToNodes = () => {
         isExpand: deepData['isExpand'] || false,
         isLeaf: deepData['isLeaf'] || false,
         loading: deepData['loading'] || false,
-        key: deepData[key],
-        label: deepData[label]
+        key: deepData['primaryKeyId'] || '',
+        label: deepData['title'] || ''
     }
 }
 
-//懒加载tree,自动展开上次记忆的节点
-const setTreeAutoExpandKey = () => {
-    const keys = TreeExpandKey.value || []
-    let num = 0, numMax = keys.length;
-    let timer = setInterval(() => {
-        if(num < numMax) {
-            document.getElementById(`node-tree-${keys[num]}`)?.click()
-            num++;
-        } else {
-            clearInterval(timer);
-        }
-    }, 800);
-}
-
 //放大缩小
 const zoomRef = ref(100)
 const treeNodeMousewheel = (event) => {
@@ -196,20 +208,73 @@ const treeNodeMouseDown = (event) => {
     }
 }
 
+//处理自动展开的节点KEY
+const getNodeExpandKeys = async (node, newKeys) => {
+    const parent = node?.parentNodes ?? []
+    const primaryKeyId = node?.data?.primaryKeyId ?? ''
+    if (primaryKeyId) {
+        newKeys.push(primaryKeyId)
+        await getNodeExpandKeys(parent, newKeys)
+    }
+}
 
 const emit = defineEmits(['expand', 'nodeClick', 'nodeDblClick','menuClick']);
 
-const expandClick = (item) => {
-    emit('expand', item)
+//导图结构展开和收缩被点击
+const expandClick = ({node,data}) => {
+    if (!node.children) {
+        node.expanded = false;
+    }
+    node.isExpand = !node.isExpand;
+    emit('expand', {node,data})
 }
+
 //鼠标左键单击事件
-const nodeLabelClick = (item) => {
-    emit('nodeClick', item)
+const nodeLabelClick = async ({node,data}) => {
+    if (data?.notExsitChild) {
+        await awaitNodeClick(node,data)
+    } else {
+        let ifChildren = !!(node.childNodes && node.childNodes.length > 0);
+        if (ifChildren) {
+            node.expanded = true;
+            node.isExpand = true;
+            node.loading = false
+            await awaitNodeClick(node,data)
+        } else {
+            const children = await queryMappingStructureTree({
+                contractId: contractId.value,
+                contractIdRelation: data?.contractIdRelation,
+                parentId: data?.contractIdRelation ? data?.primaryKeyId: data?.id,
+            })
+            node.childNodes = children
+            await nextTick(async () => {
+                if (children.length > 0) {
+                    node.expanded = true;
+                    node.isExpand = true;
+                } else {
+                    node.expanded = false;
+                    node.expanded = false;
+                }
+                node.loading = false
+                await awaitNodeClick(node, data)
+            })
+        }
+    }
+}
+
+//处理数据
+const awaitNodeClick = async (node, data) => {
+    let autoKeysArr = []
+    await getNodeExpandKeys(node, autoKeysArr)
+    const autoKeys = autoKeysArr.reverse()
+    emit('nodeClick', {node, data, keys: autoKeys})
 }
+
 //双击事件
 const nodeLabelDblClick = (item) => {
     emit('nodeDblClick', item)
 }
+
 //菜单被点击
 const poverMenuClick = (item) => {
     emit('menuClick', item)

+ 8 - 95
src/views/data-fill/wbs.vue

@@ -4,8 +4,8 @@
             <template #extra>
                 <HcNewSwitch :datas="wbsTypeTab" :keys="wbsTypeTabKey" @change="wbsTypeTabChange"/>
             </template>
-            <NodeTree ref="NodeTreeRef" :data="NodeTreeData" :format="NodeTreeFormat" :autoExpandKeys="TreeAutoExpandKeys" :menus="ElTreeMenu" :isMark="TreeMark" isColor
-                      :accordion='NodeTreeAccordion' @nodeClick="NodeTreeClick" @expand="expandClick" @nodeDblClick="NodeTreeDblClick" @menuClick="NodeTreeMenuClick"/>
+            <NodeTree ref="NodeTreeRef" :autoExpandKeys="TreeAutoExpandKeys" :menus="ElTreeMenu" :isMark="TreeMark" :projectId="projectId" :contractId="contractId"
+                      :accordion='NodeTreeAccordion' @nodeClick="NodeTreeClick" @nodeDblClick="NodeTreeDblClick" @menuClick="NodeTreeMenuClick"/>
             <template #action>
                 <div class="hc-tree-mp-tip-box">
                     <div class="dot-view green">已审批</div>
@@ -85,7 +85,6 @@ import wbsApi from "~api/data-fill/wbs"
 import {deepClone} from "~src/utils/lib/util";
 import {getTokenHeader} from '~src/api/request/header';
 import {isArray,isObjNull} from "~src/utils/lib/isApp";
-//import {setStore,getStore} from "~src/utils/lib/storage";
 import {utilsStore} from "vue-utils-plus"
 import Draggable from "vuedraggable";
 
@@ -174,9 +173,6 @@ onMounted(()=> {
     const contractType = contractInfo.value?.contractType
     setContractType(contractType)
     setElTreeMenu()
-    if (wbsTypeTabKey.value === 'map') {
-        queryMappingStructureTree()
-    }
 })
 
 const setContractType = (contractType) => {
@@ -197,11 +193,6 @@ const wbsTypeTabChange = async (item) => {
             type: item?.key
         }
     })
-    await nextTick(() => {
-        if (item?.key === 'map') {
-            queryMappingStructureTree()
-        }
-    })
 }
 
 const NodeTreeAccordion = ref(true)
@@ -245,69 +236,17 @@ const treeParams = ref({contractId: contractId.value})
 const wbsElTreeClick = ({node, data, keys}) => {
     nodeItemInfo.value = node
     nodeDataInfo.value = data
-    console.log(keys)
     setStoreData('wbsTreeExpandKeys',keys)
     searchNodeAllTable()
 }
 
-
 //导图结构数据
 const NodeTreeRef = ref(null)
-const NodeTreeFormat = ref({key: "primaryKeyId", label: "title", children: "children"})
-const NodeTreeData = ref({})
-
-//导图结构树节点查询
-const queryMappingStructureTree = () => {
-    wbsApi.queryMappingStructureTree({
-        contractId: contractId.value,
-        contractIdRelation: '',
-        parentId: '0',
-        wbsType: 1
-    }).then(({data}) => {
-        NodeTreeData.value = data?.data[0] || {}
-    })
-}
-
-//导图结构展开和收缩被点击
-const expandClick = ({node,data}) => {
-    if (!node.children) {
-        node.expanded = false;
-    }
-    node.isExpand = !node.isExpand;
-}
 
 //鼠标左键单击事件
-const NodeTreeClick = ({node,data}) => {
-    let ifChildren = !!(node.childNodes && node.childNodes.length > 0);
-    if (!ifChildren) {
-        node.loading = true
-        const cid = data?.contractIdRelation
-        const key = data?.primaryKeyId
-        const id = data?.id
-        wbsApi.queryMappingStructureTree({
-            contractId: contractId.value,
-            contractIdRelation: cid,
-            parentId: cid?key:id,
-            wbsType: 1
-        }).then((res) => {
-            const resData = res?.data?.data || []
-            node.childNodes = resData
-            nextTick(() => {
-                if (resData.length > 0) {
-                    node.expanded = true;
-                    node.isExpand = true;
-                } else {
-                    node.expanded = false;
-                    node.expanded = false;
-                }
-                node.loading = false
-            })
-        })
-    } else {
-        node.expanded = true;
-        node.isExpand = true;
-        node.loading = false
-    }
+const NodeTreeClick = ({node,data,keys}) => {
+    console.log(keys)
+    setStoreData('wbsTreeExpandKeys',keys)
 }
 
 //双击事件
@@ -324,7 +263,8 @@ const firstItemModal = ref(false)
 const editNodeModal = ref(false)
 const nodeItemInfo = ref({})
 const nodeDataInfo = ref({})
-const treeExpandKeys = ref([])
+
+//树菜单被点击
 const ElTreeMenuClick = async ({key,node,data}) => {
     nodeItemInfo.value = node
     nodeDataInfo.value = data
@@ -366,34 +306,7 @@ const ElTreeMenuClick = async ({key,node,data}) => {
     }
 }
 
-const NodeExpandKeys = async (wbsTab = false) => {
-    let newKeysArr = [], node = nodeItemInfo.value || {}
-    await getNodeExpandKeys(node,newKeysArr,wbsTab)
-    const treeKeys = newKeysArr.reverse()
-    await setStore({name: 'wbsTreeExpandKeys', content: treeKeys})
-    return treeKeys
-}
-
-//处理自动展开的节点KEY
-const getNodeExpandKeys = async (node, newKeys, wbsTab = false) => {
-    const tabType = wbsTypeTabKey.value || ''
-    const primaryKeyId = node?.data?.primaryKeyId || ''
-    if (primaryKeyId) {
-        const nodes = node?.parentNodes || []
-        const parent = node?.parent || []
-        newKeys.push(primaryKeyId)
-        if (tabType === 'map' && !wbsTab) {
-            await getNodeExpandKeys(nodes, newKeys,wbsTab)
-        } else if (tabType === 'tree' && !wbsTab) {
-            await getNodeExpandKeys(parent, newKeys,wbsTab)
-        } else if (tabType === 'map' && wbsTab) {
-            await getNodeExpandKeys(parent, newKeys,wbsTab)
-        } else if (tabType === 'tree' && wbsTab) {
-            await getNodeExpandKeys(nodes, newKeys,wbsTab)
-        }
-    }
-}
-
+//导图树菜单被点击
 const NodeTreeMenuClick = async ({key,node,data}) => {
     nodeItemInfo.value = node
     nodeDataInfo.value = data

+ 52 - 54
src/views/test/index.vue

@@ -1,69 +1,67 @@
 <template>
-    <n-divider dashed title-placement="left">测试</n-divider>
-    <n-card title="测试" :segmented="{content: true}">
-        <template #header>
-            <div class="hc-card-header flex items-center">
-                <div class="w-60 ml-3">
-                    <n-input v-model:value="pkeyId" type="text" placeholder="请输入关键词" clearable/>
-                </div>
-                <n-button type="primary" secondary class="ml-6" @click="getExcelHtml">渲染数据</n-button>
-            </div>
-        </template>
-        <div id="table-form-111"></div>
-    </n-card>
+    <div>
+        测试
+    </div>
 </template>
 
 <script setup>
-import {ref} from "vue";
+import {ref,onMounted} from "vue";
 import wbsApi from "~api/data-fill/wbs"
-import {ElDatePicker, ElInput} from "element-plus";
-import {createApp} from "vue/dist/vue.esm-bundler.js";
-import {isString} from "~src/utils/lib/isApp";
+import {isType, utilsArray} from "vue-utils-plus"
+const {getObjValue,getArrValue} = isType()
+const { isItem } = utilsArray()
 
-const pkeyId = ref('1545302418059690520')
+const contractId = '1538759610948120577'
+const keys = ['1551394315475877907', '1551394315480072251', '1551394315475877982', '1551394315480072305', '1557182703722299392', '1557182703722299393']
 
-const getExcelHtml = () => {
-    if (pkeyId.value) {
-        wbsApi.getExcelHtml({
-            pkeyId: pkeyId.value + ''
-        }).then(({data}) => {
-            const res = isString(data.data)?data.data:''
-            if (res) {
-                HTableForm(res)
-            } else {
-                window?.$message?.warning('清表内容是空的')
-            }
-        })
-    } else {
-        window?.$message?.warning('pkeyId为空')
+onMounted(() => {
+    getTreeOneLevel()
+})
+
+//首个获取
+const getTreeOneLevel = async () => {
+    const data = await queryMappingStructureTree({
+        contractId: contractId,
+        contractIdRelation: '',
+        parentId: '0',
+    })
+    const res = getObjValue(data[0])
+    //自动展开第二级
+    const children = await queryMappingStructureTree({
+        contractId: contractId,
+        contractIdRelation: res?.contractIdRelation,
+        parentId: res?.contractIdRelation ? res?.primaryKeyId: res?.id,
+    })
+    if (children.length > 0) {
+        await setTreeExpandKey(children, res)
     }
+    console.log(res)
 }
 
-//渲染表格表单
-const HTableForm = (templateData) => {
-    const app = createApp({
-        data() {
-            return {
-                formData: {},
+//设置自动展开
+const setTreeExpandKey = async (arr,res) => {
+    res.children = []
+    for (const item of arr) {
+        if (isItem(keys, item?.primaryKeyId)) {
+            const children = await queryMappingStructureTree({
+                contractId: contractId,
+                contractIdRelation: item?.contractIdRelation,
+                parentId: item?.contractIdRelation ? item?.primaryKeyId: item?.id,
+            })
+            if (children.length > 0) {
+                await setTreeExpandKey(children, item)
             }
-        },
-        template: templateData,
-        components: {ElInput,ElDatePicker},
-        methods: {
-            RightClick(a,b,c,d,e,f,event) {
-                console.log('鼠标右键事件',event)
-            },
-            getInformation(a,b,c) {
-                console.log('焦点事件')
-            },
         }
-    })
-    app.mount('#table-form-111')
+        res.children.push(item)
+    }
 }
 
+//获取数据
+const queryMappingStructureTree = async (form) => {
+    const {data} = await wbsApi.queryMappingStructureTree({
+        ...form,
+        wbsType: 1
+    })
+    return getArrValue(data?.data)
+}
 </script>
-
-<style lang="scss" scoped>
-
-</style>
-

+ 4 - 4
yarn.lock

@@ -1355,10 +1355,10 @@ vue-router@^4.1.3:
   dependencies:
     "@vue/devtools-api" "^6.1.4"
 
-vue-utils-plus@^0.0.62:
-  version "0.0.62"
-  resolved "https://registry.yarnpkg.com/vue-utils-plus/-/vue-utils-plus-0.0.62.tgz#e08b6652dc96be495552b702ccd2cbee5445a7d1"
-  integrity sha512-Q27F8fywdXVn4CszwKksMzXXEmQu+Uq0O+6cd9SfttpzuO9wU2hrO7MABP8Ibe+FXqfn9Q9xHi8gChEdrEW2vw==
+vue-utils-plus@^0.0.63:
+  version "0.0.63"
+  resolved "https://registry.yarnpkg.com/vue-utils-plus/-/vue-utils-plus-0.0.63.tgz#e3bb0bd6ba41a893d9f02a8db8c7c203a51c0ebf"
+  integrity sha512-R9r8q44O3Ij+MouapUDHl6ZfH4TJZDfAd63GJ96oiHaYq77Pbc9DzEqm1IcK4jQ/b//siyOaW2JIrXYpxod/NQ==
 
 vue@^3.2.37:
   version "3.2.37"