Ver Fonte

批量导入

duy há 3 semanas atrás
pai
commit
c6a3cf595b
2 ficheiros alterados com 21 adições e 20 exclusões
  1. 19 17
      src/views/data-fill/components/dataImport.vue
  2. 2 3
      src/views/data-fill/wbs.vue

+ 19 - 17
src/views/data-fill/components/dataImport.vue

@@ -4,11 +4,10 @@
         <div style="position: relative;">
             <el-upload
                 ref="dialogUploadRef" :headers="getHeader()" drag 
-                action="/api/blade-manager/wbsTreeContract/import-node-excel" 
-                :data="{ nodeId, classify }"
+                action="/api/blade-manager/informationImportRecord/import" 
                 :on-success="handleSuccess" :on-error="handleError" accept=".xls,.xlsx"
                 :auto-upload="false"
-                :limit="1"
+                multiple
                 :on-exceed="handleExceed"
                 :before-upload="beforeUpload"
                 :show-file-list="false"
@@ -59,8 +58,6 @@ const props = defineProps({
         type: String,
         default: '',
     },
- 
-  
 })
 //事件
 const emit = defineEmits(['close', 'save', 'success'])
@@ -73,7 +70,6 @@ watch(
         nodeId.value = nid
         classify.value = clas
         fileList.value = []
-
     },
 )
 
@@ -84,8 +80,6 @@ const dataModal = defineModel('modelValue', {
 const closeModal = ()=>{
     dataModal.value = false
     fileList.value = []
-
-   
     emit('close')
 }
 
@@ -93,7 +87,7 @@ const closeModal = ()=>{
 
 //上传文件
 const dialogUploadRef = ref(null)
-const pKeyIdData = ref('')
+// const pKeyIdData = ref('')
 // 文件类型验证
 const beforeUpload = (file) => {
   const extension = file.name.split('.').pop().toLowerCase()
@@ -130,18 +124,18 @@ const handleSuccess = (res) => {
     if (res.code === 200) {
         window.$message.success(res.msg || '上传成功')
         emit('success', res)
-  nextTick(()=>{
-         fileList.value = []
-      })
+        nextTick(()=>{
+            fileList.value = []
+        })
 
-    closeModal()
+        closeModal()
 
     } else {
     
         window.$message.error(res.msg || '上传失败')
-       nextTick(()=>{
-         fileList.value = []
-      })
+        nextTick(()=>{
+            fileList.value = []
+        })
     }
 }
 
@@ -171,8 +165,16 @@ const parseFileName = (disposition) => {
     if (matches && matches[1]) {
         return decodeURIComponent(matches[1].replace(/['"]/g, ''))
     }
-    return 'unknown'
+    confirmLoading.value = false
 }
+// const parseFileName = (disposition) => {
+//     const filenameRegex = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/
+//     const matches = filenameRegex.exec(disposition)
+//     if (matches && matches[1]) {
+//         return decodeURIComponent(matches[1].replace(/['"]/g, ''))
+//     }
+//     return 'unknown'
+// }
 
 const downloadBlob1 = (data, disposition = '', type = 'application/vnd.ms-excel')=> {
     const blob = new Blob([data], { type: type })

+ 2 - 3
src/views/data-fill/wbs.vue

@@ -195,7 +195,7 @@
                             节点基础数据
                         </el-button>
                     </HcTooltip>
-                    <!-- <HcTooltip keys="data-fill-wbs-file-import">
+                    <HcTooltip keys="data-fill-wbs-file-import">
                         <el-button 
                           
                             v-if="userInfo.dept_id === '1536982621165592577'"
@@ -206,7 +206,7 @@
                         >
                             资料导入
                         </el-button>
-                    </HcTooltip> -->
+                    </HcTooltip>
                     <HcTooltip keys="wbs_views_sort_btn">
                         <el-button
                             v-if="nodeDataInfo?.nodeClass !== 2"
@@ -1286,7 +1286,6 @@ const authBtnTabClick = (val) => {
 
         //重新加载左边树
 
-
         isLookHistory.value = false
         isLookHide.value = true
         isSearchTree.value = false