lrf402788946 4 vuotta sitten
vanhempi
commit
912f8a2a80
2 muutettua tiedostoa jossa 13 lisäystä ja 5 poistoa
  1. 8 4
      src/views/car/once.vue
  2. 5 1
      src/views/car/out.vue

+ 8 - 4
src/views/car/once.vue

@@ -111,7 +111,7 @@ export default {
     this.getOhterList();
   },
   methods: {
-    ...transport(['query', 'update', 'calculate']),
+    ...transport(['query', 'update', 'calculate', 'export']),
     ...car({ getCarList: 'query' }),
     async search({ skip = 0, limit = 10, ...info } = {}) {
       const res = await this.query({ skip, limit, ...info, supply_type: '0' });
@@ -157,10 +157,14 @@ export default {
     /**
      * 获取合计
      */
-    toExport() {
-      // TODO 导出excel
+    async toExport() {
       let msg = this.$message({ message: '正在导出,请稍后', duration: 0 });
-      console.log('in function:toExport');
+      const ids = this.selected.map(i => i._id);
+      const res = await this.export({ type: 'once', ids });
+      if (this.$checkRes(res)) {
+        msg.close();
+        window.open(res);
+      }
     },
     toReturn() {
       this.dialog = false;

+ 5 - 1
src/views/car/out.vue

@@ -119,9 +119,13 @@ export default {
     },
     // 导出
     async toExport() {
+      let msg = this.$message({ message: '正在导出,请稍后', duration: 0 });
       const dup = this.setQuery();
       const res = await this.export({ ...dup, type: 'car' });
-      console.log(res);
+      if (this.$checkRes(res)) {
+        msg.close();
+        window.open(res);
+      }
     },
     // 校验数据
     toSearch(type) {