feat: 审计链路
Some checks failed
构建并部署前端到测试环境 / build-and-deploy (push) Failing after 59s

This commit is contained in:
luo
2026-08-07 18:33:37 +08:00
parent fa3d7088f9
commit b8b2854aa6
54 changed files with 5448 additions and 12 deletions

View File

@@ -9,6 +9,9 @@
</ElTag>
</div>
<div class="card-header-right">
<ElButton v-if="auditTarget" type="primary" link @click="openAssetAudit">
{{ isSubjectActivityView ? '活动记录' : '审计记录' }}
</ElButton>
<ElButton
v-if="
cardInfo?.asset_type === 'card' &&
@@ -311,7 +314,7 @@
{{ scope.row.gateway_extend || '-' }}
</template>
</ElTableColumn>
<ElTableColumn label="操作" width="180" fixed="right">
<ElTableColumn label="操作" width="280" fixed="right">
<template #default="scope">
<!-- 根据网络状态显示启用或停用按钮 -->
<ElButton
@@ -345,6 +348,24 @@
>
更新实名状态
</ElButton>
<ElButton
v-if="getBindingCardAuditTarget(scope.row)"
type="primary"
size="small"
link
@click="openBindingCardAudit(scope.row)"
>
卡审计
</ElButton>
<ElButton
v-if="getBindingAuditTarget(scope.row)"
type="primary"
size="small"
link
@click="openBindingAudit(scope.row)"
>
绑定审计
</ElButton>
</template>
</ElTableColumn>
</ElTable>
@@ -589,10 +610,14 @@
getExpiryEstimateTooltip,
getExpiryEstimateClass
} from '@/utils/business/expiryEstimate'
import { AUDIT_PERMISSIONS } from '@/config/constants/audit'
import { resolveAuditResourceTarget } from '@/utils/business/auditNavigation'
import { openAuditInvestigation } from '@/components/business/audit/investigationController'
// Props
interface BindingCard {
id: number
card_id?: number
iccid: string
msisdn?: string
carrier_name?: string
@@ -609,7 +634,9 @@
}
interface AssetInfo {
asset_id: number
asset_type: 'card' | 'device'
identifier: string
iccid?: string
imei?: string
msisdn?: string
@@ -717,6 +744,64 @@
const { hasAuth } = useAuth()
const userStore = useUserStore()
const isSubjectActivityView = computed(() => [3, 4].includes(Number(userStore.info.user_type)))
const auditTarget = computed(() => {
const userType = Number(userStore.info.user_type)
const permission =
userType === 3
? AUDIT_PERMISSIONS.agentActivity
: userType === 4
? AUDIT_PERMISSIONS.enterpriseActivity
: props.cardInfo.asset_type === 'card'
? AUDIT_PERMISSIONS.cardEntry
: AUDIT_PERMISSIONS.deviceEntry
if (!hasAuth(permission)) return null
return resolveAuditResourceTarget({
userType,
resourceType: props.cardInfo.asset_type === 'card' ? 'iot_card' : 'device',
internalId: props.cardInfo.asset_id,
businessIdentifier:
props.cardInfo.asset_type === 'card' ? props.cardInfo.iccid : props.cardInfo.virtual_no
})
})
const openAssetAudit = () => {
if (auditTarget.value) openAuditInvestigation(auditTarget.value)
}
const getBindingCardAuditTarget = (card: BindingCard) => {
const userType = Number(userStore.info.user_type)
const permission =
userType === 3
? AUDIT_PERMISSIONS.agentActivity
: userType === 4
? AUDIT_PERMISSIONS.enterpriseActivity
: AUDIT_PERMISSIONS.cardEntry
if (!hasAuth(permission)) return null
return resolveAuditResourceTarget({
userType,
resourceType: 'iot_card',
internalId: card.card_id,
businessIdentifier: card.iccid
})
}
const getBindingAuditTarget = (card: BindingCard) => {
if (
![1, 2].includes(Number(userStore.info.user_type)) ||
!hasAuth(AUDIT_PERMISSIONS.resourceTimeline)
)
return null
return resolveAuditResourceTarget({
resourceType: 'device_sim_binding',
internalId: card.id
})
}
const openBindingCardAudit = (card: BindingCard) => {
const target = getBindingCardAuditTarget(card)
if (target) openAuditInvestigation(target)
}
const openBindingAudit = (card: BindingCard) => {
const target = getBindingAuditTarget(card)
if (target) openAuditInvestigation(target)
}
const { width } = useWindowSize()
const CARD_MONTH_USAGE_PERMISSION = 'asset_info:view_card_month_usage'

View File

@@ -44,6 +44,20 @@
/>
<ElButton type="primary" @click="handleQuery">查询</ElButton>
<ElButton @click="handleReset()">重置</ElButton>
<ElButton
v-if="walletInfo?.wallet_id && hasAuth(AUDIT_PERMISSIONS.financeTimeline)"
@click="openWalletAudit"
>资金链路</ElButton
>
<ElButton
v-if="
walletInfo?.resource_type &&
walletInfo?.resource_id &&
hasAuth(AUDIT_PERMISSIONS.resourceTimeline)
"
@click="openAssetAudit"
>资产审计</ElButton
>
</div>
</div>
</template>
@@ -167,6 +181,13 @@
AssetWalletTransactionParams,
TransactionType
} from '@/types/api'
import { useAuth } from '@/composables/useAuth'
import { AUDIT_PERMISSIONS } from '@/config/constants/audit'
import {
resolveAuditResourceTarget,
resolveFinanceAuditTarget
} from '@/utils/business/auditNavigation'
import { openAuditInvestigation } from '@/components/business/audit/investigationController'
interface Props {
assetIdentifier: string
@@ -182,6 +203,19 @@
boundDeviceId: undefined,
boundDeviceNo: ''
})
const { hasAuth } = useAuth()
const openWalletAudit = () => {
const target = resolveFinanceAuditTarget('wallet_id', props.walletInfo?.wallet_id)
if (target) openAuditInvestigation(target)
}
const openAssetAudit = () => {
const target = resolveAuditResourceTarget({
resourceType: props.walletInfo?.resource_type || '',
internalId: props.walletInfo?.resource_id
})
if (target) openAuditInvestigation(target)
}
const emit = defineEmits<{
(e: 'navigateToDevice', deviceNo: string): void

View File

@@ -969,6 +969,10 @@
import { computed, h } from 'vue'
import { useRouter } from 'vue-router'
import { RoutesAlias } from '@/router/routesAlias'
import { AUDIT_PERMISSIONS } from '@/config/constants/audit'
import { resolveAuditResourceTarget } from '@/utils/business/auditNavigation'
import { openAuditInvestigation } from '@/components/business/audit/investigationController'
import { useUserStore } from '@/store/modules/user'
import {
DeviceService,
ShopService,
@@ -1027,6 +1031,7 @@
const { hasAuth } = useAuth()
const router = useRouter()
const userStore = useUserStore()
const loading = ref(false)
const allocateLoading = ref(false)
@@ -3173,6 +3178,27 @@
})
}
const userType = Number(userStore.getUserInfo.user_type)
const auditPermission =
userType === 3
? AUDIT_PERMISSIONS.agentActivity
: userType === 4
? AUDIT_PERMISSIONS.enterpriseActivity
: AUDIT_PERMISSIONS.deviceEntry
if (hasAuth(auditPermission)) {
const auditTarget = resolveAuditResourceTarget({
userType,
resourceType: 'device',
internalId: row.id,
businessIdentifier: row.virtual_no
})
if (auditTarget)
moreActions.push({
label: userType >= 3 ? '活动记录' : '审计记录',
handler: () => openAuditInvestigation(auditTarget),
type: 'primary'
})
}
// 如果有更多操作,添加到 actions 中
if (moreActions.length > 0) {
actions.push(...moreActions)

View File

@@ -10,6 +10,30 @@
返回
</ElButton>
<h2 class="detail-title">换货单详情</h2>
<ElButton
v-if="exchangeAuditTarget && hasAuth(exchangeAuditPermission)"
type="primary"
plain
@click="openAuditInvestigation(exchangeAuditTarget)"
>
{{ userType === 3 ? '活动记录' : '换货审计' }}
</ElButton>
<ElButton
v-if="oldAssetAuditTarget && hasAuth(AUDIT_PERMISSIONS.resourceTimeline)"
type="primary"
plain
@click="openAuditInvestigation(oldAssetAuditTarget)"
>
旧资产审计
</ElButton>
<ElButton
v-if="newAssetAuditTarget && hasAuth(AUDIT_PERMISSIONS.resourceTimeline)"
type="primary"
plain
@click="openAuditInvestigation(newAssetAuditTarget)"
>
新资产审计
</ElButton>
</div>
<!-- 详情内容 -->
@@ -35,15 +59,51 @@
import { formatDateTime } from '@/utils/business/format'
import DetailPage from '@/components/common/DetailPage.vue'
import type { DetailSection } from '@/components/common/DetailPage.vue'
import { useAuth } from '@/composables/useAuth'
import { useUserStore } from '@/store/modules/user'
import { AUDIT_PERMISSIONS } from '@/config/constants/audit'
import { resolveAuditResourceTarget } from '@/utils/business/auditNavigation'
import { openAuditInvestigation } from '@/components/business/audit/investigationController'
defineOptions({ name: 'ExchangeDetail' })
const route = useRoute()
const router = useRouter()
const { hasAuth } = useAuth()
const userStore = useUserStore()
const loading = ref(false)
const exchangeDetail = ref<ExchangeResponse | null>(null)
const exchangeId = ref<number>(0)
const userType = computed(() => Number(userStore.info.user_type))
const exchangeAuditPermission = computed(() =>
userType.value === 3 ? AUDIT_PERMISSIONS.agentActivity : AUDIT_PERMISSIONS.resourceTimeline
)
const exchangeAuditTarget = computed(() => {
if (!exchangeDetail.value || userType.value === 4) return null
return resolveAuditResourceTarget({
userType: userType.value,
resourceType: 'exchange_order',
internalId: exchangeDetail.value.id,
businessIdentifier: exchangeDetail.value.exchange_no
})
})
const oldAssetAuditTarget = computed(() => {
if (!exchangeDetail.value || ![1, 2].includes(userType.value)) return null
return resolveAuditResourceTarget({
userType: userType.value,
resourceType: exchangeDetail.value.old_asset_type,
internalId: exchangeDetail.value.old_asset_id
})
})
const newAssetAuditTarget = computed(() => {
if (!exchangeDetail.value || ![1, 2].includes(userType.value)) return null
return resolveAuditResourceTarget({
userType: userType.value,
resourceType: exchangeDetail.value.new_asset_type || '',
internalId: exchangeDetail.value.new_asset_id
})
})
const formatExchangeShopName = (shopName?: string | null, shopId?: number | null) => {
if (shopName) return shopName

View File

@@ -35,7 +35,7 @@
:total="pagination.total"
:marginTop="10"
:actions="getActions"
:actionsWidth="120"
:actionsWidth="160"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
>
@@ -438,10 +438,15 @@
getProcessingStatusText
} from '@/utils/business/approvalSummary'
import { RoutesAlias } from '@/router/routesAlias'
import { useUserStore } from '@/store/modules/user'
import { AUDIT_PERMISSIONS } from '@/config/constants/audit'
import { resolveAuditResourceTarget } from '@/utils/business/auditNavigation'
import { openAuditInvestigation } from '@/components/business/audit/investigationController'
defineOptions({ name: 'ExchangeManagement' })
const { hasAuth } = useAuth()
const userStore = useUserStore()
const router = useRouter()
const currentExchangeRow = ref<ExchangeResponse | null>(null)
@@ -1548,6 +1553,45 @@
const actions: any[] = []
const status = row.status
const flowType = row.flow_type || 'shipping' // 历史数据兼容
const userType = Number(userStore.info.user_type)
const entryPermission =
userType === 3 ? AUDIT_PERMISSIONS.agentActivity : AUDIT_PERMISSIONS.resourceTimeline
if (userType !== 4 && hasAuth(entryPermission)) {
const exchangeTarget = resolveAuditResourceTarget({
userType,
resourceType: 'exchange_order',
internalId: row.id,
businessIdentifier: row.exchange_no
})
if (exchangeTarget)
actions.push({
label: userType === 3 ? '活动记录' : '换货审计',
handler: () => openAuditInvestigation(exchangeTarget),
type: 'primary'
})
if ([1, 2].includes(userType)) {
const oldAssetTarget = resolveAuditResourceTarget({
resourceType: row.old_asset_type,
internalId: row.old_asset_id
})
if (oldAssetTarget)
actions.push({
label: '旧资产审计',
handler: () => openAuditInvestigation(oldAssetTarget),
type: 'primary'
})
const newAssetTarget = resolveAuditResourceTarget({
resourceType: row.new_asset_type || '',
internalId: row.new_asset_id
})
if (newAssetTarget)
actions.push({
label: '新资产审计',
handler: () => openAuditInvestigation(newAssetTarget),
type: 'primary'
})
}
}
// 直接换货不支持任何操作(发货、确认完成、取消)
if (flowType === 'direct') {

View File

@@ -1024,6 +1024,9 @@
import { computed, h } from 'vue'
import { useRouter } from 'vue-router'
import { RoutesAlias } from '@/router/routesAlias'
import { AUDIT_PERMISSIONS } from '@/config/constants/audit'
import { resolveAuditResourceTarget } from '@/utils/business/auditNavigation'
import { openAuditInvestigation } from '@/components/business/audit/investigationController'
import {
CardService,
ShopService,
@@ -2331,6 +2334,27 @@
})
}
const userType = Number(userStore.getUserInfo.user_type)
const auditPermission =
userType === 3
? AUDIT_PERMISSIONS.agentActivity
: userType === 4
? AUDIT_PERMISSIONS.enterpriseActivity
: AUDIT_PERMISSIONS.cardEntry
if (hasAuth(auditPermission)) {
const auditTarget = resolveAuditResourceTarget({
userType,
resourceType: 'iot_card',
internalId: row.id,
businessIdentifier: row.iccid
})
if (auditTarget)
actions.push({
label: userType >= 3 ? '活动记录' : '审计记录',
handler: () => openAuditInvestigation(auditTarget),
type: 'primary'
})
}
return actions
}
@@ -2448,8 +2472,8 @@
return
}
const successCount = res.data?.success_count ?? assetIds.length
ElMessage.success(`批量修改实名顺序成功:${successCount}/${assetIds.length}`)
const successCount = res.data?.success_count ?? assetIds.length
ElMessage.success(`批量修改实名顺序成功:${successCount}/${assetIds.length}`)
batchRealnamePolicyDialogVisible.value = false
selectedCards.value = []
await getTableData()

