|
@@ -1,105 +1,106 @@
|
|
|
<template>
|
|
|
- <ElTree ref="ElTreeRef"
|
|
|
- :class="ui"
|
|
|
- :data="treedata"
|
|
|
- :default-expanded-keys="defaultExpandedCids"
|
|
|
- :indent="0"
|
|
|
- :props="ElTreeProps"
|
|
|
- accordion
|
|
|
- class="hc-tree-node tree-line"
|
|
|
- highlight-current
|
|
|
- node-key="primaryKeyId"
|
|
|
- @node-click="ElTreeClick">
|
|
|
+ <ElTree
|
|
|
+ ref="ElTreeRef"
|
|
|
+ :class="ui"
|
|
|
+ :data="treedata"
|
|
|
+ :default-expanded-keys="defaultExpandedCids"
|
|
|
+ :indent="0"
|
|
|
+ :props="ElTreeProps"
|
|
|
+ accordion
|
|
|
+ class="hc-tree-node tree-line"
|
|
|
+ highlight-current
|
|
|
+ node-key="primaryKeyId"
|
|
|
+ @node-click="ElTreeClick"
|
|
|
+ >
|
|
|
<template #default="{ node, data }">
|
|
|
- <div :id="`${idPrefix}${data['primaryKeyId']}`" class="data-custom-tree-node">
|
|
|
- <div :class="node.level === 1?'level-name':''" class="label">{{ node.label }}</div>
|
|
|
+ <div :id="`${idPrefix}${data.primaryKeyId}`" class="data-custom-tree-node">
|
|
|
+ <div :class="node.level === 1 ? 'level-name' : ''" class="label">{{ node.label }}</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
</ElTree>
|
|
|
-
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
-import {ref, nextTick, watch} from "vue";
|
|
|
-import samplingApi from "~api/tentative/material/sampling"
|
|
|
+import { nextTick, ref, watch } from 'vue'
|
|
|
+import samplingApi from '~api/tentative/material/sampling'
|
|
|
|
|
|
//参数
|
|
|
const props = defineProps({
|
|
|
projectId: {
|
|
|
type: [String, Number],
|
|
|
- default: ''
|
|
|
+ default: '',
|
|
|
},
|
|
|
contractId: {
|
|
|
type: [String, Number],
|
|
|
- default: ''
|
|
|
+ default: '',
|
|
|
},
|
|
|
wbsTempId: {
|
|
|
type: [String, Number],
|
|
|
- default: ''
|
|
|
+ default: '',
|
|
|
},
|
|
|
tenantId: {
|
|
|
type: [String, Number],
|
|
|
- default: ''
|
|
|
+ default: '',
|
|
|
},
|
|
|
wbsType: {
|
|
|
type: [String, Number],
|
|
|
- default: ''
|
|
|
+ default: '',
|
|
|
},
|
|
|
autoExpandKeys: {
|
|
|
type: Array,
|
|
|
- default: () => ([])
|
|
|
+ default: () => ([]),
|
|
|
},
|
|
|
idPrefix: {
|
|
|
type: String,
|
|
|
- default: 'test-tree-'
|
|
|
+ default: 'test-tree-',
|
|
|
},
|
|
|
ui: {
|
|
|
type: String,
|
|
|
- default: ''
|
|
|
+ default: '',
|
|
|
},
|
|
|
fromType: {
|
|
|
type: Boolean,
|
|
|
- default: false
|
|
|
+ default: false,
|
|
|
},
|
|
|
nodeId: {
|
|
|
type: [String, Number],
|
|
|
- default: ''
|
|
|
+ default: '',
|
|
|
},
|
|
|
MixRatioTestTreeData: {
|
|
|
type: Array,
|
|
|
- default: () => ([])
|
|
|
- }
|
|
|
+ default: () => ([]),
|
|
|
+ },
|
|
|
+ entrust: {
|
|
|
+ type: [String, Number],
|
|
|
+ default: '',
|
|
|
+ },
|
|
|
})
|
|
|
|
|
|
+//事件
|
|
|
+const emit = defineEmits(['menuTap', 'nodeTap', 'nodeLoading'])
|
|
|
//变量
|
|
|
const ElTreeRef = ref(null)
|
|
|
const ElTreeProps = ref({
|
|
|
label: 'title',
|
|
|
children: 'children',
|
|
|
- isLeaf: 'hasChildren'
|
|
|
+ isLeaf: 'hasChildren',
|
|
|
})
|
|
|
const TreeExpandKey = ref(props.autoExpandKeys)
|
|
|
-const projectId = ref(props.projectId);
|
|
|
-const contractId = ref(props.contractId);
|
|
|
-const wbsTempId = ref(props.wbsTempId);
|
|
|
-const tenantId = ref(props.tenantId);
|
|
|
-const wbsType = ref(props.wbsType);
|
|
|
-const idPrefix = ref(props.idPrefix);
|
|
|
+const projectId = ref(props.projectId)
|
|
|
+const contractId = ref(props.contractId)
|
|
|
+const wbsTempId = ref(props.wbsTempId)
|
|
|
+const tenantId = ref(props.tenantId)
|
|
|
+const wbsType = ref(props.wbsType)
|
|
|
+const idPrefix = ref(props.idPrefix)
|
|
|
const fromTypedata = ref(props.fromType)
|
|
|
const treedata = ref(props.MixRatioTestTreeData)
|
|
|
+const hideEntrust = ref(props.entrust)
|
|
|
|
|
|
//监听
|
|
|
watch(() => [
|
|
|
- props.autoExpandKeys,
|
|
|
- props.projectId,
|
|
|
- props.contractId,
|
|
|
- props.wbsTempId,
|
|
|
- props.tenantId,
|
|
|
- props.idPrefix,
|
|
|
- props.wbsType,
|
|
|
- props.fromType,
|
|
|
- props.MixRatioTestTreeData
|
|
|
-], ([expandKeys, UserProjectId, UserContractId, UserWbsTempId, UserTenantId, UserIdPrefix, wbs_type, fromType, MixRatioTest_treeData]) => {
|
|
|
+ props.autoExpandKeys, props.projectId, props.contractId, props.wbsTempId, props.tenantId,
|
|
|
+ props.idPrefix, props.wbsType, props.fromType, props.MixRatioTestTreeData, props.entrust,
|
|
|
+], ([expandKeys, UserProjectId, UserContractId, UserWbsTempId, UserTenantId, UserIdPrefix, wbs_type, fromType, MixRatioTest_treeData, entrust]) => {
|
|
|
TreeExpandKey.value = expandKeys
|
|
|
projectId.value = UserProjectId
|
|
|
contractId.value = UserContractId
|
|
@@ -109,11 +110,9 @@ watch(() => [
|
|
|
wbsType.value = wbs_type
|
|
|
fromTypedata.value = fromType
|
|
|
treedata.value = MixRatioTest_treeData
|
|
|
+ hideEntrust.value = entrust
|
|
|
})
|
|
|
|
|
|
-//事件
|
|
|
-const emit = defineEmits(['menuTap', 'nodeTap', 'nodeLoading'])
|
|
|
-
|
|
|
//树形结构异步加载数据
|
|
|
const defaultExpandedCids = ref([])
|
|
|
|
|
@@ -122,7 +121,7 @@ const ElTreeClick = async (data, node) => {
|
|
|
let autoKeysArr = []
|
|
|
await getNodeExpandKeys(node, autoKeysArr)
|
|
|
const autoKeys = autoKeysArr.reverse()
|
|
|
- emit('nodeTap', {node, data, keys: autoKeys})
|
|
|
+ emit('nodeTap', { node, data, keys: autoKeys })
|
|
|
}
|
|
|
|
|
|
//处理自动展开的节点KEY
|