更新
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from "vue";
|
||||
import RichText from '@/components/RichText/index.vue';
|
||||
const ruleFormRef = ref();
|
||||
const formRules = ref({
|
||||
version: [{ required: true, message: "版本号为必填项", trigger: "blur" }],
|
||||
@@ -31,7 +32,9 @@ const newFormInline = ref(
|
||||
function getRef() {
|
||||
return ruleFormRef.value;
|
||||
}
|
||||
|
||||
function chanageEditorValue(val) {
|
||||
newFormInline.value.content = val
|
||||
}
|
||||
defineExpose({ getRef });
|
||||
</script>
|
||||
|
||||
@@ -53,7 +56,9 @@ defineExpose({ getRef });
|
||||
<el-input v-model="newFormInline.downloadurl" clearable placeholder="请输入下载链接" />
|
||||
</el-form-item>
|
||||
<el-form-item label="更新内容" prop="content">
|
||||
<el-input v-model="newFormInline.content" type="textarea" clearable placeholder="请输入更新内容" />
|
||||
<RichText style="border: 1px solid #ccc;" :echoValue="newFormInline.content" @changeValue="chanageEditorValue">
|
||||
</RichText>
|
||||
<!-- <el-input v-model="newFormInline.content" type="textarea" clearable placeholder="请输入更新内容" /> -->
|
||||
</el-form-item>
|
||||
<el-form-item label="强制更新" prop="enforce">
|
||||
<el-radio-group v-model="newFormInline.enforce">
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted } from "vue";
|
||||
import { ref, onMounted, h } from "vue";
|
||||
import ExportForm from '@/components/exportDialog/index.vue';
|
||||
import { utils, writeFile } from "xlsx";
|
||||
const exportFormRef = ref(null)
|
||||
import { addDialog } from "@/components/ReDialog";
|
||||
import { message } from "@/utils/message";
|
||||
const props = defineProps(["userInfo"]);
|
||||
import {
|
||||
userLogData,
|
||||
@@ -44,7 +49,6 @@ const getLogData = async (type) => {
|
||||
}
|
||||
const getPhotoAlbum = async () => {
|
||||
const { data, code } = await userPhotoAlbum({ user_id: userData.value.userId })
|
||||
// console.log(data, code, '相册')
|
||||
photoAlbums.value = code ? data : []
|
||||
}
|
||||
const deleteAlbum = async (rowData) => {
|
||||
@@ -102,6 +106,64 @@ const handleCurrentChange = (val: number) => {
|
||||
getLogData(activeIndex.value == '1' ? 1 : 2)
|
||||
};
|
||||
//
|
||||
const exportTable = (activeIndex) => {
|
||||
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 userLogData({
|
||||
user_id: userData.value.userId, type: activeIndex.value == '1' ? 1 : 2, page: 1, page_limit: 10000
|
||||
})
|
||||
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);
|
||||
console.log(titleList)
|
||||
const workSheet = utils.aoa_to_sheet(res);
|
||||
const workBook = utils.book_new();
|
||||
utils.book_append_sheet(workBook, workSheet, "数据报表");
|
||||
writeFile(workBook, `${activeIndex.value == '1' ? '金币' : '钻石'}统计——${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] || '' })
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<div class="viewPage">
|
||||
@@ -124,9 +186,13 @@ const handleCurrentChange = (val: number) => {
|
||||
</div>
|
||||
<div style="margin-top: 20px;">
|
||||
<el-tabs v-model="activeIndex" @tab-click="handleClick">
|
||||
|
||||
<el-tab-pane label="金币收支" name="1">
|
||||
<pure-table ref="tableRef" align-whole="center" showOverflowTooltip table-layout="auto"
|
||||
:adaptiveConfig="{ offsetBottom: 108 }" :data="tableList" :columns="dynamicColumns"
|
||||
<div class="mb-5" style="float: right;">
|
||||
<el-button @click="exportTable(activeIndex)" type="primary">导出当前表格</el-button>
|
||||
</div>
|
||||
<pure-table v-if="activeIndex == 1" ref="tableRef" align-whole="center" showOverflowTooltip
|
||||
table-layout="auto" :adaptiveConfig="{ offsetBottom: 108 }" :data="tableList" :columns="dynamicColumns"
|
||||
:pagination="{ ...pagination }" @page-size-change="handleSizeChange"
|
||||
@page-current-change="handleCurrentChange" :header-cell-style="{
|
||||
background: 'var(--el-fill-color-light)',
|
||||
@@ -135,8 +201,11 @@ const handleCurrentChange = (val: number) => {
|
||||
</pure-table>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="钻石收支" name="2">
|
||||
<pure-table ref="tableRef" align-whole="center" showOverflowTooltip table-layout="auto"
|
||||
:adaptiveConfig="{ offsetBottom: 108 }" @page-size-change="handleSizeChange"
|
||||
<div class="mb-5" style="float: right;">
|
||||
<el-button @click="exportTable(activeIndex)" type="primary">导出当前表格</el-button>
|
||||
</div>
|
||||
<pure-table v-if="activeIndex == 2" ref="tableRef" align-whole="center" showOverflowTooltip
|
||||
table-layout="auto" :adaptiveConfig="{ offsetBottom: 108 }" @page-size-change="handleSizeChange"
|
||||
@page-current-change="handleCurrentChange" :data="tableList" :columns="dynamicColumns"
|
||||
:pagination="{ ...pagination }" :header-cell-style="{
|
||||
background: 'var(--el-fill-color-light)',
|
||||
@@ -146,28 +215,32 @@ const handleCurrentChange = (val: number) => {
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="ta的相册" name="3">
|
||||
<!-- {{ photoAlbums }} -->
|
||||
<div v-if="photoAlbums.length > 0" class="albums-container">
|
||||
<div v-for="(album, index) in photoAlbums" :key="index" class="album-card" @click="openAlbum(album)">
|
||||
<img :src="album.image" class="album-cover" alt="Album cover">
|
||||
<div class="album-info">
|
||||
<div class="album-title">{{ album.name }}</div>
|
||||
<div class="album-stats">
|
||||
<span><i class="fas fa-images"></i> {{ album.img_num }} 张照片</span>
|
||||
<!-- <el-popconfirm title="确定删除吗?" @confirm="deleteAlbum(album)">
|
||||
<template v-if="activeIndex == 3">
|
||||
<div v-if="photoAlbums.length > 0" class="albums-container">
|
||||
<div v-for="(album, index) in photoAlbums" :key="index" class="album-card" @click="openAlbum(album)">
|
||||
<img :src="album.image" class="album-cover" alt="Album cover">
|
||||
<div class="album-info">
|
||||
<div class="album-title">{{ album.name }}</div>
|
||||
<div class="album-stats">
|
||||
<span><i class="fas fa-images"></i> {{ album.img_num }} 张照片</span>
|
||||
<!-- <el-popconfirm title="确定删除吗?" @confirm="deleteAlbum(album)">
|
||||
<el-button size="small">删除</el-button>
|
||||
</el-popconfirm> -->
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else class="empty-album">
|
||||
<i class="fas fa-images"></i>
|
||||
<h3>暂无相册</h3>
|
||||
<p>该用户还没有创建任何相册</p>
|
||||
</div>
|
||||
<div v-else class="empty-album">
|
||||
<i class="fas fa-images"></i>
|
||||
<h3>暂无相册</h3>
|
||||
<p>该用户还没有创建任何相册</p>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { h, ref, nextTick } from "vue";
|
||||
import editForm from "./form.vue";
|
||||
import { ElMessageBox } from "element-plus";
|
||||
import ExportForm from '@/components/exportDialog/index.vue';
|
||||
import { utils, writeFile } from "xlsx";
|
||||
import detailView from './detail.vue';
|
||||
@@ -399,67 +400,64 @@ export function useData() {
|
||||
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 queryGiftGiveList({
|
||||
...formData,
|
||||
send_user: searchForm.value.send_user,
|
||||
gift_user: searchForm.value.gift_user,
|
||||
from_id: searchForm.value.from_id,
|
||||
gift_id: searchForm.value.gift_id,
|
||||
from: searchForm.value.from,
|
||||
page: 1,
|
||||
page_limit: 20000
|
||||
});
|
||||
if (code) {
|
||||
exportTableList = data.lists;
|
||||
const res = exportTableList.map(item => {
|
||||
const arr = [];
|
||||
tableLabel.value.forEach(column => {
|
||||
arr.push(item[column.prop as string]);
|
||||
});
|
||||
return arr;
|
||||
});
|
||||
const titleList = [];
|
||||
tableLabel.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] || '' })
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
// 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 queryList({
|
||||
// ...searchForm.value,
|
||||
// coin1: searchForm.value.coin1 ? searchForm.value.coin1 : '',
|
||||
// coin2: searchForm.value.coin2 ? searchForm.value.coin2 : '',
|
||||
// page: pagination.value.currentPage,
|
||||
// page_limit: pagination.value.pageSize
|
||||
// });
|
||||
// if (code) {
|
||||
// exportTableList = data.lists;
|
||||
// const res = exportTableList.map(item => {
|
||||
// const arr = [];
|
||||
// tableLabel.value.forEach(column => {
|
||||
// arr.push(item[column.prop as string]);
|
||||
// });
|
||||
// return arr;
|
||||
// });
|
||||
// const titleList = [];
|
||||
// tableLabel.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] || '' })
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
// });
|
||||
|
||||
}
|
||||
// 修改密码
|
||||
|
||||
@@ -36,8 +36,10 @@ const statisticsList = ref([
|
||||
label: "总礼物价值(收入)", prop: "total_gift_money"
|
||||
},
|
||||
{ label: "统计(收入/支出)", prop: "ratio", tip: "%" },
|
||||
{ label: "盈亏(收入-支出)", prop: "profit_loss" },
|
||||
{ label: "盈亏比(盈亏/支出)", prop: "profit_loss_ratio", tip: "%" },
|
||||
{ label: "用户盈亏", prop: "profit_loss" },
|
||||
{ label: "用户盈亏比", prop: "profit_loss_ratio", tip: "%" },
|
||||
{ label: "平台盈亏", prop: "platform_profit_loss" },
|
||||
{ label: "平台盈亏比", prop: "platform_profit_loss_ratio", tip: "%" },
|
||||
])
|
||||
const dynamicflowColumns = ref([
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user