|
@@ -1,7 +1,7 @@
|
|
|
<template>
|
|
|
<ElTree ref="ElTreeRef" :check-strictly="isStrictly" :data="ElTreeData" :expand-on-click-node="false"
|
|
|
:indent="0" :node-key="nodeKey" :props="ElTreeProps" accordion
|
|
|
- class="hc-tree-node-box hc-tree-node tree-line" highlight-current show-checkbox @check="ElTreeCheckChange">
|
|
|
+ class="hc-tree-node-box hc-tree-node tree-line" highlight-current show-checkbox @check="ElTreeCheckChange" v-loading="isElTreeLoadNode">
|
|
|
<template #default="{ node, data }">
|
|
|
<div class="custom-tree-node">
|
|
|
<div class="label" @dblclick="ElTreeDblClick(data)">
|
|
@@ -31,6 +31,10 @@ const props = defineProps({
|
|
|
type: [String, Number],
|
|
|
default: ''
|
|
|
},
|
|
|
+ contractId:{
|
|
|
+ type: [String, Number],
|
|
|
+ default: ''
|
|
|
+ },
|
|
|
nodeKey: {
|
|
|
type: String,
|
|
|
default: 'primaryKeyId'
|
|
@@ -52,15 +56,19 @@ const props = defineProps({
|
|
|
//变量
|
|
|
const ElTreeRef = ref(null)
|
|
|
const projectId = ref(props.projectId)
|
|
|
+const contractId = ref(props.contractId)
|
|
|
const isStrictly = ref(props.strictly)
|
|
|
const ElTreeProps = ref({label: 'title', children: 'children', isLeaf: 'notExsitChild'})
|
|
|
+const isElTreeLoadNode=ref(false)
|
|
|
|
|
|
//监听
|
|
|
watch(() => [
|
|
|
props.projectId,
|
|
|
props.strictly,
|
|
|
-], ([pid, strictly]) => {
|
|
|
+ props.contractId
|
|
|
+], ([pid, strictly,cid]) => {
|
|
|
projectId.value = pid
|
|
|
+ contractId.value = cid
|
|
|
isStrictly.value = strictly
|
|
|
})
|
|
|
|
|
@@ -75,17 +83,21 @@ const emit = defineEmits(['check-change'])
|
|
|
//树形结构异步加载数据
|
|
|
const ElTreeData = ref([])
|
|
|
const ElTreeLoadNode = async () => {
|
|
|
+ isElTreeLoadNode.value=true
|
|
|
let nodeId = props.oldId || props.nodeId || ''
|
|
|
- const {error, code, data} = await wbsApi.queryWbsTreePrivateByProjectIdAndId({
|
|
|
+ const {error, code, data} = await wbsApi.queryWbsTreeContractByContractIdAndId({
|
|
|
id: nodeId,
|
|
|
- projectId: projectId.value
|
|
|
+ contractId: contractId.value
|
|
|
})
|
|
|
if (!error && code === 200) {
|
|
|
+ isElTreeLoadNode.value=false
|
|
|
ElTreeData.value = getArrValue(data)
|
|
|
await nextTick(() => {
|
|
|
ElTreeCheckedKeys()
|
|
|
})
|
|
|
+
|
|
|
}
|
|
|
+ isElTreeLoadNode.value=false
|
|
|
}
|
|
|
|
|
|
//被选择的
|