2025-04-03 16:41:54 +08:00
|
|
|
<template>
|
|
|
|
|
<div class="main">
|
|
|
|
|
<div>
|
2025-04-03 20:25:25 +08:00
|
|
|
<div style="display: flex;">
|
2025-04-03 16:41:54 +08:00
|
|
|
<el-select v-model="searchForm.country" placeholder="选择国家" size="large" style="width: 240px">
|
|
|
|
|
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />
|
|
|
|
|
</el-select>
|
2025-04-03 20:25:25 +08:00
|
|
|
<div></div>
|
2025-04-03 16:41:54 +08:00
|
|
|
<el-date-picker v-model="searchForm.time" type="date" value-format="YYYYMMDD" placeholder="选择查询时间" size="large"
|
|
|
|
|
style="margin-left: 50px;" />
|
|
|
|
|
|
2025-04-09 21:07:15 +08:00
|
|
|
<el-button class="serch-button" style="margin-left: 50px;" type="primary" @click="serch">查询</el-button>
|
2025-04-10 18:11:03 +08:00
|
|
|
<el-button class="put-button" :disabled="tableData.length == 0" type="primary"
|
|
|
|
|
@click="exportList">导出Excel数据</el-button>
|
2025-04-03 16:41:54 +08:00
|
|
|
</div>
|
|
|
|
|
|
2025-04-07 18:26:39 +08:00
|
|
|
<div class="hostTable center-justify">
|
2025-04-10 18:11:03 +08:00
|
|
|
<el-table :data="tableData" stripe v-loading="loading" height="500">
|
|
|
|
|
<el-table-column fixed prop="hostId" label="主播id" width="200">
|
2025-04-09 21:07:15 +08:00
|
|
|
<template #default="scope">
|
|
|
|
|
<div class="hostIdText" @click="openHTML(scope.row.hostId)"> {{ scope.row.hostId }}</div>
|
|
|
|
|
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column prop="hostName" label="主播名字" min-width="200">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
{{ scope.row.hostName }}
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
2025-04-10 18:11:03 +08:00
|
|
|
<el-table-column prop="hostlevel" label="等级" width="120">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
{{ scope.row.hostlevel }}
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
2025-04-07 18:26:39 +08:00
|
|
|
<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[`${scope.row.hostId}-${label.paramCode}`]"
|
2025-04-10 18:11:03 +08:00
|
|
|
:title="label.paramCodeMeaning" :id="scope.row.hostId" :dataType="label.paramCode"
|
|
|
|
|
:time="searchForm.time"></component>
|
2025-04-07 18:26:39 +08:00
|
|
|
</div>
|
|
|
|
|
<template #reference>
|
2025-04-09 21:07:15 +08:00
|
|
|
<span @mouseover="openPopover(scope.row.hostId, label.paramCode)"
|
|
|
|
|
@mouseout="closePopover(scope.row.hostId, label.paramCode)">
|
2025-04-07 18:26:39 +08:00
|
|
|
{{ 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[`${scope.row.hostId}-${label.paramCode}`]"
|
2025-04-10 18:11:03 +08:00
|
|
|
:title="label.paramCodeMeaning" :id="scope.row.hostId" :dataType="label.paramCode"
|
|
|
|
|
:time="searchForm.time">
|
|
|
|
|
</component>
|
2025-04-07 18:26:39 +08:00
|
|
|
</div>
|
|
|
|
|
<template #reference>
|
|
|
|
|
<!-- 鼠标移入时开启 -->
|
2025-04-09 21:07:15 +08:00
|
|
|
<span @mouseover="openPopover(scope.row.hostId, label.paramCode)"
|
|
|
|
|
@mouseout="closePopover(scope.row.hostId, label.paramCode)">
|
2025-04-07 18:26:39 +08:00
|
|
|
{{ scope.row[label.paramCode] }}
|
|
|
|
|
</span>
|
|
|
|
|
</template>
|
|
|
|
|
</el-popover>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
|
2025-04-09 21:07:15 +08:00
|
|
|
<!-- <el-table-column label="操作">
|
2025-04-07 18:26:39 +08:00
|
|
|
<template #default="scope">
|
|
|
|
|
<div style="display: flex; align-items: center">
|
|
|
|
|
<el-button type="primary" @click="getTkhostdetail(scope.row.hostId)">查看</el-button>
|
2025-04-07 13:14:56 +08:00
|
|
|
</div>
|
2025-04-07 18:26:39 +08:00
|
|
|
</template>
|
2025-04-09 21:07:15 +08:00
|
|
|
</el-table-column> -->
|
2025-04-07 18:26:39 +08:00
|
|
|
</el-table>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="center-justify" style="margin-top: 30px;">
|
2025-04-10 18:11:03 +08:00
|
|
|
<el-pagination v-model:current-page="page" v-model:page-size="pageSize" background
|
|
|
|
|
layout="sizes, prev, pager, next" :total="total" :page-sizes="[10, 20, 50, 100]"
|
|
|
|
|
@size-change="handleSizeChange" @current-change="handleCurrentChange" />
|
2025-04-07 18:26:39 +08:00
|
|
|
</div>
|
2025-04-03 16:41:54 +08:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup>
|
2025-04-09 21:07:15 +08:00
|
|
|
// import { getToken, setToken, removeToken } from '@/utils/storage'
|
2025-04-10 18:11:03 +08:00
|
|
|
import { tkhostdata, dicts, tkhostdetail, exporthosts, downList } from '@/api/account';
|
2025-04-09 21:07:15 +08:00
|
|
|
import { usePythonBridge, } from '@/utils/pythonBridge'
|
2025-04-10 18:11:03 +08:00
|
|
|
import { getUser } from '@/utils/storage'
|
2025-04-03 16:41:54 +08:00
|
|
|
import { ref, reactive, onMounted } from 'vue';
|
2025-04-07 13:14:56 +08:00
|
|
|
import EChartsComponent from '@/components/EChartsComponent.vue';
|
2025-04-03 16:41:54 +08:00
|
|
|
|
2025-04-09 21:07:15 +08:00
|
|
|
const loading = ref(false)
|
|
|
|
|
//py方法
|
|
|
|
|
const { givePyAnchorId } = usePythonBridge();
|
2025-04-03 16:41:54 +08:00
|
|
|
|
|
|
|
|
let labelList = ref([])
|
|
|
|
|
const tableData = ref([])
|
|
|
|
|
//选择国家
|
|
|
|
|
const searchForm = ref({
|
|
|
|
|
country: '',
|
|
|
|
|
time: ''
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
//分页
|
|
|
|
|
let pageSize = ref(10)
|
|
|
|
|
let page = ref(1)
|
|
|
|
|
let total = ref(0)
|
2025-04-07 13:14:56 +08:00
|
|
|
//是否渲染
|
|
|
|
|
const isPopoverVisible = reactive({})
|
|
|
|
|
|
2025-04-03 16:41:54 +08:00
|
|
|
|
|
|
|
|
const options = [
|
|
|
|
|
{
|
|
|
|
|
value: '日本',
|
|
|
|
|
label: '日本',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
value: '美国',
|
|
|
|
|
label: '美国',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
value: '荷兰',
|
|
|
|
|
label: '荷兰',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
value: '澳大利亚',
|
|
|
|
|
label: '澳大利亚',
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
onMounted(() => {
|
|
|
|
|
getdictionary()
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
function serch() {
|
2025-04-10 18:11:03 +08:00
|
|
|
|
2025-04-03 16:41:54 +08:00
|
|
|
getlist();
|
|
|
|
|
}
|
|
|
|
|
|
2025-04-10 18:11:03 +08:00
|
|
|
function exportList() {
|
|
|
|
|
downList('export/hostsinfo',
|
|
|
|
|
{
|
|
|
|
|
searchTime: searchForm.value.time,
|
|
|
|
|
region: searchForm.value.country,
|
|
|
|
|
pageSize: pageSize.value,
|
|
|
|
|
page: page.value,
|
|
|
|
|
userId: getUser().userId,
|
|
|
|
|
userType: getUser().userType
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
// exporthosts({
|
|
|
|
|
// searchTime: searchForm.value.time,
|
|
|
|
|
// region: searchForm.value.country,
|
|
|
|
|
// pageSize: pageSize.value,
|
|
|
|
|
// page: page.value,
|
|
|
|
|
// userId: getUser().userId,
|
|
|
|
|
// userType: getUser().userType
|
|
|
|
|
// }).then(res => {
|
|
|
|
|
// const blob = new Blob([res], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' });
|
|
|
|
|
// const url = window.URL.createObjectURL(blob);
|
|
|
|
|
// const a = document.createElement('a');
|
|
|
|
|
// a.href = url;
|
|
|
|
|
// a.download = 'table-data.xlsx'; // 下载的文件名
|
|
|
|
|
// document.body.appendChild(a);
|
|
|
|
|
// a.click();
|
|
|
|
|
// a.remove();
|
|
|
|
|
// window.URL.revokeObjectURL(url);
|
|
|
|
|
// })
|
|
|
|
|
}
|
|
|
|
|
function handleSizeChange(val) {
|
|
|
|
|
console.log(`${val} items per page`)
|
|
|
|
|
getlist();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
function handleCurrentChange(val) {
|
|
|
|
|
console.log(`current page: ${val}`)
|
|
|
|
|
getlist();
|
|
|
|
|
|
|
|
|
|
}
|
2025-04-03 20:25:25 +08:00
|
|
|
//获取主播列表
|
2025-04-03 16:41:54 +08:00
|
|
|
const getlist = () => {
|
2025-04-09 21:07:15 +08:00
|
|
|
loading.value = true
|
2025-04-03 16:41:54 +08:00
|
|
|
tkhostdata({
|
|
|
|
|
searchTime: searchForm.value.time,
|
|
|
|
|
region: searchForm.value.country,
|
|
|
|
|
pageSize: pageSize.value,
|
2025-04-10 18:11:03 +08:00
|
|
|
page: page.value,
|
|
|
|
|
userId: getUser().userId,
|
|
|
|
|
userType: getUser().userType
|
2025-04-03 16:41:54 +08:00
|
|
|
}).then(res => {
|
2025-04-09 21:07:15 +08:00
|
|
|
loading.value = false
|
2025-04-03 16:41:54 +08:00
|
|
|
total.value = res.total
|
|
|
|
|
tableData.value = []
|
|
|
|
|
res.records.forEach(item => {
|
|
|
|
|
item = { ...item, ...item.infoMap }
|
|
|
|
|
tableData.value.push(item)
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
}
|
2025-04-03 20:25:25 +08:00
|
|
|
//获取字典
|
2025-04-03 16:41:54 +08:00
|
|
|
const getdictionary = () => {
|
|
|
|
|
dicts({
|
|
|
|
|
paramType: "hostsdata",
|
|
|
|
|
// page: 1,
|
|
|
|
|
offset: 1,
|
|
|
|
|
pageSize: 100
|
|
|
|
|
}).then(res => {
|
|
|
|
|
// labelList.value = res.records
|
|
|
|
|
labelList.value = res
|
|
|
|
|
console.log(labelList.value)
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
}
|
2025-04-07 13:14:56 +08:00
|
|
|
//获取主播信息
|
|
|
|
|
const getTkhostdetail = (id) => {
|
|
|
|
|
tkhostdetail({
|
|
|
|
|
hostId: id,
|
|
|
|
|
// page: 1,
|
|
|
|
|
searchTimeStart: '20250401',
|
|
|
|
|
searchTimeEnd: '20250403'
|
|
|
|
|
}).then(res => {
|
|
|
|
|
|
|
|
|
|
console.log(labelList.value)
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2025-04-09 21:07:15 +08:00
|
|
|
|
|
|
|
|
function openPopover(hostId, paramCode) {
|
|
|
|
|
|
|
|
|
|
isPopoverVisible[`${hostId}-${paramCode}`] = true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function closePopover(hostId, paramCode) {
|
|
|
|
|
|
|
|
|
|
// isPopoverVisible[`${hostId}-${paramCode}`] = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function openHTML(id) {
|
|
|
|
|
givePyAnchorId(id)
|
|
|
|
|
|
|
|
|
|
}
|
2025-04-03 16:41:54 +08:00
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="less">
|
|
|
|
|
.main {
|
2025-04-03 20:25:25 +08:00
|
|
|
box-sizing: border-box;
|
2025-04-10 18:11:03 +08:00
|
|
|
// height: 100vh;
|
2025-04-03 20:25:25 +08:00
|
|
|
width: 100%;
|
|
|
|
|
padding: 40px;
|
|
|
|
|
|
|
|
|
|
.hostTable {
|
|
|
|
|
width: 100%;
|
|
|
|
|
padding: 40px 0;
|
2025-04-09 21:07:15 +08:00
|
|
|
|
|
|
|
|
.hostIdText {
|
|
|
|
|
text-decoration: underline;
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
color: #0f0092;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.serch-button {
|
|
|
|
|
width: 80px;
|
|
|
|
|
height: 47px;
|
|
|
|
|
background: #E7CA92;
|
|
|
|
|
border-radius: 10px;
|
2025-04-10 18:11:03 +08:00
|
|
|
border: none;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.put-button {
|
|
|
|
|
width: 132px;
|
|
|
|
|
height: 47px;
|
|
|
|
|
background: #E7CA92;
|
|
|
|
|
border-radius: 10px;
|
|
|
|
|
border: none;
|
|
|
|
|
|
2025-04-03 20:25:25 +08:00
|
|
|
}
|
2025-04-03 16:41:54 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.center-line {
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
align-items: center;
|
|
|
|
|
// justify-content: center;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.center-justify {
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: space-around;
|
|
|
|
|
align-items: center;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.center-align {
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.center-flex {
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
align-items: center;
|
|
|
|
|
}
|
2025-04-09 21:07:15 +08:00
|
|
|
</style>
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|
::v-deep(.el-input__wrapper) {
|
|
|
|
|
background-color: #F2FAF9;
|
|
|
|
|
border: 1px solid #B7CEC5;
|
|
|
|
|
height: 48px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
::v-deep(.el-select__wrapper) {
|
|
|
|
|
background-color: #F2FAF9;
|
|
|
|
|
border: 1px solid #B7CEC5;
|
|
|
|
|
height: 48px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
::v-deep(.el-pagination.is-background .el-pager li.is-active) {
|
|
|
|
|
background-color: #338F6A;
|
|
|
|
|
}
|
2025-04-03 16:41:54 +08:00
|
|
|
</style>
|