|
@@ -12,8 +12,7 @@
|
|
|
</div>
|
|
|
<div class="hc-tree-box">
|
|
|
<el-scrollbar>
|
|
|
- <WbsTree :autoExpandKeys="treeAutoExpandKeys" :classifyType="classifyType" :contractId="contractId"
|
|
|
- :projectId="projectId" isColor @nodeTap="wbsElTreeClick"/>
|
|
|
+ <HcLazyTree :autoExpandKeys="treeAutoExpandKeys" isType @load="treeLoadNode" @nodeTap="wbsElTreeClick"/>
|
|
|
</el-scrollbar>
|
|
|
</div>
|
|
|
<!--左右拖动-->
|
|
@@ -84,7 +83,8 @@
|
|
|
<script setup>
|
|
|
import {ref, watch, onMounted} from "vue";
|
|
|
import {useAppStore} from "~src/store";
|
|
|
-import WbsTree from "../../data-fill/components/WbsTree.vue"
|
|
|
+import queryApi from '~api/data-fill/query';
|
|
|
+import {getArrValue, getObjValue} from "js-fast-way";
|
|
|
import {getStoreValue, setStoreValue} from '~src/utils/storage'
|
|
|
|
|
|
//变量
|
|
@@ -122,6 +122,26 @@ const primaryKeyId = ref('')
|
|
|
const nodeItemInfo = ref({})
|
|
|
const nodeDataInfo = ref({})
|
|
|
|
|
|
+//懒加载的数据
|
|
|
+const treeLoadNode = async ({node, item, level},resolve) => {
|
|
|
+ let contractIdRelation = '', parentId = '', primaryKeyId = '';
|
|
|
+ if (level !== 0) {
|
|
|
+ const nodeData = getObjValue(item);
|
|
|
+ contractIdRelation = nodeData?.contractIdRelation || ''
|
|
|
+ parentId = contractIdRelation ? nodeData?.primaryKeyId : nodeData?.id
|
|
|
+ primaryKeyId = nodeData?.id || ''
|
|
|
+ }
|
|
|
+ //获取数据
|
|
|
+ const {data} = await queryApi.queryWbsTreeData({
|
|
|
+ contractId: contractId.value || '',
|
|
|
+ contractIdRelation,
|
|
|
+ primaryKeyId,
|
|
|
+ parentId,
|
|
|
+ classifyType: classifyType.value
|
|
|
+ })
|
|
|
+ resolve(getArrValue(data))
|
|
|
+}
|
|
|
+
|
|
|
//树被点击
|
|
|
const wbsElTreeClick = ({node, data, keys}) => {
|
|
|
nodeItemInfo.value = node
|