This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -76,7 +76,7 @@
|
||||
<ElFormItem label="已选设备数">
|
||||
<span style="font-weight: bold; color: #409eff">{{ selectedDevices.length }}</span> 台
|
||||
</ElFormItem>
|
||||
<ElFormItem label="目标店铺" prop="target_shop_id">
|
||||
<ElFormItem label="店铺" prop="target_shop_id">
|
||||
<ElTreeSelect
|
||||
v-model="allocateForm.target_shop_id"
|
||||
:data="shopTreeData"
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<ElCard shadow="never" style="margin-bottom: 16px">
|
||||
<template #header>
|
||||
<div class="card-header">
|
||||
<span>{{ $t('enterpriseDevices.title') }}</span>
|
||||
<span>企业设备列表</span>
|
||||
<ElButton @click="goBack">{{ $t('common.cancel') }}</ElButton>
|
||||
</div>
|
||||
</template>
|
||||
@@ -42,7 +42,7 @@
|
||||
@click="showAllocateDialog"
|
||||
v-permission="'enterprise_device:allocate'"
|
||||
>
|
||||
{{ $t('enterpriseDevices.buttons.allocateDevices') }}
|
||||
授权设备
|
||||
</ElButton>
|
||||
<ElButton
|
||||
type="warning"
|
||||
@@ -50,7 +50,7 @@
|
||||
@click="showRecallDialog"
|
||||
v-permission="'enterprise_device:recall'"
|
||||
>
|
||||
{{ $t('enterpriseDevices.buttons.recallDevices') }}
|
||||
撤销授权
|
||||
</ElButton>
|
||||
</template>
|
||||
</ArtTableHeader>
|
||||
@@ -78,7 +78,7 @@
|
||||
<!-- 授权设备对话框 -->
|
||||
<ElDialog
|
||||
v-model="allocateDialogVisible"
|
||||
:title="$t('enterpriseDevices.dialog.allocateTitle')"
|
||||
title="授权设备给企业"
|
||||
width="75%"
|
||||
@close="handleAllocateDialogClose"
|
||||
>
|
||||
@@ -137,19 +137,13 @@
|
||||
<!-- 撤销授权对话框 -->
|
||||
<ElDialog
|
||||
v-model="recallDialogVisible"
|
||||
:title="$t('enterpriseDevices.dialog.recallTitle')"
|
||||
title="撤销设备授权"
|
||||
width="600px"
|
||||
@close="handleRecallDialogClose"
|
||||
>
|
||||
<ElForm ref="recallFormRef" :model="recallForm" :rules="recallRules">
|
||||
<ElFormItem :label="$t('enterpriseDevices.form.selectedDevices')">
|
||||
<div>
|
||||
{{
|
||||
$t('enterpriseDevices.form.selectedCount', {
|
||||
count: selectedDevices.length
|
||||
})
|
||||
}}
|
||||
</div>
|
||||
<ElFormItem label="已选择设备">
|
||||
<div>已选择 {{ selectedDevices.length }} 个设备</div>
|
||||
</ElFormItem>
|
||||
</ElForm>
|
||||
<template #footer>
|
||||
@@ -165,14 +159,14 @@
|
||||
<!-- 结果对话框 -->
|
||||
<ElDialog
|
||||
v-model="resultDialogVisible"
|
||||
:title="$t('enterpriseDevices.dialog.resultTitle')"
|
||||
title="操作结果"
|
||||
width="700px"
|
||||
>
|
||||
<ElDescriptions :column="2" border>
|
||||
<ElDescriptionsItem :label="$t('enterpriseDevices.result.successCount')">
|
||||
<ElDescriptionsItem label="成功数量">
|
||||
<ElTag type="success">{{ operationResult.success_count }}</ElTag>
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem :label="$t('enterpriseDevices.result.failCount')">
|
||||
<ElDescriptionsItem label="失败数量">
|
||||
<ElTag type="danger">{{ operationResult.fail_count }}</ElTag>
|
||||
</ElDescriptionsItem>
|
||||
</ElDescriptions>
|
||||
@@ -182,16 +176,14 @@
|
||||
v-if="operationResult.failed_items && operationResult.failed_items.length > 0"
|
||||
style="margin-top: 20px"
|
||||
>
|
||||
<ElDivider content-position="left">{{
|
||||
$t('enterpriseDevices.result.failedItems')
|
||||
}}</ElDivider>
|
||||
<ElDivider content-position="left">失败项</ElDivider>
|
||||
<ElTable :data="operationResult.failed_items" border max-height="300">
|
||||
<ElTableColumn
|
||||
prop="virtual_no"
|
||||
:label="$t('enterpriseDevices.result.deviceNo')"
|
||||
label="设备号"
|
||||
width="180"
|
||||
/>
|
||||
<ElTableColumn prop="reason" :label="$t('enterpriseDevices.result.reason')" />
|
||||
<ElTableColumn prop="reason" label="失败原因" />
|
||||
</ElTable>
|
||||
</div>
|
||||
|
||||
@@ -202,21 +194,19 @@
|
||||
"
|
||||
style="margin-top: 20px"
|
||||
>
|
||||
<ElDivider content-position="left">{{
|
||||
$t('enterpriseDevices.result.authorizedDevices')
|
||||
}}</ElDivider>
|
||||
<ElDivider content-position="left">已授权设备</ElDivider>
|
||||
<ElTable :data="operationResult.authorized_devices" border max-height="200">
|
||||
<ElTableColumn
|
||||
prop="virtual_no"
|
||||
:label="$t('enterpriseDevices.result.deviceNo')"
|
||||
label="设备号"
|
||||
width="180"
|
||||
/>
|
||||
<ElTableColumn
|
||||
prop="device_id"
|
||||
:label="$t('enterpriseDevices.result.deviceId')"
|
||||
label="设备ID"
|
||||
width="100"
|
||||
/>
|
||||
<ElTableColumn :label="$t('enterpriseDevices.result.cardCount')">
|
||||
<ElTableColumn label="绑定卡数">
|
||||
<template #default="{ row }">
|
||||
{{ row.card_count || 0 }}
|
||||
</template>
|
||||
@@ -259,7 +249,7 @@
|
||||
|
||||
defineOptions({ name: 'EnterpriseDevices' })
|
||||
|
||||
const { t } = useI18n()
|
||||
const { t } = useI18n() // 仅保留用于 common.confirm, common.cancel
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
const loading = ref(false)
|
||||
@@ -326,12 +316,12 @@
|
||||
// 搜索表单配置
|
||||
const searchFormItems: SearchFormItem[] = [
|
||||
{
|
||||
label: t('enterpriseDevices.searchForm.deviceNo'),
|
||||
label: '设备号',
|
||||
prop: 'virtual_no',
|
||||
type: 'input',
|
||||
config: {
|
||||
clearable: true,
|
||||
placeholder: t('enterpriseDevices.searchForm.deviceNoPlaceholder')
|
||||
placeholder: '请输入设备号'
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -375,12 +365,12 @@
|
||||
|
||||
// 列配置
|
||||
const columnOptions = [
|
||||
{ label: t('enterpriseDevices.table.deviceId'), prop: 'device_id' },
|
||||
{ label: t('enterpriseDevices.table.deviceNo'), prop: 'virtual_no' },
|
||||
{ label: t('enterpriseDevices.table.deviceName'), prop: 'device_name' },
|
||||
{ label: t('enterpriseDevices.table.deviceModel'), prop: 'device_model' },
|
||||
{ label: t('enterpriseDevices.table.cardCount'), prop: 'card_count' },
|
||||
{ label: t('enterpriseDevices.table.authorizedAt'), prop: 'authorized_at' }
|
||||
{ label: '设备ID', prop: 'device_id' },
|
||||
{ label: '设备号', prop: 'virtual_no' },
|
||||
{ label: '设备名称', prop: 'device_name' },
|
||||
{ label: '设备型号', prop: 'device_model' },
|
||||
{ label: '绑定卡数量', prop: 'card_count' },
|
||||
{ label: '授权时间', prop: 'authorized_at' }
|
||||
]
|
||||
|
||||
const deviceList = ref<EnterpriseDeviceItem[]>([])
|
||||
@@ -421,32 +411,32 @@
|
||||
const { columnChecks, columns } = useCheckedColumns(() => [
|
||||
{
|
||||
prop: 'device_id',
|
||||
label: t('enterpriseDevices.table.deviceId'),
|
||||
label: '设备ID',
|
||||
width: 100
|
||||
},
|
||||
{
|
||||
prop: 'virtual_no',
|
||||
label: t('enterpriseDevices.table.deviceNo'),
|
||||
label: '设备号',
|
||||
minWidth: 150
|
||||
},
|
||||
{
|
||||
prop: 'device_name',
|
||||
label: t('enterpriseDevices.table.deviceName'),
|
||||
label: '设备名称',
|
||||
minWidth: 150
|
||||
},
|
||||
{
|
||||
prop: 'device_model',
|
||||
label: t('enterpriseDevices.table.deviceModel'),
|
||||
label: '设备型号',
|
||||
width: 120
|
||||
},
|
||||
{
|
||||
prop: 'card_count',
|
||||
label: t('enterpriseDevices.table.cardCount'),
|
||||
label: '绑定卡数量',
|
||||
width: 100
|
||||
},
|
||||
{
|
||||
prop: 'authorized_at',
|
||||
label: t('enterpriseDevices.table.authorizedAt'),
|
||||
label: '授权时间',
|
||||
width: 180,
|
||||
formatter: (row: EnterpriseDeviceItem) =>
|
||||
row.authorized_at ? formatDateTime(row.authorized_at) : '-'
|
||||
@@ -499,7 +489,7 @@
|
||||
getEnterpriseInfo()
|
||||
getTableData()
|
||||
} else {
|
||||
ElMessage.error(t('enterpriseDevices.messages.loadFailed'))
|
||||
ElMessage.error('加载设备列表失败')
|
||||
goBack()
|
||||
}
|
||||
})
|
||||
@@ -686,16 +676,13 @@
|
||||
|
||||
// 显示成功消息
|
||||
if (res.data.success_count > 0 && res.data.fail_count === 0) {
|
||||
ElMessage.success(t('enterpriseDevices.messages.allocateSuccess'))
|
||||
ElMessage.success('设备授权成功')
|
||||
} else if (res.data.success_count > 0 && res.data.fail_count > 0) {
|
||||
ElMessage.warning(
|
||||
t('enterpriseDevices.messages.allocatePartialSuccess', {
|
||||
success: res.data.success_count,
|
||||
fail: res.data.fail_count
|
||||
})
|
||||
`部分设备授权成功:成功 ${res.data.success_count} 个,失败 ${res.data.fail_count} 个`
|
||||
)
|
||||
} else {
|
||||
ElMessage.error(t('enterpriseDevices.messages.allocateFailed'))
|
||||
ElMessage.error('设备授权失败')
|
||||
}
|
||||
|
||||
getTableData()
|
||||
@@ -715,7 +702,7 @@
|
||||
// 显示撤销授权对话框
|
||||
const showRecallDialog = () => {
|
||||
if (selectedDevices.value.length === 0) {
|
||||
ElMessage.warning(t('enterpriseDevices.messages.noSelection'))
|
||||
ElMessage.warning('请先选择要撤销的设备')
|
||||
return
|
||||
}
|
||||
recallDialogVisible.value = true
|
||||
@@ -729,10 +716,8 @@
|
||||
if (!recallFormRef.value) return
|
||||
|
||||
ElMessageBox.confirm(
|
||||
t('enterpriseDevices.messages.recallConfirmText', {
|
||||
count: selectedDevices.value.length
|
||||
}),
|
||||
t('enterpriseDevices.messages.recallConfirm'),
|
||||
`确定要撤销选中的 ${selectedDevices.value.length} 个设备的授权吗?`,
|
||||
'撤销授权确认',
|
||||
{
|
||||
confirmButtonText: t('common.confirm'),
|
||||
cancelButtonText: t('common.cancel'),
|
||||
@@ -753,16 +738,13 @@
|
||||
|
||||
// 显示成功消息
|
||||
if (res.data.success_count > 0 && res.data.fail_count === 0) {
|
||||
ElMessage.success(t('enterpriseDevices.messages.recallSuccess'))
|
||||
ElMessage.success('撤销授权成功')
|
||||
} else if (res.data.success_count > 0 && res.data.fail_count > 0) {
|
||||
ElMessage.warning(
|
||||
t('enterpriseDevices.messages.recallPartialSuccess', {
|
||||
success: res.data.success_count,
|
||||
fail: res.data.fail_count
|
||||
})
|
||||
`部分设备撤销成功:成功 ${res.data.success_count} 个,失败 ${res.data.fail_count} 个`
|
||||
)
|
||||
} else {
|
||||
ElMessage.error(t('enterpriseDevices.messages.recallFailed'))
|
||||
ElMessage.error('撤销授权失败')
|
||||
}
|
||||
|
||||
// 清空选择
|
||||
@@ -774,7 +756,7 @@
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
ElMessage.error(t('enterpriseDevices.messages.recallFailed'))
|
||||
ElMessage.error('撤销授权失败')
|
||||
} finally {
|
||||
recallLoading.value = false
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@
|
||||
:rules="allocateRules"
|
||||
label-width="120px"
|
||||
>
|
||||
<ElFormItem label="目标店铺" prop="to_shop_id">
|
||||
<ElFormItem label="店铺" prop="to_shop_id">
|
||||
<ElSelect
|
||||
v-model="allocateForm.to_shop_id"
|
||||
placeholder="请选择或搜索目标店铺"
|
||||
@@ -669,6 +669,7 @@
|
||||
iccid: string
|
||||
msisdn: string
|
||||
virtual_no: string
|
||||
device_virtual_no: string
|
||||
is_distributed: undefined | number
|
||||
[key: string]: any
|
||||
} = {
|
||||
@@ -677,6 +678,7 @@
|
||||
iccid: '',
|
||||
msisdn: '',
|
||||
virtual_no: '',
|
||||
device_virtual_no: '',
|
||||
is_distributed: undefined
|
||||
}
|
||||
|
||||
@@ -827,12 +829,21 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
label: '虚拟号',
|
||||
label: '卡虚拟号',
|
||||
prop: 'virtual_no',
|
||||
type: 'input',
|
||||
config: {
|
||||
clearable: true,
|
||||
placeholder: '请输入虚拟号'
|
||||
placeholder: '请输入卡虚拟号'
|
||||
}
|
||||
},
|
||||
{
|
||||
label: '绑定设备虚拟号',
|
||||
prop: 'device_virtual_no',
|
||||
type: 'input',
|
||||
config: {
|
||||
clearable: true,
|
||||
placeholder: '请输入绑定设备虚拟号'
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -854,7 +865,8 @@
|
||||
const columnOptions = [
|
||||
{ label: 'ICCID', prop: 'iccid' },
|
||||
{ label: '卡接入号', prop: 'msisdn' },
|
||||
{ label: '虚拟号', prop: 'virtual_no' },
|
||||
{ label: '卡虚拟号', prop: 'virtual_no' },
|
||||
{ label: '绑定设备虚拟号', prop: 'device_virtual_no' },
|
||||
{ label: '卡业务类型', prop: 'card_category' },
|
||||
{ label: '运营商', prop: 'carrier_name' },
|
||||
{ label: '店铺名称', prop: 'shop_name' },
|
||||
@@ -987,9 +999,15 @@
|
||||
},
|
||||
{
|
||||
prop: 'virtual_no',
|
||||
label: '虚拟号',
|
||||
label: '卡虚拟号',
|
||||
width: 160,
|
||||
formatter: (row: StandaloneIotCard) => row.virtual_no
|
||||
formatter: (row: StandaloneIotCard) => row.virtual_no || '-'
|
||||
},
|
||||
{
|
||||
prop: 'device_virtual_no',
|
||||
label: '绑定设备虚拟号',
|
||||
width: 160,
|
||||
formatter: (row: StandaloneIotCard) => row.device_virtual_no || '-'
|
||||
},
|
||||
{
|
||||
prop: 'card_category',
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
</div>
|
||||
|
||||
<!-- 导入对话框 -->
|
||||
<ElDialog v-model="importDialogVisible" title="批量导入设备" width="700px" align-center>
|
||||
<ElDialog v-model="importDialogVisible" title="批量导入设备" width="40%" align-center>
|
||||
<ElAlert type="info" :closable="false" style="margin-bottom: 20px">
|
||||
<template #title>
|
||||
<div style="line-height: 1.8">
|
||||
@@ -62,7 +62,7 @@
|
||||
<p>3. 列格式请设置为文本格式,避免长数字被转为科学计数法</p>
|
||||
<p
|
||||
>4.
|
||||
必填列:virtual_no(设备号)、device_name(设备名称)、device_model(设备型号)、device_type(设备类型)、imei(设备IMEI号)</p
|
||||
必填列:virtual_no(虚拟号)、device_name(设备名称)、device_model(设备型号)、device_type(设备类型)、imei(设备IMEI号)</p
|
||||
>
|
||||
<p
|
||||
>5. 可选列:manufacturer(制造商)、max_sim_slots(最大插槽数,默认4)、iccid_1 ~
|
||||
|
||||
Reference in New Issue
Block a user