|
|
@@ -101,8 +101,11 @@
|
|
|
|
|
|
<!-- 文档列表 -->
|
|
|
<el-table v-loading="documentLoading" :data="documentList" border style="margin-top: 10px">
|
|
|
- <el-table-column type="index" width="55" align="center"
|
|
|
- :label="t('document.document.documentList.index')" />
|
|
|
+ <el-table-column prop="id" width="55" align="center" :label="t('document.document.documentList.index')">
|
|
|
+ <template #default="scope">
|
|
|
+ {{ scope.row.id }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
<el-table-column prop="name" :label="t('document.document.documentList.name')" min-width="150"
|
|
|
show-overflow-tooltip />
|
|
|
<el-table-column prop="specification" :label="t('document.document.documentList.specification')"
|
|
|
@@ -184,7 +187,7 @@
|
|
|
<template #default="scope">
|
|
|
<!-- 审核按钮 -->
|
|
|
<el-button v-if="scope.row.url && scope.row.status === 1" v-hasPermi="['document:document:audit']"
|
|
|
- type="primary" link :icon="Select" @click="handleAudit(scope.row)"
|
|
|
+ type="primary" link :icon="Select" @click="handleAuditClick(scope.row)"
|
|
|
:title="t('document.document.button.audit')" />
|
|
|
|
|
|
<!-- 递交按钮 -->
|
|
|
@@ -208,6 +211,11 @@
|
|
|
<!-- 查看审核记录按钮 -->
|
|
|
<el-button v-hasPermi="['document:document:logAudit']" type="primary" link icon="DocumentCopy"
|
|
|
@click="handleViewAuditLog(scope.row)" :title="t('document.document.button.viewAuditLog')" />
|
|
|
+
|
|
|
+ <!-- 归档按钮 -->
|
|
|
+ <el-button v-if="scope.row.status === 3" v-hasPermi="['document:document:filing']" type="primary" link
|
|
|
+ icon="UploadFilled" @click="handleArchive(scope.row)"
|
|
|
+ :title="t('document.document.button.archive')" />
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
@@ -271,18 +279,14 @@
|
|
|
</el-radio-group>
|
|
|
</el-form-item>
|
|
|
|
|
|
- <el-form-item :label="t('document.document.documentForm.submitter')" prop="submitterId">
|
|
|
- <template v-if="documentForm.type === 0">
|
|
|
- <el-input v-model="currentUserName" disabled />
|
|
|
- </template>
|
|
|
- <template v-else>
|
|
|
- <el-select v-model="documentForm.submitterId" filterable remote reserve-keyword
|
|
|
- :placeholder="t('document.document.documentForm.submitterPlaceholder')" :remote-method="searchSubmitters"
|
|
|
- :loading="submitterSearchLoading" style="width: 100%">
|
|
|
- <el-option v-for="submitter in submitterOptions" :key="submitter.id"
|
|
|
- :label="`${submitter.name} / ${submitter.dept} --- ${submitter.phoneNumber}`" :value="submitter.id" />
|
|
|
- </el-select>
|
|
|
- </template>
|
|
|
+ <el-form-item v-if="documentForm.type === 1" :label="t('document.document.documentForm.submitter')"
|
|
|
+ prop="submitterId">
|
|
|
+ <el-select v-model="documentForm.submitterId" filterable remote reserve-keyword
|
|
|
+ :placeholder="t('document.document.documentForm.submitterPlaceholder')" :remote-method="searchSubmitters"
|
|
|
+ :loading="submitterSearchLoading" style="width: 100%">
|
|
|
+ <el-option v-for="submitter in submitterOptions" :key="submitter.id"
|
|
|
+ :label="`${submitter.name} / ${submitter.dept} --- ${submitter.phoneNumber}`" :value="submitter.id" />
|
|
|
+ </el-select>
|
|
|
</el-form-item>
|
|
|
|
|
|
<el-form-item v-if="documentForm.type === 1" :label="t('document.document.documentForm.submitDeadline')"
|
|
|
@@ -340,29 +344,6 @@
|
|
|
</template>
|
|
|
</el-dialog>
|
|
|
|
|
|
- <!-- 审核文档对话框 -->
|
|
|
- <el-dialog v-model="auditDialog.visible" :title="auditDialog.title" width="500px" append-to-body>
|
|
|
- <el-form ref="auditFormRef" :model="auditForm" :rules="auditRules" label-width="120px">
|
|
|
- <el-form-item :label="t('document.document.auditForm.result')" prop="result">
|
|
|
- <el-radio-group v-model="auditForm.result">
|
|
|
- <el-radio label="3">{{ t('document.document.auditForm.pass') }}</el-radio>
|
|
|
- <el-radio label="2">{{ t('document.document.auditForm.reject') }}</el-radio>
|
|
|
- </el-radio-group>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item v-if="auditForm.result === '2'" :label="t('document.document.auditForm.reason')" prop="reason">
|
|
|
- <el-input v-model="auditForm.reason" type="textarea" :rows="4"
|
|
|
- placeholder="{{ t('document.document.auditForm.reasonPlaceholder') }}" />
|
|
|
- </el-form-item>
|
|
|
- </el-form>
|
|
|
- <template #footer>
|
|
|
- <div class="dialog-footer">
|
|
|
- <el-button :loading="auditButtonLoading" type="primary" @click="submitAuditForm">{{
|
|
|
- t('document.document.button.submit') }}</el-button>
|
|
|
- <el-button @click="cancelAudit">{{ t('document.document.button.cancel') }}</el-button>
|
|
|
- </div>
|
|
|
- </template>
|
|
|
- </el-dialog>
|
|
|
-
|
|
|
<!-- 递交文档对话框 -->
|
|
|
<el-dialog v-model="submitDialog.visible" :title="submitDialog.title" width="500px" append-to-body>
|
|
|
<el-form ref="submitFormRef" :model="submitForm" :rules="submitRules" label-width="120px">
|
|
|
@@ -381,6 +362,14 @@
|
|
|
|
|
|
<!-- 文档审核记录对话框 -->
|
|
|
<DocumentAuditLog v-model:visible="auditLogDialog.visible" :document-id="auditLogDialog.documentId" />
|
|
|
+
|
|
|
+ <!-- 归档确认对话框 -->
|
|
|
+ <ArchiveConfirmDialog v-model="archiveDialog.visible" :document="archiveDialog.currentDocument"
|
|
|
+ @confirm="handleArchiveConfirm" />
|
|
|
+
|
|
|
+ <!-- 审核文档对话框 -->
|
|
|
+ <DocumentAuditDialog v-model="auditDialog.visible" :document="auditDialog.document"
|
|
|
+ :title="t('document.document.dialog.auditDocument')" @success="getDocumentList" />
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
@@ -389,17 +378,19 @@ import { ref, reactive, onMounted, onUnmounted, nextTick, getCurrentInstance, wa
|
|
|
import { useI18n } from 'vue-i18n';
|
|
|
import { listFolder, addFolder, delFolder, getFolder, updateFolder } from '@/api/document/folder';
|
|
|
import { FolderListVO, FolderForm } from '@/api/document/folder/types';
|
|
|
-import { addDocument, listDocument, markDocument, auditDocument, submitDocument, confirmSubmit, listDocumentAuditLog } from '@/api/document/document';
|
|
|
+import { addDocument, listDocument, markDocument, auditDocument, submitDocument, confirmSubmit, listDocumentAuditLog, filingDocument } from '@/api/document/document';
|
|
|
import { DocumentForm, DocumentQuery, DocumentVO, DocumentMarkForm, DocumentAuditForm, DocumentSubmitForm, DocumentAuditLogVO, DocumentAuditLogQuery } from '@/api/document/document/types'; import { queryMemberNotInCenter } from '@/api/project/management';
|
|
|
import { MemberNotInCenterVO, MemberNotInCenterQuery } from '@/api/project/management/types';
|
|
|
-import { Folder, Document, Edit, Delete, Plus, MoreFilled, Location, OfficeBuilding, ArrowRight, Download, Select, Grid, Monitor, Reading, Flag, Upload } from '@element-plus/icons-vue';
|
|
|
+import { Folder, Document, Edit, Delete, Plus, MoreFilled, Location, OfficeBuilding, ArrowRight, Download, Select, Grid, Monitor, Reading, Flag, Upload, UploadFilled } from '@element-plus/icons-vue';
|
|
|
import { ElMessage, ElMessageBox } from 'element-plus';
|
|
|
import type { FormInstance } from 'element-plus';
|
|
|
import type { ComponentInternalInstance } from 'vue';
|
|
|
import { useUserStore } from '@/store/modules/user';
|
|
|
import { checkPermi } from '@/utils/permission';
|
|
|
import fileUpload from '@/components/FileUpload/index.vue';
|
|
|
-import DocumentAuditLog from './components/documentAuditLog.vue';
|
|
|
+import DocumentAuditLog from './document/components/DocumentAuditLog.vue';
|
|
|
+import ArchiveConfirmDialog from './document/components/ArchiveConfirmDialog.vue';
|
|
|
+import DocumentAuditDialog from './document/components/DocumentAuditDialog.vue';
|
|
|
|
|
|
interface Props {
|
|
|
projectId?: number | string;
|
|
|
@@ -436,6 +427,12 @@ const auditLogDialog = reactive({
|
|
|
documentId: ''
|
|
|
});
|
|
|
|
|
|
+// 归档对话框
|
|
|
+const archiveDialog = reactive({
|
|
|
+ visible: false,
|
|
|
+ currentDocument: null as DocumentVO | null
|
|
|
+});
|
|
|
+
|
|
|
// 对话框
|
|
|
const dialog = reactive({
|
|
|
visible: false,
|
|
|
@@ -459,15 +456,7 @@ const markDialog = reactive({
|
|
|
const markFormRef = ref<FormInstance>();
|
|
|
const markButtonLoading = ref(false);
|
|
|
|
|
|
-// 审核文档对话框
|
|
|
-const auditDialog = reactive({
|
|
|
- visible: false,
|
|
|
- title: ''
|
|
|
-});
|
|
|
|
|
|
-// 审核表单ref
|
|
|
-const auditFormRef = ref<FormInstance>();
|
|
|
-const auditButtonLoading = ref(false);
|
|
|
|
|
|
// 当前操作的节点
|
|
|
const currentNode = ref<FolderListVO | null>(null);
|
|
|
@@ -502,6 +491,7 @@ const initDocumentFormData: DocumentForm = {
|
|
|
planType: undefined,
|
|
|
ossId: undefined,
|
|
|
submitTime: undefined,
|
|
|
+ projectId: props.projectId,
|
|
|
note: ''
|
|
|
};
|
|
|
|
|
|
@@ -517,36 +507,7 @@ const markForm = ref<DocumentMarkForm>({
|
|
|
type: ''
|
|
|
});
|
|
|
|
|
|
-// 审核表单数据
|
|
|
-interface AuditForm {
|
|
|
- id: number;
|
|
|
- result: string; // 3: 通过, 2: reject
|
|
|
- reason: string; // reject reason
|
|
|
-}
|
|
|
|
|
|
-const auditForm = ref<AuditForm>({
|
|
|
- id: 0,
|
|
|
- result: '3', // 默认通过
|
|
|
- reason: ''
|
|
|
-});
|
|
|
-
|
|
|
-// 审核表单验证规则
|
|
|
-const auditRules = reactive({
|
|
|
- result: [
|
|
|
- {
|
|
|
- required: true,
|
|
|
- message: t('document.document.auditRule.resultRequired'),
|
|
|
- trigger: 'change'
|
|
|
- }
|
|
|
- ],
|
|
|
- reason: [
|
|
|
- {
|
|
|
- required: true,
|
|
|
- message: t('document.document.auditRule.reasonRequired'),
|
|
|
- trigger: 'blur'
|
|
|
- }
|
|
|
- ]
|
|
|
-});
|
|
|
|
|
|
// 递交文档对话框
|
|
|
const submitDialog = reactive({
|
|
|
@@ -578,9 +539,15 @@ const submitRules = reactive({
|
|
|
]
|
|
|
});
|
|
|
|
|
|
-// 当前选中的文档
|
|
|
+// 当前操作的文档
|
|
|
const currentDocument = ref<DocumentVO | null>(null);
|
|
|
|
|
|
+// 审核对话框状态
|
|
|
+const auditDialog = reactive({
|
|
|
+ visible: false,
|
|
|
+ document: null as DocumentVO | null
|
|
|
+});
|
|
|
+
|
|
|
// 递交人搜索相关
|
|
|
const submitterSearchLoading = ref(false);
|
|
|
const submitterOptions = ref<MemberNotInCenterVO[]>([]);
|
|
|
@@ -1015,6 +982,7 @@ const resetDocumentForm = () => {
|
|
|
documentForm.value.type = 0;
|
|
|
}
|
|
|
documentForm.value.submitterId = userStore.userId;
|
|
|
+ documentForm.value.projectId = props.projectId;
|
|
|
currentUserName.value = userStore.nickname || '';
|
|
|
submitterOptions.value = [];
|
|
|
documentFormRef.value?.resetFields();
|
|
|
@@ -1085,8 +1053,11 @@ watch(uploadedFileId, (newVal) => {
|
|
|
// 自动设置递交时间为当前时间
|
|
|
const now = new Date();
|
|
|
documentForm.value.submitTime = proxy?.parseTime(now, '{y}-{m}-{d} {h}:{i}:{s}');
|
|
|
- // 自动设置递交人为当前用户
|
|
|
- documentForm.value.submitterId = userStore.userId;
|
|
|
+
|
|
|
+ // 对于非计划文档,自动设置递交人为当前用户
|
|
|
+ if (documentForm.value.type === 0) {
|
|
|
+ documentForm.value.submitterId = userStore.userId;
|
|
|
+ }
|
|
|
}
|
|
|
} else {
|
|
|
documentForm.value.ossId = undefined;
|
|
|
@@ -1115,12 +1086,13 @@ const submitDocumentForm = () => {
|
|
|
id: documentForm.value.id || 0,
|
|
|
name: documentForm.value.name || '',
|
|
|
type: documentForm.value.type !== undefined ? documentForm.value.type : 0,
|
|
|
- submitterId: documentForm.value.submitterId || 0,
|
|
|
+ submitterId: documentForm.value.submitterId || (documentForm.value.type === 0 ? userStore.userId : 0),
|
|
|
folderId: documentForm.value.folderId || 0,
|
|
|
submitDeadline: documentForm.value.submitDeadline || '',
|
|
|
planType: documentForm.value.planType || '',
|
|
|
ossId: hasUploadedFile ? uploadedFileId.value : null,
|
|
|
- submitTime: hasUploadedFile ? new Date().toISOString() : '',
|
|
|
+ submitTime: documentForm.value.submitTime || (hasUploadedFile ? new Date().toISOString() : ''),
|
|
|
+ projectId: documentForm.value.projectId || props.projectId,
|
|
|
status: hasUploadedFile ? 1 : 0,
|
|
|
note: documentForm.value.note || ''
|
|
|
};
|
|
|
@@ -1196,57 +1168,13 @@ const handleViewAuditLog = (row: DocumentVO) => {
|
|
|
auditLogDialog.visible = true;
|
|
|
};
|
|
|
|
|
|
-// 审核文档
|
|
|
-const handleAudit = (row: DocumentVO) => {
|
|
|
- currentDocument.value = row;
|
|
|
- auditForm.value = {
|
|
|
- id: row.id,
|
|
|
- result: '3', // 默认通过
|
|
|
- reason: ''
|
|
|
- };
|
|
|
+// 审核按钮点击事件
|
|
|
+const handleAuditClick = (row: DocumentVO) => {
|
|
|
+ auditDialog.document = row;
|
|
|
auditDialog.visible = true;
|
|
|
- auditDialog.title = t('document.document.dialog.auditDocument');
|
|
|
- // 重置表单验证
|
|
|
- nextTick(() => {
|
|
|
- auditFormRef.value?.clearValidate();
|
|
|
- });
|
|
|
};
|
|
|
|
|
|
-// 取消审核
|
|
|
-const cancelAudit = () => {
|
|
|
- auditDialog.visible = false;
|
|
|
- auditForm.value = {
|
|
|
- id: 0,
|
|
|
- result: '3',
|
|
|
- reason: ''
|
|
|
- };
|
|
|
- currentDocument.value = null;
|
|
|
-};
|
|
|
|
|
|
-// 提交审核表单
|
|
|
-const submitAuditForm = () => {
|
|
|
- auditFormRef.value?.validate(async (valid: boolean) => {
|
|
|
- if (valid) {
|
|
|
- auditButtonLoading.value = true;
|
|
|
- try {
|
|
|
- const auditData: DocumentAuditForm = {
|
|
|
- documentId: auditForm.value.id,
|
|
|
- result: parseInt(auditForm.value.result),
|
|
|
- rejectReason: auditForm.value.reason
|
|
|
- };
|
|
|
- await auditDocument(auditData);
|
|
|
- proxy?.$modal.msgSuccess(t('document.document.message.auditSuccess'));
|
|
|
- auditDialog.visible = false;
|
|
|
- // 刷新文档列表
|
|
|
- await getDocumentList();
|
|
|
- } catch (error) {
|
|
|
- console.error(t('document.document.message.auditFailed'), error);
|
|
|
- } finally {
|
|
|
- auditButtonLoading.value = false;
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
-};
|
|
|
|
|
|
// 下载文档
|
|
|
const handleDownload = (row: DocumentVO) => {
|
|
|
@@ -1336,6 +1264,28 @@ const handleConfirmSubmit = async (row: DocumentVO) => {
|
|
|
}
|
|
|
};
|
|
|
|
|
|
+// 归档文档
|
|
|
+const handleArchive = (row: DocumentVO) => {
|
|
|
+ archiveDialog.currentDocument = row;
|
|
|
+ archiveDialog.visible = true;
|
|
|
+};
|
|
|
+
|
|
|
+// 处理归档确认
|
|
|
+const handleArchiveConfirm = async (row: DocumentVO) => {
|
|
|
+ try {
|
|
|
+ // 调用归档API
|
|
|
+ await filingDocument(row.id);
|
|
|
+ ElMessage.success(t('document.document.message.archiveSuccess'));
|
|
|
+ // 关闭对话框
|
|
|
+ archiveDialog.visible = false;
|
|
|
+ // 刷新文档列表
|
|
|
+ await getDocumentList();
|
|
|
+ } catch (error) {
|
|
|
+ console.error(t('document.document.message.archiveFailed'), error);
|
|
|
+ ElMessage.error(t('document.document.message.archiveFailed'));
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
// 标识文档
|
|
|
const handleMark = (row: DocumentVO) => {
|
|
|
currentDocument.value = row;
|