Prechádzať zdrojové kódy

节点导入接口调用

duy 5 mesiacov pred
rodič
commit
ba06576398
2 zmenil súbory, kde vykonal 216 pridanie a 198 odobranie
  1. 190 179
      src/api/modules/data-fill/wbs.js
  2. 26 19
      src/views/data-fill/division.vue

+ 190 - 179
src/api/modules/data-fill/wbs.js

@@ -1,22 +1,22 @@
-import { HcApi } from "../../request/index";
-import { getHeader } from "hc-vue3-ui";
+import { HcApi } from '../../request/index'
+import { getHeader } from 'hc-vue3-ui'
 
 export default {
     //新增或删除 合同段划分树首件关联
     async wbsTreeFirstSave(form) {
         return HcApi({
-            url: "/api/blade-business/treeContractFirst/saveOrDelete",
-            method: "post",
+            url: '/api/blade-business/treeContractFirst/saveOrDelete',
+            method: 'post',
             params: form,
-        });
+        })
     },
     //修改树节点
     async wbsTreeUpdateNode(form) {
         return HcApi({
-            url: "/api/blade-business/informationWriteQuery/updateContractNodeParameter",
-            method: "post",
+            url: '/api/blade-business/informationWriteQuery/updateContractNodeParameter',
+            method: 'post',
             params: form,
-        });
+        })
     },
     //导图结构树节点查询
     // async queryMappingStructureTree(form) {
