فهرست منبع

报告、项目、合同详情中的发票添加批量导出功能

徐滕 3 روز پیش
والد
کامیت
d6a90f25e3
2فایلهای تغییر یافته به همراه66 افزوده شده و 0 حذف شده
  1. 33 0
      src/views/cw/projectRecords/ProjectRecordsForm.vue
  2. 33 0
      src/views/cw/workContract/ContractNameForm.vue

+ 33 - 0
src/views/cw/projectRecords/ProjectRecordsForm.vue

@@ -581,6 +581,14 @@
                   {{scope.row.receivablesStatus === '1'?'已收款':'未收款'}}
                 </template>
               </vxe-column>
+              <vxe-column title="操作" min-width="120" align="center" fixed="right">
+                <template #default="scope">
+                  <el-button v-if="scope.row.omsAttachmentUrl" type="primary" text size="small"
+                    @click="handleDownloadInvoice(scope.row)">
+                    <i class="el-icon-download"></i> 下载
+                  </el-button>
+                </template>
+              </vxe-column>
             </vxe-table>
           </el-tab-pane>
         </el-tabs>
@@ -699,6 +707,7 @@
         visible: false,
 		  reportTypeFlag: false,
         invoiceList: [],
+        invoiceLoading: false,
         invoiceForm: {
           no: ''
         },
@@ -1287,6 +1296,30 @@
       viewInvoice (flag, id) {
         this.$refs.invoiceFormDialog.init(flag, id)
       },
+      // 下载单个发票
+      handleDownloadInvoice (row) {
+        this.$confirm(`确定下载当前发票文件吗?`, '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
+        }).then(() => {
+          this.invoiceLoading = true
+          let omsAttachmentUrl = row.omsAttachmentUrl.substring(1)
+          omsAttachmentUrl = omsAttachmentUrl.substring(0, omsAttachmentUrl.lastIndexOf('/') + 1)
+          cwFinanceInvoiceService.downLoadOMSInvoiceAttachzip({
+            fileUrl: omsAttachmentUrl,
+            invoiceNo: row.no
+          }).then((res) => {
+            this.$utils.downloadZip(res, '发票-' + row.no + '.zip')
+            this.invoiceLoading = false
+          }).catch((err) => {
+            this.invoiceLoading = false
+            if (err.response) {
+              console.log(err.response)
+            }
+          })
+        })
+      },
       searchReport () {
         this.loading = true
         projectReportService.getIdByProjectId(this.inputForm.id, this.reportForm).then((data) => {

+ 33 - 0
src/views/cw/workContract/ContractNameForm.vue

@@ -460,6 +460,14 @@
                 {{scope.row.receivablesStatus === '1'?'已收款':'未收款'}}
               </template>
             </vxe-column>
+            <vxe-column title="操作" min-width="120" align="center" fixed="right">
+              <template #default="scope">
+                <el-button v-if="scope.row.omsAttachmentUrl" type="primary" text size="small"
+                  @click="handleDownloadInvoice(scope.row)">
+                  <i class="el-icon-download"></i> 下载
+                </el-button>
+              </template>
+            </vxe-column>
           </vxe-table>
         </el-tab-pane>
       </el-tabs>
@@ -614,6 +622,7 @@
           projectNumber: ''
         },
         invoiceList: [],
+        invoiceLoading: false,
         invoiceForm: {
           no: ''
         },
@@ -1202,6 +1211,30 @@
       viewInvoice (flag, id) {
         this.$refs.invoiceFormDialog.init(flag, id)
       },
+      // 下载单个发票
+      handleDownloadInvoice (row) {
+        this.$confirm(`确定下载当前发票文件吗?`, '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
+        }).then(() => {
+          this.invoiceLoading = true
+          let omsAttachmentUrl = row.omsAttachmentUrl.substring(1)
+          omsAttachmentUrl = omsAttachmentUrl.substring(0, omsAttachmentUrl.lastIndexOf('/') + 1)
+          cwFinanceInvoiceService.downLoadOMSInvoiceAttachzip({
+            fileUrl: omsAttachmentUrl,
+            invoiceNo: row.no
+          }).then((res) => {
+            this.$utils.downloadZip(res, '发票-' + row.no + '.zip')
+            this.invoiceLoading = false
+          }).catch((err) => {
+            this.invoiceLoading = false
+            if (err.response) {
+              console.log(err.response)
+            }
+          })
+        })
+      },
       searchReport () {
         this.loading = true
         projectReportService.getIdByContractId(this.inputForm.id, this.reportForm).then((data) => {