|
@@ -14,7 +14,7 @@
|
|
|
<div class="body">
|
|
|
<hc-body split padding="8px">
|
|
|
<template #left>
|
|
|
- <hc-new-card title="工程节点信息" scrollbar class="is-tree">
|
|
|
+ <hc-new-card v-loading="isTreeLoading" title="工程节点信息" scrollbar class="is-tree">
|
|
|
<template #search>
|
|
|
<hc-search-input v-model="searchTree.queryValue" @search="searchTreeClick">
|
|
|
<template #prepend>
|
|
@@ -25,20 +25,26 @@
|
|
|
</template>
|
|
|
</hc-search-input>
|
|
|
</template>
|
|
|
+ <hc-data-tree
|
|
|
+ v-if="isSearchTree" :h-props="treeProps" :datas="treeLoadData" tree-key="id" :auto-expand-keys="treeExpandKeys"
|
|
|
+ :menus="treeMenus" @menu-tap="treeMenuClick" @node-tap="treeNodeClick"
|
|
|
+ />
|
|
|
<hc-lazy-tree
|
|
|
- :h-props="treeProps" tree-key="id" :menus="treeMenus" :auto-expand-keys="treeExpandKeys"
|
|
|
- @load="treeLoadNode" @menu-tap="treeMenuClick" @node-tap="treeNodeClick"
|
|
|
+ v-else :h-props="treeProps" tree-key="id" :auto-expand-keys="treeExpandKeys"
|
|
|
+ :menus="treeMenus" @load="treeLoadNode" @menu-tap="treeMenuClick" @node-tap="treeNodeClick"
|
|
|
/>
|
|
|
</hc-new-card>
|
|
|
</template>
|
|
|
- <div class="body-top">
|
|
|
+ <div :id="`hc_body_top_${uuid}`" class="body-top">
|
|
|
<hc-body padding="0px">
|
|
|
<hc-new-card title="节点信息">
|
|
|
- 节点信息
|
|
|
+ <hc-table is-new :column="nodeTableColumn" :datas="nodeTableData">
|
|
|
+ <template #nodeType="{ row }">{{ getDictionaryName(nodeTypelist, row.nodeType, true) }}</template>
|
|
|
+ </hc-table>
|
|
|
</hc-new-card>
|
|
|
</hc-body>
|
|
|
</div>
|
|
|
- <div class="body-content">
|
|
|
+ <div :id="`hc_body_content_${uuid}`" class="body-content">
|
|
|
<hc-body padding="0px">
|
|
|
<hc-new-card title="当前项目信息表">
|
|
|
当前项目信息表
|
|
@@ -54,9 +60,11 @@
|
|
|
<script setup>
|
|
|
import { ref, watch } from 'vue'
|
|
|
import { useAppStore } from '~src/store'
|
|
|
-import { getArrValue, getObjValue, isNullES } from 'js-fast-way'
|
|
|
-import { delMessage, getStore } from 'hc-vue3-ui'
|
|
|
+import { delMessage, getStore, setStore } from 'hc-vue3-ui'
|
|
|
+import { getArrValue, getObjValue, getRandom, isNullES } from 'js-fast-way'
|
|
|
+import { getDictionaryData, setSplit } from '~uti/tools'
|
|
|
import mainApi from '~api/project/project'
|
|
|
+import wbsTreeApi from '~api/wbs/tree'
|
|
|
import wbsPrivateApi from '~api/wbs/private'
|
|
|
|
|
|
const props = defineProps({
|
|
@@ -96,6 +104,7 @@ watch(() => [
|
|
|
watch(isShow, (val) => {
|
|
|
if (val) {
|
|
|
getProjectData()
|
|
|
+ setSplitRef()
|
|
|
} else {
|
|
|
projectInfo.value = {}
|
|
|
isType.value = ''
|
|
@@ -103,6 +112,16 @@ watch(isShow, (val) => {
|
|
|
}
|
|
|
})
|
|
|
|
|
|
+//初始化设置拖动分割线
|
|
|
+const uuid = getRandom(4)
|
|
|
+const setSplitRef = () => {
|
|
|
+ setSplit(['#hc_body_top_' + uuid, '#hc_body_content_' + uuid], {
|
|
|
+ direction: 'vertical',
|
|
|
+ sizes: [25, 75],
|
|
|
+ snapOffset: 0,
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
//获取项目信息
|
|
|
const typeLable = ref('')
|
|
|
const wbsId = ref('')
|
|
@@ -111,19 +130,50 @@ const getProjectData = () => {
|
|
|
const wbsArr = ['WBS树管理', '实验划分', '计量管理', '日志树管理', '征拆划分']
|
|
|
typeLable.value = wbsArr[Number(type) - 1]
|
|
|
const wbsIds = [
|
|
|
- 'referenceWbsTemplateId', 'referenceWbsTemplateIdTrial', 'referenceWbsTemplateIdMeter',
|
|
|
- 'referenceLogWbsTemplateId', 'referenceWbsTemplateIdLar',
|
|
|
+ 'referenceWbsTemplateId', 'referenceWbsTemplateIdTrial',
|
|
|
+ 'referenceWbsTemplateIdMeter', 'referenceLogWbsTemplateId',
|
|
|
+ 'referenceWbsTemplateIdLar',
|
|
|
]
|
|
|
wbsId.value = projectInfo.value[wbsIds[Number(type) - 1]]
|
|
|
- console.log('type: ', type)
|
|
|
- console.log('wbsId: ', wbsId.value)
|
|
|
console.log('info: ', projectInfo.value)
|
|
|
+ getNodeTypelist(Number(type) - 1)
|
|
|
+}
|
|
|
+
|
|
|
+//获取节点类型
|
|
|
+const nodeTypelist = ref([])
|
|
|
+const getNodeTypelist = async (type) => {
|
|
|
+ const types = ['wbs_node_type', 'trial_node_type', 'meter_node_type', 'wbs_node_type', 'lar_node_type']
|
|
|
+ const data = await getDictionaryData(types[type])
|
|
|
+ nodeTypelist.value = getArrValue(data)
|
|
|
+}
|
|
|
+
|
|
|
+//获取字典里的数据
|
|
|
+const getDictionaryName = (arr, id, name) => {
|
|
|
+ const item = arr.find((item) => item.value === id)
|
|
|
+ return name ? item?.label : getObjValue(item)
|
|
|
}
|
|
|
|
|
|
//树节点搜索
|
|
|
+const isSearchTree = ref(false)
|
|
|
+const isTreeLoading = ref(false)
|
|
|
const searchTree = ref({ queryValue: '', type: '1' })
|
|
|
const searchTreeClick = () => {
|
|
|
+ const { queryValue } = searchTree.value
|
|
|
+ isSearchTree.value = !isNullES(queryValue)
|
|
|
+ getTreeLoadData()
|
|
|
+}
|
|
|
|
|
|
+//获取搜索树的数据
|
|
|
+const treeLoadData = ref([])
|
|
|
+const getTreeLoadData = async () => {
|
|
|
+ isTreeLoading.value = true
|
|
|
+ const { data } = await wbsTreeApi.getQueryValueByType({
|
|
|
+ ...searchTree.value,
|
|
|
+ wbsId: wbsId.value,
|
|
|
+ projectId: projectInfo.value.id,
|
|
|
+ })
|
|
|
+ treeLoadData.value = getArrValue(data)
|
|
|
+ isTreeLoading.value = false
|
|
|
}
|
|
|
|
|
|
//树属性
|
|
@@ -177,9 +227,43 @@ const treeLoadNode = async ({ item, level }, resolve) => {
|
|
|
resolve(getArrValue(data))
|
|
|
}
|
|
|
|
|
|
+//节点信息
|
|
|
+const nodeTableColumn = ref([
|
|
|
+ { key: 'nodeName', name: '当前节点' },
|
|
|
+ { key: 'nodeType', name: '节点类型' },
|
|
|
+ { key: 'parentName', name: '上级节点' },
|
|
|
+])
|
|
|
+const nodeTableData = ref([])
|
|
|
+
|
|
|
//节点被点击
|
|
|
+const treeItem = ref({})
|
|
|
const treeNodeClick = ({ node, data, keys }) => {
|
|
|
+ //获取父节点名称
|
|
|
+ let parentName = ''
|
|
|
+ if (node?.parent?.data) {
|
|
|
+ parentName = node.parent.data.title ?? ''
|
|
|
+ }
|
|
|
+ data.parentName = parentName
|
|
|
+ //设置相关数据
|
|
|
+ treeItem.value = getObjValue(data)
|
|
|
+ setStore('project-wbs-tree-expand-keys', keys)
|
|
|
+ treeExpandKeys.value = getArrValue(keys)
|
|
|
+ //获取节点详情
|
|
|
+ getTreeDetail(data.id, parentName)
|
|
|
+}
|
|
|
|
|
|
+//获取节点详情
|
|
|
+const treeInfo = ref({})
|
|
|
+const getTreeDetail = async (id, parentName) => {
|
|
|
+ const { data } = await wbsPrivateApi.detail({
|
|
|
+ id,
|
|
|
+ wbsId: wbsId.value,
|
|
|
+ projectId: projectInfo.value.id,
|
|
|
+ })
|
|
|
+ const res = getObjValue(data)
|
|
|
+ res.parentName = parentName
|
|
|
+ treeInfo.value = res
|
|
|
+ nodeTableData.value = [res]
|
|
|
}
|
|
|
</script>
|
|
|
|
|
@@ -212,16 +296,14 @@ const treeNodeClick = ({ node, data, keys }) => {
|
|
|
|
|
|
<style lang="scss">
|
|
|
.hc-project-wbs-tree .body .hc-page-split-content {
|
|
|
- display: flex;
|
|
|
- flex-direction: column;
|
|
|
+ position: relative;
|
|
|
.body-top {
|
|
|
position: relative;
|
|
|
- flex: 1;
|
|
|
+ height: 166px;
|
|
|
}
|
|
|
.body-content {
|
|
|
position: relative;
|
|
|
- margin-top: 10px;
|
|
|
- flex: 4;
|
|
|
+ height: calc(100% - 166px);
|
|
|
}
|
|
|
}
|
|
|
</style>
|