scorpio преди 2 години
родител
ревизия
d892304049
променени са 3 файла, в които са добавени 22 реда и са изтрити 17 реда
  1. 20 16
      src/views/home/component/dispatch.vue
  2. 0 1
      src/views/home/component/params/params7.vue
  3. 2 0
      src/views/home/details.vue

+ 20 - 16
src/views/home/component/dispatch.vue

@@ -250,20 +250,21 @@ export default {
       this.$api.dispatch.homeFile(data).then(res => {
         if (res.code === 200) {
           const tmp = res.data
-          this.data = this.data.map(sub => {
-            const item = tmp.find(ele => ele.type === sub.dispatchType)
-            if (item) {
-              sub = Object.assign(sub, item)
-            }
-            return sub
-          })
-          const img = tmp.filter(ele => ele.type === 4)
-          if (img && img.length > 0) {
-            img.forEach(i => {
-              this.srcList.push(i.fileFolder.url)
+          if (tmp && tmp.length > 0) {
+            this.data = this.data.map(sub => {
+              const item = tmp.find(ele => ele.type === sub.dispatchType)
+              if (item) {
+                sub = Object.assign(sub, item)
+              }
+              return sub
             })
+            const img = tmp.filter(ele => ele.type === 4)
+            if (img && img.length > 0) {
+              img.forEach(i => {
+                this.srcList.push(i.fileFolder.url)
+              })
+            }
           }
-          console.log(this.srcList)
         } else {
           this.$message.error(res.msg)
         }
@@ -295,13 +296,13 @@ export default {
     },
     beforeOpen(done, type) {
       if (type === 'view') {
-        this.previewFile(this.form.fileIds)
+        this.previewFile(this.form.fileId)
       } else if (type === 'edit') {
         console.log(this.form)
         this.$router.push({
           path: '/home/files',
           query: {
-            id: this.form.fileFolders[0].parentId,
+            id: this.form.fileFolder.parentId,
             projectId: this.projectId
           }
         })
@@ -310,7 +311,8 @@ export default {
       }
     },
     previewFile(id) {
-      if (id.length === 0) {
+      console.log(id)
+      if (id === undefined || id.length === 0) {
         return
       }
       const routeData = this.$router.resolve({
@@ -349,7 +351,9 @@ export default {
       window.open(routeUrl.href, '_blank')
     },
     fileDownload(res) {
-      window.open(res.fileFolders[0].url)
+      if (Object.hasOwn(res.fileFolder, 'url')) {
+        window.open(res.fileFolder.url)
+      }
     },
     exportFile() {
       this.$message.success('开始下载,请稍后...')

+ 0 - 1
src/views/home/component/params/params7.vue

@@ -352,7 +352,6 @@ export default {
     },
     getSum(list) {
       let sum = 0
-      console.log(list)
       list.forEach(sub => {
         if (sub) {
           sum = sum + Number.parseInt(sub)

+ 2 - 0
src/views/home/details.vue

@@ -95,6 +95,8 @@ export default {
       this.$api.project.projectInfo(this.id).then(res => {
         if (res.code === 200) {
           this.data = res.data
+        } else {
+          this.$message.error(res.msg)
         }
       })
     },