@@ -28,453 +28,464 @@ export default {
     // },
     async queryMappingStructureTree(form) {
         return HcApi({
-            url: "/api/blade-user/wbs/lazyQueryContractWbsTree",
-            method: "get",
+            url: '/api/blade-user/wbs/lazyQueryContractWbsTree',
+            method: 'get',
             params: form,
-        });
+        })
     },
     //保存或修改节点上传的图纸记录
     async saveContractTreeDrawings(form) {
         return HcApi({
-            url: "/api/blade-business/contractTreeDrawings/saveContractTreeDrawings",
-            method: "post",
+            url: '/api/blade-business/contractTreeDrawings/saveContractTreeDrawings',
+            method: 'post',
             params: form,
-        });
+        })
     },
     //删除节点
     async removeContractTreeNode(form) {
         return HcApi({
-            url: "/api/blade-business/informationWriteQuery/removeContractTreeNode",
-            method: "post",
+            url: '/api/blade-business/informationWriteQuery/removeContractTreeNode',
+            method: 'post',
             params: form,
-        });
+        })
     },
     //查询当前节点下所有元素表信息
     async searchNodeAllTable(form) {
         return HcApi({
-            url: "/api/blade-manager/wbsTreeContract/search-node-tables",
-            method: "get",
+            url: '/api/blade-manager/wbsTreeContract/search-node-tables',
+            method: 'get',
             params: form,
-        });
+        })
     },
     //清表生成html
     async getExcelHtml(form) {
         return HcApi({
-            url: "/api/blade-manager/exceltab/get-excel-html_buss",
-            method: "get",
+            url: '/api/blade-manager/exceltab/get-excel-html_buss',
+            method: 'get',
             params: form,
-        });
+        })
     },
     //获取按键切换输入框的key列表
     async getHtmlBussCols(form) {
         return HcApi({
-            url: "/api/blade-manager/exceltab/get-html-buss-cols",
-            method: "get",
+            url: '/api/blade-manager/exceltab/get-html-buss-cols',
+            method: 'get',
             params: form,
-        });
+        })
     },
     //填报页面数据保存
     async saveExcelBussData(form) {
         return HcApi({
-            url: "/api/blade-manager/exceltab/save_buss_data",
-            method: "post",
+            url: '/api/blade-manager/exceltab/save_buss_data',
+            method: 'post',
             data: form,
-        });
+        })
     },
     //懒加载项目级工程划分树
     async queryWbsTreePrivateByProjectIdAndId(form) {
         return HcApi({
-            url: "/api/blade-business/informationWriteQuery/queryWbsTreePrivateByProjectIdAndId",
-            method: "post",
+            url: '/api/blade-business/informationWriteQuery/queryWbsTreePrivateByProjectIdAndId',
+            method: 'post',
             params: form,
-        });
+        })
     },
     async queryWbsTreeContractByContractIdAndId(form) {
         return HcApi({
-            url: "/api/blade-manager/contractInfo/add-node-tree",
-            method: "get",
+            url: '/api/blade-manager/contractInfo/add-node-tree',
+            method: 'get',
             params: form,
-        });
+        })
     },
     //新增自定义节点项目全加载树
     async queryPriateTree(form) {
         return HcApi({
-            url: "/api/blade-user/wbs/private/tree",
-            method: "get",
+            url: '/api/blade-user/wbs/private/tree',
+            method: 'get',
             params: form,
-        });
+        })
     },
     //新增节点及其子节点
     async saveContractTreeNode(form) {
         return HcApi({
-            url: "/api/blade-business/informationWriteQuery/saveContractTreeNode",
-            method: "post",
+            url: '/api/blade-business/informationWriteQuery/saveContractTreeNode',
+            method: 'post',
             data: form,
-        });
+        })
     },
     //新增自定义节点
     async saveCustomAddContractNode(form) {
         return HcApi({
-            url: "/api/blade-business/informationWriteQuery/customAddContractNode",
-            method: "post",
+            url: '/api/blade-business/informationWriteQuery/customAddContractNode',
+            method: 'post',
             data: form,
-        });
+        })
     },
     //复制节点
     async copyContractTreeNode(form) {
         return HcApi({
-            url: "/api/blade-business/informationWriteQuery/copyContractTreeNode",
-            method: "post",
+            url: '/api/blade-business/informationWriteQuery/copyContractTreeNode',
+            method: 'post',
             data: form,
-        });
+        })
     },
     //自定义排序
     async diySortTreeNode(form) {
         return HcApi({
-            url: "/api/blade-business/informationWriteQuery/diySort",
-            method: "post",
+            url: '/api/blade-business/informationWriteQuery/diySort',
+            method: 'post',
             data: form,
-        });
+        })
     },
     //获取表单数据
     async getBussDataInfo(form) {
         return HcApi({
-            url: "/api/blade-manager/exceltab/get-buss-dataInfo",
-            method: "get",
+            url: '/api/blade-manager/exceltab/get-buss-dataInfo',
+            method: 'get',
             params: form,
-        });
+        })
     },
     //查询节点状态
     async queryNodeStatus(form) {
         return HcApi({
-            url: "/api/blade-business/informationWriteQuery/queryNodeStatus",
-            method: "post",
+            url: '/api/blade-business/informationWriteQuery/queryNodeStatus',
+            method: 'post',
             params: form,
-        });
+        })
     },
     //查询监理节点状态
     async queryNodeStatusJl(form) {
         return HcApi({
-            url: "/api/blade-business/informationWriteQuery/queryNodeStatus-jl",
-            method: "post",
+            url: '/api/blade-business/informationWriteQuery/queryNodeStatus-jl',
+            method: 'post',
             params: form,
-        });
+        })
     },
     //查询首件节点状态
     async queryNodeStatusSj(form) {
         return HcApi({
-            url: "/api/blade-business/informationWriteQuery/queryNodeStatus-sj",
-            method: "post",
+            url: '/api/blade-business/informationWriteQuery/queryNodeStatus-sj',
+            method: 'post',
             params: form,
-        });
+        })
     },
     //查询试验上报按钮状态
     async queryNodeStatusTrial(form) {
         return HcApi({
-            url: "/api/blade-business/informationWriteQuery/queryNodeStatus-trial",
-            method: "post",
+            url: '/api/blade-business/informationWriteQuery/queryNodeStatus-trial',
+            method: 'post',
             params: form,
-        });
+        })
     },
     //单个废除
     async abolishOne(form) {
         return HcApi({
-            url: "/api/blade-business/informationWriteQuery/abolishOne",
-            method: "post",
+            url: '/api/blade-business/informationWriteQuery/abolishOne',
+            method: 'post',
             params: form,
-        });
+        })
     },
 
     //单个废除-首件
     async abolishOneSJ(form) {
         return HcApi({
-            url: "/api/blade-business/informationWriteQuery/abolishOne-sj",
-            method: "post",
+            url: '/api/blade-business/informationWriteQuery/abolishOne-sj',
+            method: 'post',
             params: form,
-        });
+        })
     },
 
     //隐藏表单
     async showBussTab(form) {
         return HcApi({
-            url: "/api/blade-manager/exceltab/show-buss-tab",
-            method: "get",
+            url: '/api/blade-manager/exceltab/show-buss-tab',
+            method: 'get',
             params: form,
-        });
+        })
     },
     //单表pdf预览
     async getBussPdfInfo(form) {
         return HcApi({
-            url: "/api/blade-manager/exceltab/get-buss-pdfInfo",
-            method: "get",
+            url: '/api/blade-manager/exceltab/get-buss-pdfInfo',
+            method: 'get',
             params: form,
-        });
+        })
     },
     //表单复制
     async copeBussTab(form) {
         return HcApi({
-            url: "/api/blade-manager/exceltab/cope-buss-tab",
-            method: "get",
+            url: '/api/blade-manager/exceltab/cope-buss-tab',
+            method: 'get',
             params: form,
-        });
+        })
     },
     //多表预览
     async getBussPdfs(form) {
         return HcApi({
-            url: "/api/blade-manager/exceltab/get-buss-pdfs",
-            method: "get",
+            url: '/api/blade-manager/exceltab/get-buss-pdfs',
+            method: 'get',
             params: form,
-        });
+        })
     },
     //获取附件列表
     async getBussFileList(form) {
         return HcApi({
-            url: "/api/blade-manager/tablefile/get-buss-fileList",
-            method: "get",
+            url: '/api/blade-manager/tablefile/get-buss-fileList',
+            method: 'get',
             params: form,
-        });
+        })
     },
     //获取附件添加列表
     async selectTableFileListByTen(form) {
         return HcApi({
-            url: "/api/blade-manager/tablefile/selectTableFileListByTen",
-            method: "get",
+            url: '/api/blade-manager/tablefile/selectTableFileListByTen',
+            method: 'get',
             params: form,
-        });
+        })
     },
     //逻辑附件添加
     async delTabById(form) {
         return HcApi({
-            url: "/api/blade-manager/tablefile/delTabById",
-            method: "post",
+            url: '/api/blade-manager/tablefile/delTabById',
+            method: 'post',
             params: form,
-        });
+        })
     },
     async getBussFileList1(form) {
         return HcApi({
-            url: "/api/blade-business/detection/self/file-list",
-            method: "get",
+            url: '/api/blade-business/detection/self/file-list',
+            method: 'get',
             params: form,
-        });
+        })
     },
     //逻辑删除
     async removeBussFile(form) {
         return HcApi({
-            url: "/api/blade-manager/tablefile/remove",
-            method: "post",
+            url: '/api/blade-manager/tablefile/remove',
+            method: 'post',
             params: form,
-        });
+        })
     },
     //删除试验文件
     async removeBussFile1(form) {
         return HcApi({
-            url: "/api/blade-manager/tablefile/remove-trial",
-            method: "post",
+            url: '/api/blade-manager/tablefile/remove-trial',
+            method: 'post',
             params: form,
-        });
+        })
     },
     //用户端删除复制信息表
     async removeBussTabInfo(form) {
         return HcApi({
-            url: "/api/blade-manager/exceltab/remove-buss-tabInfo",
-            method: "post",
+            url: '/api/blade-manager/exceltab/remove-buss-tabInfo',
+            method: 'post',
             params: form,
-        });
+        })
     },
     //复制节点填报数据
     async copyContractNodeSubmitBusinessData(form) {
         return HcApi({
-            url: "/api/blade-business/informationWriteQuery/copyContractNodeSubmitBusinessData",
-            method: "post",
+            url: '/api/blade-business/informationWriteQuery/copyContractNodeSubmitBusinessData',
+            method: 'post',
             data: form,
-        });
+        })
     },
     //输入框查询合同段树
     async searchContractTree(form) {
         return HcApi({
-            url: "/api/blade-business/informationWriteQuery/searchContractTree",
-            method: "get",
+            url: '/api/blade-business/informationWriteQuery/searchContractTree',
+            method: 'get',
             params: form,
-        });
+        })
     },
     //设计值计算
     async queryFormulaRange(form) {
         return HcApi({
-            url: "/api/blade-manager/formula/range",
-            method: "get",
+            url: '/api/blade-manager/formula/range',
+            method: 'get',
             params: form,
-        });
+        })
     },
     //获取文件题名
     async queryDocumentTitle(form) {
         return HcApi({
-            url: "/api/blade-business/informationWriteQuery/queryDocumentTitle",
-            method: "get",
+            url: '/api/blade-business/informationWriteQuery/queryDocumentTitle',
+            method: 'get',
             params: form,
-        });
+        })
     },
     //查询公式参数面板
     async queryPanel(form) {
         return HcApi({
-            url: "/api/blade-manager/formula/panel",
-            method: "get",
+            url: '/api/blade-manager/formula/panel',
+            method: 'get',
             params: form,
-        });
+        })
     },
     //保存公式参数
 
     async savePanel(form) {
         return HcApi({
-            url: "/api/blade-manager/formula/panel-save",
-            method: "post",
+            url: '/api/blade-manager/formula/panel-save',
+            method: 'post',
             data: form,
-        });
+        })
     },
     //同步质检资料
     async syncTbadata(form) {
         return HcApi({
-            url: "/api/blade-manager/wbsTreeContract/sync-tab-data",
-            method: "post",
+            url: '/api/blade-manager/wbsTreeContract/sync-tab-data',
+            method: 'post',
             params: form,
-        });
+        })
     },
     //同步工序资料
     async syncWorkDate(form) {
         return HcApi({
-            url: "/api/blade-manager/formula/syncWorkDate",
-            method: "get",
+            url: '/api/blade-manager/formula/syncWorkDate',
+            method: 'get',
             params: form,
-        });
+        })
     },
     //获取表单详情
     async getWbsContractById(form) {
         return HcApi({
-            url: "/api/blade-manager/wbsTreeContract/getWbsContractById",
-            method: "post",
+            url: '/api/blade-manager/wbsTreeContract/getWbsContractById',
+            method: 'post',
             params: form,
-        });
+        })
     },
     //查询当前节点下所有表的附件信息
     async tablesAndFile(form) {
         return HcApi({
-            url: "/api/blade-manager/wbsTreeContract/search-node-tablesAndFile",
-            method: "get",
+            url: '/api/blade-manager/wbsTreeContract/search-node-tablesAndFile',
+            method: 'get',
             params: form,
-        });
+        })
     },
     //清除表单信息
     async rmTabdataInfo(form) {
         return HcApi({
-            url: "/api/blade-manager/exceltab/rm-tabdata-info",
-            method: "get",
+            url: '/api/blade-manager/exceltab/rm-tabdata-info',
+            method: 'get',
             params: form,
-        });
+        })
     },
     //下载模板
     async downloadExcel(form) {
         return HcApi({
-            url: "/api/blade-manager/wbsTreeContract/download-excel",
-            method: "get",
-            responseType: "blob",
+            url: '/api/blade-manager/wbsTreeContract/download-excel',
+            method: 'get',
+            responseType: 'blob',
             params: form,
-        });
+        })
     },
     //导入模板
     async importExcel(form) {
         return HcApi({
-            url: "/api/blade-manager/wbsTreeContract/import-excel",
-            method: "post",
+            url: '/api/blade-manager/wbsTreeContract/import-excel',
+            method: 'post',
             data: form,
-        });
+        })
     },
     //计算含水率
     async calculateWater(form) {
         return HcApi({
-            url: "/api/blade-manager/mixProportion/calculateWater",
-            method: "post",
+            url: '/api/blade-manager/mixProportion/calculateWater',
+            method: 'post',
             data: form,
-        });
+        })
     },
 
     //批量保存
     async save_nodeId(form) {
         return HcApi({
-            url: "/api/blade-manager/exceltab/save_nodeId",
-            method: "post",
+            url: '/api/blade-manager/exceltab/save_nodeId',
+            method: 'post',
             params: form,
-        });
+        })
     },
     //批量隐藏节点
     async updateNodeStates(form) {
         return HcApi({
-            url: "/api/blade-manager/wbsTreeContract/updateNodeStates",
-            method: "post",
+            url: '/api/blade-manager/wbsTreeContract/updateNodeStates',
+            method: 'post',
             params: form,
-        });
+        })
     },
     //获取图纸
     async getTreeDrawings(form) {
         return HcApi({
-            url: "/api/blade-business/contractTreeDrawings/getTreeDrawings",
-            method: "get",
+            url: '/api/blade-business/contractTreeDrawings/getTreeDrawings',
+            method: 'get',
             params: form,
-        });
+        })
     },
     //保存用户填报历史
     async saveUserHistory(form) {
         return HcApi({
-            url: "/api/blade-manager/userHistory/saveUserHistory",
-            method: "post",
+            url: '/api/blade-manager/userHistory/saveUserHistory',
+            method: 'post',
             data: form,
-        });
+        })
     },
     //回到上次填报历史
     async getUserHistory(form) {
         return HcApi({
-            url: "/api/blade-manager/userHistory/getUserHistory",
-            method: "get",
+            url: '/api/blade-manager/userHistory/getUserHistory',
+            method: 'get',
             params: form,
-        });
+        })
     },
     //评定汇总
     async evaluateTotal(form) {
         return HcApi({
-            url: "/api/blade-manager/formula/evaluate",
-            method: "get",
+            url: '/api/blade-manager/formula/evaluate',
+            method: 'get',
             params: form,
-        });
+        })
     },
     async evaluateTotalNew(form) {
         return HcApi({
-            url: "/api/blade-manager/formula/newEvaluate",
-            method: "get",
+            url: '/api/blade-manager/formula/newEvaluate',
+            method: 'get',
             params: form,
-        });
+        })
     },
     async evaluateIsWater(form) {
         return HcApi({
-            url: "/api/blade-manager/formula/isWaterProject",
-            method: "get",
+            url: '/api/blade-manager/formula/isWaterProject',
+            method: 'get',
             params: form,
-        });
+        })
     },
     //排序
     async formTableSort(form) {
         return HcApi({
-            url: "/api/blade-manager/wbsTreeContract/table-sort",
-            method: "post",
+            url: '/api/blade-manager/wbsTreeContract/table-sort',
+            method: 'post',
             data: form,
-        });
+        })
     },
     //删除节点前
     async removeContractTreeNodeJudge(form) {
         return HcApi(
             {
-                url: "/api/blade-business/informationWriteQuery/removeContractTreeNodeJudge",
-                method: "post",
+                url: '/api/blade-business/informationWriteQuery/removeContractTreeNodeJudge',
+                method: 'post',
                 params: form,
             },
-            false
-        );
+            false,
+        )
     },
