+
@@ -2368,6 +2402,74 @@
}
}
+ // ========== 绑定卡列表操作 ==========
+
+ // 启用绑定卡列表中的某张卡
+ const handleEnableBindingCard = async (card: any) => {
+ try {
+ await ElMessageBox.confirm(`确认要启用卡片 ${card.iccid} 吗?`, '提示', {
+ type: 'warning'
+ })
+
+ const res = await CardService.enableIotCard(card.iccid)
+ if (res.code === 0) {
+ ElMessage.success('启用成功')
+ await handleRefreshAsset()
+ }
+ } catch (error: any) {
+ if (error !== 'cancel') {
+ console.error('启用失败:', error)
+ ElMessage.error(error?.message || '启用失败')
+ }
+ }
+ }
+
+ // 停用绑定卡列表中的某张卡
+ const handleDisableBindingCard = async (card: any) => {
+ try {
+ await ElMessageBox.confirm(`确认要停用卡片 ${card.iccid} 吗?`, '提示', {
+ type: 'warning'
+ })
+
+ const res = await CardService.disableIotCard(card.iccid)
+ if (res.code === 0) {
+ ElMessage.success('停用成功')
+ await handleRefreshAsset()
+ }
+ } catch (error: any) {
+ if (error !== 'cancel') {
+ console.error('停用失败:', error)
+ ElMessage.error(error?.message || '停用失败')
+ }
+ }
+ }
+
+ // 手动停用绑定卡列表中的某张卡
+ const handleDeactivateBindingCard = async (card: any) => {
+ try {
+ await ElMessageBox.confirm(
+ `手动停用后卡片 ${card.iccid} 将永久停用,无法再次使用。此操作不可逆,请谨慎操作。确认要手动停用吗?`,
+ '警告',
+ {
+ type: 'error',
+ confirmButtonText: '确认停用',
+ cancelButtonText: '取消'
+ }
+ )
+
+ const res = await CardService.deactivateIotCard(card.id)
+ if (res.code === 0) {
+ ElMessage.success('手动停用成功')
+ await handleRefreshAsset()
+ }
+ } catch (error: any) {
+ if (error !== 'cancel') {
+ console.error('手动停用失败:', error)
+ ElMessage.error(error?.message || '手动停用失败')
+ }
+ }
+ }
+
// ========== 设备操作 ==========
// 重启设备