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

This commit is contained in:
sexygoat
2026-04-10 16:54:53 +08:00
parent 8b30341d50
commit 90ae585651
10 changed files with 556 additions and 426 deletions

View File

@@ -27,6 +27,7 @@
@enable-binding-card="handleEnableBindingCard"
@disable-binding-card="handleDisableBindingCard"
@navigate-to-card="handleNavigateToCard"
@navigate-to-device="handleNavigateToDevice"
/>
</div>
@@ -36,31 +37,40 @@
:current-package="currentPackage"
:loading="currentPackageLoading"
:error-msg="currentPackageErrorMsg"
:bound-device-id="cardInfo.bound_device_id"
:bound-device-no="cardInfo.bound_device_no"
:bound-device-name="cardInfo.bound_device_name"
@show-recharge="showRechargeDialog"
@navigate-to-device="handleNavigateToDevice"
/>
</div>
<!-- 第三行钱包概况和套餐列表 -->
<div class="row two-columns">
<div class="col">
<WalletOverviewCard :wallet-info="walletInfo" :loading="walletLoading" />
</div>
<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 class="row full-width">
<PackageListCard
:package-list="packageList"
:total="packagePagination.total"
:page="packagePagination.page"
:page-size="packagePagination.pageSize"
:bound-device-id="cardInfo.bound_device_id"
:bound-device-no="cardInfo.bound_device_no"
@show-daily-records="handleShowDailyRecords"
@page-change="handlePackagePageChange"
@size-change="handlePackageSizeChange"
@navigate-to-device="handleNavigateToDevice"
/>
</div>
<!-- 第四行钱包流水 -->
<!-- 第四行钱包概况+流水 -->
<div class="row full-width">
<WalletTransactionCard :asset-identifier="cardInfo.identifier" />
<WalletTransactionCard
:asset-identifier="cardInfo.identifier"
:wallet-info="walletInfo"
:wallet-loading="walletLoading"
:bound-device-id="cardInfo.bound_device_id"
:bound-device-no="cardInfo.bound_device_no"
@navigate-to-device="handleNavigateToDevice"
/>
</div>
</div>
</div>
@@ -75,12 +85,12 @@
<!-- 对话框组件 -->
<SwitchCardDialog
v-model="switchCardDialogVisible"
:device-id="cardInfo?.id"
:cards="cardInfo?.cards"
@confirm="handleConfirmSwitchCard"
/>
<WiFiConfigDialog
v-model="setWiFiDialogVisible"
:card-no="cardInfo?.iccid"
:card-no="deviceRealtime?.current_iccid"
@confirm="handleConfirmSetWiFi"
/>
<PackageRechargeDialog
@@ -103,7 +113,7 @@
</template>
<script setup lang="ts">
import { ref, watch, onMounted } from 'vue'
import { ref, watch, onMounted, nextTick } from 'vue'
import { useRoute } from 'vue-router'
import { ElMessage, ElCard, ElEmpty } from 'element-plus'
@@ -111,7 +121,6 @@
import AssetSearchCard from './components/AssetSearchCard.vue'
import BasicInfoCard from './components/BasicInfoCard.vue'
import CurrentPackageCard from './components/CurrentPackageCard.vue'
import WalletOverviewCard from './components/WalletOverviewCard.vue'
import PackageListCard from './components/PackageListCard.vue'
import WalletTransactionCard from './components/WalletTransactionCard.vue'
@@ -189,7 +198,9 @@
// ========== 轮询状态 ==========
const pollingEnabled = ref(false)
let pollingInitializing = false
watch(pollingEnabled, async (val) => {
if (pollingInitializing) return
await updatePollingStatus(val)
})
@@ -205,6 +216,12 @@
// fetchAssetDetail 内部已经会并行加载所有相关数据,不需要重复调用
await fetchAssetDetail(identifier)
// 从接口数据初始化轮询开关,不触发更新接口
pollingInitializing = true
pollingEnabled.value = cardInfo.value?.enable_polling ?? false
await nextTick()
pollingInitializing = false
// 重置分页并加载套餐列表
packagePagination.value.page = 1
const result = await loadPackageList(identifier, 1, packagePagination.value.pageSize)
@@ -224,7 +241,6 @@
*/
const handleEnableCard = async () => {
await enableCardOp()
await handleRefresh()
}
/**
@@ -232,7 +248,6 @@
*/
const handleDisableCard = async () => {
await disableCardOp()
await handleRefresh()
}
/**
@@ -240,7 +255,6 @@
*/
const handleManualDeactivate = async () => {
await manualDeactivateCardOp()
await handleRefresh()
}
/**
@@ -248,7 +262,6 @@
*/
const handleRebootDevice = async () => {
await rebootDeviceOp()
await handleRefresh()
}
/**
@@ -256,7 +269,6 @@
*/
const handleResetDevice = async () => {
await resetDeviceOp()
await handleRefresh()
}
/**
@@ -272,7 +284,6 @@
const handleConfirmSwitchCard = async (form: SwitchCardForm) => {
await switchCardOp(form)
switchCardDialogVisible.value = false
await handleRefresh()
}
/**
@@ -288,7 +299,6 @@
const handleConfirmSetWiFi = async (form: WiFiForm) => {
await setWiFiOp(form)
setWiFiDialogVisible.value = false
await handleRefresh()
}
/**
@@ -297,11 +307,11 @@
const handleEnableBindingCard = async (payload: { card: any }) => {
const { card } = payload
try {
const { CardService } = await import('@/api/modules')
await CardService.enableIotCard(card.iccid)
const { AssetService } = await import('@/api/modules')
await AssetService.startAsset(card.iccid)
ElMessage.success('启用成功')
// 刷新资产信息
await handleRefresh()
if (cardInfo.value)
await loadRealtimeStatus(cardInfo.value.identifier, cardInfo.value.asset_type)
} catch (error: any) {
console.error('启用绑定卡失败:', error)
}
@@ -313,11 +323,11 @@
const handleDisableBindingCard = async (payload: { card: any }) => {
const { card } = payload
try {
const { CardService } = await import('@/api/modules')
await CardService.disableIotCard(card.iccid)
const { AssetService } = await import('@/api/modules')
await AssetService.stopAsset(card.iccid)
ElMessage.success('停用成功')
// 刷新资产信息
await handleRefresh()
if (cardInfo.value)
await loadRealtimeStatus(cardInfo.value.identifier, cardInfo.value.asset_type)
} catch (error: any) {
console.error('停用绑定卡失败:', error)
}
@@ -393,6 +403,13 @@
await handleSearch({ identifier: iccid })
}
/**
* 跳转到绑定设备信息
*/
const handleNavigateToDevice = async (deviceNo: string) => {
await handleSearch({ identifier: deviceNo })
}
/**
* URL参数自动加载
*/