-};
+    //节点导入
+    async importTree(form) {
+        return HcApi(
+            {
+                url: '/api/blade-business/informationWriteQuery/importTree',
+                method: 'post',
+                data: form,
+            },
+            false,
+        )
+    },
+}

+ 26 - 19
src/views/data-fill/division.vue

@@ -41,7 +41,7 @@
         <div class="hc-page-content-box hc-division-page">
             <div style="height: 50px" class="mb-2">
                 <hc-card class="text-right">
-                    <!-- <el-button
+                    <el-button
                         hc-btn
                         type="warning"
                         @click="divisionClick"
@@ -52,11 +52,12 @@
                     <el-button
                         hc-btn
                         type="primary"
+                      
                         @click="divisionImportClick"
                     >
                         <HcIcon name="folder-received" />
                         <span>节点导入</span>
-                    </el-button> -->
+                    </el-button>
                 </hc-card>
             </div>
             <div class="basic-info">
@@ -997,15 +998,12 @@
         <!-- 节点导入 -->
         <hc-dialog v-model="divisionImportDialog" title="上传文件">
             <div style="position: relative;">
-                <!-- <el-form :model="divisionImportFormModel" label-width="auto" size="large">
-                    <el-form-item>
-                        <hc-form-upload v-model="divisionImportFormModel.key3" is-full :options="{ num: 0, type: 'list', drop: true }" format="支持的文件格式: pdf" />
-                    </el-form-item>
-                </el-form> -->
                 <el-upload
