8
0
ZaiZai 1 жил өмнө
parent
commit
4707edfb05

+ 97 - 28
src/views/project/modules/list/wbs-tree.vue

@@ -35,19 +35,32 @@
                             />
                         </hc-new-card>
                     </template>
-                    <div :id="`hc_body_top_${uuid}`" class="body-top">
+                    <div class="body-top">
                         <hc-body padding="0px">
                             <hc-new-card title="节点信息">
-                                <hc-table is-new :column="nodeTableColumn" :datas="nodeTableData">
+                                <hc-table is-new :is-index="false" :column="nodeTableColumn" :datas="nodeTableData">
                                     <template #nodeType="{ row }">{{ getDictionaryName(nodeTypelist, row.nodeType, true) }}</template>
                                 </hc-table>
                             </hc-new-card>
                         </hc-body>
                     </div>
-                    <div :id="`hc_body_content_${uuid}`" class="body-content">
+                    <div class="body-content">
                         <hc-body padding="0px">
                             <hc-new-card title="当前项目信息表">
-                                当前项目信息表
+                                <template #extra>
+                                    <el-button hc-btn type="primary" :disabled="infoTableData.length <= 0">编辑</el-button>
+                                    <el-button hc-btn type="success" :disabled="infoTableData.length <= 0">排序</el-button>
+                                </template>
+                                <hc-table v-loading="infoTableLoading" is-new :is-index="false" :column="infoTableColumn" :datas="infoTableData">
+                                    <template #tableType="{ row }">{{ getDictionaryName(tableTypelist, row.tableType, true) }}</template>
+                                    <template #tableOwner="{ row }">{{ getDictionaryName(ownerTypeList, row.tableOwner, true) }}</template>
+                                    <template #action="{ row }">
+                                        <el-link type="primary">预览</el-link>
+                                        <el-link v-if="row.status === 1" type="warning">隐藏表单</el-link>
+                                        <el-link v-if="row.status === 0" type="success">取消隐藏</el-link>
+                                        <el-link type="danger">删除</el-link>
+                                    </template>
+                                </hc-table>
                             </hc-new-card>
                         </hc-body>
                     </div>
@@ -61,8 +74,8 @@
 import { ref, watch } from 'vue'
 import { useAppStore } from '~src/store'
 import { delMessage, getStore, setStore } from 'hc-vue3-ui'
-import { getArrValue, getObjValue, getRandom, isNullES } from 'js-fast-way'
-import { getDictionaryData, setSplit } from '~uti/tools'
+import { getArrValue, getObjValue, isNullES } from 'js-fast-way'
+import { getDictionaryData } from '~uti/tools'
 import mainApi from '~api/project/project'
 import wbsTreeApi from '~api/wbs/tree'
 import wbsPrivateApi from '~api/wbs/private'
