|
@@ -9,7 +9,7 @@
|
|
|
:with-input="true"
|
|
|
searchPlaceholder="请输入运单编号查询"
|
|
|
@search="searchHandler"
|
|
|
- :withExportButton="false"
|
|
|
+ @exportex="exportex"
|
|
|
/>
|
|
|
</header>
|
|
|
<main>
|
|
@@ -23,18 +23,32 @@
|
|
|
:loading="loading"
|
|
|
@handleTableChange="handleTableChange"
|
|
|
/>
|
|
|
+ <PrintTable
|
|
|
+ v-show="false"
|
|
|
+ :table-cols="tableCols"
|
|
|
+ id="2"
|
|
|
+ :table-data="tableDataPrint"
|
|
|
+ row-key="index"
|
|
|
+ :height="tableHeight"
|
|
|
+ show-summary
|
|
|
+ :loading="false"
|
|
|
+ />
|
|
|
</main>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import SecurityCheckHeader from '../components/securityCheckHeader.vue'
|
|
|
+import PrintTable from '../components/securityCheckTable.vue'
|
|
|
import SecurityCheckTable from '../components/securityCheckTableWaybill.vue'
|
|
|
import { waybill } from '@/api/statistics/statistics.js'
|
|
|
+import XLSX from 'xlsx'
|
|
|
+import FileSaver from 'file-saver'
|
|
|
export default {
|
|
|
- components: { SecurityCheckHeader, SecurityCheckTable },
|
|
|
+ components: { SecurityCheckHeader, SecurityCheckTable,PrintTable },
|
|
|
data() {
|
|
|
return {
|
|
|
+ printTableId:"printTableId",
|
|
|
loading: false,
|
|
|
pagination: {
|
|
|
showSizeChanger: true,
|
|
@@ -142,6 +156,7 @@ export default {
|
|
|
pageSize: '20', // /** 每页显示记录数 */
|
|
|
},
|
|
|
tableData: [],
|
|
|
+ tableDataPrint:[]
|
|
|
}
|
|
|
},
|
|
|
created() {},
|
|
@@ -176,11 +191,48 @@ export default {
|
|
|
pageSize: '20',
|
|
|
}
|
|
|
this.getData()
|
|
|
+ this.getPrintData();
|
|
|
},
|
|
|
beforeDestroy() {
|
|
|
window.removeEventListener('resize', this.setTableHeight)
|
|
|
},
|
|
|
methods: {
|
|
|
+ //导出
|
|
|
+ async exportex() {
|
|
|
+ this.downFile()
|
|
|
+ },
|
|
|
+ downFile() {
|
|
|
+ var wb = XLSX.utils.table_to_book(document.querySelector('#table2'))
|
|
|
+ var wbout = XLSX.write(wb, {
|
|
|
+ bookType: 'xlsx',
|
|
|
+ bookSST: true,
|
|
|
+ type: 'array',
|
|
|
+ })
|
|
|
+ try {
|
|
|
+ FileSaver.saveAs(
|
|
|
+ new Blob([wbout], {
|
|
|
+ type: 'application/octet-stream',
|
|
|
+ }),
|
|
|
+ '运单统计.xlsx'
|
|
|
+ )
|
|
|
+ } catch (e) {
|
|
|
+ if (typeof console !== 'undefined') console.log(e, wbout)
|
|
|
+ }
|
|
|
+ return wbout
|
|
|
+ },
|
|
|
+ async getPrintData(){
|
|
|
+ try {
|
|
|
+ let queryData = JSON.parse(JSON.stringify(this.FormData));
|
|
|
+ queryData.pageNum = "1";
|
|
|
+ queryData.pageSize = "999999";
|
|
|
+ const result = await waybill(queryData)
|
|
|
+ if (result.code === 200) {
|
|
|
+ this.tableDataPrint = result.data.list
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ console.log(error)
|
|
|
+ }
|
|
|
+ },
|
|
|
searchHandler(arr) {
|
|
|
this.FormData.waybillNo = arr[0]
|
|
|
this.getData()
|