-                    ref="dialogUploadRef" :headers="getHeader()" drag accept=".pdf"
-                    action="/api/blade-resource/oss/endpoint/upload-file" multiple
-                    :on-success="handleSuccess" :on-error="handleError"
+                    ref="dialogUploadRef" :headers="getHeader()" drag 
+                    action="/api/blade-business/informationWriteQuery/importTree" 
+                    :data="{ pKeyId: pKeyIdData }"
+                    :on-success="handleSuccess" :on-error="handleError" accept=".xls,.xlsx"
+                    :auto-upload="false"
                 >
                     <div class="text-80px text-gray">
                         <i class="ri-upload-cloud-line" />
@@ -1070,6 +1068,7 @@ import {
     getArrValue,
     getObjValue,
     isNullES,
+    isObjNull, 
 } from 'js-fast-way'
 import { getStoreValue, setStoreValue } from '~src/utils/storage'
 import { getDictionary } from '~api/other'
@@ -1081,6 +1080,7 @@ import { HcDelMsg, getHeader } from 'hc-vue3-ui'
 
 import { getChildList } from '~api/other'
 import { getDictionaryData } from '~uti/tools'
+import { p } from 'hc-vue3-ui/dist/js/_element-plus.js'
 //初始变量
 const router = useRouter()
 const useRoutes = useRoute()
