导出删除数据
This commit is contained in:
@@ -99,3 +99,18 @@ export const getSimpleUserList = (): Promise<UserVO[]> => {
|
||||
export const getSimpleUserListPage = (params: PageParam): Promise<UserVO[]> => {
|
||||
return request.get({ url: '/system/user/page', params })
|
||||
}
|
||||
|
||||
|
||||
// 获取国家
|
||||
export const getCountry = (country) => {
|
||||
return request.get({ url: '/server/country-info/get?region='+ country })
|
||||
}
|
||||
// 获取本人建联率
|
||||
export const getComplete = () => {
|
||||
return request.get({ url: '/server/employee-hosts/self_complete'})
|
||||
}
|
||||
|
||||
// 获取员工建联率
|
||||
export const getEmployeeComplete = (id) => {
|
||||
return request.get({ url: '/server/employee-hosts/employeeComplete?userId='+id})
|
||||
}
|
||||
|
||||
58
src/components/MobilePagination.vue
Normal file
58
src/components/MobilePagination.vue
Normal file
@@ -0,0 +1,58 @@
|
||||
<template>
|
||||
<div class="mobile-pagination">
|
||||
<el-button type="primary" size="small" :disabled="currentPage <= 1" @click="loadPreviousPage">
|
||||
{{ $t('employee.previous') || '上一页' }}
|
||||
</el-button>
|
||||
<span class="page-info">
|
||||
{{ currentPage }} / {{ totalPages }}
|
||||
</span>
|
||||
<el-button type="primary" size="small" :disabled="currentPage >= totalPages" @click="loadNextPage">
|
||||
{{ $t('employee.loadNext') || '下一页' }}
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed, defineProps, defineEmits } from 'vue'
|
||||
const { t } = useI18n() // 国际化
|
||||
|
||||
const props = defineProps({
|
||||
page: { type: Number, required: true },
|
||||
limit: { type: Number, required: true },
|
||||
total: { type: Number, required: true }
|
||||
})
|
||||
|
||||
const emits = defineEmits(['update:page', 'load', 'loadPre'])
|
||||
|
||||
const totalPages = computed(() => Math.ceil(props.total / props.limit))
|
||||
const currentPage = computed(() => props.page)
|
||||
|
||||
const loadNextPage = () => {
|
||||
if (currentPage.value < totalPages.value) {
|
||||
emits('update:page', currentPage.value)
|
||||
emits('load') // 触发外部方法加载下一页数据
|
||||
}
|
||||
}
|
||||
|
||||
const loadPreviousPage = () => {
|
||||
if (currentPage.value > 1) {
|
||||
emits('update:page', currentPage.value)
|
||||
emits('loadPre')
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.mobile-pagination {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
margin: 16px 0;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.page-info {
|
||||
font-size: 14px;
|
||||
color: #666;
|
||||
}
|
||||
</style>
|
||||
@@ -172,7 +172,7 @@ export default {
|
||||
transactionAmount: 'Transaction amount',
|
||||
totalShopping: 'Total Shopping',
|
||||
monthlySales: 'Monthly sales',
|
||||
userAccessSource: 'User access source',
|
||||
userAccessSource: 'Jianlian rate',
|
||||
january: 'January',
|
||||
february: 'February',
|
||||
march: 'March',
|
||||
@@ -194,6 +194,8 @@ export default {
|
||||
searchEngines: 'Search engines',
|
||||
weeklyUserActivity: 'Weekly user activity',
|
||||
activeQuantity: 'Active quantity',
|
||||
alreadyJianlian:'Already alliance',
|
||||
noAlliance:'No alliance',
|
||||
monday: 'Monday',
|
||||
tuesday: 'Tuesday',
|
||||
wednesday: 'Wednesday',
|
||||
@@ -476,7 +478,8 @@ export default {
|
||||
onlineFans: 'Online Viewers',
|
||||
fans: 'Followers',
|
||||
fllowernum: 'Following',
|
||||
hostsCountry: 'Host Country',
|
||||
hostsCountry: 'Host Area',
|
||||
hostsCountryinfo: 'Host Country',
|
||||
placeHostsCountry: 'Please select host country',
|
||||
hostsKind: 'Host Type',
|
||||
placeHostsKind: 'Please enter live type, e.g., game',
|
||||
@@ -538,7 +541,10 @@ export default {
|
||||
delete: 'Delete',
|
||||
primaryKey: 'ID',
|
||||
action: 'Action',
|
||||
remark: 'Remark'
|
||||
remark: 'Remark',
|
||||
loadNext:'Next',
|
||||
previous:'上一页',
|
||||
|
||||
},
|
||||
country: {
|
||||
greece: 'Greece Region',
|
||||
|
||||
@@ -179,7 +179,7 @@ export default {
|
||||
transactionAmount: '成交金额',
|
||||
totalShopping: '购物总量',
|
||||
monthlySales: '每月销售额',
|
||||
userAccessSource: '用户访问来源',
|
||||
userAccessSource: '建联率',
|
||||
january: '一月',
|
||||
february: '二月',
|
||||
march: '三月',
|
||||
@@ -201,6 +201,8 @@ export default {
|
||||
searchEngines: '搜索引擎',
|
||||
weeklyUserActivity: '每周用户活跃量',
|
||||
activeQuantity: '活跃量',
|
||||
alreadyJianlian:'已建联',
|
||||
noAlliance:'未建联',
|
||||
monday: '周一',
|
||||
tuesday: '周二',
|
||||
wednesday: '周三',
|
||||
@@ -476,7 +478,8 @@ export default {
|
||||
onlineFans: '在线人数',
|
||||
fans: '粉丝数量',
|
||||
fllowernum: '关注数量',
|
||||
hostsCountry: '主播国家',
|
||||
hostsCountry: '主播地区',
|
||||
hostsCountryinfo: '主播国家',
|
||||
placeHostsCountry: '请选择主播国家',
|
||||
hostsKind: '主播类型',
|
||||
placeHostsKind: '请输入直播类型 如:游戏 ',
|
||||
@@ -538,7 +541,9 @@ export default {
|
||||
delete: '删除',
|
||||
primaryKey: '主键',
|
||||
action: '操作',
|
||||
remark: '备注'
|
||||
remark: '备注',
|
||||
loadNext:'下一页',
|
||||
previous:'上一页',
|
||||
},
|
||||
country: {
|
||||
greece: '希腊大区',
|
||||
|
||||
@@ -71,7 +71,18 @@
|
||||
</el-skeleton>
|
||||
</el-card>
|
||||
|
||||
<!-- <el-card shadow="never" class="mt-8px">
|
||||
<el-card shadow="never" class="mt-8px">
|
||||
|
||||
<div style="display: flex; width: 50%;"
|
||||
v-if="wsCache.get('roleRouters').find(item => item.id === 1)?.children.find(item => item.id === 100)">
|
||||
|
||||
<el-select v-model="allocationUser" :placeholder="t('newHosts.placeAllocationUser')" clearable
|
||||
@change="getUserAccessSource(allocationUser)">
|
||||
<el-option v-for="(user, index) in allocationUserList" :key="index" :label="user.label"
|
||||
:value="user.value" />
|
||||
</el-select>
|
||||
</div>
|
||||
|
||||
<el-skeleton :loading="loading" animated>
|
||||
<el-row :gutter="20" justify="space-between">
|
||||
<el-col :xl="10" :lg="10" :md="24" :sm="24" :xs="24">
|
||||
@@ -81,16 +92,16 @@
|
||||
</el-skeleton>
|
||||
</el-card>
|
||||
</el-col>
|
||||
<el-col :xl="14" :lg="14" :md="24" :sm="24" :xs="24">
|
||||
<!-- <el-col :xl="14" :lg="14" :md="24" :sm="24" :xs="24">
|
||||
<el-card shadow="hover" class="mb-8px">
|
||||
<el-skeleton :loading="loading" animated>
|
||||
<Echart :options="barOptionsData" :height="280" />
|
||||
</el-skeleton>
|
||||
</el-card>
|
||||
</el-col>
|
||||
</el-col> -->
|
||||
</el-row>
|
||||
</el-skeleton>
|
||||
</el-card> -->
|
||||
</el-card>
|
||||
</el-col>
|
||||
<el-col :xl="8" :lg="8" :md="24" :sm="24" :xs="24" class="mb-8px">
|
||||
<!-- 快捷入口 -->
|
||||
@@ -155,10 +166,20 @@ import { useUserStore } from '@/store/modules/user'
|
||||
import type { WorkplaceTotal, Project, Notice, Shortcut } from './types'
|
||||
import { pieOptions, barOptions } from './echarts-data'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { getComplete, getEmployeeComplete } from '@/api/system/user'
|
||||
import { useCache } from '@/hooks/web/useCache'
|
||||
import { getSimpleUserListPage, getSimpleUserList } from '@/api/system/user'
|
||||
// import { useGlobalWebSocket } from '@/components/useGlobalWebSocket'
|
||||
// let messageList = useGlobalWebSocket().messageList
|
||||
// console.log(messageList.value)
|
||||
|
||||
const { wsCache } = useCache()
|
||||
let allocationUser = ref('') //选中的分配用户
|
||||
let allocationUserList = ref([
|
||||
{
|
||||
label: '分配用户1',
|
||||
value: 1
|
||||
}
|
||||
]) //选中的分配用户
|
||||
|
||||
// function test() {
|
||||
// console.log(messageList.value)
|
||||
@@ -324,13 +345,16 @@ const getShortcut = async () => {
|
||||
}
|
||||
|
||||
// 用户来源
|
||||
const getUserAccessSource = async () => {
|
||||
const getUserAccessSource = async (id) => {
|
||||
const res = id ? await getEmployeeComplete(id) : await getComplete()
|
||||
const completeData = res ?? { unfinishedNum: 0, finishedNum: 0 }
|
||||
console.log('completeData', completeData)
|
||||
const data = [
|
||||
{ value: 335, name: 'analysis.directAccess' },
|
||||
{ value: 310, name: 'analysis.mailMarketing' },
|
||||
{ value: 234, name: 'analysis.allianceAdvertising' },
|
||||
{ value: 135, name: 'analysis.videoAdvertising' },
|
||||
{ value: 1548, name: 'analysis.searchEngines' }
|
||||
{ value: completeData.unfinishedNum, name: 'analysis.noAlliance' },
|
||||
{ value: completeData.finishedNum, name: 'analysis.alreadyJianlian' },
|
||||
// { value: 234, name: 'analysis.allianceAdvertising' },
|
||||
// { value: 135, name: 'analysis.videoAdvertising' },
|
||||
// { value: 1548, name: 'analysis.searchEngines' }
|
||||
]
|
||||
set(
|
||||
pieOptionsData,
|
||||
@@ -377,7 +401,7 @@ const getAllApi = async () => {
|
||||
getProject(),
|
||||
getNotice(),
|
||||
getShortcut(),
|
||||
getUserAccessSource(),
|
||||
getUserAccessSource(null),
|
||||
getWeeklyUserActivity()
|
||||
])
|
||||
loading.value = false
|
||||
@@ -391,5 +415,30 @@ const handleShortcutClick = (url: string) => {
|
||||
router.push(url)
|
||||
}
|
||||
|
||||
/** 查询员工 */
|
||||
const getAllocationList = async () => {
|
||||
loading.value = true
|
||||
allocationUserList.value = []
|
||||
try {
|
||||
const data = await getSimpleUserList()
|
||||
console.log('data', data)
|
||||
data.forEach((item) => {
|
||||
if (wsCache.get('user').user.id == item.id) {
|
||||
|
||||
} else {
|
||||
allocationUserList.value.push({
|
||||
label: item.nickname,
|
||||
value: item.id
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
console.log(allocationUserList.value)
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
getAllApi()
|
||||
getAllocationList()
|
||||
</script>
|
||||
|
||||
@@ -43,13 +43,20 @@
|
||||
<el-input v-model="queryParams.fllowernumMax" :placeholder="$t('employee.max')" clearable
|
||||
@keyup.enter="handleQuery" class="!w-115px" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('employee.hostsCountry')" prop="country">
|
||||
<el-select v-model="queryParams.country" :placeholder="$t('employee.placeHostsCountry')" clearable
|
||||
class="!w-240px">
|
||||
<el-form-item :label="t('newHosts.hostsCountry')" prop="region">
|
||||
<el-select v-model="queryParams.region" :placeholder="t('newHosts.placeHostsCountry')" clearable
|
||||
class="!w-240px" @change="changeCountry(queryParams.region)">
|
||||
<el-option v-for="dict in getStrDictOptions(DICT_TYPE.COUNTRY_GROUP)" :key="dict.value"
|
||||
:label="$t(dict.label)" :value="dict.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item :label="t('newHosts.hostsCountryinfo')" prop="country">
|
||||
<el-select v-model="queryParams.country" :placeholder="t('newHosts.placeHostsCountry')" clearable
|
||||
class="!w-240px">
|
||||
<el-option v-for="dict in countryinfoList" :key="dict.id" :label="dict.countryName"
|
||||
:value="dict.countryName" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('employee.hostsKind')" prop="hostsKind">
|
||||
<el-input v-model="queryParams.hostsKind" :placeholder="$t('employee.placeHostsKind')" clearable
|
||||
@keyup.enter="handleQuery" class="!w-240px" />
|
||||
@@ -155,7 +162,7 @@
|
||||
</el-table>
|
||||
|
||||
<!-- ✅ 移动端使用卡片列表 -->
|
||||
<div v-else v-infinite-scroll="loadList">
|
||||
<div v-else>
|
||||
<div v-for="(item, index) in list" :key="index" class="mobile-card">
|
||||
<div class="card-row" style="color:green;">
|
||||
<b>{{ $t('employee.hostsId') }}:</b><span @click="openHtml(item, item.hostsId)"
|
||||
@@ -174,14 +181,16 @@
|
||||
<div class="card-row"><b>{{ $t('employee.operationStatus') }}:</b>
|
||||
<dict-tag :type="DICT_TYPE.OPERATION_STATE" :value="item.operationStatus" />
|
||||
</div>
|
||||
<div class="card-row"><b>{{ $t('employee.createTime') }}:</b>{{ item.createTime }}</div>
|
||||
<div class="card-row"><b>{{ $t('employee.updateTime') }}:</b>{{ item.updateTime }}</div>
|
||||
<div class="card-row"><b>{{ $t('employee.createTime') }}:</b>{{ formatTimestamp(item.createTime) }}</div>
|
||||
<div class="card-row"><b>{{ $t('employee.updateTime') }}:</b>{{ formatTimestamp(item.updateTime) }}</div>
|
||||
<div class="card-row action-row">
|
||||
<el-button link type="primary" @click="openForm('update', item.id, index)">{{ $t('employee.edit')
|
||||
}}</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<MobilePagination v-if="isMobile" :page="queryParams.pageNo" :limit="queryParams.pageSize" :total="total"
|
||||
@update:page="val => queryParams.pageNo = val" @load="loadList" @loadPre="loadpreviousList" />
|
||||
|
||||
<!-- ✅ PC 显示分页,移动端隐藏 -->
|
||||
<Pagination v-if="!isMobile" :total="total" v-model:page="queryParams.pageNo" v-model:limit="queryParams.pageSize"
|
||||
@@ -199,9 +208,10 @@ import { dateFormatter } from '@/utils/formatTime'
|
||||
import download from '@/utils/download'
|
||||
import { EmployeeHostsApi, EmployeeHostsVO } from '@/api/server/employeehosts'
|
||||
import EmployeeHostsForm from './EmployeeHostsForm.vue'
|
||||
import { getAllocation } from '@/api/system/user'
|
||||
import { getAllocation, getCountry } from '@/api/system/user'
|
||||
import { useCache } from '@/hooks/web/useCache'
|
||||
import { func } from 'vue-types'
|
||||
import MobilePagination from '@/components/MobilePagination.vue'
|
||||
|
||||
const { wsCache } = useCache()
|
||||
|
||||
@@ -216,7 +226,7 @@ const list = ref<EmployeeHostsVO[]>([]) // 列表的数据
|
||||
const total = ref(0) // 列表的总页数
|
||||
const queryParams = reactive({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
pageSize: 20,
|
||||
hostsId: undefined,
|
||||
hostsLevel: undefined,
|
||||
onlineFansMin: undefined,
|
||||
@@ -230,6 +240,7 @@ const queryParams = reactive({
|
||||
invitationType: undefined,
|
||||
yesterdayCoins: undefined,
|
||||
country: undefined,
|
||||
region: undefined,
|
||||
hostsKind: undefined,
|
||||
isAssigned: undefined,
|
||||
createTime: [],
|
||||
@@ -247,6 +258,7 @@ let allocationUserList = ref([
|
||||
]) //选中的分配用户
|
||||
let selectHostList = ref([]) //选中的主播列表
|
||||
let allocationUser = ref() //选中的分配用户
|
||||
let countryinfoList = ref([])
|
||||
/** 查询列表pc直接赋值 */
|
||||
const getList = async () => {
|
||||
loading.value = true
|
||||
@@ -361,13 +373,20 @@ function openHtml(item, id) {
|
||||
window.open(`https://www.tiktok.com/@${id}`)
|
||||
|
||||
}
|
||||
|
||||
const loadList = () => {
|
||||
if (queryParams.pageNo < Math.ceil(total.value / queryParams.pageSize)) {
|
||||
queryParams.pageNo++
|
||||
getListPhone()
|
||||
getList()
|
||||
}
|
||||
}
|
||||
|
||||
const loadpreviousList = () => {
|
||||
if (queryParams.pageNo > 1) {
|
||||
queryParams.pageNo--
|
||||
getList()
|
||||
}
|
||||
}
|
||||
|
||||
function formSuccess(data, index) {
|
||||
if (isMobile.value) {
|
||||
console.log(data, index)
|
||||
@@ -378,6 +397,19 @@ function formSuccess(data, index) {
|
||||
|
||||
}
|
||||
|
||||
function formatTimestamp(milliseconds) {
|
||||
const date = new Date(milliseconds); // 直接使用毫秒级时间戳
|
||||
const year = date.getFullYear();
|
||||
const month = String(date.getMonth() + 1).padStart(2, '0');
|
||||
const day = String(date.getDate()).padStart(2, '0');
|
||||
const hours = String(date.getHours()).padStart(2, '0');
|
||||
const minutes = String(date.getMinutes()).padStart(2, '0');
|
||||
const seconds = String(date.getSeconds()).padStart(2, '0');
|
||||
|
||||
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
||||
}
|
||||
|
||||
|
||||
//分配按钮操作
|
||||
const handleSelectionChange = (val) => {
|
||||
selectHostList.value = val
|
||||
@@ -475,7 +507,13 @@ onMounted(() => {
|
||||
|
||||
})
|
||||
|
||||
function changeCountry(region) {
|
||||
console.log(region)
|
||||
getCountry(region).then((res) => {
|
||||
countryinfoList.value = res
|
||||
|
||||
})
|
||||
}
|
||||
// /** 初始化 **/
|
||||
// onMounted(() => {
|
||||
// getList()
|
||||
|
||||
@@ -43,13 +43,20 @@
|
||||
<el-input v-model="queryParams.fllowernumMax" :placeholder="$t('employee.max')" clearable
|
||||
@keyup.enter="handleQuery" class="!w-115px" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('employee.hostsCountry')" prop="country">
|
||||
<el-select v-model="queryParams.country" :placeholder="$t('employee.placeHostsCountry')" clearable
|
||||
class="!w-240px">
|
||||
<el-form-item :label="t('newHosts.hostsCountry')" prop="region">
|
||||
<el-select v-model="queryParams.region" :placeholder="t('newHosts.placeHostsCountry')" clearable
|
||||
class="!w-240px" @change="changeCountry(queryParams.region)">
|
||||
<el-option v-for="dict in getStrDictOptions(DICT_TYPE.COUNTRY_GROUP)" :key="dict.value"
|
||||
:label="$t(dict.label)" :value="dict.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item :label="t('newHosts.hostsCountryinfo')" prop="country">
|
||||
<el-select v-model="queryParams.country" :placeholder="t('newHosts.placeHostsCountry')" clearable
|
||||
class="!w-240px">
|
||||
<el-option v-for="dict in countryinfoList" :key="dict.id" :label="dict.countryName"
|
||||
:value="dict.countryName" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('employee.hostsKind')" prop="hostsKind">
|
||||
<el-input v-model="queryParams.hostsKind" :placeholder="$t('employee.placeHostsKind')" clearable
|
||||
@keyup.enter="handleQuery" class="!w-240px" />
|
||||
@@ -154,7 +161,7 @@
|
||||
</el-table>
|
||||
|
||||
<!-- ✅ 移动端使用卡片列表 -->
|
||||
<div v-else v-infinite-scroll="loadList">
|
||||
<div v-else>
|
||||
<div v-for="(item, index) in list" :key="index" class="mobile-card">
|
||||
<div class="card-row" style="color:green;">
|
||||
<b>{{ $t('employee.hostsId') }}:</b><span @click="openHtml(item, item.hostsId)"
|
||||
@@ -182,6 +189,9 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<MobilePagination v-if="isMobile" :page="queryParams.pageNo" :limit="queryParams.pageSize" :total="total"
|
||||
@update:page="val => queryParams.pageNo = val" @load="loadList" @loadPre="loadpreviousList" />
|
||||
|
||||
|
||||
<!-- ✅ PC 显示分页,移动端隐藏 -->
|
||||
<Pagination v-if="!isMobile" :total="total" v-model:page="queryParams.pageNo" v-model:limit="queryParams.pageSize"
|
||||
@@ -214,8 +224,9 @@ import { dateFormatter } from '@/utils/formatTime'
|
||||
import download from '@/utils/download'
|
||||
import { EmployeeHostsApi, EmployeeHostsVO } from '@/api/server/employeehosts'
|
||||
import EmployeeHostsForm from './EmployeeHostsForm.vue'
|
||||
import { getAllocation, getSimpleUserList } from '@/api/system/user'
|
||||
import { getAllocation, getSimpleUserList, getCountry } from '@/api/system/user'
|
||||
import { useCache } from '@/hooks/web/useCache'
|
||||
import MobilePagination from '@/components/MobilePagination.vue'
|
||||
|
||||
const { wsCache } = useCache()
|
||||
|
||||
@@ -230,7 +241,7 @@ const list = ref<EmployeeHostsVO[]>([]) // 列表的数据
|
||||
const total = ref(0) // 列表的总页数
|
||||
const queryParams = reactive({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
pageSize: 20,
|
||||
hostsId: undefined,
|
||||
hostsLevel: undefined,
|
||||
onlineFansMin: undefined,
|
||||
@@ -244,6 +255,7 @@ const queryParams = reactive({
|
||||
invitationType: undefined,
|
||||
yesterdayCoins: undefined,
|
||||
country: undefined,
|
||||
region: undefined,
|
||||
hostsKind: undefined,
|
||||
isAssigned: undefined,
|
||||
createTime: [],
|
||||
@@ -262,6 +274,8 @@ let allocationUserList = ref([
|
||||
]) //选中的分配用户
|
||||
let selectHostList = ref([]) //选中的主播列表
|
||||
let allocationUser = ref() //选中的分配用户
|
||||
let countryinfoList = ref([])
|
||||
|
||||
/** 查询列表pc直接赋值 */
|
||||
const getList = async () => {
|
||||
loading.value = true
|
||||
@@ -380,7 +394,14 @@ function openHtml(item, id) {
|
||||
const loadList = () => {
|
||||
if (queryParams.pageNo < Math.ceil(total.value / queryParams.pageSize)) {
|
||||
queryParams.pageNo++
|
||||
getListPhone()
|
||||
getList()
|
||||
}
|
||||
}
|
||||
|
||||
const loadpreviousList = () => {
|
||||
if (queryParams.pageNo > 1) {
|
||||
queryParams.pageNo--
|
||||
getList()
|
||||
}
|
||||
}
|
||||
function formSuccess(data, index) {
|
||||
@@ -480,7 +501,13 @@ onMounted(() => {
|
||||
|
||||
})
|
||||
|
||||
function changeCountry(region) {
|
||||
console.log(region)
|
||||
getCountry(region).then((res) => {
|
||||
countryinfoList.value = res
|
||||
|
||||
})
|
||||
}
|
||||
// /** 初始化 **/
|
||||
// onMounted(() => {
|
||||
// getList()
|
||||
|
||||
@@ -75,13 +75,20 @@
|
||||
/>
|
||||
|
||||
</el-form-item> -->
|
||||
<el-form-item :label="t('newHosts.hostsCountry')" prop="country">
|
||||
<el-select v-model="queryParams.country" :placeholder="t('newHosts.placeHostsCountry')" clearable
|
||||
class="!w-240px">
|
||||
<el-form-item :label="t('newHosts.hostsCountry')" prop="region">
|
||||
<el-select v-model="queryParams.region" :placeholder="t('newHosts.placeHostsCountry')" clearable
|
||||
class="!w-240px" @change="changeCountry(queryParams.region)">
|
||||
<el-option v-for="dict in getStrDictOptions(DICT_TYPE.COUNTRY_GROUP)" :key="dict.value"
|
||||
:label="$t(dict.label)" :value="dict.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item :label="t('newHosts.hostsCountryinfo')" prop="country">
|
||||
<el-select v-model="queryParams.country" :placeholder="t('newHosts.placeHostsCountry')" clearable
|
||||
class="!w-240px">
|
||||
<el-option v-for="dict in countryinfoList" :key="dict.id" :label="dict.countryName"
|
||||
:value="dict.countryName" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item :label="t('newHosts.hostsKind')" prop="hostsKind">
|
||||
<el-input v-model="queryParams.hostsKind" :placeholder="t('newHosts.placeHostsKind')" clearable
|
||||
@keyup.enter="handleQuery" class="!w-240px" />
|
||||
@@ -230,10 +237,11 @@ import { getIntDictOptions, DICT_TYPE, getStrDictOptions } from '@/utils/dict'
|
||||
import { dateFormatter } from '@/utils/formatTime'
|
||||
import download from '@/utils/download'
|
||||
import { NewHostsApi, NewHostsVO } from '@/api/server/newhosts'
|
||||
import { getAllocation, getSimpleUserList, getSimpleUserListPage } from '@/api/system/user'
|
||||
import { getAllocation, getSimpleUserList, getSimpleUserListPage, getCountry } from '@/api/system/user'
|
||||
import NewHostsForm from './NewHostsForm.vue'
|
||||
import { useCache } from '@/hooks/web/useCache'
|
||||
import * as DeptApi from '@/api/system/dept'
|
||||
import { ElMessageBox } from 'element-plus'
|
||||
|
||||
import { func } from 'vue-types'
|
||||
const { wsCache } = useCache()
|
||||
@@ -262,11 +270,13 @@ const queryParams = reactive({
|
||||
fllowernumMax: undefined,
|
||||
invitationType: undefined,
|
||||
yesterdayCoins: undefined,
|
||||
region: undefined,
|
||||
country: undefined,
|
||||
hostsKind: undefined,
|
||||
isAssigned: undefined,
|
||||
createTime: new Date().toISOString().split('T')[0] + ' 00:00:00',
|
||||
userId: undefined,
|
||||
deleteFlag: false //导出 是否删除
|
||||
})
|
||||
const queryFormRef = ref() // 搜索的表单
|
||||
const exportLoading = ref(false) // 导出的加载中
|
||||
@@ -286,7 +296,7 @@ let allocationdeptList = ref([
|
||||
id: 1
|
||||
}
|
||||
]) //选中的分配部门
|
||||
|
||||
let countryinfoList = ref([])
|
||||
/** 查询列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true
|
||||
@@ -407,13 +417,40 @@ const handleDeleteBatch = async () => {
|
||||
/** 导出按钮操作 */
|
||||
const handleExport = async () => {
|
||||
try {
|
||||
// 导出的二次确认
|
||||
await message.exportConfirm()
|
||||
// 先确认是否删除导出的数据
|
||||
await ElMessageBox.confirm(
|
||||
'导出后是否删除导出的数据?',
|
||||
'删除确认',
|
||||
{
|
||||
distinguishCancelAndClose: true,
|
||||
confirmButtonText: '删除并导出',
|
||||
cancelButtonText: '仅导出',
|
||||
type: 'warning',
|
||||
}
|
||||
).then(async () => {
|
||||
queryParams.deleteFlag = true
|
||||
exportLoading.value = true
|
||||
const data = await NewHostsApi.exportNewHosts(queryParams)
|
||||
download.excel(data, '主播数据管理.xls')
|
||||
}).catch(async (err) => {
|
||||
if (err === 'cancel' || err?.action === 'cancel') {
|
||||
exportLoading.value = true
|
||||
const data = await NewHostsApi.exportNewHosts(queryParams)
|
||||
download.excel(data, '主播数据管理.xls')
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
// 原本的导出二次确认
|
||||
// await message.exportConfirm()
|
||||
|
||||
// 发起导出
|
||||
exportLoading.value = true
|
||||
const data = await NewHostsApi.exportNewHosts(queryParams)
|
||||
download.excel(data, '主播数据管理.xls')
|
||||
|
||||
|
||||
// 这里可以根据需求执行删除逻辑
|
||||
// await NewHostsApi.deleteExportedData()
|
||||
} catch {
|
||||
// 用户取消任意一个确认都会走这里
|
||||
} finally {
|
||||
exportLoading.value = false
|
||||
}
|
||||
@@ -468,6 +505,14 @@ function handleCopy(text) {
|
||||
}
|
||||
}
|
||||
|
||||
function changeCountry(region) {
|
||||
console.log(region)
|
||||
getCountry(region).then((res) => {
|
||||
countryinfoList.value = res
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
/** 初始化 **/
|
||||
onMounted(() => {
|
||||
getList()
|
||||
|
||||
Reference in New Issue
Block a user