Browse Source

导出优化完成24个页面

milestone-20260415-金币优化4期
zhangrenyuan 15 hours ago
parent
commit
59ac3fb8e6
  1. 88
      src/views/channelManage/cart/cart.vue
  2. 98
      src/views/channelManage/fans/fans.vue
  3. 98
      src/views/channelManage/reward/reward.vue
  4. 98
      src/views/consume/bean/articleVideo.vue
  5. 98
      src/views/consume/bean/dieHardFan.vue
  6. 98
      src/views/consume/bean/liveStream.vue
  7. 98
      src/views/consume/gold/coinConsumeDetail.vue
  8. 97
      src/views/moneyManage/financialAccount/cashFlow.vue
  9. 97
      src/views/moneyManage/financialAccount/performanceAttribution.vue
  10. 99
      src/views/moneyManage/receiveDetail/receiveFinance.vue
  11. 101
      src/views/moneyManage/receiveDetail/receiveHead.vue
  12. 99
      src/views/moneyManage/receiveDetail/receiveManage.vue
  13. 99
      src/views/moneyManage/refundDetail/refundCharge.vue
  14. 99
      src/views/moneyManage/refundDetail/refundFinance.vue
  15. 99
      src/views/moneyManage/refundDetail/refundHeader.vue
  16. 98
      src/views/recharge/bean/beanOnlineRecharge.vue
  17. 98
      src/views/recharge/bean/beanSystemRecharge.vue
  18. 12
      src/views/recharge/gold/coinRechargeDetail.vue
  19. 98
      src/views/refund/gold/coinRefundDetail.vue
  20. 98
      src/views/usergold/gold/clientCountBalance.vue
  21. 98
      src/views/usergold/gold/clientCountDetail.vue
  22. 98
      src/views/usergold/gold/clientCountWallet.vue
  23. 98
      src/views/walletManage/WalletBalance.vue
  24. 97
      src/views/walletManage/components/WalletDetailTemplate.vue

88
src/views/channelManage/cart/cart.vue

@ -1,5 +1,5 @@
<script setup> <script setup>
import { computed, onMounted, ref } from 'vue'
import { computed, onMounted, ref, watch, onBeforeUnmount } from 'vue'
import { dayjs, ElMessage } from 'element-plus' import { dayjs, ElMessage } from 'element-plus'
import request from '@/util/http.js' import request from '@/util/http.js'
import API from '@/util/http.js' import API from '@/util/http.js'
@ -294,30 +294,86 @@ const exportExcel = async function () {
} }
const exportListVisible = ref(false) const exportListVisible = ref(false)
const EXPORT_LIST_POLL_INTERVAL = 3000
let exportListPollingTimer = null
const exportList = ref([]) const exportList = ref([])
const exportListLoading = ref(false) const exportListLoading = ref(false)
const exportListRequesting = ref(false)
const sortExportList = (list = []) => {
return [...list].sort((a, b) => {
return new Date(b.createTime).getTime() - new Date(a.createTime).getTime()
})
}
const hasPendingExportTask = (list = []) => {
const latestTask = sortExportList(list)[0]
return latestTask ? latestTask.state === 0 || latestTask.state === 1 : false
}
const stopExportListPolling = () => {
if (exportListPollingTimer) {
clearInterval(exportListPollingTimer)
exportListPollingTimer = null
}
}
const startExportListPolling = () => {
if (exportListPollingTimer) {
return
}
exportListPollingTimer = setInterval(() => {
if (!exportListVisible.value) {
stopExportListPolling()
return
}
getExportList({ showLoading: false, silentError: true })
}, EXPORT_LIST_POLL_INTERVAL)
}
// //
const openExportList = () => { const openExportList = () => {
getExportList()
exportListVisible.value = true exportListVisible.value = true
} }
// //
const getExportList = async () => {
exportListLoading.value = true
const getExportList = async ({ showLoading = true, silentError = false } = {}) => {
if (exportListRequesting.value) {
return
}
if (showLoading) {
exportListLoading.value = true
}
exportListRequesting.value = true
try { try {
const result = await API({ url: '/export/export' })
const result = await API({ url: '/export/export' })
if (result.code === 200) { if (result.code === 200) {
ElMessage.success('导出成功')
const filteredData = result.data.filter(item => {
return item.type === 8 // /
})
exportList.value = sortExportList(filteredData)
if (exportListVisible.value && hasPendingExportTask(exportList.value)) {
startExportListPolling()
} else {
stopExportListPolling()
}
} else { } else {
ElMessage.error(result.msg || '获取导出列表失败')
stopExportListPolling()
if (!silentError) {
ElMessage.error(result.msg || '获取导出列表失败')
}
} }
} catch (error) { } catch (error) {
console.error('获取导出列表出错:', error) console.error('获取导出列表出错:', error)
ElMessage.error('获取导出列表失败,请稍后重试')
stopExportListPolling()
if (!silentError) {
ElMessage.error('获取导出列表失败,请稍后重试')
}
} finally { } finally {
exportListLoading.value = false
exportListRequesting.value = false
if (showLoading) {
exportListLoading.value = false
}
} }
} }
@ -364,6 +420,18 @@ const getTagText = (state) => {
return '未知状态' return '未知状态'
} }
} }
watch(exportListVisible, (visible) => {
if (visible) {
getExportList()
} else {
stopExportListPolling()
}
})
onBeforeUnmount(() => {
stopExportListPolling()
})
</script> </script>
<template> <template>
@ -586,4 +654,4 @@ const getTagText = (state) => {
} }
} }
} }
</style>
</style>

98
src/views/channelManage/fans/fans.vue

