feat: 新增更新资产实名认证策略
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 5m5s
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 5m5s
This commit is contained in:
@@ -197,11 +197,6 @@
|
||||
</ElTag>
|
||||
</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn label="实名认证策略" width="180">
|
||||
<template #default="scope">
|
||||
{{ getRealnamePolicyName(scope.row.realname_policy) }}
|
||||
</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn label="实名时间" width="180">
|
||||
<template #default="scope">
|
||||
{{ scope.row.real_name_at ? formatDateTime(scope.row.real_name_at) : '-' }}
|
||||
@@ -375,6 +370,7 @@
|
||||
<ElButton type="success" @click="handleEnableCard"> 启用此卡 </ElButton>
|
||||
<ElButton type="warning" @click="handleDisableCard"> 停用此卡 </ElButton>
|
||||
<ElButton type="danger" @click="handleManualDeactivate"> 手动停用 </ElButton>
|
||||
<ElButton type="primary" @click="handleShowRealnamePolicy"> 实名认证策略 </ElButton>
|
||||
</div>
|
||||
|
||||
<!-- 设备操作按钮 -->
|
||||
@@ -384,6 +380,7 @@
|
||||
<ElButton type="warning" @click="handleResetDevice"> 恢复出厂 </ElButton>
|
||||
<ElButton type="success" @click="handleShowSwitchCard"> 切换SIM卡 </ElButton>
|
||||
<ElButton type="primary" @click="handleShowSetWiFi"> 设置WiFi </ElButton>
|
||||
<ElButton type="primary" @click="handleShowRealnamePolicy"> 实名认证策略 </ElButton>
|
||||
</div>
|
||||
</ElCard>
|
||||
</template>
|
||||
@@ -420,6 +417,7 @@
|
||||
network_status?: number
|
||||
real_name_status?: number
|
||||
real_name_at?: string
|
||||
realname_policy?: string
|
||||
}
|
||||
|
||||
interface AssetInfo {
|
||||
@@ -509,6 +507,7 @@
|
||||
(e: 'showSwitchCard'): void
|
||||
(e: 'showSwitchMode'): void
|
||||
(e: 'show-set-wifi'): void
|
||||
(e: 'showRealnamePolicy'): void
|
||||
(e: 'enableBindingCard', payload: { card: BindingCard }): void
|
||||
(e: 'disableBindingCard', payload: { card: BindingCard }): void
|
||||
(e: 'navigateToCard', iccid: string): void
|
||||
@@ -610,6 +609,10 @@
|
||||
emit('show-set-wifi')
|
||||
}
|
||||
|
||||
const handleShowRealnamePolicy = () => {
|
||||
emit('showRealnamePolicy')
|
||||
}
|
||||
|
||||
// 绑定卡操作
|
||||
const handleEnableBindingCard = (card: BindingCard) => {
|
||||
ElMessageBox.confirm(`确定要启用此卡(${card.iccid})吗?`, '启用确认', {
|
||||
|
||||
@@ -98,7 +98,10 @@
|
||||
<ElDescriptionsItem label="套餐类型">
|
||||
{{ getPackageTypeName(currentPackage.package_type) }}
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem v-if="currentPackage.enable_virtual_data && isSuperAdmin" label="虚流量比例">
|
||||
<ElDescriptionsItem
|
||||
v-if="currentPackage.enable_virtual_data && isSuperAdmin"
|
||||
label="虚流量比例"
|
||||
>
|
||||
{{ currentPackage.virtual_ratio || '-' }}
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem v-if="currentPackage.duration_days" label="套餐时长" :span="3">
|
||||
@@ -110,11 +113,6 @@
|
||||
<ElDescriptionsItem label="到期时间">
|
||||
{{ formatDateTime(currentPackage.expire_time) || '-' }}
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="状态">
|
||||
<ElTag :type="getPackageStatusTagType(currentPackage.status)" size="small">
|
||||
{{ currentPackage.status_name || '-' }}
|
||||
</ElTag>
|
||||
</ElDescriptionsItem>
|
||||
</ElDescriptions>
|
||||
|
||||
<!-- 空状态 -->
|
||||
|
||||
@@ -67,13 +67,13 @@ export function useAssetFormatters(deviceRealtime?: Ref<any>) {
|
||||
|
||||
// 获取实名认证策略名称
|
||||
const getRealnamePolicyName = (policy?: string) => {
|
||||
if (!policy) return '-'
|
||||
if (!policy || policy === '') return '未知'
|
||||
const policyMap: Record<string, string> = {
|
||||
none: '无需实名',
|
||||
before_order: '先实名后充值/购买',
|
||||
after_order: '先充值/购买后实名'
|
||||
}
|
||||
return policyMap[policy] || policy
|
||||
return policyMap[policy] || '未知'
|
||||
}
|
||||
|
||||
// 获取资产状态名称
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
@show-switch-card="showSwitchCardDialog"
|
||||
@show-switch-mode="showSwitchModeDialog"
|
||||
@show-set-wifi="showSetWiFiDialog"
|
||||
@show-realname-policy="showRealnamePolicyDialog"
|
||||
@enable-binding-card="handleEnableBindingCard"
|
||||
@disable-binding-card="handleDisableBindingCard"
|
||||
@navigate-to-card="handleNavigateToCard"
|
||||
@@ -116,6 +117,12 @@
|
||||
:asset-identifier="cardInfo?.identifier"
|
||||
:asset-type="cardInfo?.asset_type"
|
||||
/>
|
||||
<RealnamePolicyDialog
|
||||
v-model="realnamePolicyDialogVisible"
|
||||
:asset-identifier="cardInfo?.identifier || ''"
|
||||
:current-policy="cardInfo?.realname_policy"
|
||||
@confirm="handleConfirmRealnamePolicy"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -140,6 +147,7 @@
|
||||
DailyRecordsDialog,
|
||||
OrderHistoryDialog
|
||||
} from './components/dialogs'
|
||||
import RealnamePolicyDialog from '@/components/device/RealnamePolicyDialog.vue'
|
||||
|
||||
// 引入 composables
|
||||
import { useAssetInfo } from './composables/useAssetInfo'
|
||||
@@ -196,6 +204,7 @@
|
||||
const rechargeDialogVisible = ref(false)
|
||||
const dailyRecordsDialogVisible = ref(false)
|
||||
const orderHistoryDialogVisible = ref(false)
|
||||
const realnamePolicyDialogVisible = ref(false)
|
||||
const selectedPackageUsageId = ref<number | null>(null)
|
||||
|
||||
// ========== 套餐列表分页状态 ==========
|
||||
@@ -343,6 +352,34 @@
|
||||
setWiFiDialogVisible.value = false
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示实名认证策略对话框
|
||||
*/
|
||||
const showRealnamePolicyDialog = () => {
|
||||
realnamePolicyDialogVisible.value = true
|
||||
}
|
||||
|
||||
/**
|
||||
* 确认实名认证策略
|
||||
*/
|
||||
const handleConfirmRealnamePolicy = async (form: { realname_policy: string }) => {
|
||||
try {
|
||||
const { AssetService } = await import('@/api/modules')
|
||||
const identifier = cardInfo.value?.identifier || ''
|
||||
const res = await AssetService.updateRealnamePolicy(identifier, form.realname_policy)
|
||||
if (res.code === 0) {
|
||||
ElMessage.success('设置实名认证策略成功')
|
||||
realnamePolicyDialogVisible.value = false
|
||||
await refreshAsset(cardInfo.value!.identifier, cardInfo.value!.asset_type)
|
||||
} else {
|
||||
ElMessage.error(res.msg || '设置实名认证策略失败')
|
||||
}
|
||||
} catch (error: any) {
|
||||
console.error('设置实名认证策略失败:', error)
|
||||
ElMessage.error('设置实名认证策略失败')
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 绑定卡操作 - 启用绑定卡
|
||||
*/
|
||||
|
||||
@@ -592,6 +592,14 @@
|
||||
</ElButton>
|
||||
</template>
|
||||
</ElDialog>
|
||||
|
||||
<!-- 实名认证策略对话框 -->
|
||||
<RealnamePolicyDialog
|
||||
v-model="realnamePolicyDialogVisible"
|
||||
:asset-identifier="currentRealnamePolicyAsset"
|
||||
:current-policy="currentRealnamePolicy"
|
||||
@confirm="handleConfirmRealnamePolicy"
|
||||
/>
|
||||
</ElCard>
|
||||
</div>
|
||||
</ArtTableFullScreen>
|
||||
@@ -623,6 +631,7 @@
|
||||
import { useAuth } from '@/composables/useAuth'
|
||||
import { formatDateTime } from '@/utils/business/format'
|
||||
import type { PackageSeriesResponse } from '@/types/api'
|
||||
import RealnamePolicyDialog from '@/components/device/RealnamePolicyDialog.vue'
|
||||
|
||||
defineOptions({ name: 'DeviceList' })
|
||||
|
||||
@@ -755,6 +764,11 @@
|
||||
switch_mode: [{ required: true, message: '请选择切卡模式', trigger: 'change' }]
|
||||
})
|
||||
|
||||
// 实名认证策略相关
|
||||
const realnamePolicyDialogVisible = ref(false)
|
||||
const currentRealnamePolicyAsset = ref<string>('')
|
||||
const currentRealnamePolicy = ref<string>('none')
|
||||
|
||||
// 搜索表单初始值
|
||||
const initialSearchState = {
|
||||
virtual_no: '',
|
||||
@@ -1601,6 +1615,35 @@
|
||||
case 'switch-mode':
|
||||
showSwitchModeDialog(deviceNo, device?.switch_mode)
|
||||
break
|
||||
case 'realname-policy':
|
||||
showRealnamePolicyDialog(deviceNo, device?.realname_policy)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
// 显示实名认证策略对话框
|
||||
const showRealnamePolicyDialog = (deviceNo: string, currentPolicy?: string) => {
|
||||
currentRealnamePolicyAsset.value = deviceNo
|
||||
currentRealnamePolicy.value = currentPolicy ?? 'none'
|
||||
realnamePolicyDialogVisible.value = true
|
||||
}
|
||||
|
||||
// 确认设置实名认证策略
|
||||
const handleConfirmRealnamePolicy = async (data: { realname_policy: string }) => {
|
||||
try {
|
||||
const res = await AssetService.updateRealnamePolicy(
|
||||
currentRealnamePolicyAsset.value,
|
||||
data.realname_policy
|
||||
)
|
||||
if (res.code === 0) {
|
||||
ElMessage.success('设置实名认证策略成功')
|
||||
realnamePolicyDialogVisible.value = false
|
||||
await getTableData()
|
||||
} else {
|
||||
ElMessage.error(res.msg || '设置失败')
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('设置实名认证策略失败:', error)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1913,6 +1956,14 @@
|
||||
})
|
||||
}
|
||||
|
||||
if (hasAuth('asset:realname_policy')) {
|
||||
moreActions.push({
|
||||
label: '实名认证策略',
|
||||
handler: () => handleDeviceOperation('realname-policy', row.virtual_no, row),
|
||||
type: 'primary'
|
||||
})
|
||||
}
|
||||
|
||||
// if (hasAuth('device:manual_deactivate')) {
|
||||
// moreActions.push({
|
||||
// label: '手动停用',
|
||||
|
||||
@@ -545,6 +545,14 @@
|
||||
:menu-width="180"
|
||||
@select="handleMoreMenuSelect"
|
||||
/>
|
||||
|
||||
<!-- 实名认证策略对话框 -->
|
||||
<RealnamePolicyDialog
|
||||
v-model="realnamePolicyDialogVisible"
|
||||
:asset-identifier="currentRealnamePolicyIccid"
|
||||
:current-policy="currentRealnamePolicy"
|
||||
@confirm="handleConfirmRealnamePolicy"
|
||||
/>
|
||||
</ElCard>
|
||||
</div>
|
||||
</ArtTableFullScreen>
|
||||
@@ -557,6 +565,7 @@
|
||||
import { CardService, ShopService, PackageSeriesService, AssetService } from '@/api/modules'
|
||||
import { ElMessage, ElTag, ElIcon, ElMessageBox } from 'element-plus'
|
||||
import { Loading } from '@element-plus/icons-vue'
|
||||
import RealnamePolicyDialog from '@/components/device/RealnamePolicyDialog.vue'
|
||||
import type { FormInstance, FormRules } from 'element-plus'
|
||||
import type { SearchFormItem } from '@/types'
|
||||
import { useCheckedColumns } from '@/composables/useCheckedColumns'
|
||||
@@ -636,6 +645,54 @@
|
||||
const cardStatusLoading = ref(false)
|
||||
const cardStatusData = ref<any>(null)
|
||||
|
||||
// 实名认证策略对话框
|
||||
const realnamePolicyDialogVisible = ref(false)
|
||||
const currentRealnamePolicyIccid = ref('')
|
||||
const currentRealnamePolicy = ref('none')
|
||||
|
||||
// 显示实名认证策略对话框
|
||||
const handleShowRealnamePolicy = async (iccid: string, currentPolicy?: string) => {
|
||||
currentRealnamePolicyIccid.value = iccid
|
||||
if (currentPolicy !== undefined && currentPolicy !== null) {
|
||||
currentRealnamePolicy.value = String(currentPolicy)
|
||||
} else {
|
||||
try {
|
||||
const res = await AssetService.resolveAsset(iccid)
|
||||
if (res.code === 0 && res.data) {
|
||||
currentRealnamePolicy.value = res.data.realname_policy ?? 'none'
|
||||
} else {
|
||||
currentRealnamePolicy.value = 'none'
|
||||
}
|
||||
} catch {
|
||||
currentRealnamePolicy.value = 'none'
|
||||
}
|
||||
}
|
||||
realnamePolicyDialogVisible.value = true
|
||||
}
|
||||
|
||||
// 确认设置实名认证策略
|
||||
const handleConfirmRealnamePolicy = async (data: { realname_policy: string }) => {
|
||||
if (!currentRealnamePolicyIccid.value) {
|
||||
ElMessage.warning('未指定卡片')
|
||||
return
|
||||
}
|
||||
try {
|
||||
const res = await AssetService.updateRealnamePolicy(
|
||||
currentRealnamePolicyIccid.value,
|
||||
data.realname_policy
|
||||
)
|
||||
if (res.code === 0) {
|
||||
ElMessage.success('设置实名认证策略成功')
|
||||
realnamePolicyDialogVisible.value = false
|
||||
await getTableData()
|
||||
} else {
|
||||
ElMessage.error(res.msg || '设置失败')
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('设置实名认证策略失败:', error)
|
||||
}
|
||||
}
|
||||
|
||||
// 更多操作右键菜单
|
||||
const moreMenuRef = ref<InstanceType<typeof ArtMenuRight>>()
|
||||
|
||||
@@ -1153,6 +1210,29 @@
|
||||
})
|
||||
}
|
||||
|
||||
if (hasAuth('asset:realname_policy')) {
|
||||
actions.push({
|
||||
label: '实名认证策略',
|
||||
handler: () => handleCardOperation('realname-policy', row.iccid, row),
|
||||
type: 'primary'
|
||||
})
|
||||
}
|
||||
|
||||
// 更多操作放到"更多"下拉菜单中
|
||||
const moreActions: any[] = []
|
||||
|
||||
if (hasAuth('iot_card:clear_series')) {
|
||||
moreActions.push({
|
||||
label: '清除关联',
|
||||
handler: () => handleCardOperation('clear-series', row.iccid),
|
||||
type: 'primary'
|
||||
})
|
||||
}
|
||||
|
||||
if (moreActions.length > 0) {
|
||||
actions.push(...moreActions)
|
||||
}
|
||||
|
||||
// if (hasAuth('iot_card:manual_deactivate')) {
|
||||
// actions.push({
|
||||
// label: '手动停用',
|
||||
@@ -1524,13 +1604,6 @@
|
||||
})
|
||||
}
|
||||
|
||||
if (hasAuth('iot_card:clear_series')) {
|
||||
items.push({
|
||||
key: 'clearSeries',
|
||||
label: '清除关联'
|
||||
})
|
||||
}
|
||||
|
||||
return items
|
||||
})
|
||||
|
||||
@@ -1632,7 +1705,7 @@
|
||||
}
|
||||
|
||||
// IoT卡操作处理函数
|
||||
const handleCardOperation = (command: string, iccid: string) => {
|
||||
const handleCardOperation = (command: string, iccid: string, row?: any) => {
|
||||
switch (command) {
|
||||
case 'realname-status':
|
||||
showRealnameStatusDialog(iccid)
|
||||
@@ -1646,12 +1719,48 @@
|
||||
case 'stop-card':
|
||||
handleStopCard(iccid)
|
||||
break
|
||||
case 'realname-policy':
|
||||
handleShowRealnamePolicy(iccid, row?.realname_policy)
|
||||
break
|
||||
case 'manual-deactivate':
|
||||
handleManualDeactivate(iccid)
|
||||
break
|
||||
case 'clear-series':
|
||||
handleClearSingleCardSeries(iccid)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
// 清除单卡套餐系列绑定
|
||||
const handleClearSingleCardSeries = (iccid: string) => {
|
||||
ElMessageBox.confirm(`确定要清除该卡(${iccid})的套餐系列关联吗?`, '确认清除', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
})
|
||||
.then(async () => {
|
||||
try {
|
||||
const res = await CardService.batchSetCardSeriesBinding({
|
||||
iccids: [iccid],
|
||||
series_id: 0
|
||||
})
|
||||
if (res.code === 0) {
|
||||
if (res.data.fail_count === 0) {
|
||||
ElMessage.success('清除关联成功')
|
||||
} else {
|
||||
ElMessage.warning(`失败:${res.data.failed_items?.[0]?.reason || '未知原因'}`)
|
||||
}
|
||||
await getTableData()
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('清除关联失败:', error)
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
// 用户取消
|
||||
})
|
||||
}
|
||||
|
||||
// 查询流量使用
|
||||
const showFlowUsageDialog = async (iccid: string) => {
|
||||
flowUsageDialogVisible.value = true
|
||||
|
||||
Reference in New Issue
Block a user