更新新加需求
This commit is contained in:
@@ -55,6 +55,10 @@ export function useData() {
|
||||
label: "数量(金币/钻石)",
|
||||
prop: "change_value"
|
||||
},
|
||||
{
|
||||
label: "备注",
|
||||
prop: "remarks",
|
||||
},
|
||||
{
|
||||
label: "支付时间",
|
||||
prop: "createtime",
|
||||
|
||||
@@ -9,6 +9,7 @@ import ExportForm from '@/components/exportDialog/index.vue';
|
||||
import {
|
||||
queryList,
|
||||
getRoomDetail,
|
||||
queryClassifyList,
|
||||
deleteRoomData,
|
||||
updateRoomData
|
||||
} from "@/api/modules/room";
|
||||
@@ -35,6 +36,30 @@ export function useData() {
|
||||
{ label: "封禁", value: 2 },
|
||||
{ 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({
|
||||
@@ -114,6 +139,14 @@ export function useData() {
|
||||
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) => {
|
||||
loading.value = true;
|
||||
searchForm.value = { ...formData }
|
||||
@@ -321,6 +354,7 @@ export function useData() {
|
||||
viewDetail,
|
||||
editDialog,
|
||||
viewTurntableData,
|
||||
viewXunLeHuiData
|
||||
viewXunLeHuiData,
|
||||
getListType
|
||||
};
|
||||
}
|
||||
|
||||
@@ -21,13 +21,15 @@ const {
|
||||
loading,
|
||||
exportExcel,
|
||||
editDialog,
|
||||
viewXunLeHuiData
|
||||
viewXunLeHuiData,
|
||||
getListType
|
||||
} = useData();
|
||||
defineOptions({
|
||||
name: "roomList"
|
||||
});
|
||||
onMounted(() => {
|
||||
onSearch(searchForm.value);
|
||||
getListType()
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@ const pagination = ref({
|
||||
currentPage: 1,
|
||||
background: true
|
||||
});
|
||||
const totalConsumption = ref(0)
|
||||
const dynamicColumns = ref([
|
||||
{
|
||||
label: "房间ID",
|
||||
@@ -64,94 +65,45 @@ const onSearch = async (formData) => {
|
||||
});
|
||||
if (code) {
|
||||
tableList.value = data.lists;
|
||||
totalConsumption.value = data.total_consumption;
|
||||
pagination.value.total = data.count;
|
||||
pagination.value.currentPage = data.page;
|
||||
}
|
||||
loading.value = false;
|
||||
}
|
||||
const exportFormRef = ref(null)
|
||||
const exportExcel = () => {
|
||||
const exportExcel = async () => {
|
||||
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 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] || '' })
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
const { data, code } = await queryUnionRoomList({
|
||||
search_stime: searchForm.value.search_stime,
|
||||
search_etime: searchForm.value.search_etime,
|
||||
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}工会下的房间流水统计${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(() => {
|
||||
onSearch(searchForm.value)
|
||||
})
|
||||
@@ -160,10 +112,12 @@ onMounted(() => {
|
||||
<template>
|
||||
<div>
|
||||
<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"
|
||||
@click="exportExcel">
|
||||
<div class="mb-5" style="display: inline-flex; justify-content: flex-end;width: 100%;">
|
||||
<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
|
||||
:loading="loading" row-key="id" adaptive :adaptiveConfig="{ offsetBottom: 108 }" :data="tableList"
|
||||
:columns="dynamicColumns" :pagination="{ ...pagination }" :header-cell-style="{
|
||||
|
||||
Reference in New Issue
Block a user