From 0a95690a124c7a1ce71c3102ff7caf630b1d47da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=89=AB=E5=9C=B0=E5=83=A7?= <357099073@qq.com> Date: Tue, 16 Jun 2026 00:39:26 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=BE=E5=A4=87=E7=AE=A1=E7=90=86=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/cursor/activationcode/index.vue | 10 ++- .../components/activationRecords.vue | 47 +++++++++++-- .../cursor/equipment/components/detail.vue | 8 +-- .../equipment/components/extractRecords.vue | 65 +++++++++++++----- src/views/cursor/equipment/index.vue | 68 ++++++++++++------- 5 files changed, 140 insertions(+), 58 deletions(-) diff --git a/src/views/cursor/activationcode/index.vue b/src/views/cursor/activationcode/index.vue index d0ee8b0..94e7162 100644 --- a/src/views/cursor/activationcode/index.vue +++ b/src/views/cursor/activationcode/index.vue @@ -573,10 +573,7 @@ onUnmounted(() => { @@ -598,7 +595,7 @@ onUnmounted(() => {
设备:{{ row.machineCode || row.bindDeviceId || '-' }}
- + @@ -609,9 +606,10 @@ onUnmounted(() => { - + - - - - + + + + + + + - - + + + + + + + + + + + + @@ -110,8 +141,8 @@ function statusType(status: unknown) { background layout="total, prev, pager, next, jumper" :total="total" - @update:current-page="(v) => emit('update:page', v)" - @update:page-size="(v) => emit('update:pageSize', v)" + @update:current-page="(v: number) => emit('update:page', v)" + @update:page-size="(v: number) => emit('update:pageSize', v)" /> diff --git a/src/views/cursor/equipment/index.vue b/src/views/cursor/equipment/index.vue index 08937ae..8d201f0 100644 --- a/src/views/cursor/equipment/index.vue +++ b/src/views/cursor/equipment/index.vue @@ -15,7 +15,7 @@ import { getCursorEquipmentExtractRecords, getCursorEquipmentList, updateCursorEquipment, -} from '@/api/cursorEquipment'; +} from '../../../api/cursorEquipment'; type EquipmentRow = Record; @@ -60,10 +60,10 @@ const extractState = reactive({ }); const statusOptions = [ - { label: '未激活', value: 'inactive' }, - { label: '正常', value: 'active' }, - { label: '禁用', value: 'disabled' }, - { label: '已过期', value: 'expired' }, + { label: '未激活', value: 0 }, + { label: '已激活', value: 1 }, + { label: '禁用', value: 3 }, + { label: '已过期', value: 2 }, ]; const osOptions = [ @@ -74,7 +74,7 @@ const osOptions = [ ]; const statusMap: Record = { - active: { label: '正常', type: 'success' }, + active: { label: '已激活', type: 'success' }, inactive: { label: '未激活', type: 'info' }, disabled: { label: '禁用', type: 'danger' }, expired: { label: '已过期', type: 'warning' }, @@ -87,7 +87,7 @@ const summary = computed(() => { const expired = tableData.value.filter((item) => item.status === 'expired').length; return [ { label: '当前页设备', value: tableData.value.length, type: 'primary' }, - { label: '正常设备', value: active, type: 'success' }, + { label: '已激活设备', value: active, type: 'success' }, { label: '未激活', value: inactive, type: 'info' }, { label: '禁用/过期', value: disabled + expired, type: 'danger' }, ]; @@ -137,24 +137,35 @@ function formatTime(value: any) { return `${d.getFullYear()}-${p(d.getMonth() + 1)}-${p(d.getDate())} ${p(d.getHours())}:${p(d.getMinutes())}:${p(d.getSeconds())}`; } +function normalizeEquipmentStatus(status: any) { + const value = String(status ?? '').trim(); + + if (value === '0' || value === 'inactive') return 'inactive'; + if (value === '1' || value === 'active' || value === 'normal') return 'active'; + if (value === '2' || value === 'expired') return 'expired'; + if (value === '3' || value === 'disabled' || value === 'disable') return 'disabled'; + + return value || 'inactive'; +} + function normalizeRow(raw: any): EquipmentRow { - const status = String(pick(raw, 'status', 'Status') || 'inactive'); + const status = normalizeEquipmentStatus(pick(raw, 'status', 'Status')); return { id: pick(raw, 'id', 'ID', 'Id'), name: pick(raw, 'name', 'device_name', 'deviceName', 'Name', 'DeviceName'), deviceNo: pick(raw, 'device_no', 'deviceNo', 'DeviceNo', 'serial_no', 'serialNo'), machineCode: pick(raw, 'machine_code', 'machineCode', 'MachineCode', 'fingerprint'), - licenseCode: pick(raw, 'license_code', 'licenseCode', 'LicenseCode'), - os: pick(raw, 'os', 'OS', 'platform', 'Platform'), + licenseCode: pick(raw, 'bindActivationCode', 'activationCode', 'activation_code', 'code', 'Code', 'license_code', 'licenseCode', 'LicenseCode'), + os: pick(raw, 'system', 'System', 'os', 'OS', 'platform', 'Platform'), version: pick(raw, 'version', 'Version', 'client_version', 'clientVersion'), - account: pick(raw, 'account', 'Account', 'email', 'Email'), + account: pick(raw, 'bindActivationCode', 'activationCode', 'activation_code', 'code', 'Code', 'license_code', 'licenseCode', 'LicenseCode'), owner: pick(raw, 'owner', 'Owner', 'user_name', 'userName', 'tenant_name', 'tenantName'), status, activationCount: Number(pick(raw, 'activation_count', 'activationCount', 'ActivationCount') || 0), extractCount: Number(pick(raw, 'extract_count', 'extractCount', 'ExtractCount') || 0), - lastActivatedAt: formatTime(pick(raw, 'last_activated_at', 'lastActivatedAt', 'activated_at')), + lastActivatedAt: formatTime(pick(raw, 'lastActivatedAt', 'last_activated_at', 'activationTime', 'activation_time', 'activated_at', 'activatedAt')), lastExtractedAt: formatTime(pick(raw, 'last_extracted_at', 'lastExtractedAt', 'extracted_at')), - expiredAt: formatTime(pick(raw, 'expired_at', 'expiredAt', 'expire_time', 'expireTime')), + expiredAt: formatTime(pick(raw, 'expiredAt', 'expired_at', 'expireTime', 'expire_time')), createdAt: formatTime(pick(raw, 'create_time', 'created_at', 'createdAt', 'CreatedAt')), remark: pick(raw, 'remark', 'Remark'), raw, @@ -164,14 +175,23 @@ function normalizeRow(raw: any): EquipmentRow { function normalizeRecord(raw: any): EquipmentRow { return { id: pick(raw, 'id', 'ID', 'Id'), - status: pick(raw, 'status', 'Status', 'result', 'Result'), + status: pick(raw, 'status', 'Status', 'result', 'Result', 'isExtracted', 'is_extracted'), + activationCode: pick(raw, 'activationCode', 'activation_code', 'code', 'Code'), + durationDays: pick(raw, 'durationDays', 'duration_days'), + machineCode: pick(raw, 'machineCode', 'machine_code', 'MachineCode'), + deviceInfo: pick(raw, 'deviceInfo', 'device_info', 'DeviceInfo'), + expiredAt: formatTime(pick(raw, 'expiredAt', 'expired_at', 'expireTime', 'expire_time')), + activatedAt: formatTime(pick(raw, 'activatedAt', 'activated_at', 'activationTime', 'activation_time')), account: pick(raw, 'account', 'Account', 'email', 'Email'), - platform: pick(raw, 'platform', 'Platform', 'source', 'Source'), + password: pick(raw, 'password', 'Password'), + token: pick(raw, 'token', 'Token'), + platform: pick(raw, 'platform', 'Platform', 'source', 'Source', 'extractedPlatform', 'extracted_platform'), type: pick(raw, 'type', 'Type', 'data_type', 'dataType'), - content: pick(raw, 'content', 'Content', 'extract_content', 'extractContent', 'token', 'Token'), + content: pick(raw, 'content', 'Content', 'extract_content', 'extractContent'), ip: pick(raw, 'ip', 'IP', 'client_ip', 'clientIp'), clientVersion: pick(raw, 'client_version', 'clientVersion', 'version', 'Version'), createdAt: formatTime(pick(raw, 'create_time', 'created_at', 'createdAt', 'CreatedAt')), + extractedAt: formatTime(pick(raw, 'extractedAt', 'extracted_at', 'extracted_time')), remark: pick(raw, 'remark', 'Remark', 'message', 'Message'), raw, }; @@ -202,7 +222,7 @@ async function fetchList() { page: pagination.page, pageSize: pagination.pageSize, keyword: query.keyword || undefined, - status: query.status || undefined, + status: query.status === '' ? undefined : query.status, os: query.os || undefined, }); if (res?.code !== 200) { @@ -401,7 +421,7 @@ onUnmounted(() => {
@@ -450,7 +470,7 @@ onUnmounted(() => { - +