ZaiZai 1 年之前
父節點
當前提交
4f5531ec5c
共有 2 個文件被更改,包括 16 次插入5 次删除
  1. 2 0
      pages/data-fill/dataTable.vue
  2. 14 5
      pages/data-fill/fileUp.vue

+ 2 - 0
pages/data-fill/dataTable.vue

@@ -128,6 +128,7 @@ const getTableDataAll = () => {
 const listItemData = ref([])
 const appUserList = ref([])
 const searchNodeAllTable = async () => {
+    uni.showLoading({title: '加载中...', mask: true});
     const info = treeNode.value
     const { data } = await wbsApi.searchNodeAllTable({
         projectId: projectId.value,
@@ -147,6 +148,7 @@ const searchNodeAllTable = async () => {
     })
     appUserList.value = [...userMap.values()]
     isNodes.value = true
+    uni.hideLoading();
 }
 
 //当前节点状态, 1 未填报,2待上报,3已上报

+ 14 - 5
pages/data-fill/fileUp.vue

@@ -89,15 +89,24 @@ const selectFileTap = () => {
 }
 //文件选择完成
 const selectFileChange = async (files) => {
-    console.log(files)
-    /*if (files && files.length > 0) {
+    if (files && files.length > 0) {
+        let isUnsupported = false
         uni.showLoading({title: '上传文件中...', mask: true})
+        const fileType = ['doc', 'docx', 'pdf', 'xls', 'xlsx', 'gif', 'jpg', 'jpeg', 'png', 'bmp', 'webp']
         for (let i = 0; i < files.length; i++) {
-            await uploadFileApi(files[i].filePath)
-            getBussFileList().then()
+            const extension = files[i].fileExtension.toLowerCase()
+            if (fileType.indexOf(extension) > -1) {
+                await uploadFileApi(files[i].filePath)
+                getBussFileList().then()
+            } else {
+                isUnsupported = true
+            }
         }
         uni.hideLoading()
-    }*/
+        if (isUnsupported) {
+            errorToast('有不支持的文件格式,已过滤上传');
+        }
+    }
 }
 
 //处理文件上传