fix: 报表新增导出

This commit is contained in:
sy2084 2024-07-31 18:38:04 +08:00
parent 9917ca25f6
commit 01483c626f
2 changed files with 13 additions and 4 deletions

View File

@ -52,9 +52,7 @@ const emit = defineEmits(["toFilt"]);
const chartType = ref("line");
const dateType = ref("day");
const filterData = ref({
});
const filterData = ref({});
const rangePicker = computed(() => {
switch(dateType.value) {

View File

@ -29,7 +29,7 @@
/>
<a-range-picker v-else-if="item.type === 'time'" class="date-item" v-model:value="filterData[item.name]" @change="toFilt" />
</div>
<div v-if="isExport" class="filter-item"><a :href="`${YCODE_BASEURL}/api/v1/preview/export?preview_id=${previewId}&filter=${JSON.stringify(getFilter())}`" target="_blank"><a-button type="primary">导出</a-button></a></div>
<div v-if="isExport" class="filter-item"><a :href="`${YCODE_BASEURL}/api/v1/preview/export?preview_id=${previewId}&filter=${JSON.stringify(getFilter())}`" target="_blank"><a-button type="primary"><CloudDownloadOutlined />导出</a-button></a></div>
</div>
<div class="y-table-content">
<a-table
@ -47,6 +47,7 @@
:hide-on-single-page="false"
size="small"
class="pagination-box"
:show-total="total => `共 ${total} 条`"
@change="pageChange"
/>
</div>
@ -57,6 +58,7 @@
import { reactive, ref } from "vue";
import { useDebounceFn } from "@vueuse/core";
import _ from "lodash";
import { CloudDownloadOutlined } from "@ant-design/icons-vue";
const YCODE_BASEURL = import.meta.env.VITE_YCODE_BASEURL
@ -99,6 +101,14 @@ const pageState = reactive({
perPage: 20,
});
// watch(() => props.previewId, () => {
// props.filterConfig.forEach(item => {
// if (item.type === 'time') {
// filterData.value[item.name] = [dayjs().startOf('month'), dayjs().endOf('month')];
// }
// })
// }, { immediate: true })
const getFilter = () => {
const cloneFilter = _.cloneDeep(props.filterConfig);
const filter = cloneFilter
@ -141,6 +151,7 @@ const pageChange = () => {
<style lang="less" scoped>
.y-table-name {
margin-bottom: 10px;
display: none;
.title {
font-size: 18px;
font-weight: bold;