|
@@ -43,7 +43,7 @@
|
|
|
readonly
|
|
readonly
|
|
|
style="width: 50vw;margin-bottom: 10px;margin-left: 5px"
|
|
style="width: 50vw;margin-bottom: 10px;margin-left: 5px"
|
|
|
/>
|
|
/>
|
|
|
- <el-table
|
|
|
|
|
|
|
+ <el-table id="tab"
|
|
|
ref="multipleTable"
|
|
ref="multipleTable"
|
|
|
height="70vh"
|
|
height="70vh"
|
|
|
:data="tableData"
|
|
:data="tableData"
|
|
@@ -57,7 +57,7 @@
|
|
|
:header-cell-style="{ padding: '0px' }"
|
|
:header-cell-style="{ padding: '0px' }"
|
|
|
>
|
|
>
|
|
|
<!-- 循环渲染表格列 -->
|
|
<!-- 循环渲染表格列 -->
|
|
|
- <el-table-column
|
|
|
|
|
|
|
+ <el-table-column id="tab"
|
|
|
v-for="column in tableColumns"
|
|
v-for="column in tableColumns"
|
|
|
:key="column.prop"
|
|
:key="column.prop"
|
|
|
:prop="column.prop"
|
|
:prop="column.prop"
|
|
@@ -89,7 +89,9 @@ export const getOrderWasteTotal = (params) => {
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
|
<script setup>
|
|
<script setup>
|
|
|
-import { watch, ref, reactive, defineProps, defineEmits } from 'vue'
|
|
|
|
|
|
|
+import * as XLSX from 'xlsx'
|
|
|
|
|
+import FileSaver from 'file-saver'
|
|
|
|
|
+import { watch, ref, reactive, defineProps, defineEmits, nextTick } from 'vue'
|
|
|
|
|
|
|
|
const props = defineProps(['modelValue', 'val'])
|
|
const props = defineProps(['modelValue', 'val'])
|
|
|
const emits = defineEmits(['update:modelValue'])
|
|
const emits = defineEmits(['update:modelValue'])
|
|
@@ -119,7 +121,21 @@ const inputCpmc = ref('')
|
|
|
const isLoading = ref(false)
|
|
const isLoading = ref(false)
|
|
|
|
|
|
|
|
const handleExcel = () => {
|
|
const handleExcel = () => {
|
|
|
|
|
+ const el = document.getElementById('tab');
|
|
|
|
|
+ // 文件名
|
|
|
|
|
+ const filename = '核检废品日统计-'+input.value+ '.xlsx';
|
|
|
|
|
+ const wb = XLSX.utils.table_to_book(el, { raw: true });
|
|
|
|
|
+ const wbout = XLSX.write(wb, { bookType: 'xlsx', bookSST: true, type: 'array' });
|
|
|
|
|
+ try {
|
|
|
|
|
+ FileSaver.saveAs(new Blob([wbout], { type: 'application/octet-stream' }), filename);
|
|
|
|
|
+ } catch (e) {
|
|
|
|
|
+ console.log(e);
|
|
|
|
|
+ }
|
|
|
|
|
+ return wbout;
|
|
|
}
|
|
}
|
|
|
|
|
+nextTick(() => {
|
|
|
|
|
+ handleSearch()
|
|
|
|
|
+})
|
|
|
|
|
|
|
|
const handleSearch = async() => {
|
|
const handleSearch = async() => {
|
|
|
if (!input.value) { return }
|
|
if (!input.value) { return }
|