Browse Source

发票号码明细导出

jbb 2 years ago
parent
commit
8b8023f5a1
1 changed files with 41 additions and 4 deletions
  1. 41 4
      src/views/reportForms/fabric-loss-table/invoiceNumModal.vue

+ 41 - 4
src/views/reportForms/fabric-loss-table/invoiceNumModal.vue

@@ -21,6 +21,18 @@
             <a-col :md="6" :sm="8">
               <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
                 <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
+                <a-button type="primary" icon="download" @click="exportExcel" style="margin-left: 8px">导出</a-button>
+                <JsonExcel
+                  :fetch="getExportDataList"
+                  :fields="exportFields"
+                  :header="exportTitle"
+                  name="发票号码明细.xls"
+                  style="display:none"
+                >
+                  <!-- 上面可以自定义自己的样式,还可以引用其他组件button -->
+                  <a-button type="primary" icon="download" ref="realExportExcel">导出</a-button>
+                  
+                </JsonExcel>
                 <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
                 <a @click="handleToggleSearch" style="margin-left: 8px">
                   {{ toggleSearchStatus ? '收起' : '展开' }}
@@ -48,9 +60,9 @@
         <a-row style="marginTop:20px;">
           <a-col :md="24" :sm="12">
             <span style="float: right;" class="table-operator">
-              <a-button type="primary" icon="download" @click="handleExportXls('采购数量')">导出</a-button>
-              <a-button type="primary" @click="print" icon="printer" style="margin:0 10px;">打印</a-button>
-              <a-button type="primary" @click="backFabricLossTable" icon="rollback">返回</a-button>
+              <!-- <a-button type="primary" icon="download" @click="handleExportXls('采购数量')">导出</a-button>
+              <a-button type="primary" @click="print" icon="printer" style="margin:0 10px;">打印</a-button> -->
+              <a-button type="primary" @click="backFabricLossTable" icon="rollback">关闭</a-button>
             </span>
           </a-col>
         </a-row>
@@ -62,12 +74,14 @@
 <script>
 import { JeecgListMixin } from '@/mixins/JeecgListMixin'
 import JEllipsis from '@/components/jeecg/JEllipsis'
+import JsonExcel from 'vue-json-excel'
 export default {
   name: 'InvoiceNumModal', // 发票号明细 弹框
   mixins: [JeecgListMixin],
-  components: { JEllipsis },
+  components: { JEllipsis,JsonExcel },
   data() {
     return {
+      exportTitle:"发票号码明细",
       // 表头
       invoiceNumColumns: [
         {
@@ -148,6 +162,20 @@ export default {
       item.inatSum= parseFloat(inatSum.toFixed(2));
       return [item];
 
+    },
+    // 获取导出json定义
+    exportFields(){
+      var ret = {};
+      this.invoiceNumColumns.forEach((record,index)=>{
+        if (record.title != "序号"){
+          if (record.title != "入库单号")
+            ret[record.title] = record.dataIndex;
+          else
+            ret[record.title] = record.dataIndex+"_ex";
+        }
+
+      });
+      return ret;
     }
   },
   methods: {
@@ -189,6 +217,15 @@ export default {
         ></a-table>
       )
     },
+     // 导出excel
+    exportExcel(){
+      this.$refs.realExportExcel.$el.click();
+    },
+    // 生成导出数据
+    getExportDataList(){
+      this.invoiceNumData.forEach((item,index)=>{item["ccode_ex"]="&nbsp;"+item["ccode"]});
+      return this.invoiceNumData;
+    }
   }
 }
 </script>