@@ -1209,7 +1209,7 @@ const getRowTableOwnerType = (type) => {
         return ''
     }
 }
-
+const pKeyIdData = ref('')
 //懒加载的数据
 const treeLoadNode = async ({ node, item, level }, resolve) => {
     let contractIdRelation = '',
@@ -1221,6 +1221,7 @@ const treeLoadNode = async ({ node, item, level }, resolve) => {
         parentId = contractIdRelation ? nodeData?.primaryKeyId : nodeData?.id
         primaryKeyId = nodeData?.id || ''
     }
+ 
     //获取数据
     const { data } = await queryApi.queryWbsTreeData({
         contractId: contractId.value || '',
@@ -1232,6 +1233,11 @@ const treeLoadNode = async ({ node, item, level }, resolve) => {
         dataTime:new Date(),
     })
     resolve(getArrValue(data))
+        // 获取最顶层节点的 pKeyId
+        if (level === 0 && data.length > 0) {
+            pKeyIdData.value = data[0]?.pKeyId
+           
+        }
     treeLoading.value = false
 }
 
@@ -2596,19 +2602,16 @@ const divisionImportDialog = ref(false)
 //上传文件
 const dialogUploadRef = ref(null)
 const divisionImportClick = ()=>{
+
     divisionImportDialog.value = true
+  
+    
 }
 //上传成功
-const formDataFiles = ref([])
+
 const confirmLoading = ref(false)
 const handleSuccess = (res) => {
-    confirmLoading.value = false
-    if (res.code === 200) {
-        const data = getObjValue(res.data)
-        formDataFiles.value.push(data)
-    } else {
-        window.$message.error(res.msg || '上传失败')
-    }
+
 }
 
 //上传失败
@@ -2622,6 +2625,10 @@ const handleError = (error) => {
     }
 }
 const confirmTap = ()=>{
+
+    dialogUploadRef.value.submit()
+
+    
 }
 //节点命名配置
 const nodeNameDialogShow = ref(false)