Add dormitory forms and archive department settings

This commit is contained in:
biss committed 2026-11-20 20:38:50 +08:00
1 parent 53fd0db7b1
commit e4cfd299d1
12 files changed
+13067 -8

No files matched your search

+32 -1
View File
@@ -133,6 +133,9 @@ const approveTarget = ref<any>(null);
const approveComment = ref("");
const reviewInProgress = ref(false);
const workflowDialog = ref(false);
const archiveSettingsDialog = ref(false);
const archiveSettings = ref<{ type: string; departmentsText: string }[]>([]);
const archiveSaving = ref("");
const workflowSettings = ref<{ type: string; reviewerRole: string }[]>([]);
const workflowSaving = ref("");
const attachmentSettingsDialog = ref(false);
@@ -498,6 +501,25 @@ async function openWorkflowSettings() {
}
}
async function openArchiveSettings() {
try {
const { data } = await http.get('/approval-archive-settings');
archiveSettings.value = data.map((item: { type: string; departments: string[] }) => ({ type: item.type, departmentsText: item.departments.join('、') }));
archiveSettingsDialog.value = true;
} catch (e) { ElMessage.error(apiErrorMessage(e)); }
}
async function saveArchiveSettings(item: any) {
archiveSaving.value = item.type;
try {
const departments = (item.departmentsText as string).split(/[、,,\n]/).map(x => x.trim()).filter(Boolean);
await http.put(`/approval-archive-settings/${item.type}`, { departments });
item.departmentsText = [...new Set(departments)].join('、');
ElMessage.success(attachmentText('设置已保存', 'Settings saved'));
} catch (e) { ElMessage.error(apiErrorMessage(e)); }
finally { archiveSaving.value = ''; }
}
async function openAttachmentSettings() {
try {
attachmentPolicies.value = (await http.get('/approval-attachment-policies')).data;
@@ -828,6 +850,7 @@ onMounted(async () => {
</div>
<div>
<el-button v-if="isSuperAdmin" @click="openAttachmentSettings">{{ attachmentText('附件规则', 'Attachment rules') }}</el-button>
<el-button v-if="isSuperAdmin" @click="openArchiveSettings">{{ attachmentText('存档部门', 'Archive departments') }}</el-button>
<el-button v-if="isSuperAdmin" @click="openWorkflowSettings">{{
t("approvalCenterExtra.settings")
}}</el-button>
@@ -837,6 +860,14 @@ onMounted(async () => {
</div>
</section>
<el-dialog v-model="archiveSettingsDialog" :title="attachmentText('申请表存档部门', 'Form archive departments')" width="min(800px, 95vw)">
<p>{{ attachmentText('按审批类型设置存档部门,多个部门请用顿号或逗号分隔。', 'Configure departments by approval type, separated by commas.') }}</p>
<el-table :data="archiveSettings">
<el-table-column :label="attachmentText('审批业务', 'Approval type')" min-width="150"><template #default="{ row }">{{ row.type === 'StudentLeave' ? attachmentText('学生请假', 'Student leave') : approvalLabel({ type: row.type }) }}</template></el-table-column>
<el-table-column :label="attachmentText('存档部门', 'Departments')" min-width="280"><template #default="{ row }"><el-input v-model="row.departmentsText" /></template></el-table-column>
<el-table-column :label="attachmentText('操作', 'Action')" width="90"><template #default="{ row }"><el-button link type="primary" :loading="archiveSaving === row.type" :disabled="!!archiveSaving" @click="saveArchiveSettings(row)">{{ t('businessLabels.save') }}</el-button></template></el-table-column>
</el-table>
</el-dialog>
<el-dialog v-model="attachmentSettingsDialog" :title="attachmentText('审批附件规则', 'Approval attachment rules')" width="min(960px, 95vw)">
<div class="workflow-setting-row">
<strong>{{ attachmentText('新附件存储方式', 'Storage for new attachments') }}</strong>
@@ -937,7 +968,7 @@ onMounted(async () => {
</ol>
<ApprovalAttachmentList v-if="progressDialog && ['CourseExemption', 'DeferredExam', 'AssessmentDeclaration'].includes(progressType)" :key="`${progressType}-${progressId}`" :type="progressType" :id="progressId" />
<template #footer>
<el-button v-if="['CourseExemption', 'DeferredExam', 'CourseSubstitution', 'StudentStatusChange'].includes(progressType)" @click="downloadApprovalForm">
<el-button v-if="['CourseExemption', 'DeferredExam', 'CourseSubstitution', 'StudentStatusChange', 'DormitoryApplication'].includes(progressType)" @click="downloadApprovalForm">
{{ attachmentText('下载 Word 申请表', 'Download Word form') }}
</el-button>
</template>