修复bug
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 4m59s

This commit is contained in:
sexygoat
2026-04-09 17:47:32 +08:00
parent 472099bf96
commit c2c1644799
13 changed files with 166 additions and 172 deletions

View File

@@ -139,6 +139,16 @@
</ElSelect>
</ElFormItem>
<ElFormItem label="卡业务类型" style="margin-bottom: 20px">
<ElSelect v-model="selectedCardCategory" placeholder="请选择卡业务类型" style="width: 100%">
<ElOption label="普通卡" value="normal" />
<ElOption label="行业卡" value="industry" />
</ElSelect>
<div style="margin-top: 4px; font-size: 12px; color: var(--el-text-color-secondary)">
默认为普通卡可选择行业卡
</div>
</ElFormItem>
<ElUpload
ref="uploadRef"
drag
@@ -150,7 +160,7 @@
<el-icon class="el-icon--upload"><upload-filled /></el-icon>
<div class="el-upload__text"> Excel 文件拖到此处<em>点击选择</em></div>
<template #tip>
<div class="el-upload__tip">只能上传 .xlsx 格式的 Excel 文件且不超过 10MB</div>
<div class="el-upload__tip">只能上传 .xlsx 格式的 Excel 文件且不超过 300MB</div>
</template>
</ElUpload>
@@ -207,6 +217,7 @@
const uploading = ref(false)
const importDialogVisible = ref(false)
const selectedCarrierId = ref<number>()
const selectedCardCategory = ref<'normal' | 'industry'>('normal') // 默认普通卡
const carrierList = ref<Carrier[]>([])
const carrierLoading = ref(false)
const failDataDialogVisible = ref(false)
@@ -292,6 +303,7 @@
{ label: '任务编号', prop: 'task_no' },
{ label: '任务状态', prop: 'status' },
{ label: '运营商', prop: 'carrier_name' },
{ label: '卡业务类型', prop: 'card_category' },
{ label: '文件名', prop: 'file_name' },
{ label: '总数', prop: 'total_count' },
{ label: '成功数', prop: 'success_count' },
@@ -374,6 +386,19 @@
label: '运营商',
width: 120
},
{
prop: 'card_category',
label: '卡业务类型',
width: 110,
formatter: (row: IotCardImportTask) => {
if (!row.card_category) return '-'
return row.card_category === 'normal'
? '普通卡'
: row.card_category === 'industry'
? '行业卡'
: row.card_category
}
},
{
prop: 'file_name',
label: '文件名',
@@ -577,22 +602,22 @@
// 动态导入 xlsx 库
const XLSX = await import('xlsx')
// 创建示例数据
// 创建示例数据按固定列顺序ICCID、MSISDN、虚拟号
const templateData = [
{
ICCID: '89860123456789012345',
MSISDN: '13800138000',
virtual_no: 'V001'
'MSISDN(接入号)': '13800138000',
虚拟号: 'V001'
},
{
ICCID: '89860123456789012346',
MSISDN: '13800138001',
virtual_no: 'V002'
'MSISDN(接入号)': '13800138001',
虚拟号: 'V002'
},
{
ICCID: '89860123456789012347',
MSISDN: '13800138002',
virtual_no: 'V003'
'MSISDN(接入号)': '13800138002',
虚拟号: 'V003'
}
]
@@ -603,8 +628,8 @@
// 设置列宽
ws['!cols'] = [
{ wch: 25 }, // ICCID
{ wch: 15 }, // MSISDN
{ wch: 15 } // virtual_no
{ wch: 20 }, // MSISDN(接入号)
{ wch: 15 } // 虚拟号
]
// 将所有单元格设置为文本格式,防止科学计数法
@@ -631,9 +656,9 @@
// 文件选择变化
const handleFileChange = (uploadFile: any) => {
const maxSize = 10 * 1024 * 1024
const maxSize = 300 * 1024 * 1024
if (uploadFile.raw && uploadFile.raw.size > maxSize) {
ElMessage.error('文件大小不能超过 10MB')
ElMessage.error('文件大小不能超过 300MB')
uploadRef.value?.clearFiles()
fileList.value = []
return
@@ -659,6 +684,7 @@
// 取消导入
const handleCancelImport = () => {
clearFiles()
selectedCardCategory.value = 'normal' // 重置为默认值
importDialogVisible.value = false
}
@@ -728,7 +754,8 @@
const importRes = await CardService.importIotCards({
carrier_id: selectedCarrierId.value,
file_key,
batch_no: `IOT-${Date.now()}`
batch_no: `IOT-${Date.now()}`,
card_category: selectedCardCategory.value // 新增卡业务类型
})
if (importRes.code !== 0) {