Procházet zdrojové kódy

速运行李查询修改

zhongxiaoyu před 2 roky
rodič
revize
1ebc15d2f2
1 změnil soubory, kde provedl 73 přidání a 36 odebrání
  1. 73 36
      src/views/upload/index.vue

+ 73 - 36
src/views/upload/index.vue

@@ -111,15 +111,10 @@
             :key="column.key"
             :prop="column.prop"
             :label="column.prop"
-            :formatter="formatter"
-          />
-          <el-table-column
-            prop="message"
-            label="message"
-            width="200"
           >
-            <template slot-scope="{ row }">
+            <template slot-scope="scope">
               <el-tooltip
+                v-if="column.showTooltip"
                 class="item"
                 effect="dark"
                 placement="top-start"
@@ -128,10 +123,33 @@
                   slot="content"
                   class="tooltip-content"
                 >
-                  {{ row.message }}
+                  {{
+                    formatter(
+                      scope.row,
+                      scope.column,
+                      scope.row[scope.column.property]
+                    )
+                  }}
+                </div>
+                <div class="tooltip-trigger">
+                  {{
+                    formatter(
+                      scope.row,
+                      scope.column,
+                      scope.row[scope.column.property]
+                    )
+                  }}
                 </div>
-                <div class="tooltip-trigger">{{ row.message }}</div>
               </el-tooltip>
+              <span v-else>
+                {{
+                  formatter(
+                    scope.row,
+                    scope.column,
+                    scope.row[scope.column.property]
+                  )
+                }}
+              </span>
             </template>
           </el-table-column>
           <template #empty>
@@ -179,45 +197,53 @@ export default {
       flightDate: new Array(2).fill(parseTime(new Date(), '{y}-{m}-{d}')),
       dateRangePickerOptions: {
         onPick: this.dateRangePickHandler,
-        disabledDate: this.dateRangeDisabled
+        disabledDate: this.dateRangeDisabled,
       },
       tableColumns: [
         {
-          prop: 'C0'
+          prop: 'C0',
         },
         {
-          prop: 'C1'
+          prop: 'C1',
         },
         {
-          prop: 'C2'
+          prop: 'C2',
         },
         {
-          prop: 'C3'
+          prop: 'C3',
         },
         {
-          prop: 'C4'
+          prop: 'C4',
         },
         {
-          prop: 'C5'
+          prop: 'C5',
         },
         {
-          prop: 'C6'
+          prop: 'C6',
         },
         {
-          prop: 'C7'
+          prop: 'C7',
         },
         {
-          prop: 'C8'
+          prop: 'C8',
         },
         {
-          prop: 'C9'
+          prop: 'C9',
         },
         {
-          prop: 'createtime'
-        }
+          prop: 'createtime',
+        },
+        {
+          prop: 'message',
+          showTooltip: true,
+        },
+        {
+          prop: 'sendResult',
+          showTooltip: true,
+        },
       ],
       tableData: [],
-      loading: false
+      loading: false,
     }
   },
   computed: {
@@ -228,7 +254,7 @@ export default {
     },
     exceed() {
       return this.currentProgressNum >= this.limit
-    }
+    },
   },
   watch: {
     flightDate: {
@@ -236,8 +262,8 @@ export default {
         this.getTableData()
       },
       deep: true,
-      immediate: true
-    }
+      immediate: true,
+    },
   },
   methods: {
     beforeUpload(file) {
@@ -247,16 +273,22 @@ export default {
         return
       }
       if (this.exceed) {
-        this.$message.warning(`${file.name} 上传出错:超出最大同时上传数量,最多同时上传 ${this.limit} 个文件`)
+        this.$message.warning(
+          `${file.name} 上传出错:超出最大同时上传数量,最多同时上传 ${this.limit} 个文件`
+        )
       }
       const extensionName = file.name.split('.').pop()
       const acceptExtention = acceptTypes.includes(extensionName)
       if (!acceptExtention) {
-        this.$message.warning(`${file.name} 上传出错:上传文件只能是 ${acceptTypes.join('/')} 格式`)
+        this.$message.warning(
+          `${file.name} 上传出错:上传文件只能是 ${acceptTypes.join('/')} 格式`
+        )
         return false
       }
       if (file.size > maxSize) {
-        this.$message.warning(`${file.name} 上传出错:上传文件大小不能超过 ${short}`)
+        this.$message.warning(
+          `${file.name} 上传出错:上传文件大小不能超过 ${short}`
+        )
         return false
       }
     },
@@ -274,7 +306,7 @@ export default {
         key: `${file.name}${file.lastModified}`,
         fileName: file.name,
         state: this.exceed ? 2 : 0,
-        time: parseTime(Date.now(), '{y}-{m}-{d} {h}:{i}:{s}')
+        time: parseTime(Date.now(), '{y}-{m}-{d} {h}:{i}:{s}'),
       }
       this.totalProgressList.push(newProgress)
     },
@@ -329,7 +361,9 @@ export default {
       }
     },
     dateRangeDisabled(date) {
-      return this.pickedDate ? Math.abs(date - this.pickedDate) > 2 * 24 * 60 * 60 * 1000 : false
+      return this.pickedDate
+        ? Math.abs(date - this.pickedDate) > 2 * 24 * 60 * 60 * 1000
+        : false
     },
     cellClass({ row, column, rowIndex, columnIndex }) {
       const classes = []
@@ -351,13 +385,16 @@ export default {
       this.loading = true
       try {
         // const dataContent = [this.flightDate[0], this.flightDate[1]]
-        const dataContent = [`${this.flightDate[0]} 00:00:00`, `${this.flightDate[1]} 23:59:59`]
+        const dataContent = [
+          `${this.flightDate[0]} 00:00:00`,
+          `${this.flightDate[1]} 23:59:59`,
+        ]
         const {
           code,
-          returnData: { listValues }
+          returnData: { listValues },
         } = await WhatQuery({
           id: DATACONTENT_ID.expressTransportation,
-          dataContent
+          dataContent,
         })
         if (Number(code) !== 0) {
           throw new Error('失败')
@@ -367,8 +404,8 @@ export default {
         this.$message.error('查询表格失败')
       }
       this.loading = false
-    }
-  }
+    },
+  },
 }
 </script>