This commit is contained in:
yziiy
2026-01-16 10:08:18 +08:00
parent 4e1d7a60ae
commit 0ff9bdad84
3 changed files with 84 additions and 9 deletions

View File

@@ -1,6 +1,6 @@
// export const URL = "https://yushengapi.qxyushen.top"; export const URL = "https://yushengapi.qxyushen.top";
// 预测版 // 预测版
export const URL = "https://vsyusheng.qxhs.xyz"; // export const URL = "https://vsyusheng.qxhs.xyz";
// 测试 // 测试
// export const URL = "https://test.vespa.qxyushen.top"; // export const URL = "https://test.vespa.qxyushen.top";
// 声网appId 在这里换 // 声网appId 在这里换

View File

@@ -1,9 +1,13 @@
<script setup lang="ts"> <script setup lang="ts">
// 开奖记录 // 开奖记录
import { ref, onMounted, nextTick } from "vue"; import { ref, onMounted, nextTick, h } from "vue";
import SearchForm from "@/components/SearchForm/index.vue"; import SearchForm from "@/components/SearchForm/index.vue";
import { queryBoxTypeList } from "@/api/modules/blindBox"; import { queryBoxTypeList } from "@/api/modules/blindBox";
import { queryTurntableRecord } from "@/api/modules/room"; import { queryTurntableRecord } from "@/api/modules/room";
import ExportForm from "@/components/exportDialog/index.vue";
import { utils, writeFile } from "xlsx";
import { message } from "@/utils/message";
import { addDialog } from "@/components/ReDialog";
const searchLabel = ref([ const searchLabel = ref([
{ {
label: "盲盒礼包", label: "盲盒礼包",
@@ -163,6 +167,75 @@ const handleCurrentChange = (val: number) => {
pagination.value.currentPage = val; pagination.value.currentPage = val;
getData(searchForm.value); getData(searchForm.value);
}; };
const exportFormRef = ref(null);
const exportExcel = () => {
let exportTableList = [];
addDialog({
title: `导出数据`,
props: {
formInline: {
time: ""
}
},
width: "40%",
closeOnClickModal: false,
contentRenderer: () =>
h(ExportForm, { ref: exportFormRef, formInline: null }),
beforeSure: (done, { options }) => {
const FormRef = exportFormRef.value.getRef();
const curData = options.props.formInline;
const exportData = async formData => {
const { data, code } = await queryTurntableRecord({
...searchForm.value,
stime: formData.start_time,
etime: formData.end_time,
page: 1,
page_limit: 20000
});
if (code) {
exportTableList = data.lists;
const res = exportTableList.map(item => {
const arr = [];
dynamicflowColumns.value.forEach(column => {
arr.push(item[column.prop as string]);
});
return arr;
});
const titleList = [];
dynamicflowColumns.value.forEach(column => {
titleList.push(column.label);
});
res.unshift(titleList);
const workSheet = utils.aoa_to_sheet(res);
const workBook = utils.book_new();
utils.book_append_sheet(workBook, workSheet, "数据报表");
writeFile(
workBook,
`盲盒转盘开奖记录统计${formData.start_time} - ${formData.end_time}.xlsx`
);
message("导出成功", {
type: "success"
});
done();
} else {
message("获取数据失败,请重试!", {
type: "error"
});
}
};
FormRef.validate(valid => {
if (valid) {
if (curData.time && curData.time.length) {
exportData({
start_time: curData.time[0] || "",
end_time: curData.time[1] || ""
});
}
}
});
}
});
};
onMounted(() => { onMounted(() => {
getType(); getType();
}); });
@@ -177,7 +250,9 @@ onMounted(() => {
<span /> <span />
</div> </div>
</div> </div>
<div style="text-align: right">
<el-button type="primary" @click="exportExcel">导出表格</el-button>
</div>
<pure-table ref="tableRef" class="mt-5" align-whole="center" showOverflowTooltip table-layout="auto" <pure-table ref="tableRef" class="mt-5" align-whole="center" showOverflowTooltip table-layout="auto"
default-expand-all row-key="id" :adaptiveConfig="{ offsetBottom: 108 }" :data="tableList" default-expand-all row-key="id" :adaptiveConfig="{ offsetBottom: 108 }" :data="tableList"
:columns="dynamicflowColumns" :pagination="{ ...pagination }" :header-cell-style="{ :columns="dynamicflowColumns" :pagination="{ ...pagination }" :header-cell-style="{

View File

@@ -35,11 +35,11 @@ export default ({ mode }: ConfigEnv): UserConfigExport => {
onProxyReq: (proxyReq, req, res) => { onProxyReq: (proxyReq, req, res) => {
if (req.method === "OPTIONS") { if (req.method === "OPTIONS") {
proxyReq.method = "OPTIONS"; proxyReq.method = "OPTIONS";
res.setHeader( // res.setHeader(
"Access-Control-Allow-Origin", // "Access-Control-Allow-Origin",
"http://adminvs.qxhs.xyz" // "http://adminvs.qxhs.xyz"
); // );
// res.setHeader('Access-Control-Allow-Origin', 'http://yushenggliht.qxyushen.top'); res.setHeader('Access-Control-Allow-Origin', 'http://yushenggliht.qxyushen.top');
// res.setHeader('Access-Control-Allow-Origin', 'https://test.vespa.qxyushen.top'); // res.setHeader('Access-Control-Allow-Origin', 'https://test.vespa.qxyushen.top');
res.setHeader( res.setHeader(
"Access-Control-Allow-Methods", "Access-Control-Allow-Methods",