增加计费列表收货时间查询
This commit is contained in:
@@ -1,5 +1,19 @@
|
||||
<template>
|
||||
<div class="app-container order-bill-query">
|
||||
<div v-if="exportFloatVisible" class="retry-status-float export-status-float" :class="{ 'is-offset': rebillFloatVisible }">
|
||||
<el-tooltip :content="exportFloatTooltip" placement="bottom">
|
||||
<el-button class="retry-status-button" type="warning" plain size="small" @click="openExportProgress()">
|
||||
<span class="retry-progress-ring" :style="{ '--retry-progress': exportProgressDegree + 'deg' }" aria-hidden="true">
|
||||
<span class="retry-progress-value">{{ exportProgressText }}</span>
|
||||
</span>
|
||||
<span class="retry-status-text">
|
||||
<strong>{{ exportFloatTitle }}</strong>
|
||||
<small>{{ exportFloatSummary }}</small>
|
||||
</span>
|
||||
</el-button>
|
||||
</el-tooltip>
|
||||
</div>
|
||||
|
||||
<div v-if="rebillFloatVisible" class="retry-status-float">
|
||||
<el-tooltip :content="rebillFloatTooltip" placement="bottom">
|
||||
<el-button class="retry-status-button" type="primary" plain size="small" @click="openRebillProgress()">
|
||||
@@ -58,6 +72,8 @@
|
||||
type="warning"
|
||||
plain
|
||||
icon="Download"
|
||||
:loading="exportLoading"
|
||||
:disabled="exportLoading"
|
||||
v-hasPermi="['price:orderBill:export']"
|
||||
@click="handleExport"
|
||||
>导出</el-button>
|
||||
@@ -208,6 +224,32 @@
|
||||
<el-button v-else type="primary" @click="rebillProgressVisible = false">关闭</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
<el-dialog
|
||||
v-model="exportProgressVisible"
|
||||
:title="exportDialogTitle"
|
||||
width="480px"
|
||||
append-to-body
|
||||
:close-on-click-modal="false"
|
||||
:close-on-press-escape="true"
|
||||
:show-close="true"
|
||||
>
|
||||
<el-progress
|
||||
:percentage="exportProgressPercent"
|
||||
:status="exportProgressStatus"
|
||||
:stroke-width="14"
|
||||
striped
|
||||
:striped-flow="exportLoading"
|
||||
/>
|
||||
<div class="rebill-progress__msg">{{ exportProgressMessage }}</div>
|
||||
<div class="rebill-progress__text">
|
||||
导出行数 {{ exportProgressRowCount }}
|
||||
</div>
|
||||
<p v-if="exportLoading" class="rebill-progress__hint">导出在后台进行,可收起弹窗继续操作;请勿关闭或刷新本页</p>
|
||||
<template #footer>
|
||||
<el-button v-if="exportLoading" @click="exportProgressVisible = false">收起</el-button>
|
||||
<el-button v-else type="primary" @click="exportProgressVisible = false">关闭</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
<order-source-sync-log-drawer ref="logDrawerRef" />
|
||||
<order-bill-product-check-drawer ref="productCheckDrawerRef" />
|
||||
|
||||
@@ -233,6 +275,78 @@ const exportFieldRef = ref()
|
||||
const logDrawerRef = ref()
|
||||
const productCheckDrawerRef = ref()
|
||||
const checkLoading = ref(false)
|
||||
const exportLoading = ref(false)
|
||||
const exportFinished = ref(false)
|
||||
const exportProgressVisible = ref(false)
|
||||
const exportProgressPercent = ref(0)
|
||||
const exportProgressMessage = ref('')
|
||||
const exportProgressStatus = ref(undefined)
|
||||
const exportProgressRowCount = ref(0)
|
||||
const exportTaskId = ref('')
|
||||
let exportFloatHideTimer = null
|
||||
|
||||
const exportFloatVisible = computed(() => exportLoading.value || exportFinished.value)
|
||||
const exportProgressDegree = computed(() => Math.round(((exportProgressPercent.value || 0) / 100) * 360))
|
||||
const exportProgressText = computed(() => (exportProgressPercent.value || 0) + '%')
|
||||
const exportDialogTitle = computed(() => {
|
||||
if (exportLoading.value) return '异步导出进行中'
|
||||
if (exportFinished.value) return '异步导出完成'
|
||||
return '异步导出'
|
||||
})
|
||||
const exportFloatTitle = computed(() => {
|
||||
if (exportLoading.value) return '导出中'
|
||||
if (exportProgressStatus.value === 'exception') return '导出失败'
|
||||
if (exportFinished.value) return '导出完成'
|
||||
return '导出'
|
||||
})
|
||||
const exportFloatSummary = computed(() => {
|
||||
const pct = exportProgressPercent.value || 0
|
||||
const rows = exportProgressRowCount.value || 0
|
||||
if (rows > 0) return pct + '% / ' + rows + ' 行'
|
||||
return pct + '%'
|
||||
})
|
||||
const exportFloatTooltip = computed(() => exportProgressMessage.value || '点击查看详情')
|
||||
|
||||
function openExportProgress() {
|
||||
exportProgressVisible.value = true
|
||||
}
|
||||
|
||||
function scheduleHideExportFloat() {
|
||||
if (exportFloatHideTimer) {
|
||||
clearTimeout(exportFloatHideTimer)
|
||||
exportFloatHideTimer = null
|
||||
}
|
||||
exportFloatHideTimer = window.setTimeout(() => {
|
||||
if (!exportLoading.value && exportFinished.value) {
|
||||
exportFinished.value = false
|
||||
}
|
||||
exportFloatHideTimer = null
|
||||
}, 8000)
|
||||
}
|
||||
|
||||
function applyExportProgress(t) {
|
||||
const pct = Math.min(100, Number(t && t.percent) || 0)
|
||||
exportProgressPercent.value = pct
|
||||
exportProgressRowCount.value = Number(t && t.rowCount) || 0
|
||||
const st = String((t && t.status) || '').toUpperCase()
|
||||
if (st === 'PENDING') {
|
||||
exportProgressMessage.value = (t && t.message) || '排队中...'
|
||||
exportProgressStatus.value = undefined
|
||||
} else if (st === 'RUNNING') {
|
||||
exportProgressMessage.value = (t && t.message) || ('导出中 ' + pct + '%')
|
||||
exportProgressStatus.value = undefined
|
||||
} else if (st === 'SUCCESS') {
|
||||
exportProgressMessage.value = (t && t.message) || '导出完成,正在下载'
|
||||
exportProgressStatus.value = 'success'
|
||||
exportProgressPercent.value = 100
|
||||
} else if (st === 'FAIL' || st === 'FAILED') {
|
||||
exportProgressMessage.value = (t && (t.error || t.message)) || '导出失败'
|
||||
exportProgressStatus.value = 'exception'
|
||||
} else {
|
||||
exportProgressMessage.value = (t && t.message) || ''
|
||||
}
|
||||
}
|
||||
|
||||
const batchLoading = ref(false)
|
||||
const rebillFinished = ref(false)
|
||||
const rebillProgressVisible = ref(false)
|
||||
@@ -516,21 +630,67 @@ function queryList(params) {
|
||||
}
|
||||
|
||||
async function handleExport() {
|
||||
if (exportLoading.value) return
|
||||
const params = tableRef.value?.getQueryParams?.() || {}
|
||||
if (!validateOrderIdentifierLimit(params.orderIdentifiers)) return
|
||||
const fields = await exportFieldRef.value?.open?.()
|
||||
if (!fields || !fields.length) return
|
||||
return exportAsyncFromTable({
|
||||
baseUrl: '/price/billing/orderBill/export',
|
||||
tableRef: tableRef.value,
|
||||
normalize: (raw) => {
|
||||
const q = applySearchRanges(raw)
|
||||
q.exportFields = fields
|
||||
return q
|
||||
},
|
||||
filePrefix: 'order_bill',
|
||||
requireFilter: true
|
||||
})
|
||||
if (exportFloatHideTimer) {
|
||||
clearTimeout(exportFloatHideTimer)
|
||||
exportFloatHideTimer = null
|
||||
}
|
||||
exportLoading.value = true
|
||||
exportFinished.value = false
|
||||
exportProgressVisible.value = false
|
||||
exportProgressPercent.value = 0
|
||||
exportProgressRowCount.value = 0
|
||||
exportProgressStatus.value = undefined
|
||||
exportProgressMessage.value = '导出任务已提交'
|
||||
exportTaskId.value = ''
|
||||
try {
|
||||
const result = await exportAsyncFromTable({
|
||||
baseUrl: '/price/billing/orderBill/export',
|
||||
tableRef: tableRef.value,
|
||||
normalize: (raw) => {
|
||||
const q = applySearchRanges(raw)
|
||||
q.exportFields = fields
|
||||
return q
|
||||
},
|
||||
filePrefix: 'order_bill',
|
||||
requireFilter: true,
|
||||
showLoading: false,
|
||||
showSuccessMessage: true,
|
||||
showErrorMessage: true,
|
||||
onTaskId: (id) => { exportTaskId.value = id },
|
||||
onProgress: (task) => applyExportProgress(task || {})
|
||||
})
|
||||
if (result && result.task) {
|
||||
applyExportProgress({ ...(result.task || {}), status: 'SUCCESS', percent: 100 })
|
||||
exportFinished.value = true
|
||||
scheduleHideExportFloat()
|
||||
} else if (!exportTaskId.value) {
|
||||
// filter rejected / cancelled before task created
|
||||
exportFinished.value = false
|
||||
exportProgressPercent.value = 0
|
||||
exportProgressMessage.value = ''
|
||||
exportProgressStatus.value = undefined
|
||||
} else if (exportProgressStatus.value !== 'exception') {
|
||||
exportProgressStatus.value = 'exception'
|
||||
exportProgressMessage.value = exportProgressMessage.value || '导出失败'
|
||||
exportFinished.value = true
|
||||
scheduleHideExportFloat()
|
||||
} else {
|
||||
exportFinished.value = true
|
||||
scheduleHideExportFloat()
|
||||
}
|
||||
} catch (e) {
|
||||
exportProgressStatus.value = 'exception'
|
||||
exportProgressMessage.value = (e && e.message) || '导出失败'
|
||||
exportFinished.value = true
|
||||
scheduleHideExportFloat()
|
||||
} finally {
|
||||
exportLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -889,6 +1049,12 @@ onBeforeUnmount(() => {
|
||||
.rebill-progress__msg { margin-top: 12px; color: var(--el-text-color-regular); }
|
||||
.rebill-progress__text { margin-top: 8px; font-size: 13px; color: var(--el-text-color-secondary); }
|
||||
.rebill-progress__hint { margin-top: 12px; font-size: 12px; color: var(--el-color-warning); }
|
||||
.order-bill-query .export-status-float {
|
||||
top: 92px;
|
||||
}
|
||||
.order-bill-query .export-status-float.is-offset {
|
||||
top: 178px;
|
||||
}
|
||||
.order-bill-query .retry-status-float {
|
||||
position: fixed;
|
||||
top: 92px;
|
||||
|
||||
Reference in New Issue
Block a user