This commit is contained in:
@@ -246,8 +246,8 @@
|
||||
import { useAssetFormatters } from '../composables/useAssetFormatters'
|
||||
import { useUserStore } from '@/store/modules/user'
|
||||
import { storeToRefs } from 'pinia'
|
||||
import type { AssetPackageUsageRecord } from '@/types/api'
|
||||
import { formatDateTime } from '@/utils/business/format'
|
||||
import type { PackageInfo } from '../types'
|
||||
|
||||
const {
|
||||
formatAmount,
|
||||
@@ -265,10 +265,10 @@
|
||||
)
|
||||
|
||||
interface Props {
|
||||
currentPackage: PackageInfo | null
|
||||
currentPackage: AssetPackageUsageRecord | null
|
||||
loading?: boolean
|
||||
errorMsg?: string
|
||||
boundDeviceId?: number
|
||||
boundDeviceId?: number | null
|
||||
boundDeviceNo?: string
|
||||
boundDeviceName?: string
|
||||
}
|
||||
|
||||
@@ -79,6 +79,14 @@
|
||||
<span class="field-value">
|
||||
<template v-if="item.type === 'change'">
|
||||
<span class="new-value">{{ formatFieldValue(item.key, item.afterValue) }}</span>
|
||||
<ElButton
|
||||
v-if="canDownloadLogFile && isDownloadableFileKey(item.key, item.afterValue)"
|
||||
link
|
||||
type="primary"
|
||||
@click.stop="handleDownloadLogFile(item.afterValue)"
|
||||
>
|
||||
下载文件
|
||||
</ElButton>
|
||||
</template>
|
||||
<span v-else :class="['message-value', item.level === 'error' ? 'is-error' : '']">
|
||||
{{ item.message }}
|
||||
@@ -106,7 +114,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { reactive, ref, watch } from 'vue'
|
||||
import { computed, reactive, ref, watch } from 'vue'
|
||||
import {
|
||||
ElButton,
|
||||
ElCard,
|
||||
@@ -118,13 +126,15 @@
|
||||
ElTableColumn,
|
||||
ElTag
|
||||
} from 'element-plus'
|
||||
import { AssetService } from '@/api/modules'
|
||||
import { AssetService, StorageService } from '@/api/modules'
|
||||
import { useAuth } from '@/composables/useAuth'
|
||||
import type { AssetOperationLogItem } from '@/types/api'
|
||||
import { formatDateTime } from '@/utils/business/format'
|
||||
|
||||
interface Props {
|
||||
assetIdentifier?: string
|
||||
assetType?: string
|
||||
downloadPermission?: string
|
||||
}
|
||||
|
||||
type TagType = 'primary' | 'success' | 'warning' | 'info' | 'danger'
|
||||
@@ -285,10 +295,14 @@
|
||||
}
|
||||
|
||||
const props = defineProps<Props>()
|
||||
const { hasAuth } = useAuth()
|
||||
|
||||
const loading = ref(false)
|
||||
const logList = ref<OperationLogRow[]>([])
|
||||
const total = ref(0)
|
||||
const canDownloadLogFile = computed(() => {
|
||||
return props.downloadPermission ? hasAuth(props.downloadPermission) : false
|
||||
})
|
||||
const pagination = reactive({
|
||||
page: 1,
|
||||
page_size: 20
|
||||
@@ -369,6 +383,20 @@
|
||||
return textMap[status] || status
|
||||
}
|
||||
|
||||
const isDownloadableFileKey = (key: string, value: unknown) => {
|
||||
return key === 'file_key' && typeof value === 'string' && value.trim() !== ''
|
||||
}
|
||||
|
||||
const handleDownloadLogFile = async (fileKey: string) => {
|
||||
try {
|
||||
await StorageService.downloadFileByKey(fileKey)
|
||||
ElMessage.success('文件下载已开始')
|
||||
} catch (error) {
|
||||
console.error('下载日志文件失败:', error)
|
||||
ElMessage.error('下载文件失败')
|
||||
}
|
||||
}
|
||||
|
||||
const getOperatorTypeText = (row: OperationLogRow) => {
|
||||
if (row.operator_type_code && operatorTypeMap[row.operator_type_code]) {
|
||||
return operatorTypeMap[row.operator_type_code]
|
||||
|
||||
@@ -165,20 +165,17 @@
|
||||
import { useAssetFormatters } from '../composables/useAssetFormatters'
|
||||
import { formatDateTime } from '@/utils/business/format'
|
||||
import { AssetService } from '@/api/modules'
|
||||
|
||||
interface WalletInfo {
|
||||
balance: number
|
||||
available_balance: number
|
||||
frozen_balance: number
|
||||
status: number
|
||||
status_text?: string
|
||||
}
|
||||
import type {
|
||||
AssetWalletResponse,
|
||||
AssetWalletTransactionParams,
|
||||
TransactionType
|
||||
} from '@/types/api'
|
||||
|
||||
interface Props {
|
||||
assetIdentifier: string
|
||||
walletInfo: WalletInfo | null
|
||||
walletInfo: AssetWalletResponse | null
|
||||
walletLoading?: boolean
|
||||
boundDeviceId?: number
|
||||
boundDeviceId?: number | null
|
||||
boundDeviceNo?: string
|
||||
}
|
||||
|
||||
@@ -200,16 +197,16 @@
|
||||
const total = ref(0)
|
||||
const pagination = ref({ page: 1, page_size: 20 })
|
||||
const filterForm = ref<{
|
||||
transaction_type: string | null
|
||||
transaction_type: TransactionType | null
|
||||
date_range: [Date, Date] | null
|
||||
}>({
|
||||
transaction_type: null,
|
||||
date_range: null
|
||||
})
|
||||
const queryParams = ref({
|
||||
const queryParams = ref<AssetWalletTransactionParams>({
|
||||
page: 1,
|
||||
page_size: 20,
|
||||
transaction_type: null as string | null,
|
||||
transaction_type: null as TransactionType | null,
|
||||
start_time: null as string | null,
|
||||
end_time: null as string | null
|
||||
})
|
||||
|
||||
@@ -121,8 +121,8 @@ export function useAssetFormatters() {
|
||||
}
|
||||
|
||||
// 获取钱包状态标签类型
|
||||
const getWalletStatusType = (status?: number) => {
|
||||
const map: Record<number, string> = {
|
||||
const getWalletStatusType = (status?: number): TagType => {
|
||||
const map: Record<number, TagType> = {
|
||||
1: 'success',
|
||||
2: 'warning',
|
||||
3: 'danger'
|
||||
@@ -176,8 +176,8 @@ export function useAssetFormatters() {
|
||||
}
|
||||
|
||||
// 获取交易类型标签颜色
|
||||
const getTransactionTypeTag = (type: string | undefined) => {
|
||||
const map: Record<string, string> = {
|
||||
const getTransactionTypeTag = (type: string | undefined): TagType => {
|
||||
const map: Record<string, TagType> = {
|
||||
recharge: 'success',
|
||||
deduct: 'danger',
|
||||
refund: 'warning'
|
||||
|
||||
@@ -89,6 +89,7 @@
|
||||
<OperationLogsCard
|
||||
:asset-identifier="cardInfo.identifier"
|
||||
:asset-type="cardInfo.asset_type"
|
||||
download-permission="asset_info:download_log_file"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -134,7 +135,7 @@
|
||||
/>
|
||||
<DailyRecordsDialog
|
||||
v-model="dailyRecordsDialogVisible"
|
||||
:package-usage-id="selectedPackageUsageId"
|
||||
:package-usage-id="selectedPackageUsageId ?? undefined"
|
||||
/>
|
||||
<OrderHistoryDialog
|
||||
v-model="orderHistoryDialogVisible"
|
||||
@@ -276,8 +277,7 @@
|
||||
slot_position: card.slot_position,
|
||||
carrier_name: card.carrier_name,
|
||||
msisdn: card.msisdn,
|
||||
network_status:
|
||||
card.network_status === undefined ? undefined : Number(card.network_status),
|
||||
network_status: card.network_status === undefined ? undefined : Number(card.network_status),
|
||||
real_name_status:
|
||||
card.real_name_status === undefined ? undefined : Number(card.real_name_status),
|
||||
is_current: card.is_current
|
||||
@@ -466,8 +466,7 @@
|
||||
/**
|
||||
* 更新实名状态成功
|
||||
*/
|
||||
const handleUpdateRealnameStatusSuccess = async () => {
|
||||
}
|
||||
const handleUpdateRealnameStatusSuccess = async () => {}
|
||||
|
||||
/**
|
||||
* 显示绑定卡更新实名状态对话框
|
||||
@@ -481,8 +480,7 @@
|
||||
/**
|
||||
* 绑定卡更新实名状态成功
|
||||
*/
|
||||
const handleBindingCardRealnameStatusSuccess = async () => {
|
||||
}
|
||||
const handleBindingCardRealnameStatusSuccess = async () => {}
|
||||
|
||||
/**
|
||||
* 确认实名认证策略
|
||||
|
||||
@@ -377,7 +377,7 @@
|
||||
<ElOption
|
||||
v-if="iotCardList.length === 0 && !iotCardSearchLoading"
|
||||
label="未找到相关数据"
|
||||
:value="undefined"
|
||||
value=""
|
||||
disabled
|
||||
/>
|
||||
</ElSelect>
|
||||
@@ -498,6 +498,7 @@
|
||||
<OperationLogsDialog
|
||||
v-model="operationLogsDialogVisible"
|
||||
:identifier="operationLogsIdentifier"
|
||||
download-permission="device:download_log_file"
|
||||
/>
|
||||
</ElCard>
|
||||
</div>
|
||||
@@ -867,7 +868,7 @@
|
||||
|
||||
// 分配表单
|
||||
const allocateForm = reactive({
|
||||
target_shop_id: undefined as number | undefined,
|
||||
target_shop_id: undefined as number[] | undefined,
|
||||
remark: ''
|
||||
})
|
||||
|
||||
@@ -1467,9 +1468,15 @@
|
||||
if (valid) {
|
||||
allocateLoading.value = true
|
||||
try {
|
||||
const targetShopPath = allocateForm.target_shop_id
|
||||
if (!targetShopPath?.length) {
|
||||
ElMessage.warning('请选择目标店铺')
|
||||
return
|
||||
}
|
||||
|
||||
const data = {
|
||||
device_ids: selectedDevices.value.map((d) => d.id),
|
||||
target_shop_id: allocateForm.target_shop_id![allocateForm.target_shop_id.length - 1],
|
||||
target_shop_id: targetShopPath[targetShopPath.length - 1],
|
||||
remark: allocateForm.remark
|
||||
}
|
||||
const res = await DeviceService.allocateDevices(data)
|
||||
@@ -1890,8 +1897,7 @@
|
||||
slot_position: card.slot_position,
|
||||
carrier_name: card.carrier_name,
|
||||
msisdn: card.msisdn,
|
||||
network_status:
|
||||
card.network_status === undefined ? undefined : Number(card.network_status),
|
||||
network_status: card.network_status === undefined ? undefined : Number(card.network_status),
|
||||
real_name_status:
|
||||
card.real_name_status === undefined ? undefined : Number(card.real_name_status),
|
||||
is_current: card.is_current
|
||||
|
||||
@@ -42,7 +42,6 @@
|
||||
>
|
||||
批量设置套餐系列
|
||||
</ElButton>
|
||||
|
||||
</template>
|
||||
</ArtTableHeader>
|
||||
|
||||
@@ -516,6 +515,7 @@
|
||||
<OperationLogsDialog
|
||||
v-model="operationLogsDialogVisible"
|
||||
:identifier="operationLogsIdentifier"
|
||||
download-permission="iot_card:download_log_file"
|
||||
/>
|
||||
</ElCard>
|
||||
</div>
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
:total="pagination.total"
|
||||
:marginTop="10"
|
||||
:actions="getActions"
|
||||
:actionsWidth="120"
|
||||
:actionsWidth="180"
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange"
|
||||
>
|
||||
@@ -614,9 +614,34 @@
|
||||
}
|
||||
}
|
||||
|
||||
const downloadTaskFile = async (row: DeviceImportTask) => {
|
||||
const fileKey = row.file_name?.trim()
|
||||
if (!fileKey) {
|
||||
ElMessage.warning('当前任务没有可下载的原始文件')
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
await StorageService.downloadFileByKey(fileKey)
|
||||
ElMessage.success('原始文件下载已开始')
|
||||
} catch (error) {
|
||||
console.error('下载原始文件失败:', error)
|
||||
ElMessage.error('下载原始文件失败')
|
||||
}
|
||||
}
|
||||
|
||||
// 获取操作按钮
|
||||
const getActions = (row: DeviceImportTask) => {
|
||||
const actions: any[] = []
|
||||
const showDownloadFileAction = false
|
||||
|
||||
if (showDownloadFileAction && row.file_name?.trim() && hasAuth('device_task:download_file')) {
|
||||
actions.push({
|
||||
label: '下载文件',
|
||||
handler: () => downloadTaskFile(row),
|
||||
type: 'primary'
|
||||
})
|
||||
}
|
||||
|
||||
if (row.fail_count > 0 && hasAuth('device_task:download_fail_data')) {
|
||||
actions.push({
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
:total="pagination.total"
|
||||
:marginTop="10"
|
||||
:actions="getActions"
|
||||
:actionsWidth="120"
|
||||
:actionsWidth="180"
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange"
|
||||
>
|
||||
@@ -237,6 +237,7 @@
|
||||
import { StorageService } from '@/api/modules/storage'
|
||||
import { generatePackageCode } from '@/utils/codeGenerator'
|
||||
import { RoutesAlias } from '@/router/routesAlias'
|
||||
import { CardCategory } from '@/types/api/card'
|
||||
import type { IotCardImportTask, IotCardImportTaskStatus } from '@/types/api/card'
|
||||
import type { Carrier } from '@/types/api'
|
||||
|
||||
@@ -253,7 +254,7 @@
|
||||
const uploading = ref(false)
|
||||
const importDialogVisible = ref(false)
|
||||
const selectedCarrierId = ref<number>()
|
||||
const selectedCardCategory = ref<'normal' | 'industry'>('normal') // 默认普通卡
|
||||
const selectedCardCategory = ref<CardCategory>(CardCategory.NORMAL) // 默认普通卡
|
||||
const carrierList = ref<Carrier[]>([])
|
||||
const carrierLoading = ref(false)
|
||||
const failDataDialogVisible = ref(false)
|
||||
@@ -697,7 +698,7 @@
|
||||
// 取消导入
|
||||
const handleCancelImport = () => {
|
||||
clearFiles()
|
||||
selectedCardCategory.value = 'normal'
|
||||
selectedCardCategory.value = CardCategory.NORMAL
|
||||
importForm.batch_no = ''
|
||||
importForm.realname_policy = ''
|
||||
importDialogVisible.value = false
|
||||
@@ -797,9 +798,34 @@
|
||||
}
|
||||
}
|
||||
|
||||
const downloadTaskFile = async (row: IotCardImportTask) => {
|
||||
const fileKey = row.file_name?.trim()
|
||||
if (!fileKey) {
|
||||
ElMessage.warning('当前任务没有可下载的原始文件')
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
await StorageService.downloadFileByKey(fileKey)
|
||||
ElMessage.success('原始文件下载已开始')
|
||||
} catch (error) {
|
||||
console.error('下载原始文件失败:', error)
|
||||
ElMessage.error('下载原始文件失败')
|
||||
}
|
||||
}
|
||||
|
||||
// 获取操作按钮
|
||||
const getActions = (row: IotCardImportTask) => {
|
||||
const actions: any[] = []
|
||||
const showDownloadFileAction = false
|
||||
|
||||
if (showDownloadFileAction && row.file_name?.trim() && hasAuth('iot_card_task:download_file')) {
|
||||
actions.push({
|
||||
label: '下载文件',
|
||||
handler: () => downloadTaskFile(row),
|
||||
type: 'primary'
|
||||
})
|
||||
}
|
||||
|
||||
if (row.fail_count > 0 && hasAuth('iot_card_task:download_fail_data')) {
|
||||
actions.push({
|
||||
|
||||
Reference in New Issue
Block a user