feat: 新增导入字段,显示实名认证策略字段
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 4m9s

This commit is contained in:
sexygoat
2026-04-17 18:40:54 +08:00
parent 90b13eb5ec
commit b48d6a1894
16 changed files with 267 additions and 130 deletions

View File

@@ -119,35 +119,72 @@
</ElButton>
</div>
<ElFormItem label="运营商" required style="margin-bottom: 20px">
<ElSelect
v-model="selectedCarrierId"
placeholder="请输入运营商名称搜索"
style="width: 100%"
filterable
remote
:remote-method="handleCarrierSearch"
:loading="carrierLoading"
clearable
>
<ElOption
v-for="carrier in carrierList"
:key="carrier.id"
:label="carrier.carrier_name"
:value="carrier.id"
/>
</ElSelect>
</ElFormItem>
<ElRow :gutter="20">
<ElCol :span="12">
<ElFormItem label="运营商" required>
<ElSelect
v-model="selectedCarrierId"
placeholder="请输入运营商名称搜索"
style="width: 100%"
filterable
remote
:remote-method="handleCarrierSearch"
:loading="carrierLoading"
clearable
>
<ElOption
v-for="carrier in carrierList"
:key="carrier.id"
:label="carrier.carrier_name"
:value="carrier.id"
/>
</ElSelect>
</ElFormItem>
</ElCol>
<ElCol :span="12">
<ElFormItem label="卡业务类型">
<ElSelect
v-model="selectedCardCategory"
placeholder="请选择卡业务类型"
style="width: 100%"
>
<ElOption label="普通卡" value="normal" />
<ElOption label="行业卡" value="industry" />
</ElSelect>
</ElFormItem>
</ElCol>
</ElRow>
<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>
<ElRow :gutter="20">
<ElCol :span="12">
<ElFormItem label="批次号" prop="batch_no">
<ElInput
v-model="importForm.batch_no"
placeholder="请输入批次号或点击生成"
:maxlength="100"
clearable
>
<template #append>
<ElButton @click="handleGenerateBatchNo">生成编码</ElButton>
</template>
</ElInput>
</ElFormItem>
</ElCol>
<ElCol :span="12">
<ElFormItem label="实名认证策略">
<ElSelect
v-model="importForm.realname_policy"
placeholder="默认无需实名"
clearable
style="width: 100%"
>
<ElOption label="无需实名" value="none" />
<ElOption label="先实名后充值/购买" value="before_order" />
<ElOption label="先充值/购买后实名" value="after_order" />
</ElSelect>
</ElFormItem>
</ElCol>
</ElRow>
<ElUpload
ref="uploadRef"
@@ -200,6 +237,7 @@
import { useAuth } from '@/composables/useAuth'
import { formatDateTime } from '@/utils/business/format'
import { StorageService } from '@/api/modules/storage'
import { generatePackageCode } from '@/utils/codeGenerator'
import { RoutesAlias } from '@/router/routesAlias'
import type { IotCardImportTask, IotCardImportTaskStatus } from '@/types/api/card'
import type { Carrier } from '@/types/api'
@@ -224,6 +262,10 @@
const failDataLoading = ref(false)
const failedItems = ref<any[]>([])
const currentFailTask = ref<IotCardImportTask | null>(null)
const importForm = reactive({
batch_no: '',
realname_policy: '' as '' | 'none' | 'before_order' | 'after_order'
})
// 搜索表单初始值
const initialSearchState = {
@@ -682,10 +724,19 @@
selectedCarrierId.value = undefined
}
// 生成批次号
const handleGenerateBatchNo = () => {
const code = generatePackageCode().replace('PKG', 'IOT')
importForm.batch_no = code
ElMessage.success('批次号生成成功')
}
// 取消导入
const handleCancelImport = () => {
clearFiles()
selectedCardCategory.value = 'normal' // 重置为默认值
selectedCardCategory.value = 'normal'
importForm.batch_no = ''
importForm.realname_policy = ''
importDialogVisible.value = false
}
@@ -755,8 +806,9 @@
const importRes = await CardService.importIotCards({
carrier_id: selectedCarrierId.value,
file_key,
batch_no: `IOT-${Date.now()}`,
card_category: selectedCardCategory.value // 新增卡业务类型
batch_no: importForm.batch_no || undefined,
card_category: selectedCardCategory.value,
realname_policy: importForm.realname_policy || undefined
})
if (importRes.code !== 0) {