Browse Source

bug修复

iZaiZaiA 2 years ago
parent
commit
3ed7da7275
1 changed files with 44 additions and 6 deletions
  1. 44 6
      src/views/data-fill/division.vue

+ 44 - 6
src/views/data-fill/division.vue

@@ -29,7 +29,9 @@
             </div>
             <div class="project-info">
                 <HcCard title="当前节点工程用表信息">
-                    <HcTable :column="tableProjectColumn" :datas="tableProjectData" :isIndex="false" border/>
+                    <HcTable :column="tableProjectColumn" :datas="tableProjectData" :isIndex="false" border>
+                        <template #tableType="{row}">{{getRowTableType(row['tableType'])}}</template>
+                    </HcTable>
                 </HcCard>
             </div>
             <div class="footer-box">
@@ -277,6 +279,7 @@ onMounted(() => {
     setElTreeMenu()
     getWbsNodeTypeApi()
     getMajorDataTypeApi()
+    getWbsNodeTableTypeApi()
 })
 
 //获取节点类型
@@ -323,16 +326,39 @@ const getRowMajorType = (type) => {
     }
 }
 
+//获取表类型数据
+const nodeTableTypeData = ref([])
+const getWbsNodeTableTypeApi = async () => {
+    const { data } = await getDictionary({
+        code: 'table_type'
+    })
+    nodeTableTypeData.value = getArrValue(data)
+}
+
+//获取表类型
+const getRowTableType = (type) => {
+    if (type > 0) {
+        const nodeData = nodeTableTypeData.value
+        const index = getIndex(nodeData, 'dictKey', type)
+        return nodeData[index]?.dictValue ?? type
+    } else {
+        return ''
+    }
+}
+
+
 //树被点击
 const treeItemInfo = ref({})
 const treeNodeInfo = ref({})
 const wbsElTreeClick = ({node, data, keys}) => {
-    console.log(data)
     treeNodeInfo.value = node
     treeItemInfo.value = data
     tableBasicData.value = [data]
     setStoreData('wbsTreeExpandKeys',keys)
     treeAutoExpandKeys.value = keys || []
+    if (node.level > 1) {
+        searchNodeAllTableApi(data['primaryKeyId'])
+    }
 }
 
 //当前节点基础信息
@@ -344,15 +370,27 @@ const tableBasicColumn = ref([
 ])
 const tableBasicData = ref([])
 
-
 //当前节点工程用表信息
 const tableProjectColumn = ref([
-    {key:'name', name: '工程用表名称'},
-    {key:'startTime', name: '用表类型'},
+    {key:'nodeName', name: '工程用表名称'},
+    {key:'tableType', name: '用表类型'},
     {key:'taskStatusStr', name: '用表单位'},
-    {key:'reportNumber', name: '填报完整率'}
+    {key:'fillRate', name: '填报完整率'}
 ])
 const tableProjectData = ref([])
+//获取数据
+const searchNodeAllTableApi = async (pid) => {
+    const {error, code, data} = await wbsApi.searchNodeAllTable({
+        projectId: projectId.value,
+        contractId: contractId.value,
+        primaryKeyId: pid
+    })
+    if (!error && code === 200) {
+        tableProjectData.value = getArrValue(data)
+    } else {
+        tableProjectData.value = []
+    }
+}
 
 
 //树菜单配置