View File

@@ -10,6 +10,22 @@
返回
</ElButton>
<h2 class="detail-title">资产分配详情</h2>
<ElButton
v-if="recordAuditTarget && hasAuth(recordAuditPermission)"
type="primary"
plain
@click="openAuditInvestigation(recordAuditTarget)"
>
{{ userType === 3 ? '活动记录' : '分配审计' }}
</ElButton>
<ElButton
v-if="assetAuditTarget && hasAuth(AUDIT_PERMISSIONS.resourceTimeline)"
type="primary"
plain
@click="openAuditInvestigation(assetAuditTarget)"
>
资产审计
</ElButton>
</div>
<!-- 详情内容 -->
@@ -25,7 +41,7 @@
</template>
<script setup lang="ts">
import { ref, onMounted } from 'vue'
import { computed, ref, onMounted } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { ElCard, ElButton, ElIcon, ElMessage } from 'element-plus'
import { ArrowLeft, Loading } from '@element-plus/icons-vue'
@@ -34,14 +50,42 @@
import { CardService } from '@/api/modules'
import type { AssetAllocationRecord } from '@/types/api/card'
import { formatDateTime } from '@/utils/business/format'
import { useAuth } from '@/composables/useAuth'
import { useUserStore } from '@/store/modules/user'
import { AUDIT_PERMISSIONS } from '@/config/constants/audit'
import { resolveAuditResourceTarget } from '@/utils/business/auditNavigation'
import { openAuditInvestigation } from '@/components/business/audit/investigationController'
defineOptions({ name: 'AssetAssignDetail' })
const route = useRoute()
const router = useRouter()
const { hasAuth } = useAuth()
const userStore = useUserStore()
const loading = ref(false)
const detailData = ref<AssetAllocationRecord | null>(null)
const userType = computed(() => Number(userStore.info.user_type))
const recordAuditPermission = computed(() =>
userType.value === 3 ? AUDIT_PERMISSIONS.agentActivity : AUDIT_PERMISSIONS.resourceTimeline
)
const recordAuditTarget = computed(() => {
if (!detailData.value || userType.value === 4) return null
return resolveAuditResourceTarget({
userType: userType.value,
resourceType: 'asset_allocation_record',
internalId: detailData.value.id,
businessIdentifier: detailData.value.allocation_no
})
})
const assetAuditTarget = computed(() => {
if (!detailData.value || ![1, 2].includes(userType.value)) return null
return resolveAuditResourceTarget({
userType: userType.value,
resourceType: detailData.value.asset_type,
internalId: detailData.value.asset_id
})
})
// 详情页配置
const detailSections: DetailSection[] = [

View File

@@ -28,6 +28,8 @@
:pageSize="pagination.pageSize"
:total="pagination.total"
:marginTop="10"
:actions="getActions"
:actionsWidth="180"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
>
@@ -51,10 +53,15 @@
import { formatDateTime } from '@/utils/business/format'
import type { AssetAllocationRecord, AllocationTypeEnum, AssetTypeEnum } from '@/types/api/card'
import { RoutesAlias } from '@/router/routesAlias'
import { useUserStore } from '@/store/modules/user'
import { AUDIT_PERMISSIONS } from '@/config/constants/audit'
import { resolveAuditResourceTarget } from '@/utils/business/auditNavigation'
import { openAuditInvestigation } from '@/components/business/audit/investigationController'
defineOptions({ name: 'AssetAllocationRecords' })
const { hasAuth } = useAuth()
const userStore = useUserStore()
const router = useRouter()
const loading = ref(false)
@@ -221,6 +228,40 @@
const recordList = ref<AssetAllocationRecord[]>([])
const getActions = (row: AssetAllocationRecord) => {
const actions: Array<{ label: string; handler: () => void; type: 'primary' }> = []
const userType = Number(userStore.info.user_type)
const entryPermission =
userType === 3 ? AUDIT_PERMISSIONS.agentActivity : AUDIT_PERMISSIONS.resourceTimeline
if (!hasAuth(entryPermission) || userType === 4) return actions
const recordTarget = resolveAuditResourceTarget({
userType,
resourceType: 'asset_allocation_record',
internalId: row.id,
businessIdentifier: row.allocation_no
})
if (recordTarget)
actions.push({
label: userType === 3 ? '活动记录' : '分配审计',
handler: () => openAuditInvestigation(recordTarget),
type: 'primary'
})
if ([1, 2].includes(userType)) {
const assetTarget = resolveAuditResourceTarget({
userType,
resourceType: row.asset_type,
internalId: row.asset_id
})
if (assetTarget)
actions.push({
label: '资产审计',
handler: () => openAuditInvestigation(assetTarget),
type: 'primary'
})
}
return actions
}
// 获取分配类型标签类型
const getAllocationTypeType = (type: AllocationTypeEnum) => {
return type === 'allocate' ? 'success' : 'warning'