提交代码
This commit is contained in:
1 parent
db3d6c786e
commit
8f8257ec2e
17 files changed
+2753
-61
No files matched your search
@@ -73,3 +73,16 @@ export const getStudentOptions = (keyword?: string): AxiosPromise<XskhStudentOpt
|
||||
params: { keyword }
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 查询当前登录学生的违纪处分记录列表
|
||||
* @param query
|
||||
* @returns {*}
|
||||
*/
|
||||
export const listMyDisciplineRecord = (query?: DisciplineRecordQuery): AxiosPromise<DisciplineRecordVO[]> => {
|
||||
return request({
|
||||
url: '/disciplineRecord/disciplineRecord/my',
|
||||
method: 'get',
|
||||
params: query
|
||||
});
|
||||
};
|
||||
@@ -0,0 +1,110 @@
|
||||
import request from '@/utils/request';
|
||||
import { AxiosPromise } from 'axios';
|
||||
import { DisciplineRevokeVO, DisciplineRevokeForm, DisciplineRevokeQuery } from './types';
|
||||
|
||||
/**
|
||||
* 查询违纪处分撤销申请审批列表
|
||||
* @param query
|
||||
* @returns {*}
|
||||
*/
|
||||
export const listDisciplineRevoke = (query?: DisciplineRevokeQuery): AxiosPromise<DisciplineRevokeVO[]> => {
|
||||
return request({
|
||||
url: '/disciplineRevoke/disciplineRevoke/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 查询违纪处分撤销申请审批详细
|
||||
* @param id
|
||||
*/
|
||||
export const getDisciplineRevoke = (id: string | number): AxiosPromise<DisciplineRevokeVO> => {
|
||||
return request({
|
||||
url: '/disciplineRevoke/disciplineRevoke/' + id,
|
||||
method: 'get'
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 新增违纪处分撤销申请审批
|
||||
* @param data
|
||||
*/
|
||||
export const addDisciplineRevoke = (data: DisciplineRevokeForm) => {
|
||||
return request({
|
||||
url: '/disciplineRevoke/disciplineRevoke',
|
||||
method: 'post',
|
||||
data: data
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 修改违纪处分撤销申请审批
|
||||
* @param data
|
||||
*/
|
||||
export const updateDisciplineRevoke = (data: DisciplineRevokeForm) => {
|
||||
return request({
|
||||
url: '/disciplineRevoke/disciplineRevoke',
|
||||
method: 'put',
|
||||
data: data
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 删除违纪处分撤销申请审批
|
||||
* @param id
|
||||
*/
|
||||
export const delDisciplineRevoke = (id: string | number | Array<string | number>) => {
|
||||
return request({
|
||||
url: '/disciplineRevoke/disciplineRevoke/' + id,
|
||||
method: 'delete'
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 根据违纪记录ID查询撤销申请记录
|
||||
* @param disciplineRecordId 违纪记录ID
|
||||
*/
|
||||
export const getDisciplineRevokeByRecordId = (disciplineRecordId: string | number): AxiosPromise<DisciplineRevokeVO> => {
|
||||
return request({
|
||||
url: '/disciplineRevoke/disciplineRevoke/byDisciplineRecord/' + disciplineRecordId,
|
||||
method: 'get'
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 查询当前登录学生的撤销申请列表
|
||||
* @param query
|
||||
* @returns {*}
|
||||
*/
|
||||
export const listMyDisciplineRevoke = (query?: DisciplineRevokeQuery): AxiosPromise<DisciplineRevokeVO[]> => {
|
||||
return request({
|
||||
url: '/disciplineRevoke/disciplineRevoke/my',
|
||||
method: 'get',
|
||||
params: query
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 学生申请撤销违纪记录
|
||||
* @param data
|
||||
*/
|
||||
export const applyDisciplineRevoke = (data: DisciplineRevokeForm) => {
|
||||
return request({
|
||||
url: '/disciplineRevoke/disciplineRevoke/apply',
|
||||
method: 'post',
|
||||
data: data
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 审核撤销申请
|
||||
* @param data
|
||||
*/
|
||||
export const approveDisciplineRevoke = (data: DisciplineRevokeForm) => {
|
||||
return request({
|
||||
url: '/disciplineRevoke/disciplineRevoke/approve',
|
||||
method: 'put',
|
||||
data: data
|
||||
});
|
||||
};
|
||||
@@ -0,0 +1,187 @@
|
||||
import { PageQuery } from '@/types/base';
|
||||
|
||||
export interface DisciplineRevokeVO {
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
id: string | number;
|
||||
|
||||
/**
|
||||
* 违纪记录ID
|
||||
*/
|
||||
disciplineRecordId: string | number;
|
||||
|
||||
/**
|
||||
* 学生ID
|
||||
*/
|
||||
studentId: string | number;
|
||||
|
||||
/**
|
||||
* 学生姓名
|
||||
*/
|
||||
studentName: string;
|
||||
|
||||
/**
|
||||
* 撤销申请原因
|
||||
*/
|
||||
revokeReason: string;
|
||||
|
||||
/**
|
||||
* 撤销证明材料,附件的oss_id,多个用逗号分隔
|
||||
*/
|
||||
revokeEvidence: string;
|
||||
|
||||
/**
|
||||
* 申请时间
|
||||
*/
|
||||
applyTime: string;
|
||||
|
||||
/**
|
||||
* 状态(1-待审核 2-审核通过 3-审核拒绝)
|
||||
*/
|
||||
status: string;
|
||||
|
||||
/**
|
||||
* 审核人ID
|
||||
*/
|
||||
approvalBy: string | number;
|
||||
|
||||
/**
|
||||
* 审核时间
|
||||
*/
|
||||
approvalTime: string;
|
||||
|
||||
/**
|
||||
* 审核备注
|
||||
*/
|
||||
approvalRemark: string;
|
||||
|
||||
/**
|
||||
* 创建者
|
||||
*/
|
||||
createBy: string | number;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
createTime: string;
|
||||
|
||||
/**
|
||||
* 更新者
|
||||
*/
|
||||
updateBy: string | number;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
updateTime: string;
|
||||
}
|
||||
|
||||
export interface DisciplineRevokeForm {
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
id?: string | number;
|
||||
|
||||
/**
|
||||
* 违纪记录ID
|
||||
*/
|
||||
disciplineRecordId?: string | number;
|
||||
|
||||
/**
|
||||
* 学生ID
|
||||
*/
|
||||
studentId?: string | number;
|
||||
|
||||
/**
|
||||
* 学生姓名
|
||||
*/
|
||||
studentName?: string;
|
||||
|
||||
/**
|
||||
* 撤销申请原因
|
||||
*/
|
||||
revokeReason?: string;
|
||||
|
||||
/**
|
||||
* 撤销证明材料,附件的oss_id,多个用逗号分隔
|
||||
*/
|
||||
revokeEvidence?: string;
|
||||
|
||||
/**
|
||||
* 申请时间
|
||||
*/
|
||||
applyTime?: string;
|
||||
|
||||
/**
|
||||
* 状态(1-待审核 2-审核通过 3-审核拒绝)
|
||||
*/
|
||||
status?: string;
|
||||
|
||||
/**
|
||||
* 审核人ID
|
||||
*/
|
||||
approvalBy?: string | number;
|
||||
|
||||
/**
|
||||
* 审核时间
|
||||
*/
|
||||
approvalTime?: string;
|
||||
|
||||
/**
|
||||
* 审核备注
|
||||
*/
|
||||
approvalRemark?: string;
|
||||
}
|
||||
|
||||
export interface DisciplineRevokeQuery extends PageQuery {
|
||||
/**
|
||||
* 违纪记录ID
|
||||
*/
|
||||
disciplineRecordId?: string | number;
|
||||
|
||||
/**
|
||||
* 学生ID
|
||||
*/
|
||||
studentId?: string | number;
|
||||
|
||||
/**
|
||||
* 学生姓名
|
||||
*/
|
||||
studentName?: string;
|
||||
|
||||
/**
|
||||
* 撤销申请原因
|
||||
*/
|
||||
revokeReason?: string;
|
||||
|
||||
/**
|
||||
* 申请时间
|
||||
*/
|
||||
applyTime?: string;
|
||||
|
||||
/**
|
||||
* 状态(1-待审核 2-审核通过 3-审核拒绝)
|
||||
*/
|
||||
status?: string;
|
||||
|
||||
/**
|
||||
* 审核人ID
|
||||
*/
|
||||
approvalBy?: string | number;
|
||||
|
||||
/**
|
||||
* 审核时间
|
||||
*/
|
||||
approvalTime?: string;
|
||||
|
||||
/**
|
||||
* 审核备注
|
||||
*/
|
||||
approvalRemark?: string;
|
||||
|
||||
/**
|
||||
* 其他参数
|
||||
*/
|
||||
params?: any;
|
||||
}
|
||||
@@ -0,0 +1,955 @@
|
||||
<template>
|
||||
<el-dialog :title="dialog.title" v-model="dialog.visible" width="1000px" append-to-body destroy-on-close>
|
||||
<!-- 上部分:违纪记录信息(只读) -->
|
||||
<div class="discipline-record-section">
|
||||
<h3 class="section-title">违纪记录信息</h3>
|
||||
<el-form :model="disciplineRecord" label-width="120px" disabled>
|
||||
<el-row :gutter="20">
|
||||
<!-- 左列:学生基本信息 -->
|
||||
<el-col :span="12">
|
||||
<el-form-item label="学号">
|
||||
<el-input v-model="disciplineRecord.studentNo" />
|
||||
</el-form-item>
|
||||
<el-form-item label="学生姓名">
|
||||
<el-input v-model="disciplineRecord.studentName" />
|
||||
</el-form-item>
|
||||
<el-form-item label="学院名称">
|
||||
<el-input v-model="disciplineRecord.collegeName" />
|
||||
</el-form-item>
|
||||
<el-form-item label="专业名称">
|
||||
<el-input v-model="disciplineRecord.majorName" />
|
||||
</el-form-item>
|
||||
<el-form-item label="班级名称">
|
||||
<el-input v-model="disciplineRecord.className" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<!-- 右列:违纪处分信息 -->
|
||||
<el-col :span="12">
|
||||
<el-form-item label="违纪处分类型">
|
||||
<el-input v-model="disciplineRecord.disciplineTypeName" />
|
||||
</el-form-item>
|
||||
<el-form-item label="违纪处分日期">
|
||||
<el-input v-model="disciplineRecord.disciplineDate" />
|
||||
</el-form-item>
|
||||
<el-form-item label="扣分分值">
|
||||
<el-input v-model="disciplineRecord.scoreDeduction" />
|
||||
</el-form-item>
|
||||
<el-form-item label="状态">
|
||||
<el-input v-model="statusLabel" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<!-- 完整宽度的字段 -->
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="违纪处分原因">
|
||||
<el-input v-model="disciplineRecord.disciplineReason" type="textarea" :rows="3" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="违纪处分内容">
|
||||
<el-input v-model="disciplineRecord.disciplineContent" type="textarea" :rows="3" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<!-- 违纪记录附件展示(只读) -->
|
||||
<el-row v-if="disciplineAttachmentList.length > 0">
|
||||
<el-col :span="24">
|
||||
<el-form-item label="违纪记录附件">
|
||||
<div class="attachment-view-container">
|
||||
<div class="attachment-view-grid">
|
||||
<div v-for="file in disciplineAttachmentList" :key="file.uid" class="upload-file-card">
|
||||
<div class="upload-file-thumb">
|
||||
<image-preview v-if="isImageFile(file) && file.url" :src="getFileOssId(file)" class="upload-thumb-image" :isOssId="true" />
|
||||
<div v-else class="upload-file-placeholder">
|
||||
<el-icon><Document /></el-icon>
|
||||
<span class="file-ext">{{ getFileExt(file.name) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="upload-file-name" :title="file.name">
|
||||
{{ getShortFileName(file.name) }}
|
||||
</div>
|
||||
<div class="upload-file-card-actions">
|
||||
<el-button type="success" size="small" @click.stop="handleDownloadAttachment(file)" title="下载">
|
||||
<el-icon><Download /></el-icon>
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</div>
|
||||
|
||||
<!-- 分隔线 -->
|
||||
<el-divider />
|
||||
|
||||
<!-- 下部分:撤销申请表单 -->
|
||||
<div class="revoke-form-section">
|
||||
<h3 class="section-title">撤销申请信息</h3>
|
||||
<!-- 状态提示信息 -->
|
||||
<div v-if="existingRevokeRecord && !canApply" class="status-alert">
|
||||
<el-alert
|
||||
:title="existingRevokeRecord.status === '2' ? '该违纪记录的撤销申请已审核通过' : '该违纪记录的撤销申请已被拒绝'"
|
||||
:type="existingRevokeRecord.status === '2' ? 'success' : 'error'"
|
||||
:closable="false"
|
||||
show-icon
|
||||
>
|
||||
<template #default>
|
||||
<div>
|
||||
<p><strong>申请时间:</strong>{{ existingRevokeRecord.applyTime }}</p>
|
||||
<p><strong>申请原因:</strong>{{ existingRevokeRecord.revokeReason }}</p>
|
||||
<p v-if="existingRevokeRecord.approvalTime"><strong>审核时间:</strong>{{ existingRevokeRecord.approvalTime }}</p>
|
||||
<p v-if="existingRevokeRecord.approvalRemark"><strong>审核备注:</strong>{{ existingRevokeRecord.approvalRemark }}</p>
|
||||
</div>
|
||||
</template>
|
||||
</el-alert>
|
||||
</div>
|
||||
|
||||
<el-form ref="revokeFormRef" :model="form" :rules="rules" label-width="120px" :disabled="!canApply">
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="撤销申请原因" prop="revokeReason">
|
||||
<el-input v-model="form.revokeReason" type="textarea" placeholder="请输入撤销申请原因" :rows="4" :disabled="!canApply" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<!-- 撤销证明材料上传区域 -->
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="撤销证明材料">
|
||||
<div class="attachment-upload-container">
|
||||
<el-upload
|
||||
:file-list="attachmentList"
|
||||
class="upload-demo"
|
||||
drag
|
||||
list-type="picture-card"
|
||||
:on-preview="handleFilePreview"
|
||||
:action="uploadAction"
|
||||
:headers="uploadHeaders"
|
||||
:data="uploadData"
|
||||
:auto-upload="true"
|
||||
:before-upload="handleBeforeUpload"
|
||||
:on-success="handleUploadSuccess"
|
||||
:on-error="handleUploadError"
|
||||
:on-remove="handleRemoveAttachmentConfirm"
|
||||
:on-change="handleFileChange"
|
||||
:disabled="!canApply"
|
||||
multiple
|
||||
:limit="15"
|
||||
:show-file-list="true"
|
||||
accept="image/*,video/*,.pdf,.doc,.docx,.txt"
|
||||
>
|
||||
<template #tip>
|
||||
<div class="el-upload__tip">支持图片、视频、PDF、Word文档等格式,单个文件大小不超过10MB,最多上传15个文件。</div>
|
||||
</template>
|
||||
|
||||
<div class="el-upload-dragger1">
|
||||
<el-icon class="el-icon--upload"><upload-filled /></el-icon>
|
||||
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
|
||||
</div>
|
||||
|
||||
<!-- 自定义文件卡片缩略图 -->
|
||||
<template #file="{ file }">
|
||||
<div class="upload-file-card">
|
||||
<div class="upload-file-thumb">
|
||||
<image-preview v-if="isImageFile(file) && file.url" :src="getFileOssId(file)" class="upload-thumb-image" :isOssId="true" />
|
||||
<div v-else class="upload-file-placeholder">
|
||||
<el-icon><Document /></el-icon>
|
||||
<span class="file-ext">{{ getFileExt(file.name) }}</span>
|
||||
</div>
|
||||
<div v-if="file.status === 'uploading'" class="upload-file-loading">
|
||||
<el-icon class="is-loading"><Loading /></el-icon>
|
||||
<span class="loading-text">上传中...</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="upload-file-name" :title="file.name">
|
||||
{{ getShortFileName(file.name) }}
|
||||
</div>
|
||||
<div class="upload-file-card-actions" v-if="file.status && file.status !== 'ready'">
|
||||
<el-button-group size="small">
|
||||
<el-button type="success" @click.stop="handleDownloadAttachment(file)" title="下载" :disabled="file.status !== 'success'">
|
||||
<el-icon><Download /></el-icon>
|
||||
</el-button>
|
||||
<el-button type="danger" @click.stop="handleRemoveAttachmentConfirm(file)" title="删除">
|
||||
<el-icon><Delete /></el-icon>
|
||||
</el-button>
|
||||
</el-button-group>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-upload>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</div>
|
||||
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button v-if="canApply" :loading="buttonLoading" type="primary" @click="submitForm">
|
||||
{{ isEditMode ? '保存修改' : '提交申请' }}
|
||||
</el-button>
|
||||
<!-- 新增删除按钮:只有当存在撤销申请记录且状态为待审核时才显示 -->
|
||||
<el-button
|
||||
v-if="existingRevokeRecord && existingRevokeRecord.status === '1'"
|
||||
:loading="deleteLoading"
|
||||
type="danger"
|
||||
@click="handleDeleteApplication"
|
||||
>
|
||||
删除申请
|
||||
</el-button>
|
||||
<el-button @click="cancel">{{ canApply ? '取消' : '关闭' }}</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup name="RevokeApplicationForm" lang="ts">
|
||||
import { ref, reactive, computed, toRefs, getCurrentInstance } from 'vue';
|
||||
import { UploadFilled, Document, Loading, Download, Delete } from '@element-plus/icons-vue';
|
||||
import { ElMessage, ElMessageBox, ElLoading, FormInstance } from 'element-plus';
|
||||
import { getToken } from '@/utils/auth';
|
||||
import { globalHeaders } from '@/utils/request';
|
||||
import ImagePreview from '@/components/ImagePreview/index.vue';
|
||||
import request from '@/utils/request';
|
||||
import { getDisciplineRecord } from '@/api/xskh/disciplineRecord/disciplineRecord';
|
||||
import {
|
||||
applyDisciplineRevoke,
|
||||
getDisciplineRevokeByRecordId,
|
||||
updateDisciplineRevoke,
|
||||
delDisciplineRevoke
|
||||
} from '@/api/xskh/disciplineRevoke/disciplineRevoke';
|
||||
import { DisciplineRevokeForm, DisciplineRevokeVO } from '@/api/xskh/disciplineRevoke/types';
|
||||
|
||||
interface Props {}
|
||||
|
||||
const emit = defineEmits(['success']);
|
||||
|
||||
// 使用getCurrentInstance获取上下文
|
||||
const { proxy } = getCurrentInstance() as any;
|
||||
const { student_discipline_status } = toRefs<any>(proxy?.useDict('student_discipline_status'));
|
||||
|
||||
const revokeFormRef = ref<FormInstance>();
|
||||
const buttonLoading = ref(false);
|
||||
const deleteLoading = ref(false); // 新增删除按钮的加载状态
|
||||
|
||||
// 对话框状态
|
||||
const dialog = reactive({
|
||||
visible: false,
|
||||
title: '撤销申请'
|
||||
});
|
||||
|
||||
// 违纪记录信息(只读)
|
||||
const disciplineRecord = ref<any>({});
|
||||
const disciplineAttachmentList = ref<any[]>([]);
|
||||
|
||||
// 现有撤销申请记录
|
||||
const existingRevokeRecord = ref<DisciplineRevokeVO | null>(null);
|
||||
const isEditMode = ref(false); // 是否为编辑模式
|
||||
const canApply = ref(true); // 是否可以申请/编辑
|
||||
|
||||
// 撤销申请表单
|
||||
const initFormData: DisciplineRevokeForm = {
|
||||
disciplineRecordId: undefined,
|
||||
revokeReason: undefined,
|
||||
revokeEvidence: undefined
|
||||
};
|
||||
|
||||
const form = ref<DisciplineRevokeForm>({ ...initFormData });
|
||||
|
||||
// 表单验证规则
|
||||
const rules = reactive({
|
||||
revokeReason: [{ required: true, message: '撤销申请原因不能为空', trigger: 'blur' }]
|
||||
});
|
||||
|
||||
// 撤销证明材料附件
|
||||
const attachmentList = ref<any[]>([]);
|
||||
|
||||
// 状态标签计算属性
|
||||
const statusLabel = computed(() => {
|
||||
const statusDict = student_discipline_status.value || [];
|
||||
const statusItem = statusDict.find((item: any) => item.value === disciplineRecord.value.status);
|
||||
return statusItem ? statusItem.label : disciplineRecord.value.status;
|
||||
});
|
||||
|
||||
// 上传相关配置
|
||||
const uploadAction = computed(() => {
|
||||
return import.meta.env.VITE_APP_BASE_API + '/resource/oss/upload';
|
||||
});
|
||||
|
||||
const uploadHeaders = computed(() => {
|
||||
return {
|
||||
'Authorization': `Bearer ${getToken() || ''}`,
|
||||
'clientid': import.meta.env.VITE_APP_CLIENT_ID || 'e5cd7e4891bf95d1d19206ce24a7b32e'
|
||||
};
|
||||
});
|
||||
|
||||
const uploadData = computed(() => {
|
||||
return {
|
||||
bizType: 'discipline_revoke_evidence'
|
||||
};
|
||||
});
|
||||
|
||||
/** 打开弹窗 */
|
||||
const openDialog = async (disciplineRecordId: string | number) => {
|
||||
dialog.visible = true;
|
||||
resetForm();
|
||||
|
||||
try {
|
||||
// 加载违纪记录信息
|
||||
const res = await getDisciplineRecord(disciplineRecordId);
|
||||
disciplineRecord.value = res.data;
|
||||
form.value.disciplineRecordId = disciplineRecordId;
|
||||
|
||||
// 处理违纪记录附件数据
|
||||
await handleDisciplineAttachmentData();
|
||||
|
||||
// 查询现有撤销申请记录
|
||||
await checkExistingRevokeRecord(disciplineRecordId);
|
||||
} catch (error) {
|
||||
console.error('加载数据失败:', error);
|
||||
ElMessage.error('加载数据失败');
|
||||
}
|
||||
};
|
||||
|
||||
/** 重置表单 */
|
||||
const resetForm = () => {
|
||||
form.value = { ...initFormData };
|
||||
attachmentList.value = [];
|
||||
disciplineAttachmentList.value = [];
|
||||
existingRevokeRecord.value = null;
|
||||
isEditMode.value = false;
|
||||
canApply.value = true;
|
||||
revokeFormRef.value?.resetFields();
|
||||
};
|
||||
|
||||
/** 取消按钮 */
|
||||
const cancel = () => {
|
||||
dialog.visible = false;
|
||||
resetForm();
|
||||
};
|
||||
|
||||
/** 提交表单 */
|
||||
const submitForm = () => {
|
||||
if (!canApply.value) {
|
||||
ElMessage.warning('当前状态不允许申请或修改');
|
||||
return;
|
||||
}
|
||||
|
||||
revokeFormRef.value?.validate(async (valid: boolean) => {
|
||||
if (valid) {
|
||||
buttonLoading.value = true;
|
||||
|
||||
// 处理附件数据
|
||||
const attachmentOssIds = attachmentList.value.filter((file: any) => file.status === 'success' && file.ossId).map((file: any) => file.ossId);
|
||||
form.value.revokeEvidence = attachmentOssIds.join(',');
|
||||
|
||||
try {
|
||||
if (isEditMode.value && form.value.id) {
|
||||
// 编辑现有申请
|
||||
await updateDisciplineRevoke(form.value);
|
||||
ElMessage.success('撤销申请修改成功');
|
||||
} else {
|
||||
// 新建申请
|
||||
await applyDisciplineRevoke(form.value);
|
||||
ElMessage.success('撤销申请提交成功');
|
||||
}
|
||||
|
||||
dialog.visible = false;
|
||||
emit('success');
|
||||
} catch (error) {
|
||||
console.error('操作失败:', error);
|
||||
const errorMsg = isEditMode.value ? '修改申请失败' : '提交申请失败';
|
||||
ElMessage.error(errorMsg);
|
||||
} finally {
|
||||
buttonLoading.value = false;
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/** 删除撤销申请 */
|
||||
const handleDeleteApplication = () => {
|
||||
if (!existingRevokeRecord.value?.id) {
|
||||
ElMessage.error('未找到撤销申请记录ID');
|
||||
return;
|
||||
}
|
||||
|
||||
ElMessageBox.confirm('确定要删除这个撤销申请吗?删除后将无法恢复。', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
})
|
||||
.then(async () => {
|
||||
deleteLoading.value = true;
|
||||
try {
|
||||
await delDisciplineRevoke(existingRevokeRecord.value.id);
|
||||
ElMessage.success('撤销申请删除成功');
|
||||
dialog.visible = false;
|
||||
emit('success');
|
||||
} catch (error) {
|
||||
console.error('删除申请失败:', error);
|
||||
ElMessage.error('删除申请失败');
|
||||
} finally {
|
||||
deleteLoading.value = false;
|
||||
}
|
||||
})
|
||||
.catch(() => {});
|
||||
};
|
||||
|
||||
// 文件处理方法
|
||||
const isImageFile = (file: any) => {
|
||||
const imageTypes = ['image/jpeg', 'image/png', 'image/gif', 'image/bmp', 'image/webp'];
|
||||
return imageTypes.includes(file.raw?.type) || (file.url && /\.(jpg|jpeg|png|gif|bmp|webp)$/i.test(file.name));
|
||||
};
|
||||
|
||||
const getFileOssId = (file: any) => {
|
||||
return file.ossId || '';
|
||||
};
|
||||
|
||||
const getFileExt = (fileName: string) => {
|
||||
const ext = fileName.split('.').pop()?.toUpperCase();
|
||||
return ext || 'FILE';
|
||||
};
|
||||
|
||||
const getShortFileName = (fileName: string) => {
|
||||
if (!fileName) return '';
|
||||
const lastDotIndex = fileName.lastIndexOf('.');
|
||||
if (lastDotIndex === -1) {
|
||||
return fileName.length > 12 ? fileName.substring(0, 12) + '...' : fileName;
|
||||
}
|
||||
const name = fileName.substring(0, lastDotIndex);
|
||||
const ext = fileName.substring(lastDotIndex);
|
||||
if (name.length <= 8) {
|
||||
return fileName;
|
||||
}
|
||||
return name.substring(0, 8) + '...' + ext;
|
||||
};
|
||||
|
||||
const handleFilePreview = (file: any) => {
|
||||
if (isImageFile(file)) {
|
||||
window.open(file.url);
|
||||
} else {
|
||||
handleDownloadAttachment(file);
|
||||
}
|
||||
};
|
||||
|
||||
const handleBeforeUpload = (file: any) => {
|
||||
const isValidType = /\.(jpg|jpeg|png|gif|bmp|webp|pdf|doc|docx|txt|mp4|avi|mov)$/i.test(file.name);
|
||||
const isLt10M = file.size / 1024 / 1024 < 10;
|
||||
|
||||
if (!isValidType) {
|
||||
ElMessage.error('上传文件格式不正确!');
|
||||
return false;
|
||||
}
|
||||
if (!isLt10M) {
|
||||
ElMessage.error('上传文件大小不能超过 10MB!');
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
const handleUploadSuccess = (response: any, file: any) => {
|
||||
if (response.code === 200) {
|
||||
file.url = response.data.url;
|
||||
file.ossId = response.data.ossId;
|
||||
ElMessage.success('文件上传成功');
|
||||
} else {
|
||||
ElMessage.error(response.msg || '文件上传失败');
|
||||
}
|
||||
};
|
||||
|
||||
const handleUploadError = (error: any, file: any) => {
|
||||
console.error('文件上传失败:', error);
|
||||
ElMessage.error('文件上传失败');
|
||||
};
|
||||
|
||||
const handleFileChange = (file: any, fileList: any) => {
|
||||
attachmentList.value = fileList;
|
||||
};
|
||||
|
||||
const handleRemoveAttachmentConfirm = (file: any) => {
|
||||
ElMessageBox.confirm('确定要删除这个文件吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
})
|
||||
.then(() => {
|
||||
handleRemoveAttachment(file);
|
||||
})
|
||||
.catch(() => {});
|
||||
};
|
||||
|
||||
const handleRemoveAttachment = (file: any) => {
|
||||
const index = attachmentList.value.findIndex((item: any) => item.uid === file.uid);
|
||||
if (index > -1) {
|
||||
attachmentList.value.splice(index, 1);
|
||||
ElMessage.success('文件删除成功');
|
||||
}
|
||||
};
|
||||
|
||||
const handleDownloadAttachment = async (file: any) => {
|
||||
let downloadUrl = '';
|
||||
let fileName = file.name || 'attachment';
|
||||
|
||||
if (file.response && file.response.data && file.response.data.filePath) {
|
||||
downloadUrl = file.response.data.filePath;
|
||||
fileName = file.response.data.fileName || fileName;
|
||||
} else if (file.ossId) {
|
||||
downloadUrl = file.ossId;
|
||||
} else if (file.raw) {
|
||||
const link = document.createElement('a');
|
||||
link.href = URL.createObjectURL(file.raw);
|
||||
link.download = fileName;
|
||||
link.style.display = 'none';
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
document.body.removeChild(link);
|
||||
URL.revokeObjectURL(link.href);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!downloadUrl) {
|
||||
ElMessage.error('无法获取文件下载地址');
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const loading = ElLoading.service({
|
||||
text: '正在下载文件...',
|
||||
target: document.body
|
||||
});
|
||||
|
||||
const response = await request({
|
||||
url: '/resource/oss/download/' + downloadUrl,
|
||||
method: 'get',
|
||||
responseType: 'blob',
|
||||
timeout: 300000
|
||||
});
|
||||
|
||||
if (!response) {
|
||||
throw new Error('响应数据为空');
|
||||
}
|
||||
|
||||
let blobData: Blob;
|
||||
if (response instanceof Blob) {
|
||||
blobData = response;
|
||||
} else if (response.data instanceof Blob) {
|
||||
blobData = response.data;
|
||||
} else {
|
||||
throw new Error('无效的响应数据格式');
|
||||
}
|
||||
|
||||
const url = window.URL.createObjectURL(blobData);
|
||||
const link = document.createElement('a');
|
||||
link.href = url;
|
||||
link.download = fileName;
|
||||
link.style.display = 'none';
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
document.body.removeChild(link);
|
||||
window.URL.revokeObjectURL(url);
|
||||
loading?.close();
|
||||
} catch (error) {
|
||||
console.error('下载文件失败:', error);
|
||||
ElMessage.error('下载文件失败,请稍后重试');
|
||||
}
|
||||
};
|
||||
|
||||
/** 检查现有撤销申请记录 */
|
||||
const checkExistingRevokeRecord = async (disciplineRecordId: string | number) => {
|
||||
try {
|
||||
const res = await getDisciplineRevokeByRecordId(disciplineRecordId);
|
||||
if (res.data) {
|
||||
existingRevokeRecord.value = res.data;
|
||||
|
||||
// 根据状态判断是否可以操作
|
||||
const status = res.data.status;
|
||||
if (status === '1') {
|
||||
// 待审核状态,可以编辑
|
||||
isEditMode.value = true;
|
||||
canApply.value = true;
|
||||
dialog.title = '修改撤销申请';
|
||||
|
||||
// 填充现有数据到表单
|
||||
form.value.id = res.data.id;
|
||||
form.value.revokeReason = res.data.revokeReason;
|
||||
form.value.revokeEvidence = res.data.revokeEvidence;
|
||||
|
||||
// 处理现有证明材料附件
|
||||
await handleRevokeEvidenceData(res.data.revokeEvidence);
|
||||
} else if (status === '2') {
|
||||
// 审核通过,不能再申请
|
||||
canApply.value = false;
|
||||
dialog.title = '撤销申请详情(已通过)';
|
||||
ElMessage.warning('该违纪记录的撤销申请已审核通过,无法再次申请');
|
||||
} else if (status === '3') {
|
||||
// 审核拒绝,不能再申请
|
||||
canApply.value = false;
|
||||
dialog.title = '撤销申请详情(已拒绝)';
|
||||
ElMessage.warning('该违纪记录的撤销申请已被拒绝,无法再次申请');
|
||||
}
|
||||
} else {
|
||||
// 没有现有申请记录,可以新建
|
||||
existingRevokeRecord.value = null;
|
||||
isEditMode.value = false;
|
||||
canApply.value = true;
|
||||
dialog.title = '撤销申请';
|
||||
}
|
||||
} catch (error) {
|
||||
// 如果查询失败(比如404),说明没有现有记录,可以新建
|
||||
existingRevokeRecord.value = null;
|
||||
isEditMode.value = false;
|
||||
canApply.value = true;
|
||||
dialog.title = '撤销申请';
|
||||
}
|
||||
};
|
||||
|
||||
const handleDisciplineAttachmentData = async () => {
|
||||
try {
|
||||
if (!disciplineRecord.value.attachmentOssIds || !disciplineRecord.value.attachmentOssIds.toString().trim()) {
|
||||
disciplineAttachmentList.value = [];
|
||||
return;
|
||||
}
|
||||
|
||||
const ossIdsArray = disciplineRecord.value.attachmentOssIds
|
||||
.toString()
|
||||
.split(',')
|
||||
.map((id: string) => id.trim())
|
||||
.filter((id: string) => id);
|
||||
|
||||
if (ossIdsArray.length === 0) {
|
||||
disciplineAttachmentList.value = [];
|
||||
return;
|
||||
}
|
||||
|
||||
const response = await request({
|
||||
url: `/resource/oss/listByIds/${ossIdsArray.join(',')}`,
|
||||
method: 'get'
|
||||
});
|
||||
|
||||
if (response.code === 200 && response.data) {
|
||||
const attachmentFiles = response.data.map((item: any, index: number) => ({
|
||||
uid: `existing_${index}_${Date.now()}`,
|
||||
name: item.originalName || `附件${index + 1}`,
|
||||
url: item.url,
|
||||
ossId: item.ossId,
|
||||
status: 'success'
|
||||
}));
|
||||
|
||||
disciplineAttachmentList.value = attachmentFiles;
|
||||
} else {
|
||||
disciplineAttachmentList.value = [];
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('处理违纪记录附件数据失败:', error);
|
||||
disciplineAttachmentList.value = [];
|
||||
}
|
||||
};
|
||||
|
||||
/** 处理现有撤销证明材料附件数据 */
|
||||
const handleRevokeEvidenceData = async (revokeEvidence: string) => {
|
||||
try {
|
||||
if (!revokeEvidence || !revokeEvidence.trim()) {
|
||||
attachmentList.value = [];
|
||||
return;
|
||||
}
|
||||
|
||||
const ossIdsArray = revokeEvidence
|
||||
.split(',')
|
||||
.map((id: string) => id.trim())
|
||||
.filter((id: string) => id);
|
||||
|
||||
if (ossIdsArray.length === 0) {
|
||||
attachmentList.value = [];
|
||||
return;
|
||||
}
|
||||
|
||||
const response = await request({
|
||||
url: `/resource/oss/listByIds/${ossIdsArray.join(',')}`,
|
||||
method: 'get'
|
||||
});
|
||||
|
||||
if (response.code === 200 && response.data) {
|
||||
const attachmentFiles = response.data.map((item: any, index: number) => ({
|
||||
uid: `revoke_${index}_${Date.now()}`,
|
||||
name: item.originalName || `证明材料${index + 1}`,
|
||||
url: item.url,
|
||||
ossId: item.ossId,
|
||||
status: 'success'
|
||||
}));
|
||||
|
||||
attachmentList.value = attachmentFiles;
|
||||
} else {
|
||||
attachmentList.value = [];
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('处理撤销证明材料数据失败:', error);
|
||||
attachmentList.value = [];
|
||||
}
|
||||
};
|
||||
|
||||
// 暴露方法给父组件使用
|
||||
defineExpose({
|
||||
openDialog
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.section-title {
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
color: #303133;
|
||||
margin-bottom: 20px;
|
||||
padding-bottom: 10px;
|
||||
border-bottom: 1px solid #ebeef5;
|
||||
}
|
||||
|
||||
.discipline-record-section {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.revoke-form-section {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.status-alert {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.status-alert .el-alert__content p {
|
||||
margin: 4px 0;
|
||||
font-size: 14px;
|
||||
color: #303133;
|
||||
}
|
||||
|
||||
.status-alert .el-alert__content p strong {
|
||||
color: #409eff;
|
||||
margin-right: 8px;
|
||||
}
|
||||
|
||||
/* 附件上传容器样式 */
|
||||
.attachment-upload-container {
|
||||
width: 100%;
|
||||
max-height: calc(100vh - 650px);
|
||||
min-height: 200px;
|
||||
overflow-y: auto;
|
||||
padding-right: 8px;
|
||||
border: 1px solid #e4e7ed;
|
||||
border-radius: 6px;
|
||||
background: #fafafa;
|
||||
}
|
||||
|
||||
.attachment-upload-container .upload-demo {
|
||||
padding: 12px;
|
||||
min-height: 180px;
|
||||
}
|
||||
|
||||
.attachment-upload-container .upload-demo .el-upload {
|
||||
border-radius: 6px;
|
||||
cursor: pointer;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
transition: all 0.3s;
|
||||
}
|
||||
|
||||
.attachment-upload-container .upload-demo .el-upload:hover {
|
||||
border-color: #409eff;
|
||||
}
|
||||
|
||||
.attachment-upload-container .upload-demo .el-upload__tip {
|
||||
font-size: 12px;
|
||||
color: #000000;
|
||||
margin-top: 7px;
|
||||
}
|
||||
|
||||
.attachment-upload-container .upload-demo .el-upload-dragger1 {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 15px;
|
||||
padding: 0px !important;
|
||||
}
|
||||
|
||||
.attachment-upload-container .upload-demo .el-upload-dragger1 .el-icon--upload {
|
||||
margin: 0;
|
||||
padding: 0px !important;
|
||||
}
|
||||
|
||||
/* 文件卡片样式 */
|
||||
.upload-file-card {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 6px;
|
||||
overflow: hidden;
|
||||
background: #fff;
|
||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
||||
transition: all 0.3s;
|
||||
}
|
||||
|
||||
.upload-file-card:hover {
|
||||
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
|
||||
}
|
||||
|
||||
.upload-file-thumb {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 110px;
|
||||
background: #f5f5f5;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.upload-thumb-image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.upload-file-placeholder {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: #909399;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.upload-file-placeholder .el-icon {
|
||||
font-size: 28px;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.file-ext {
|
||||
font-size: 12px;
|
||||
text-transform: uppercase;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.upload-file-loading {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
.loading-text {
|
||||
margin-top: 8px;
|
||||
font-size: 12px;
|
||||
color: #606266;
|
||||
}
|
||||
|
||||
.upload-file-name {
|
||||
padding: 6px 8px;
|
||||
font-size: 11px;
|
||||
color: #303133;
|
||||
text-align: center;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
background: #fafafa;
|
||||
border-top: 1px solid #f0f0f0;
|
||||
line-height: 1.2;
|
||||
height: 32px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
word-break: break-all;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.upload-file-card-actions {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
padding: 6px 8px;
|
||||
background: #fafafa;
|
||||
border-top: 1px solid #f0f0f0;
|
||||
transition: all 0.3s;
|
||||
height: 38px;
|
||||
}
|
||||
|
||||
.upload-file-card-actions .el-button-group {
|
||||
background: transparent;
|
||||
border-radius: 4px;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.upload-file-card-actions .el-button {
|
||||
padding: 4px 8px;
|
||||
border: 1px solid #e0e0e0;
|
||||
background: #fff;
|
||||
font-size: 12px;
|
||||
margin: 0 2px;
|
||||
border-radius: 3px;
|
||||
transition: all 0.3s;
|
||||
}
|
||||
|
||||
.upload-file-card-actions .el-button:hover {
|
||||
background: #f5f5f5;
|
||||
border-color: #409eff;
|
||||
}
|
||||
|
||||
/* 让附件卡片一行展示 5 个 */
|
||||
.attachment-upload-container :deep(.el-upload-list--picture-card) {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(5, 1fr);
|
||||
gap: 9px;
|
||||
margin-top: 12px;
|
||||
padding-bottom: 16px;
|
||||
}
|
||||
|
||||
.attachment-upload-container :deep(.el-upload-list--picture-card) .el-upload-list__item {
|
||||
margin: 0;
|
||||
height: 180px !important;
|
||||
width: 100% !important;
|
||||
}
|
||||
|
||||
:deep(.el-upload-dragger) {
|
||||
border: 0px !important;
|
||||
padding: 0px !important;
|
||||
}
|
||||
|
||||
/* 查看模式下的附件网格展示 */
|
||||
.attachment-view-container {
|
||||
width: 100%;
|
||||
max-height: calc(100vh - 650px);
|
||||
min-height: 200px;
|
||||
overflow-y: auto;
|
||||
padding-right: 8px;
|
||||
border: 1px solid #e4e7ed;
|
||||
border-radius: 6px;
|
||||
background: #fafafa;
|
||||
}
|
||||
|
||||
.attachment-view-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(5, 1fr);
|
||||
gap: 9px;
|
||||
margin: 12px;
|
||||
padding-bottom: 16px;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,600 @@
|
||||
<template>
|
||||
<el-dialog :title="dialog.title" v-model="dialog.visible" width="1000px" append-to-body destroy-on-close>
|
||||
<!-- 上部分:违纪记录信息(只读) -->
|
||||
<div class="discipline-record-section">
|
||||
<h3 class="section-title">违纪记录信息</h3>
|
||||
<el-form :model="disciplineRecord" label-width="120px">
|
||||
<el-row :gutter="20">
|
||||
<!-- 左列:学生基本信息 -->
|
||||
<el-col :span="12">
|
||||
<el-form-item label="学号">
|
||||
<div class="form-field-value">{{ disciplineRecord.studentNo }}</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="学生姓名">
|
||||
<div class="form-field-value">{{ disciplineRecord.studentName }}</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="学院名称">
|
||||
<div class="form-field-value">{{ disciplineRecord.collegeName }}</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="专业名称">
|
||||
<div class="form-field-value">{{ disciplineRecord.majorName }}</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="班级名称">
|
||||
<div class="form-field-value">{{ disciplineRecord.className }}</div>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<!-- 右列:违纪处分信息 -->
|
||||
<el-col :span="12">
|
||||
<el-form-item label="违纪处分类型">
|
||||
<div class="form-field-value">{{ disciplineRecord.disciplineTypeName }}</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="违纪处分日期">
|
||||
<div class="form-field-value">{{ disciplineRecord.disciplineDate }}</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="扣分分值">
|
||||
<div class="form-field-value">{{ disciplineRecord.scoreDeduction }}</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="状态">
|
||||
<div class="form-field-value">
|
||||
<dict-tag :options="student_discipline_status" :value="disciplineRecord.status" />
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<!-- 完整宽度的字段 -->
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="违纪处分原因">
|
||||
<div class="form-field-value textarea-value">{{ disciplineRecord.disciplineReason }}</div>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="违纪处分内容">
|
||||
<div class="form-field-value textarea-value">{{ disciplineRecord.disciplineContent }}</div>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<!-- 违纪记录附件展示(只读) -->
|
||||
<el-row v-if="disciplineAttachmentList.length > 0">
|
||||
<el-col :span="24">
|
||||
<el-form-item label="违纪记录附件">
|
||||
<div class="attachment-view-container">
|
||||
<div class="attachment-view-grid">
|
||||
<div v-for="file in disciplineAttachmentList" :key="file.uid" class="upload-file-card">
|
||||
<div class="upload-file-thumb">
|
||||
<image-preview v-if="isImageFile(file) && file.url" :src="getFileOssId(file)" class="upload-thumb-image" :isOssId="true" />
|
||||
<div v-else class="upload-file-placeholder">
|
||||
<el-icon><Document /></el-icon>
|
||||
<span class="file-ext">{{ getFileExt(file.name) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="upload-file-name" :title="file.name">
|
||||
{{ getShortFileName(file.name) }}
|
||||
</div>
|
||||
<div class="upload-file-card-actions">
|
||||
<el-button type="success" size="small" @click.stop="handleDownloadAttachment(file)" title="下载">
|
||||
<el-icon><Download /></el-icon>
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</div>
|
||||
|
||||
<!-- 分隔线 -->
|
||||
<el-divider />
|
||||
|
||||
<!-- 下部分:撤销申请信息(只读) -->
|
||||
<div class="revoke-info-section">
|
||||
<h3 class="section-title">撤销申请信息</h3>
|
||||
<el-form :model="revokeData" label-width="120px">
|
||||
<el-row :gutter="20">
|
||||
<!-- 左列:申请信息 -->
|
||||
<el-col :span="12">
|
||||
<el-form-item label="申请时间">
|
||||
<div class="form-field-value">{{ revokeData.applyTime }}</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="申请状态">
|
||||
<div class="form-field-value">
|
||||
<dict-tag :options="student_revoke_status" :value="revokeData.status" />
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<!-- 右列:审批信息 -->
|
||||
<el-col :span="12">
|
||||
<el-form-item label="审核时间" v-if="revokeData.approvalTime">
|
||||
<div class="form-field-value">{{ revokeData.approvalTime }}</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="审核人" v-if="revokeData.approvalBy">
|
||||
<div class="form-field-value">{{ revokeData.approvalBy }}</div>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="撤销申请原因">
|
||||
<div class="form-field-value textarea-value">{{ revokeData.revokeReason }}</div>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row v-if="revokeData.approvalRemark">
|
||||
<el-col :span="24">
|
||||
<el-form-item label="审核备注">
|
||||
<div class="form-field-value textarea-value">{{ revokeData.approvalRemark }}</div>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<!-- 撤销证明材料展示(只读) -->
|
||||
<el-row v-if="revokeAttachmentList.length > 0">
|
||||
<el-col :span="24">
|
||||
<el-form-item label="撤销证明材料">
|
||||
<div class="attachment-view-container">
|
||||
<div class="attachment-view-grid">
|
||||
<div v-for="file in revokeAttachmentList" :key="file.uid" class="upload-file-card">
|
||||
<div class="upload-file-thumb">
|
||||
<image-preview v-if="isImageFile(file) && file.url" :src="getFileOssId(file)" class="upload-thumb-image" :isOssId="true" />
|
||||
<div v-else class="upload-file-placeholder">
|
||||
<el-icon><Document /></el-icon>
|
||||
<span class="file-ext">{{ getFileExt(file.name) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="upload-file-name" :title="file.name">
|
||||
{{ getShortFileName(file.name) }}
|
||||
</div>
|
||||
<div class="upload-file-card-actions">
|
||||
<el-button type="success" size="small" @click.stop="handleDownloadAttachment(file)" title="下载">
|
||||
<el-icon><Download /></el-icon>
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</div>
|
||||
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button @click="cancel">关 闭</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup name="RevokeApplicationView" lang="ts">
|
||||
import { ref, reactive, toRefs, getCurrentInstance } from 'vue';
|
||||
import { Document, Download } from '@element-plus/icons-vue';
|
||||
import { ElMessage, ElLoading } from 'element-plus';
|
||||
import ImagePreview from '@/components/ImagePreview/index.vue';
|
||||
import request from '@/utils/request';
|
||||
import { getDisciplineRecord } from '@/api/xskh/disciplineRecord/disciplineRecord';
|
||||
import { getDisciplineRevokeByRecordId } from '@/api/xskh/disciplineRevoke/disciplineRevoke';
|
||||
|
||||
interface Props {}
|
||||
|
||||
const emit = defineEmits(['success']);
|
||||
|
||||
// 使用getCurrentInstance获取上下文
|
||||
const { proxy } = getCurrentInstance() as any;
|
||||
const { student_discipline_status, student_revoke_status } = toRefs<any>(proxy?.useDict('student_discipline_status', 'student_revoke_status'));
|
||||
|
||||
// 对话框状态
|
||||
const dialog = reactive({
|
||||
visible: false,
|
||||
title: '查看撤销申请'
|
||||
});
|
||||
|
||||
// 违纪记录信息
|
||||
const disciplineRecord = ref<any>({});
|
||||
const disciplineAttachmentList = ref<any[]>([]);
|
||||
|
||||
// 撤销申请信息
|
||||
const revokeData = ref<any>({});
|
||||
const revokeAttachmentList = ref<any[]>([]);
|
||||
|
||||
/** 打开弹窗 */
|
||||
const openDialog = async (disciplineRecordId: string | number) => {
|
||||
dialog.visible = true;
|
||||
resetData();
|
||||
|
||||
try {
|
||||
// 加载违纪记录信息
|
||||
const disciplineRes = await getDisciplineRecord(disciplineRecordId);
|
||||
disciplineRecord.value = disciplineRes.data;
|
||||
|
||||
// 加载撤销申请信息
|
||||
const revokeRes = await getDisciplineRevokeByRecordId(disciplineRecordId);
|
||||
if (revokeRes.data) {
|
||||
revokeData.value = revokeRes.data;
|
||||
await handleRevokeAttachmentData();
|
||||
} else {
|
||||
ElMessage.warning('该违纪记录暂无撤销申请记录');
|
||||
}
|
||||
|
||||
// 处理违纪记录附件数据
|
||||
await handleDisciplineAttachmentData();
|
||||
} catch (error) {
|
||||
console.error('加载数据失败:', error);
|
||||
ElMessage.error('加载数据失败');
|
||||
}
|
||||
};
|
||||
|
||||
/** 重置数据 */
|
||||
const resetData = () => {
|
||||
disciplineRecord.value = {};
|
||||
revokeData.value = {};
|
||||
disciplineAttachmentList.value = [];
|
||||
revokeAttachmentList.value = [];
|
||||
};
|
||||
|
||||
/** 取消按钮 */
|
||||
const cancel = () => {
|
||||
dialog.visible = false;
|
||||
resetData();
|
||||
};
|
||||
|
||||
// 文件处理方法
|
||||
const isImageFile = (file: any) => {
|
||||
const imageTypes = ['image/jpeg', 'image/png', 'image/gif', 'image/bmp', 'image/webp'];
|
||||
return imageTypes.includes(file.raw?.type) || (file.url && /\.(jpg|jpeg|png|gif|bmp|webp)$/i.test(file.name));
|
||||
};
|
||||
|
||||
const getFileOssId = (file: any) => {
|
||||
return file.ossId || '';
|
||||
};
|
||||
|
||||
const getFileExt = (fileName: string) => {
|
||||
const ext = fileName.split('.').pop()?.toUpperCase();
|
||||
return ext || 'FILE';
|
||||
};
|
||||
|
||||
const getShortFileName = (fileName: string) => {
|
||||
if (!fileName) return '';
|
||||
const lastDotIndex = fileName.lastIndexOf('.');
|
||||
if (lastDotIndex === -1) {
|
||||
return fileName.length > 12 ? fileName.substring(0, 12) + '...' : fileName;
|
||||
}
|
||||
const name = fileName.substring(0, lastDotIndex);
|
||||
const ext = fileName.substring(lastDotIndex);
|
||||
if (name.length <= 8) {
|
||||
return fileName;
|
||||
}
|
||||
return name.substring(0, 8) + '...' + ext;
|
||||
};
|
||||
|
||||
const handleDownloadAttachment = async (file: any) => {
|
||||
let downloadUrl = '';
|
||||
let fileName = file.name || 'attachment';
|
||||
|
||||
if (file.response && file.response.data && file.response.data.filePath) {
|
||||
downloadUrl = file.response.data.filePath;
|
||||
fileName = file.response.data.fileName || fileName;
|
||||
} else if (file.ossId) {
|
||||
downloadUrl = file.ossId;
|
||||
} else if (file.raw) {
|
||||
const link = document.createElement('a');
|
||||
link.href = URL.createObjectURL(file.raw);
|
||||
link.download = fileName;
|
||||
link.style.display = 'none';
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
document.body.removeChild(link);
|
||||
URL.revokeObjectURL(link.href);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!downloadUrl) {
|
||||
ElMessage.error('无法获取文件下载地址');
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const loading = ElLoading.service({
|
||||
text: '正在下载文件...',
|
||||
target: document.body
|
||||
});
|
||||
|
||||
const response = await request({
|
||||
url: '/resource/oss/download/' + downloadUrl,
|
||||
method: 'get',
|
||||
responseType: 'blob',
|
||||
timeout: 300000
|
||||
});
|
||||
|
||||
if (!response) {
|
||||
throw new Error('响应数据为空');
|
||||
}
|
||||
|
||||
let blobData: Blob;
|
||||
if (response instanceof Blob) {
|
||||
blobData = response;
|
||||
} else if (response.data instanceof Blob) {
|
||||
blobData = response.data;
|
||||
} else {
|
||||
throw new Error('无效的响应数据格式');
|
||||
}
|
||||
|
||||
const url = window.URL.createObjectURL(blobData);
|
||||
const link = document.createElement('a');
|
||||
link.href = url;
|
||||
link.download = fileName;
|
||||
link.style.display = 'none';
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
document.body.removeChild(link);
|
||||
window.URL.revokeObjectURL(url);
|
||||
loading?.close();
|
||||
} catch (error) {
|
||||
console.error('下载文件失败:', error);
|
||||
ElMessage.error('下载文件失败,请稍后重试');
|
||||
}
|
||||
};
|
||||
|
||||
const handleDisciplineAttachmentData = async () => {
|
||||
try {
|
||||
if (!disciplineRecord.value.attachmentOssIds || !disciplineRecord.value.attachmentOssIds.toString().trim()) {
|
||||
disciplineAttachmentList.value = [];
|
||||
return;
|
||||
}
|
||||
|
||||
const ossIdsArray = disciplineRecord.value.attachmentOssIds
|
||||
.toString()
|
||||
.split(',')
|
||||
.map((id: string) => id.trim())
|
||||
.filter((id: string) => id);
|
||||
|
||||
if (ossIdsArray.length === 0) {
|
||||
disciplineAttachmentList.value = [];
|
||||
return;
|
||||
}
|
||||
|
||||
const response = await request({
|
||||
url: `/resource/oss/listByIds/${ossIdsArray.join(',')}`,
|
||||
method: 'get'
|
||||
});
|
||||
|
||||
if (response.code === 200 && response.data) {
|
||||
const attachmentFiles = response.data.map((item: any, index: number) => ({
|
||||
uid: `discipline_${index}_${Date.now()}`,
|
||||
name: item.originalName || `附件${index + 1}`,
|
||||
url: item.url,
|
||||
ossId: item.ossId,
|
||||
status: 'success'
|
||||
}));
|
||||
|
||||
disciplineAttachmentList.value = attachmentFiles;
|
||||
} else {
|
||||
disciplineAttachmentList.value = [];
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('处理违纪记录附件数据失败:', error);
|
||||
disciplineAttachmentList.value = [];
|
||||
}
|
||||
};
|
||||
|
||||
const handleRevokeAttachmentData = async () => {
|
||||
try {
|
||||
if (!revokeData.value.revokeEvidence || !revokeData.value.revokeEvidence.toString().trim()) {
|
||||
revokeAttachmentList.value = [];
|
||||
return;
|
||||
}
|
||||
|
||||
const ossIdsArray = revokeData.value.revokeEvidence
|
||||
.toString()
|
||||
.split(',')
|
||||
.map((id: string) => id.trim())
|
||||
.filter((id: string) => id);
|
||||
|
||||
if (ossIdsArray.length === 0) {
|
||||
revokeAttachmentList.value = [];
|
||||
return;
|
||||
}
|
||||
|
||||
const response = await request({
|
||||
url: `/resource/oss/listByIds/${ossIdsArray.join(',')}`,
|
||||
method: 'get'
|
||||
});
|
||||
|
||||
if (response.code === 200 && response.data) {
|
||||
const attachmentFiles = response.data.map((item: any, index: number) => ({
|
||||
uid: `revoke_${index}_${Date.now()}`,
|
||||
name: item.originalName || `撤销证明${index + 1}`,
|
||||
url: item.url,
|
||||
ossId: item.ossId,
|
||||
status: 'success'
|
||||
}));
|
||||
|
||||
revokeAttachmentList.value = attachmentFiles;
|
||||
} else {
|
||||
revokeAttachmentList.value = [];
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('处理撤销申请附件数据失败:', error);
|
||||
revokeAttachmentList.value = [];
|
||||
}
|
||||
};
|
||||
|
||||
// 暴露方法给父组件使用
|
||||
defineExpose({
|
||||
openDialog
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.section-title {
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
color: #303133;
|
||||
margin-bottom: 20px;
|
||||
padding-bottom: 10px;
|
||||
border-bottom: 1px solid #ebeef5;
|
||||
}
|
||||
|
||||
.discipline-record-section {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.revoke-info-section {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
/* 表单字段值样式 */
|
||||
.form-field-value {
|
||||
padding: 0 11px;
|
||||
background: #f8f9fa;
|
||||
border: 1px solid #e4e7ed;
|
||||
border-radius: 4px;
|
||||
font-size: 14px;
|
||||
height: 32px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
color: #606266;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.textarea-value {
|
||||
min-height: 80px;
|
||||
height: auto;
|
||||
padding: 8px 11px;
|
||||
align-items: flex-start;
|
||||
line-height: 1.5;
|
||||
white-space: pre-wrap;
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
/* 文件卡片样式 */
|
||||
.upload-file-card {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 6px;
|
||||
overflow: hidden;
|
||||
background: #fff;
|
||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
||||
transition: all 0.3s;
|
||||
}
|
||||
|
||||
.upload-file-card:hover {
|
||||
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
|
||||
}
|
||||
|
||||
.upload-file-thumb {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 110px;
|
||||
background: #f5f5f5;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.upload-thumb-image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.upload-file-placeholder {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: #909399;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.upload-file-placeholder .el-icon {
|
||||
font-size: 28px;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.file-ext {
|
||||
font-size: 12px;
|
||||
text-transform: uppercase;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.upload-file-name {
|
||||
padding: 6px 8px;
|
||||
font-size: 11px;
|
||||
color: #303133;
|
||||
text-align: center;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
background: #fafafa;
|
||||
border-top: 1px solid #f0f0f0;
|
||||
line-height: 1.2;
|
||||
height: 32px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
word-break: break-all;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.upload-file-card-actions {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
padding: 6px 8px;
|
||||
background: #fafafa;
|
||||
border-top: 1px solid #f0f0f0;
|
||||
transition: all 0.3s;
|
||||
height: 38px;
|
||||
}
|
||||
|
||||
.upload-file-card-actions .el-button {
|
||||
padding: 4px 8px;
|
||||
border: 1px solid #e0e0e0;
|
||||
background: #fff;
|
||||
font-size: 12px;
|
||||
border-radius: 3px;
|
||||
transition: all 0.3s;
|
||||
}
|
||||
|
||||
.upload-file-card-actions .el-button:hover {
|
||||
background: #f5f5f5;
|
||||
border-color: #409eff;
|
||||
}
|
||||
|
||||
/* 查看模式下的附件网格展示 */
|
||||
.attachment-view-container {
|
||||
width: 100%;
|
||||
max-height: calc(100vh - 650px);
|
||||
min-height: 200px;
|
||||
overflow-y: auto;
|
||||
padding-right: 8px;
|
||||
border: 1px solid #e4e7ed;
|
||||
border-radius: 6px;
|
||||
background: #fafafa;
|
||||
}
|
||||
|
||||
.attachment-view-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(5, 1fr);
|
||||
gap: 9px;
|
||||
margin: 12px;
|
||||
padding-bottom: 16px;
|
||||
}
|
||||
</style>
|
||||
@@ -39,36 +39,6 @@
|
||||
<el-card shadow="never">
|
||||
<template #header>
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['disciplineRecord:disciplineRecord:add']">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="Edit"
|
||||
:disabled="single"
|
||||
@click="handleUpdate()"
|
||||
v-hasPermi="['disciplineRecord:disciplineRecord:edit']"
|
||||
>修改</el-button
|
||||
>
|
||||
</el-col>
|
||||
<!-- <el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="Delete"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete()"
|
||||
v-hasPermi="['disciplineRecord:disciplineRecord:remove']"
|
||||
>删除</el-button
|
||||
>
|
||||
</el-col> -->
|
||||
<!-- <el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['disciplineRecord:disciplineRecord:export']"
|
||||
>导出</el-button
|
||||
>
|
||||
</el-col> -->
|
||||
<right-toolbar :showSearch="showSearch" @update:showSearch="showSearch = $event" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
</template>
|
||||
@@ -92,7 +62,7 @@
|
||||
<dict-tag :options="student_discipline_status" :value="scope.row.status" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right" width="180">
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right" width="250">
|
||||
<template #default="scope">
|
||||
<el-tooltip content="查看" placement="top">
|
||||
<el-button
|
||||
@@ -103,22 +73,23 @@
|
||||
v-hasPermi="['disciplineRecord:disciplineRecord:query']"
|
||||
></el-button>
|
||||
</el-tooltip>
|
||||
<el-tooltip content="修改" placement="top">
|
||||
<el-tooltip content="撤销申请" placement="top">
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
icon="Edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['disciplineRecord:disciplineRecord:edit']"
|
||||
type="warning"
|
||||
icon="EditPen"
|
||||
@click="handleRevokeApply(scope.row)"
|
||||
v-hasPermi="['disciplineRevoke:student:apply']"
|
||||
:disabled="scope.row.status !== '1'"
|
||||
></el-button>
|
||||
</el-tooltip>
|
||||
<el-tooltip content="删除" placement="top">
|
||||
<el-tooltip content="查看撤销申请" placement="top">
|
||||
<el-button
|
||||
link
|
||||
type="danger"
|
||||
icon="Delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['disciplineRecord:disciplineRecord:remove']"
|
||||
type="info"
|
||||
icon="Document"
|
||||
@click="handleViewRevoke(scope.row)"
|
||||
v-hasPermi="['disciplineRevoke:student:query']"
|
||||
></el-button>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
@@ -130,18 +101,26 @@
|
||||
|
||||
<!-- 添加或修改学生违纪处分记录对话框 -->
|
||||
<DisciplineRecordForm ref="disciplineRecordFormRef" @success="handleSuccess" />
|
||||
|
||||
<!-- 撤销申请弹窗 -->
|
||||
<RevokeApplicationForm ref="revokeApplicationFormRef" @success="handleSuccess" />
|
||||
|
||||
<!-- 查看撤销申请弹窗 -->
|
||||
<RevokeApplicationView ref="revokeApplicationViewRef" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="DisciplineRecord" lang="ts">
|
||||
import { ref, reactive, toRefs, onMounted, getCurrentInstance, ComponentInternalInstance } from 'vue';
|
||||
import { listDisciplineRecord, delDisciplineRecord } from '@/api/xskh/xsDisciplineRecord/disciplineRecord';
|
||||
import { listMyDisciplineRecord, getDisciplineRecord } from '@/api/xskh/disciplineRecord/disciplineRecord';
|
||||
import {
|
||||
DisciplineRecordVO,
|
||||
DisciplineRecordQuery,
|
||||
DisciplineRecordForm as DisciplineRecordFormType
|
||||
} from '@/api/xskh/xsDisciplineRecord/xsDisciplineRecord/types';
|
||||
import DisciplineRecordForm from './DisciplineRecordForm.vue';
|
||||
import RevokeApplicationForm from './RevokeApplicationForm.vue';
|
||||
import RevokeApplicationView from './RevokeApplicationView.vue';
|
||||
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
const { student_discipline_status } = toRefs<any>(proxy?.useDict('student_discipline_status'));
|
||||
@@ -156,6 +135,8 @@ const total = ref(0);
|
||||
|
||||
const queryFormRef = ref<ElFormInstance>();
|
||||
const disciplineRecordFormRef = ref<ComponentRef<typeof DisciplineRecordForm>>();
|
||||
const revokeApplicationFormRef = ref<ComponentRef<typeof RevokeApplicationForm>>();
|
||||
const revokeApplicationViewRef = ref<ComponentRef<typeof RevokeApplicationView>>();
|
||||
|
||||
const initFormData: DisciplineRecordForm = {
|
||||
id: undefined,
|
||||
@@ -216,7 +197,7 @@ const { queryParams, form } = toRefs(data);
|
||||
/** 查询学生违纪处分记录列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true;
|
||||
const res = await listDisciplineRecord(queryParams.value);
|
||||
const res = await listMyDisciplineRecord(queryParams.value);
|
||||
disciplineRecordList.value = res.rows;
|
||||
total.value = res.total;
|
||||
loading.value = false;
|
||||
@@ -241,34 +222,24 @@ const handleSelectionChange = (selection: DisciplineRecordVO[]) => {
|
||||
multiple.value = !selection.length;
|
||||
};
|
||||
|
||||
/** 新增按钮操作 */
|
||||
const handleAdd = () => {
|
||||
disciplineRecordFormRef.value?.openDialog(undefined, '新增');
|
||||
};
|
||||
|
||||
/** 查看按钮操作 */
|
||||
const handleView = (row: DisciplineRecordVO) => {
|
||||
disciplineRecordFormRef.value?.openDialog(row.id, '查看');
|
||||
};
|
||||
|
||||
/** 修改按钮操作 */
|
||||
const handleUpdate = (row?: DisciplineRecordVO) => {
|
||||
const id = row?.id || ids.value[0];
|
||||
disciplineRecordFormRef.value?.openDialog(id, '修改');
|
||||
};
|
||||
|
||||
/** 提交成功回调 */
|
||||
const handleSuccess = () => {
|
||||
getList();
|
||||
};
|
||||
|
||||
/** 删除按钮操作 */
|
||||
const handleDelete = async (row?: DisciplineRecordVO) => {
|
||||
const _ids = row?.id || ids.value;
|
||||
await proxy?.$modal.confirm('是否确认删除学生违纪处分记录编号为"' + _ids + '"的数据项?').finally(() => (loading.value = false));
|
||||
await delDisciplineRecord(_ids);
|
||||
proxy?.$modal.msgSuccess('删除成功');
|
||||
await getList();
|
||||
/** 撤销申请按钮操作 */
|
||||
const handleRevokeApply = (row: DisciplineRecordVO) => {
|
||||
revokeApplicationFormRef.value?.openDialog(row.id);
|
||||
};
|
||||
|
||||
/** 查看撤销申请按钮操作 */
|
||||
const handleViewRevoke = (row: DisciplineRecordVO) => {
|
||||
revokeApplicationViewRef.value?.openDialog(row.id);
|
||||
};
|
||||
|
||||
/** 导出按钮操作 */
|
||||
|
||||
Reference in new issue
Block a user