|
@@ -12,9 +12,8 @@
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
<div class="page-header__actions">
|
|
<div class="page-header__actions">
|
|
|
- <Button type="primary" class="next-btn" :disabled="!hasSuccessResult" @click="handleGoMatch">
|
|
|
|
|
- 下一步:数据匹配
|
|
|
|
|
- </Button>
|
|
|
|
|
|
|
+ <Button type="primary" class="next-btn" :disabled="!hasSuccessResult" @click="handleSmartClean"> 智能 </Button>
|
|
|
|
|
+ <Button class="next-btn" :disabled="!resultTrees.length" @click="handleManualClean">手动清洗</Button>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
@@ -142,19 +141,26 @@
|
|
|
<div class="panel-title">解析结果(实时)</div>
|
|
<div class="panel-title">解析结果(实时)</div>
|
|
|
<div class="panel-desc">每完成一份文件解析,结果树会实时追加到下方</div>
|
|
<div class="panel-desc">每完成一份文件解析,结果树会实时追加到下方</div>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
+ <div class="panel-header__actions">
|
|
|
|
|
+ <Button size="small" :disabled="!expandableCount" @click="toggleExpandAllRows">
|
|
|
|
|
+ {{ allExpanded ? '全部收起' : '全部展开' }}
|
|
|
|
|
+ </Button>
|
|
|
|
|
+ </div>
|
|
|
<div class="panel-stats">已解析 {{ resultTrees.length }} 个文件</div>
|
|
<div class="panel-stats">已解析 {{ resultTrees.length }} 个文件</div>
|
|
|
</div>
|
|
</div>
|
|
|
<div class="table-wrapper">
|
|
<div class="table-wrapper">
|
|
|
<Table
|
|
<Table
|
|
|
class="result-tree-table"
|
|
class="result-tree-table"
|
|
|
:columns="resultTableColumns"
|
|
:columns="resultTableColumns"
|
|
|
- :data-source="resultTrees"
|
|
|
|
|
|
|
+ :data-source="tableDataSource"
|
|
|
:loading="tableLoading"
|
|
:loading="tableLoading"
|
|
|
:pagination="false"
|
|
:pagination="false"
|
|
|
row-key="id"
|
|
row-key="id"
|
|
|
:children-column-name="'children'"
|
|
:children-column-name="'children'"
|
|
|
|
|
+ :expanded-row-keys="expandedRowKeys"
|
|
|
size="small"
|
|
size="small"
|
|
|
- :scroll="{ x: 760 }"
|
|
|
|
|
|
|
+ :scroll="{ x: 840 }"
|
|
|
|
|
+ @expandedRowsChange="onExpandedRowsChange"
|
|
|
/>
|
|
/>
|
|
|
</div>
|
|
</div>
|
|
|
</section>
|
|
</section>
|
|
@@ -163,7 +169,7 @@
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts" setup name="ViewsDataUpload">
|
|
<script lang="ts" setup name="ViewsDataUpload">
|
|
|
- import { computed, h, ref } from 'vue';
|
|
|
|
|
|
|
+ import { computed, h, onMounted, ref } from 'vue';
|
|
|
import { onBeforeRouteLeave } from 'vue-router';
|
|
import { onBeforeRouteLeave } from 'vue-router';
|
|
|
import { CloseOutlined, LeftOutlined } from '@ant-design/icons-vue';
|
|
import { CloseOutlined, LeftOutlined } from '@ant-design/icons-vue';
|
|
|
import { Button, Modal, Table, type TableColumnsType } from 'ant-design-vue';
|
|
import { Button, Modal, Table, type TableColumnsType } from 'ant-design-vue';
|
|
@@ -172,8 +178,9 @@
|
|
|
import { PageEnum } from '@/core/enums/pageEnum';
|
|
import { PageEnum } from '@/core/enums/pageEnum';
|
|
|
import { useMessage } from '@/core/hooks/web/useMessage';
|
|
import { useMessage } from '@/core/hooks/web/useMessage';
|
|
|
import { useEmitter } from '@/core/store/modules/case';
|
|
import { useEmitter } from '@/core/store/modules/case';
|
|
|
- import { clearUploadBatch, preFileUpload } from '@/case/api/govern/governApi';
|
|
|
|
|
|
|
+ import { clearUploadBatch, deletedFileList, preFileUpload } from '@/case/api/govern/governApi';
|
|
|
import { FileStatusEnum } from '@/case/types/enum';
|
|
import { FileStatusEnum } from '@/case/types/enum';
|
|
|
|
|
+ import { resetImportProgressSession } from './importProgressSession';
|
|
|
import type { FileInfo } from '@/types/api';
|
|
import type { FileInfo } from '@/types/api';
|
|
|
|
|
|
|
|
const { prefixCls } = useDesign('case-upload');
|
|
const { prefixCls } = useDesign('case-upload');
|
|
@@ -182,8 +189,9 @@
|
|
|
const emitter = useEmitter();
|
|
const emitter = useEmitter();
|
|
|
const { createMessage } = useMessage();
|
|
const { createMessage } = useMessage();
|
|
|
const FILE_INFO_STORAGE_KEY = 'case_clean_file_infos';
|
|
const FILE_INFO_STORAGE_KEY = 'case_clean_file_infos';
|
|
|
|
|
+ const IMPORT_FILE_INFO_STORAGE_KEY = 'case_clean_import_file_infos';
|
|
|
|
|
+ const RECLEAN_CONTEXT_STORAGE_KEY = 'case_clean_reclean_context';
|
|
|
const CASE_DATA_REFRESH_EVENT = 'case-data:refresh';
|
|
const CASE_DATA_REFRESH_EVENT = 'case-data:refresh';
|
|
|
- const CASE_IMPORT_FILE_REFRESH_EVENT = 'case-import-file:refresh';
|
|
|
|
|
const VALID_UPLOAD_EXTS = ['.xls', '.xlsx', '.csv'];
|
|
const VALID_UPLOAD_EXTS = ['.xls', '.xlsx', '.csv'];
|
|
|
|
|
|
|
|
type UploadMode = 'single' | 'folder';
|
|
type UploadMode = 'single' | 'folder';
|
|
@@ -210,6 +218,42 @@
|
|
|
const allFileInfos = ref<Recordable[]>([]);
|
|
const allFileInfos = ref<Recordable[]>([]);
|
|
|
const tableLoading = ref(false);
|
|
const tableLoading = ref(false);
|
|
|
|
|
|
|
|
|
|
+ // 受控展开:默认全部展开,新解析的文件根节点自动展开
|
|
|
|
|
+ // (键类型与 ant-design-vue Table 的 expandedRowKeys 保持一致:string | number)
|
|
|
|
|
+ const expandedRowKeys = ref<(string | number)[]>([]);
|
|
|
|
|
+ const expandableCount = computed(() => resultTrees.value.filter((root) => (root.children || []).length > 0).length);
|
|
|
|
|
+ const allExpanded = computed(
|
|
|
|
|
+ () => expandableCount.value > 0 && expandedRowKeys.value.length >= expandableCount.value,
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
|
|
+ const collectExpandableKeys = () =>
|
|
|
|
|
+ resultTrees.value.filter((root) => (root.children || []).length > 0).map((root) => String(root.id ?? ''));
|
|
|
|
|
+
|
|
|
|
|
+ const expandAllRows = () => {
|
|
|
|
|
+ expandedRowKeys.value = collectExpandableKeys();
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ const toggleExpandAllRows = () => {
|
|
|
|
|
+ expandedRowKeys.value = allExpanded.value ? [] : collectExpandableKeys();
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ // 用户手动展开/收起时同步受控 keys
|
|
|
|
|
+ const onExpandedRowsChange = (keys: (string | number)[]) => {
|
|
|
|
|
+ expandedRowKeys.value = keys;
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ // 表格数据源:递归剥离空 children。
|
|
|
|
|
+ // 后端 FileInfo.children 恒为空数组(非 undefined),ant-design-vue 树形模式下
|
|
|
|
|
+ // 只要 record.children 为真值就渲染展开图标,空数组也算,必须逐层剥掉
|
|
|
|
|
+ const stripEmptyChildren = (node: Recordable): Recordable => {
|
|
|
|
|
+ const children = node.children || [];
|
|
|
|
|
+ if (!children.length) {
|
|
|
|
|
+ return { ...node, children: undefined };
|
|
|
|
|
+ }
|
|
|
|
|
+ return { ...node, children: children.map(stripEmptyChildren) };
|
|
|
|
|
+ };
|
|
|
|
|
+ const tableDataSource = computed(() => resultTrees.value.map(stripEmptyChildren));
|
|
|
|
|
+
|
|
|
// 离开放行标记:点「下一步」或已确认清理后的程序化跳转置为 true
|
|
// 离开放行标记:点「下一步」或已确认清理后的程序化跳转置为 true
|
|
|
const allowedToLeave = ref(false);
|
|
const allowedToLeave = ref(false);
|
|
|
// 放弃标记:确认离开后中断上传循环,避免组件卸载后继续写结果
|
|
// 放弃标记:确认离开后中断上传循环,避免组件卸载后继续写结果
|
|
@@ -367,6 +411,33 @@
|
|
|
sessionStorage.setItem(FILE_INFO_STORAGE_KEY, JSON.stringify(infos));
|
|
sessionStorage.setItem(FILE_INFO_STORAGE_KEY, JSON.stringify(infos));
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 从 storage 恢复已解析结果(从清洗页返回时右侧表格还原)
|
|
|
|
|
+ * 同时把批次号恢复为原批次,保证后续上传/删除/清理与原批次数据一致
|
|
|
|
|
+ */
|
|
|
|
|
+ const restoreParsedResults = () => {
|
|
|
|
|
+ try {
|
|
|
|
|
+ const raw = sessionStorage.getItem(FILE_INFO_STORAGE_KEY);
|
|
|
|
|
+ if (!raw) return;
|
|
|
|
|
+ const parsed = JSON.parse(raw);
|
|
|
|
|
+ if (!Array.isArray(parsed) || !parsed.length) return;
|
|
|
|
|
+ allFileInfos.value = parsed;
|
|
|
|
|
+ resultTrees.value = parsed;
|
|
|
|
|
+ // 恢复后默认全部展开
|
|
|
|
|
+ expandAllRows();
|
|
|
|
|
+ const storedBatchId = parsed[0]?.batchId;
|
|
|
|
|
+ if (storedBatchId !== null && storedBatchId !== undefined && String(storedBatchId).trim() !== '') {
|
|
|
|
|
+ uploadBatchId.value = storedBatchId as number;
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch {
|
|
|
|
|
+ // 无效缓存忽略,保持新批次
|
|
|
|
|
+ }
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ onMounted(() => {
|
|
|
|
|
+ restoreParsedResults();
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
const isOwnBatchStorage = () => {
|
|
const isOwnBatchStorage = () => {
|
|
|
const raw = sessionStorage.getItem(FILE_INFO_STORAGE_KEY);
|
|
const raw = sessionStorage.getItem(FILE_INFO_STORAGE_KEY);
|
|
|
if (!raw) return true;
|
|
if (!raw) return true;
|
|
@@ -385,6 +456,20 @@
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 离开上传页时清空本流程的 sessionStorage 缓存,避免上一批已上传文件被后续流程复用:
|
|
|
|
|
+ * - case_clean_file_infos 已上传文件的解析结果(右侧表格数据源)
|
|
|
|
|
+ * - case_clean_import_file_infos 手动清洗页提交给清洗进度页的导入文件列表
|
|
|
|
|
+ * - case_clean_reclean_context 重新清洗上下文(reClean=1 + fileId)
|
|
|
|
|
+ * - case_clean_import_progress 清洗进度快照,连同运行时状态与 SSE 连接一起重置
|
|
|
|
|
+ */
|
|
|
|
|
+ const clearCleanFlowSessionCache = () => {
|
|
|
|
|
+ clearStoredFileInfos();
|
|
|
|
|
+ sessionStorage.removeItem(IMPORT_FILE_INFO_STORAGE_KEY);
|
|
|
|
|
+ sessionStorage.removeItem(RECLEAN_CONTEXT_STORAGE_KEY);
|
|
|
|
|
+ resetImportProgressSession();
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 自动上传队列:选择文件后自动触发,按序消费列表中的待上传文件;
|
|
* 自动上传队列:选择文件后自动触发,按序消费列表中的待上传文件;
|
|
|
* 上传解析成功即从列表移除,失败保留(标记错误,可手动移除)。
|
|
* 上传解析成功即从列表移除,失败保留(标记错误,可手动移除)。
|
|
@@ -428,9 +513,12 @@
|
|
|
if (fileNode) {
|
|
if (fileNode) {
|
|
|
// 右侧 treetable 直接渲染树(文件根 → sheet 子节点)
|
|
// 右侧 treetable 直接渲染树(文件根 → sheet 子节点)
|
|
|
resultTrees.value = [...resultTrees.value, fileNode];
|
|
resultTrees.value = [...resultTrees.value, fileNode];
|
|
|
- // 持久化给 match/清洗流程的数据保持平铺(根 + 各 sheet 同层,pid 关联),与历史契约一致
|
|
|
|
|
- const flatList: FileInfo[] = [fileNode, ...(fileNode.children ?? [])];
|
|
|
|
|
- allFileInfos.value = [...allFileInfos.value, ...flatList];
|
|
|
|
|
|
|
+ // 新文件根自动展开(受控展开,默认全部展开)
|
|
|
|
|
+ if ((fileNode.children || []).length > 0) {
|
|
|
|
|
+ expandedRowKeys.value = [...expandedRowKeys.value, String(fileNode.id ?? '')];
|
|
|
|
|
+ }
|
|
|
|
|
+ // 持久化给 match/清洗流程的数据按后端返回的树结构存储(文件根 + children sheet)
|
|
|
|
|
+ allFileInfos.value = [...allFileInfos.value, fileNode];
|
|
|
persistFileInfos(allFileInfos.value);
|
|
persistFileInfos(allFileInfos.value);
|
|
|
}
|
|
}
|
|
|
// 上传成功:从列表移除该文件
|
|
// 上传成功:从列表移除该文件
|
|
@@ -483,7 +571,7 @@
|
|
|
'SHEET_TEMPLATE_MATCHED_FAIL',
|
|
'SHEET_TEMPLATE_MATCHED_FAIL',
|
|
|
]);
|
|
]);
|
|
|
|
|
|
|
|
- const isSuccessStatus = (status?: string) => {
|
|
|
|
|
|
|
+ const isSuccessStatus = (status?: string | null) => {
|
|
|
const normalized = String(status || '').trim();
|
|
const normalized = String(status || '').trim();
|
|
|
return !!normalized && SUCCESS_FILE_STATUSES.has(normalized);
|
|
return !!normalized && SUCCESS_FILE_STATUSES.has(normalized);
|
|
|
};
|
|
};
|
|
@@ -525,19 +613,6 @@
|
|
|
width: 90,
|
|
width: 90,
|
|
|
customRender: ({ record }: any) => record.dataNum ?? '—',
|
|
customRender: ({ record }: any) => record.dataNum ?? '—',
|
|
|
},
|
|
},
|
|
|
- {
|
|
|
|
|
- title: '成功',
|
|
|
|
|
- key: 'successNum',
|
|
|
|
|
- width: 90,
|
|
|
|
|
- customRender: ({ record }: any) =>
|
|
|
|
|
- h('span', { class: 'cell-num is-success' }, [String(record.successNum ?? '—')]),
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- title: '失败',
|
|
|
|
|
- key: 'failNum',
|
|
|
|
|
- width: 90,
|
|
|
|
|
- customRender: ({ record }: any) => h('span', { class: 'cell-num is-fail' }, [String(record.failNum ?? '—')]),
|
|
|
|
|
- },
|
|
|
|
|
{
|
|
{
|
|
|
title: '状态',
|
|
title: '状态',
|
|
|
key: 'status',
|
|
key: 'status',
|
|
@@ -548,6 +623,54 @@
|
|
|
return h('span', { class: ['status-tag', cls] }, [mapped.label]);
|
|
return h('span', { class: ['status-tag', cls] }, [mapped.label]);
|
|
|
},
|
|
},
|
|
|
},
|
|
},
|
|
|
|
|
+ {
|
|
|
|
|
+ title: '操作',
|
|
|
|
|
+ key: 'action',
|
|
|
|
|
+ width: 150,
|
|
|
|
|
+ customRender: ({ record }: any) => {
|
|
|
|
|
+ // 文件根行:删除整个文件(级联全部工作表)
|
|
|
|
|
+ if (isRootNode(record)) {
|
|
|
|
|
+ return h('div', { class: 'cell-actions' }, [
|
|
|
|
|
+ h(
|
|
|
|
|
+ Button,
|
|
|
|
|
+ {
|
|
|
|
|
+ type: 'link',
|
|
|
|
|
+ size: 'small',
|
|
|
|
|
+ class: 'action-link is-danger',
|
|
|
|
|
+ disabled: isUploading.value,
|
|
|
|
|
+ onClick: () => handleRowDelete(record),
|
|
|
|
|
+ },
|
|
|
|
|
+ () => '删除',
|
|
|
|
|
+ ),
|
|
|
|
|
+ ]);
|
|
|
|
|
+ }
|
|
|
|
|
+ // 工作表行:手动清洗 + 删除
|
|
|
|
|
+ return h('div', { class: 'cell-actions' }, [
|
|
|
|
|
+ h(
|
|
|
|
|
+ Button,
|
|
|
|
|
+ {
|
|
|
|
|
+ type: 'link',
|
|
|
|
|
+ size: 'small',
|
|
|
|
|
+ class: 'action-link',
|
|
|
|
|
+ disabled: isUploading.value,
|
|
|
|
|
+ onClick: () => handleRowManualClean(record),
|
|
|
|
|
+ },
|
|
|
|
|
+ () => '手动清洗',
|
|
|
|
|
+ ),
|
|
|
|
|
+ h(
|
|
|
|
|
+ Button,
|
|
|
|
|
+ {
|
|
|
|
|
+ type: 'link',
|
|
|
|
|
+ size: 'small',
|
|
|
|
|
+ class: 'action-link is-danger',
|
|
|
|
|
+ disabled: isUploading.value,
|
|
|
|
|
+ onClick: () => handleRowDelete(record),
|
|
|
|
|
+ },
|
|
|
|
|
+ () => '删除',
|
|
|
|
|
+ ),
|
|
|
|
|
+ ]);
|
|
|
|
|
+ },
|
|
|
|
|
+ },
|
|
|
];
|
|
];
|
|
|
|
|
|
|
|
const cleanupAndLeave = async () => {
|
|
const cleanupAndLeave = async () => {
|
|
@@ -558,7 +681,7 @@
|
|
|
} catch (error: any) {
|
|
} catch (error: any) {
|
|
|
createMessage.warning(error?.message || '清理本批次数据失败,可稍后在导入文件管理中删除');
|
|
createMessage.warning(error?.message || '清理本批次数据失败,可稍后在导入文件管理中删除');
|
|
|
} finally {
|
|
} finally {
|
|
|
- clearStoredFileInfos();
|
|
|
|
|
|
|
+ clearCleanFlowSessionCache();
|
|
|
await go(PageEnum.BASE_HOME, true);
|
|
await go(PageEnum.BASE_HOME, true);
|
|
|
emitter.emit(CASE_DATA_REFRESH_EVENT);
|
|
emitter.emit(CASE_DATA_REFRESH_EVENT);
|
|
|
}
|
|
}
|
|
@@ -567,6 +690,8 @@
|
|
|
const handleBack = () => {
|
|
const handleBack = () => {
|
|
|
if (!hasActivity.value) {
|
|
if (!hasActivity.value) {
|
|
|
allowedToLeave.value = true;
|
|
allowedToLeave.value = true;
|
|
|
|
|
+ // 返回案件数据:清空已上传文件与清洗流程缓存,避免下次进入上传页还原上一批文件
|
|
|
|
|
+ clearCleanFlowSessionCache();
|
|
|
go(PageEnum.BASE_HOME, true);
|
|
go(PageEnum.BASE_HOME, true);
|
|
|
emitter.emit(CASE_DATA_REFRESH_EVENT);
|
|
emitter.emit(CASE_DATA_REFRESH_EVENT);
|
|
|
return;
|
|
return;
|
|
@@ -582,17 +707,134 @@
|
|
|
});
|
|
});
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- const handleGoMatch = () => {
|
|
|
|
|
|
|
+ /** 智能清洗:直接进入清洗导入流程(自动按已匹配模板执行) */
|
|
|
|
|
+ const handleSmartClean = () => {
|
|
|
if (!hasSuccessResult.value) return;
|
|
if (!hasSuccessResult.value) return;
|
|
|
allowedToLeave.value = true;
|
|
allowedToLeave.value = true;
|
|
|
|
|
+ resetImportProgressSession();
|
|
|
|
|
+ go(PageEnum.BASE_CLEAN_PROGRESS);
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ /** 手动清洗:进入手动清洗页逐个处理(含模板匹配失败的表) */
|
|
|
|
|
+ const handleManualClean = () => {
|
|
|
|
|
+ if (!resultTrees.value.length) return;
|
|
|
|
|
+ allowedToLeave.value = true;
|
|
|
|
|
+ go(PageEnum.BASE_CLEANING);
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ /** 行级手动清洗:定位到指定工作表进入手动清洗页 */
|
|
|
|
|
+ const handleRowManualClean = (record: Recordable) => {
|
|
|
|
|
+ const focusKey = String(record.id ?? '').trim();
|
|
|
|
|
+ if (!focusKey) {
|
|
|
|
|
+ createMessage.warning('未获取到工作表ID,暂时无法手动清洗');
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ allowedToLeave.value = true;
|
|
|
|
|
+ go({ path: PageEnum.BASE_CLEANING, query: { focusKey } });
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ /** 本地移除整个文件节点并同步 sessionStorage */
|
|
|
|
|
+ const removeFileNodeSync = (rootId: string) => {
|
|
|
|
|
+ resultTrees.value = resultTrees.value.filter((item) => String(item.id ?? '') !== rootId);
|
|
|
|
|
+ allFileInfos.value = allFileInfos.value.filter((item) => String(item.id ?? '') !== rootId);
|
|
|
|
|
+ // 同步移除已删除文件根的展开状态
|
|
|
|
|
+ expandedRowKeys.value = expandedRowKeys.value.filter((key) => String(key) !== rootId);
|
|
|
|
|
+ persistFileInfos(allFileInfos.value);
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ /** 本地移除单个工作表节点并同步 sessionStorage */
|
|
|
|
|
+ const removeSheetNodeSync = (rootId: string, sheetId: string) => {
|
|
|
|
|
+ const stripSheet = (item: Recordable) =>
|
|
|
|
|
+ String(item.id ?? '') === rootId
|
|
|
|
|
+ ? {
|
|
|
|
|
+ ...item,
|
|
|
|
|
+ children: (item.children || []).filter((child) => String(child.id ?? '') !== sheetId),
|
|
|
|
|
+ }
|
|
|
|
|
+ : item;
|
|
|
|
|
+ resultTrees.value = resultTrees.value.map(stripSheet);
|
|
|
|
|
+ allFileInfos.value = allFileInfos.value.map(stripSheet);
|
|
|
persistFileInfos(allFileInfos.value);
|
|
persistFileInfos(allFileInfos.value);
|
|
|
- emitter.emit(CASE_IMPORT_FILE_REFRESH_EVENT);
|
|
|
|
|
- go(PageEnum.BASE_MATCH);
|
|
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ /** 行级删除:文件根行删除整个文件(级联全部工作表),工作表行删除单个工作表(仅剩此表时连同文件根) */
|
|
|
|
|
+ const handleRowDelete = (record: Recordable) => {
|
|
|
|
|
+ // 文件根行:整文件删除
|
|
|
|
|
+ if (isRootNode(record)) {
|
|
|
|
|
+ const fileRootId = String(record.id ?? '').trim();
|
|
|
|
|
+ const fileName = record.fileName || '未命名文件';
|
|
|
|
|
+ if (!fileRootId) {
|
|
|
|
|
+ createMessage.warning('未获取到文件ID,暂时无法删除');
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ Modal.confirm({
|
|
|
|
|
+ title: '删除确认',
|
|
|
|
|
+ content: `确定删除文件「${fileName}」及其全部工作表吗?`,
|
|
|
|
|
+ okText: '删除',
|
|
|
|
|
+ okType: 'danger',
|
|
|
|
|
+ cancelText: '取消',
|
|
|
|
|
+ onOk: async () => {
|
|
|
|
|
+ try {
|
|
|
|
|
+ // 后端按 id 级联删除(id 匹配 + pid 匹配),传根 id 即删整文件
|
|
|
|
|
+ await deletedFileList({ ids: [fileRootId] });
|
|
|
|
|
+ removeFileNodeSync(fileRootId);
|
|
|
|
|
+ createMessage.success('删除成功');
|
|
|
|
|
+ } catch (error: any) {
|
|
|
|
|
+ createMessage.error(error?.message || '删除失败');
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ });
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 工作表行:单表删除(该文件仅剩此表时连同文件根一起删除)
|
|
|
|
|
+ const rootId = String(record.pid ?? '').trim();
|
|
|
|
|
+ const root = resultTrees.value.find((item) => String(item.id ?? '') === rootId);
|
|
|
|
|
+ const siblings = root?.children || [];
|
|
|
|
|
+ const isLastSheet = siblings.length <= 1;
|
|
|
|
|
+ const sheetId = String(record.id ?? '').trim();
|
|
|
|
|
+ const sheetName = record.sheetName || '未命名工作表';
|
|
|
|
|
+ const fileName = root?.fileName || '未命名文件';
|
|
|
|
|
+
|
|
|
|
|
+ Modal.confirm({
|
|
|
|
|
+ title: '删除确认',
|
|
|
|
|
+ content: isLastSheet
|
|
|
|
|
+ ? `「${fileName}」仅剩此工作表,删除后将移除整个文件,是否继续?`
|
|
|
|
|
+ : `确定删除工作表「${sheetName}」吗?`,
|
|
|
|
|
+ okText: '删除',
|
|
|
|
|
+ okType: 'danger',
|
|
|
|
|
+ cancelText: '取消',
|
|
|
|
|
+ onOk: async () => {
|
|
|
|
|
+ try {
|
|
|
|
|
+ // 后端按 id 级联删除(id 匹配 + pid 匹配):仅剩此表时传根 id 删整文件,否则传 sheet id 删单表
|
|
|
|
|
+ const deleteIds = isLastSheet && root ? [String(root.id ?? '')] : [sheetId];
|
|
|
|
|
+ const validIds = deleteIds.filter(Boolean);
|
|
|
|
|
+ if (!validIds.length) {
|
|
|
|
|
+ createMessage.warning('未获取到ID,暂时无法删除');
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ await deletedFileList({ ids: validIds });
|
|
|
|
|
+ if (isLastSheet) {
|
|
|
|
|
+ removeFileNodeSync(rootId);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ removeSheetNodeSync(rootId, sheetId);
|
|
|
|
|
+ }
|
|
|
|
|
+ createMessage.success('删除成功');
|
|
|
|
|
+ } catch (error: any) {
|
|
|
|
|
+ createMessage.error(error?.message || '删除失败');
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ });
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
// 兜底浏览器返回 / 标签页关闭等非按钮离开
|
|
// 兜底浏览器返回 / 标签页关闭等非按钮离开
|
|
|
- onBeforeRouteLeave((_to, _from, next) => {
|
|
|
|
|
|
|
+ onBeforeRouteLeave((to, _from, next) => {
|
|
|
if (allowedToLeave.value || !hasActivity.value) {
|
|
if (allowedToLeave.value || !hasActivity.value) {
|
|
|
|
|
+ // 进入清洗流程(清洗页 / 清洗进度页)时保留缓存,供下游页面读取;
|
|
|
|
|
+ // 其余离开上传页的场景(返回案件数据、切菜单等)一律清空已上传文件与清洗流程缓存
|
|
|
|
|
+ const toPath = String(to?.path ?? '');
|
|
|
|
|
+ if (toPath !== PageEnum.BASE_CLEANING && toPath !== PageEnum.BASE_CLEAN_PROGRESS) {
|
|
|
|
|
+ clearCleanFlowSessionCache();
|
|
|
|
|
+ }
|
|
|
next();
|
|
next();
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
@@ -742,6 +984,13 @@
|
|
|
line-height: 1.5;
|
|
line-height: 1.5;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ .panel-header__actions {
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ align-items: center;
|
|
|
|
|
+ gap: 8px;
|
|
|
|
|
+ margin-left: auto;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
.panel-stats {
|
|
.panel-stats {
|
|
|
font-size: 12px;
|
|
font-size: 12px;
|
|
|
color: #64748b;
|
|
color: #64748b;
|
|
@@ -756,7 +1005,7 @@
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
.result-tree-table {
|
|
.result-tree-table {
|
|
|
- :deep(.ant-table-thead > tr > th) {
|
|
|
|
|
|
|
+ .ant-table-thead > tr > th {
|
|
|
padding: 6px 8px;
|
|
padding: 6px 8px;
|
|
|
font-size: 12px;
|
|
font-size: 12px;
|
|
|
font-weight: 600;
|
|
font-weight: 600;
|
|
@@ -765,20 +1014,25 @@
|
|
|
border-bottom: 1px solid #eef2f7;
|
|
border-bottom: 1px solid #eef2f7;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- :deep(.ant-table-tbody > tr > td) {
|
|
|
|
|
|
|
+ .ant-table-tbody > tr > td {
|
|
|
padding: 6px 8px;
|
|
padding: 6px 8px;
|
|
|
font-size: 13px;
|
|
font-size: 13px;
|
|
|
border-bottom: 1px solid #f6f8fa;
|
|
border-bottom: 1px solid #f6f8fa;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- :deep(.ant-table-tbody > tr:hover > td) {
|
|
|
|
|
|
|
+ .ant-table-tbody > tr:hover > td {
|
|
|
background: #f8fafc;
|
|
background: #f8fafc;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- :deep(.ant-table-row-expand-icon) {
|
|
|
|
|
|
|
+ .ant-table-row-expand-icon {
|
|
|
margin-right: 6px;
|
|
margin-right: 6px;
|
|
|
border-radius: 3px;
|
|
border-radius: 3px;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ /* 无子集的行:隐藏展开占位图标(样式块非 scoped,直接用普通选择器) */
|
|
|
|
|
+ .ant-table-row-expand-icon-spaced {
|
|
|
|
|
+ display: none;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
.cell-name {
|
|
.cell-name {
|
|
@@ -790,15 +1044,28 @@
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- .cell-num {
|
|
|
|
|
- font-size: 13px;
|
|
|
|
|
|
|
+ .cell-actions {
|
|
|
|
|
+ display: inline-flex;
|
|
|
|
|
+ align-items: center;
|
|
|
|
|
+ gap: 2px;
|
|
|
|
|
|
|
|
- &.is-success {
|
|
|
|
|
- color: #16a34a;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ .action-link {
|
|
|
|
|
+ padding: 0 4px;
|
|
|
|
|
+ height: 24px;
|
|
|
|
|
+ font-size: 12px;
|
|
|
|
|
+ color: #2563eb;
|
|
|
|
|
|
|
|
- &.is-fail {
|
|
|
|
|
- color: #dc2626;
|
|
|
|
|
|
|
+ &:hover {
|
|
|
|
|
+ color: #1d4ed8;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ &.is-danger {
|
|
|
|
|
+ color: #dc2626;
|
|
|
|
|
+
|
|
|
|
|
+ &:hover {
|
|
|
|
|
+ color: #b91c1c;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|