Merge branch 'dev' into hugo-shipping-notice
# Conflicts: # backend/app/api/chat.py # backend/app/services/agent_runtime_context/dify_inputs.py # backend/app/services/maintenance_chat_service.py
This commit is contained in:
commit
fc694a8f43
55 files changed
+2107
-192
No files matched your search
@@ -30,7 +30,7 @@ const titleText = computed(() => props.assetId || props.assetName || '资产履
|
||||
<template>
|
||||
<div
|
||||
v-if="open"
|
||||
class="dialog-overlay z-[120] items-center"
|
||||
class="dialog-overlay z-[150] items-center"
|
||||
@click.self="emit('close')"
|
||||
>
|
||||
<div class="dialog-panel flex max-h-[88vh] w-[min(96vw,900px)] max-w-[900px] flex-col">
|
||||
|
||||
@@ -41,6 +41,7 @@ const props = defineProps<{
|
||||
canSendMessage: boolean;
|
||||
isShippingNoticeAgent: boolean;
|
||||
isMaintenanceAgent?: boolean;
|
||||
canManageMaintenance?: boolean;
|
||||
shippingSuggestedPrompt: string;
|
||||
shippingFocusTaskNo?: string;
|
||||
shippingFocusReason?: string;
|
||||
@@ -202,7 +203,7 @@ watch(
|
||||
ref="textareaRef"
|
||||
v-model="inputValue"
|
||||
rows="1"
|
||||
:placeholder="isVoiceTranscribing ? $t('chat.voiceTranscribing') : isVoiceRecording ? $t('chat.voiceListening') : shippingFocusTaskNo ? $t('chat.shippingNoticeUi.focusInputPlaceholder', { taskId: shippingFocusTaskNo }) : $t('chat.askAnything')"
|
||||
:placeholder="isVoiceTranscribing ? $t('chat.voiceTranscribing') : isVoiceRecording ? $t('chat.voiceListening') : shippingFocusTaskNo ? $t('chat.shippingNoticeUi.focusInputPlaceholder', { taskId: shippingFocusTaskNo }) : isMaintenanceAgent ? $t('maintenance.chat.inputPlaceholder') : $t('chat.askAnything')"
|
||||
class="w-full resize-none border-none bg-transparent px-2.5 py-1.5 text-[15px] leading-relaxed text-primary placeholder-slate-400 focus:border-transparent focus:outline-none focus:ring-0"
|
||||
style="min-height: 40px; max-height: 220px;"
|
||||
:disabled="isVoiceTranscribing"
|
||||
@@ -259,7 +260,7 @@ watch(
|
||||
</div>
|
||||
|
||||
<div
|
||||
v-if="isMaintenanceAgent"
|
||||
v-if="isMaintenanceAgent && canManageMaintenance"
|
||||
class="flex flex-wrap items-center gap-2 px-3 pb-1 text-xs text-muted"
|
||||
>
|
||||
<button
|
||||
|
||||
@@ -19,6 +19,7 @@ const emit = defineEmits<{
|
||||
close: [];
|
||||
'change-page': [delta: number];
|
||||
'open-asset-history': [payload: { assetId: string; assetName: string }];
|
||||
'open-asset-image': [payload: { assetId: string; assetName: string }];
|
||||
}>();
|
||||
|
||||
const totalPages = computed(() =>
|
||||
@@ -26,19 +27,34 @@ const totalPages = computed(() =>
|
||||
);
|
||||
const assetIdColumnIndex = computed(() => props.state.columns.findIndex((column) => column === '资产编号'));
|
||||
const assetNameColumnIndex = computed(() => props.state.columns.findIndex((column) => column === '资产名称'));
|
||||
const imageColumnIndex = computed(() => props.state.columns.findIndex((column) => column === '图片'));
|
||||
|
||||
function isHighlightColumn(column: string): boolean {
|
||||
return column === '资产编号' || column === '图片';
|
||||
}
|
||||
|
||||
function normalizeCellText(cell: unknown): string {
|
||||
return String(cell ?? '').trim();
|
||||
}
|
||||
|
||||
function canOpenAssetHistory(row: unknown[], cellIndex: number): boolean {
|
||||
return cellIndex === assetIdColumnIndex.value && !!normalizeCellText(row[cellIndex]);
|
||||
if (cellIndex === assetIdColumnIndex.value) {
|
||||
return !!normalizeCellText(row[cellIndex]);
|
||||
}
|
||||
if (cellIndex === imageColumnIndex.value) {
|
||||
return !!normalizeCellText(row[assetIdColumnIndex.value]);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function emitAssetHistory(row: unknown[]): void {
|
||||
function emitAssetAction(row: unknown[], cellIndex: number): void {
|
||||
const assetId = normalizeCellText(row[assetIdColumnIndex.value]);
|
||||
const assetName = assetNameColumnIndex.value >= 0 ? normalizeCellText(row[assetNameColumnIndex.value]) : '';
|
||||
if (!assetId) return;
|
||||
if (cellIndex === imageColumnIndex.value) {
|
||||
emit('open-asset-image', { assetId, assetName });
|
||||
return;
|
||||
}
|
||||
emit('open-asset-history', { assetId, assetName });
|
||||
}
|
||||
</script>
|
||||
@@ -97,7 +113,10 @@ function emitAssetHistory(row: unknown[]): void {
|
||||
<th
|
||||
v-for="column in state.columns"
|
||||
:key="`query-preview-col-${column}`"
|
||||
class="border border-slate-200 px-3 py-2 text-left font-semibold text-primary"
|
||||
:class="[
|
||||
'border border-slate-200 px-3 py-2 text-left font-semibold',
|
||||
isHighlightColumn(column) ? 'text-blue-800' : 'text-primary',
|
||||
]"
|
||||
>
|
||||
{{ column }}
|
||||
</th>
|
||||
@@ -117,8 +136,8 @@ function emitAssetHistory(row: unknown[]): void {
|
||||
<button
|
||||
v-if="canOpenAssetHistory(row, cellIndex)"
|
||||
type="button"
|
||||
class="whitespace-pre-wrap break-all text-left font-medium text-brand-600 underline-offset-2 transition hover:underline"
|
||||
@click="emitAssetHistory(row)"
|
||||
class="whitespace-pre-wrap break-all text-left font-semibold text-blue-700 underline-offset-2 transition hover:text-blue-800 hover:underline"
|
||||
@click="emitAssetAction(row, cellIndex)"
|
||||
>
|
||||
{{ cell ?? '-' }}
|
||||
</button>
|
||||
|
||||
@@ -31,6 +31,7 @@ const embeddedIframeSrc = computed(() => {
|
||||
const url = agent.iframe_url;
|
||||
return url ? String(url) : undefined;
|
||||
});
|
||||
const canManageMaintenance = computed(() => ['admin', 'maintenance_manager'].includes(String(page.currentUser?.role || '')));
|
||||
const hideWelcomePanel = computed(() => isTrainingAgentPage.value);
|
||||
const isTrainingWorkspaceExpanded = ref(false);
|
||||
const maintenancePanel = ref<'ledger' | 'record' | null>(null);
|
||||
@@ -224,6 +225,7 @@ watch(() => page.currentAgentId, () => {
|
||||
:can-send-message="page.canSendMessage"
|
||||
:is-shipping-notice-agent="page.isShippingNoticeAgent"
|
||||
:is-maintenance-agent="isMaintenanceAgentPage"
|
||||
:can-manage-maintenance="canManageMaintenance"
|
||||
:shipping-suggested-prompt="page.shippingSuggestedPrompt"
|
||||
:shipping-focus-task-no="page.focusedShippingTaskNo"
|
||||
:shipping-focus-reason="page.shippingFocusReason"
|
||||
@@ -245,7 +247,7 @@ watch(() => page.currentAgentId, () => {
|
||||
</div>
|
||||
|
||||
<aside
|
||||
v-if="isMaintenanceAgentPage && maintenancePanel"
|
||||
v-if="isMaintenanceAgentPage && canManageMaintenance && maintenancePanel"
|
||||
class="relative flex flex-col border-l border-default bg-surface shadow-[-8px_0_24px_rgba(15,23,42,0.06)]"
|
||||
:class="[
|
||||
isMaintenancePanelFullscreen ? 'absolute inset-y-0 right-0 z-30' : '',
|
||||
|
||||
@@ -11,6 +11,7 @@ import ChatLeaveAgentDialog from '@/features/chat/components/ChatLeaveAgentDialo
|
||||
import ChatOALoginDialog from '@/features/chat/components/ChatOALoginDialog.vue';
|
||||
import ChatGuideModal from '@/features/chat/components/ChatGuideModal.vue';
|
||||
import { Loader2 } from 'lucide-vue-next';
|
||||
import { nextTick } from 'vue';
|
||||
import { useChatPageContext } from '@/features/chat/composables/chat.context';
|
||||
import { getAuthHeaders } from '@/shared/utils/auth';
|
||||
|
||||
@@ -23,14 +24,29 @@ function onFeedbackSubmitted() {
|
||||
page.msg.success(page.t('chat.feedbackSubmitSuccess'));
|
||||
page.showGeneralFeedbackDialog = false;
|
||||
}
|
||||
|
||||
async function handleQueryPreviewAssetHistory(assetId: string, assetName: string) {
|
||||
page.queryPreview.close();
|
||||
await nextTick();
|
||||
await page.assetHistory.openHistory(assetId, assetName);
|
||||
}
|
||||
|
||||
async function handleQueryPreviewAssetImage(assetId: string, assetName: string) {
|
||||
page.queryPreview.close();
|
||||
await nextTick();
|
||||
await page.assetImage.openImage(assetId, assetName);
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<FilePreviewModal
|
||||
v-model="page.filePreviewVisible"
|
||||
:file="page.previewFile"
|
||||
:files="page.previewFiles"
|
||||
:current-index="page.currentPreviewIndex"
|
||||
:agent-id="page.currentAgentId"
|
||||
:auth-headers="getAuthHeaders()"
|
||||
@update:current-index="page.setPreviewFileIndex"
|
||||
/>
|
||||
<GeneralFeedbackDialog
|
||||
v-model="page.showGeneralFeedbackDialog"
|
||||
@@ -46,7 +62,8 @@ function onFeedbackSubmitted() {
|
||||
:state="page.queryPreviewState"
|
||||
@close="page.queryPreview.close"
|
||||
@change-page="page.queryPreview.changePage"
|
||||
@open-asset-history="({ assetId, assetName }) => page.assetHistory.openHistory(assetId, assetName)"
|
||||
@open-asset-history="({ assetId, assetName }) => handleQueryPreviewAssetHistory(assetId, assetName)"
|
||||
@open-asset-image="({ assetId, assetName }) => handleQueryPreviewAssetImage(assetId, assetName)"
|
||||
/>
|
||||
<div
|
||||
v-if="page.assetHistory.loading"
|
||||
@@ -57,6 +74,15 @@ function onFeedbackSubmitted() {
|
||||
<span>正在搜索该资产的履历资料,请耐心等待...</span>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
v-if="page.assetImage.loading"
|
||||
class="pointer-events-none fixed inset-x-0 top-20 z-[145] flex justify-center px-4"
|
||||
>
|
||||
<div class="flex items-center gap-2 rounded-full border border-brand-200 bg-white/95 px-4 py-2 text-sm text-brand-700 shadow-lg backdrop-blur">
|
||||
<Loader2 class="h-4 w-4 animate-spin text-brand-500" />
|
||||
<span>正在搜索该资产的图片资料,请耐心等待...</span>
|
||||
</div>
|
||||
</div>
|
||||
<ChatLeaveAgentDialog
|
||||
v-model:open="page.showLeaveAgentDialog"
|
||||
v-model:keyword="page.leaveAgentKeyword"
|
||||
|
||||
@@ -5,8 +5,9 @@
|
||||
* 逻辑:由 ChatMessageList 按消息逐条挂载;正文渲染与特殊交互委托 useChatPageMarkdown 等页面编排层提供的 handlers。
|
||||
*/
|
||||
<script setup lang="ts">
|
||||
import { computed, ref, watch } from 'vue';
|
||||
import { computed, nextTick, ref, watch } from 'vue';
|
||||
import { Check, Copy, Download, Edit2, Eye, LayoutGrid, MessageSquareText, RotateCw, X } from 'lucide-vue-next';
|
||||
import { useAuthStore } from '@/features/auth/stores/auth.store';
|
||||
import LeaveMessageBlock, { type LeaveMessageHandlers } from './LeaveMessageBlock.vue';
|
||||
import MaintenanceDeviceResultCard from './MaintenanceDeviceResultCard.vue';
|
||||
import ShippingInventoryMappingMessage, { type ShippingMappingHandlers } from './ShippingInventoryMappingMessage.vue';
|
||||
@@ -23,6 +24,7 @@ export interface ChatMessageBubbleHandlers {
|
||||
renderMarkdown: (text: string) => string;
|
||||
onMarkdownClick: (event: MouseEvent) => void;
|
||||
openAssetHistory: (assetId: string, assetName?: string) => void;
|
||||
openAssetImage: (assetId: string, assetName?: string) => void;
|
||||
getInlineDownloadFiles: (text: string) => { cleanedText: string; files: InlineDownloadFile[] };
|
||||
downloadInlineFile: (file: InlineDownloadFile) => void;
|
||||
getShippingInventoryMappingPayload: (msg: ChatMessage) => ShippingInventoryMappingFormPayload | null;
|
||||
@@ -76,6 +78,10 @@ const emit = defineEmits<{
|
||||
'open-feedback': [];
|
||||
}>();
|
||||
|
||||
const authStore = useAuthStore();
|
||||
const INLINE_DOWNLOAD_ALLOWED_EMPLOYEE_ID = '17070141';
|
||||
const RESTRICTED_INLINE_DOWNLOAD_FILE_NAME = '资产明细全量导出表.csv';
|
||||
|
||||
const isLeaveMessage = computed(() =>
|
||||
message.type === 'leave-form'
|
||||
|| message.type === 'leave-confirmation'
|
||||
@@ -185,6 +191,8 @@ const FIXED_ASSET_HEADER_LABELS: Record<string, string> = {
|
||||
custodian_name: '保管人',
|
||||
custodian_dept: '保管部门',
|
||||
department_name: '保管部门',
|
||||
image: '图片',
|
||||
picture: '图片',
|
||||
storage_location: '存放位置名称',
|
||||
location_name: '存放位置名称',
|
||||
asset_status: '资产状态',
|
||||
@@ -209,16 +217,17 @@ const FIXED_ASSET_HEADER_LABELS: Record<string, string> = {
|
||||
snapshot_time: '快照时间',
|
||||
};
|
||||
const FIXED_ASSET_CANONICAL_COLUMNS = [
|
||||
{ key: 'id', label: '序号', aliases: ['id'] },
|
||||
{ key: 'asset_id', label: '资产编号', aliases: ['asset_id', 'asset_no'] },
|
||||
{ key: 'asset_name', label: '资产名称', aliases: ['asset_name'] },
|
||||
{ key: 'custodian_person', label: '保管人', aliases: ['custodian_person', 'custodian_name'] },
|
||||
{ key: 'custodian_dept', label: '保管部门', aliases: ['custodian_dept', 'department_name'] },
|
||||
{ key: 'account_period', label: '账套', aliases: ['account_period', 'operating_center_code'] },
|
||||
{ key: 'supplier', label: '供应商', aliases: ['supplier', 'vendor_name'] },
|
||||
{ key: 'asset_status', label: '资产状态', aliases: ['asset_status'] },
|
||||
{ key: 'quantity', label: '数量', aliases: ['quantity'] },
|
||||
{ key: 'acquisition_date', label: '取得时间', aliases: ['acquisition_date', 'acquired_date'] },
|
||||
{ key: 'id', label: '序号', aliases: ['id', '序号'] },
|
||||
{ key: 'asset_id', label: '资产编号', aliases: ['asset_id', 'asset_no', '资产编号'] },
|
||||
{ key: 'asset_name', label: '资产名称', aliases: ['asset_name', '资产名称'] },
|
||||
{ key: 'custodian_person', label: '保管人', aliases: ['custodian_person', 'custodian_name', '保管人', '保管人姓名'] },
|
||||
{ key: 'custodian_dept', label: '保管部门', aliases: ['custodian_dept', 'department_name', '保管部门', '保管部门名称'] },
|
||||
{ key: 'image', label: '图片', aliases: ['image', 'picture', '图片'] },
|
||||
{ key: 'account_period', label: '账套', aliases: ['account_period', 'operating_center_code', '账套'] },
|
||||
{ key: 'supplier', label: '供应商', aliases: ['supplier', 'vendor_name', '供应商', '供应厂商'] },
|
||||
{ key: 'asset_status', label: '资产状态', aliases: ['asset_status', '资产状态'] },
|
||||
{ key: 'quantity', label: '数量', aliases: ['quantity', '数量'] },
|
||||
{ key: 'acquisition_date', label: '取得时间', aliases: ['acquisition_date', 'acquired_date', '取得时间', '取得日期'] },
|
||||
] as const;
|
||||
const INLINE_DIALOG_PAGE_SIZE = 15;
|
||||
|
||||
@@ -362,6 +371,18 @@ function buildFixedAssetInlineTable(rawHeaders: string[], dataRows: string[][]):
|
||||
const canonicalHeaders = FIXED_ASSET_CANONICAL_COLUMNS.map((column) => column.key);
|
||||
const allRows = dataRows.map((row, rowIndex) => FIXED_ASSET_CANONICAL_COLUMNS.map((column) => {
|
||||
if (column.key === 'id') return String(rowIndex + 1);
|
||||
if (column.key === 'image') {
|
||||
const assetIdColumnIndex = findInlineTableHeaderIndex(rawHeaders, ['asset_id', 'asset_no', '资产编号']);
|
||||
const rawAssetId = assetIdColumnIndex >= 0 ? row[assetIdColumnIndex] ?? '' : '';
|
||||
const normalizedAssetId = String(rawAssetId ?? '').trim();
|
||||
const imageColumnIndex = findInlineTableHeaderIndex(rawHeaders, ['image', 'picture', '图片']);
|
||||
const rawImageValue = imageColumnIndex >= 0 ? row[imageColumnIndex] ?? '' : '';
|
||||
const normalizedImageValue = String(rawImageValue ?? '').trim();
|
||||
if (normalizedImageValue) {
|
||||
return normalizeInlineTableCell(normalizedImageValue);
|
||||
}
|
||||
return normalizedAssetId ? '查看' : '无';
|
||||
}
|
||||
const columnIndex = findInlineTableHeaderIndex(rawHeaders, [...column.aliases]);
|
||||
const rawValue = columnIndex >= 0 ? row[columnIndex] ?? '' : '';
|
||||
const normalizedValue = column.key === 'acquisition_date'
|
||||
@@ -488,6 +509,33 @@ const activeInlinePageRows = computed(() => {
|
||||
});
|
||||
const activeInlineRangeStart = computed(() => (activeInlineFilteredRows.value.length === 0 ? 0 : (inlineDialogPage.value - 1) * INLINE_DIALOG_PAGE_SIZE + 1));
|
||||
const activeInlineRangeEnd = computed(() => Math.min(inlineDialogPage.value * INLINE_DIALOG_PAGE_SIZE, activeInlineFilteredRows.value.length));
|
||||
const currentUserEmployeeId = computed(() => String(authStore.user?.employee_id || '').trim());
|
||||
|
||||
/**
|
||||
* 判断当前文件是否命中“仅指定工号可下载”的特殊管控。
|
||||
* AI 触发时机:当聊天内嵌 CSV 预览头部要决定是否展示【下载数据】按钮,或真正执行下载前需要二次校验时调用。
|
||||
* 核心逻辑:仅对 `资产明细全量导出表.csv` 启用强限制,其他附件继续沿用现有下载能力,避免误伤普通文件预览。
|
||||
* 参数约束:传入文件名允许为空;空值或非目标文件一律视为不命中管控。
|
||||
*/
|
||||
function requiresRestrictedInlineDownload(file: InlineDownloadFile | null | undefined): boolean {
|
||||
const fileName = String(file?.name || '').trim();
|
||||
return fileName === RESTRICTED_INLINE_DOWNLOAD_FILE_NAME;
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验当前用户是否有权下载当前内嵌文件。
|
||||
* AI 触发时机:当页面需要控制【下载数据】按钮显隐,或下载函数执行前做权限兜底时调用。
|
||||
* 核心逻辑:命中特殊管控文件时,只放行工号 `17070141`;其余文件保持原权限不变。
|
||||
* 参数约束:仅负责前端展示层和交互层兜底,不替代后端鉴权;若后续接入通用权限系统,应优先复用统一能力。
|
||||
*/
|
||||
function canDownloadInlineFile(file: InlineDownloadFile | null | undefined): boolean {
|
||||
if (!requiresRestrictedInlineDownload(file)) {
|
||||
return true;
|
||||
}
|
||||
return currentUserEmployeeId.value === INLINE_DOWNLOAD_ALLOWED_EMPLOYEE_ID;
|
||||
}
|
||||
|
||||
const canDownloadActiveInlineFile = computed(() => canDownloadInlineFile(activeInlineDialogEntry.value?.file));
|
||||
|
||||
watch(activeInlineTotalPages, (totalPages) => {
|
||||
if (inlineDialogPage.value > totalPages) {
|
||||
@@ -543,14 +591,32 @@ function changeInlineDialogPage(nextPage: number): void {
|
||||
|
||||
function canOpenInlineAssetHistory(cellIndex: number, cellValue: string): boolean {
|
||||
const normalizedValue = String(cellValue || '').trim();
|
||||
return cellIndex === activeInlineFilterIndexes.value.assetId && !!normalizedValue && normalizedValue !== '-';
|
||||
const imageIndex = activeInlineDialogEntry.value?.table.rawHeaders.findIndex((header) => header === 'image' || header === '图片') ?? -1;
|
||||
if (cellIndex === activeInlineFilterIndexes.value.assetId) {
|
||||
return !!normalizedValue && normalizedValue !== '-';
|
||||
}
|
||||
if (cellIndex === imageIndex) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function openInlineAssetHistory(row: string[]): void {
|
||||
function isInlineHighlightHeader(header: string): boolean {
|
||||
return header === '资产编号' || header === '图片';
|
||||
}
|
||||
|
||||
async function openInlineAssetHistory(row: string[], cellIndex: number): Promise<void> {
|
||||
const indexes = activeInlineFilterIndexes.value;
|
||||
const assetId = indexes.assetId >= 0 ? String(row[indexes.assetId] || '').trim() : '';
|
||||
const assetName = indexes.assetName >= 0 ? String(row[indexes.assetName] || '').trim() : '';
|
||||
if (!assetId || assetId === '-') return;
|
||||
const imageIndex = activeInlineDialogEntry.value?.table.rawHeaders.findIndex((header) => header === 'image' || header === '图片') ?? -1;
|
||||
closeInlinePreviewDialog();
|
||||
await nextTick();
|
||||
if (cellIndex === imageIndex) {
|
||||
handlers.openAssetImage(assetId, assetName === '-' ? '' : assetName);
|
||||
return;
|
||||
}
|
||||
handlers.openAssetHistory(assetId, assetName === '-' ? '' : assetName);
|
||||
}
|
||||
|
||||
@@ -560,6 +626,9 @@ function openInlineAssetHistory(row: string[]): void {
|
||||
* @param file - 从当前消息内容解析出的单个可下载文件。
|
||||
*/
|
||||
function handleInlineDownload(file: InlineDownloadFile): void {
|
||||
if (!canDownloadInlineFile(file)) {
|
||||
return;
|
||||
}
|
||||
const table = buildInlinePreviewTable(file);
|
||||
if (!table.isCsv || table.headers.length === 0) {
|
||||
handlers.downloadInlineFile(file);
|
||||
@@ -854,6 +923,7 @@ function handleInlineDownload(file: InlineDownloadFile): void {
|
||||
</div>
|
||||
<div class="flex items-center gap-2">
|
||||
<button
|
||||
v-if="canDownloadActiveInlineFile"
|
||||
type="button"
|
||||
class="inline-flex items-center gap-2 rounded-xl border border-brand-200 bg-brand-50 px-3 py-2 text-xs font-medium text-brand-700 transition hover:bg-brand-100"
|
||||
@click="handleInlineDownload(activeInlineDialogEntry.file)"
|
||||
@@ -909,7 +979,10 @@ function handleInlineDownload(file: InlineDownloadFile): void {
|
||||
<th
|
||||
v-for="(header, headerIndex) in activeInlineDialogEntry.table.headers"
|
||||
:key="`${activeInlineDialogEntry.file.name}-dialog-header-${headerIndex}`"
|
||||
class="border border-slate-200 px-3 py-2 text-left font-semibold text-primary"
|
||||
:class="[
|
||||
'border border-slate-200 px-3 py-2 text-left font-semibold',
|
||||
isInlineHighlightHeader(header) ? 'text-blue-800' : 'text-primary',
|
||||
]"
|
||||
>
|
||||
{{ header || '-' }}
|
||||
</th>
|
||||
@@ -929,8 +1002,8 @@ function handleInlineDownload(file: InlineDownloadFile): void {
|
||||
<button
|
||||
v-if="canOpenInlineAssetHistory(cellIndex, cell)"
|
||||
type="button"
|
||||
class="whitespace-pre-wrap break-all text-left font-medium text-brand-600 underline-offset-2 transition hover:underline"
|
||||
@click="openInlineAssetHistory(row)"
|
||||
class="whitespace-pre-wrap break-all text-left font-semibold text-blue-700 underline-offset-2 transition hover:text-blue-800 hover:underline"
|
||||
@click="openInlineAssetHistory(row, cellIndex)"
|
||||
>
|
||||
{{ cell || '-' }}
|
||||
</button>
|
||||
@@ -1030,6 +1103,21 @@ function handleInlineDownload(file: InlineDownloadFile): void {
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
:deep(.chat-markdown .chat-fixed-asset-highlight-header) {
|
||||
color: rgb(30 64 175);
|
||||
}
|
||||
|
||||
:deep(.chat-markdown .chat-asset-history-link) {
|
||||
color: rgb(29 78 216);
|
||||
font-weight: 600;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
:deep(.chat-markdown .chat-asset-history-link:hover) {
|
||||
color: rgb(30 64 175);
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
:deep(.dark .chat-markdown th),
|
||||
:deep(.dark .chat-markdown td) {
|
||||
border-color: rgb(51 65 85);
|
||||
@@ -1039,6 +1127,15 @@ function handleInlineDownload(file: InlineDownloadFile): void {
|
||||
background: rgb(30 41 59);
|
||||
}
|
||||
|
||||
:deep(.dark .chat-markdown .chat-fixed-asset-highlight-header),
|
||||
:deep(.dark .chat-markdown .chat-asset-history-link) {
|
||||
color: rgb(147 197 253);
|
||||
}
|
||||
|
||||
:deep(.dark .chat-markdown .chat-asset-history-link:hover) {
|
||||
color: rgb(191 219 254);
|
||||
}
|
||||
|
||||
:deep(.chat-markdown details) {
|
||||
margin-top: 1rem;
|
||||
border: 1px solid rgb(226 232 240);
|
||||
|
||||
@@ -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