fix: 修改工单bug
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 2m15s

This commit is contained in:
sexygoat
2026-04-22 17:42:36 +08:00
parent 8378d2228e
commit fd22dc7ad4
14 changed files with 199 additions and 280 deletions

View File

@@ -105,10 +105,8 @@
<p>1. 请先下载 Excel 模板文件按照模板格式填写IoT卡信息</p>
<p>2. 仅支持 Excel 格式.xlsx单次最多导入 1000 </p>
<p>3. 列格式请设置为文本格式避免长数字被转为科学计数法</p>
<p>4. <strong>必填字段ICCIDMSISDN手机号virtual_no虚拟号</strong></p>
<p>5. <strong>Excel 文件必须包含 virtual_no 否则整批导入将失败</strong></p>
<p>6. virtual_no 为空将导入失败</p>
<p>7. 必须选择运营商</p>
<p>4. <span style="color: var(--el-color-primary)">必填字段ICCIDMSISDN</span></p>
<p>5. 必须选择运营商</p>
</div>
</template>
</ElAlert>
@@ -642,58 +640,16 @@
// 下载模板
const downloadTemplate = async () => {
try {
// 动态导入 xlsx 库
const XLSX = await import('xlsx')
// 创建示例数据按固定列顺序ICCID、MSISDN、虚拟号
const templateData = [
{
ICCID: '89860123456789012345',
'MSISDN接入号': '13800138000',
虚拟号: 'V001'
},
{
ICCID: '89860123456789012346',
'MSISDN接入号': '13800138001',
虚拟号: 'V002'
},
{
ICCID: '89860123456789012347',
'MSISDN接入号': '13800138002',
虚拟号: 'V003'
}
]
// 创建工作簿
const wb = XLSX.utils.book_new()
const ws = XLSX.utils.json_to_sheet(templateData)
// 设置列宽
ws['!cols'] = [
{ wch: 25 }, // ICCID
{ wch: 20 }, // MSISDN接入号
{ wch: 15 } // 虚拟号
]
// 将所有单元格设置为文本格式,防止科学计数法
const range = XLSX.utils.decode_range(ws['!ref'] || 'A1')
for (let R = range.s.r; R <= range.e.r; ++R) {
for (let C = range.s.c; C <= range.e.c; ++C) {
const cellAddress = XLSX.utils.encode_cell({ r: R, c: C })
if (!ws[cellAddress]) continue
ws[cellAddress].t = 's' // 设置为字符串类型
}
}
// 添加工作表到工作簿
XLSX.utils.book_append_sheet(wb, ws, 'IoT卡导入模板')
// 导出文件
XLSX.writeFile(wb, 'IoT卡导入模板.xlsx')
const link = document.createElement('a')
link.href = new URL('@/template/IoT卡导入模板.xlsx', import.meta.url).href
link.download = 'IoT卡导入模板.xlsx'
document.body.appendChild(link)
link.click()
document.body.removeChild(link)
ElMessage.success('IoT卡导入模板下载成功')
} catch (error) {
console.error('下载模板失败:', error)
ElMessage.error('下载模板失败')
}
}