对接导入导出,优化页面UI

This commit is contained in:
fks-xuxinyue
2024-08-14 15:21:20 +08:00
parent 4205413418
commit 83119f53e9
13 changed files with 468 additions and 166 deletions

View File

@@ -56,6 +56,12 @@
</div> -->
</div>
<div class="right">
<a-button
type="primary"
@click="changeParentData"
style="position: absolute; right: 25px; top: 10px; z-index: 99">
返回
</a-button>
<a-tabs v-model:activeKey="activeKey" @change="handleTabChange" style="height: 100%">
<a-tab-pane key="1" tab="排放源">
<div style="display: flex; height: 100%">
@@ -305,7 +311,8 @@
:data-source="newTableData"
bordered
rowKey="id"
:scroll="{ y: 400 }"
:scroll="{ y: 300 }"
size="small"
style="margin-bottom: 10px"
:rowSelection="{
selectedRowKeys: selectedRowKeysEdit,
@@ -315,14 +322,14 @@
:pagination="false">
</a-table>
<a-pagination
:current="queryParams.pageNum"
:current="queryData.pageNum"
:total="total"
:page-size="queryParams.pageSize"
:page-size="queryData.pageSize"
style="display: flex; justify-content: center; margin-top: 16px"
:show-size-changer="true"
:show-quick-jumper="true"
@change="onChange" />
<a-upload
<!-- <a-upload
v-model:file-list="fileList"
name="file"
accept=".jpg,.jpeg,.png,.gif,.bmp,.pdf"
@@ -333,7 +340,20 @@
<upload-outlined></upload-outlined>
点击上传凭证
</a-button>
</a-upload>
</a-upload> -->
<a-upload-dragger
v-model:fileList="fileList"
name="file"
@remove="handleFileRemove"
:before-upload="beforeUpload"
@change="handleChange">
<p class="ant-upload-drag-icon">
<inbox-outlined></inbox-outlined>
</p>
<p class="ant-upload-hint">1.仅支持pdf格式文件或文件夹</p>
<p class="ant-upload-hint">2.文件名命名规则为能源种类_年份</p>
<p class="ant-upload-hint">3.每次上传自动覆盖</p>
</a-upload-dragger>
<template #footer>
<a-button style="margin-right: 8px" @click="onCloseEditData">取消</a-button>
<a-button type="primary" @click="submitEditData">确定</a-button>
@@ -352,6 +372,7 @@
PlusCircleOutlined,
MinusCircleOutlined,
UploadOutlined,
InboxOutlined,
} from '@ant-design/icons-vue';
import * as echarts from 'echarts';
import { voucherColumns, drawerColumns } from '../config';
@@ -388,8 +409,8 @@
const orgId = ref('');
const result = JSON.parse(sessionStorage.getItem('ORGID')!);
orgId.value = result;
const fetch = (api, params = { orgId: orgId.value }) => {
return http.post(api, params);
const fetch = (api, params = { orgId: orgId.value }, config) => {
return http.post(api, params, config);
};
// 左侧树结构
const x = 3;
@@ -867,15 +888,17 @@
selectedRowKeys.value.forEach((item) => {
deleteIds.value.append('ids', item);
});
fetch(uploadPic.downloadZip, deleteIds.value)
const config = {
responseType: 'blob',
};
fetch(uploadPic.downloadZip, deleteIds.value, config)
.then((res) => {
// 创建一个 URL 对象,指向图片数据的 blob
const url = window.URL.createObjectURL(new Blob([res.data]));
const url = window.URL.createObjectURL(new Blob([res]));
// 创建一个 <a> 标签,用于触发下载
const link = document.createElement('a');
link.href = url;
debugger;
link.setAttribute('download', ''); // 设置下载的文件名
link.setAttribute('download', '碳盘查凭证.zip'); // 设置下载的文件名
document.body.appendChild(link);
link.click();
@@ -912,10 +935,11 @@
const queryData = ref({
orgId: orgId.value,
pageNum: 1,
pageSize: 999,
pageSize: 10,
});
const edit = (record) => {
getDictList();
// queryData.value.emissionSources = record.emissionFactors;
getNewTable();
editFormState.value.id = record.id;
editFormState.value.dataSources = record.dataSources;
@@ -1064,8 +1088,8 @@
};
// 分页器
const onChange = (pageNumber: number, size: number) => {
queryParams.value.pageNum = pageNumber;
queryParams.value.pageSize = size;
queryData.value.pageNum = pageNumber;
queryData.value.pageSize = size;
getNewTable();
};
// 点击切换排放统计/碳排流向
@@ -1511,6 +1535,7 @@
background-color: @white;
border-radius: @ns-border-radius;
box-shadow: @ns-content-box-shadow;
position: relative;
:deep(.ant-tabs-content-holder) {
padding: 20px;
}
@@ -1570,4 +1595,8 @@
margin-left: 10%;
flex-direction: column;
}
:deep(.ant-upload.ant-upload-drag) {
height: 18vh;
margin-top: 10px;
}
</style>