|
@@ -8,7 +8,7 @@
|
|
|
<p class="report-period">【填报周期】:{{ detailData.start }} 至 {{ detailData.end }}</p>
|
|
|
</el-col>
|
|
|
<el-col :span="1.5">
|
|
|
- <el-button type="primary" @click="exportToExcel()"> 收取 </el-button>
|
|
|
+ <el-button type="primary" @click="handleWrite()"> 收取 </el-button>
|
|
|
</el-col>
|
|
|
<el-col :span="1.5">
|
|
|
<el-button type="danger" @click="handleReturn()"> 返回 </el-button>
|
|
@@ -35,7 +35,7 @@
|
|
|
import { ref, onMounted } from 'vue';
|
|
|
import { ElTable, ElButton, ElCol, ElRow, ElTableColumn } from 'element-plus';
|
|
|
import * as XLSX from 'xlsx';
|
|
|
-import {fillDetail} from "@/api/dataFilling/fileManagement";
|
|
|
+import { fillDetail,collectList } from "@/api/dataFilling/fileManagement";
|
|
|
|
|
|
const emits = defineEmits(['close']);
|
|
|
const props = defineProps({
|
|
@@ -52,8 +52,6 @@ const detailData = ref({
|
|
|
});
|
|
|
|
|
|
onMounted(() => {
|
|
|
- console.log('table_name:', props.table_name);
|
|
|
- console.log('eventId:', props.eventId);
|
|
|
fetchFillDetail();
|
|
|
});
|
|
|
|
|
@@ -61,7 +59,6 @@ const fetchFillDetail = async () => {
|
|
|
try {
|
|
|
|
|
|
const res = await fillDetail({ report_id: props.eventId });
|
|
|
- // console.log(res);
|
|
|
// 动态设置表头
|
|
|
editableHeaders.value = res.columns;
|
|
|
// 转换表格数据格式以匹配表头
|
|
@@ -79,18 +76,24 @@ const fetchFillDetail = async () => {
|
|
|
}
|
|
|
};
|
|
|
|
|
|
-const exportToExcel = () => {
|
|
|
- const worksheet = XLSX.utils.json_to_sheet(tableData.value);
|
|
|
- const workbook = { Sheets: { data: worksheet }, SheetNames: ['data'] };
|
|
|
- const excelBuffer = XLSX.write(workbook, { bookType: 'xlsx', type: 'array' });
|
|
|
-
|
|
|
- const blob = new Blob([excelBuffer], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' });
|
|
|
- const link = document.createElement('a');
|
|
|
- const url = window.URL.createObjectURL(blob);
|
|
|
- link.href = url;
|
|
|
- link.download = 'SheetJS.xlsx';
|
|
|
- link.click();
|
|
|
- window.URL.revokeObjectURL(url); // 清理
|
|
|
+//收取
|
|
|
+const handleWrite = () => {
|
|
|
+ if (props.eventId && props.eventId !== '') {
|
|
|
+ const data = {
|
|
|
+ report_id: props.eventId,
|
|
|
+ creator_id: 3,
|
|
|
+ new_status: 2
|
|
|
+ };
|
|
|
+ collectList(data).then(response => {
|
|
|
+ if (response.code === 200) {
|
|
|
+ console.log(response.msg);
|
|
|
+ } else {
|
|
|
+ console.error('更新失败', response.msg);
|
|
|
+ }
|
|
|
+ }).catch(error => {
|
|
|
+ console.error('请求失败', error);
|
|
|
+ });
|
|
|
+ }
|
|
|
};
|
|
|
const handleReturn = () => {
|
|
|
emits('close');
|