1、文档新增批量删除
2、文档新增点击文件名预览
This commit is contained in:
@@ -101,7 +101,11 @@
|
|||||||
<a class="action-btn bg-blue-500" @click="openReport(record)"
|
<a class="action-btn bg-blue-500" @click="openReport(record)"
|
||||||
>1 生成审计方案</a
|
>1 生成审计方案</a
|
||||||
>
|
>
|
||||||
<a class="action-btn bg-green-600" @click="openReportContent(record)">2 审计内容</a>
|
<a
|
||||||
|
class="action-btn bg-green-600"
|
||||||
|
@click="openReportContent(record)"
|
||||||
|
>2 审计内容</a
|
||||||
|
>
|
||||||
<a class="action-btn bg-red-600" @click="openReportView(record)"
|
<a class="action-btn bg-red-600" @click="openReportView(record)"
|
||||||
>3 审计报告</a
|
>3 审计报告</a
|
||||||
>
|
>
|
||||||
@@ -114,7 +118,8 @@
|
|||||||
:class="{ 'disabled-text': !record.id }"
|
:class="{ 'disabled-text': !record.id }"
|
||||||
:style="!record.id ? 'cursor: not-allowed; color: #999' : ''"
|
:style="!record.id ? 'cursor: not-allowed; color: #999' : ''"
|
||||||
@click="record.id && openDocManage(record)"
|
@click="record.id && openDocManage(record)"
|
||||||
>文档管理</a>
|
>文档管理</a
|
||||||
|
>
|
||||||
<a class="edit-btn" @click="openEdit(record)">修改</a>
|
<a class="edit-btn" @click="openEdit(record)">修改</a>
|
||||||
<a-popconfirm
|
<a-popconfirm
|
||||||
title="确定要删除此记录吗?"
|
title="确定要删除此记录吗?"
|
||||||
@@ -133,9 +138,17 @@
|
|||||||
<Edit v-model:visible="showEdit" :data="current" @done="reload" />
|
<Edit v-model:visible="showEdit" :data="current" @done="reload" />
|
||||||
<!-- 生成报告 -->
|
<!-- 生成报告 -->
|
||||||
<Report v-model:visible="showReport" :data="current" @done="reload" />
|
<Report v-model:visible="showReport" :data="current" @done="reload" />
|
||||||
<ReportContent v-model:visible="showReportContent" :data="current" @done="reload" />
|
<ReportContent
|
||||||
|
v-model:visible="showReportContent"
|
||||||
|
:data="current"
|
||||||
|
@done="reload"
|
||||||
|
/>
|
||||||
<!-- 审计报告查看 -->
|
<!-- 审计报告查看 -->
|
||||||
<ReportView v-model:visible="showReportView" :data="current" @done="reload" />
|
<ReportView
|
||||||
|
v-model:visible="showReportView"
|
||||||
|
:data="current"
|
||||||
|
@done="reload"
|
||||||
|
/>
|
||||||
<!-- 审计核查弹窗 -->
|
<!-- 审计核查弹窗 -->
|
||||||
<AuditCheck
|
<AuditCheck
|
||||||
v-model:visible="showAuditCheck"
|
v-model:visible="showAuditCheck"
|
||||||
@@ -220,6 +233,17 @@
|
|||||||
<template #icon><UploadOutlined /></template>
|
<template #icon><UploadOutlined /></template>
|
||||||
上传文档
|
上传文档
|
||||||
</a-button>
|
</a-button>
|
||||||
|
<a-button
|
||||||
|
danger
|
||||||
|
:disabled="!selectedDocRows.length"
|
||||||
|
@click="deleteSelectedDocs"
|
||||||
|
>
|
||||||
|
<template #icon><DeleteOutlined /></template>
|
||||||
|
批量删除
|
||||||
|
</a-button>
|
||||||
|
<span v-if="selectedDocRows.length" class="doc-selected-count">
|
||||||
|
已选 {{ selectedDocRows.length }} 个文件
|
||||||
|
</span>
|
||||||
<span class="doc-tips">请选择分类上传资料</span>
|
<span class="doc-tips">请选择分类上传资料</span>
|
||||||
</div>
|
</div>
|
||||||
<a-input-search
|
<a-input-search
|
||||||
@@ -235,6 +259,7 @@
|
|||||||
:dataSource="docList"
|
:dataSource="docList"
|
||||||
:columns="docColumns"
|
:columns="docColumns"
|
||||||
:loading="docLoading"
|
:loading="docLoading"
|
||||||
|
:row-selection="docRowSelection"
|
||||||
rowKey="id"
|
rowKey="id"
|
||||||
:scroll="{ x: 2600, y: 500 }"
|
:scroll="{ x: 2600, y: 500 }"
|
||||||
:pagination="pagination"
|
:pagination="pagination"
|
||||||
@@ -285,17 +310,61 @@
|
|||||||
>
|
>
|
||||||
<a-form :model="docForm" layout="vertical">
|
<a-form :model="docForm" layout="vertical">
|
||||||
<a-row :gutter="16">
|
<a-row :gutter="16">
|
||||||
<a-col :span="12"><a-form-item label="文件名称"><a-input v-model:value="docForm.fileName" /></a-form-item></a-col>
|
<a-col :span="12"
|
||||||
<a-col :span="12"><a-form-item label="制度标题"><a-input v-model:value="docForm.title" /></a-form-item></a-col>
|
><a-form-item label="文件名称"
|
||||||
<a-col :span="12"><a-form-item label="发文字号"><a-input v-model:value="docForm.issueNumber" /></a-form-item></a-col>
|
><a-input v-model:value="docForm.fileName" /></a-form-item
|
||||||
<a-col :span="12"><a-form-item label="版本号"><a-input v-model:value="docForm.version" /></a-form-item></a-col>
|
></a-col>
|
||||||
<a-col :span="12"><a-form-item label="成文日期"><a-date-picker v-model:value="docForm.documentDate" value-format="YYYY-MM-DD" style="width: 100%" /></a-form-item></a-col>
|
<a-col :span="12"
|
||||||
<a-col :span="12"><a-form-item label="生效日期"><a-date-picker v-model:value="docForm.effectiveDate" value-format="YYYY-MM-DD" style="width: 100%" /></a-form-item></a-col>
|
><a-form-item label="制度标题"
|
||||||
<a-col :span="12"><a-form-item label="废止日期"><a-date-picker v-model:value="docForm.abolishDate" value-format="YYYY-MM-DD" style="width: 100%" /></a-form-item></a-col>
|
><a-input v-model:value="docForm.title" /></a-form-item
|
||||||
<a-col :span="12"><a-form-item label="适用业务范围"><a-input v-model:value="docForm.businessScope" /></a-form-item></a-col>
|
></a-col>
|
||||||
<a-col :span="12"><a-form-item label="适用区域"><a-input v-model:value="docForm.region" /></a-form-item></a-col>
|
<a-col :span="12"
|
||||||
<a-col :span="24"><a-form-item label="关联制度"><a-input v-model:value="docForm.relatedDocuments" /></a-form-item></a-col>
|
><a-form-item label="发文字号"
|
||||||
<a-col :span="24"><a-form-item label="备注"><a-textarea v-model:value="docForm.comments" :rows="3" /></a-form-item></a-col>
|
><a-input v-model:value="docForm.issueNumber" /></a-form-item
|
||||||
|
></a-col>
|
||||||
|
<a-col :span="12"
|
||||||
|
><a-form-item label="版本号"
|
||||||
|
><a-input v-model:value="docForm.version" /></a-form-item
|
||||||
|
></a-col>
|
||||||
|
<a-col :span="12"
|
||||||
|
><a-form-item label="成文日期"
|
||||||
|
><a-date-picker
|
||||||
|
v-model:value="docForm.documentDate"
|
||||||
|
value-format="YYYY-MM-DD"
|
||||||
|
style="width: 100%" /></a-form-item
|
||||||
|
></a-col>
|
||||||
|
<a-col :span="12"
|
||||||
|
><a-form-item label="生效日期"
|
||||||
|
><a-date-picker
|
||||||
|
v-model:value="docForm.effectiveDate"
|
||||||
|
value-format="YYYY-MM-DD"
|
||||||
|
style="width: 100%" /></a-form-item
|
||||||
|
></a-col>
|
||||||
|
<a-col :span="12"
|
||||||
|
><a-form-item label="废止日期"
|
||||||
|
><a-date-picker
|
||||||
|
v-model:value="docForm.abolishDate"
|
||||||
|
value-format="YYYY-MM-DD"
|
||||||
|
style="width: 100%" /></a-form-item
|
||||||
|
></a-col>
|
||||||
|
<a-col :span="12"
|
||||||
|
><a-form-item label="适用业务范围"
|
||||||
|
><a-input v-model:value="docForm.businessScope" /></a-form-item
|
||||||
|
></a-col>
|
||||||
|
<a-col :span="12"
|
||||||
|
><a-form-item label="适用区域"
|
||||||
|
><a-input v-model:value="docForm.region" /></a-form-item
|
||||||
|
></a-col>
|
||||||
|
<a-col :span="24"
|
||||||
|
><a-form-item label="关联制度"
|
||||||
|
><a-input v-model:value="docForm.relatedDocuments" /></a-form-item
|
||||||
|
></a-col>
|
||||||
|
<a-col :span="24"
|
||||||
|
><a-form-item label="备注"
|
||||||
|
><a-textarea
|
||||||
|
v-model:value="docForm.comments"
|
||||||
|
:rows="3" /></a-form-item
|
||||||
|
></a-col>
|
||||||
</a-row>
|
</a-row>
|
||||||
</a-form>
|
</a-form>
|
||||||
</a-modal>
|
</a-modal>
|
||||||
@@ -363,7 +432,11 @@
|
|||||||
updateAiCloudDoc,
|
updateAiCloudDoc,
|
||||||
removeAiCloudDoc
|
removeAiCloudDoc
|
||||||
} from '@/api/ai/aiCloudDoc';
|
} from '@/api/ai/aiCloudDoc';
|
||||||
import { pageAiCloudFile, removeAiCloudFile, updateAiCloudFile } from '@/api/ai/aiCloudFile';
|
import {
|
||||||
|
pageAiCloudFile,
|
||||||
|
removeAiCloudFile,
|
||||||
|
updateAiCloudFile
|
||||||
|
} from '@/api/ai/aiCloudFile';
|
||||||
import type { AiCloudDoc } from '@/api/ai/aiCloudDoc/model';
|
import type { AiCloudDoc } from '@/api/ai/aiCloudDoc/model';
|
||||||
import type { AiCloudFile } from '@/api/ai/aiCloudFile/model';
|
import type { AiCloudFile } from '@/api/ai/aiCloudFile/model';
|
||||||
|
|
||||||
@@ -405,6 +478,8 @@
|
|||||||
const docList = ref<AiCloudFile[]>([]); // 文档列表数据改为使用AiCloudFile类型
|
const docList = ref<AiCloudFile[]>([]); // 文档列表数据改为使用AiCloudFile类型
|
||||||
const docLoading = ref(false); // 文档加载状态
|
const docLoading = ref(false); // 文档加载状态
|
||||||
const allDirs = ref<AiCloudDoc[]>([]); // 所有目录列表
|
const allDirs = ref<AiCloudDoc[]>([]); // 所有目录列表
|
||||||
|
const selectedDocRowKeys = ref<(string | number)[]>([]);
|
||||||
|
const selectedDocRows = ref<AiCloudFile[]>([]);
|
||||||
const docSearchForm = ref({
|
const docSearchForm = ref({
|
||||||
fileName: ''
|
fileName: ''
|
||||||
});
|
});
|
||||||
@@ -471,7 +546,7 @@
|
|||||||
|
|
||||||
// 计算树形数据
|
// 计算树形数据
|
||||||
const treeData = computed(() => {
|
const treeData = computed(() => {
|
||||||
const buildTree = (parentId: number = 0): any[] => {
|
const buildTree = (parentId = 0): any[] => {
|
||||||
return allDirs.value
|
return allDirs.value
|
||||||
.filter((item) => item.parentId === parentId)
|
.filter((item) => item.parentId === parentId)
|
||||||
.map((item) => ({
|
.map((item) => ({
|
||||||
@@ -519,7 +594,11 @@
|
|||||||
return allDirs.value.some((item) => item.parentId === dirId);
|
return allDirs.value.some((item) => item.parentId === dirId);
|
||||||
};
|
};
|
||||||
|
|
||||||
const getDocFieldValue = (record: AiCloudFile, keys: string[], fallback = '-') => {
|
const getDocFieldValue = (
|
||||||
|
record: AiCloudFile,
|
||||||
|
keys: string[],
|
||||||
|
fallback = '-'
|
||||||
|
) => {
|
||||||
const row = record as Record<string, any>;
|
const row = record as Record<string, any>;
|
||||||
for (const key of keys) {
|
for (const key of keys) {
|
||||||
const value = row[key];
|
const value = row[key];
|
||||||
@@ -550,6 +629,19 @@
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const resetDocSelection = () => {
|
||||||
|
selectedDocRowKeys.value = [];
|
||||||
|
selectedDocRows.value = [];
|
||||||
|
};
|
||||||
|
|
||||||
|
const docRowSelection = computed(() => ({
|
||||||
|
selectedRowKeys: selectedDocRowKeys.value,
|
||||||
|
onChange: (keys: (string | number)[], rows: AiCloudFile[]) => {
|
||||||
|
selectedDocRowKeys.value = keys;
|
||||||
|
selectedDocRows.value = rows;
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
|
||||||
const docColumns = ref([
|
const docColumns = ref([
|
||||||
{
|
{
|
||||||
title: '文件名称',
|
title: '文件名称',
|
||||||
@@ -585,7 +677,8 @@
|
|||||||
width: 220,
|
width: 220,
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
customRender: ({ record, text }: { record: AiCloudFile; text: any }) =>
|
customRender: ({ record, text }: { record: AiCloudFile; text: any }) =>
|
||||||
text || renderDocText(record, ['version', 'versionNumber', 'versionName'])
|
text ||
|
||||||
|
renderDocText(record, ['version', 'versionNumber', 'versionName'])
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '成文日期(落款日期)',
|
title: '成文日期(落款日期)',
|
||||||
@@ -630,10 +723,16 @@
|
|||||||
width: 260,
|
width: 260,
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
customRender: ({ record, text }: { record: AiCloudFile; text: any }) =>
|
customRender: ({ record, text }: { record: AiCloudFile; text: any }) =>
|
||||||
text || renderDocText(record, ['relatedDocuments', 'relatedDoc', 'relatedFiles'])
|
text ||
|
||||||
|
renderDocText(record, [
|
||||||
|
'relatedDocuments',
|
||||||
|
'relatedDoc',
|
||||||
|
'relatedFiles'
|
||||||
|
])
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '适用区域(全国/广西/南宁市等)如果是公司文档管理的模板,不需要这个字段内容',
|
title:
|
||||||
|
'适用区域(全国/广西/南宁市等)如果是公司文档管理的模板,不需要这个字段内容',
|
||||||
dataIndex: 'region',
|
dataIndex: 'region',
|
||||||
key: 'region',
|
key: 'region',
|
||||||
width: 280,
|
width: 280,
|
||||||
@@ -670,12 +769,6 @@
|
|||||||
showReportView.value = true;
|
showReportView.value = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
// 打开审计核查弹窗
|
|
||||||
const openAuditCheck = (record: PwlProject) => {
|
|
||||||
current.value = record;
|
|
||||||
showAuditCheck.value = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
// 打开文档管理弹窗
|
// 打开文档管理弹窗
|
||||||
const openDocManage = async (record: PwlProject) => {
|
const openDocManage = async (record: PwlProject) => {
|
||||||
currentKbId.value = record.kbId;
|
currentKbId.value = record.kbId;
|
||||||
@@ -688,6 +781,7 @@
|
|||||||
// 重置选择状态
|
// 重置选择状态
|
||||||
expandedKeys.value = [];
|
expandedKeys.value = [];
|
||||||
selectedKeys.value = [];
|
selectedKeys.value = [];
|
||||||
|
resetDocSelection();
|
||||||
|
|
||||||
// 加载目录列表
|
// 加载目录列表
|
||||||
await loadAllCloudDocs(true);
|
await loadAllCloudDocs(true);
|
||||||
@@ -730,6 +824,7 @@
|
|||||||
const onSelect = (keys: (string | number)[], { node }: any) => {
|
const onSelect = (keys: (string | number)[], { node }: any) => {
|
||||||
selectedKeys.value = keys;
|
selectedKeys.value = keys;
|
||||||
pagination.value.current = 1;
|
pagination.value.current = 1;
|
||||||
|
resetDocSelection();
|
||||||
loadCloudFiles();
|
loadCloudFiles();
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -745,11 +840,13 @@
|
|||||||
const handleTableChange = (pag: any) => {
|
const handleTableChange = (pag: any) => {
|
||||||
pagination.value.current = pag.current;
|
pagination.value.current = pag.current;
|
||||||
pagination.value.pageSize = pag.pageSize;
|
pagination.value.pageSize = pag.pageSize;
|
||||||
|
resetDocSelection();
|
||||||
loadCloudFiles();
|
loadCloudFiles();
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleDocSearch = () => {
|
const handleDocSearch = () => {
|
||||||
pagination.value.current = 1;
|
pagination.value.current = 1;
|
||||||
|
resetDocSelection();
|
||||||
loadCloudFiles();
|
loadCloudFiles();
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -760,6 +857,7 @@
|
|||||||
if (!selectedCategoryId.value) {
|
if (!selectedCategoryId.value) {
|
||||||
docList.value = [];
|
docList.value = [];
|
||||||
pagination.value.total = 0;
|
pagination.value.total = 0;
|
||||||
|
resetDocSelection();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -772,6 +870,7 @@
|
|||||||
const result = await pageAiCloudFile(params);
|
const result = await pageAiCloudFile(params);
|
||||||
docList.value = result?.list || [];
|
docList.value = result?.list || [];
|
||||||
pagination.value.total = result?.count || 0;
|
pagination.value.total = result?.count || 0;
|
||||||
|
resetDocSelection();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
message.error('加载文件列表失败');
|
message.error('加载文件列表失败');
|
||||||
console.error('加载文件错误:', error);
|
console.error('加载文件错误:', error);
|
||||||
@@ -794,6 +893,56 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const deleteSelectedDocs = () => {
|
||||||
|
if (!selectedDocRows.value.length) {
|
||||||
|
message.info('请先选择要删除的文件');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Modal.confirm({
|
||||||
|
title: '提示',
|
||||||
|
content: `确定要删除选中的 ${selectedDocRows.value.length} 个文件吗?`,
|
||||||
|
icon: createVNode(ExclamationCircleOutlined),
|
||||||
|
maskClosable: true,
|
||||||
|
onOk: async () => {
|
||||||
|
const currentPageSize = docList.value.length;
|
||||||
|
const ids = selectedDocRows.value
|
||||||
|
.map((item) => item.id)
|
||||||
|
.filter((id): id is number => typeof id === 'number');
|
||||||
|
|
||||||
|
const results = await Promise.allSettled(
|
||||||
|
ids.map((id) => removeAiCloudFile(id))
|
||||||
|
);
|
||||||
|
const successCount = results.filter(
|
||||||
|
(item) => item.status === 'fulfilled'
|
||||||
|
).length;
|
||||||
|
const failedCount = results.length - successCount;
|
||||||
|
|
||||||
|
if (
|
||||||
|
successCount > 0 &&
|
||||||
|
successCount === currentPageSize &&
|
||||||
|
pagination.value.current > 1
|
||||||
|
) {
|
||||||
|
pagination.value.current -= 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (successCount > 0) {
|
||||||
|
await loadCloudFiles();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (failedCount === 0) {
|
||||||
|
message.success(`成功删除 ${successCount} 个文件`);
|
||||||
|
} else if (successCount > 0) {
|
||||||
|
message.warning(
|
||||||
|
`已删除 ${successCount} 个文件,${failedCount} 个删除失败`
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
message.error('批量删除失败');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
const openDocEdit = (record: AiCloudFile) => {
|
const openDocEdit = (record: AiCloudFile) => {
|
||||||
docForm.value = { ...record };
|
docForm.value = { ...record };
|
||||||
showDocEdit.value = true;
|
showDocEdit.value = true;
|
||||||
@@ -1338,8 +1487,8 @@
|
|||||||
.edit-btn {
|
.edit-btn {
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
padding: 3px 10px;
|
padding: 3px 10px;
|
||||||
color: #3B82F6;
|
color: #3b82f6;
|
||||||
border: 1px solid #3B82F6;
|
border: 1px solid #3b82f6;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1352,7 +1501,9 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* 修改已完成步骤的连接线颜色 */
|
/* 修改已完成步骤的连接线颜色 */
|
||||||
.ant-steps-item-wait > .ant-steps-item-container > .ant-steps-item-tail::after {
|
.ant-steps-item-wait
|
||||||
|
> .ant-steps-item-container
|
||||||
|
> .ant-steps-item-tail::after {
|
||||||
background-color: red !important;
|
background-color: red !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1428,6 +1579,11 @@
|
|||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.doc-selected-count {
|
||||||
|
color: #1890ff;
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
.doc-content {
|
.doc-content {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
padding: 16px;
|
padding: 16px;
|
||||||
|
|||||||
@@ -24,7 +24,13 @@
|
|||||||
<template v-if="column.key === 'type'">
|
<template v-if="column.key === 'type'">
|
||||||
<a-tag v-if="record.type === 'biz'" color="blue">行业库</a-tag>
|
<a-tag v-if="record.type === 'biz'" color="blue">行业库</a-tag>
|
||||||
<a-tag v-if="record.type === 'pub'" color="green">公共库</a-tag>
|
<a-tag v-if="record.type === 'pub'" color="green">公共库</a-tag>
|
||||||
<span v-if="!record.type || (record.type !== 'biz' && record.type !== 'pub')">未设置</span>
|
<span
|
||||||
|
v-if="
|
||||||
|
!record.type ||
|
||||||
|
(record.type !== 'biz' && record.type !== 'pub')
|
||||||
|
"
|
||||||
|
>未设置</span
|
||||||
|
>
|
||||||
</template>
|
</template>
|
||||||
<template v-if="column.key === 'image'">
|
<template v-if="column.key === 'image'">
|
||||||
<a-image :src="record.image" :width="50" />
|
<a-image :src="record.image" :width="50" />
|
||||||
@@ -39,9 +45,12 @@
|
|||||||
<a-divider type="vertical" />
|
<a-divider type="vertical" />
|
||||||
<a
|
<a
|
||||||
:class="{ 'disabled-text': !record.kbId }"
|
:class="{ 'disabled-text': !record.kbId }"
|
||||||
:style="!record.kbId ? 'cursor: not-allowed; color: #999' : ''"
|
:style="
|
||||||
|
!record.kbId ? 'cursor: not-allowed; color: #999' : ''
|
||||||
|
"
|
||||||
@click="record.kbId && openDocManage(record)"
|
@click="record.kbId && openDocManage(record)"
|
||||||
>文档管理</a>
|
>文档管理</a
|
||||||
|
>
|
||||||
<a-divider type="vertical" />
|
<a-divider type="vertical" />
|
||||||
<a-popconfirm
|
<a-popconfirm
|
||||||
title="确定要删除此记录吗?"
|
title="确定要删除此记录吗?"
|
||||||
@@ -57,7 +66,11 @@
|
|||||||
</a-card>
|
</a-card>
|
||||||
|
|
||||||
<!-- 编辑弹窗 -->
|
<!-- 编辑弹窗 -->
|
||||||
<PwlProjectLibraryEdit v-model:visible="showEdit" :data="current" @done="reload" />
|
<PwlProjectLibraryEdit
|
||||||
|
v-model:visible="showEdit"
|
||||||
|
:data="current"
|
||||||
|
@done="reload"
|
||||||
|
/>
|
||||||
|
|
||||||
<!-- 文档管理弹窗 -->
|
<!-- 文档管理弹窗 -->
|
||||||
<a-modal
|
<a-modal
|
||||||
@@ -112,10 +125,16 @@
|
|||||||
:load-data="onLoadData"
|
:load-data="onLoadData"
|
||||||
@expand="onExpand"
|
@expand="onExpand"
|
||||||
@select="onSelect"
|
@select="onSelect"
|
||||||
:field-names="{ title: 'name', key: 'id', children: 'children' }"
|
:field-names="{
|
||||||
|
title: 'name',
|
||||||
|
key: 'id',
|
||||||
|
children: 'children'
|
||||||
|
}"
|
||||||
>
|
>
|
||||||
<template #title="{ name, id }">
|
<template #title="{ name, id }">
|
||||||
<span :class="{ 'active-dir': selectedKeys[0] === id }">{{ name }}</span>
|
<span :class="{ 'active-dir': selectedKeys[0] === id }">{{
|
||||||
|
name
|
||||||
|
}}</span>
|
||||||
</template>
|
</template>
|
||||||
</a-tree>
|
</a-tree>
|
||||||
<a-empty v-else :image="simpleImage" description="暂无目录" />
|
<a-empty v-else :image="simpleImage" description="暂无目录" />
|
||||||
@@ -130,6 +149,20 @@
|
|||||||
<template #icon><UploadOutlined /></template>
|
<template #icon><UploadOutlined /></template>
|
||||||
上传文档
|
上传文档
|
||||||
</a-button>
|
</a-button>
|
||||||
|
<a-button
|
||||||
|
danger
|
||||||
|
:disabled="!selectedDocRows.length"
|
||||||
|
@click="deleteSelectedDocs"
|
||||||
|
>
|
||||||
|
<template #icon><DeleteOutlined /></template>
|
||||||
|
批量删除
|
||||||
|
</a-button>
|
||||||
|
<span
|
||||||
|
v-if="selectedDocRows.length"
|
||||||
|
class="doc-selected-count"
|
||||||
|
>
|
||||||
|
已选 {{ selectedDocRows.length }} 个文件
|
||||||
|
</span>
|
||||||
<span class="doc-tips">请选择分类上传资料</span>
|
<span class="doc-tips">请选择分类上传资料</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -138,6 +171,7 @@
|
|||||||
:dataSource="docList"
|
:dataSource="docList"
|
||||||
:columns="docColumns"
|
:columns="docColumns"
|
||||||
:loading="docLoading"
|
:loading="docLoading"
|
||||||
|
:row-selection="docRowSelection"
|
||||||
rowKey="id"
|
rowKey="id"
|
||||||
:scroll="{ x: 2600, y: 500 }"
|
:scroll="{ x: 2600, y: 500 }"
|
||||||
:pagination="pagination"
|
:pagination="pagination"
|
||||||
@@ -145,8 +179,15 @@
|
|||||||
size="middle"
|
size="middle"
|
||||||
>
|
>
|
||||||
<template #bodyCell="{ column, record }">
|
<template #bodyCell="{ column, record }">
|
||||||
|
<template v-if="column.key === 'fileName'">
|
||||||
|
<a @click="openDocPreview(record)">{{
|
||||||
|
renderDocText(record, ['fileName', 'name'])
|
||||||
|
}}</a>
|
||||||
|
</template>
|
||||||
<template v-if="column.key === 'action'">
|
<template v-if="column.key === 'action'">
|
||||||
<a-space>
|
<a-space>
|
||||||
|
<a @click="openDocPreview(record)">预览</a>
|
||||||
|
<a-divider type="vertical" />
|
||||||
<a @click="openDocEdit(record)">编辑</a>
|
<a @click="openDocEdit(record)">编辑</a>
|
||||||
<a-divider type="vertical" />
|
<a-divider type="vertical" />
|
||||||
<a-popconfirm
|
<a-popconfirm
|
||||||
@@ -181,17 +222,62 @@
|
|||||||
>
|
>
|
||||||
<a-form :model="docForm" layout="vertical">
|
<a-form :model="docForm" layout="vertical">
|
||||||
<a-row :gutter="16">
|
<a-row :gutter="16">
|
||||||
<a-col :span="12"><a-form-item label="文件名称"><a-input v-model:value="docForm.fileName" /></a-form-item></a-col>
|
<a-col :span="12"
|
||||||
<a-col :span="12"><a-form-item label="制度标题"><a-input v-model:value="docForm.title" /></a-form-item></a-col>
|
><a-form-item label="文件名称"
|
||||||
<a-col :span="12"><a-form-item label="发文字号"><a-input v-model:value="docForm.issueNumber" /></a-form-item></a-col>
|
><a-input v-model:value="docForm.fileName" /></a-form-item
|
||||||
<a-col :span="12"><a-form-item label="版本号"><a-input v-model:value="docForm.version" /></a-form-item></a-col>
|
></a-col>
|
||||||
<a-col :span="12"><a-form-item label="成文日期"><a-date-picker v-model:value="docForm.documentDate" value-format="YYYY-MM-DD" style="width: 100%" /></a-form-item></a-col>
|
<a-col :span="12"
|
||||||
<a-col :span="12"><a-form-item label="生效日期"><a-date-picker v-model:value="docForm.effectiveDate" value-format="YYYY-MM-DD" style="width: 100%" /></a-form-item></a-col>
|
><a-form-item label="制度标题"
|
||||||
<a-col :span="12"><a-form-item label="废止日期"><a-date-picker v-model:value="docForm.abolishDate" value-format="YYYY-MM-DD" style="width: 100%" /></a-form-item></a-col>
|
><a-input v-model:value="docForm.title" /></a-form-item
|
||||||
<a-col :span="12"><a-form-item label="适用业务范围"><a-input v-model:value="docForm.businessScope" /></a-form-item></a-col>
|
></a-col>
|
||||||
<a-col :span="12"><a-form-item label="适用区域"><a-input v-model:value="docForm.region" /></a-form-item></a-col>
|
<a-col :span="12"
|
||||||
<a-col :span="24"><a-form-item label="关联制度"><a-input v-model:value="docForm.relatedDocuments" /></a-form-item></a-col>
|
><a-form-item label="发文字号"
|
||||||
<a-col :span="24"><a-form-item label="备注"><a-textarea v-model:value="docForm.comments" :rows="3" /></a-form-item></a-col>
|
><a-input v-model:value="docForm.issueNumber" /></a-form-item
|
||||||
|
></a-col>
|
||||||
|
<a-col :span="12"
|
||||||
|
><a-form-item label="版本号"
|
||||||
|
><a-input v-model:value="docForm.version" /></a-form-item
|
||||||
|
></a-col>
|
||||||
|
<a-col :span="12"
|
||||||
|
><a-form-item label="成文日期"
|
||||||
|
><a-date-picker
|
||||||
|
v-model:value="docForm.documentDate"
|
||||||
|
value-format="YYYY-MM-DD"
|
||||||
|
style="width: 100%" /></a-form-item
|
||||||
|
></a-col>
|
||||||
|
<a-col :span="12"
|
||||||
|
><a-form-item label="生效日期"
|
||||||
|
><a-date-picker
|
||||||
|
v-model:value="docForm.effectiveDate"
|
||||||
|
value-format="YYYY-MM-DD"
|
||||||
|
style="width: 100%" /></a-form-item
|
||||||
|
></a-col>
|
||||||
|
<a-col :span="12"
|
||||||
|
><a-form-item label="废止日期"
|
||||||
|
><a-date-picker
|
||||||
|
v-model:value="docForm.abolishDate"
|
||||||
|
value-format="YYYY-MM-DD"
|
||||||
|
style="width: 100%" /></a-form-item
|
||||||
|
></a-col>
|
||||||
|
<a-col :span="12"
|
||||||
|
><a-form-item label="适用业务范围"
|
||||||
|
><a-input v-model:value="docForm.businessScope" /></a-form-item
|
||||||
|
></a-col>
|
||||||
|
<a-col :span="12"
|
||||||
|
><a-form-item label="适用区域"
|
||||||
|
><a-input v-model:value="docForm.region" /></a-form-item
|
||||||
|
></a-col>
|
||||||
|
<a-col :span="24"
|
||||||
|
><a-form-item label="关联制度"
|
||||||
|
><a-input
|
||||||
|
v-model:value="docForm.relatedDocuments" /></a-form-item
|
||||||
|
></a-col>
|
||||||
|
<a-col :span="24"
|
||||||
|
><a-form-item label="备注"
|
||||||
|
><a-textarea
|
||||||
|
v-model:value="docForm.comments"
|
||||||
|
:rows="3" /></a-form-item
|
||||||
|
></a-col>
|
||||||
</a-row>
|
</a-row>
|
||||||
</a-form>
|
</a-form>
|
||||||
</a-modal>
|
</a-modal>
|
||||||
@@ -206,7 +292,10 @@
|
|||||||
>
|
>
|
||||||
<a-form :model="dirForm" layout="vertical">
|
<a-form :model="dirForm" layout="vertical">
|
||||||
<a-form-item label="目录名称">
|
<a-form-item label="目录名称">
|
||||||
<a-input v-model:value="dirForm.name" placeholder="请输入目录名称" />
|
<a-input
|
||||||
|
v-model:value="dirForm.name"
|
||||||
|
placeholder="请输入目录名称"
|
||||||
|
/>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item label="排序号">
|
<a-form-item label="排序号">
|
||||||
<a-input-number
|
<a-input-number
|
||||||
@@ -225,21 +314,42 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { createVNode, ref, computed, h } from 'vue';
|
import { createVNode, ref, computed, h } from 'vue';
|
||||||
import { message, Modal, Empty } from 'ant-design-vue';
|
import { message, Modal, Empty } from 'ant-design-vue';
|
||||||
import { ExclamationCircleOutlined, PlusOutlined, UploadOutlined, EditOutlined, DeleteOutlined } from '@ant-design/icons-vue';
|
import {
|
||||||
|
ExclamationCircleOutlined,
|
||||||
|
PlusOutlined,
|
||||||
|
UploadOutlined,
|
||||||
|
EditOutlined,
|
||||||
|
DeleteOutlined
|
||||||
|
} from '@ant-design/icons-vue';
|
||||||
import type { EleProTable } from 'ele-admin-pro';
|
import type { EleProTable } from 'ele-admin-pro';
|
||||||
import {toDateString} from 'ele-admin-pro';
|
|
||||||
import type {
|
import type {
|
||||||
DatasourceFunction,
|
DatasourceFunction,
|
||||||
ColumnItem
|
ColumnItem
|
||||||
} from 'ele-admin-pro/es/ele-pro-table/types';
|
} from 'ele-admin-pro/es/ele-pro-table/types';
|
||||||
import Search from './components/search.vue';
|
import Search from './components/search.vue';
|
||||||
import PwlProjectLibraryEdit from './components/pwlProjectLibraryEdit.vue';
|
import PwlProjectLibraryEdit from './components/pwlProjectLibraryEdit.vue';
|
||||||
import { pagePwlProjectLibrary, removePwlProjectLibrary, removeBatchPwlProjectLibrary } from '@/api/pwl/pwlProjectLibrary';
|
import {
|
||||||
import type { PwlProjectLibrary, PwlProjectLibraryParam } from '@/api/pwl/pwlProjectLibrary/model';
|
pagePwlProjectLibrary,
|
||||||
|
removePwlProjectLibrary,
|
||||||
|
removeBatchPwlProjectLibrary
|
||||||
|
} from '@/api/pwl/pwlProjectLibrary';
|
||||||
|
import type {
|
||||||
|
PwlProjectLibrary,
|
||||||
|
PwlProjectLibraryParam
|
||||||
|
} from '@/api/pwl/pwlProjectLibrary/model';
|
||||||
import Import2 from '@/views/oa/oaCompany/components/Import2.vue';
|
import Import2 from '@/views/oa/oaCompany/components/Import2.vue';
|
||||||
import { listAiCloudDoc, addAiCloudDoc, updateAiCloudDoc, removeAiCloudDoc } from '@/api/ai/aiCloudDoc';
|
import {
|
||||||
|
listAiCloudDoc,
|
||||||
|
addAiCloudDoc,
|
||||||
|
updateAiCloudDoc,
|
||||||
|
removeAiCloudDoc
|
||||||
|
} from '@/api/ai/aiCloudDoc';
|
||||||
import type { AiCloudDoc } from '@/api/ai/aiCloudDoc/model';
|
import type { AiCloudDoc } from '@/api/ai/aiCloudDoc/model';
|
||||||
import { listAiCloudFile, removeAiCloudFile, updateAiCloudFile } from '@/api/ai/aiCloudFile';
|
import {
|
||||||
|
listAiCloudFile,
|
||||||
|
removeAiCloudFile,
|
||||||
|
updateAiCloudFile
|
||||||
|
} from '@/api/ai/aiCloudFile';
|
||||||
import type { AiCloudFile } from '@/api/ai/aiCloudFile/model';
|
import type { AiCloudFile } from '@/api/ai/aiCloudFile/model';
|
||||||
|
|
||||||
// 表格实例
|
// 表格实例
|
||||||
@@ -269,6 +379,8 @@
|
|||||||
const docList = ref<AiCloudFile[]>([]); // 文档列表数据
|
const docList = ref<AiCloudFile[]>([]); // 文档列表数据
|
||||||
const docLoading = ref(false); // 文档加载状态
|
const docLoading = ref(false); // 文档加载状态
|
||||||
const allDirs = ref<AiCloudDoc[]>([]); // 所有目录列表
|
const allDirs = ref<AiCloudDoc[]>([]); // 所有目录列表
|
||||||
|
const selectedDocRowKeys = ref<(string | number)[]>([]);
|
||||||
|
const selectedDocRows = ref<AiCloudFile[]>([]);
|
||||||
|
|
||||||
// 树形结构相关
|
// 树形结构相关
|
||||||
const expandedKeys = ref<(string | number)[]>([]);
|
const expandedKeys = ref<(string | number)[]>([]);
|
||||||
@@ -313,7 +425,9 @@
|
|||||||
// 计算目录弹窗标题
|
// 计算目录弹窗标题
|
||||||
const dirModalTitle = computed(() => {
|
const dirModalTitle = computed(() => {
|
||||||
const mode = isEditingDir.value ? '编辑' : '新增';
|
const mode = isEditingDir.value ? '编辑' : '新增';
|
||||||
const location = selectedDirName.value ? `在『${selectedDirName.value}』下` : '在根目录下';
|
const location = selectedDirName.value
|
||||||
|
? `在『${selectedDirName.value}』下`
|
||||||
|
: '在根目录下';
|
||||||
return `${mode}目录 - ${location}`;
|
return `${mode}目录 - ${location}`;
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -330,15 +444,17 @@
|
|||||||
|
|
||||||
// 计算树形数据
|
// 计算树形数据
|
||||||
const treeData = computed(() => {
|
const treeData = computed(() => {
|
||||||
const buildTree = (parentId: number = 0): any[] => {
|
const buildTree = (parentId = 0): any[] => {
|
||||||
return allDirs.value
|
return allDirs.value
|
||||||
.filter(item => item.parentId === parentId)
|
.filter((item) => item.parentId === parentId)
|
||||||
.map(item => ({
|
.map((item) => ({
|
||||||
...item,
|
...item,
|
||||||
key: item.id,
|
key: item.id,
|
||||||
title: item.name,
|
title: item.name,
|
||||||
children: buildTree(item.id),
|
children: buildTree(item.id),
|
||||||
isLeaf: allDirs.value.filter(child => child.parentId === item.id).length === 0
|
isLeaf:
|
||||||
|
allDirs.value.filter((child) => child.parentId === item.id)
|
||||||
|
.length === 0
|
||||||
}));
|
}));
|
||||||
};
|
};
|
||||||
return buildTree(0);
|
return buildTree(0);
|
||||||
@@ -348,7 +464,7 @@
|
|||||||
const selectedDirName = computed(() => {
|
const selectedDirName = computed(() => {
|
||||||
if (selectedKeys.value.length === 0) return '';
|
if (selectedKeys.value.length === 0) return '';
|
||||||
const selectedId = selectedKeys.value[0];
|
const selectedId = selectedKeys.value[0];
|
||||||
const dir = allDirs.value.find(item => item.id === selectedId);
|
const dir = allDirs.value.find((item) => item.id === selectedId);
|
||||||
return dir?.name || '';
|
return dir?.name || '';
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -362,14 +478,20 @@
|
|||||||
const selectedDoc = computed(() => {
|
const selectedDoc = computed(() => {
|
||||||
if (selectedKeys.value.length === 0) return null;
|
if (selectedKeys.value.length === 0) return null;
|
||||||
const selectedId = selectedKeys.value[0];
|
const selectedId = selectedKeys.value[0];
|
||||||
const doc = allDirs.value.find(item => item.id === selectedId);
|
const doc = allDirs.value.find((item) => item.id === selectedId);
|
||||||
return doc ? {
|
return doc
|
||||||
|
? {
|
||||||
id: doc.id!,
|
id: doc.id!,
|
||||||
categoryId: doc.categoryId || ''
|
categoryId: doc.categoryId || ''
|
||||||
} : null;
|
}
|
||||||
|
: null;
|
||||||
});
|
});
|
||||||
|
|
||||||
const getDocFieldValue = (record: AiCloudFile, keys: string[], fallback = '-') => {
|
const getDocFieldValue = (
|
||||||
|
record: AiCloudFile,
|
||||||
|
keys: string[],
|
||||||
|
fallback = '-'
|
||||||
|
) => {
|
||||||
const row = record as Record<string, any>;
|
const row = record as Record<string, any>;
|
||||||
for (const key of keys) {
|
for (const key of keys) {
|
||||||
const value = row[key];
|
const value = row[key];
|
||||||
@@ -389,13 +511,77 @@
|
|||||||
if (value === '-') {
|
if (value === '-') {
|
||||||
return '-';
|
return '-';
|
||||||
}
|
}
|
||||||
return h('a', {
|
return h(
|
||||||
|
'a',
|
||||||
|
{
|
||||||
href: String(value),
|
href: String(value),
|
||||||
target: '_blank',
|
target: '_blank',
|
||||||
rel: 'noreferrer'
|
rel: 'noreferrer'
|
||||||
}, String(value));
|
},
|
||||||
|
String(value)
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const resetDocSelection = () => {
|
||||||
|
selectedDocRowKeys.value = [];
|
||||||
|
selectedDocRows.value = [];
|
||||||
|
};
|
||||||
|
|
||||||
|
const getDocFileUrl = (record: AiCloudFile) => {
|
||||||
|
const value = getDocFieldValue(
|
||||||
|
record,
|
||||||
|
['fileUrl', 'downloadUrl', 'url'],
|
||||||
|
''
|
||||||
|
);
|
||||||
|
return value === '-' ? '' : String(value).trim();
|
||||||
|
};
|
||||||
|
|
||||||
|
const getDocFileExt = (record: AiCloudFile) => {
|
||||||
|
const candidates = [
|
||||||
|
record.fileExt,
|
||||||
|
record.fileType,
|
||||||
|
record.fileName,
|
||||||
|
getDocFileUrl(record)
|
||||||
|
].filter(Boolean) as string[];
|
||||||
|
|
||||||
|
for (const item of candidates) {
|
||||||
|
const cleanValue = item.split('?')[0];
|
||||||
|
const ext = cleanValue.includes('.')
|
||||||
|
? cleanValue.split('.').pop()
|
||||||
|
: cleanValue;
|
||||||
|
if (ext) {
|
||||||
|
return ext.toLowerCase().replace(/^\./, '');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
};
|
||||||
|
|
||||||
|
const openDocPreview = (record: AiCloudFile) => {
|
||||||
|
const fileUrl = getDocFileUrl(record);
|
||||||
|
if (!fileUrl) {
|
||||||
|
message.warning('该文件暂无可预览地址');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const ext = getDocFileExt(record);
|
||||||
|
const officePreviewExts = ['doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx'];
|
||||||
|
const previewUrl = officePreviewExts.includes(ext)
|
||||||
|
? `https://view.officeapps.live.com/op/view.aspx?src=${encodeURIComponent(
|
||||||
|
fileUrl
|
||||||
|
)}`
|
||||||
|
: fileUrl;
|
||||||
|
|
||||||
|
window.open(previewUrl, '_blank', 'noopener,noreferrer');
|
||||||
|
};
|
||||||
|
|
||||||
|
const docRowSelection = computed(() => ({
|
||||||
|
selectedRowKeys: selectedDocRowKeys.value,
|
||||||
|
onChange: (keys: (string | number)[], rows: AiCloudFile[]) => {
|
||||||
|
selectedDocRowKeys.value = keys;
|
||||||
|
selectedDocRows.value = rows;
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
|
||||||
// 文档表格列配置
|
// 文档表格列配置
|
||||||
const docColumns = ref([
|
const docColumns = ref([
|
||||||
{
|
{
|
||||||
@@ -404,7 +590,8 @@
|
|||||||
key: 'fileName',
|
key: 'fileName',
|
||||||
width: 180,
|
width: 180,
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
customRender: ({ record }: { record: AiCloudFile }) => renderDocText(record, ['fileName', 'name'])
|
customRender: ({ record }: { record: AiCloudFile }) =>
|
||||||
|
renderDocText(record, ['fileName', 'name'])
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '制度标题',
|
title: '制度标题',
|
||||||
@@ -412,7 +599,8 @@
|
|||||||
key: 'title',
|
key: 'title',
|
||||||
width: 220,
|
width: 220,
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
customRender: ({ record, text }: { record: AiCloudFile; text: any }) => text || renderDocText(record, ['title', 'documentTitle'])
|
customRender: ({ record, text }: { record: AiCloudFile; text: any }) =>
|
||||||
|
text || renderDocText(record, ['title', 'documentTitle'])
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '发文字号',
|
title: '发文字号',
|
||||||
@@ -420,7 +608,8 @@
|
|||||||
key: 'issueNumber',
|
key: 'issueNumber',
|
||||||
width: 160,
|
width: 160,
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
customRender: ({ record, text }: { record: AiCloudFile; text: any }) => text || renderDocText(record, ['issueNumber', 'documentNo', 'fileNo'])
|
customRender: ({ record, text }: { record: AiCloudFile; text: any }) =>
|
||||||
|
text || renderDocText(record, ['issueNumber', 'documentNo', 'fileNo'])
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '版本号(反映当前制度更新状态,如有)',
|
title: '版本号(反映当前制度更新状态,如有)',
|
||||||
@@ -428,7 +617,9 @@
|
|||||||
key: 'version',
|
key: 'version',
|
||||||
width: 220,
|
width: 220,
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
customRender: ({ record, text }: { record: AiCloudFile; text: any }) => text || renderDocText(record, ['version', 'versionNumber', 'versionName'])
|
customRender: ({ record, text }: { record: AiCloudFile; text: any }) =>
|
||||||
|
text ||
|
||||||
|
renderDocText(record, ['version', 'versionNumber', 'versionName'])
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '成文日期(落款日期)',
|
title: '成文日期(落款日期)',
|
||||||
@@ -436,7 +627,8 @@
|
|||||||
key: 'documentDate',
|
key: 'documentDate',
|
||||||
width: 180,
|
width: 180,
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
customRender: ({ record, text }: { record: AiCloudFile; text: any }) => text || renderDocText(record, ['documentDate', 'signDate', 'writeDate'])
|
customRender: ({ record, text }: { record: AiCloudFile; text: any }) =>
|
||||||
|
text || renderDocText(record, ['documentDate', 'signDate', 'writeDate'])
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '生效日期',
|
title: '生效日期',
|
||||||
@@ -444,7 +636,8 @@
|
|||||||
key: 'effectiveDate',
|
key: 'effectiveDate',
|
||||||
width: 160,
|
width: 160,
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
customRender: ({ record, text }: { record: AiCloudFile; text: any }) => text || renderDocText(record, ['effectiveDate'])
|
customRender: ({ record, text }: { record: AiCloudFile; text: any }) =>
|
||||||
|
text || renderDocText(record, ['effectiveDate'])
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '废止日期',
|
title: '废止日期',
|
||||||
@@ -452,7 +645,8 @@
|
|||||||
key: 'abolishDate',
|
key: 'abolishDate',
|
||||||
width: 160,
|
width: 160,
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
customRender: ({ record, text }: { record: AiCloudFile; text: any }) => text || renderDocText(record, ['abolishDate', 'invalidDate'])
|
customRender: ({ record, text }: { record: AiCloudFile; text: any }) =>
|
||||||
|
text || renderDocText(record, ['abolishDate', 'invalidDate'])
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '适用业务范围',
|
title: '适用业务范围',
|
||||||
@@ -460,7 +654,8 @@
|
|||||||
key: 'businessScope',
|
key: 'businessScope',
|
||||||
width: 220,
|
width: 220,
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
customRender: ({ record, text }: { record: AiCloudFile; text: any }) => text || renderDocText(record, ['businessScope'])
|
customRender: ({ record, text }: { record: AiCloudFile; text: any }) =>
|
||||||
|
text || renderDocText(record, ['businessScope'])
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '关联制度(与本制度相关的其他文件,如新旧制度间的关联文件)',
|
title: '关联制度(与本制度相关的其他文件,如新旧制度间的关联文件)',
|
||||||
@@ -468,15 +663,23 @@
|
|||||||
key: 'relatedDocuments',
|
key: 'relatedDocuments',
|
||||||
width: 260,
|
width: 260,
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
customRender: ({ record, text }: { record: AiCloudFile; text: any }) => text || renderDocText(record, ['relatedDocuments', 'relatedDoc', 'relatedFiles'])
|
customRender: ({ record, text }: { record: AiCloudFile; text: any }) =>
|
||||||
|
text ||
|
||||||
|
renderDocText(record, [
|
||||||
|
'relatedDocuments',
|
||||||
|
'relatedDoc',
|
||||||
|
'relatedFiles'
|
||||||
|
])
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '适用区域(全国/广西/南宁市等)如果是公司文档管理的模板,不需要这个字段内容',
|
title:
|
||||||
|
'适用区域(全国/广西/南宁市等)如果是公司文档管理的模板,不需要这个字段内容',
|
||||||
dataIndex: 'region',
|
dataIndex: 'region',
|
||||||
key: 'region',
|
key: 'region',
|
||||||
width: 280,
|
width: 280,
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
customRender: ({ record, text }: { record: AiCloudFile; text: any }) => text || renderDocText(record, ['region', 'applyRegion'])
|
customRender: ({ record, text }: { record: AiCloudFile; text: any }) =>
|
||||||
|
text || renderDocText(record, ['region', 'applyRegion'])
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '下载链接',
|
title: '下载链接',
|
||||||
@@ -484,7 +687,8 @@
|
|||||||
key: 'fileUrl',
|
key: 'fileUrl',
|
||||||
width: 220,
|
width: 220,
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
customRender: ({ record }: { record: AiCloudFile }) => renderDocLink(record, ['fileUrl', 'downloadUrl', 'url'])
|
customRender: ({ record }: { record: AiCloudFile }) =>
|
||||||
|
renderDocLink(record, ['fileUrl', 'downloadUrl', 'url'])
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '备注',
|
title: '备注',
|
||||||
@@ -526,19 +730,19 @@
|
|||||||
dataIndex: 'id',
|
dataIndex: 'id',
|
||||||
key: 'id',
|
key: 'id',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
width: 90,
|
width: 90
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '资料库',
|
title: '资料库',
|
||||||
dataIndex: 'name',
|
dataIndex: 'name',
|
||||||
key: 'name',
|
key: 'name',
|
||||||
align: 'center',
|
align: 'center'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '类型',
|
title: '类型',
|
||||||
dataIndex: 'type',
|
dataIndex: 'type',
|
||||||
key: 'type',
|
key: 'type',
|
||||||
align: 'center',
|
align: 'center'
|
||||||
},
|
},
|
||||||
// {
|
// {
|
||||||
// title: '关联知识库ID',
|
// title: '关联知识库ID',
|
||||||
@@ -574,7 +778,7 @@
|
|||||||
title: '排序',
|
title: '排序',
|
||||||
dataIndex: 'sort',
|
dataIndex: 'sort',
|
||||||
key: 'sort',
|
key: 'sort',
|
||||||
align: 'center',
|
align: 'center'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '操作',
|
title: '操作',
|
||||||
@@ -614,6 +818,7 @@
|
|||||||
// 重置选择状态
|
// 重置选择状态
|
||||||
expandedKeys.value = [];
|
expandedKeys.value = [];
|
||||||
selectedKeys.value = [];
|
selectedKeys.value = [];
|
||||||
|
resetDocSelection();
|
||||||
|
|
||||||
// 加载目录列表
|
// 加载目录列表
|
||||||
await loadAllCloudDocs(true);
|
await loadAllCloudDocs(true);
|
||||||
@@ -631,7 +836,7 @@
|
|||||||
if (resetState) {
|
if (resetState) {
|
||||||
// 默认展开根节点并选中第一个目录
|
// 默认展开根节点并选中第一个目录
|
||||||
if (allDirs.value.length > 0) {
|
if (allDirs.value.length > 0) {
|
||||||
const rootDirs = allDirs.value.filter(item => item.parentId === 0);
|
const rootDirs = allDirs.value.filter((item) => item.parentId === 0);
|
||||||
if (rootDirs.length > 0) {
|
if (rootDirs.length > 0) {
|
||||||
expandedKeys.value = [rootDirs[0].id!];
|
expandedKeys.value = [rootDirs[0].id!];
|
||||||
selectedKeys.value = [rootDirs[0].id!];
|
selectedKeys.value = [rootDirs[0].id!];
|
||||||
@@ -654,6 +859,7 @@
|
|||||||
const onSelect = (keys: (string | number)[], { node }: any) => {
|
const onSelect = (keys: (string | number)[], { node }: any) => {
|
||||||
selectedKeys.value = keys;
|
selectedKeys.value = keys;
|
||||||
pagination.value.current = 1;
|
pagination.value.current = 1;
|
||||||
|
resetDocSelection();
|
||||||
loadCloudFiles();
|
loadCloudFiles();
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -678,6 +884,7 @@
|
|||||||
if (!selectedCategoryId.value) {
|
if (!selectedCategoryId.value) {
|
||||||
docList.value = [];
|
docList.value = [];
|
||||||
pagination.value.total = 0;
|
pagination.value.total = 0;
|
||||||
|
resetDocSelection();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -695,6 +902,7 @@
|
|||||||
docList.value = result || [];
|
docList.value = result || [];
|
||||||
pagination.value.total = docList.value.length;
|
pagination.value.total = docList.value.length;
|
||||||
}
|
}
|
||||||
|
resetDocSelection();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
message.error('加载文件列表失败');
|
message.error('加载文件列表失败');
|
||||||
console.error('加载文件错误:', error);
|
console.error('加载文件错误:', error);
|
||||||
@@ -715,6 +923,56 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const deleteSelectedDocs = () => {
|
||||||
|
if (!selectedDocRows.value.length) {
|
||||||
|
message.info('请先选择要删除的文件');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Modal.confirm({
|
||||||
|
title: '提示',
|
||||||
|
content: `确定要删除选中的 ${selectedDocRows.value.length} 个文件吗?`,
|
||||||
|
icon: createVNode(ExclamationCircleOutlined),
|
||||||
|
maskClosable: true,
|
||||||
|
onOk: async () => {
|
||||||
|
const currentPageSize = docList.value.length;
|
||||||
|
const ids = selectedDocRows.value
|
||||||
|
.map((item) => item.id)
|
||||||
|
.filter((id): id is number => typeof id === 'number');
|
||||||
|
|
||||||
|
const results = await Promise.allSettled(
|
||||||
|
ids.map((id) => removeAiCloudFile(id))
|
||||||
|
);
|
||||||
|
const successCount = results.filter(
|
||||||
|
(item) => item.status === 'fulfilled'
|
||||||
|
).length;
|
||||||
|
const failedCount = results.length - successCount;
|
||||||
|
|
||||||
|
if (
|
||||||
|
successCount > 0 &&
|
||||||
|
successCount === currentPageSize &&
|
||||||
|
pagination.value.current > 1
|
||||||
|
) {
|
||||||
|
pagination.value.current -= 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (successCount > 0) {
|
||||||
|
await loadCloudFiles();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (failedCount === 0) {
|
||||||
|
message.success(`成功删除 ${successCount} 个文件`);
|
||||||
|
} else if (successCount > 0) {
|
||||||
|
message.warning(
|
||||||
|
`已删除 ${successCount} 个文件,${failedCount} 个删除失败`
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
message.error('批量删除失败');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
const openDocEdit = (record: AiCloudFile) => {
|
const openDocEdit = (record: AiCloudFile) => {
|
||||||
docForm.value = { ...record };
|
docForm.value = { ...record };
|
||||||
showDocEdit.value = true;
|
showDocEdit.value = true;
|
||||||
@@ -770,7 +1028,9 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const selectedDir = allDirs.value.find(item => item.id === selectedKeys.value[0]);
|
const selectedDir = allDirs.value.find(
|
||||||
|
(item) => item.id === selectedKeys.value[0]
|
||||||
|
);
|
||||||
if (!selectedDir) {
|
if (!selectedDir) {
|
||||||
message.error('未找到选中的目录');
|
message.error('未找到选中的目录');
|
||||||
return;
|
return;
|
||||||
@@ -790,7 +1050,9 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const selectedDir = allDirs.value.find(item => item.id === selectedKeys.value[0]);
|
const selectedDir = allDirs.value.find(
|
||||||
|
(item) => item.id === selectedKeys.value[0]
|
||||||
|
);
|
||||||
if (!selectedDir) {
|
if (!selectedDir) {
|
||||||
message.error('未找到选中的目录');
|
message.error('未找到选中的目录');
|
||||||
return;
|
return;
|
||||||
@@ -851,9 +1113,11 @@
|
|||||||
|
|
||||||
// 删除目录
|
// 删除目录
|
||||||
const deleteDir = async (dirId: number, dirName: string) => {
|
const deleteDir = async (dirId: number, dirName: string) => {
|
||||||
const hasChildren = allDirs.value.some(item => item.parentId === dirId);
|
const hasChildren = allDirs.value.some((item) => item.parentId === dirId);
|
||||||
if (hasChildren) {
|
if (hasChildren) {
|
||||||
message.error(`目录「${dirName}」包含子目录,无法删除。请先删除该目录下的所有子目录。`);
|
message.error(
|
||||||
|
`目录「${dirName}」包含子目录,无法删除。请先删除该目录下的所有子目录。`
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -881,7 +1145,6 @@
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/* 删除单个 */
|
/* 删除单个 */
|
||||||
const remove = (row: PwlProjectLibrary) => {
|
const remove = (row: PwlProjectLibrary) => {
|
||||||
const hide = message.loading('请求中..', 0);
|
const hide = message.loading('请求中..', 0);
|
||||||
@@ -1015,6 +1278,11 @@
|
|||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.doc-selected-count {
|
||||||
|
color: #1890ff;
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
.doc-content {
|
.doc-content {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
padding: 16px;
|
padding: 16px;
|
||||||
|
|||||||
Reference in New Issue
Block a user