fix: some
All checks were successful
构建并部署前端到测试环境 / deploy (push) Successful in 55s

This commit is contained in:
luo
2026-10-13 11:25:03 +08:00
parent 52268859aa
commit b2a76adc9a
67 changed files with 1982 additions and 200 deletions

View File

@@ -442,6 +442,12 @@
import { AUDIT_PERMISSIONS } from '@/config/constants/audit'
import { resolveAuditResourceTarget } from '@/utils/business/auditNavigation'
import { openAuditInvestigation } from '@/components/business/audit/investigationController'
import { AUGUST_PERMISSIONS } from '@/config/constants/augustIteration'
import { normalizeApiError } from '@/utils/business/apiError'
import {
getExchangePhoneConflictMessage,
getExchangeBusinessErrorMessage
} from '@/utils/business/exchangeError'
defineOptions({ name: 'ExchangeManagement' })
@@ -449,6 +455,38 @@
const userStore = useUserStore()
const router = useRouter()
const handleExchangeFailure = async (failure: unknown, fallback: string) => {
const conflictMessage = getExchangePhoneConflictMessage(failure)
if (!conflictMessage) {
const normalized = normalizeApiError(failure)
if (normalized.kind === 'auth') return // 登录失效由统一 HTTP 层反馈。
ElMessage.error(
getExchangeBusinessErrorMessage(failure) ||
(normalized.kind === 'unknown' ? fallback : normalized.message)
)
return
}
const canManageAssociations = hasAuth(AUGUST_PERMISSIONS.phoneAssetAssociation.list)
try {
await ElMessageBox.confirm(
canManageAssociations
? conflictMessage
: `${conflictMessage}。您暂无管理权限,请联系管理员解除。`,
'新资产手机号绑定冲突',
{
type: 'warning',
confirmButtonText: canManageAssociations ? '前往手机号资产关联' : '知道了',
cancelButtonText: '暂不处理',
showCancelButton: canManageAssociations,
dangerouslyUseHTMLString: false
}
)
if (canManageAssociations) await router.push(RoutesAlias.PhoneAssetAssociation)
} catch {
// 用户关闭提示,不执行解绑或改写换货状态。
}
}
const currentExchangeRow = ref<ExchangeResponse | null>(null)
const loading = ref(false)
const shipDialogVisible = ref(false)
@@ -871,7 +909,7 @@
label: '换货单号',
width: 230,
showOverflowTooltip: true,
fixed:true,
fixed: true,
formatter: (row: any) =>
h(
ElButton,
@@ -1535,7 +1573,9 @@
requestData.migrate_data = createForm.migrate_data
}
const res = await ExchangeService.createExchange(requestData)
const res = await ExchangeService.createExchange(requestData, {
requestOptions: { errorMessageMode: 'none' }
})
if (res.code === 0) {
ElMessage.success('换货单创建成功')
createDialogVisible.value = false
@@ -1543,9 +1583,9 @@
return
}
ElMessage.error(res.msg || '换货单创建失败')
await handleExchangeFailure(res, '换货单创建失败')
} catch (error) {
console.error('创建换货单失败:', error)
await handleExchangeFailure(error, '换货单创建失败')
} finally {
createLoading.value = false
}
@@ -1767,48 +1807,36 @@
}
// 确认完成
const handleCompleteExchange = (row: ExchangeResponse) => {
const handleCompleteExchange = async (row: ExchangeResponse) => {
if (completeLoadingId.value === row.id) return
completeLoadingId.value = row.id
ElMessageBox.confirm('确定要确认换货完成吗?', '确认操作', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
beforeClose: async (action, instance, done) => {
if (action !== 'confirm') {
done()
return
}
instance.confirmButtonLoading = true
instance.confirmButtonText = '提交中...'
try {
const res = await ExchangeService.completeExchange(row.id)
if (res.code === 0) {
await refreshExchangeDetail(row.id)
await loadExchangeList()
ElMessage.success('操作成功')
done()
return
}
ElMessage.error(res.msg || '确认完成失败')
} catch (error) {
console.error('确认完成失败:', error)
} finally {
instance.confirmButtonLoading = false
instance.confirmButtonText = '确定'
}
}
})
.then(() => {})
.finally(() => {
completeLoadingId.value = null
try {
await ElMessageBox.confirm('确定要确认换货完成吗?', '确认操作', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.catch(() => {})
} catch {
completeLoadingId.value = null
return
}
try {
const res = await ExchangeService.completeExchange(row.id, {
requestOptions: { errorMessageMode: 'none' }
})
// 刷新失败也不能吞掉原操作的 1202 业务响应。
await Promise.allSettled([refreshExchangeDetail(row.id), loadExchangeList()])
if (res.code === 0) ElMessage.success('操作成功')
else await handleExchangeFailure(res, '确认完成失败')
} catch (error) {
// 仅重新读取原单状态,不乐观标记完成,错误对象可能包含完整手机号,不输出日志。
await Promise.allSettled([refreshExchangeDetail(row.id), loadExchangeList()])
await handleExchangeFailure(error, '确认完成失败')
} finally {
completeLoadingId.value = null
}
}
// 旧资产转新

View File

@@ -62,11 +62,11 @@
<p>2. 列格式请设置为文本格式,避免长数字被转为科学计数法。</p>
<p>3. <strong>列顺序固定,不可调整。</strong>系统按位置读取,不识别列名。</p>
<p style="color: var(--el-color-primary)">
4. 必填列:设备标识(第 1 列,支持 VirtualNo、IMEI 或 SN)。
4. 必填列:设备标识(第 1 列,支持 VirtualNo、IMEI 或 SN)和独立的 IMEI
列。即使设备标识填写 IMEI,IMEI 列也不能留空或仅填空格。
</p>
<p>
5. 可选列:SN、设备名称、设备型号、设备类型、IMEI、制造商、最大 SIM 槽数、卡 1~卡 4
ICCID。
5. 可选列:SN、设备名称、设备型号、设备类型、制造商、最大 SIM 槽数、卡 1~卡 4 ICCID。
</p>
</div>
</template>
@@ -162,7 +162,6 @@
} from '@/types/api/device'
import { RoutesAlias } from '@/router/routesAlias'
import { generatePackageCode } from '@/utils/codeGenerator'
import { normalizeApiError } from '@/utils/business/apiError'
defineOptions({ name: 'DeviceTask' })