Shan9312 hace 10 meses
padre
commit
794ef9fca7

+ 3 - 2
src/views/statisticalAnalysis/inventoryManagement/group/index.vue

@@ -27,6 +27,7 @@
             :row-style="rowStyle"
             :cell-style="cellStyle"
             class="elTable table-fixed"
+            ref="elTable1"
           >
             <el-table-column sortable :label="$t('InventoryManagement.silc')"    min-width="130px" align="center">
               <template slot-scope="scope">
@@ -88,7 +89,7 @@
           :cell-style="cellStyle"
           class="elTable table-fixed"
           :height="myHeight2"
-          ref="elTable1"
+          ref="elTable2"
         >
           <el-table-column v-for="item in tab2.table.tableConfig" align="center" :label="item.label" :prop="item.prop">
             <el-table-column v-for="item1 in item.children"  v-if="item.children || item.children.length>0" align="center" :label="item1.label" :prop="item1.prop">
@@ -132,7 +133,7 @@
           :cell-style="cellStyle"
           class="elTable table-fixed"
           :height="myHeight2"
-          ref="elTable2"
+          ref="elTable3"
         >
           <el-table-column v-for="item in tab3.table.tableConfig" align="center" :label="item.label" :prop="item.prop">
             <el-table-column v-for="item1 in item.children" v-if="item.children || item.children.length>0" align="center" :label="item1.label" :prop="item1.prop">

+ 9 - 3
src/views/statisticalAnalysis/inventoryManagement/pasture/index.vue

@@ -23,6 +23,7 @@
             :row-style="rowStyle"
             :cell-style="cellStyle"
             class="elTable table-fixed"
+            ref="table1"
           >
             <el-table-column sortable :label="$t('InventoryManagement.silc')"    min-width="130px" align="center">
               <template slot-scope="scope">
@@ -914,6 +915,7 @@ export default {
     },
     handleExport(item) {
       if (item == 'tab1') {
+
         console.log('库存统计导出')
         this.downLoad.getdataListParm = {}
         this.downLoad.getdataListParm.name = 'getfsStaticlist'
@@ -927,13 +929,17 @@ export default {
           } else {
             this.downLoad.list = []
           }
+          const table = this.$refs.table1;
+        const columns = table.columns;
+        const labels = columns.map(column => column.label);
+
           import('@/vendor/Export5Excel').then(excel => {
-            const multiHeader = [['饲料名称', '期初', '', '用量', '', '', '', '期末', '']]
-            const multiHeader2 = [['', '期初库存(kg)', '期初金额(元)', '入库重量(kg)', '系统出库重量(kg)', '人工用料重量(kg)', '损耗重量', '期末库存(kg)', '期末金额(元)']]
+            const multiHeader = [[this.$t('InventoryManagement.silc'), , this.$t('InventoryManagement.qc'), '', this.$t('InventoryManagement.yl'), '', '', '', this.$t('InventoryManagement.qm'), '']]
+            const multiHeader2 = labels;
             const filterVal = ['feedname', 'startsum', 'startprice', 'laidsum', 'usesumXT', 'usesumRG', 'usesumXH', 'stopsum', 'stopprice']
             const data = this.downLoad.list.map((v) => filterVal.map((j) => v[j]))
             const merges = ['A1:A2', 'B1:C1', 'D1:G1', 'H1:I1']
-            excel.export_json_to_excel({ multiHeader, multiHeader2, data, filename: '库存统计', merges })
+            excel.export_json_to_excel({ multiHeader, multiHeader2, data, filename: this.$t('InventoryManagement.kctj'), merges }) // kctj
           })
         })
       } else if (item == 'tab2') {