fix(operator): fix operator edit issue
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 6m25s

This commit is contained in:
sexygoat
2026-04-10 15:06:28 +08:00
parent 2b3119c549
commit 8b30341d50
8 changed files with 320 additions and 86 deletions

View File

@@ -48,7 +48,12 @@
<div class="col">
<PackageListCard
:package-list="packageList"
:total="packagePagination.total"
:page="packagePagination.page"
:page-size="packagePagination.pageSize"
@show-daily-records="handleShowDailyRecords"
@page-change="handlePackagePageChange"
@size-change="handlePackageSizeChange"
/>
</div>
</div>
@@ -73,7 +78,11 @@
:device-id="cardInfo?.id"
@confirm="handleConfirmSwitchCard"
/>
<WiFiConfigDialog v-model="setWiFiDialogVisible" @confirm="handleConfirmSetWiFi" />
<WiFiConfigDialog
v-model="setWiFiDialogVisible"
:card-no="cardInfo?.iccid"
@confirm="handleConfirmSetWiFi"
/>
<PackageRechargeDialog
v-model="rechargeDialogVisible"
:asset-identifier="cardInfo?.identifier"
@@ -171,6 +180,13 @@
const orderHistoryDialogVisible = ref(false)
const selectedPackageUsageId = ref<number | null>(null)
// ========== 套餐列表分页状态 ==========
const packagePagination = ref({
page: 1,
pageSize: 10,
total: 0
})
// ========== 轮询状态 ==========
const pollingEnabled = ref(false)
watch(pollingEnabled, async (val) => {
@@ -188,6 +204,11 @@
// fetchAssetDetail 内部已经会并行加载所有相关数据,不需要重复调用
await fetchAssetDetail(identifier)
// 重置分页并加载套餐列表
packagePagination.value.page = 1
const result = await loadPackageList(identifier, 1, packagePagination.value.pageSize)
packagePagination.value.total = result.total
}
/**
@@ -283,7 +304,6 @@
await handleRefresh()
} catch (error: any) {
console.error('启用绑定卡失败:', error)
ElMessage.error(error?.message || '启用失败')
}
}
@@ -300,7 +320,6 @@
await handleRefresh()
} catch (error: any) {
console.error('停用绑定卡失败:', error)
ElMessage.error(error?.message || '停用失败')
}
}
@@ -317,8 +336,15 @@
const handleRechargeSuccess = async () => {
rechargeDialogVisible.value = false
if (cardInfo.value) {
// 重置分页并重新加载
packagePagination.value.page = 1
const result = await loadPackageList(
cardInfo.value.identifier,
packagePagination.value.page,
packagePagination.value.pageSize
)
packagePagination.value.total = result.total
await Promise.all([
loadPackageList(cardInfo.value.identifier),
loadCurrentPackage(cardInfo.value.identifier),
loadAssetWallet(cardInfo.value.identifier)
])
@@ -326,10 +352,36 @@
ElMessage.success('充值成功')
}
/**
* 套餐列表页码变化
*/
const handlePackagePageChange = async (page: number) => {
if (!cardInfo.value) return
packagePagination.value.page = page
const result = await loadPackageList(
cardInfo.value.identifier,
page,
packagePagination.value.pageSize
)
packagePagination.value.total = result.total
}
/**
* 套餐列表每页条数变化
*/
const handlePackageSizeChange = async (size: number) => {
if (!cardInfo.value) return
packagePagination.value.pageSize = size
packagePagination.value.page = 1 // 重置到第一页
const result = await loadPackageList(cardInfo.value.identifier, 1, size)
packagePagination.value.total = result.total
}
/**
* 显示流量详单
*/
const handleShowDailyRecords = (packageRow: any) => {
const handleShowDailyRecords = (payload: { packageRow: any }) => {
const { packageRow } = payload
selectedPackageUsageId.value = packageRow.package_usage_id
dailyRecordsDialogVisible.value = true
}
@@ -539,11 +591,20 @@
display: flex;
flex: 1;
flex-direction: column;
min-width: 0; // 防止被内容撑开
.info-card {
height: 100%;
margin-bottom: 0;
}
&:first-child {
flex: 2;
}
&:last-child {
flex: 8;
}
}
}
}