更新新加需求

This commit is contained in:
yziiy
2025-10-21 17:33:59 +08:00
parent 34b750690f
commit 3e3beca568
4 changed files with 78 additions and 84 deletions

View File

@@ -55,6 +55,10 @@ export function useData() {
label: "数量(金币/钻石)", label: "数量(金币/钻石)",
prop: "change_value" prop: "change_value"
}, },
{
label: "备注",
prop: "remarks",
},
{ {
label: "支付时间", label: "支付时间",
prop: "createtime", prop: "createtime",

View File

@@ -9,6 +9,7 @@ import ExportForm from '@/components/exportDialog/index.vue';
import { import {
queryList, queryList,
getRoomDetail, getRoomDetail,
queryClassifyList,
deleteRoomData, deleteRoomData,
updateRoomData updateRoomData
} from "@/api/modules/room"; } from "@/api/modules/room";
@@ -35,6 +36,30 @@ export function useData() {
{ label: "封禁", value: 2 }, { label: "封禁", value: 2 },
{ label: "关闭", value: 3 } { label: "关闭", value: 3 }
] ]
},
{
label: "是否热门",
prop: "is_hot",
type: "select",
optionList: [
{ label: "是", value: 2 },
{ label: "否", value: 1 }
]
},
{
label: "是否置顶",
prop: "is_top",
type: "select",
optionList: [
{ label: "是", value: 2 },
{ label: "否", value: 1 }
]
},
{
label: "房间类型",
prop: "type_id",
type: "select",
optionList: []
} }
]); ]);
const pagination = ref({ const pagination = ref({
@@ -114,6 +139,14 @@ export function useData() {
slot: "operation" slot: "operation"
} }
]); ]);
const getListType = async () => {
const { data, code } = await queryClassifyList({});
if (code) {
searchLabel.value[searchLabel.value.length - 1].optionList = data.lists.map(ele => {
return { label: ele.type_name, value: ele.id }
})
}
}
const onSearch = async (formData) => { const onSearch = async (formData) => {
loading.value = true; loading.value = true;
searchForm.value = { ...formData } searchForm.value = { ...formData }
@@ -321,6 +354,7 @@ export function useData() {
viewDetail, viewDetail,
editDialog, editDialog,
viewTurntableData, viewTurntableData,
viewXunLeHuiData viewXunLeHuiData,
getListType
}; };
} }

View File

@@ -21,13 +21,15 @@ const {
loading, loading,
exportExcel, exportExcel,
editDialog, editDialog,
viewXunLeHuiData viewXunLeHuiData,
getListType
} = useData(); } = useData();
defineOptions({ defineOptions({
name: "roomList" name: "roomList"
}); });
onMounted(() => { onMounted(() => {
onSearch(searchForm.value); onSearch(searchForm.value);
getListType()
}); });
</script> </script>

View File

@@ -27,6 +27,7 @@ const pagination = ref({
currentPage: 1, currentPage: 1,
background: true background: true
}); });
const totalConsumption = ref(0)
const dynamicColumns = ref([ const dynamicColumns = ref([
{ {
label: "房间ID", label: "房间ID",
@@ -64,94 +65,45 @@ const onSearch = async (formData) => {
}); });
if (code) { if (code) {
tableList.value = data.lists; tableList.value = data.lists;
totalConsumption.value = data.total_consumption;
pagination.value.total = data.count; pagination.value.total = data.count;
pagination.value.currentPage = data.page; pagination.value.currentPage = data.page;
} }
loading.value = false; loading.value = false;
} }
const exportFormRef = ref(null) const exportFormRef = ref(null)
const exportExcel = () => { const exportExcel = async () => {
let exportTableList = [] let exportTableList = []
addDialog({ const { data, code } = await queryUnionRoomList({
title: `导出数据`, search_stime: searchForm.value.search_stime,
props: { search_etime: searchForm.value.search_etime,
formInline: { guild_id: props.rowData.id,
time: '' page: 1,
} page_limit: 20000
},
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 queryUnionRoomList({
...formData,
guild_id: props.rowData.id,
page: 1,
page_limit: 20000
});
if (code) {
exportTableList = data.lists;
const res = exportTableList.map(item => {
const arr = [];
dynamicColumns.value.forEach(column => {
arr.push(item[column.prop as string]);
});
return arr;
});
const titleList = [];
dynamicColumns.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, `${props.rowData.guild_name}工会下的房间流水统计${formData.search_stime} - ${formData.search_etime}.xlsx`);
message("导出成功", {
type: "success"
});
done()
} else {
message("获取数据失败,请重试!", {
type: "error"
});
}
}
FormRef.validate(valid => {
if (valid) {
if (curData.time && curData.time.length) {
exportData({ search_stime: curData.time[0] || '', search_etime: curData.time[1] || '' })
}
}
});
}
}); });
if (code) {
exportTableList = data.lists;
const res = exportTableList.map(item => {
const arr = [];
dynamicColumns.value.forEach(column => {
arr.push(item[column.prop as string]);
});
return arr;
});
const titleList = [];
dynamicColumns.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, `${props.rowData.guild_name}工会下的房间流水统计${searchForm.value.search_stime} - ${searchForm.value.search_etime}.xlsx`);
message("导出成功", {
type: "success"
});
}
} }
// const exportExcel = () => {
// const res = tableList.value.map(item => {
// const arr = [];
// dynamicColumns.value.forEach(column => {
// arr.push(item[column.prop as string]);
// });
// return arr;
// });
// const titleList = [];
// dynamicColumns.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, `房间流水统计第${pagination.value.currentPage}页.xlsx`);
// message("导出成功", {
// type: "success"
// });
// }
onMounted(() => { onMounted(() => {
onSearch(searchForm.value) onSearch(searchForm.value)
}) })
@@ -160,10 +112,12 @@ onMounted(() => {
<template> <template>
<div> <div>
<SearchForm class="pb-2" :LabelList="searchLabel" :formData="searchForm" @handleSearch="onSearch" /> <SearchForm class="pb-2" :LabelList="searchLabel" :formData="searchForm" @handleSearch="onSearch" />
<div class="mb-5" style="display: inline-flex; justify-content: flex-end;width: 100%;"> <el-button type="primary" <div class="mb-5" style="display: inline-flex; justify-content: flex-end;width: 100%;">
@click="exportExcel"> <div style="display: inline-flex;align-items: center;margin-right: 20px;">总流水{{ totalConsumption }}</div>
<el-button type="primary" @click="exportExcel">
导出表格 导出表格
</el-button></div> </el-button>
</div>
<pure-table ref="tableRef" align-whole="center" showOverflowTooltip table-layout="auto" default-expand-all <pure-table ref="tableRef" align-whole="center" showOverflowTooltip table-layout="auto" default-expand-all
:loading="loading" row-key="id" adaptive :adaptiveConfig="{ offsetBottom: 108 }" :data="tableList" :loading="loading" row-key="id" adaptive :adaptiveConfig="{ offsetBottom: 108 }" :data="tableList"
:columns="dynamicColumns" :pagination="{ ...pagination }" :header-cell-style="{ :columns="dynamicColumns" :pagination="{ ...pagination }" :header-cell-style="{