瀏覽代碼

2023-9-12 上传优化

codeMan 2 年之前
父節點
當前提交
16c4dd332b
共有 2 個文件被更改,包括 18 次插入5 次删除
  1. 8 3
      src/HManagement/archives_sc/list/modules/edit.vue
  2. 10 2
      src/components/upload/hw_obs_upload.vue

+ 8 - 3
src/HManagement/archives_sc/list/modules/edit.vue

@@ -73,7 +73,7 @@
           <!-- 附件列表 -->
           <div class="container normal-panel">
             <attachmentList :attinfos="form.attinfos" @onSuccess="selectDetail" :onlyread="store.state.pageOnlyRead">
-              <upload slot="upload" :folderid="folderid"
+              <upload slot="upload" :folderid="folderid" ref="upload"
                 :bindData="{ ownertable: 'SAT_COURSEWARE', ownerid: form.sat_coursewareid, usetype: 'default' }"
                 @onSuccess="onSubmit"></upload>
             </attachmentList>
@@ -155,9 +155,14 @@ export default {
 
         /*this.selectDetail()*/
         this.insertCoursewareauth(() => {
-          this.$router.push({path:'/archives_scdetails',query:{id:res.data.sat_coursewareid,rowindex:res.data.rowindex}})
+          if (Object.prototype.toString.call(callback).indexOf('Function') != -1) {
+            this.$router.push({path:'/archives_scdetails',query:{id:res.data.sat_coursewareid,rowindex:res.data.rowindex}})
+            callback(res)
+          } else {
+            this.$refs.upload.dialogUploadVisible = false
+            this.selectDetail()
+          }
         })
-        callback?callback(res):''
       });
     },
     async selectDetail() {

+ 10 - 2
src/components/upload/hw_obs_upload.vue

@@ -84,7 +84,8 @@ export default {
         }
       },
       file: {},
-      filelist: []
+      filelist: [],
+      count:0
     }
   },
   methods: {
@@ -140,9 +141,16 @@ export default {
         "content":obj
       }
       const res = await this.$api.requested(param)
-      if (res.code ===  1) {
+      this.count++
+      console.log(this.count);
+      if (this.count == this.filelist.length) {
         this.$emit('onSuccess',res)
+        this.count = 0
+        console.log('触发');
       }
+      // if (res.code ===  1) {
+      //   this.$emit('onSuccess',res)
+      // }
     },
 
     clearFiles () {