查询列表

This commit is contained in:
2025-04-07 13:14:56 +08:00
parent d7d08675c6
commit 489112d028
5 changed files with 183 additions and 3 deletions

View File

@@ -15,3 +15,6 @@ export function tkhostdata(data) {
export function dicts(data) {
return postAxios({ url: 'param/dicts', data })
}
export function tkhostdetail(data) {
return postAxios({ url: 'tkinfo/tkhostdetail', data })
}

View File

@@ -0,0 +1,88 @@
<template>
<div ref="chart" style="width: 500px; height: 300px;"></div>
</template>
<script>
import * as echarts from 'echarts';
import { tkhostdata, dicts, tkhostdetail } from '@/api/account';
export default {
name: 'EChartsComponent',
props: {
title: {
type: String,
required: true
},
id: {
type: String,
required: true
},
dataType: {
type: String,
required: true
}
},
mounted() {
this.initChart();
this.getTkhostdetail();
},
methods: {
initChart() {
const myChart = echarts.init(this.$refs.chart);
const option = {
title: {
text: this.title
},
tooltip: {},
legend: {
data: ['销量']
},
xAxis: {
data: ['2025-03-29', '2025-03-30', '2025-03-31', '2025-04-01', '2025-04-02', '2025-04-03']
},
yAxis: {},
series: [
{
name: '金币数',
type: 'line',
data: [23266, 12144, 44467, 86686, 35637, 34534],
smooth: true
}
]
};
myChart.setOption(option);
},
getTkhostdetail() {
tkhostdetail({
hostId: this.id,
dataType: this.dataType,
searchTimeStart: this.getCurrentDate()[0],
searchTimeEnd: this.getCurrentDate()[6]
}).then(res => {
res[0]
})
},
getCurrentDate() {
const dates = [];
const today = new Date();
for (let i = 6; i >= 0; i--) {
const date = new Date(today);
date.setDate(today.getDate() - i);
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
dates.push(`${year}${month}${day}`);
}
return dates;
}
}
};
</script>

View File

@@ -23,8 +23,45 @@
<el-table :data="tableData" stripe>
<el-table-column prop="hostId" label="主播id" width="200" />
<el-table-column prop="hostName" label="主播名字" min-width="200" />
<el-table-column v-for="label in labelList" :prop="label.paramCode" :label="label.paramCodeMeaning"
width="150" />
<el-table-column v-for="label in labelList" :key="label.paramCode" :prop="label.paramCode"
:label="label.paramCodeMeaning" width="120">
<template #default="scope">
<el-popover v-if="!(label.paramCode == 'hostcoins' || label.paramCode == 'ysthostcoins')" placement="bottom"
:width="600" trigger="hover">
<div style="height: 300px;">
<component :is="EChartsComponent" v-if="isPopoverVisible[label.paramCode]"
:title="label.paramCodeMeaning" :id="scope.row.hostId" :dataType="label.paramCode"></component>
</div>
<template #reference>
<span @mouseover="isPopoverVisible[label.paramCode] = true"> {{ scope.row[label.paramCode] }}</span>
</template>
</el-popover>
<el-popover v-else placement="bottom" :width="500" trigger="hover">
<div style="height: 300px;">
<component :is="EChartsComponent" v-if="isPopoverVisible[label.paramCode]"
:title="label.paramCodeMeaning" :id="scope.row.hostId" :dataType="label.paramCode"></component>
</div>
<template #reference>
<span @mouseover="isPopoverVisible[label.paramCode] = true"> {{ scope.row[label.paramCode] }}</span>
</template>
</el-popover>
</template>
</el-table-column>
<el-table-column label="操作">
<template #default="scope">
<div style="display: flex; align-items: center">
<el-button type="primary" @click="getTkhostdetail(scope.row.hostId)">查看</el-button>
</div>
</template>
</el-table-column>
</el-table>
</div>
<div class="center-justify" style="margin-top: 30px;">
@@ -39,8 +76,9 @@
<script setup>
import { getToken, setToken, removeToken } from '@/utils/storage'
import { tkhostdata, dicts } from '@/api/account';
import { tkhostdata, dicts, tkhostdetail } from '@/api/account';
import { ref, reactive, onMounted } from 'vue';
import EChartsComponent from '@/components/EChartsComponent.vue';
let labelList = ref([])
@@ -55,6 +93,9 @@ const searchForm = ref({
let pageSize = ref(10)
let page = ref(1)
let total = ref(0)
//是否渲染
const isPopoverVisible = reactive({})
const options = [
{
@@ -122,6 +163,21 @@ const getdictionary = () => {
})
}
//获取主播信息
const getTkhostdetail = (id) => {
tkhostdetail({
hostId: id,
// page: 1,
searchTimeStart: '20250401',
searchTimeEnd: '20250403'
}).then(res => {
console.log(labelList.value)
})
}
</script>
<style lang="less">