更新
This commit is contained in:
@@ -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";
|
||||
// 声网appId 在这里换
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
<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 { queryBoxTypeList } from "@/api/modules/blindBox";
|
||||
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([
|
||||
{
|
||||
label: "盲盒礼包",
|
||||
@@ -163,6 +167,75 @@ const handleCurrentChange = (val: number) => {
|
||||
pagination.value.currentPage = val;
|
||||
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(() => {
|
||||
getType();
|
||||
});
|
||||
@@ -177,7 +250,9 @@ onMounted(() => {
|
||||
<span />
|
||||
</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"
|
||||
default-expand-all row-key="id" :adaptiveConfig="{ offsetBottom: 108 }" :data="tableList"
|
||||
:columns="dynamicflowColumns" :pagination="{ ...pagination }" :header-cell-style="{
|
||||
|
||||
@@ -35,11 +35,11 @@ export default ({ mode }: ConfigEnv): UserConfigExport => {
|
||||
onProxyReq: (proxyReq, req, res) => {
|
||||
if (req.method === "OPTIONS") {
|
||||
proxyReq.method = "OPTIONS";
|
||||
res.setHeader(
|
||||
"Access-Control-Allow-Origin",
|
||||
"http://adminvs.qxhs.xyz"
|
||||
);
|
||||
// res.setHeader('Access-Control-Allow-Origin', 'http://yushenggliht.qxyushen.top');
|
||||
// res.setHeader(
|
||||
// "Access-Control-Allow-Origin",
|
||||
// "http://adminvs.qxhs.xyz"
|
||||
// );
|
||||
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-Methods",
|
||||
|
||||
Reference in New Issue
Block a user