feat(equipment-maintenance): 增加上下文设备解析
This commit is contained in:
1 parent
76d5778c3b
commit
2566ce53e4
21 files changed
+512
-62
No files matched your search
@@ -15,6 +15,9 @@ interface MaintenanceDeviceResultPayload {
|
||||
matched?: boolean;
|
||||
device?: MaintenanceDevice;
|
||||
records?: MaintenanceRecord[];
|
||||
summary?: {
|
||||
ledgerMatched?: boolean;
|
||||
};
|
||||
actions?: Array<{ id: string; label: string }>;
|
||||
}
|
||||
|
||||
@@ -32,6 +35,8 @@ const payload = computed<MaintenanceDeviceResultPayload | null>(() => {
|
||||
|
||||
const device = computed(() => payload.value?.device || null);
|
||||
const records = computed(() => payload.value?.records || []);
|
||||
const hasResult = computed(() => Boolean(device.value || records.value.length));
|
||||
const ledgerMatched = computed(() => payload.value?.summary?.ledgerMatched !== false);
|
||||
|
||||
const statusLabel = computed(() => {
|
||||
const status = device.value?.deviceStatus;
|
||||
@@ -67,15 +72,20 @@ const rows = computed(() => {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<section v-if="device" class="mt-3 rounded-xl border border-slate-300 bg-white p-3 text-sm text-slate-800 shadow-sm">
|
||||
<section v-if="hasResult" class="mt-3 rounded-xl border border-slate-300 bg-white p-3 text-sm text-slate-800 shadow-sm">
|
||||
<div class="flex items-center justify-between gap-3 rounded-t-lg border border-slate-200 bg-slate-50 px-3 py-2">
|
||||
<h3 class="font-semibold">{{ t('maintenance.chat.deviceLedgerInfo') }}</h3>
|
||||
<span class="rounded-full bg-emerald-50 px-2.5 py-0.5 text-xs font-semibold text-emerald-700">
|
||||
{{ t('maintenance.chat.matched') }}
|
||||
<h3 class="font-semibold">
|
||||
{{ device ? t('maintenance.chat.deviceLedgerInfo') : t('maintenance.chat.recordInfo') }}
|
||||
</h3>
|
||||
<span
|
||||
class="rounded-full px-2.5 py-0.5 text-xs font-semibold"
|
||||
:class="ledgerMatched ? 'bg-emerald-50 text-emerald-700' : 'bg-amber-50 text-amber-700'"
|
||||
>
|
||||
{{ ledgerMatched ? t('maintenance.chat.matched') : t('maintenance.chat.recordMatched') }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="overflow-hidden border-x border-b border-slate-200">
|
||||
<div v-if="device" class="overflow-hidden border-x border-b border-slate-200">
|
||||
<table class="w-full table-fixed text-sm">
|
||||
<tbody>
|
||||
<tr v-for="(row, rowIndex) in rows" :key="rowIndex" class="border-t border-slate-200 first:border-t-0">
|
||||
|
||||
Reference in new issue
Block a user