= {
- 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(() => {
{{ row.version || '-' }}
-
+
@@ -492,18 +512,18 @@ onUnmounted(() => {
-
+
@@ -512,7 +532,7 @@ onUnmounted(() => {
v-model="activationVisible"
v-model:page="activationState.page"
v-model:page-size="activationState.pageSize"
- :row="currentRow"
+ :row="currentRow || undefined"
:loading="activationState.loading"
:records="activationState.records"
:total="activationState.total"
@@ -523,7 +543,7 @@ onUnmounted(() => {
v-model="extractVisible"
v-model:page="extractState.page"
v-model:page-size="extractState.pageSize"
- :row="currentRow"
+ :row="currentRow || undefined"
:loading="extractState.loading"
:records="extractState.records"
:total="extractState.total"