瀏覽代碼

مدیریت مالی

خروجی اکسل برای پرداخت ها
hgh 2 年之前
父節點
當前提交
0bd0e807e3
共有 2 個文件被更改,包括 47 次插入 和 1 次删除
  1. 22 1
      src/api/models/Payment.js
  2. 25 0
      src/components/Widgets/Payment/AdminPaymentList/AdminPaymentList.vue

+ 22 - 1
src/api/models/Payment.js

@@ -10,7 +10,8 @@ export default class PaymentAPI extends APIRepository {
       requestWithdraw: '/accounting/payments/request_withdraw',
       confirmWithdraw: (id) => '/accounting/payments/' + id + '/confirm_withdraw',
       rejectWithdraw: (id) => '/accounting/payments/' + id + '/reject_withdraw',
-      byId: (id) => '/accounting/payments/' + id
+      byId: (id) => '/accounting/payments/' + id,
+      exportPaymentReport: '/accounting/payments/export_report'
     }
     this.CacheList = {
       base: this.name + this.APIAdresses.base
@@ -108,4 +109,24 @@ export default class PaymentAPI extends APIRepository {
       }
     })
   }
+
+  exportPaymentReport(data) {
+    return this.sendRequest({
+      apiMethod: 'get',
+      api: this.api,
+      request: this.APIAdresses.exportPaymentReport,
+      data: this.getNormalizedSendData({
+        classroom: null, // Number
+        report_type: null, // String
+        status: null // String
+      }, data),
+      responseType: 'blob',
+      resolveCallback: (response) => {
+        return response.data // xlsxData
+      },
+      rejectCallback: (error) => {
+        return error
+      }
+    })
+  }
 }

+ 25 - 0
src/components/Widgets/Payment/AdminPaymentList/AdminPaymentList.vue

@@ -13,6 +13,13 @@
                   :show-search-button="false"
                   :show-expand-button="false"
                   :show-reload-button="false">
+      <template #toolbar>
+        <q-btn color="primary"
+               :loading="exportReportLoading"
+               @click="getPaymentsListExcel">
+          دریافت
+        </q-btn>
+      </template>
       <template #entity-index-table-cell="{inputData}">
         <template v-if="inputData.col.name === 'number'">
           {{ inputData.rowNumber }}
@@ -144,6 +151,7 @@ export default {
         ]
       },
       mounted: false,
+      exportReportLoading: false,
       createRouteName: ''
     }
   },
@@ -157,6 +165,23 @@ export default {
     },
     search () {
       this.$refs.entityIndex.search()
+    },
+    getPaymentsListExcel () {
+      this.exportReportLoading = true
+      const status = null
+      APIGateway.payment.exportPaymentReport({
+        classroom: this.$route.params.id,
+        report_type: 'payments_list',
+        status
+      })
+        .then((xlsxData) => {
+          // Assist.saveXlsx(xlsxData, this.classroomId)
+          Assist.saveXlsx(xlsxData, 'پرداخت ها')
+          this.exportReportLoading = false
+        })
+        .catch((e) => {
+          this.exportReportLoading = false
+        })
     }
   }
 }