浏览代码

工单核验单-核检废品日统计导出

曹鹤洋 1 年之前
父节点
当前提交
780bfa6740

+ 19 - 3
src/view/performance/09-workOrderVerification/componets/gongdanzhijianfeipintongji.vue

@@ -43,7 +43,7 @@
           readonly
           style="width: 50vw;margin-bottom: 10px;margin-left: 5px"
         />
-        <el-table
+        <el-table id="tab"
           ref="multipleTable"
           height="70vh"
           :data="tableData"
@@ -57,7 +57,7 @@
           :header-cell-style="{ padding: '0px' }"
         >
           <!-- 循环渲染表格列 -->
-          <el-table-column
+          <el-table-column id="tab"
             v-for="column in tableColumns"
             :key="column.prop"
             :prop="column.prop"
@@ -89,7 +89,9 @@ export const getOrderWasteTotal = (params) => {
 </script>
 
 <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 emits = defineEmits(['update:modelValue'])
@@ -119,7 +121,21 @@ const inputCpmc = ref('')
 const isLoading = ref(false)
 
 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() => {
   if (!input.value) { return }

+ 3 - 1
src/view/performance/09-workOrderVerification/index.vue

@@ -1030,12 +1030,14 @@
 	const table = ref(null)
 
 	const showGdzjfptj = () => {
-		value1.value = currentRow.value?.qczl_gdbh
+		value1.value = currentRow.gdbh
 		dialogGdzjfptj.value = true
+		
 	}
 	const currentRow = ref()
 	const handleSelectChange = (row, column, event) => {
 		currentRow.value = row.UniqId
+		currentRow.gdbh = row.qczl_gdbh
 	}
 
 	// 新增数据