fetch(modify):账号管理
This commit is contained in:
@@ -1,189 +0,0 @@
|
||||
<template>
|
||||
<ArtTableFullScreen>
|
||||
<div class="allocation-record-detail-page" id="table-full-screen">
|
||||
<ElCard shadow="never" style="margin-bottom: 20px">
|
||||
<template #header>
|
||||
<div class="card-header">
|
||||
<span>分配记录详情</span>
|
||||
<ElButton @click="goBack">返回</ElButton>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<ElSkeleton :loading="loading" :rows="10" animated>
|
||||
<template #default>
|
||||
<ElDescriptions v-if="recordDetail" title="基本信息" :column="3" border>
|
||||
<ElDescriptionsItem label="分配单号">{{
|
||||
recordDetail.allocation_no
|
||||
}}</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="分配类型">
|
||||
<ElTag :type="getAllocationTypeType(recordDetail.allocation_type)">
|
||||
{{ recordDetail.allocation_name }}
|
||||
</ElTag>
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="资产类型">
|
||||
<ElTag :type="getAssetTypeType(recordDetail.asset_type)">
|
||||
{{ recordDetail.asset_type_name }}
|
||||
</ElTag>
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="资产标识符">{{
|
||||
recordDetail.asset_identifier
|
||||
}}</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="关联卡数量">{{
|
||||
recordDetail.related_card_count
|
||||
}}</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="关联设备ID">
|
||||
{{ recordDetail.related_device_id || '-' }}
|
||||
</ElDescriptionsItem>
|
||||
</ElDescriptions>
|
||||
|
||||
<ElDescriptions
|
||||
v-if="recordDetail"
|
||||
title="所有者信息"
|
||||
:column="2"
|
||||
border
|
||||
style="margin-top: 20px"
|
||||
>
|
||||
<ElDescriptionsItem label="来源所有者">
|
||||
{{ recordDetail.from_owner_name }} ({{ recordDetail.from_owner_type }})
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="目标所有者">
|
||||
{{ recordDetail.to_owner_name }} ({{ recordDetail.to_owner_type }})
|
||||
</ElDescriptionsItem>
|
||||
</ElDescriptions>
|
||||
|
||||
<ElDescriptions
|
||||
v-if="recordDetail"
|
||||
title="操作信息"
|
||||
:column="2"
|
||||
border
|
||||
style="margin-top: 20px"
|
||||
>
|
||||
<ElDescriptionsItem label="操作人">{{
|
||||
recordDetail.operator_name
|
||||
}}</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="创建时间">
|
||||
{{ formatDateTime(recordDetail.created_at) }}
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="备注" :span="2">
|
||||
{{ recordDetail.remark || '-' }}
|
||||
</ElDescriptionsItem>
|
||||
</ElDescriptions>
|
||||
|
||||
<!-- 关联卡列表 -->
|
||||
<div
|
||||
v-if="
|
||||
recordDetail &&
|
||||
recordDetail.related_card_ids &&
|
||||
recordDetail.related_card_ids.length > 0
|
||||
"
|
||||
style="margin-top: 20px"
|
||||
>
|
||||
<ElDivider content-position="left">关联卡列表</ElDivider>
|
||||
<ElTable :data="relatedCardsList" border>
|
||||
<ElTableColumn type="index" label="序号" width="60" />
|
||||
<ElTableColumn prop="card_id" label="卡ID" width="80" />
|
||||
<ElTableColumn label="ICCID" width="180">
|
||||
<template #default="scope">
|
||||
{{ getCardInfo(scope.row.card_id, 'iccid') }}
|
||||
</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn label="状态" width="100">
|
||||
<template #default="scope">
|
||||
{{ getCardInfo(scope.row.card_id, 'status') }}
|
||||
</template>
|
||||
</ElTableColumn>
|
||||
</ElTable>
|
||||
</div>
|
||||
</template>
|
||||
</ElSkeleton>
|
||||
</ElCard>
|
||||
</div>
|
||||
</ArtTableFullScreen>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useRouter, useRoute } from 'vue-router'
|
||||
import { CardService } from '@/api/modules'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { formatDateTime } from '@/utils/business/format'
|
||||
import type {
|
||||
AssetAllocationRecordDetail,
|
||||
AllocationTypeEnum,
|
||||
AssetTypeEnum
|
||||
} from '@/types/api/card'
|
||||
|
||||
defineOptions({ name: 'AllocationRecordDetail' })
|
||||
|
||||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
const loading = ref(false)
|
||||
const recordDetail = ref<AssetAllocationRecordDetail | null>(null)
|
||||
const relatedCardsList = ref<{ card_id: number }[]>([])
|
||||
|
||||
// 获取分配类型标签类型
|
||||
const getAllocationTypeType = (type: AllocationTypeEnum) => {
|
||||
return type === 'allocate' ? 'success' : 'warning'
|
||||
}
|
||||
|
||||
// 获取资产类型标签类型
|
||||
const getAssetTypeType = (type: AssetTypeEnum) => {
|
||||
return type === 'iot_card' ? 'primary' : 'info'
|
||||
}
|
||||
|
||||
// 模拟获取卡信息的方法(实际应该调用API获取)
|
||||
const getCardInfo = (cardId: number, field: 'iccid' | 'status') => {
|
||||
if (field === 'iccid') {
|
||||
return `ICCID-${cardId}`
|
||||
} else {
|
||||
return '在库'
|
||||
}
|
||||
}
|
||||
|
||||
// 获取详情数据
|
||||
const getDetailData = async () => {
|
||||
const id = route.query.id as string
|
||||
if (!id) {
|
||||
ElMessage.error('缺少记录ID参数')
|
||||
goBack()
|
||||
return
|
||||
}
|
||||
|
||||
loading.value = true
|
||||
try {
|
||||
const res = await CardService.getAssetAllocationRecordDetail(Number(id))
|
||||
if (res.code === 0) {
|
||||
recordDetail.value = res.data
|
||||
// 构建关联卡列表
|
||||
if (recordDetail.value.related_card_ids && recordDetail.value.related_card_ids.length > 0) {
|
||||
relatedCardsList.value = recordDetail.value.related_card_ids.map((cardId) => ({
|
||||
card_id: cardId
|
||||
}))
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
ElMessage.error('获取分配记录详情失败')
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// 返回列表
|
||||
const goBack = () => {
|
||||
router.back()
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getDetailData()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.allocation-record-detail-page {
|
||||
.card-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -40,6 +40,35 @@
|
||||
</ElTableColumn>
|
||||
</template>
|
||||
</ArtTable>
|
||||
|
||||
<!-- 分配详情对话框 -->
|
||||
<ElDialog v-model="detailDialogVisible" title="分配详情" width="700px">
|
||||
<ElDescriptions v-if="currentRecord" :column="2" border>
|
||||
<ElDescriptionsItem label="分配单号" :span="2">{{ currentRecord.allocation_no }}</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="分配类型">
|
||||
<ElTag :type="getAllocationTypeType(currentRecord.allocation_type)">
|
||||
{{ currentRecord.allocation_name }}
|
||||
</ElTag>
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="资产类型">
|
||||
<ElTag :type="getAssetTypeType(currentRecord.asset_type)">
|
||||
{{ currentRecord.asset_type_name }}
|
||||
</ElTag>
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="资产标识符" :span="2">{{ currentRecord.asset_identifier }}</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="来源所有者">{{ currentRecord.from_owner_name }}</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="目标所有者">{{ currentRecord.to_owner_name }}</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="操作人">{{ currentRecord.operator_name }}</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="关联卡数量">{{ currentRecord.related_card_count }}</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="创建时间" :span="2">{{ formatDateTime(currentRecord.created_at) }}</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="备注" :span="2">{{ currentRecord.remark || '--' }}</ElDescriptionsItem>
|
||||
</ElDescriptions>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<ElButton type="primary" @click="detailDialogVisible = false">关闭</ElButton>
|
||||
</div>
|
||||
</template>
|
||||
</ElDialog>
|
||||
</ElCard>
|
||||
</div>
|
||||
</ArtTableFullScreen>
|
||||
@@ -59,7 +88,9 @@
|
||||
|
||||
const router = useRouter()
|
||||
const loading = ref(false)
|
||||
const detailDialogVisible = ref(false)
|
||||
const tableRef = ref()
|
||||
const currentRecord = ref<AssetAllocationRecord | null>(null)
|
||||
|
||||
// 搜索表单初始值
|
||||
const initialSearchState = {
|
||||
@@ -199,7 +230,7 @@
|
||||
{
|
||||
prop: 'asset_identifier',
|
||||
label: '资产标识符',
|
||||
minWidth: 180
|
||||
minWidth: 200
|
||||
},
|
||||
{
|
||||
prop: 'from_owner_name',
|
||||
@@ -265,7 +296,7 @@
|
||||
|
||||
const res = await CardService.getAssetAllocationRecords(params)
|
||||
if (res.code === 0) {
|
||||
recordList.value = res.data.list || []
|
||||
recordList.value = res.data.items || []
|
||||
pagination.total = res.data.total || 0
|
||||
}
|
||||
} catch (error) {
|
||||
@@ -307,10 +338,8 @@
|
||||
|
||||
// 查看详情
|
||||
const viewDetail = (row: AssetAllocationRecord) => {
|
||||
router.push({
|
||||
path: '/asset-management/allocation-record-detail',
|
||||
query: { id: row.id }
|
||||
})
|
||||
currentRecord.value = row
|
||||
detailDialogVisible.value = true
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -1,118 +0,0 @@
|
||||
<template>
|
||||
<div class="authorization-detail-page">
|
||||
<ElCard shadow="never" v-loading="loading">
|
||||
<template #header>
|
||||
<div class="card-header">
|
||||
<span>授权记录详情</span>
|
||||
<ElButton @click="goBack">返回</ElButton>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<ElDescriptions v-if="authorizationDetail" :column="2" border>
|
||||
<ElDescriptionsItem label="授权记录ID">{{ authorizationDetail.id }}</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="状态">
|
||||
<ElTag :type="authorizationDetail.status === 1 ? 'success' : 'info'">
|
||||
{{ authorizationDetail.status === 1 ? '有效' : '已回收' }}
|
||||
</ElTag>
|
||||
</ElDescriptionsItem>
|
||||
|
||||
<ElDescriptionsItem label="ICCID">{{ authorizationDetail.iccid }}</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="手机号">{{ authorizationDetail.msisdn }}</ElDescriptionsItem>
|
||||
|
||||
<ElDescriptionsItem label="企业名称">
|
||||
{{ authorizationDetail.enterprise_name }}
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="企业ID">
|
||||
{{ authorizationDetail.enterprise_id }}
|
||||
</ElDescriptionsItem>
|
||||
|
||||
<ElDescriptionsItem label="授权人">
|
||||
{{ authorizationDetail.authorizer_name }}
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="授权人类型">
|
||||
<ElTag :type="authorizationDetail.authorizer_type === 2 ? 'primary' : 'success'">
|
||||
{{ authorizationDetail.authorizer_type === 2 ? '平台' : '代理' }}
|
||||
</ElTag>
|
||||
</ElDescriptionsItem>
|
||||
|
||||
<ElDescriptionsItem label="授权时间">
|
||||
{{ formatDateTime(authorizationDetail.authorized_at) }}
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="授权人ID">
|
||||
{{ authorizationDetail.authorized_by }}
|
||||
</ElDescriptionsItem>
|
||||
|
||||
<ElDescriptionsItem label="回收人">
|
||||
{{ authorizationDetail.revoker_name || '-' }}
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="回收时间">
|
||||
{{
|
||||
authorizationDetail.revoked_at ? formatDateTime(authorizationDetail.revoked_at) : '-'
|
||||
}}
|
||||
</ElDescriptionsItem>
|
||||
|
||||
<ElDescriptionsItem label="备注" :span="2">
|
||||
{{ authorizationDetail.remark || '-' }}
|
||||
</ElDescriptionsItem>
|
||||
</ElDescriptions>
|
||||
</ElCard>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import { AuthorizationService } from '@/api/modules'
|
||||
import { ElMessage, ElTag } from 'element-plus'
|
||||
import { formatDateTime } from '@/utils/business/format'
|
||||
import type { AuthorizationItem } from '@/types/api/authorization'
|
||||
|
||||
defineOptions({ name: 'AuthorizationDetail' })
|
||||
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
const loading = ref(false)
|
||||
const authorizationDetail = ref<AuthorizationItem | null>(null)
|
||||
|
||||
onMounted(() => {
|
||||
const id = route.query.id
|
||||
if (id) {
|
||||
getAuthorizationDetail(Number(id))
|
||||
} else {
|
||||
ElMessage.error('缺少授权记录ID')
|
||||
goBack()
|
||||
}
|
||||
})
|
||||
|
||||
// 获取授权记录详情
|
||||
const getAuthorizationDetail = async (id: number) => {
|
||||
loading.value = true
|
||||
try {
|
||||
const res = await AuthorizationService.getAuthorizationDetail(id)
|
||||
if (res.code === 0) {
|
||||
authorizationDetail.value = res.data
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
ElMessage.error('获取授权记录详情失败')
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// 返回
|
||||
const goBack = () => {
|
||||
router.back()
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.authorization-detail-page {
|
||||
padding: 20px;
|
||||
|
||||
.card-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -36,6 +36,36 @@
|
||||
</template>
|
||||
</ArtTable>
|
||||
|
||||
<!-- 授权详情对话框 -->
|
||||
<ElDialog v-model="detailDialogVisible" title="授权详情" width="700px">
|
||||
<ElDescriptions v-if="currentRecord" :column="2" border>
|
||||
<ElDescriptionsItem label="企业ID">{{ currentRecord.enterprise_id }}</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="企业名称">{{ currentRecord.enterprise_name }}</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="卡ID">{{ currentRecord.card_id }}</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="ICCID">{{ currentRecord.iccid }}</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="手机号">{{ currentRecord.msisdn || '--' }}</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="授权人ID">{{ currentRecord.authorized_by }}</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="授权人">{{ currentRecord.authorizer_name }}</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="授权人类型">
|
||||
<ElTag :type="getAuthorizerTypeTag(currentRecord.authorizer_type)">
|
||||
{{ getAuthorizerTypeText(currentRecord.authorizer_type) }}
|
||||
</ElTag>
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="授权时间" :span="2">{{ formatDateTime(currentRecord.authorized_at) }}</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="状态" :span="2">
|
||||
<ElTag :type="getStatusTag(currentRecord.status)">
|
||||
{{ getStatusText(currentRecord.status) }}
|
||||
</ElTag>
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="备注" :span="2">{{ currentRecord.remark || '--' }}</ElDescriptionsItem>
|
||||
</ElDescriptions>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<ElButton type="primary" @click="detailDialogVisible = false">关闭</ElButton>
|
||||
</div>
|
||||
</template>
|
||||
</ElDialog>
|
||||
|
||||
<!-- 修改备注对话框 -->
|
||||
<ElDialog v-model="remarkDialogVisible" title="修改备注" width="500px">
|
||||
<ElForm ref="remarkFormRef" :model="remarkForm" :rules="remarkRules" label-width="80px">
|
||||
@@ -85,11 +115,13 @@
|
||||
|
||||
const router = useRouter()
|
||||
const loading = ref(false)
|
||||
const detailDialogVisible = ref(false)
|
||||
const remarkDialogVisible = ref(false)
|
||||
const remarkLoading = ref(false)
|
||||
const tableRef = ref()
|
||||
const remarkFormRef = ref<FormInstance>()
|
||||
const currentRecordId = ref<number>(0)
|
||||
const currentRecord = ref<AuthorizationItem | null>(null)
|
||||
|
||||
// 搜索表单初始值
|
||||
const initialSearchState = {
|
||||
@@ -172,7 +204,6 @@
|
||||
|
||||
// 列配置
|
||||
const columnOptions = [
|
||||
{ label: 'ID', prop: 'id' },
|
||||
{ label: 'ICCID', prop: 'iccid' },
|
||||
{ label: '手机号', prop: 'msisdn' },
|
||||
{ label: '企业名称', prop: 'enterprise_name' },
|
||||
@@ -180,8 +211,6 @@
|
||||
{ label: '授权人类型', prop: 'authorizer_type' },
|
||||
{ label: '授权时间', prop: 'authorized_at' },
|
||||
{ label: '状态', prop: 'status' },
|
||||
{ label: '回收人', prop: 'revoker_name' },
|
||||
{ label: '回收时间', prop: 'revoked_at' },
|
||||
{ label: '备注', prop: 'remark' },
|
||||
{ label: '操作', prop: 'operation' }
|
||||
]
|
||||
@@ -210,20 +239,16 @@
|
||||
|
||||
// 动态列配置
|
||||
const { columnChecks, columns } = useCheckedColumns(() => [
|
||||
{
|
||||
prop: 'id',
|
||||
label: 'ID',
|
||||
width: 80
|
||||
},
|
||||
{
|
||||
prop: 'iccid',
|
||||
label: 'ICCID',
|
||||
minWidth: 180
|
||||
minWidth: 200
|
||||
},
|
||||
{
|
||||
prop: 'msisdn',
|
||||
label: '手机号',
|
||||
width: 120
|
||||
width: 130,
|
||||
formatter: (row: AuthorizationItem) => row.msisdn || '-'
|
||||
},
|
||||
{
|
||||
prop: 'enterprise_name',
|
||||
@@ -238,7 +263,7 @@
|
||||
{
|
||||
prop: 'authorizer_type',
|
||||
label: '授权人类型',
|
||||
width: 100,
|
||||
width: 110,
|
||||
formatter: (row: AuthorizationItem) => {
|
||||
return h(ElTag, { type: getAuthorizerTypeTag(row.authorizer_type) }, () =>
|
||||
getAuthorizerTypeText(row.authorizer_type)
|
||||
@@ -259,18 +284,6 @@
|
||||
return h(ElTag, { type: getStatusTag(row.status) }, () => getStatusText(row.status))
|
||||
}
|
||||
},
|
||||
{
|
||||
prop: 'revoker_name',
|
||||
label: '回收人',
|
||||
width: 120,
|
||||
formatter: (row: AuthorizationItem) => row.revoker_name || '-'
|
||||
},
|
||||
{
|
||||
prop: 'revoked_at',
|
||||
label: '回收时间',
|
||||
width: 180,
|
||||
formatter: (row: AuthorizationItem) => (row.revoked_at ? formatDateTime(row.revoked_at) : '-')
|
||||
},
|
||||
{
|
||||
prop: 'remark',
|
||||
label: '备注',
|
||||
@@ -286,7 +299,7 @@
|
||||
formatter: (row: AuthorizationItem) => {
|
||||
return h('div', { style: 'display: flex; gap: 8px;' }, [
|
||||
h(ArtButtonTable, {
|
||||
type: 'view',
|
||||
text: '详情',
|
||||
onClick: () => viewDetail(row)
|
||||
}),
|
||||
h(ArtButtonTable, {
|
||||
@@ -371,10 +384,8 @@
|
||||
|
||||
// 查看详情
|
||||
const viewDetail = (row: AuthorizationItem) => {
|
||||
router.push({
|
||||
path: '/asset-management/authorization-detail',
|
||||
query: { id: row.id }
|
||||
})
|
||||
currentRecord.value = row
|
||||
detailDialogVisible.value = true
|
||||
}
|
||||
|
||||
// 显示修改备注对话框
|
||||
|
||||
@@ -284,7 +284,7 @@
|
||||
>
|
||||
<ElDivider content-position="left">失败项详情</ElDivider>
|
||||
<ElTable :data="allocationResult.failed_items" border max-height="300">
|
||||
<ElTableColumn prop="iccid" label="ICCID" width="180" />
|
||||
<ElTableColumn prop="iccid" label="ICCID" width="200" />
|
||||
<ElTableColumn prop="reason" label="失败原因" />
|
||||
</ElTable>
|
||||
</div>
|
||||
@@ -362,7 +362,7 @@
|
||||
>
|
||||
<ElDivider content-position="left">失败项详情</ElDivider>
|
||||
<ElTable :data="seriesBindingResult.failed_items" border max-height="300">
|
||||
<ElTableColumn prop="iccid" label="ICCID" width="180" />
|
||||
<ElTableColumn prop="iccid" label="ICCID" width="200" />
|
||||
<ElTableColumn prop="reason" label="失败原因" />
|
||||
</ElTable>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user