@ -1,5 +1,5 @@
<script setup> <script setup>
import { computed, onMounted, ref, watch, nextTick } from 'vue'
import { computed, onMounted, ref, watch, nextTick, onBeforeUnmount } from 'vue'
import { dayjs, ElMessage } from 'element-plus' import { dayjs, ElMessage } from 'element-plus'
import request from '@/util/http.js' import request from '@/util/http.js'
import API from '@/util/http.js' import API from '@/util/http.js'
@ -448,10 +448,11 @@ const exportExcel = async function () {
} }
} }
const exportListVisible = ref(false) const exportListVisible = ref(false)
const EXPORT_LIST_POLL_INTERVAL = 3000
let exportListPollingTimer = null
// //
const openExportList = () => { const openExportList = () => {
getExportList()
exportListVisible.value = true exportListVisible.value = true
} }
@ -459,26 +460,79 @@ const openExportList = () => {
const exportList = ref([]) const exportList = ref([])
// //
const exportListLoading = ref(false) const exportListLoading = ref(false)
const exportListRequesting = ref(false)
const sortExportList = (list = []) => {
return [...list].sort((a, b) => {
return new Date(b.createTime).getTime() - new Date(a.createTime).getTime()
})
}
const hasPendingExportTask = (list = []) => {
const latestTask = sortExportList(list)[0]
return latestTask ? latestTask.state === 0 || latestTask.state === 1 : false
}
const stopExportListPolling = () => {
if (exportListPollingTimer) {
clearInterval(exportListPollingTimer)
exportListPollingTimer = null
}
}
const startExportListPolling = () => {
if (exportListPollingTimer) {
return
}
exportListPollingTimer = setInterval(() => {
if (!exportListVisible.value) {
stopExportListPolling()
return
}
getExportList({ showLoading: false, silentError: true })
}, EXPORT_LIST_POLL_INTERVAL)
}
// //
const getExportList = async () => {
exportListLoading.value = true
try {
const result = await API({ url: '/export/export' })
if (result.code === 200) {
const getExportList = async ({ showLoading = true, silentError = false } = {}) => {
if (exportListRequesting.value) {
return
}
if (showLoading) {
exportListLoading.value = true
}
exportListRequesting.value = true
try {
const result = await API({ url: '/export/export' })
if (result.code === 200) {
const filteredData = result.data.filter(item => { const filteredData = result.data.filter(item => {
return item.type === 7; //7 return item.type === 7; //7
}); });
exportList.value = filteredData
} else {
ElMessage.error(result.msg || t('elmessage.getExportListError'))
exportList.value = sortExportList(filteredData)
if (exportListVisible.value && hasPendingExportTask(exportList.value)) {
startExportListPolling()
} else {
stopExportListPolling()
}
} else {
stopExportListPolling()
if (!silentError) {
ElMessage.error(result.msg || t('elmessage.getExportListError'))
}
}
} catch (error) {
console.error('获取导出列表出错:', error)
stopExportListPolling()
if (!silentError) {
ElMessage.error(t('elmessage.getExportListError'))
}
} finally {
exportListRequesting.value = false
if (showLoading) {
exportListLoading.value = false
}
} }
} catch (error) {
console.error('获取导出列表出错:', error)
ElMessage.error(t('elmessage.getExportListError'))
} finally {
exportListLoading.value = false
}
} }
// //
const downloadExportFile = (item) => { const downloadExportFile = (item) => {
if (item.state === 2) { if (item.state === 2) {
@ -520,6 +574,18 @@ const getTagText = (state) => {
return t('elmessage.unknownStatus'); return t('elmessage.unknownStatus');
} }
} }
watch(exportListVisible, (visible) => {
if (visible) {
getExportList()
} else {
stopExportListPolling()
}
})
onBeforeUnmount(() => {
stopExportListPolling()
})
</script> </script>
<template> <template>

98
src/views/channelManage/reward/reward.vue

@ -1,5 +1,5 @@
<script setup> <script setup>
import {computed, onMounted, ref, watch, nextTick} from 'vue'
import { computed, onMounted, ref, watch, nextTick, onBeforeUnmount } from 'vue'
import {dayjs, ElMessage} from 'element-plus' import {dayjs, ElMessage} from 'element-plus'
import request from '@/util/http.js' import request from '@/util/http.js'
import API from '@/util/http.js' import API from '@/util/http.js'
@ -476,10 +476,11 @@ const exportExcel = async function () {
} }
} }
const exportListVisible = ref(false) const exportListVisible = ref(false)
const EXPORT_LIST_POLL_INTERVAL = 3000
let exportListPollingTimer = null
// //
const openExportList = () => { const openExportList = () => {
getExportList()
exportListVisible.value = true exportListVisible.value = true
} }
@ -487,27 +488,80 @@ const openExportList = () => {
const exportList = ref([]) const exportList = ref([])
// //
const exportListLoading = ref(false) const exportListLoading = ref(false)
const exportListRequesting = ref(false)
const sortExportList = (list = []) => {
return [...list].sort((a, b) => {
return new Date(b.createTime).getTime() - new Date(a.createTime).getTime()
})
}
const hasPendingExportTask = (list = []) => {
const latestTask = sortExportList(list)[0]
return latestTask ? latestTask.state === 0 || latestTask.state === 1 : false
}
const stopExportListPolling = () => {
if (exportListPollingTimer) {
clearInterval(exportListPollingTimer)
exportListPollingTimer = null
}
}
const startExportListPolling = () => {
if (exportListPollingTimer) {
return
}
exportListPollingTimer = setInterval(() => {
if (!exportListVisible.value) {
stopExportListPolling()
return
}
getExportList({ showLoading: false, silentError: true })
}, EXPORT_LIST_POLL_INTERVAL)
}
// //
const getExportList = async () => {
exportListLoading.value = true
try {
const result = await API({url: '/export/export'})
if (result.code === 200) {
const getExportList = async ({ showLoading = true, silentError = false } = {}) => {
if (exportListRequesting.value) {
return
}
if (showLoading) {
exportListLoading.value = true
}
exportListRequesting.value = true
try {
const result = await API({url: '/export/export'})
if (result.code === 200) {
const filteredData = result.data.filter(item => { const filteredData = result.data.filter(item => {
return item.type === 6; //6 return item.type === 6; //6
}); });
exportList.value = filteredData
} else {
ElMessage.error(result.msg || t('elmessage.getExportListError'))
exportList.value = sortExportList(filteredData)
if (exportListVisible.value && hasPendingExportTask(exportList.value)) {
startExportListPolling()
} else {
stopExportListPolling()
}
} else {
stopExportListPolling()
if (!silentError) {
ElMessage.error(result.msg || t('elmessage.getExportListError'))
}
}
} catch (error) {
console.error('获取导出列表出错:', error)
stopExportListPolling()
if (!silentError) {
ElMessage.error(t('elmessage.getExportListError'))
}
} finally {
exportListRequesting.value = false
if (showLoading) {
exportListLoading.value = false
}
} }
} catch (error) {
console.error('获取导出列表出错:', error)
ElMessage.error(t('elmessage.getExportListError'))
} finally {
exportListLoading.value = false
}
} }
// //
const downloadExportFile = (item) => { const downloadExportFile = (item) => {
if (item.state === 2) { if (item.state === 2) {
@ -549,6 +603,18 @@ const getTagText = (state) => {
return t('elmessage.unknownStatus'); return t('elmessage.unknownStatus');
} }
} }
watch(exportListVisible, (visible) => {
if (visible) {
getExportList()
} else {
stopExportListPolling()
}
})
onBeforeUnmount(() => {
stopExportListPolling()
})
</script> </script>
<template> <template>

98
src/views/consume/bean/articleVideo.vue

@ -1,5 +1,5 @@
<script setup> <script setup>
import { computed, onMounted, ref, watch, nextTick } from 'vue'
import { computed, onMounted, ref, watch, nextTick, onBeforeUnmount } from 'vue'
import { dayjs, ElMessage } from 'element-plus' import { dayjs, ElMessage } from 'element-plus'
import request from '@/util/http.js' import request from '@/util/http.js'
import API from '@/util/http.js' import API from '@/util/http.js'
@ -424,10 +424,11 @@ const exportExcel = async function () {
} }
} }
const exportListVisible = ref(false) const exportListVisible = ref(false)
const EXPORT_LIST_POLL_INTERVAL = 3000
let exportListPollingTimer = null
// //
const openExportList = () => { const openExportList = () => {
getExportList()
exportListVisible.value = true exportListVisible.value = true
} }
@ -435,26 +436,79 @@ const openExportList = () => {
const exportList = ref([]) const exportList = ref([])
// //
const exportListLoading = ref(false) const exportListLoading = ref(false)
const exportListRequesting = ref(false)
const sortExportList = (list = []) => {
return [...list].sort((a, b) => {
return new Date(b.createTime).getTime() - new Date(a.createTime).getTime()
})
}
const hasPendingExportTask = (list = []) => {
const latestTask = sortExportList(list)[0]
return latestTask ? latestTask.state === 0 || latestTask.state === 1 : false
}
const stopExportListPolling = () => {
if (exportListPollingTimer) {
clearInterval(exportListPollingTimer)
exportListPollingTimer = null
}
}
const startExportListPolling = () => {
if (exportListPollingTimer) {
return
}
exportListPollingTimer = setInterval(() => {
if (!exportListVisible.value) {
stopExportListPolling()
return
}
getExportList({ showLoading: false, silentError: true })
}, EXPORT_LIST_POLL_INTERVAL)
}
// //
const getExportList = async () => {
exportListLoading.value = true
try {
const result = await API({ url: '/export/export' })
if (result.code === 200) {
const getExportList = async ({ showLoading = true, silentError = false } = {}) => {
if (exportListRequesting.value) {
return
}
if (showLoading) {
exportListLoading.value = true
}
exportListRequesting.value = true
try {
const result = await API({ url: '/export/export' })
if (result.code === 200) {
const filteredData = result.data.filter(item => { const filteredData = result.data.filter(item => {
return item.type === 8; //8/ return item.type === 8; //8/
}); });
exportList.value = filteredData
} else {
ElMessage.error(result.msg || t('elmessage.getExportListError'))
exportList.value = sortExportList(filteredData)
if (exportListVisible.value && hasPendingExportTask(exportList.value)) {
startExportListPolling()
} else {
stopExportListPolling()
}
} else {
stopExportListPolling()
if (!silentError) {
ElMessage.error(result.msg || t('elmessage.getExportListError'))
}
}
} catch (error) {
console.error('获取导出列表出错:', error)
stopExportListPolling()
if (!silentError) {
ElMessage.error(t('elmessage.getExportListError'))
}
} finally {
exportListRequesting.value = false
if (showLoading) {
exportListLoading.value = false
}
} }
} catch (error) {
console.error('获取导出列表出错:', error)
ElMessage.error(t('elmessage.getExportListError'))
} finally {
exportListLoading.value = false
}
} }
// //
const downloadExportFile = (item) => { const downloadExportFile = (item) => {
if (item.state === 2) { if (item.state === 2) {
@ -496,6 +550,18 @@ const getTagText = (state) => {
return t('elmessage.unknownStatus'); return t('elmessage.unknownStatus');
} }
} }
watch(exportListVisible, (visible) => {
if (visible) {
getExportList()
} else {
stopExportListPolling()
}
})
onBeforeUnmount(() => {
stopExportListPolling()
})
</script> </script>
<template> <template>

98
src/views/consume/bean/dieHardFan.vue

@ -1,5 +1,5 @@
<script setup> <script setup>
import { computed, onMounted, ref, watch, nextTick } from 'vue'
import { computed, onMounted, ref, watch, nextTick, onBeforeUnmount } from 'vue'
import { dayjs, ElMessage } from 'element-plus' import { dayjs, ElMessage } from 'element-plus'
import request from '@/util/http.js' import request from '@/util/http.js'
import API from '@/util/http.js' import API from '@/util/http.js'
@ -428,10 +428,11 @@ const exportExcel = async function () {
} }
} }
const exportListVisible = ref(false) const exportListVisible = ref(false)
const EXPORT_LIST_POLL_INTERVAL = 3000
let exportListPollingTimer = null
// //
const openExportList = () => { const openExportList = () => {
getExportList()
exportListVisible.value = true exportListVisible.value = true
} }
@ -439,26 +440,79 @@ const openExportList = () => {
const exportList = ref([]) const exportList = ref([])
// //
const exportListLoading = ref(false) const exportListLoading = ref(false)
const exportListRequesting = ref(false)
const sortExportList = (list = []) => {
return [...list].sort((a, b) => {
return new Date(b.createTime).getTime() - new Date(a.createTime).getTime()
})
}
const hasPendingExportTask = (list = []) => {
const latestTask = sortExportList(list)[0]
return latestTask ? latestTask.state === 0 || latestTask.state === 1 : false
}
const stopExportListPolling = () => {
if (exportListPollingTimer) {
clearInterval(exportListPollingTimer)
exportListPollingTimer = null
}
}
const startExportListPolling = () => {
if (exportListPollingTimer) {
return
}
exportListPollingTimer = setInterval(() => {
if (!exportListVisible.value) {
stopExportListPolling()
return
}
getExportList({ showLoading: false, silentError: true })
}, EXPORT_LIST_POLL_INTERVAL)
}
// //
const getExportList = async () => {
exportListLoading.value = true
try {
const result = await API({ url: '/export/export' })
if (result.code === 200) {
const getExportList = async ({ showLoading = true, silentError = false } = {}) => {
if (exportListRequesting.value) {
return
}
if (showLoading) {
exportListLoading.value = true
}
exportListRequesting.value = true
try {
const result = await API({ url: '/export/export' })
if (result.code === 200) {
const filteredData = result.data.filter(item => { const filteredData = result.data.filter(item => {
return item.type === 7; //7 return item.type === 7; //7
}); });
exportList.value = filteredData
} else {
ElMessage.error(result.msg || t('elmessage.getExportListError'))
exportList.value = sortExportList(filteredData)
if (exportListVisible.value && hasPendingExportTask(exportList.value)) {
startExportListPolling()
} else {
stopExportListPolling()
}
} else {
stopExportListPolling()
if (!silentError) {
ElMessage.error(result.msg || t('elmessage.getExportListError'))
}
}
} catch (error) {
console.error('获取导出列表出错:', error)
stopExportListPolling()
if (!silentError) {
ElMessage.error(t('elmessage.getExportListError'))
}
} finally {
exportListRequesting.value = false
if (showLoading) {
exportListLoading.value = false
}
} }
} catch (error) {
console.error('获取导出列表出错:', error)
ElMessage.error(t('elmessage.getExportListError'))
} finally {
exportListLoading.value = false
}
} }
// //
const downloadExportFile = (item) => { const downloadExportFile = (item) => {
if (item.state === 2) { if (item.state === 2) {
@ -500,6 +554,18 @@ const getTagText = (state) => {
return t('elmessage.unknownStatus'); return t('elmessage.unknownStatus');
} }
} }
watch(exportListVisible, (visible) => {
if (visible) {
getExportList()
} else {
stopExportListPolling()
}
})
onBeforeUnmount(() => {
stopExportListPolling()
})
</script> </script>
<template> <template>

98
src/views/consume/bean/liveStream.vue

@ -1,5 +1,5 @@
<script setup> <script setup>
import {computed, onMounted, ref, watch, nextTick} from 'vue'
import { computed, onMounted, ref, watch, nextTick, onBeforeUnmount } from 'vue'
import {dayjs, ElMessage} from 'element-plus' import {dayjs, ElMessage} from 'element-plus'
import request from '@/util/http.js' import request from '@/util/http.js'
import API from '@/util/http.js' import API from '@/util/http.js'
@ -455,10 +455,11 @@ const exportExcel = async function () {
} }
} }
const exportListVisible = ref(false) const exportListVisible = ref(false)
const EXPORT_LIST_POLL_INTERVAL = 3000
let exportListPollingTimer = null
// //
const openExportList = () => { const openExportList = () => {
getExportList()
exportListVisible.value = true exportListVisible.value = true
} }
@ -466,27 +467,80 @@ const openExportList = () => {
const exportList = ref([]) const exportList = ref([])
// //
const exportListLoading = ref(false) const exportListLoading = ref(false)
const exportListRequesting = ref(false)
const sortExportList = (list = []) => {
return [...list].sort((a, b) => {
return new Date(b.createTime).getTime() - new Date(a.createTime).getTime()
})
}
const hasPendingExportTask = (list = []) => {
const latestTask = sortExportList(list)[0]
return latestTask ? latestTask.state === 0 || latestTask.state === 1 : false
}
const stopExportListPolling = () => {
if (exportListPollingTimer) {
clearInterval(exportListPollingTimer)
exportListPollingTimer = null
}
}
const startExportListPolling = () => {
if (exportListPollingTimer) {
return
}
exportListPollingTimer = setInterval(() => {
if (!exportListVisible.value) {
stopExportListPolling()
return
}
getExportList({ showLoading: false, silentError: true })
}, EXPORT_LIST_POLL_INTERVAL)
}
// //
const getExportList = async () => {
exportListLoading.value = true
try {
const result = await API({url: '/export/export'})
if (result.code === 200) {
const getExportList = async ({ showLoading = true, silentError = false } = {}) => {
if (exportListRequesting.value) {
return
}
if (showLoading) {
exportListLoading.value = true
}
exportListRequesting.value = true
try {
const result = await API({url: '/export/export'})
if (result.code === 200) {
const filteredData = result.data.filter(item => { const filteredData = result.data.filter(item => {
return item.type === 6; //6 return item.type === 6; //6
}); });
exportList.value = filteredData
} else {
ElMessage.error(result.msg || t('elmessage.getExportListError'))
exportList.value = sortExportList(filteredData)
if (exportListVisible.value && hasPendingExportTask(exportList.value)) {
startExportListPolling()
} else {
stopExportListPolling()
}
} else {
stopExportListPolling()
if (!silentError) {
ElMessage.error(result.msg || t('elmessage.getExportListError'))
}
}
} catch (error) {
console.error('获取导出列表出错:', error)
stopExportListPolling()
if (!silentError) {
ElMessage.error(t('elmessage.getExportListError'))
}
} finally {
exportListRequesting.value = false
if (showLoading) {
exportListLoading.value = false
}
} }
} catch (error) {
console.error('获取导出列表出错:', error)
ElMessage.error(t('elmessage.getExportListError'))
} finally {
exportListLoading.value = false
}
} }
// //
const downloadExportFile = (item) => { const downloadExportFile = (item) => {
if (item.state === 2) { if (item.state === 2) {
@ -528,6 +582,18 @@ const getTagText = (state) => {
return t('elmessage.unknownStatus'); return t('elmessage.unknownStatus');
} }
} }
watch(exportListVisible, (visible) => {
if (visible) {
getExportList()
} else {
stopExportListPolling()
}
})
onBeforeUnmount(() => {
stopExportListPolling()
})
</script> </script>
<template> <template>

98
src/views/consume/gold/coinConsumeDetail.vue

@ -1,5 +1,5 @@
<script setup> <script setup>
import { computed, onMounted, ref, watch, nextTick } from 'vue'
import { computed, onMounted, ref, watch, nextTick, onBeforeUnmount } from 'vue'
import { dayjs, ElMessage } from 'element-plus' import { dayjs, ElMessage } from 'element-plus'
import request from '@/util/http.js' import request from '@/util/http.js'
import API from '@/util/http.js' import API from '@/util/http.js'
@ -467,10 +467,11 @@ const exportExcel = async function () {
} }
} }
const exportListVisible = ref(false) const exportListVisible = ref(false)
const EXPORT_LIST_POLL_INTERVAL = 3000
let exportListPollingTimer = null
// //
const openExportList = () => { const openExportList = () => {
getExportList()
exportListVisible.value = true exportListVisible.value = true
} }
@ -478,26 +479,79 @@ const openExportList = () => {
const exportList = ref([]) const exportList = ref([])
// //
const exportListLoading = ref(false) const exportListLoading = ref(false)
const exportListRequesting = ref(false)
const sortExportList = (list = []) => {
return [...list].sort((a, b) => {
return new Date(b.createTime).getTime() - new Date(a.createTime).getTime()
})
}
const hasPendingExportTask = (list = []) => {
const latestTask = sortExportList(list)[0]
return latestTask ? latestTask.state === 0 || latestTask.state === 1 : false
}
const stopExportListPolling = () => {
if (exportListPollingTimer) {
clearInterval(exportListPollingTimer)
exportListPollingTimer = null
}
}
const startExportListPolling = () => {
if (exportListPollingTimer) {
return
}
exportListPollingTimer = setInterval(() => {
if (!exportListVisible.value) {
stopExportListPolling()
return
}
getExportList({ showLoading: false, silentError: true })
}, EXPORT_LIST_POLL_INTERVAL)
}
// //
const getExportList = async () => {
exportListLoading.value = true
try {
const result = await API({ url: '/export/export' })
if (result.code === 200) {
const getExportList = async ({ showLoading = true, silentError = false } = {}) => {
if (exportListRequesting.value) {
return
}
if (showLoading) {
exportListLoading.value = true
}
exportListRequesting.value = true
try {
const result = await API({ url: '/export/export' })
if (result.code === 200) {
const filteredData = result.data.filter(item => { const filteredData = result.data.filter(item => {
return item.type === 4; //4 return item.type === 4; //4
}); });
exportList.value = filteredData
} else {
ElMessage.error(result.msg || t('elmessage.getExportListError'))
exportList.value = sortExportList(filteredData)
if (exportListVisible.value && hasPendingExportTask(exportList.value)) {
startExportListPolling()
} else {
stopExportListPolling()
}
} else {
stopExportListPolling()
if (!silentError) {
ElMessage.error(result.msg || t('elmessage.getExportListError'))
}
}
} catch (error) {
console.error('获取导出列表出错:', error)
stopExportListPolling()
if (!silentError) {
ElMessage.error(t('elmessage.getExportListError'))
}
} finally {
exportListRequesting.value = false
if (showLoading) {
exportListLoading.value = false
}
} }
} catch (error) {
console.error('获取导出列表出错:', error)
ElMessage.error(t('elmessage.getExportListError'))
} finally {
exportListLoading.value = false
}
} }
// //
const downloadExportFile = (item) => { const downloadExportFile = (item) => {
if (item.state === 2) { if (item.state === 2) {
@ -586,6 +640,18 @@ const getMarket = async function () {
} }
} }
watch(exportListVisible, (visible) => {
if (visible) {
getExportList()
} else {
stopExportListPolling()
}
})
onBeforeUnmount(() => {
stopExportListPolling()
})
</script> </script>
<template> <template>

97
src/views/moneyManage/financialAccount/cashFlow.vue

@ -1,5 +1,5 @@
<script setup> <script setup>
import { ref, reactive, onMounted, nextTick, toRaw } from 'vue'
import { ref, reactive, onMounted, nextTick, toRaw, watch, onBeforeUnmount } from 'vue'
import { useRoute } from 'vue-router' import { useRoute } from 'vue-router'
import { ElMessage, ElMessageBox } from 'element-plus' import { ElMessage, ElMessageBox } from 'element-plus'
import request from '@/util/http.js' import request from '@/util/http.js'
@ -354,8 +354,42 @@ const payPlatformOptionsList = ref([])
// ==================== ==================== // ==================== ====================
const exportListVisible = ref(false) const exportListVisible = ref(false)
const EXPORT_LIST_POLL_INTERVAL = 3000
let exportListPollingTimer = null
const exportList = ref([]) const exportList = ref([])
const exportListLoading = ref(false) const exportListLoading = ref(false)
const exportListRequesting = ref(false)
const sortExportList = (list = []) => {
return [...list].sort((a, b) => {
return new Date(b.createTime).getTime() - new Date(a.createTime).getTime()
})
}
const hasPendingExportTask = (list = []) => {
const latestTask = sortExportList(list)[0]
return latestTask ? latestTask.state === 0 || latestTask.state === 1 : false
}
const stopExportListPolling = () => {
if (exportListPollingTimer) {
clearInterval(exportListPollingTimer)
exportListPollingTimer = null
}
}
const startExportListPolling = () => {
if (exportListPollingTimer) {
return
}
exportListPollingTimer = setInterval(() => {
if (!exportListVisible.value) {
stopExportListPolling()
return
}
getExportList({ showLoading: false, silentError: true })
}, EXPORT_LIST_POLL_INTERVAL)
}
// Excel // Excel
const handleExport = async () => { const handleExport = async () => {
@ -415,27 +449,46 @@ const handleExport = async () => {
// //
const openExportList = () => { const openExportList = () => {
getExportList()
exportListVisible.value = true exportListVisible.value = true
} }
// //
const getExportList = async () => {
exportListLoading.value = true
try {
const result = await request({ url: '/export/export' })
if (result.code === 200) {
const getExportList = async ({ showLoading = true, silentError = false } = {}) => {
if (exportListRequesting.value) {
return
}
if (showLoading) {
exportListLoading.value = true
}
exportListRequesting.value = true
try {
const result = await request({ url: '/export/export' })
if (result.code === 200) {
const filteredData = result.data.filter(item => item.type == 15); const filteredData = result.data.filter(item => item.type == 15);
exportList.value = filteredData || []
} else {
ElMessage.error(result.msg || t('elmessage.getExportListError'))
exportList.value = sortExportList(filteredData || [])
if (exportListVisible.value && hasPendingExportTask(exportList.value)) {
startExportListPolling()
} else {
stopExportListPolling()
}
} else {
stopExportListPolling()
if (!silentError) {
ElMessage.error(result.msg || t('elmessage.getExportListError'))
}
}
} catch (error) {
console.error('获取导出列表出错:', error)
stopExportListPolling()
if (!silentError) {
ElMessage.error(t('elmessage.getExportListError'))
}
} finally {
exportListRequesting.value = false
if (showLoading) {
exportListLoading.value = false
}
} }
} catch (error) {
console.error('获取导出列表出错:', error)
ElMessage.error(t('elmessage.getExportListError'))
} finally {
exportListLoading.value = false
}
} }
// //
@ -753,6 +806,18 @@ onMounted(async () => {
fetchData() fetchData()
}) })
watch(exportListVisible, (visible) => {
if (visible) {
getExportList()
} else {
stopExportListPolling()
}
})
onBeforeUnmount(() => {
stopExportListPolling()
})
</script> </script>
<template> <template>

97
src/views/moneyManage/financialAccount/performanceAttribution.vue

@ -1,5 +1,5 @@
<script setup> <script setup>
import { ref, reactive, onMounted, toRefs, nextTick, computed } from 'vue'
import { ref, reactive, onMounted, toRefs, nextTick, computed, watch, onBeforeUnmount } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus' import { ElMessage, ElMessageBox } from 'element-plus'
import request from '@/util/http.js' import request from '@/util/http.js'
import dayjs from 'dayjs' import dayjs from 'dayjs'
@ -205,8 +205,42 @@ const handleRefund = (row) => {
// ==================== ==================== // ==================== ====================
const exportListVisible = ref(false) const exportListVisible = ref(false)
const EXPORT_LIST_POLL_INTERVAL = 3000
let exportListPollingTimer = null
const exportList = ref([]) const exportList = ref([])
const exportListLoading = ref(false) const exportListLoading = ref(false)
const exportListRequesting = ref(false)
const sortExportList = (list = []) => {
return [...list].sort((a, b) => {
return dayjs(b.createTime).valueOf() - dayjs(a.createTime).valueOf()
})
}
const hasPendingExportTask = (list = []) => {
const latestTask = sortExportList(list)[0]
return latestTask ? latestTask.state === 0 || latestTask.state === 1 : false
}
const stopExportListPolling = () => {
if (exportListPollingTimer) {
clearInterval(exportListPollingTimer)
exportListPollingTimer = null
}
}
const startExportListPolling = () => {
if (exportListPollingTimer) {
return
}
exportListPollingTimer = setInterval(() => {
if (!exportListVisible.value) {
stopExportListPolling()
return
}
getExportList({ showLoading: false, silentError: true })
}, EXPORT_LIST_POLL_INTERVAL)
}
// Excel // Excel
const handleExport = async () => { const handleExport = async () => {
@ -242,27 +276,46 @@ const handleExport = async () => {
// //
const openExportList = () => { const openExportList = () => {
getExportList()
exportListVisible.value = true exportListVisible.value = true
} }
// //
const getExportList = async () => {
exportListLoading.value = true
try {
const result = await request({ url: '/export/export' })
if (result.code === 200) {
const getExportList = async ({ showLoading = true, silentError = false } = {}) => {
if (exportListRequesting.value) {
return
}
if (showLoading) {
exportListLoading.value = true
}
exportListRequesting.value = true
try {
const result = await request({ url: '/export/export' })
if (result.code === 200) {
const filteredData = result.data.filter(item => item.type == 14); const filteredData = result.data.filter(item => item.type == 14);
exportList.value = filteredData || []
} else {
ElMessage.error(result.msg || t('elmessage.getExportListError'))
exportList.value = sortExportList(filteredData || [])
if (exportListVisible.value && hasPendingExportTask(exportList.value)) {
startExportListPolling()
} else {
stopExportListPolling()
}
} else {
stopExportListPolling()
if (!silentError) {
ElMessage.error(result.msg || t('elmessage.getExportListError'))
}
}
} catch (error) {
console.error('获取导出列表出错:', error)
stopExportListPolling()
if (!silentError) {
ElMessage.error(t('elmessage.getExportListError'))
}
} finally {
exportListRequesting.value = false
if (showLoading) {
exportListLoading.value = false
}
} }
} catch (error) {
console.error('获取导出列表出错:', error)
ElMessage.error(t('elmessage.getExportListError'))
} finally {
exportListLoading.value = false
}
} }
// //
@ -409,6 +462,18 @@ onMounted(async () => {
await getMarket() await getMarket()
await fetchData() await fetchData()
}) })
watch(exportListVisible, (visible) => {
if (visible) {
getExportList()
} else {
stopExportListPolling()
}
})
onBeforeUnmount(() => {
stopExportListPolling()
})
</script> </script>
<template> <template>

99
src/views/moneyManage/receiveDetail/receiveFinance.vue

@ -642,7 +642,7 @@
<script setup> <script setup>
// //
import { ref, watch, onMounted, nextTick } from 'vue';
import { ref, watch, onMounted, nextTick, onBeforeUnmount } from 'vue';
import { storeToRefs } from 'pinia'; import { storeToRefs } from 'pinia';
import { ElMessage, ElMessageBox } from 'element-plus'; import { ElMessage, ElMessageBox } from 'element-plus';
import API from '@/util/http.js'; import API from '@/util/http.js';
@ -811,8 +811,42 @@ const closeConfirmRefund = () => {
// //
const exportListVisible = ref(false) const exportListVisible = ref(false)
const EXPORT_LIST_POLL_INTERVAL = 3000
let exportListPollingTimer = null
const exportList = ref([]) const exportList = ref([])
const exportListLoading = ref(false) const exportListLoading = ref(false)
const exportListRequesting = ref(false)
const sortExportList = (list = []) => {
return [...list].sort((a, b) => {
return new Date(b.createTime).getTime() - new Date(a.createTime).getTime()
})
}
const hasPendingExportTask = (list = []) => {
const latestTask = sortExportList(list)[0]
return latestTask ? latestTask.state === 0 || latestTask.state === 1 : false
}
const stopExportListPolling = () => {
if (exportListPollingTimer) {
clearInterval(exportListPollingTimer)
exportListPollingTimer = null
}
}
const startExportListPolling = () => {
if (exportListPollingTimer) {
return
}
exportListPollingTimer = setInterval(() => {
if (!exportListVisible.value) {
stopExportListPolling()
return
}
getExportList({ showLoading: false, silentError: true })
}, EXPORT_LIST_POLL_INTERVAL)
}
const exportExcel = async function () { const exportExcel = async function () {
let payCurrencySelect = ''; let payCurrencySelect = '';
@ -868,28 +902,47 @@ const exportExcel = async function () {
} }
const openExportList = () => { const openExportList = () => {
getExportList()
exportListVisible.value = true
exportListVisible.value = true
} }
// //
const getExportList = async () => {
exportListLoading.value = true
try {
const result = await API({ url: '/export/export' })
if (result.code === 200) {
const getExportList = async ({ showLoading = true, silentError = false } = {}) => {
if (exportListRequesting.value) {
return
}
if (showLoading) {
exportListLoading.value = true
}
exportListRequesting.value = true
try {
const result = await API({ url: '/export/export' })
if (result.code === 200) {
const filteredData = result.data.filter(item => { const filteredData = result.data.filter(item => {
return item.type === 13 return item.type === 13
}) })
exportList.value = filteredData
} else {
ElMessage.error(result.msg || t('elmessage.getExportListError'))
exportList.value = sortExportList(filteredData)
if (exportListVisible.value && hasPendingExportTask(exportList.value)) {
startExportListPolling()
} else {
stopExportListPolling()
}
} else {
stopExportListPolling()
if (!silentError) {
ElMessage.error(result.msg || t('elmessage.getExportListError'))
}
}
} catch (error) {
console.error('获取导出列表出错:', error)
stopExportListPolling()
if (!silentError) {
ElMessage.error(t('elmessage.getExportListError'))
}
} finally {
exportListRequesting.value = false
if (showLoading) {
exportListLoading.value = false
}
} }
} catch (error) {
console.error('获取导出列表出错:', error)
ElMessage.error(t('elmessage.getExportListError'))
} finally {
exportListLoading.value = false
}
} }
const downloadExportFile = (item) => { const downloadExportFile = (item) => {
if (item.state === 2) { if (item.state === 2) {
@ -1478,6 +1531,18 @@ const handlePagination = (type, val) => {
else pageInfo.value.pageNum = val; else pageInfo.value.pageNum = val;
getlist(); getlist();
}; };
watch(exportListVisible, (visible) => {
if (visible) {
getExportList()
} else {
stopExportListPolling()
}
})
onBeforeUnmount(() => {
stopExportListPolling()
})
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">

101
src/views/moneyManage/receiveDetail/receiveHead.vue

@ -521,7 +521,7 @@
<script setup> <script setup>
// //
import { ref, watch, onMounted, nextTick } from 'vue';
import { ref, watch, onMounted, nextTick, onBeforeUnmount } from 'vue';
import { storeToRefs } from 'pinia'; import { storeToRefs } from 'pinia';
import { ElMessage, ElMessageBox } from 'element-plus'; import { ElMessage, ElMessageBox } from 'element-plus';
import API from '@/util/http.js'; import API from '@/util/http.js';
@ -618,8 +618,42 @@ const ifRefundGold = () => {
// //
const exportListVisible = ref(false) const exportListVisible = ref(false)
const EXPORT_LIST_POLL_INTERVAL = 3000
let exportListPollingTimer = null
const exportList = ref([]) const exportList = ref([])
const exportListLoading = ref(false) const exportListLoading = ref(false)
const exportListRequesting = ref(false)
const sortExportList = (list = []) => {
return [...list].sort((a, b) => {
return new Date(b.createTime).getTime() - new Date(a.createTime).getTime()
})
}
const hasPendingExportTask = (list = []) => {
const latestTask = sortExportList(list)[0]
return latestTask ? latestTask.state === 0 || latestTask.state === 1 : false
}
const stopExportListPolling = () => {
if (exportListPollingTimer) {
clearInterval(exportListPollingTimer)
exportListPollingTimer = null
}
}
const startExportListPolling = () => {
if (exportListPollingTimer) {
return
}
exportListPollingTimer = setInterval(() => {
if (!exportListVisible.value) {
stopExportListPolling()
return
}
getExportList({ showLoading: false, silentError: true })
}, EXPORT_LIST_POLL_INTERVAL)
}
const exportExcel = async function () { const exportExcel = async function () {
let payCurrencySelect = ''; let payCurrencySelect = '';
@ -675,30 +709,47 @@ const exportExcel = async function () {
} }
const openExportList = () => { const openExportList = () => {
getExportList()
console.log('daoshiu');
exportListVisible.value = true
exportListVisible.value = true
} }
// //
const getExportList = async () => {
exportListLoading.value = true
try {
const result = await API({ url: '/export/export' })
if (result.code === 200) {
const getExportList = async ({ showLoading = true, silentError = false } = {}) => {
if (exportListRequesting.value) {
return
}
if (showLoading) {
exportListLoading.value = true
}
exportListRequesting.value = true
try {
const result = await API({ url: '/export/export' })
if (result.code === 200) {
const filteredData = result.data.filter(item => { const filteredData = result.data.filter(item => {
return item.type === 13 return item.type === 13
}) })
exportList.value = filteredData
} else {
ElMessage.error(result.msg || t('elmessage.getExportListError'))
exportList.value = sortExportList(filteredData)
if (exportListVisible.value && hasPendingExportTask(exportList.value)) {
startExportListPolling()
} else {
stopExportListPolling()
}
} else {
stopExportListPolling()
if (!silentError) {
ElMessage.error(result.msg || t('elmessage.getExportListError'))
}
}
} catch (error) {
console.error('获取导出列表出错:', error)
stopExportListPolling()
if (!silentError) {
ElMessage.error(t('elmessage.getExportListError'))
}
} finally {
exportListRequesting.value = false
if (showLoading) {
exportListLoading.value = false
}
} }
} catch (error) {
console.error('获取导出列表出错:', error)
ElMessage.error(t('elmessage.getExportListError'))
} finally {
exportListLoading.value = false
}
} }
const downloadExportFile = (item) => { const downloadExportFile = (item) => {
if (item.state === 2) { if (item.state === 2) {
@ -1217,6 +1268,18 @@ const handlePagination = (type, val) => {
else pageInfo.value.pageNum = val; else pageInfo.value.pageNum = val;
getlist(); getlist();
}; };
watch(exportListVisible, (visible) => {
if (visible) {
getExportList()
} else {
stopExportListPolling()
}
})
onBeforeUnmount(() => {
stopExportListPolling()
})
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">

99
src/views/moneyManage/receiveDetail/receiveManage.vue

@ -642,7 +642,7 @@
<script setup> <script setup>
// //
import { ref, watch, onMounted, nextTick } from 'vue';
import { ref, watch, onMounted, nextTick, onBeforeUnmount } from 'vue';
import { storeToRefs } from 'pinia'; import { storeToRefs } from 'pinia';
import { ElMessage, ElMessageBox } from 'element-plus'; import { ElMessage, ElMessageBox } from 'element-plus';
import API from '@/util/http.js'; import API from '@/util/http.js';
@ -811,8 +811,42 @@ const closeConfirmRefund = () => {
// //
const exportListVisible = ref(false) const exportListVisible = ref(false)
const EXPORT_LIST_POLL_INTERVAL = 3000
let exportListPollingTimer = null
const exportList = ref([]) const exportList = ref([])
const exportListLoading = ref(false) const exportListLoading = ref(false)
const exportListRequesting = ref(false)
const sortExportList = (list = []) => {
return [...list].sort((a, b) => {
return new Date(b.createTime).getTime() - new Date(a.createTime).getTime()
})
}
const hasPendingExportTask = (list = []) => {
const latestTask = sortExportList(list)[0]
return latestTask ? latestTask.state === 0 || latestTask.state === 1 : false
}
const stopExportListPolling = () => {
if (exportListPollingTimer) {
clearInterval(exportListPollingTimer)
exportListPollingTimer = null
}
}
const startExportListPolling = () => {
if (exportListPollingTimer) {
return
}
exportListPollingTimer = setInterval(() => {
if (!exportListVisible.value) {
stopExportListPolling()
return
}
getExportList({ showLoading: false, silentError: true })
}, EXPORT_LIST_POLL_INTERVAL)
}
const exportExcel = async function () { const exportExcel = async function () {
let payCurrencySelect = ''; let payCurrencySelect = '';
@ -868,28 +902,47 @@ const exportExcel = async function () {
} }
const openExportList = () => { const openExportList = () => {
getExportList()
exportListVisible.value = true
exportListVisible.value = true
} }
// //
const getExportList = async () => {
exportListLoading.value = true
try {
const result = await API({ url: '/export/export' })
if (result.code === 200) {
const getExportList = async ({ showLoading = true, silentError = false } = {}) => {
if (exportListRequesting.value) {
return
}
if (showLoading) {
exportListLoading.value = true
}
exportListRequesting.value = true
try {
const result = await API({ url: '/export/export' })
if (result.code === 200) {
const filteredData = result.data.filter(item => { const filteredData = result.data.filter(item => {
return item.type === 13 return item.type === 13
}) })
exportList.value = filteredData
} else {
ElMessage.error(result.msg || t('elmessage.getExportListError'))
exportList.value = sortExportList(filteredData)
if (exportListVisible.value && hasPendingExportTask(exportList.value)) {
startExportListPolling()
} else {
stopExportListPolling()
}
} else {
stopExportListPolling()
if (!silentError) {
ElMessage.error(result.msg || t('elmessage.getExportListError'))
}
}
} catch (error) {
console.error('获取导出列表出错:', error)
stopExportListPolling()
if (!silentError) {
ElMessage.error(t('elmessage.getExportListError'))
}
} finally {
exportListRequesting.value = false
if (showLoading) {
exportListLoading.value = false
}
} }
} catch (error) {
console.error('获取导出列表出错:', error)
ElMessage.error(t('elmessage.getExportListError'))
} finally {
exportListLoading.value = false
}
} }
const downloadExportFile = (item) => { const downloadExportFile = (item) => {
if (item.state === 2) { if (item.state === 2) {
@ -1477,6 +1530,18 @@ const handlePagination = (type, val) => {
else pageInfo.value.pageNum = val; else pageInfo.value.pageNum = val;
getlist(); getlist();
}; };
watch(exportListVisible, (visible) => {
if (visible) {
getExportList()
} else {
stopExportListPolling()
}
})
onBeforeUnmount(() => {
stopExportListPolling()
})
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">

99
src/views/moneyManage/refundDetail/refundCharge.vue

@ -353,7 +353,7 @@
</el-dialog> </el-dialog>
</template> </template>
<script setup> <script setup>
import { ref, onMounted, computed, nextTick } from 'vue'
import { ref, onMounted, computed, nextTick, watch, onBeforeUnmount } from 'vue'
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
import API from '@/util/http.js' import API from '@/util/http.js'
const uploadUrl = 'https://api.homilychart.com/hljw/api/aws/upload' const uploadUrl = 'https://api.homilychart.com/hljw/api/aws/upload'
@ -407,9 +407,43 @@ const headFinance = ref('')// 总部财务
const executor = ref('')// const executor = ref('')//
const uploadRef = ref(null) const uploadRef = ref(null)
const exportListVisible = ref(false) const exportListVisible = ref(false)
const EXPORT_LIST_POLL_INTERVAL = 3000
let exportListPollingTimer = null
const exportList = ref([]) const exportList = ref([])
// //
const exportListLoading = ref(false) const exportListLoading = ref(false)
const exportListRequesting = ref(false)
const sortExportList = (list = []) => {
return [...list].sort((a, b) => {
return new Date(b.createTime).getTime() - new Date(a.createTime).getTime()
})
}
const hasPendingExportTask = (list = []) => {
const latestTask = sortExportList(list)[0]
return latestTask ? latestTask.state === 0 || latestTask.state === 1 : false
}
const stopExportListPolling = () => {
if (exportListPollingTimer) {
clearInterval(exportListPollingTimer)
exportListPollingTimer = null
}
}
const startExportListPolling = () => {
if (exportListPollingTimer) {
return
}
exportListPollingTimer = setInterval(() => {
if (!exportListVisible.value) {
stopExportListPolling()
return
}
getExportList({ showLoading: false, silentError: true })
}, EXPORT_LIST_POLL_INTERVAL)
}
const statusStepMap = { const statusStepMap = {
10: [1, false], 10: [1, false],
@ -755,27 +789,46 @@ const exportExcel = async function () {
} }
} }
const openExportList = () => { const openExportList = () => {
getExportList()
exportListVisible.value = true
exportListVisible.value = true
} }
const getExportList = async () => {
exportListLoading.value = true
try {
const result = await API({ url: '/export/export' })
if (result.code === 200) {
const getExportList = async ({ showLoading = true, silentError = false } = {}) => {
if (exportListRequesting.value) {
return
}
if (showLoading) {
exportListLoading.value = true
}
exportListRequesting.value = true
try {
const result = await API({ url: '/export/export' })
if (result.code === 200) {
const filteredData = result.data.filter(item => { const filteredData = result.data.filter(item => {
return item.type === 12 return item.type === 12
}) })
exportList.value = filteredData
} else {
ElMessage.error(result.msg || t('elmessage.getExportListError'))
exportList.value = sortExportList(filteredData)
if (exportListVisible.value && hasPendingExportTask(exportList.value)) {
startExportListPolling()
} else {
stopExportListPolling()
}
} else {
stopExportListPolling()
if (!silentError) {
ElMessage.error(result.msg || t('elmessage.getExportListError'))
}
}
} catch (error) {
console.error('获取导出列表出错:', error)
stopExportListPolling()
if (!silentError) {
ElMessage.error(t('elmessage.getExportListError'))
}
} finally {
exportListRequesting.value = false
if (showLoading) {
exportListLoading.value = false
}
} }
} catch (error) {
console.error('获取导出列表出错:', error)
ElMessage.error(t('elmessage.getExportListError'))
} finally {
exportListLoading.value = false
}
} }
const downloadExportFile = (item) => { const downloadExportFile = (item) => {
if (item.state === 2) { if (item.state === 2) {
@ -856,6 +909,18 @@ onMounted(() => {
getRefund() getRefund()
getMarket() getMarket()
}) })
watch(exportListVisible, (visible) => {
if (visible) {
getExportList()
} else {
stopExportListPolling()
}
})
onBeforeUnmount(() => {
stopExportListPolling()
})
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
:deep(.el-table__header-wrapper), :deep(.el-table__header-wrapper),

99
src/views/moneyManage/refundDetail/refundFinance.vue

@ -331,7 +331,7 @@
</el-dialog> </el-dialog>
</template> </template>
<script setup> <script setup>
import { ref, onMounted, computed, nextTick } from 'vue'
import { ref, onMounted, computed, nextTick, watch, onBeforeUnmount } from 'vue'
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
import API from '@/util/http.js' import API from '@/util/http.js'
const uploadUrl = 'https://api.homilychart.com/hljw/api/aws/upload' const uploadUrl = 'https://api.homilychart.com/hljw/api/aws/upload'
@ -388,9 +388,43 @@ const areaCharge = ref('')// 地区负责人
const headFinance = ref('')// const headFinance = ref('')//
const executor = ref('')// const executor = ref('')//
const exportListVisible = ref(false) const exportListVisible = ref(false)
const EXPORT_LIST_POLL_INTERVAL = 3000
let exportListPollingTimer = null
const exportList = ref([]) const exportList = ref([])
// //
const exportListLoading = ref(false) const exportListLoading = ref(false)
const exportListRequesting = ref(false)
const sortExportList = (list = []) => {
return [...list].sort((a, b) => {
return new Date(b.createTime).getTime() - new Date(a.createTime).getTime()
})
}
const hasPendingExportTask = (list = []) => {
const latestTask = sortExportList(list)[0]
return latestTask ? latestTask.state === 0 || latestTask.state === 1 : false
}
const stopExportListPolling = () => {
if (exportListPollingTimer) {
clearInterval(exportListPollingTimer)
exportListPollingTimer = null
}
}
const startExportListPolling = () => {
if (exportListPollingTimer) {
return
}
exportListPollingTimer = setInterval(() => {
if (!exportListVisible.value) {
stopExportListPolling()
return
}
getExportList({ showLoading: false, silentError: true })
}, EXPORT_LIST_POLL_INTERVAL)
}
const statusStepMap = { const statusStepMap = {
10: [1, false], 10: [1, false],
12: [2, true], 12: [2, true],
@ -725,27 +759,46 @@ const exportExcel = async function () {
} }
} }
const openExportList = () => { const openExportList = () => {
getExportList()
exportListVisible.value = true
exportListVisible.value = true
} }
const getExportList = async () => {
exportListLoading.value = true
try {
const result = await API({ url: '/export/export' })
if (result.code === 200) {
const getExportList = async ({ showLoading = true, silentError = false } = {}) => {
if (exportListRequesting.value) {
return
}
if (showLoading) {
exportListLoading.value = true
}
exportListRequesting.value = true
try {
const result = await API({ url: '/export/export' })
if (result.code === 200) {
const filteredData = result.data.filter(item => { const filteredData = result.data.filter(item => {
return item.type === 12 return item.type === 12
}) })
exportList.value = filteredData
} else {
ElMessage.error(result.msg || t('elmessage.getExportListError'))
exportList.value = sortExportList(filteredData)
if (exportListVisible.value && hasPendingExportTask(exportList.value)) {
startExportListPolling()
} else {
stopExportListPolling()
}
} else {
stopExportListPolling()
if (!silentError) {
ElMessage.error(result.msg || t('elmessage.getExportListError'))
}
}
} catch (error) {
console.error('获取导出列表出错:', error)
stopExportListPolling()
if (!silentError) {
ElMessage.error(t('elmessage.getExportListError'))
}
} finally {
exportListRequesting.value = false
if (showLoading) {
exportListLoading.value = false
}
} }
} catch (error) {
console.error('获取导出列表出错:', error)
ElMessage.error(t('elmessage.getExportListError'))
} finally {
exportListLoading.value = false
}
} }
const downloadExportFile = (item) => { const downloadExportFile = (item) => {
if (item.state === 2) { if (item.state === 2) {
@ -827,6 +880,18 @@ onMounted(() => {
getRefund() getRefund()
getMarket() getMarket()
}) })
watch(exportListVisible, (visible) => {
if (visible) {
getExportList()
} else {
stopExportListPolling()
}
})
onBeforeUnmount(() => {
stopExportListPolling()
})
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
:deep(.el-table__header-wrapper), :deep(.el-table__header-wrapper),

99
src/views/moneyManage/refundDetail/refundHeader.vue

@ -342,7 +342,7 @@
</template> </template>
<script setup> <script setup>
import BackgroundSvg from '@/assets/images/refund-progress.png' import BackgroundSvg from '@/assets/images/refund-progress.png'
import { ref, onMounted, nextTick } from 'vue'
import { ref, onMounted, nextTick, watch, onBeforeUnmount } from 'vue'
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
import API from '@/util/http.js' import API from '@/util/http.js'
const uploadUrl = 'https://api.homilychart.com/hljw/api/aws/upload' const uploadUrl = 'https://api.homilychart.com/hljw/api/aws/upload'
@ -401,9 +401,43 @@ const areaCharge = ref('')// 地区负责人
const headFinance = ref('')// const headFinance = ref('')//
const executor = ref('')// const executor = ref('')//
const exportListVisible = ref(false) const exportListVisible = ref(false)
const EXPORT_LIST_POLL_INTERVAL = 3000
let exportListPollingTimer = null
const exportList = ref([]) const exportList = ref([])
// //
const exportListLoading = ref(false) const exportListLoading = ref(false)
const exportListRequesting = ref(false)
const sortExportList = (list = []) => {
return [...list].sort((a, b) => {
return new Date(b.createTime).getTime() - new Date(a.createTime).getTime()
})
}
const hasPendingExportTask = (list = []) => {
const latestTask = sortExportList(list)[0]
return latestTask ? latestTask.state === 0 || latestTask.state === 1 : false
}
const stopExportListPolling = () => {
if (exportListPollingTimer) {
clearInterval(exportListPollingTimer)
exportListPollingTimer = null
}
}
const startExportListPolling = () => {
if (exportListPollingTimer) {
return
}
exportListPollingTimer = setInterval(() => {
if (!exportListVisible.value) {
stopExportListPolling()
return
}
getExportList({ showLoading: false, silentError: true })
}, EXPORT_LIST_POLL_INTERVAL)
}
const statusStepMap = { const statusStepMap = {
10: [1, false], 10: [1, false],
12: [2, true], 12: [2, true],
@ -770,27 +804,46 @@ const exportExcel = async function () {
} }
} }
const openExportList = () => { const openExportList = () => {
getExportList()
exportListVisible.value = true
exportListVisible.value = true
} }
const getExportList = async () => {
exportListLoading.value = true
try {
const result = await API({ url: '/export/export' })
if (result.code === 200) {
const getExportList = async ({ showLoading = true, silentError = false } = {}) => {
if (exportListRequesting.value) {
return
}
if (showLoading) {
exportListLoading.value = true
}
exportListRequesting.value = true
try {
const result = await API({ url: '/export/export' })
if (result.code === 200) {
const filteredData = result.data.filter(item => { const filteredData = result.data.filter(item => {
return item.type === 12 return item.type === 12
}) })
exportList.value = filteredData
} else {
ElMessage.error(result.msg || t('elmessage.getExportListError'))
exportList.value = sortExportList(filteredData)
if (exportListVisible.value && hasPendingExportTask(exportList.value)) {
startExportListPolling()
} else {
stopExportListPolling()
}
} else {
stopExportListPolling()
if (!silentError) {
ElMessage.error(result.msg || t('elmessage.getExportListError'))
}
}
} catch (error) {
console.error('获取导出列表出错:', error)
stopExportListPolling()
if (!silentError) {
ElMessage.error(t('elmessage.getExportListError'))
}
} finally {
exportListRequesting.value = false
if (showLoading) {
exportListLoading.value = false
}
} }
} catch (error) {
console.error('获取导出列表出错:', error)
ElMessage.error(t('elmessage.getExportListError'))
} finally {
exportListLoading.value = false
}
} }
const downloadExportFile = (item) => { const downloadExportFile = (item) => {
if (item.state === 2) { if (item.state === 2) {
@ -897,6 +950,18 @@ onMounted(() => {
getRefund() getRefund()
getMarket() getMarket()
}) })
watch(exportListVisible, (visible) => {
if (visible) {
getExportList()
} else {
stopExportListPolling()
}
})
onBeforeUnmount(() => {
stopExportListPolling()
})
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
:deep(.el-table__header-wrapper), :deep(.el-table__header-wrapper),

98
src/views/recharge/bean/beanOnlineRecharge.vue

@ -1,5 +1,5 @@
<script setup> <script setup>
import { ref, onMounted, reactive, computed, nextTick } from 'vue'
import { ref, onMounted, reactive, computed, nextTick, watch, onBeforeUnmount } from 'vue'
import ElementPlus from 'element-plus' import ElementPlus from 'element-plus'
import { ElMessage, ElMessageBox } from 'element-plus' import { ElMessage, ElMessageBox } from 'element-plus'
import { AiFillRead } from 'vue-icons-plus/ai' import { AiFillRead } from 'vue-icons-plus/ai'
@ -276,10 +276,11 @@ const exportExcel = async () => {
} }
} }
const exportListVisible = ref(false) const exportListVisible = ref(false)
const EXPORT_LIST_POLL_INTERVAL = 3000
let exportListPollingTimer = null
// //
const openExportList = () => { const openExportList = () => {
getExportList()
exportListVisible.value = true exportListVisible.value = true
} }
@ -287,26 +288,79 @@ const openExportList = () => {
const exportList = ref([]) const exportList = ref([])
// //
const exportListLoading = ref(false) const exportListLoading = ref(false)
const exportListRequesting = ref(false)
const sortExportList = (list = []) => {
return [...list].sort((a, b) => {
return new Date(b.createTime).getTime() - new Date(a.createTime).getTime()
})
}
const hasPendingExportTask = (list = []) => {
const latestTask = sortExportList(list)[0]
return latestTask ? latestTask.state === 0 || latestTask.state === 1 : false
}
const stopExportListPolling = () => {
if (exportListPollingTimer) {
clearInterval(exportListPollingTimer)
exportListPollingTimer = null
}
}
const startExportListPolling = () => {
if (exportListPollingTimer) {
return
}
exportListPollingTimer = setInterval(() => {
if (!exportListVisible.value) {
stopExportListPolling()
return
}
getExportList({ showLoading: false, silentError: true })
}, EXPORT_LIST_POLL_INTERVAL)
}
// //
const getExportList = async () => {
exportListLoading.value = true
try {
const result = await API({ url: '/export/export' })
if (result.code === 200) {
const getExportList = async ({ showLoading = true, silentError = false } = {}) => {
if (exportListRequesting.value) {
return
}
if (showLoading) {
exportListLoading.value = true
}
exportListRequesting.value = true
try {
const result = await API({ url: '/export/export' })
if (result.code === 200) {
const filteredData = result.data.filter(item => { const filteredData = result.data.filter(item => {
return item.type === 10; return item.type === 10;
}); });
exportList.value = filteredData
} else {
ElMessage.error(result.msg || '获取导出列表失败')
exportList.value = sortExportList(filteredData)
if (exportListVisible.value && hasPendingExportTask(exportList.value)) {
startExportListPolling()
} else {
stopExportListPolling()
}
} else {
stopExportListPolling()
if (!silentError) {
ElMessage.error(result.msg || '获取导出列表失败')
}
}
} catch (error) {
console.error('获取导出列表出错:', error)
stopExportListPolling()
if (!silentError) {
ElMessage.error(t('elmessage.getExportListError'))
}
} finally {
exportListRequesting.value = false
if (showLoading) {
exportListLoading.value = false
}
} }
} catch (error) {
console.error('获取导出列表出错:', error)
ElMessage.error(t('elmessage.getExportListError'))
} finally {
exportListLoading.value = false
}
} }
// //
const downloadExportFile = (item) => { const downloadExportFile = (item) => {
if (item.state === 2) { if (item.state === 2) {
@ -357,6 +411,18 @@ onMounted(async function () {
await getArea() await getArea()
await getTotalBeans() await getTotalBeans()
}) })
watch(exportListVisible, (visible) => {
if (visible) {
getExportList()
} else {
stopExportListPolling()
}
})
onBeforeUnmount(() => {
stopExportListPolling()
})
</script> </script>
<template> <template>
<el-card class="card1" style="margin-bottom: 0.5vh;"> <el-card class="card1" style="margin-bottom: 0.5vh;">

98
src/views/recharge/bean/beanSystemRecharge.vue

@ -1,5 +1,5 @@
<script setup> <script setup>
import { ref, onMounted, reactive, computed, watch, nextTick } from 'vue'
import { ref, onMounted, reactive, computed, watch, nextTick, onBeforeUnmount } from 'vue'
import ElementPlus from 'element-plus' import ElementPlus from 'element-plus'
import { ElMessage, ElMessageBox } from 'element-plus' import { ElMessage, ElMessageBox } from 'element-plus'
import { AiFillRead } from 'vue-icons-plus/ai' import { AiFillRead } from 'vue-icons-plus/ai'
@ -280,10 +280,11 @@ const exportExcel = async () => {
} }
} }
const exportListVisible = ref(false) const exportListVisible = ref(false)
const EXPORT_LIST_POLL_INTERVAL = 3000
let exportListPollingTimer = null
// //
const openExportList = () => { const openExportList = () => {
getExportList()
exportListVisible.value = true exportListVisible.value = true
} }
@ -291,26 +292,79 @@ const openExportList = () => {
const exportList = ref([]) const exportList = ref([])
// //
const exportListLoading = ref(false) const exportListLoading = ref(false)
const exportListRequesting = ref(false)
const sortExportList = (list = []) => {
return [...list].sort((a, b) => {
return new Date(b.createTime).getTime() - new Date(a.createTime).getTime()
})
}
const hasPendingExportTask = (list = []) => {
const latestTask = sortExportList(list)[0]
return latestTask ? latestTask.state === 0 || latestTask.state === 1 : false
}
const stopExportListPolling = () => {
if (exportListPollingTimer) {
clearInterval(exportListPollingTimer)
exportListPollingTimer = null
}
}
const startExportListPolling = () => {
if (exportListPollingTimer) {
return
}
exportListPollingTimer = setInterval(() => {
if (!exportListVisible.value) {
stopExportListPolling()
return
}
getExportList({ showLoading: false, silentError: true })
}, EXPORT_LIST_POLL_INTERVAL)
}
// //
const getExportList = async () => {
exportListLoading.value = true
try {
const result = await API({ url: '/export/export' })
if (result.code === 200) {
const getExportList = async ({ showLoading = true, silentError = false } = {}) => {
if (exportListRequesting.value) {
return
}
if (showLoading) {
exportListLoading.value = true
}
exportListRequesting.value = true
try {
const result = await API({ url: '/export/export' })
if (result.code === 200) {
const filteredData = result.data.filter(item => { const filteredData = result.data.filter(item => {
return item.type === 9; return item.type === 9;
}); });
exportList.value = filteredData
} else {
ElMessage.error(result.msg || t('elmessage.getExportListError'))
exportList.value = sortExportList(filteredData)
if (exportListVisible.value && hasPendingExportTask(exportList.value)) {
startExportListPolling()
} else {
stopExportListPolling()
}
} else {
stopExportListPolling()
if (!silentError) {
ElMessage.error(result.msg || t('elmessage.getExportListError'))
}
}
} catch (error) {
console.error('获取导出列表出错:', error)
stopExportListPolling()
if (!silentError) {
ElMessage.error(t('elmessage.getExportListError'))
}
} finally {
exportListRequesting.value = false
if (showLoading) {
exportListLoading.value = false
}
} }
} catch (error) {
console.error('获取导出列表出错:', error)
ElMessage.error(t('elmessage.getExportListError'))
} finally {
exportListLoading.value = false
}
} }
// //
const downloadExportFile = (item) => { const downloadExportFile = (item) => {
if (item.state === 2) { if (item.state === 2) {
@ -361,6 +415,18 @@ onMounted(async function () {
await getArea() await getArea()
await getTotalBeans() await getTotalBeans()
}) })
watch(exportListVisible, (visible) => {
if (visible) {
getExportList()
} else {
stopExportListPolling()
}
})
onBeforeUnmount(() => {
stopExportListPolling()
})
</script> </script>
<template> <template>
<el-card class="card1" style="margin-bottom: 0.5vh"> <el-card class="card1" style="margin-bottom: 0.5vh">

12
src/views/recharge/gold/coinRechargeDetail.vue

@ -548,8 +548,15 @@ const exportListLoading = ref(false)
const exportListRequesting = ref(false) const exportListRequesting = ref(false)
// / // /
const sortExportList = (list = []) => {
return [...list].sort((a, b) => {
return new Date(b.createTime).getTime() - new Date(a.createTime).getTime()
})
}
const hasPendingExportTask = (list = []) => { const hasPendingExportTask = (list = []) => {
return list.some(item => item.state === 0 || item.state === 1)
const latestTask = sortExportList(list)[0]
return latestTask ? latestTask.state === 0 || latestTask.state === 1 : false
} }
// //
@ -591,7 +598,7 @@ const getExportList = async ({ showLoading = true, silentError = false } = {}) =
const filteredData = result.data.filter(item => { const filteredData = result.data.filter(item => {
return item.type === 2; //2 return item.type === 2; //2
}); });
exportList.value = filteredData
exportList.value = sortExportList(filteredData)
// / // /
if (exportListVisible.value && hasPendingExportTask(filteredData)) { if (exportListVisible.value && hasPendingExportTask(filteredData)) {
startExportListPolling() startExportListPolling()
@ -617,6 +624,7 @@ const getExportList = async ({ showLoading = true, silentError = false } = {}) =
} }
} }
} }
// //
const downloadExportFile = (item) => { const downloadExportFile = (item) => {
if (item.state === 2) { if (item.state === 2) {

98
src/views/refund/gold/coinRefundDetail.vue

@ -1,6 +1,6 @@
<script setup> <script setup>
// 退 // 退
import { computed, onMounted, ref,watch,nextTick } from 'vue'
import { computed, onMounted, ref, watch, nextTick, onBeforeUnmount } from 'vue'
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
import moment from 'moment' import moment from 'moment'
import API from '@/util/http.js' import API from '@/util/http.js'
@ -398,10 +398,11 @@ const exportExcel = async function () {
} }
const exportListVisible = ref(false) const exportListVisible = ref(false)
const EXPORT_LIST_POLL_INTERVAL = 3000
let exportListPollingTimer = null
// //
const openExportList = () => { const openExportList = () => {
getExportList()
exportListVisible.value = true exportListVisible.value = true
} }
@ -409,26 +410,79 @@ const openExportList = () => {
const exportList = ref([]) const exportList = ref([])
// //
const exportListLoading = ref(false) const exportListLoading = ref(false)
const exportListRequesting = ref(false)
const sortExportList = (list = []) => {
return [...list].sort((a, b) => {
return new Date(b.createTime).getTime() - new Date(a.createTime).getTime()
})
}
const hasPendingExportTask = (list = []) => {
const latestTask = sortExportList(list)[0]
return latestTask ? latestTask.state === 0 || latestTask.state === 1 : false
}
const stopExportListPolling = () => {
if (exportListPollingTimer) {
clearInterval(exportListPollingTimer)
exportListPollingTimer = null
}
}
const startExportListPolling = () => {
if (exportListPollingTimer) {
return
}
exportListPollingTimer = setInterval(() => {
if (!exportListVisible.value) {
stopExportListPolling()
return
}
getExportList({ showLoading: false, silentError: true })
}, EXPORT_LIST_POLL_INTERVAL)
}
// //
const getExportList = async () => {
exportListLoading.value = true
try {
const result = await API({ url: '/export/export' })
if (result.code === 200) {
const getExportList = async ({ showLoading = true, silentError = false } = {}) => {
if (exportListRequesting.value) {
return
}
if (showLoading) {
exportListLoading.value = true
}
exportListRequesting.value = true
try {
const result = await API({ url: '/export/export' })
if (result.code === 200) {
const filteredData = result.data.filter(item => { const filteredData = result.data.filter(item => {
return item.type === 3; //3退 return item.type === 3; //3退
}); });
exportList.value = filteredData
} else {
ElMessage.error(result.msg || t("elmessage.getExportListError"))
exportList.value = sortExportList(filteredData)
if (exportListVisible.value && hasPendingExportTask(exportList.value)) {
startExportListPolling()
} else {
stopExportListPolling()
}
} else {
stopExportListPolling()
if (!silentError) {
ElMessage.error(result.msg || t("elmessage.getExportListError"))
}
}
} catch (error) {
console.error('获取导出列表出错:', error)
stopExportListPolling()
if (!silentError) {
ElMessage.error(t("elmessage.getExportListFailed"))
}
} finally {
exportListRequesting.value = false
if (showLoading) {
exportListLoading.value = false
}
} }
} catch (error) {
console.error('获取导出列表出错:', error)
ElMessage.error(t("elmessage.getExportListFailed"))
} finally {
exportListLoading.value = false
}
} }
// //
const downloadExportFile = (item) => { const downloadExportFile = (item) => {
if (item.state === 2) { if (item.state === 2) {
@ -517,6 +571,18 @@ const getMarket = async function () {
console.log('请求失败', error) console.log('请求失败', error)
} }
} }
watch(exportListVisible, (visible) => {
if (visible) {
getExportList()
} else {
stopExportListPolling()
}
})
onBeforeUnmount(() => {
stopExportListPolling()
})
</script> </script>
<template> <template>

98
src/views/usergold/gold/clientCountBalance.vue

@ -13,7 +13,7 @@ const { adminData, menuTree, flag } = storeToRefs(adminStore)
get() get()
} }
}) })
import { onMounted, ref, watch, nextTick } from 'vue'
import { onMounted, ref, watch, nextTick, onBeforeUnmount } from 'vue'
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
import moment from 'moment' import moment from 'moment'
@ -306,10 +306,11 @@ const exportExcel = async function () {
} }
const exportListVisible = ref(false) const exportListVisible = ref(false)
const EXPORT_LIST_POLL_INTERVAL = 3000
let exportListPollingTimer = null
// //
const openExportList = () => { const openExportList = () => {
getExportList()
exportListVisible.value = true exportListVisible.value = true
} }
@ -317,26 +318,79 @@ const openExportList = () => {
const exportList = ref([]) const exportList = ref([])
// //
const exportListLoading = ref(false) const exportListLoading = ref(false)
const exportListRequesting = ref(false)
const sortExportList = (list = []) => {
return [...list].sort((a, b) => {
return new Date(b.createTime).getTime() - new Date(a.createTime).getTime()
})
}
const hasPendingExportTask = (list = []) => {
const latestTask = sortExportList(list)[0]
return latestTask ? latestTask.state === 0 || latestTask.state === 1 : false
}
const stopExportListPolling = () => {
if (exportListPollingTimer) {
clearInterval(exportListPollingTimer)
exportListPollingTimer = null
}
}
const startExportListPolling = () => {
if (exportListPollingTimer) {
return
}
exportListPollingTimer = setInterval(() => {
if (!exportListVisible.value) {
stopExportListPolling()
return
}
getExportList({ showLoading: false, silentError: true })
}, EXPORT_LIST_POLL_INTERVAL)
}
// //
const getExportList = async () => {
exportListLoading.value = true
try {
const result = await API({ url: '/export/export' })
if (result.code === 200) {
const getExportList = async ({ showLoading = true, silentError = false } = {}) => {
if (exportListRequesting.value) {
return
}
if (showLoading) {
exportListLoading.value = true
}
exportListRequesting.value = true
try {
const result = await API({ url: '/export/export' })
if (result.code === 200) {
const filteredData = result.data.filter(item => { const filteredData = result.data.filter(item => {
return item.type === 1; //type0 return item.type === 1; //type0
}); });
exportList.value = filteredData
} else {
ElMessage.error(result.msg || t('elmessage.getExportListError'))
exportList.value = sortExportList(filteredData)
if (exportListVisible.value && hasPendingExportTask(exportList.value)) {
startExportListPolling()
} else {
stopExportListPolling()
}
} else {
stopExportListPolling()
if (!silentError) {
ElMessage.error(result.msg || t('elmessage.getExportListError'))
}
}
} catch (error) {
console.error('获取导出列表出错:', error)
stopExportListPolling()
if (!silentError) {
ElMessage.error(t('elmessage.getExportListError'))
}
} finally {
exportListRequesting.value = false
if (showLoading) {
exportListLoading.value = false
}
} }
} catch (error) {
console.error('获取导出列表出错:', error)
ElMessage.error(t('elmessage.getExportListError'))
} finally {
exportListLoading.value = false
}
} }
// //
const downloadExportFile = (item) => { const downloadExportFile = (item) => {
if (item.state === 2) { if (item.state === 2) {
@ -447,6 +501,18 @@ const handleMouseLeave = () => {
popoverVisible.value = false popoverVisible.value = false
} }
watch(exportListVisible, (visible) => {
if (visible) {
getExportList()
} else {
stopExportListPolling()
}
})
onBeforeUnmount(() => {
stopExportListPolling()
})
</script> </script>
<template> <template>

98
src/views/usergold/gold/clientCountDetail.vue

@ -1,5 +1,5 @@
<script setup> <script setup>
import { onMounted, ref, watch, nextTick } from 'vue'
import { onMounted, ref, watch, nextTick, onBeforeUnmount } from 'vue'
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
import moment from 'moment' import moment from 'moment'
@ -358,10 +358,11 @@ onMounted(async function () {
}) })
const exportListVisible = ref(false) const exportListVisible = ref(false)
const EXPORT_LIST_POLL_INTERVAL = 3000
let exportListPollingTimer = null
// //
const openExportList = () => { const openExportList = () => {
getExportList()
exportListVisible.value = true exportListVisible.value = true
} }
@ -369,26 +370,79 @@ const openExportList = () => {
const exportList = ref([]) const exportList = ref([])
// //
const exportListLoading = ref(false) const exportListLoading = ref(false)
const exportListRequesting = ref(false)
const sortExportList = (list = []) => {
return [...list].sort((a, b) => {
return new Date(b.createTime).getTime() - new Date(a.createTime).getTime()
})
}
const hasPendingExportTask = (list = []) => {
const latestTask = sortExportList(list)[0]
return latestTask ? latestTask.state === 0 || latestTask.state === 1 : false
}
const stopExportListPolling = () => {
if (exportListPollingTimer) {
clearInterval(exportListPollingTimer)
exportListPollingTimer = null
}
}
const startExportListPolling = () => {
if (exportListPollingTimer) {
return
}
exportListPollingTimer = setInterval(() => {
if (!exportListVisible.value) {
stopExportListPolling()
return
}
getExportList({ showLoading: false, silentError: true })
}, EXPORT_LIST_POLL_INTERVAL)
}
// //
const getExportList = async () => {
exportListLoading.value = true
try {
const result = await API({ url: '/export/export' })
if (result.code === 200) {
const getExportList = async ({ showLoading = true, silentError = false } = {}) => {
if (exportListRequesting.value) {
return
}
if (showLoading) {
exportListLoading.value = true
}
exportListRequesting.value = true
try {
const result = await API({ url: '/export/export' })
if (result.code === 200) {
const filteredData = result.data.filter(item => { const filteredData = result.data.filter(item => {
return item.type === 0; //0 return item.type === 0; //0
}); });
exportList.value = filteredData
} else {
ElMessage.error(result.msg || t('elmessage.getExportListError'))
exportList.value = sortExportList(filteredData)
if (exportListVisible.value && hasPendingExportTask(exportList.value)) {
startExportListPolling()
} else {
stopExportListPolling()
}
} else {
stopExportListPolling()
if (!silentError) {
ElMessage.error(result.msg || t('elmessage.getExportListError'))
}
}
} catch (error) {
console.error('获取导出列表出错:', error)
stopExportListPolling()
if (!silentError) {
ElMessage.error(t('elmessage.getExportListError'))
}
} finally {
exportListRequesting.value = false
if (showLoading) {
exportListLoading.value = false
}
} }
} catch (error) {
console.error('获取导出列表出错:', error)
ElMessage.error(t('elmessage.getExportListError'))
} finally {
exportListLoading.value = false
}
} }
// //
const downloadExportFile = (item) => { const downloadExportFile = (item) => {
if (item.state === 2) { if (item.state === 2) {
@ -485,6 +539,18 @@ const format3 = (num) => {
// //
return num.toLocaleString('en-US') return num.toLocaleString('en-US')
} }
watch(exportListVisible, (visible) => {
if (visible) {
getExportList()
} else {
stopExportListPolling()
}
})
onBeforeUnmount(() => {
stopExportListPolling()
})
</script> </script>
<template> <template>
<div> <div>

98
src/views/usergold/gold/clientCountWallet.vue

@ -13,7 +13,7 @@ const { adminData, menuTree, flag } = storeToRefs(adminStore)
get() get()
} }
}) })
import { onMounted, ref, watch, nextTick } from 'vue'
import { onMounted, ref, watch, nextTick, onBeforeUnmount } from 'vue'
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
import moment from 'moment' import moment from 'moment'
import API from '@/util/http.js' import API from '@/util/http.js'
@ -446,6 +446,8 @@ const exportExcelOnlyOne = async function () {
const exportListVisible = ref(false) const exportListVisible = ref(false)
const EXPORT_LIST_POLL_INTERVAL = 3000
let exportListPollingTimer = null
const selectWalletVisible = ref(false) const selectWalletVisible = ref(false)
const selectWalletFormRef = ref(null) const selectWalletFormRef = ref(null)
const selectWalletRules = { const selectWalletRules = {
@ -502,7 +504,6 @@ const companyWalletList = ref([
]) ])
// //
const openExportList = () => { const openExportList = () => {
getExportList()
exportListVisible.value = true exportListVisible.value = true
} }
@ -510,27 +511,80 @@ const openExportList = () => {
const exportList = ref([]) const exportList = ref([])
// //
const exportListLoading = ref(false) const exportListLoading = ref(false)
const exportListRequesting = ref(false)
const sortExportList = (list = []) => {
return [...list].sort((a, b) => {
return new Date(b.createTime).getTime() - new Date(a.createTime).getTime()
})
}
const hasPendingExportTask = (list = []) => {
const latestTask = sortExportList(list)[0]
return latestTask ? latestTask.state === 0 || latestTask.state === 1 : false
}
const stopExportListPolling = () => {
if (exportListPollingTimer) {
clearInterval(exportListPollingTimer)
exportListPollingTimer = null
}
}
const startExportListPolling = () => {
if (exportListPollingTimer) {
return
}
exportListPollingTimer = setInterval(() => {
if (!exportListVisible.value) {
stopExportListPolling()
return
}
getExportList({ showLoading: false, silentError: true })
}, EXPORT_LIST_POLL_INTERVAL)
}
// //
const getExportList = async () => {
exportListLoading.value = true
try {
const result = await API({ url: '/export/export' })
if (result.code === 200) {
const getExportList = async ({ showLoading = true, silentError = false } = {}) => {
if (exportListRequesting.value) {
return
}
if (showLoading) {
exportListLoading.value = true
}
exportListRequesting.value = true
try {
const result = await API({ url: '/export/export' })
if (result.code === 200) {
// type1617 // type1617
const filteredData = result.data.filter(item => { const filteredData = result.data.filter(item => {
return item.type === 16 || item.type === 17; return item.type === 16 || item.type === 17;
}); });
exportList.value = filteredData
} else {
ElMessage.error(result.msg || t('elmessage.getExportListError'))
exportList.value = sortExportList(filteredData)
if (exportListVisible.value && hasPendingExportTask(exportList.value)) {
startExportListPolling()
} else {
stopExportListPolling()
}
} else {
stopExportListPolling()
if (!silentError) {
ElMessage.error(result.msg || t('elmessage.getExportListError'))
}
}
} catch (error) {
console.error('获取导出列表出错:', error)
stopExportListPolling()
if (!silentError) {
ElMessage.error(t('elmessage.getExportListError'))
}
} finally {
exportListRequesting.value = false
if (showLoading) {
exportListLoading.value = false
}
} }
} catch (error) {
console.error('获取导出列表出错:', error)
ElMessage.error(t('elmessage.getExportListError'))
} finally {
exportListLoading.value = false
}
} }
// //
const downloadExportFile = (item) => { const downloadExportFile = (item) => {
if (item.state === 2) { if (item.state === 2) {
@ -626,6 +680,18 @@ const format3 = (num) => {
return num.toLocaleString('en-US') return num.toLocaleString('en-US')
} }
watch(exportListVisible, (visible) => {
if (visible) {
getExportList()
} else {
stopExportListPolling()
}
})
onBeforeUnmount(() => {
stopExportListPolling()
})
</script> </script>
<template> <template>

98
src/views/walletManage/WalletBalance.vue

@ -13,7 +13,7 @@ watch(flag, (newFlag, oldFlag) => {
get() get()
} }
}) })
import { onMounted, ref, watch, nextTick } from 'vue'
import { onMounted, ref, watch, nextTick, onBeforeUnmount } from 'vue'
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
import moment from 'moment' import moment from 'moment'
import API from '@/util/http.js' import API from '@/util/http.js'
@ -446,6 +446,8 @@ const exportExcelOnlyOne = async function () {
const exportListVisible = ref(false) const exportListVisible = ref(false)
const EXPORT_LIST_POLL_INTERVAL = 3000
let exportListPollingTimer = null
const selectWalletVisible = ref(false) const selectWalletVisible = ref(false)
const selectWalletFormRef = ref(null) const selectWalletFormRef = ref(null)
const selectWalletRules = { const selectWalletRules = {
@ -502,7 +504,6 @@ const companyWalletList = ref([
]) ])
// //
const openExportList = () => { const openExportList = () => {
getExportList()
exportListVisible.value = true exportListVisible.value = true
} }
@ -510,27 +511,80 @@ const openExportList = () => {
const exportList = ref([]) const exportList = ref([])
// //
const exportListLoading = ref(false) const exportListLoading = ref(false)
const exportListRequesting = ref(false)
const sortExportList = (list = []) => {
return [...list].sort((a, b) => {
return new Date(b.createTime).getTime() - new Date(a.createTime).getTime()
})
}
const hasPendingExportTask = (list = []) => {
const latestTask = sortExportList(list)[0]
return latestTask ? latestTask.state === 0 || latestTask.state === 1 : false
}
const stopExportListPolling = () => {
if (exportListPollingTimer) {
clearInterval(exportListPollingTimer)
exportListPollingTimer = null
}
}
const startExportListPolling = () => {
if (exportListPollingTimer) {
return
}
exportListPollingTimer = setInterval(() => {
if (!exportListVisible.value) {
stopExportListPolling()
return
}
getExportList({ showLoading: false, silentError: true })
}, EXPORT_LIST_POLL_INTERVAL)
}
// //
const getExportList = async () => {
exportListLoading.value = true
try {
const result = await API({ url: '/export/export' })
if (result.code === 200) {
const getExportList = async ({ showLoading = true, silentError = false } = {}) => {
if (exportListRequesting.value) {
return
}
if (showLoading) {
exportListLoading.value = true
}
exportListRequesting.value = true
try {
const result = await API({ url: '/export/export' })
if (result.code === 200) {
// type1617 // type1617
const filteredData = result.data.filter(item => { const filteredData = result.data.filter(item => {
return item.type === 16 || item.type === 17; return item.type === 16 || item.type === 17;
}); });
exportList.value = filteredData
} else {
ElMessage.error(result.msg || t('elmessage.getExportListError'))
exportList.value = sortExportList(filteredData)
if (exportListVisible.value && hasPendingExportTask(exportList.value)) {
startExportListPolling()
} else {
stopExportListPolling()
}
} else {
stopExportListPolling()
if (!silentError) {
ElMessage.error(result.msg || t('elmessage.getExportListError'))
}
}
} catch (error) {
console.error('获取导出列表出错:', error)
stopExportListPolling()
if (!silentError) {
ElMessage.error(t('elmessage.getExportListError'))
}
} finally {
exportListRequesting.value = false
if (showLoading) {
exportListLoading.value = false
}
} }
} catch (error) {
console.error('获取导出列表出错:', error)
ElMessage.error(t('elmessage.getExportListError'))
} finally {
exportListLoading.value = false
}
} }
// //
const downloadExportFile = (item) => { const downloadExportFile = (item) => {
if (item.state === 2) { if (item.state === 2) {
@ -626,6 +680,18 @@ const format3 = (num) => {
return num.toLocaleString('en-US') return num.toLocaleString('en-US')
} }
watch(exportListVisible, (visible) => {
if (visible) {
getExportList()
} else {
stopExportListPolling()
}
})
onBeforeUnmount(() => {
stopExportListPolling()
})
</script> </script>
<template> <template>

97
src/views/walletManage/components/WalletDetailTemplate.vue

@ -1,5 +1,5 @@
<script setup> <script setup>
import { ref, watch, nextTick, onMounted } from 'vue'
import { ref, watch, nextTick, onMounted, onBeforeUnmount } from 'vue'
import { useRoute } from 'vue-router' import { useRoute } from 'vue-router'
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
import API from '@/util/http.js' import API from '@/util/http.js'
@ -169,8 +169,42 @@ watch(
// ==================== ==================== // ==================== ====================
const exportListVisible = ref(false) const exportListVisible = ref(false)
const EXPORT_LIST_POLL_INTERVAL = 3000
let exportListPollingTimer = null
const exportList = ref([]) const exportList = ref([])
const exportListLoading = ref(false) const exportListLoading = ref(false)
const exportListRequesting = ref(false)
const sortExportList = (list = []) => {
return [...list].sort((a, b) => {
return new Date(b.createTime).getTime() - new Date(a.createTime).getTime()
})
}
const hasPendingExportTask = (list = []) => {
const latestTask = sortExportList(list)[0]
return latestTask ? latestTask.state === 0 || latestTask.state === 1 : false
}
const stopExportListPolling = () => {
if (exportListPollingTimer) {
clearInterval(exportListPollingTimer)
exportListPollingTimer = null
}
}
const startExportListPolling = () => {
if (exportListPollingTimer) {
return
}
exportListPollingTimer = setInterval(() => {
if (!exportListVisible.value) {
stopExportListPolling()
return
}
getExportList({ showLoading: false, silentError: true })
}, EXPORT_LIST_POLL_INTERVAL)
}
const exportExcelOnlyOne = async function () { const exportExcelOnlyOne = async function () {
if (!selectData.value.walletId) { if (!selectData.value.walletId) {
@ -206,30 +240,49 @@ const exportExcelOnlyOne = async function () {
// //
const openExportList = () => { const openExportList = () => {
getExportList()
exportListVisible.value = true exportListVisible.value = true
} }
// //
const getExportList = async () => {
exportListLoading.value = true
try {
const result = await API({ url: '/export/export' })
if (result.code === 200) {
const getExportList = async ({ showLoading = true, silentError = false } = {}) => {
if (exportListRequesting.value) {
return
}
if (showLoading) {
exportListLoading.value = true
}
exportListRequesting.value = true
try {
const result = await API({ url: '/export/export' })
if (result.code === 200) {
// type 16 17 WalletBalance // type 16 17 WalletBalance
const filteredData = result.data.filter(item => { const filteredData = result.data.filter(item => {
return item.type === 16 || item.type === 17; return item.type === 16 || item.type === 17;
}); });
exportList.value = filteredData
} else {
ElMessage.error(result.msg || t('elmessage.getExportListError'))
exportList.value = sortExportList(filteredData)
if (exportListVisible.value && hasPendingExportTask(exportList.value)) {
startExportListPolling()
} else {
stopExportListPolling()
}
} else {
stopExportListPolling()
if (!silentError) {
ElMessage.error(result.msg || t('elmessage.getExportListError'))
}
}
} catch (error) {
console.error('获取导出列表出错:', error)
stopExportListPolling()
if (!silentError) {
ElMessage.error(t('elmessage.getExportListError'))
}
} finally {
exportListRequesting.value = false
if (showLoading) {
exportListLoading.value = false
}
} }
} catch (error) {
console.error('获取导出列表出错:', error)
ElMessage.error(t('elmessage.getExportListError'))
} finally {
exportListLoading.value = false
}
} }
// //
@ -308,6 +361,18 @@ onMounted(() => {
selectMarket() selectMarket()
}) })
watch(exportListVisible, (visible) => {
if (visible) {
getExportList()
} else {
stopExportListPolling()
}
})
onBeforeUnmount(() => {
stopExportListPolling()
})
</script> </script>
<template> <template>

Loading…
Cancel
Save