feat: 换货新旧资产展示与独立搜索
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 4m34s

This commit is contained in:
luo
2026-07-22 16:57:17 +08:00
parent 8faa2ea2ef
commit 7d3352038a
5 changed files with 197 additions and 13 deletions

View File

@@ -11,7 +11,8 @@ export interface ExchangeQueryParams {
page_size?: number
status?: number // 换货状态
flow_type?: string // 流程类型shipping/direct
identifier?: string // 资产标识符(模糊匹配,同时匹配旧资产、新资产
old_asset_keyword?: string // 资产关键词ICCID、接入号、虚拟号、IMEI、SN
new_asset_keyword?: string // 新资产关键词ICCID、接入号、虚拟号、IMEI、SN
created_at_start?: string // 创建时间起始
created_at_end?: string // 创建时间结束
}
@@ -33,10 +34,13 @@ export interface ExchangeResponse {
exchange_no: string
exchange_reason: string
old_asset_type: string
old_asset_id: number
old_asset_identifier: string
new_asset_type: string
new_asset_identifier: string
new_asset_type?: string | null
new_asset_id?: number | null
new_asset_identifier?: string | null
status: number // 换货状态1:待填写信息, 2:待发货, 3:已发货待确认, 4:已完成, 5:已取消)
status_name?: string
status_text: string
flow_type: string // 流程类型shipping/direct
flow_type_name: string // 流程类型名称

View File

@@ -423,7 +423,8 @@
const searchForm = reactive({
status: undefined,
flow_type: undefined, // 流程类型筛选
identifier: '',
old_asset_keyword: '',
new_asset_keyword: '',
created_at_range: [],
created_at_start: '',
created_at_end: ''
@@ -626,11 +627,20 @@
]
},
{
label: '资产标识符',
prop: 'identifier',
label: '资产',
prop: 'old_asset_keyword',
type: 'input',
config: {
placeholder: '请输入资产标识',
placeholder: '请输入资产标识',
clearable: true
}
},
{
label: '新资产',
prop: 'new_asset_keyword',
type: 'input',
config: {
placeholder: '请输入新资产标识',
clearable: true
}
},
@@ -682,18 +692,25 @@
prop: 'old_asset_type',
label: '旧资产类型',
width: 120,
formatter: (row: any) => (row.old_asset_type === 'iot_card' ? 'IoT卡' : '设备')
formatter: (row: ExchangeResponse) => getAssetTypeName(row.old_asset_type)
},
{
prop: 'old_asset_identifier',
label: '旧资产标识符',
width: 220
width: 220,
formatter: (row: ExchangeResponse) => row.old_asset_identifier || '--'
},
{
prop: 'new_asset_type',
label: '新资产类型',
width: 120,
formatter: (row: ExchangeResponse) => getAssetTypeName(row.new_asset_type)
},
{
prop: 'new_asset_identifier',
label: '新资产标识符',
width: 220,
formatter: (row: any) => row.new_asset_identifier || '--'
formatter: (row: ExchangeResponse) => row.new_asset_identifier || '--'
},
{
prop: 'recipient_name',
@@ -734,7 +751,8 @@
prop: 'status',
label: '状态',
width: 130,
formatter: (row: any) => h(ElTag, { type: getStatusType(row.status) }, () => row.status_text)
formatter: (row: ExchangeResponse) =>
h(ElTag, { type: getStatusType(row.status) }, () => row.status_name || '--')
},
{
prop: 'created_at',
@@ -755,6 +773,12 @@
return types[status] || 'info'
}
const getAssetTypeName = (assetType?: string | null) => {
if (assetType === 'iot_card') return '物联网卡'
if (assetType === 'device') return '设备'
return '--'
}
// 加载换货单列表
const loadExchangeList = async () => {
loading.value = true
@@ -771,8 +795,11 @@
if (searchForm.flow_type) {
params.flow_type = searchForm.flow_type
}
if (searchForm.identifier) {
params.identifier = searchForm.identifier
if (searchForm.old_asset_keyword) {
params.old_asset_keyword = searchForm.old_asset_keyword
}
if (searchForm.new_asset_keyword) {
params.new_asset_keyword = searchForm.new_asset_keyword
}
if (searchForm.created_at_start) {
params.created_at_start = searchForm.created_at_start
@@ -809,6 +836,8 @@
// 重置
const handleReset = () => {
searchForm.old_asset_keyword = ''
searchForm.new_asset_keyword = ''
searchForm.created_at_range = []
searchForm.created_at_start = ''
searchForm.created_at_end = ''