@@ -104,7 +117,6 @@ watch(() => [
 watch(isShow, (val) => {
     if (val) {
         getProjectData()
-        setSplitRef()
     } else {
         projectInfo.value = {}
         isType.value = ''
@@ -112,16 +124,6 @@ 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('')
@@ -137,19 +139,55 @@ const getProjectData = () => {
     wbsId.value = projectInfo.value[wbsIds[Number(type) - 1]]
     console.log('info: ', projectInfo.value)
     getNodeTypelist(Number(type) - 1)
+    getTableTypelist(Number(type) - 1)
+    getDataTypelist()
+    getOwnerTypelist()
+    getMajorDataTypeList()
 }
 
 //获取节点类型
 const nodeTypelist = ref([])
 const getNodeTypelist = async (type) => {
+    //计量管理,征拆划分,实验划分,WBS树管理,日志树管理
     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 tableTypelist = ref([])
+const getTableTypelist = async (type) => {
+    //计量管理,征拆划分,实验划分,WBS树管理,日志树管理
+    const types = ['table_type', 'trial_table_type', 'table_type', 'table_type', 'table_type']
+    const data = await getDictionaryData(types[type])
+    tableTypelist.value = getArrValue(data)
+}
+
+//获取数据类型
+const dataTypeList = ref([])
+const getDataTypelist = async () => {
+    const data = await getDictionaryData('data_type')
+    dataTypeList.value = getArrValue(data)
+}
+
+//获取业主类型
+const ownerTypeList = ref([])
+const getOwnerTypelist = async () => {
+    const data = await getDictionaryData('owner_type')
+    ownerTypeList.value = getArrValue(data)
+}
+
+//获取类型字典
+const majorDataTypeList = ref([])
+const getMajorDataTypeList = async () => {
+    const data = await getDictionaryData('major_data_type')
+    majorDataTypeList.value = getArrValue(data)
+}
+
 //获取字典里的数据
 const getDictionaryName = (arr, id, name) => {
-    const item = arr.find((item) => item.value === id)
+    if (isNullES(id)) return name ? '' : {}
+    const item = arr.find((item) => item.value === Number(id))
     return name ? item?.label : getObjValue(item)
 }
 
@@ -229,9 +267,9 @@ const treeLoadNode = async ({ item, level }, resolve) => {
 
 //节点信息
 const nodeTableColumn = ref([
-    { key: 'nodeName', name: '当前节点' },
-    { key: 'nodeType', name: '节点类型' },
-    { key: 'parentName', name: '上级节点' },
+    { key: 'nodeName', name: '当前节点', align: 'center' },
+    { key: 'nodeType', name: '节点类型', align: 'center' },
+    { key: 'parentName', name: '上级节点', align: 'center' },
 ])
 const nodeTableData = ref([])
 
@@ -250,6 +288,7 @@ const treeNodeClick = ({ node, data, keys }) => {
     treeExpandKeys.value = getArrValue(keys)
     //获取节点详情
     getTreeDetail(data.id, parentName)
+    getInfoTableData()
 }
 
 //获取节点详情
@@ -265,6 +304,29 @@ const getTreeDetail = async (id, parentName) => {
     treeInfo.value = res
     nodeTableData.value = [res]
 }
+
+//当前项目信息表
+const infoTableLoading = ref(false)
+const infoTableColumn = ref([
+    { key: 'tableName', name: '表单名称', align: 'center' },
+    { key: 'elementTotal', name: '字段总量', align: 'center' },
+    { key: 'fillRate', name: '填报率', align: 'center' },
+    { key: 'tableType', name: '表单类型', align: 'center' },
+    { key: 'tableOwner', name: '所属方', align: 'center' },
+    { key: 'action', name: '操作', width: 160, align: 'center' },
+])
+const infoTableData = ref([])
+const getInfoTableData = async () => {
+    const { id } = treeItem.value
+    infoTableLoading.value = true
+    const { data } = await wbsPrivateApi.findNodeTableByCondition({
+        parentId: id,
+        wbsId: wbsId.value,
+        projectId: projectInfo.value.id,
+    })
+    infoTableData.value = getArrValue(data)
+    infoTableLoading.value = false
+}
 </script>
 
 <style scoped lang="scss">
@@ -295,15 +357,22 @@ const getTreeDetail = async (id, parentName) => {
 </style>
 
 <style lang="scss">
-.hc-project-wbs-tree .body .hc-page-split-content {
-    position: relative;
-    .body-top {
-        position: relative;
-        height: 166px;
+.hc-project-wbs-tree .body {
+    .el-card.hc-card-box {
+        --el-card-padding: 12px;
+        --el-card-border-radius: 5px;
     }
-    .body-content {
+    .hc-page-split-content {
         position: relative;
-        height: calc(100% - 166px);
+        .body-top {
+            position: relative;
+            height: 119.5px;
+        }
+        .body-content {
+            position: relative;
+            margin-top: 10px;
+            height: calc(100% - 129.5px);
+        }
     }
 }
 </style>