修改导入功能

This commit is contained in:
wuweihua
2026-09-23 17:56:45 +08:00
parent f834dd785b
commit 168ad13396
6 changed files with 75 additions and 14 deletions
+22 -1
View File
@@ -37,6 +37,12 @@
<el-descriptions-item v-if="detail.logType === 'CREDIT'" label="金额">
{{ creditAmountLabel(detail) }}
</el-descriptions-item>
<el-descriptions-item v-if="detail.logType === 'ARREARS'" label="清除范围">
{{ arrearsScopeLabel(detail) }}
</el-descriptions-item>
<el-descriptions-item v-if="detail.logType === 'ARREARS'" label="清除金额">
{{ arrearsAmountLabel(detail) }}
</el-descriptions-item>
<el-descriptions-item v-if="detail.errorMessage" label="错误信息" :span="2">
<span class="err-text">{{ detail.errorMessage }}</span>
</el-descriptions-item>
@@ -73,7 +79,8 @@ const drawerTitle = ref('ES日志详情')
const typeOptions = [
{ label: '计费', value: 'BILL' },
{ label: '试算', value: 'QUOTE' },
{ label: '扣减额度', value: 'CREDIT' }
{ label: '扣减额度', value: 'CREDIT' },
{ label: '欠费清除', value: 'ARREARS' }
]
const statusOptions = [
@@ -125,10 +132,24 @@ function creditAmountLabel(detail) {
return String(req.amount) + (req.currency ? (' ' + req.currency) : '')
}
function arrearsScopeLabel(detail) {
const req = parseReq(detail)
const map = { SUMMARY: '客户汇总', ORDER: '单订单' }
return map[req.scope] || req.scope || '-'
}
function arrearsAmountLabel(detail) {
const req = parseReq(detail)
const amount = req.scope === 'ORDER' ? req.batchAmount : req.amount
if (amount == null || amount === '') return '-'
return String(amount) + (req.currency ? (' ' + req.currency) : '')
}
function typeTag(type) {
if (type === 'BILL') return 'success'
if (type === 'QUOTE') return 'warning'
if (type === 'CREDIT') return 'danger'
if (type === 'ARREARS') return 'primary'
return 'info'
}
@@ -5,7 +5,7 @@
:closable="false"
show-icon
class="mb16"
title="多国家价表用「导入 Excel」。单国专线成本价用「按国家导入」:先选目的国家,目录里的产品都记到该国。相同产品代码+生效日期不覆盖主数据。"
title="多国家价表用「全部导入」。单国专线成本价用「按国家导入」:先选目的国家,目录里的产品都记到该国。相同产品代码+生效日期不覆盖主数据。两种导入均可在弹窗内下载对应模板。"
/>
<basic-table
@@ -20,10 +20,17 @@
<el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['price:product:add']">新建产品</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="info" plain icon="Upload" @click="handleImport" v-hasPermi="['price:product:import']">导入 Excel</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="info" plain icon="Upload" @click="handleCountryImport" v-hasPermi="['price:product:import']">按国家导入</el-button>
<el-dropdown @command="handleImportCommand">
<el-button type="info" plain icon="Upload" v-hasPermi="['price:product:import']">
导入 Excel<el-icon class="el-icon--right"><arrow-down /></el-icon>
</el-button>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item command="all">全部导入(多国家价表)</el-dropdown-item>
<el-dropdown-item command="country">按国家导入(单国专线成本价)</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
</el-col>
</template>
@@ -51,6 +58,9 @@
action="/price/product/importData"
width="560px"
:show-update-support="false"
template-url="/templates/product/product-import-all-template.xlsx"
template-file-name="产品多国家价表导入模板"
:import-desc="allImportDesc"
@success="() => tableRef.refresh()"
/>
<excel-import-dialog
@@ -62,6 +72,8 @@
:extra-query="countryImportQuery"
:before-submit="validateCountryImport"
:import-desc="countryImportDesc"
template-url="/templates/product/product-import-country-template.xlsx"
template-file-name="产品按国家导入模板"
@success="() => tableRef.refresh()"
>
<template #extra>
@@ -102,9 +114,14 @@ const countryImportRef = ref()
const importCountryCode = ref('')
const regionOptions = ref([])
const countryImportQuery = computed(() => ({ countryCode: importCountryCode.value }))
const allImportDesc = [
'适用多国家价表(B2C 小包价表等),按目录 sheet 匹配国家导入。',
'请在弹窗底部下载模板,按模板格式整理后上传。相同产品代码+生效日期不覆盖主数据。'
]
const countryImportDesc = [
'选择目的国家后上传专线成本价表,目录中的产品都会记到该国家。',
'邮编、赔偿标准等 sheet 不导入。相同产品代码+生效日期不覆盖主数据,重量段按生效日写入。'
'邮编、赔偿标准等 sheet 不导入。相同产品代码+生效日期不覆盖主数据,重量段按生效日写入。',
'可在弹窗底部下载模板,按模板格式整理后上传。'
]
const columns = [
@@ -152,6 +169,14 @@ function handleUpdate(row) {
formRef.value.open(row)
}
function handleImportCommand(command) {
if (command === 'country') {
handleCountryImport()
return
}
handleImport()
}
function handleImport() {
importRef.value.open()
}
+2 -2
View File
@@ -67,7 +67,7 @@
<template #col-payTotal="{ row }">
<span class="payable">{{ formatMoney(row.payTotal) }}</span>
</template>
<template #toolbar="{ selection, ids }">
<!-- <template #toolbar="{ selection, ids }">
<el-col :span="1.5">
<el-button
type="warning"
@@ -78,7 +78,7 @@
@click="handleUpdateArrears(ids, selection)"
>更新欠费状态</el-button>
</el-col>
</template>
</template> -->
<template #col-action="{ row }">
<el-button link type="primary" icon="View" @click="handleView(row)">查看</el-button>
</template>