ren
This commit is contained in:
@@ -87,6 +87,18 @@ export const putObj = (obj: any) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 审核
|
||||||
|
* @param obj
|
||||||
|
*/
|
||||||
|
export const examObj = (obj: any) => {
|
||||||
|
return request({
|
||||||
|
url: '/professional/professionalteacherpaper/exam',
|
||||||
|
method: 'post',
|
||||||
|
data: obj,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新状态
|
* 更新状态
|
||||||
* @param obj
|
* @param obj
|
||||||
|
|||||||
@@ -87,6 +87,18 @@ export const putObj = (obj: any) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 审核
|
||||||
|
* @param obj
|
||||||
|
*/
|
||||||
|
export const examObj = (obj: any) => {
|
||||||
|
return request({
|
||||||
|
url: '/professional/professionalteachingmaterial/exam',
|
||||||
|
method: 'post',
|
||||||
|
data: obj,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新状态
|
* 更新状态
|
||||||
* @param obj
|
* @param obj
|
||||||
|
|||||||
@@ -75,6 +75,18 @@ export const putObj = (obj: any) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 审核
|
||||||
|
* @param obj
|
||||||
|
*/
|
||||||
|
export const examObj = (obj: any) => {
|
||||||
|
return request({
|
||||||
|
url: '/professional/professionaltopiclist/exam',
|
||||||
|
method: 'post',
|
||||||
|
data: obj,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新状态
|
* 更新状态
|
||||||
* @param obj
|
* @param obj
|
||||||
|
|||||||
@@ -107,6 +107,18 @@ export function putObj(obj?: any) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 审核对象
|
||||||
|
* @param obj 对象数据
|
||||||
|
*/
|
||||||
|
export function examObj(obj?: any) {
|
||||||
|
return request({
|
||||||
|
url: '/professional/professionalqualificationrelation/exam',
|
||||||
|
method: 'post',
|
||||||
|
data: obj,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取图表选项
|
* 获取图表选项
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -107,6 +107,18 @@ export const putObj = (obj: any) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 审核
|
||||||
|
* @param obj
|
||||||
|
*/
|
||||||
|
export const examObj = (obj: any) => {
|
||||||
|
return request({
|
||||||
|
url: '/professional/professionalteacheracademicrelation/exam',
|
||||||
|
method: 'post',
|
||||||
|
data: obj,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取图表配置
|
* 获取图表配置
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -81,6 +81,18 @@ export const putObj = (obj: any) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 审核
|
||||||
|
* @param obj
|
||||||
|
*/
|
||||||
|
export const examObj = (obj: any) => {
|
||||||
|
return request({
|
||||||
|
url: '/professional/professionalteachercertificaterelation/exam',
|
||||||
|
method: 'post',
|
||||||
|
data: obj,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取证书统计信息
|
* 获取证书统计信息
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -81,3 +81,15 @@ export const putObj = (obj: any) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 审核
|
||||||
|
* @param obj
|
||||||
|
*/
|
||||||
|
export const examObj = (obj: any) => {
|
||||||
|
return request({
|
||||||
|
url: '/professional/professionalteacherhonor/exam',
|
||||||
|
method: 'post',
|
||||||
|
data: obj,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,15 +1,43 @@
|
|||||||
<template>
|
<template>
|
||||||
<div style="width: 100%;height: 100%;">
|
<!-- 组件不占据任何布局空间,所有预览组件都是 teleported 的 -->
|
||||||
<viewer :images="[authSrc]" v-if="!showIframe">
|
<div style="display: none;">
|
||||||
<img v-if="!showIframe" ref="imgRef" :width="imgWidth || '100%'" :height="imgHeight || '100%'" :src="authSrc" />
|
<!-- 图片:直接使用 el-image-viewer 全屏预览 -->
|
||||||
</viewer>
|
<el-image-viewer
|
||||||
<iframe v-if="showIframe" ref="authIframeRef" style="width: 100%;height: 100%;" >
|
v-if="!showIframe && imageSrc && imagePreviewVisible"
|
||||||
</iframe>
|
:url-list="[imageSrc]"
|
||||||
|
:teleported="true"
|
||||||
|
hide-on-click-modal
|
||||||
|
@close="imagePreviewVisible = false"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<!-- PDF:在 dialog 中显示 -->
|
||||||
|
<el-dialog
|
||||||
|
v-if="showIframe"
|
||||||
|
v-model="pdfDialogVisible"
|
||||||
|
:title="dialogTitle || '文件预览'"
|
||||||
|
append-to-body
|
||||||
|
width="90%"
|
||||||
|
class="pdf-preview-dialog"
|
||||||
|
>
|
||||||
|
<iframe ref="authIframeRef" :style="{ width: '100%', height: pdfIframeHeight }" />
|
||||||
|
<!-- <div class="pdf-iframe-wrapper">
|
||||||
|
<iframe
|
||||||
|
ref="authIframeRef"
|
||||||
|
:style="{
|
||||||
|
width: '100%',
|
||||||
|
height: pdfIframeHeight,
|
||||||
|
border: 'none',
|
||||||
|
display: 'block'
|
||||||
|
}"
|
||||||
|
/>
|
||||||
|
</div> -->
|
||||||
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, onMounted, nextTick } from 'vue';
|
import { ref, onMounted, nextTick, computed, onUnmounted } from 'vue';
|
||||||
|
import { ElImageViewer } from 'element-plus';
|
||||||
import { Session } from "/@/utils/storage";
|
import { Session } from "/@/utils/storage";
|
||||||
|
|
||||||
// 定义 props
|
// 定义 props
|
||||||
@@ -17,17 +45,47 @@ const props = defineProps<{
|
|||||||
authSrc: string;
|
authSrc: string;
|
||||||
imgWidth?: string;
|
imgWidth?: string;
|
||||||
imgHeight?: string;
|
imgHeight?: string;
|
||||||
|
dialogTitle?: string;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
// 定义响应式数据
|
// 定义响应式数据
|
||||||
const showIframe = ref(false);
|
const showIframe = ref(false);
|
||||||
const imgRef = ref<HTMLImageElement | null>(null);
|
const imageSrc = ref<string>('');
|
||||||
|
const imagePreviewVisible = ref(false);
|
||||||
|
const pdfDialogVisible = ref(false);
|
||||||
const authIframeRef = ref<HTMLIFrameElement | null>(null);
|
const authIframeRef = ref<HTMLIFrameElement | null>(null);
|
||||||
|
const windowHeight = ref(window.innerHeight);
|
||||||
|
|
||||||
|
// 计算 PDF iframe 的合适高度(优先使用外部传入的 imgHeight,否则根据窗口高度动态计算)
|
||||||
|
const pdfIframeHeight = computed(() => {
|
||||||
|
// 如果外部传入了 imgHeight,优先使用
|
||||||
|
if (props.imgHeight) {
|
||||||
|
return props.imgHeight;
|
||||||
|
}
|
||||||
|
// 否则根据窗口高度动态计算:dialog header 约 50px,padding 约 40px,留一些余量
|
||||||
|
return `${windowHeight.value - 120}px`;
|
||||||
|
});
|
||||||
|
|
||||||
|
// 监听窗口大小变化
|
||||||
|
const handleResize = () => {
|
||||||
|
windowHeight.value = window.innerHeight;
|
||||||
|
};
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
window.addEventListener('resize', handleResize);
|
||||||
|
getImgSrcByToken();
|
||||||
|
});
|
||||||
|
|
||||||
|
onUnmounted(() => {
|
||||||
|
window.removeEventListener('resize', handleResize);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
// 携带token请求img的src
|
// 携带token请求img的src
|
||||||
const getImgSrcByToken = (src?: string) => {
|
const getImgSrcByToken = (src?: string) => {
|
||||||
if (props.authSrc.indexOf(".pdf") >= 0) {
|
if (props.authSrc.indexOf(".pdf") >= 0) {
|
||||||
showIframe.value = true;
|
showIframe.value = true;
|
||||||
|
pdfDialogVisible.value = true;
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
const imgSrc = src || props.authSrc;
|
const imgSrc = src || props.authSrc;
|
||||||
const tenantId = Session.getTenant();
|
const tenantId = Session.getTenant();
|
||||||
@@ -52,12 +110,11 @@ const getImgSrcByToken = (src?: string) => {
|
|||||||
request.send(null);
|
request.send(null);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// 图片处理逻辑(已注释,如需要可取消注释并更新)
|
// 图片处理逻辑:加载后直接打开预览
|
||||||
showIframe.value = false;
|
showIframe.value = false;
|
||||||
|
pdfDialogVisible.value = false;
|
||||||
const imgSrc = src || props.authSrc;
|
const imgSrc = src || props.authSrc;
|
||||||
const tenantId = Session.getTenant();
|
const tenantId = Session.getTenant();
|
||||||
const img = imgRef.value;
|
|
||||||
if (!img) return;
|
|
||||||
|
|
||||||
const request = new XMLHttpRequest();
|
const request = new XMLHttpRequest();
|
||||||
request.responseType = 'blob';
|
request.responseType = 'blob';
|
||||||
@@ -66,10 +123,8 @@ const getImgSrcByToken = (src?: string) => {
|
|||||||
request.setRequestHeader('TENANT-ID', tenantId);
|
request.setRequestHeader('TENANT-ID', tenantId);
|
||||||
request.onreadystatechange = () => {
|
request.onreadystatechange = () => {
|
||||||
if (request.readyState == XMLHttpRequest.DONE && request.status == 200) {
|
if (request.readyState == XMLHttpRequest.DONE && request.status == 200) {
|
||||||
img.src = URL.createObjectURL(request.response);
|
imageSrc.value = URL.createObjectURL(request.response);
|
||||||
img.onload = () => {
|
imagePreviewVisible.value = true;
|
||||||
URL.revokeObjectURL(img.src);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
request.send(null);
|
request.send(null);
|
||||||
@@ -86,8 +141,10 @@ defineExpose({
|
|||||||
refreshImg
|
refreshImg
|
||||||
});
|
});
|
||||||
|
|
||||||
// 组件挂载时执行
|
|
||||||
onMounted(() => {
|
|
||||||
getImgSrcByToken();
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
<style scoped>
|
||||||
|
.pdf-preview-dialog :deep(.el-dialog__body) {
|
||||||
|
padding: 20px !important;
|
||||||
|
overflow-y: hidden !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
@@ -34,14 +34,14 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, reactive } from 'vue'
|
import { ref, reactive } from 'vue'
|
||||||
import { useMessage, useMessageBox } from '/@/hooks/message'
|
import { useMessage, useMessageBox } from '/@/hooks/message'
|
||||||
import { putObj as editTitle } from '/@/api/professional/professionaluser/professionaltitlerelation'
|
import { examObj as editTitle } from '/@/api/professional/professionaluser/professionaltitlerelation'
|
||||||
import { putObj as editQua } from '/@/api/professional/professionaluser/professionalqualificationrelation'
|
import { examObj as editQua } from '/@/api/professional/professionaluser/professionalqualificationrelation'
|
||||||
import { putObj as editCer } from '/@/api/professional/professionaluser/professionalteachercertificaterelation'
|
import { examObj as editCer } from '/@/api/professional/professionaluser/professionalteachercertificaterelation'
|
||||||
import { putObj as editEducation } from '/@/api/professional/professionaluser/professionalteacheracademicrelation'
|
import { examObj as editEducation } from '/@/api/professional/professionaluser/professionalteacheracademicrelation'
|
||||||
import { putObj as editHonor } from '/@/api/professional/professionaluser/professionalteacherhonor'
|
import { examObj as editHonor } from '/@/api/professional/professionaluser/professionalteacherhonor'
|
||||||
import { putObj as editPaper } from '/@/api/professional/professionalteacherpaper'
|
import { examObj as editPaper } from '/@/api/professional/professionalteacherpaper'
|
||||||
import { putObj as editMaterial } from '/@/api/professional/professionalteachingmaterial'
|
import { examObj as editMaterial } from '/@/api/professional/professionalteachingmaterial'
|
||||||
import { putObj as editTopic } from '/@/api/professional/professionaltopiclist'
|
import { examObj as editTopic } from '/@/api/professional/professionaltopiclist'
|
||||||
|
|
||||||
// Emits
|
// Emits
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
|
|||||||
@@ -96,7 +96,6 @@
|
|||||||
import { ref, reactive, computed } from 'vue'
|
import { ref, reactive, computed } from 'vue'
|
||||||
import { Session } from '/@/utils/storage'
|
import { Session } from '/@/utils/storage'
|
||||||
import { useMessage } from '/@/hooks/message'
|
import { useMessage } from '/@/hooks/message'
|
||||||
import { getMyTeacherNo } from '/@/api/professional/professionaluser/teacherbase'
|
|
||||||
import { addObj } from '/@/api/professional/professionaluser/professionalqualificationrelation'
|
import { addObj } from '/@/api/professional/professionaluser/professionalqualificationrelation'
|
||||||
import { checkLocked } from '/@/api/professional/professionalstatuslock'
|
import { checkLocked } from '/@/api/professional/professionalstatuslock'
|
||||||
import { getLevelList } from '/@/api/professional/rsbase/professionalqualificationconfig'
|
import { getLevelList } from '/@/api/professional/rsbase/professionalqualificationconfig'
|
||||||
@@ -126,7 +125,6 @@ const dataForm = reactive({
|
|||||||
materialA: '',
|
materialA: '',
|
||||||
evidenceA: '',
|
evidenceA: '',
|
||||||
state: '',
|
state: '',
|
||||||
teacherNo: '',
|
|
||||||
id: ''
|
id: ''
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -144,6 +142,9 @@ const formRules = {
|
|||||||
certificateNumber: [
|
certificateNumber: [
|
||||||
{ required: true, message: '请输入证书编号', trigger: 'blur' },
|
{ required: true, message: '请输入证书编号', trigger: 'blur' },
|
||||||
{ pattern: /^[A-Za-z0-9]+$/, message: '证书编号只能包含英文和数字', trigger: 'blur' }
|
{ pattern: /^[A-Za-z0-9]+$/, message: '证书编号只能包含英文和数字', trigger: 'blur' }
|
||||||
|
],
|
||||||
|
materialA: [
|
||||||
|
{ required: true, message: '请上传证明材料', trigger: 'change' }
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -211,14 +212,34 @@ const materiaUploadSuccess = (response: any) => {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
dataForm.evidenceA = response.data.url
|
dataForm.evidenceA = response.data.url
|
||||||
|
dataForm.materialA = response.data.url
|
||||||
|
// 上传成功后清除该字段的验证错误
|
||||||
|
formRef.value?.clearValidate('materialA')
|
||||||
}
|
}
|
||||||
|
|
||||||
// 打开对话框
|
// 打开对话框
|
||||||
const openDialog = async (row?: any) => {
|
const openDialog = async (row?: any) => {
|
||||||
|
// 新增模式:先检查是否锁定
|
||||||
|
if (!row || !row.id) {
|
||||||
|
try {
|
||||||
|
const lockResponse = await checkLocked('job')
|
||||||
|
if (lockResponse.data) {
|
||||||
|
message.warning("新增功能已锁定,暂不允许操作")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
// 错误处理已在数据请求层统一处理,此处不需要提示
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 公共设置
|
||||||
|
url.value = `/professional/file/teacherAboutInfoUpload?type=3`
|
||||||
|
fileList.value = []
|
||||||
|
|
||||||
|
// 根据是否有 row 设置不同的表单数据
|
||||||
if (row && row.id) {
|
if (row && row.id) {
|
||||||
// 编辑模式
|
// 编辑模式:使用传入的数据
|
||||||
url.value = `/professional/file/teacherAboutInfoUpload?teacherNo=${row.teacherNo}&type=3`
|
|
||||||
fileList.value = []
|
|
||||||
Object.assign(dataForm, {
|
Object.assign(dataForm, {
|
||||||
worker: row.worker || '',
|
worker: row.worker || '',
|
||||||
qualificationConfigId: row.qualificationConfigId || '',
|
qualificationConfigId: row.qualificationConfigId || '',
|
||||||
@@ -227,59 +248,32 @@ const openDialog = async (row?: any) => {
|
|||||||
materialA: row.materialA || '',
|
materialA: row.materialA || '',
|
||||||
evidenceA: row.evidenceA || '',
|
evidenceA: row.evidenceA || '',
|
||||||
state: row.state || '',
|
state: row.state || '',
|
||||||
teacherNo: row.teacherNo || '',
|
|
||||||
id: row.id || ''
|
id: row.id || ''
|
||||||
})
|
})
|
||||||
showForm.value = true
|
|
||||||
await initDicData()
|
|
||||||
dialogVisible.value = true
|
|
||||||
} else {
|
} else {
|
||||||
// 新增模式:先检查是否锁定,再获取当前用户的 teacherNo
|
// 新增模式:重置为空
|
||||||
try {
|
Object.assign(dataForm, {
|
||||||
const lockResponse = await checkLocked('job')
|
worker: '',
|
||||||
if (lockResponse.data) {
|
qualificationConfigId: '',
|
||||||
// 已锁定
|
certificateTime: '',
|
||||||
message.warning("新增功能已锁定,暂不允许操作")
|
certificateNumber: '',
|
||||||
return
|
materialA: '',
|
||||||
}
|
evidenceA: '',
|
||||||
|
state: '',
|
||||||
// 未锁定,继续获取 teacherNo
|
id: ''
|
||||||
const response = await getMyTeacherNo()
|
})
|
||||||
const teacherNo = response.data
|
|
||||||
url.value = `/professional/file/teacherAboutInfoUpload?teacherNo=${teacherNo}&type=3`
|
|
||||||
Object.assign(dataForm, {
|
|
||||||
worker: '',
|
|
||||||
qualificationConfigId: '',
|
|
||||||
certificateTime: '',
|
|
||||||
certificateNumber: '',
|
|
||||||
materialA: '',
|
|
||||||
evidenceA: '',
|
|
||||||
state: '',
|
|
||||||
teacherNo: teacherNo,
|
|
||||||
id: ''
|
|
||||||
})
|
|
||||||
fileList.value = []
|
|
||||||
// 先加载字典数据,再显示表单
|
|
||||||
await initDicData()
|
|
||||||
showForm.value = true
|
|
||||||
dialogVisible.value = true
|
|
||||||
} catch (error) {
|
|
||||||
message.error('获取教师编号失败')
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 公共操作:加载字典数据并显示对话框
|
||||||
|
await initDicData()
|
||||||
|
showForm.value = true
|
||||||
|
dialogVisible.value = true
|
||||||
}
|
}
|
||||||
|
|
||||||
// 提交表单
|
// 提交表单
|
||||||
const dialogSubmit = async () => {
|
const dialogSubmit = async () => {
|
||||||
if (!formRef.value) return
|
if (!formRef.value) return
|
||||||
|
|
||||||
// 验证证明材料是否上传(与 MultiDialog 保持一致)
|
|
||||||
if (!dataForm.evidenceA && !dataForm.materialA) {
|
|
||||||
message.warning("请上传证明材料")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
await formRef.value.validate(async (valid: boolean) => {
|
await formRef.value.validate(async (valid: boolean) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
submitLoading.value = true
|
submitLoading.value = true
|
||||||
@@ -290,16 +284,8 @@ const dialogSubmit = async () => {
|
|||||||
dataForm.evidenceA = dataForm.materialA
|
dataForm.evidenceA = dataForm.materialA
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dataForm.id) {
|
await addObj(dataForm)
|
||||||
// 编辑模式
|
message.success(dataForm.id ? "修改成功" : "提交成功")
|
||||||
dataForm.state = '0'
|
|
||||||
await addObj(dataForm)
|
|
||||||
message.success("修改成功")
|
|
||||||
} else {
|
|
||||||
// 新增模式
|
|
||||||
await addObj(dataForm)
|
|
||||||
message.success("提交成功")
|
|
||||||
}
|
|
||||||
dialogVisible.value = false
|
dialogVisible.value = false
|
||||||
emit('refreshData')
|
emit('refreshData')
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
|
|||||||
@@ -166,15 +166,13 @@
|
|||||||
@size-change="sizeChangeHandle"
|
@size-change="sizeChangeHandle"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<!-- 材料预览对话框 -->
|
<!-- 材料预览:图片直接显示,PDF 在组件内部 dialog 中显示 -->
|
||||||
<el-dialog v-model="dialogVisible" title="职业资格材料" append-to-body width="90%">
|
<auth-img
|
||||||
<auth-img
|
v-for="src in imgUrl"
|
||||||
v-for="src in imgUrl"
|
:key="src.title"
|
||||||
:key="src.title"
|
:authSrc="src.url"
|
||||||
:authSrc="src.url"
|
dialog-title="职业资格材料"
|
||||||
style="height:1000px;"
|
/>
|
||||||
/>
|
|
||||||
</el-dialog>
|
|
||||||
|
|
||||||
<!-- 子组件 -->
|
<!-- 子组件 -->
|
||||||
<DataForm ref="dataFormRef" @refreshData="handleFilter" />
|
<DataForm ref="dataFormRef" @refreshData="handleFilter" />
|
||||||
@@ -249,7 +247,6 @@ const search = reactive({
|
|||||||
})
|
})
|
||||||
|
|
||||||
// 材料预览
|
// 材料预览
|
||||||
const dialogVisible = ref(false)
|
|
||||||
const imgUrl = ref<Array<{ title: string; url: string }>>([])
|
const imgUrl = ref<Array<{ title: string; url: string }>>([])
|
||||||
|
|
||||||
// 导出加载状态
|
// 导出加载状态
|
||||||
@@ -283,6 +280,7 @@ const state: BasicTableProps = reactive<BasicTableProps>({
|
|||||||
|
|
||||||
const { getDataList, currentChangeHandle, sizeChangeHandle, tableStyle } = useTable(state)
|
const { getDataList, currentChangeHandle, sizeChangeHandle, tableStyle } = useTable(state)
|
||||||
|
|
||||||
|
// 预览材料
|
||||||
// 预览材料
|
// 预览材料
|
||||||
const handlePreview = (list: string[]) => {
|
const handlePreview = (list: string[]) => {
|
||||||
imgUrl.value = []
|
imgUrl.value = []
|
||||||
@@ -293,9 +291,6 @@ const handlePreview = (list: string[]) => {
|
|||||||
url: v
|
url: v
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
nextTick(() => {
|
|
||||||
dialogVisible.value = true
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog v-model="dialogVisible" title="编辑学历学位" width="800px" append-to-body :close-on-click-modal="false" destroy-on-close>
|
<el-dialog v-model="dialogVisible" title="编辑学历学位" width="600px" append-to-body :close-on-click-modal="false" destroy-on-close>
|
||||||
<div v-if="showForm">
|
<div v-if="showForm">
|
||||||
<el-form
|
<el-form
|
||||||
ref="formRef"
|
ref="formRef"
|
||||||
@@ -14,7 +14,6 @@
|
|||||||
placeholder="请选择毕业时间"
|
placeholder="请选择毕业时间"
|
||||||
format="YYYY-MM-DD"
|
format="YYYY-MM-DD"
|
||||||
value-format="YYYY-MM-DD HH:mm:ss"
|
value-format="YYYY-MM-DD HH:mm:ss"
|
||||||
style="width: 100%"
|
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
@@ -24,7 +23,6 @@
|
|||||||
filterable
|
filterable
|
||||||
clearable
|
clearable
|
||||||
placeholder="请选择教育类型"
|
placeholder="请选择教育类型"
|
||||||
style="width: 100%"
|
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in educationTypeList"
|
v-for="item in educationTypeList"
|
||||||
@@ -41,7 +39,7 @@
|
|||||||
filterable
|
filterable
|
||||||
clearable
|
clearable
|
||||||
placeholder="请选择学历"
|
placeholder="请选择学历"
|
||||||
style="width: 100%"
|
@change="handleQualificationChange"
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in qualificationList"
|
v-for="item in qualificationList"
|
||||||
@@ -58,7 +56,7 @@
|
|||||||
filterable
|
filterable
|
||||||
clearable
|
clearable
|
||||||
placeholder="请选择学位"
|
placeholder="请选择学位"
|
||||||
style="width: 100%"
|
@change="handleDegreeChange"
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in degreeList"
|
v-for="item in degreeList"
|
||||||
@@ -96,40 +94,40 @@
|
|||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="学历证书" prop="materialA">
|
<el-form-item v-if="needQualificationImg" label="学历证书" prop="qualificationImg" required>
|
||||||
<el-upload
|
<el-upload
|
||||||
:headers="headers"
|
:headers="headers"
|
||||||
:limit="1"
|
:limit="1"
|
||||||
:action="url"
|
:action="url"
|
||||||
:file-list="fileList"
|
:file-list="fileList"
|
||||||
:on-success="materiaUploadSuccess"
|
:on-success="materiaUploadSuccess"
|
||||||
:accept="'.jpg,.jpeg,.png,.pdf'"
|
:accept="'.jpg,.jpeg,.png,.pdf'"
|
||||||
>
|
>
|
||||||
<el-button size="small" type="primary">点击上传</el-button>
|
<el-button size="small" type="primary">点击上传</el-button>
|
||||||
<template #tip>
|
<template #tip>
|
||||||
<div style="margin-top: 8px;">
|
<div style="margin-top: 8px;">
|
||||||
<el-tag>仅支持jpg,jpeg,png,pdf后缀的文件上传</el-tag>
|
<el-tag>仅支持jpg,jpeg,png,pdf后缀的文件上传</el-tag>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-upload>
|
</el-upload>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="学位证书" prop="materialB">
|
<el-form-item v-if="needDegreeImg" label="学位证书" prop="degreeImg" required>
|
||||||
<el-upload
|
<el-upload
|
||||||
:headers="headers"
|
:headers="headers"
|
||||||
:limit="1"
|
:limit="1"
|
||||||
:action="url"
|
:action="url"
|
||||||
:file-list="fileListB"
|
:file-list="fileListB"
|
||||||
:on-success="materiaUploadSuccessB"
|
:on-success="materiaUploadSuccessB"
|
||||||
:accept="'.jpg,.jpeg,.png,.pdf'"
|
:accept="'.jpg,.jpeg,.png,.pdf'"
|
||||||
>
|
>
|
||||||
<el-button size="small" type="primary">点击上传</el-button>
|
<el-button size="small" type="primary">点击上传</el-button>
|
||||||
<template #tip>
|
<template #tip>
|
||||||
<div style="margin-top: 8px;">
|
<div style="margin-top: 8px;">
|
||||||
<el-tag>仅支持jpg,jpeg,png,pdf后缀的文件上传</el-tag>
|
<el-tag>仅支持jpg,jpeg,png,pdf后缀的文件上传</el-tag>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-upload>
|
</el-upload>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</div>
|
</div>
|
||||||
@@ -144,10 +142,9 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, reactive, computed } from 'vue'
|
import { ref, reactive, computed, nextTick } from 'vue'
|
||||||
import { Session } from '/@/utils/storage'
|
import { Session } from '/@/utils/storage'
|
||||||
import { useMessage } from '/@/hooks/message'
|
import { useMessage } from '/@/hooks/message'
|
||||||
import { getMyTeacherNo } from '/@/api/professional/professionaluser/teacherbase'
|
|
||||||
import { addObj } from '/@/api/professional/professionaluser/professionalteacheracademicrelation'
|
import { addObj } from '/@/api/professional/professionaluser/professionalteacheracademicrelation'
|
||||||
import { getAllTypeList } from '/@/api/professional/rsbase/professionalacademiceducationtypeconfig'
|
import { getAllTypeList } from '/@/api/professional/rsbase/professionalacademiceducationtypeconfig'
|
||||||
import { getQualificationList } from '/@/api/professional/rsbase/academicqualificationsconfig'
|
import { getQualificationList } from '/@/api/professional/rsbase/academicqualificationsconfig'
|
||||||
@@ -178,34 +175,66 @@ const dataForm = reactive({
|
|||||||
graduateSchool: '',
|
graduateSchool: '',
|
||||||
major: '',
|
major: '',
|
||||||
certificateNumber: '',
|
certificateNumber: '',
|
||||||
materialA: '',
|
|
||||||
materialB: '',
|
|
||||||
qualificationImg: '',
|
qualificationImg: '',
|
||||||
degreeImg: '',
|
degreeImg: '',
|
||||||
state: '',
|
state: '',
|
||||||
teacherNo: '',
|
|
||||||
id: ''
|
id: ''
|
||||||
})
|
})
|
||||||
|
|
||||||
// 表单验证规则
|
// 计算属性:是否需要学历证书(选择了学历)
|
||||||
const formRules = {
|
const needQualificationImg = computed(() => {
|
||||||
graduateTime: [
|
return !!dataForm.qualificationConfigId
|
||||||
{ required: true, message: '请选择毕业时间', trigger: 'change' }
|
})
|
||||||
],
|
|
||||||
type: [
|
// 计算属性:是否需要学位证书(选择了学位且不等于 -1 或"无")
|
||||||
{ required: true, message: '请选择教育类型', trigger: 'change' }
|
const needDegreeImg = computed(() => {
|
||||||
],
|
if (!dataForm.degreeConfigId) return false
|
||||||
graduateSchool: [
|
// 检查是否为 -1 或"无"(处理类型转换)
|
||||||
{ required: true, message: '请输入毕业学校', trigger: 'blur' }
|
const degreeId = String(dataForm.degreeConfigId)
|
||||||
],
|
if (degreeId === '-1') return false
|
||||||
major: [
|
// 检查学位列表中是否有名称为"无"的选项
|
||||||
{ required: true, message: '请输入所学专业', trigger: 'blur' }
|
const degreeItem = degreeList.value.find(item => String(item.id) === degreeId)
|
||||||
],
|
if (degreeItem && degreeItem.degreeName === '无') return false
|
||||||
certificateNumber: [
|
return true
|
||||||
{ required: true, message: '请输入证书编码', trigger: 'blur' },
|
})
|
||||||
{ pattern: /^[A-Za-z0-9]+$/, message: '证书编码只能包含英文和数字', trigger: 'blur' }
|
|
||||||
]
|
// 动态验证规则
|
||||||
}
|
const formRules = computed(() => {
|
||||||
|
const rules: any = {
|
||||||
|
graduateTime: [
|
||||||
|
{ required: true, message: '请选择毕业时间', trigger: 'change' }
|
||||||
|
],
|
||||||
|
type: [
|
||||||
|
{ required: true, message: '请选择教育类型', trigger: 'change' }
|
||||||
|
],
|
||||||
|
graduateSchool: [
|
||||||
|
{ required: true, message: '请输入毕业学校', trigger: 'blur' }
|
||||||
|
],
|
||||||
|
major: [
|
||||||
|
{ required: true, message: '请输入所学专业', trigger: 'blur' }
|
||||||
|
],
|
||||||
|
certificateNumber: [
|
||||||
|
{ required: true, message: '请输入证书编码', trigger: 'blur' },
|
||||||
|
{ pattern: /^[A-Za-z0-9]+$/, message: '证书编码只能包含英文和数字', trigger: 'blur' }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
// 只有当需要学历证书时才添加验证规则
|
||||||
|
if (needQualificationImg.value) {
|
||||||
|
rules.qualificationImg = [
|
||||||
|
{ required: true, message: '请上传学历证书', trigger: 'change' }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
// 只有当需要学位证书时才添加验证规则
|
||||||
|
if (needDegreeImg.value) {
|
||||||
|
rules.degreeImg = [
|
||||||
|
{ required: true, message: '请上传学位证书', trigger: 'change' }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
return rules
|
||||||
|
})
|
||||||
|
|
||||||
// 下拉列表数据
|
// 下拉列表数据
|
||||||
const educationTypeList = ref<any[]>([])
|
const educationTypeList = ref<any[]>([])
|
||||||
@@ -241,23 +270,17 @@ const initDicData = async () => {
|
|||||||
|
|
||||||
// 获取教育类型列表
|
// 获取教育类型列表
|
||||||
if (eduRes && eduRes.data) {
|
if (eduRes && eduRes.data) {
|
||||||
educationTypeList.value = Array.isArray(eduRes.data)
|
educationTypeList.value = eduRes.data
|
||||||
? eduRes.data
|
|
||||||
: (eduRes.data.records || eduRes.data.list || [])
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取学历列表
|
// 获取学历列表
|
||||||
if (quaRes && quaRes.data) {
|
if (quaRes && quaRes.data) {
|
||||||
qualificationList.value = Array.isArray(quaRes.data)
|
qualificationList.value = quaRes.data
|
||||||
? quaRes.data
|
|
||||||
: (quaRes.data.records || quaRes.data.list || [])
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取学位列表
|
// 获取学位列表
|
||||||
if (degRes && degRes.data) {
|
if (degRes && degRes.data) {
|
||||||
degreeList.value = Array.isArray(degRes.data)
|
degreeList.value = degRes.data
|
||||||
? degRes.data
|
|
||||||
: (degRes.data.records || degRes.data.list || [])
|
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// 获取字典数据失败
|
// 获取字典数据失败
|
||||||
@@ -269,6 +292,26 @@ const handleCertificateNumberInput = (value: string) => {
|
|||||||
dataForm.certificateNumber = value.replace(/[^A-Za-z0-9]/g, '')
|
dataForm.certificateNumber = value.replace(/[^A-Za-z0-9]/g, '')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 学历改变时的处理
|
||||||
|
const handleQualificationChange = () => {
|
||||||
|
// 如果不需要学历证书,清除学历证书字段、文件列表和验证错误
|
||||||
|
if (!needQualificationImg.value) {
|
||||||
|
dataForm.qualificationImg = ''
|
||||||
|
fileList.value = []
|
||||||
|
formRef.value?.clearValidate('qualificationImg')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 学位改变时的处理
|
||||||
|
const handleDegreeChange = () => {
|
||||||
|
// 如果不需要学位证书,清除学位证书字段、文件列表和验证错误
|
||||||
|
if (!needDegreeImg.value) {
|
||||||
|
dataForm.degreeImg = ''
|
||||||
|
fileListB.value = []
|
||||||
|
formRef.value?.clearValidate('degreeImg')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 文件上传成功 - 学历证书
|
// 文件上传成功 - 学历证书
|
||||||
const materiaUploadSuccess = (response: any) => {
|
const materiaUploadSuccess = (response: any) => {
|
||||||
if (response.data && response.data.code === "-1") {
|
if (response.data && response.data.code === "-1") {
|
||||||
@@ -276,120 +319,113 @@ const materiaUploadSuccess = (response: any) => {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
dataForm.qualificationImg = response.data.url
|
dataForm.qualificationImg = response.data.url
|
||||||
|
// 清除验证错误
|
||||||
|
formRef.value?.clearValidate('qualificationImg')
|
||||||
}
|
}
|
||||||
|
|
||||||
// 文件上传成功 - 学位证书
|
// 文件上传成功 - 学位证书
|
||||||
const materiaUploadSuccessB = (response: any) => {
|
const materiaUploadSuccessB = (response: any) => {
|
||||||
if (response.data && response.data.code === "-1") {
|
if (response.data && response.data.code === "-1") {
|
||||||
message.error("当前不允许上传文件")
|
message.error("当前不允许上传文件")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
dataForm.degreeImg = response.data.url
|
dataForm.degreeImg = response.data.url
|
||||||
|
// 清除验证错误
|
||||||
|
formRef.value?.clearValidate('degreeImg')
|
||||||
}
|
}
|
||||||
|
|
||||||
// 打开对话框
|
// 打开对话框
|
||||||
const openDialog = async (row?: any) => {
|
const openDialog = async (row?: any) => {
|
||||||
if (row && row.id) {
|
// 新增模式:先检查是否锁定
|
||||||
// 编辑模式
|
if (!row || !row.id) {
|
||||||
url.value = `/professional/file/teacherAboutInfoUpload?teacherNo=${row.teacherNo}&type=1`
|
|
||||||
fileList.value = []
|
|
||||||
fileListB.value = []
|
|
||||||
Object.assign(dataForm, {
|
|
||||||
graduateTime: row.graduateTime || '',
|
|
||||||
type: row.type || '',
|
|
||||||
qualificationConfigId: row.qualificationConfigId || '',
|
|
||||||
degreeConfigId: row.degreeConfigId || '',
|
|
||||||
graduateSchool: row.graduateSchool || '',
|
|
||||||
major: row.major || '',
|
|
||||||
certificateNumber: row.certificateNumber || '',
|
|
||||||
materialA: row.materialA || '',
|
|
||||||
materialB: row.materialB || '',
|
|
||||||
qualificationImg: row.qualificationImg || '',
|
|
||||||
degreeImg: row.degreeImg || '',
|
|
||||||
state: row.state || '',
|
|
||||||
teacherNo: row.teacherNo || '',
|
|
||||||
id: row.id || ''
|
|
||||||
})
|
|
||||||
showForm.value = true
|
|
||||||
await initDicData()
|
|
||||||
dialogVisible.value = true
|
|
||||||
} else {
|
|
||||||
// 新增模式:先检查是否锁定,再获取当前用户的 teacherNo
|
|
||||||
try {
|
try {
|
||||||
const lockResponse = await checkLocked('acade')
|
const lockResponse = await checkLocked('acade')
|
||||||
if (lockResponse.data) {
|
if (lockResponse.data) {
|
||||||
// 已锁定
|
|
||||||
message.warning("新增功能已锁定,暂不允许操作")
|
message.warning("新增功能已锁定,暂不允许操作")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 未锁定,继续获取 teacherNo
|
|
||||||
const response = await getMyTeacherNo()
|
|
||||||
const teacherNo = response.data
|
|
||||||
url.value = `/professional/file/teacherAboutInfoUpload?teacherNo=${teacherNo}&type=1`
|
|
||||||
Object.assign(dataForm, {
|
|
||||||
graduateTime: '',
|
|
||||||
type: '',
|
|
||||||
qualificationConfigId: '',
|
|
||||||
degreeConfigId: '',
|
|
||||||
graduateSchool: '',
|
|
||||||
major: '',
|
|
||||||
certificateNumber: '',
|
|
||||||
materialA: '',
|
|
||||||
materialB: '',
|
|
||||||
qualificationImg: '',
|
|
||||||
degreeImg: '',
|
|
||||||
state: '',
|
|
||||||
teacherNo: teacherNo,
|
|
||||||
id: ''
|
|
||||||
})
|
|
||||||
fileList.value = []
|
|
||||||
fileListB.value = []
|
|
||||||
// 先加载字典数据,再显示表单
|
|
||||||
await initDicData()
|
|
||||||
showForm.value = true
|
|
||||||
dialogVisible.value = true
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
message.error('获取教师编号失败')
|
// 错误处理已在数据请求层统一处理,此处不需要提示
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 公共设置
|
||||||
|
url.value = `/professional/file/teacherAboutInfoUpload?type=1`
|
||||||
|
fileList.value = []
|
||||||
|
fileListB.value = []
|
||||||
|
|
||||||
|
// 根据是否有 row 设置不同的表单数据
|
||||||
|
if (row && row.id) {
|
||||||
|
// 编辑模式:使用传入的数据
|
||||||
|
// 确保类型匹配(将 id 转换为字符串或数字,与选项列表保持一致)
|
||||||
|
Object.assign(dataForm, {
|
||||||
|
graduateTime: row.graduateTime || '',
|
||||||
|
type: row.type !== null && row.type !== undefined ? String(row.type) : '',
|
||||||
|
qualificationConfigId: row.qualificationConfigId !== null && row.qualificationConfigId !== undefined ? String(row.qualificationConfigId) : '',
|
||||||
|
degreeConfigId: row.degreeConfigId !== null && row.degreeConfigId !== undefined ? String(row.degreeConfigId) : '',
|
||||||
|
graduateSchool: row.graduateSchool || '',
|
||||||
|
major: row.major || '',
|
||||||
|
certificateNumber: row.certificateNumber || '',
|
||||||
|
qualificationImg: row.qualificationImg || '',
|
||||||
|
degreeImg: row.degreeImg || '',
|
||||||
|
state: row.state || '',
|
||||||
|
id: row.id || ''
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
// 新增模式:重置为空
|
||||||
|
Object.assign(dataForm, {
|
||||||
|
graduateTime: '',
|
||||||
|
type: '',
|
||||||
|
qualificationConfigId: '',
|
||||||
|
degreeConfigId: '',
|
||||||
|
graduateSchool: '',
|
||||||
|
major: '',
|
||||||
|
certificateNumber: '',
|
||||||
|
qualificationImg: '',
|
||||||
|
degreeImg: '',
|
||||||
|
state: '',
|
||||||
|
id: ''
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 公共操作:先加载字典数据,再显示对话框
|
||||||
|
await initDicData()
|
||||||
|
// 等待字典数据加载完成后再显示表单,确保选项列表已准备好
|
||||||
|
await nextTick()
|
||||||
|
showForm.value = true
|
||||||
|
dialogVisible.value = true
|
||||||
}
|
}
|
||||||
|
|
||||||
// 提交表单
|
// 提交表单
|
||||||
const dialogSubmit = async () => {
|
const dialogSubmit = async () => {
|
||||||
if (!formRef.value) return
|
if (!formRef.value) return
|
||||||
|
|
||||||
// 验证证明材料是否上传(与 MultiDialog 保持一致:mateA 或 mateB 至少有一个)
|
|
||||||
if (!dataForm.qualificationImg && !dataForm.degreeImg && !dataForm.materialA && !dataForm.materialB) {
|
|
||||||
message.warning("请上传学历或学位证书")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
await formRef.value.validate(async (valid: boolean) => {
|
await formRef.value.validate(async (valid: boolean) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
submitLoading.value = true
|
submitLoading.value = true
|
||||||
try {
|
try {
|
||||||
// 统一使用 addObj 接口(新增和编辑都使用同一个接口)
|
// 统一使用 addObj 接口(新增和编辑都使用)
|
||||||
// 确保 qualificationImg 或 materialA 有值
|
const submitData: any = {
|
||||||
if (!dataForm.qualificationImg && dataForm.materialA) {
|
graduateTime: dataForm.graduateTime,
|
||||||
dataForm.qualificationImg = dataForm.materialA
|
type: dataForm.type,
|
||||||
}
|
qualificationConfigId: dataForm.qualificationConfigId,
|
||||||
// 确保 degreeImg 或 materialB 有值
|
degreeConfigId: dataForm.degreeConfigId,
|
||||||
if (!dataForm.degreeImg && dataForm.materialB) {
|
graduateSchool: dataForm.graduateSchool,
|
||||||
dataForm.degreeImg = dataForm.materialB
|
major: dataForm.major,
|
||||||
|
certificateNumber: dataForm.certificateNumber,
|
||||||
|
qualificationImg: dataForm.qualificationImg,
|
||||||
|
degreeImg: dataForm.degreeImg,
|
||||||
|
state: '' // 待审核
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 编辑时需要传递 id
|
||||||
if (dataForm.id) {
|
if (dataForm.id) {
|
||||||
// 编辑模式
|
submitData.id = dataForm.id
|
||||||
dataForm.state = '0'
|
|
||||||
await addObj(dataForm)
|
|
||||||
message.success("修改成功")
|
|
||||||
} else {
|
|
||||||
// 新增模式
|
|
||||||
await addObj(dataForm)
|
|
||||||
message.success("提交成功")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await addObj(submitData)
|
||||||
|
message.success(dataForm.id ? "修改成功" : "提交成功")
|
||||||
dialogVisible.value = false
|
dialogVisible.value = false
|
||||||
emit('refreshData')
|
emit('refreshData')
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
|
|||||||
@@ -95,12 +95,16 @@
|
|||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
<el-table-column prop="graduateTime" label="毕业时间" width="180" align="center" />
|
<el-table-column prop="graduateTime" label="毕业时间" width="180" align="center">
|
||||||
|
|
||||||
<el-table-column prop="degreeConfigId" label="学位" min-width="120" align="center" show-overflow-tooltip>
|
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
{{ getDegreeName(scope.row.degreeConfigId) }}
|
{{ scope.row.graduateTime ? scope.row.graduateTime.split(' ')[0] : '-' }}
|
||||||
</template>
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column prop="type" label="教育类型" min-width="120" align="center" show-overflow-tooltip>
|
||||||
|
<template #default="scope">
|
||||||
|
{{ getEducationTypeName(scope.row.type) }}
|
||||||
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
<el-table-column prop="qualificationConfigId" label="学历" min-width="120" align="center" show-overflow-tooltip>
|
<el-table-column prop="qualificationConfigId" label="学历" min-width="120" align="center" show-overflow-tooltip>
|
||||||
@@ -109,7 +113,14 @@
|
|||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
<el-table-column prop="createTime" label="创建时间" width="180" align="center" />
|
<el-table-column prop="degreeConfigId" label="学位" min-width="120" align="center" show-overflow-tooltip>
|
||||||
|
<template #default="scope">
|
||||||
|
{{ getDegreeName(scope.row.degreeConfigId) }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- <el-table-column prop="createTime" label="创建时间" width="180" align="center" /> -->
|
||||||
|
|
||||||
<el-table-column label="学历证书附件" width="130" align="center">
|
<el-table-column label="学历证书附件" width="130" align="center">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
@@ -181,15 +192,13 @@
|
|||||||
@size-change="sizeChangeHandle"
|
@size-change="sizeChangeHandle"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<!-- 材料预览对话框 -->
|
<!-- 材料预览:图片直接显示,PDF 在组件内部 dialog 中显示 -->
|
||||||
<el-dialog v-model="dialogVisible" :title="dialogTitle" append-to-body width="90%">
|
<auth-img
|
||||||
<auth-img
|
v-for="src in imgUrl"
|
||||||
v-for="src in imgUrl"
|
:key="src.title"
|
||||||
:key="src.title"
|
:authSrc="src.url"
|
||||||
:authSrc="src.url"
|
:dialog-title="dialogTitle"
|
||||||
style="height:1000px;"
|
/>
|
||||||
/>
|
|
||||||
</el-dialog>
|
|
||||||
|
|
||||||
<!-- 子组件 -->
|
<!-- 子组件 -->
|
||||||
<DataForm ref="dataFormRef" @refreshData="handleFilter" />
|
<DataForm ref="dataFormRef" @refreshData="handleFilter" />
|
||||||
@@ -214,6 +223,7 @@ import {
|
|||||||
} from '/@/api/professional/professionaluser/professionalteacheracademicrelation'
|
} from '/@/api/professional/professionaluser/professionalteacheracademicrelation'
|
||||||
import { getDegreeList } from '/@/api/professional/rsbase/professionalacademicdegreeconfig'
|
import { getDegreeList } from '/@/api/professional/rsbase/professionalacademicdegreeconfig'
|
||||||
import { getQualificationList } from '/@/api/professional/rsbase/academicqualificationsconfig'
|
import { getQualificationList } from '/@/api/professional/rsbase/academicqualificationsconfig'
|
||||||
|
import { getAllTypeList } from '/@/api/professional/rsbase/professionalacademiceducationtypeconfig'
|
||||||
import { defineAsyncComponent } from 'vue'
|
import { defineAsyncComponent } from 'vue'
|
||||||
const TeacherNameNo = defineAsyncComponent(() => import('/@/components/TeacherNameNo/index.vue'))
|
const TeacherNameNo = defineAsyncComponent(() => import('/@/components/TeacherNameNo/index.vue'))
|
||||||
const AuditState = defineAsyncComponent(() => import('/@/components/AuditState/index.vue'))
|
const AuditState = defineAsyncComponent(() => import('/@/components/AuditState/index.vue'))
|
||||||
@@ -264,16 +274,16 @@ const search = reactive({
|
|||||||
})
|
})
|
||||||
|
|
||||||
// 材料预览
|
// 材料预览
|
||||||
const dialogVisible = ref(false)
|
|
||||||
const dialogTitle = ref('')
|
const dialogTitle = ref('')
|
||||||
const imgUrl = ref<Array<{ title: string; url: string }>>([])
|
const imgUrl = ref<Array<{ title: string; url: string }>>([])
|
||||||
|
|
||||||
// 导出加载状态
|
// 导出加载状态
|
||||||
const exportLoading = ref(false)
|
const exportLoading = ref(false)
|
||||||
|
|
||||||
// 学位和学历列表
|
// 学位、学历和教育类型列表
|
||||||
const degreeList = ref<any[]>([])
|
const degreeList = ref<any[]>([])
|
||||||
const qualificationList = ref<any[]>([])
|
const qualificationList = ref<any[]>([])
|
||||||
|
const educationTypeList = ref<any[]>([])
|
||||||
|
|
||||||
// 配置 useTable
|
// 配置 useTable
|
||||||
const state: BasicTableProps = reactive<BasicTableProps>({
|
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||||
@@ -321,10 +331,6 @@ const handlePreview = (list: string[], type: number) => {
|
|||||||
} else if (type === 2) {
|
} else if (type === 2) {
|
||||||
dialogTitle.value = '学位证书附件'
|
dialogTitle.value = '学位证书附件'
|
||||||
}
|
}
|
||||||
|
|
||||||
nextTick(() => {
|
|
||||||
dialogVisible.value = true
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -429,20 +435,37 @@ const getQualificationName = (id: string | number) => {
|
|||||||
return item ? item.qualificationName : '-'
|
return item ? item.qualificationName : '-'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取教育类型名称
|
||||||
|
const getEducationTypeName = (id: string | number | undefined) => {
|
||||||
|
if (!id) return '-'
|
||||||
|
const item = educationTypeList.value.find((item: any) => item.id === id || String(item.id) === String(id))
|
||||||
|
return item ? item.name : '-'
|
||||||
|
}
|
||||||
|
|
||||||
// 加载字典数据
|
// 加载字典数据
|
||||||
const loadDictData = async () => {
|
const loadDictData = async () => {
|
||||||
try {
|
try {
|
||||||
|
// 并行加载所有字典数据
|
||||||
|
const [degreeRes, qualRes, eduTypeRes] = await Promise.all([
|
||||||
|
getDegreeList(),
|
||||||
|
getQualificationList(),
|
||||||
|
getAllTypeList()
|
||||||
|
])
|
||||||
|
|
||||||
// 加载学位列表
|
// 加载学位列表
|
||||||
const degreeRes = await getDegreeList()
|
|
||||||
if (degreeRes && degreeRes.data) {
|
if (degreeRes && degreeRes.data) {
|
||||||
degreeList.value = degreeRes.data
|
degreeList.value = degreeRes.data
|
||||||
}
|
}
|
||||||
|
|
||||||
// 加载学历列表
|
// 加载学历列表
|
||||||
const qualRes = await getQualificationList()
|
|
||||||
if (qualRes && qualRes.data) {
|
if (qualRes && qualRes.data) {
|
||||||
qualificationList.value = qualRes.data
|
qualificationList.value = qualRes.data
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 加载教育类型列表
|
||||||
|
if (eduTypeRes && eduTypeRes.data) {
|
||||||
|
educationTypeList.value = eduTypeRes.data
|
||||||
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// Failed to load dict data
|
// Failed to load dict data
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog v-model="dialogVisible" title="编辑教师资格证" width="800px" append-to-body :close-on-click-modal="false" destroy-on-close>
|
<el-dialog v-model="dialogVisible" title="编辑教师资格证" width="600px" append-to-body :close-on-click-modal="false" destroy-on-close>
|
||||||
<div v-if="showForm">
|
<div v-if="showForm">
|
||||||
<el-form
|
<el-form
|
||||||
ref="formRef"
|
ref="formRef"
|
||||||
@@ -10,43 +10,29 @@
|
|||||||
<el-form-item label="类型" prop="certificateConfId">
|
<el-form-item label="类型" prop="certificateConfId">
|
||||||
<el-select
|
<el-select
|
||||||
v-model="dataForm.certificateConfId"
|
v-model="dataForm.certificateConfId"
|
||||||
filterable
|
|
||||||
clearable
|
|
||||||
placeholder="请选择类型"
|
placeholder="请选择类型"
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in teacherCertificateList"
|
v-for="item in teacherCertificateList"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
:label="item.cretificateName || item.certificateName"
|
:label="item.cretificateName"
|
||||||
:value="item.id"
|
:value="item.id"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="取证时间" prop="certificateTime">
|
|
||||||
<el-date-picker
|
|
||||||
v-model="dataForm.certificateTime"
|
|
||||||
type="date"
|
|
||||||
placeholder="请选择取证时间"
|
|
||||||
format="YYYY-MM-DD"
|
|
||||||
value-format="YYYY-MM-DD HH:mm:ss"
|
|
||||||
style="width: 100%"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
|
|
||||||
<el-form-item label="证书编号" prop="certificateNumber">
|
<el-form-item label="证书编号" prop="certificateNumber">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="dataForm.certificateNumber"
|
v-model="dataForm.certificateNumber"
|
||||||
placeholder="请输入证书编号(仅支持英文和数字)"
|
placeholder="请输入证书编号(仅支持英文和数字)"
|
||||||
clearable
|
|
||||||
show-word-limit
|
show-word-limit
|
||||||
maxlength="64"
|
maxlength="64"
|
||||||
@input="handleCertificateNumberInput"
|
@input="handleCertificateNumberInput"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="材料1" prop="materialA">
|
<el-form-item label="证明材料" prop="evidenceA" required>
|
||||||
<el-upload
|
<el-upload
|
||||||
:headers="headers"
|
:headers="headers"
|
||||||
:limit="1"
|
:limit="1"
|
||||||
@@ -63,24 +49,6 @@
|
|||||||
</template>
|
</template>
|
||||||
</el-upload>
|
</el-upload>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="材料2" prop="materialB">
|
|
||||||
<el-upload
|
|
||||||
:headers="headers"
|
|
||||||
:limit="1"
|
|
||||||
:action="url"
|
|
||||||
:file-list="fileListB"
|
|
||||||
:on-success="materiaUploadSuccessB"
|
|
||||||
:accept="'.jpg,.jpeg,.png,.pdf'"
|
|
||||||
>
|
|
||||||
<el-button size="small" type="primary">点击上传</el-button>
|
|
||||||
<template #tip>
|
|
||||||
<div style="margin-top: 8px;">
|
|
||||||
<el-tag>仅支持jpg,jpeg,png,pdf后缀的文件上传</el-tag>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
</el-upload>
|
|
||||||
</el-form-item>
|
|
||||||
</el-form>
|
</el-form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -97,7 +65,6 @@
|
|||||||
import { ref, reactive, computed } from 'vue'
|
import { ref, reactive, computed } from 'vue'
|
||||||
import { Session } from '/@/utils/storage'
|
import { Session } from '/@/utils/storage'
|
||||||
import { useMessage } from '/@/hooks/message'
|
import { useMessage } from '/@/hooks/message'
|
||||||
import { getMyTeacherNo } from '/@/api/professional/professionaluser/teacherbase'
|
|
||||||
import { addObj } from '/@/api/professional/professionaluser/professionalteachercertificaterelation'
|
import { addObj } from '/@/api/professional/professionaluser/professionalteachercertificaterelation'
|
||||||
import { getTeacherCertificateList } from '/@/api/professional/rsbase/professionalteachercertificateconf'
|
import { getTeacherCertificateList } from '/@/api/professional/rsbase/professionalteachercertificateconf'
|
||||||
import { checkLocked } from '/@/api/professional/professionalstatuslock'
|
import { checkLocked } from '/@/api/professional/professionalstatuslock'
|
||||||
@@ -120,14 +87,9 @@ const dialogVisible = ref(false)
|
|||||||
// 表单数据
|
// 表单数据
|
||||||
const dataForm = reactive({
|
const dataForm = reactive({
|
||||||
certificateConfId: '',
|
certificateConfId: '',
|
||||||
certificateTime: '',
|
|
||||||
certificateNumber: '',
|
certificateNumber: '',
|
||||||
materialA: '',
|
|
||||||
materialB: '',
|
|
||||||
evidenceA: '',
|
evidenceA: '',
|
||||||
evidenceB: '',
|
|
||||||
state: '',
|
state: '',
|
||||||
teacherNo: '',
|
|
||||||
id: ''
|
id: ''
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -136,12 +98,12 @@ const formRules = {
|
|||||||
certificateConfId: [
|
certificateConfId: [
|
||||||
{ required: true, message: '请选择类型', trigger: 'change' }
|
{ required: true, message: '请选择类型', trigger: 'change' }
|
||||||
],
|
],
|
||||||
certificateTime: [
|
|
||||||
{ required: true, message: '请选择取证时间', trigger: 'change' }
|
|
||||||
],
|
|
||||||
certificateNumber: [
|
certificateNumber: [
|
||||||
{ required: true, message: '请输入证书编号', trigger: 'blur' },
|
{ required: true, message: '请输入证书编号', trigger: 'blur' },
|
||||||
{ pattern: /^[A-Za-z0-9]+$/, message: '证书编号只能包含英文和数字', trigger: 'blur' }
|
{ pattern: /^[A-Za-z0-9]+$/, message: '证书编号只能包含英文和数字', trigger: 'blur' }
|
||||||
|
],
|
||||||
|
evidenceA: [
|
||||||
|
{ required: true, message: '请上传证明材料', trigger: 'change' }
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -153,7 +115,6 @@ const teacherCertificateList = ref<any[]>([])
|
|||||||
// 上传相关
|
// 上传相关
|
||||||
const url = ref('')
|
const url = ref('')
|
||||||
const fileList = ref<any[]>([])
|
const fileList = ref<any[]>([])
|
||||||
const fileListB = ref<any[]>([])
|
|
||||||
|
|
||||||
// 请求头
|
// 请求头
|
||||||
const headers = computed(() => {
|
const headers = computed(() => {
|
||||||
@@ -168,15 +129,8 @@ const showForm = ref(false)
|
|||||||
// 初始化字典数据
|
// 初始化字典数据
|
||||||
const initDicData = async () => {
|
const initDicData = async () => {
|
||||||
try {
|
try {
|
||||||
// 使用专门的 API 获取数据(与 index.vue 保持一致)
|
const res = await getTeacherCertificateList()
|
||||||
const certResponse = await getTeacherCertificateList()
|
teacherCertificateList.value = res.data || []
|
||||||
|
|
||||||
// 获取教师资格证列表
|
|
||||||
if (certResponse && certResponse.data) {
|
|
||||||
teacherCertificateList.value = Array.isArray(certResponse.data)
|
|
||||||
? certResponse.data
|
|
||||||
: (certResponse.data.records || certResponse.data.list || [])
|
|
||||||
}
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// 获取字典数据失败
|
// 获取字典数据失败
|
||||||
}
|
}
|
||||||
@@ -187,119 +141,87 @@ const handleCertificateNumberInput = (value: string) => {
|
|||||||
dataForm.certificateNumber = value.replace(/[^A-Za-z0-9]/g, '')
|
dataForm.certificateNumber = value.replace(/[^A-Za-z0-9]/g, '')
|
||||||
}
|
}
|
||||||
|
|
||||||
// 文件上传成功 - 材料A
|
// 文件上传成功
|
||||||
const materiaUploadSuccess = (response: any) => {
|
const materiaUploadSuccess = (response: any) => {
|
||||||
if (response.data && response.data.code === "-1") {
|
if (response.data && response.data.code === "-1") {
|
||||||
message.error("当前不允许上传文件")
|
message.error("当前不允许上传文件")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
dataForm.evidenceA = response.data.url
|
dataForm.evidenceA = response.data.url
|
||||||
}
|
// 清除验证错误
|
||||||
|
formRef.value?.clearValidate('evidenceA')
|
||||||
// 文件上传成功 - 材料B
|
|
||||||
const materiaUploadSuccessB = (response: any) => {
|
|
||||||
if (response.data && response.data.code === "-1") {
|
|
||||||
message.error("当前不允许上传文件")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
dataForm.evidenceB = response.data.url
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 打开对话框
|
// 打开对话框
|
||||||
const openDialog = async (row?: any) => {
|
const openDialog = async (row?: any) => {
|
||||||
if (row && row.id) {
|
// 新增模式:先检查是否锁定
|
||||||
// 编辑模式
|
if (!row || !row.id) {
|
||||||
url.value = `/professional/file/teacherAboutInfoUpload?teacherNo=${row.teacherNo}&type=0`
|
|
||||||
fileList.value = []
|
|
||||||
fileListB.value = []
|
|
||||||
Object.assign(dataForm, {
|
|
||||||
certificateConfId: row.certificateConfId || '',
|
|
||||||
certificateTime: row.certificateTime || '',
|
|
||||||
certificateNumber: row.certificateNumber || '',
|
|
||||||
materialA: row.materialA || '',
|
|
||||||
materialB: row.materialB || '',
|
|
||||||
evidenceA: row.evidenceA || '',
|
|
||||||
evidenceB: row.evidenceB || '',
|
|
||||||
state: row.state || '',
|
|
||||||
teacherNo: row.teacherNo || '',
|
|
||||||
id: row.id || ''
|
|
||||||
})
|
|
||||||
showForm.value = true
|
|
||||||
await initDicData()
|
|
||||||
dialogVisible.value = true
|
|
||||||
} else {
|
|
||||||
// 新增模式:先检查是否锁定,再获取当前用户的 teacherNo
|
|
||||||
try {
|
try {
|
||||||
const lockResponse = await checkLocked('teacherTitle')
|
const lockResponse = await checkLocked('teacherTitle')
|
||||||
if (lockResponse.data) {
|
if (lockResponse.data) {
|
||||||
// 已锁定
|
|
||||||
message.warning("新增功能已锁定,暂不允许操作")
|
message.warning("新增功能已锁定,暂不允许操作")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 未锁定,继续获取 teacherNo
|
|
||||||
const response = await getMyTeacherNo()
|
|
||||||
const teacherNo = response.data
|
|
||||||
url.value = `/professional/file/teacherAboutInfoUpload?teacherNo=${teacherNo}&type=0`
|
|
||||||
Object.assign(dataForm, {
|
|
||||||
certificateConfId: '',
|
|
||||||
certificateTime: '',
|
|
||||||
certificateNumber: '',
|
|
||||||
materialA: '',
|
|
||||||
materialB: '',
|
|
||||||
evidenceA: '',
|
|
||||||
evidenceB: '',
|
|
||||||
state: '',
|
|
||||||
teacherNo: teacherNo,
|
|
||||||
id: ''
|
|
||||||
})
|
|
||||||
fileList.value = []
|
|
||||||
fileListB.value = []
|
|
||||||
// 先加载字典数据,再显示表单
|
|
||||||
await initDicData()
|
|
||||||
showForm.value = true
|
|
||||||
dialogVisible.value = true
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
message.error('获取教师编号失败')
|
// 错误处理已在数据请求层统一处理,此处不需要提示
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 公共设置
|
||||||
|
url.value = `/professional/file/teacherAboutInfoUpload?type=0`
|
||||||
|
fileList.value = []
|
||||||
|
|
||||||
|
// 根据是否有 row 设置不同的表单数据
|
||||||
|
if (row && row.id) {
|
||||||
|
// 编辑模式:使用传入的数据
|
||||||
|
Object.assign(dataForm, {
|
||||||
|
certificateConfId: row.certificateConfId || '',
|
||||||
|
certificateNumber: row.certificateNumber || '',
|
||||||
|
evidenceA: row.evidenceA || '',
|
||||||
|
state: row.state || '',
|
||||||
|
id: row.id || ''
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
// 新增模式:重置为空
|
||||||
|
Object.assign(dataForm, {
|
||||||
|
certificateConfId: '',
|
||||||
|
certificateNumber: '',
|
||||||
|
evidenceA: '',
|
||||||
|
state: '',
|
||||||
|
id: ''
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 公共操作:加载字典数据并显示对话框
|
||||||
|
await initDicData()
|
||||||
|
showForm.value = true
|
||||||
|
dialogVisible.value = true
|
||||||
}
|
}
|
||||||
|
|
||||||
// 提交表单
|
// 提交表单
|
||||||
const dialogSubmit = async () => {
|
const dialogSubmit = async () => {
|
||||||
if (!formRef.value) return
|
if (!formRef.value) return
|
||||||
|
|
||||||
// 验证证明材料是否上传(与 MultiDialog 保持一致)
|
|
||||||
if (!dataForm.evidenceA && !dataForm.materialA) {
|
|
||||||
message.warning("请上传证明材料")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
await formRef.value.validate(async (valid: boolean) => {
|
await formRef.value.validate(async (valid: boolean) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
submitLoading.value = true
|
submitLoading.value = true
|
||||||
try {
|
try {
|
||||||
// 统一使用 addObj 接口(新增和编辑都使用同一个接口)
|
// 统一使用 addObj 接口(新增和编辑都使用)
|
||||||
// 确保 evidenceA 或 materialA 有值
|
const submitData: any = {
|
||||||
if (!dataForm.evidenceA && dataForm.materialA) {
|
certificateConfId: dataForm.certificateConfId,
|
||||||
dataForm.evidenceA = dataForm.materialA
|
certificateNumber: dataForm.certificateNumber,
|
||||||
}
|
evidenceA: dataForm.evidenceA,
|
||||||
// 确保 evidenceB 或 materialB 有值
|
state: '' // 待审核
|
||||||
if (!dataForm.evidenceB && dataForm.materialB) {
|
|
||||||
dataForm.evidenceB = dataForm.materialB
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 编辑时需要传递 id
|
||||||
if (dataForm.id) {
|
if (dataForm.id) {
|
||||||
// 编辑模式
|
submitData.id = dataForm.id
|
||||||
dataForm.state = '0'
|
|
||||||
await addObj(dataForm)
|
|
||||||
message.success("修改成功")
|
|
||||||
} else {
|
|
||||||
// 新增模式
|
|
||||||
await addObj(dataForm)
|
|
||||||
message.success("提交成功")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await addObj(submitData)
|
||||||
|
message.success(dataForm.id ? "修改成功" : "提交成功")
|
||||||
dialogVisible.value = false
|
dialogVisible.value = false
|
||||||
emit('refreshData')
|
emit('refreshData')
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
|
|||||||
@@ -162,15 +162,13 @@
|
|||||||
@size-change="sizeChangeHandle"
|
@size-change="sizeChangeHandle"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<!-- 材料预览对话框 -->
|
<!-- 材料预览:图片直接显示,PDF 在组件内部 dialog 中显示 -->
|
||||||
<el-dialog v-model="dialogVisible" title="教师资格材料" append-to-body width="90%">
|
<auth-img
|
||||||
<auth-img
|
v-for="src in imgUrl"
|
||||||
v-for="src in imgUrl"
|
:key="src.title"
|
||||||
:key="src.title"
|
:authSrc="src.url"
|
||||||
:authSrc="src.url"
|
dialog-title="教师资格材料"
|
||||||
style="height:1000px;"
|
/>
|
||||||
/>
|
|
||||||
</el-dialog>
|
|
||||||
|
|
||||||
<!-- 子组件 -->
|
<!-- 子组件 -->
|
||||||
<DataForm ref="dataFormRef" @refreshData="handleFilter" />
|
<DataForm ref="dataFormRef" @refreshData="handleFilter" />
|
||||||
@@ -244,7 +242,6 @@ const search = reactive({
|
|||||||
})
|
})
|
||||||
|
|
||||||
// 材料预览
|
// 材料预览
|
||||||
const dialogVisible = ref(false)
|
|
||||||
const imgUrl = ref<Array<{ title: string; url: string }>>([])
|
const imgUrl = ref<Array<{ title: string; url: string }>>([])
|
||||||
|
|
||||||
// 导出加载状态
|
// 导出加载状态
|
||||||
@@ -287,9 +284,6 @@ const handlePreview = (list: string[]) => {
|
|||||||
url: v
|
url: v
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
nextTick(() => {
|
|
||||||
dialogVisible.value = true
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,55 +1,47 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog v-model="dialogVisible" :title="title" width="80%" append-to-body :close-on-click-modal="false" destroy-on-close>
|
<el-dialog v-model="dialogVisible" :title="title" width="600px" append-to-body :close-on-click-modal="false" destroy-on-close>
|
||||||
<el-row>
|
<el-form
|
||||||
<el-form
|
ref="formRef"
|
||||||
ref="formRef"
|
:model="dataForm"
|
||||||
:model="dataForm"
|
:rules="dataRules"
|
||||||
:rules="dataRules"
|
label-width="120px"
|
||||||
label-width="120px"
|
>
|
||||||
>
|
<el-form-item label="荣誉" prop="honor">
|
||||||
<el-col :span="12">
|
<el-input v-model="dataForm.honor" placeholder="请输入荣誉" clearable />
|
||||||
<el-form-item label="荣誉" prop="honor">
|
</el-form-item>
|
||||||
<el-input v-model="dataForm.honor" placeholder="请输入荣誉" clearable />
|
|
||||||
</el-form-item>
|
<el-form-item label="表彰单位" prop="honorCompany">
|
||||||
</el-col>
|
<el-input v-model="dataForm.honorCompany" placeholder="请输入表彰单位" clearable />
|
||||||
<el-col :span="12">
|
</el-form-item>
|
||||||
<el-form-item label="表彰单位" prop="honorCompany">
|
|
||||||
<el-input v-model="dataForm.honorCompany" placeholder="请输入表彰单位" clearable />
|
<el-form-item label="年份" prop="year">
|
||||||
</el-form-item>
|
<el-date-picker
|
||||||
</el-col>
|
v-model="dataForm.year"
|
||||||
<el-col :span="12">
|
type="year"
|
||||||
<el-form-item label="年份" prop="year">
|
placeholder="请选择年份"
|
||||||
<el-input-number
|
format="YYYY"
|
||||||
v-model="dataForm.year"
|
value-format="YYYY"
|
||||||
:controls="false"
|
/>
|
||||||
:min="1900"
|
</el-form-item>
|
||||||
:max="2100"
|
|
||||||
placeholder="请输入年份"
|
<el-form-item label="证明材料" prop="attachment" required>
|
||||||
style="width: 100%"
|
<el-upload
|
||||||
/>
|
:headers="headers"
|
||||||
</el-form-item>
|
:limit="1"
|
||||||
</el-col>
|
:action="url"
|
||||||
<el-col :span="12">
|
:on-success="materiaUploadSuccess"
|
||||||
<el-form-item label="证明材料" prop="materialA">
|
:file-list="fileList"
|
||||||
<el-upload
|
:accept="'.jpg,.jpeg,.png,.pdf'"
|
||||||
:headers="headers"
|
>
|
||||||
:limit="1"
|
<el-button size="small" type="primary">点击上传</el-button>
|
||||||
:action="url"
|
<template #tip>
|
||||||
:on-success="materiaUploadSuccess"
|
<div style="margin-top: 8px;">
|
||||||
:file-list="fileList"
|
<el-tag>仅支持jpg,jpeg,png,pdf后缀的文件上传</el-tag>
|
||||||
:accept="'.jpg,.jpeg,.png,.pdf'"
|
</div>
|
||||||
>
|
</template>
|
||||||
<el-button size="small" type="primary">点击上传</el-button>
|
</el-upload>
|
||||||
<template #tip>
|
</el-form-item>
|
||||||
<div style="margin-top: 8px;">
|
</el-form>
|
||||||
<el-tag>仅支持jpg,jpeg,png,pdf后缀的文件上传</el-tag>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
</el-upload>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
</el-form>
|
|
||||||
</el-row>
|
|
||||||
|
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<div class="dialog-footer">
|
<div class="dialog-footer">
|
||||||
@@ -64,7 +56,6 @@
|
|||||||
import { ref, reactive, computed } from 'vue'
|
import { ref, reactive, computed } from 'vue'
|
||||||
import { Session } from '/@/utils/storage'
|
import { Session } from '/@/utils/storage'
|
||||||
import { useMessage } from '/@/hooks/message'
|
import { useMessage } from '/@/hooks/message'
|
||||||
import { getMyTeacherNo } from '/@/api/professional/professionaluser/teacherbase'
|
|
||||||
import { addObj } from '/@/api/professional/professionaluser/professionalteacherhonor'
|
import { addObj } from '/@/api/professional/professionaluser/professionalteacherhonor'
|
||||||
import { checkLocked } from '/@/api/professional/professionalstatuslock'
|
import { checkLocked } from '/@/api/professional/professionalstatuslock'
|
||||||
|
|
||||||
@@ -87,11 +78,10 @@ const dialogVisible = ref(false)
|
|||||||
const dataForm = reactive({
|
const dataForm = reactive({
|
||||||
honor: '',
|
honor: '',
|
||||||
honorCompany: '',
|
honorCompany: '',
|
||||||
year: null as number | null,
|
year: '',
|
||||||
materialA: '',
|
materialA: '',
|
||||||
attachment: '',
|
attachment: '',
|
||||||
state: '',
|
state: '',
|
||||||
teacherNo: '',
|
|
||||||
teacherName: '',
|
teacherName: '',
|
||||||
id: ''
|
id: ''
|
||||||
})
|
})
|
||||||
@@ -99,13 +89,16 @@ const dataForm = reactive({
|
|||||||
// 表单验证规则
|
// 表单验证规则
|
||||||
const dataRules = {
|
const dataRules = {
|
||||||
honor: [
|
honor: [
|
||||||
{ required: true, message: '请填写荣誉', trigger: 'change' }
|
{ required: true, message: '请填写荣誉', trigger: 'blur' }
|
||||||
],
|
],
|
||||||
honorCompany: [
|
honorCompany: [
|
||||||
{ required: true, message: '请填写表彰单位', trigger: 'change' }
|
{ required: true, message: '请填写表彰单位', trigger: 'blur' }
|
||||||
],
|
],
|
||||||
year: [
|
year: [
|
||||||
{ required: true, message: '请填写年份', trigger: 'change' }
|
{ required: true, message: '请选择年份', trigger: 'change' }
|
||||||
|
],
|
||||||
|
attachment: [
|
||||||
|
{ required: true, message: '请上传证明材料', trigger: 'change' }
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -140,97 +133,79 @@ const materiaUploadSuccess = (response: any) => {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
dataForm.attachment = response.data.url
|
dataForm.attachment = response.data.url
|
||||||
|
// 清除验证错误
|
||||||
|
formRef.value?.clearValidate('attachment')
|
||||||
}
|
}
|
||||||
|
|
||||||
// 打开对话框
|
// 打开对话框
|
||||||
const openDialog = async (row?: any) => {
|
const openDialog = async (row?: any) => {
|
||||||
if (row && row.id) {
|
// 新增模式:先检查是否锁定
|
||||||
// 编辑模式
|
if (!row || !row.id) {
|
||||||
title.value = row.teacherName || ''
|
|
||||||
url.value = `/professional/file/teacherAboutInfoUpload?teacherNo=${row.teacherNo}&type=4`
|
|
||||||
fileList.value = []
|
|
||||||
Object.assign(dataForm, {
|
|
||||||
honor: row.honor || '',
|
|
||||||
honorCompany: row.honorCompany || '',
|
|
||||||
year: row.year || null,
|
|
||||||
materialA: row.materialA || '',
|
|
||||||
attachment: row.attachment || '',
|
|
||||||
state: row.state || '',
|
|
||||||
teacherNo: row.teacherNo || '',
|
|
||||||
teacherName: row.teacherName || '',
|
|
||||||
id: row.id || ''
|
|
||||||
})
|
|
||||||
showForm.value = true
|
|
||||||
await initDicData()
|
|
||||||
dialogVisible.value = true
|
|
||||||
} else {
|
|
||||||
// 新增模式:先检查是否锁定,再获取当前用户的 teacherNo
|
|
||||||
try {
|
try {
|
||||||
const lockResponse = await checkLocked('remix')
|
const lockResponse = await checkLocked('remix')
|
||||||
if (lockResponse.data) {
|
if (lockResponse.data) {
|
||||||
// 已锁定
|
|
||||||
message.warning("新增功能已锁定,暂不允许操作")
|
message.warning("新增功能已锁定,暂不允许操作")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 未锁定,继续获取 teacherNo
|
|
||||||
const response = await getMyTeacherNo()
|
|
||||||
const teacherNo = response.data
|
|
||||||
title.value = '新增综合表彰'
|
|
||||||
url.value = `/professional/file/teacherAboutInfoUpload?teacherNo=${teacherNo}&type=4`
|
|
||||||
Object.assign(dataForm, {
|
|
||||||
honor: '',
|
|
||||||
honorCompany: '',
|
|
||||||
year: null,
|
|
||||||
materialA: '',
|
|
||||||
attachment: '',
|
|
||||||
state: '',
|
|
||||||
teacherNo: teacherNo,
|
|
||||||
teacherName: '',
|
|
||||||
id: ''
|
|
||||||
})
|
|
||||||
fileList.value = []
|
|
||||||
// 先加载字典数据,再显示表单
|
|
||||||
await initDicData()
|
|
||||||
showForm.value = true
|
|
||||||
dialogVisible.value = true
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
message.error('获取教师编号失败')
|
// 错误处理已在数据请求层统一处理,此处不需要提示
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 根据是否有 row 设置不同的表单数据
|
||||||
|
if (row && row.id) {
|
||||||
|
// 编辑模式:使用传入的数据
|
||||||
|
title.value = row.teacherName || ''
|
||||||
|
Object.assign(dataForm, {
|
||||||
|
honor: row.honor || '',
|
||||||
|
honorCompany: row.honorCompany || '',
|
||||||
|
year: row.year ? String(row.year) : '',
|
||||||
|
materialA: row.materialA || '',
|
||||||
|
attachment: row.attachment || '',
|
||||||
|
state: row.state || '',
|
||||||
|
teacherName: row.teacherName || '',
|
||||||
|
id: row.id || ''
|
||||||
|
})
|
||||||
|
// 回显已上传的证明材料
|
||||||
|
fileList.value = dataForm.attachment
|
||||||
|
? [{ name: '证明材料', url: dataForm.attachment }]
|
||||||
|
: []
|
||||||
|
} else {
|
||||||
|
// 新增模式:重置为空
|
||||||
|
title.value = '新增综合表彰'
|
||||||
|
Object.assign(dataForm, {
|
||||||
|
honor: '',
|
||||||
|
honorCompany: '',
|
||||||
|
year: '',
|
||||||
|
attachment: '',
|
||||||
|
state: '',
|
||||||
|
teacherName: '',
|
||||||
|
id: ''
|
||||||
|
})
|
||||||
|
fileList.value = []
|
||||||
|
}
|
||||||
|
|
||||||
|
// 公共设置:每次打开都重置上传地址
|
||||||
|
url.value = `/professional/file/teacherAboutInfoUpload?type=4`
|
||||||
|
|
||||||
|
// 公共操作:加载字典数据并显示对话框
|
||||||
|
await initDicData()
|
||||||
|
showForm.value = true
|
||||||
|
dialogVisible.value = true
|
||||||
}
|
}
|
||||||
|
|
||||||
// 提交表单
|
// 提交表单
|
||||||
const dialogSubmit = async () => {
|
const dialogSubmit = async () => {
|
||||||
if (!formRef.value) return
|
if (!formRef.value) return
|
||||||
|
|
||||||
// 验证证明材料是否上传(与 MultiDialog 保持一致)
|
|
||||||
if (!dataForm.attachment && !dataForm.materialA) {
|
|
||||||
message.warning("请上传证明材料")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
await formRef.value.validate(async (valid: boolean) => {
|
await formRef.value.validate(async (valid: boolean) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
submitLoading.value = true
|
submitLoading.value = true
|
||||||
try {
|
try {
|
||||||
// 统一使用 addObj 接口(新增和编辑都使用同一个接口)
|
// 统一使用 addObj 接口(新增和编辑都使用同一个接口)
|
||||||
// 确保 attachment 或 materialA 有值
|
await addObj(dataForm)
|
||||||
if (!dataForm.attachment && dataForm.materialA) {
|
message.success(dataForm.id ? "修改成功" : "提交成功")
|
||||||
dataForm.attachment = dataForm.materialA
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dataForm.id) {
|
|
||||||
// 编辑模式
|
|
||||||
dataForm.state = '0'
|
|
||||||
await addObj(dataForm)
|
|
||||||
message.success("修改成功")
|
|
||||||
} else {
|
|
||||||
// 新增模式
|
|
||||||
await addObj(dataForm)
|
|
||||||
message.success("提交成功")
|
|
||||||
}
|
|
||||||
dialogVisible.value = false
|
dialogVisible.value = false
|
||||||
emit('refreshData')
|
emit('refreshData')
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
|
|||||||
@@ -90,7 +90,7 @@
|
|||||||
|
|
||||||
<el-table-column label="姓名/工号" min-width="150" align="center">
|
<el-table-column label="姓名/工号" min-width="150" align="center">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<TeacherNameNo :name="scope.row.teacherName" :no="scope.row.teacherNo" />
|
<TeacherNameNo :name="scope.row.realName" :no="scope.row.teacherNo" />
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
@@ -157,8 +157,15 @@
|
|||||||
@size-change="sizeChangeHandle"
|
@size-change="sizeChangeHandle"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<!-- 材料预览:图片直接显示,PDF 在组件内部 dialog 中显示 -->
|
||||||
|
<auth-img
|
||||||
|
v-for="src in imgUrl"
|
||||||
|
:key="src.title"
|
||||||
|
:authSrc="src.url"
|
||||||
|
dialog-title="综合表彰材料"
|
||||||
|
/>
|
||||||
|
|
||||||
<!-- 子组件 -->
|
<!-- 子组件 -->
|
||||||
<ShowHonorEdvince ref="showHonorEdvinceRef" />
|
|
||||||
<ProfessionalBackResaon ref="backReasonRef" @refreshData="handleFilter" />
|
<ProfessionalBackResaon ref="backReasonRef" @refreshData="handleFilter" />
|
||||||
<DataForm ref="dataFormRef" @refreshData="handleFilter" />
|
<DataForm ref="dataFormRef" @refreshData="handleFilter" />
|
||||||
</div>
|
</div>
|
||||||
@@ -166,7 +173,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, reactive, computed, onMounted } from 'vue'
|
import { ref, reactive, computed, onMounted, nextTick } from 'vue'
|
||||||
import { storeToRefs } from 'pinia'
|
import { storeToRefs } from 'pinia'
|
||||||
import { useUserInfo } from '/@/stores/userInfo'
|
import { useUserInfo } from '/@/stores/userInfo'
|
||||||
import { BasicTableProps, useTable } from '/@/hooks/table'
|
import { BasicTableProps, useTable } from '/@/hooks/table'
|
||||||
@@ -181,9 +188,9 @@ import {
|
|||||||
import { defineAsyncComponent } from 'vue'
|
import { defineAsyncComponent } from 'vue'
|
||||||
const TeacherNameNo = defineAsyncComponent(() => import('/@/components/TeacherNameNo/index.vue'))
|
const TeacherNameNo = defineAsyncComponent(() => import('/@/components/TeacherNameNo/index.vue'))
|
||||||
const AuditState = defineAsyncComponent(() => import('/@/components/AuditState/index.vue'))
|
const AuditState = defineAsyncComponent(() => import('/@/components/AuditState/index.vue'))
|
||||||
const ShowHonorEdvince = defineAsyncComponent(() => import('./showHonorEdvince.vue'))
|
|
||||||
const ProfessionalBackResaon = defineAsyncComponent(() => import('/@/views/professional/common/professional-back-resaon.vue'))
|
const ProfessionalBackResaon = defineAsyncComponent(() => import('/@/views/professional/common/professional-back-resaon.vue'))
|
||||||
const DataForm = defineAsyncComponent(() => import('./form.vue'))
|
const DataForm = defineAsyncComponent(() => import('./form.vue'))
|
||||||
|
const authImg = defineAsyncComponent(() => import('/@/components/tools/auth-img.vue'))
|
||||||
|
|
||||||
// 使用 Pinia store
|
// 使用 Pinia store
|
||||||
const userInfoStore = useUserInfo()
|
const userInfoStore = useUserInfo()
|
||||||
@@ -216,7 +223,6 @@ const auditStateOptions: StateOption[] = [
|
|||||||
// 表格引用
|
// 表格引用
|
||||||
const tableRef = ref()
|
const tableRef = ref()
|
||||||
const searchFormRef = ref()
|
const searchFormRef = ref()
|
||||||
const showHonorEdvinceRef = ref()
|
|
||||||
const backReasonRef = ref()
|
const backReasonRef = ref()
|
||||||
const dataFormRef = ref()
|
const dataFormRef = ref()
|
||||||
const showSearch = ref(true)
|
const showSearch = ref(true)
|
||||||
@@ -228,6 +234,9 @@ const search = reactive({
|
|||||||
teacherName: ''
|
teacherName: ''
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// 材料预览
|
||||||
|
const imgUrl = ref<Array<{ title: string; url: string }>>([])
|
||||||
|
|
||||||
// 导出加载状态
|
// 导出加载状态
|
||||||
const exportLoading = ref(false)
|
const exportLoading = ref(false)
|
||||||
|
|
||||||
@@ -247,9 +256,18 @@ const state: BasicTableProps = reactive<BasicTableProps>({
|
|||||||
|
|
||||||
const { getDataList, currentChangeHandle, sizeChangeHandle, tableStyle } = useTable(state)
|
const { getDataList, currentChangeHandle, sizeChangeHandle, tableStyle } = useTable(state)
|
||||||
|
|
||||||
// 查看证明材料
|
// 查看证明材料:构造预览列表,交给 auth-img 处理
|
||||||
const showEdvince = (row: any) => {
|
const showEdvince = (row: any) => {
|
||||||
showHonorEdvinceRef.value?.init(row)
|
imgUrl.value = []
|
||||||
|
nextTick(() => {
|
||||||
|
const list = row.attachment ? [row.attachment] : []
|
||||||
|
list.forEach(v => {
|
||||||
|
imgUrl.value.push({
|
||||||
|
title: '',
|
||||||
|
url: v
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 审核状态变更
|
// 审核状态变更
|
||||||
|
|||||||
@@ -1,44 +0,0 @@
|
|||||||
<template>
|
|
||||||
<el-dialog v-model="visible" width="90%" append-to-body title="综合表彰材料">
|
|
||||||
<auth-img
|
|
||||||
v-for="src in imgUrl"
|
|
||||||
:key="src.title"
|
|
||||||
:authSrc="src.url"
|
|
||||||
style="height:1000px;"
|
|
||||||
/>
|
|
||||||
</el-dialog>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup lang="ts">
|
|
||||||
import { ref, nextTick } from 'vue'
|
|
||||||
import authImg from '/@/components/tools/auth-img.vue'
|
|
||||||
|
|
||||||
interface ImageItem {
|
|
||||||
title: string
|
|
||||||
url: string
|
|
||||||
}
|
|
||||||
|
|
||||||
const visible = ref(false)
|
|
||||||
const row = ref<any>({})
|
|
||||||
const imgUrl = ref<ImageItem[]>([])
|
|
||||||
|
|
||||||
const init = (rowData: any) => {
|
|
||||||
row.value = rowData
|
|
||||||
imgUrl.value = []
|
|
||||||
nextTick(() => {
|
|
||||||
const obj: ImageItem = {
|
|
||||||
title: '',
|
|
||||||
url: row.value.attachment
|
|
||||||
}
|
|
||||||
imgUrl.value.push(obj)
|
|
||||||
visible.value = true
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
defineExpose({
|
|
||||||
init
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped lang="scss">
|
|
||||||
</style>
|
|
||||||
@@ -149,6 +149,9 @@ const formRules = {
|
|||||||
certificateNumber: [
|
certificateNumber: [
|
||||||
{ required: true, message: '请输入证书编号', trigger: 'blur' },
|
{ required: true, message: '请输入证书编号', trigger: 'blur' },
|
||||||
{ pattern: /^[A-Za-z0-9]+$/, message: '证书编号只能包含英文和数字', trigger: 'blur' }
|
{ pattern: /^[A-Za-z0-9]+$/, message: '证书编号只能包含英文和数字', trigger: 'blur' }
|
||||||
|
],
|
||||||
|
evidence: [
|
||||||
|
{ required: true, message: '请上传证明材料', trigger: 'change' }
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -216,6 +219,8 @@ const materiaUploadSuccess = (response: any) => {
|
|||||||
}
|
}
|
||||||
// 统一使用 evidence 字段存储证明材料URL(与后端API一致)
|
// 统一使用 evidence 字段存储证明材料URL(与后端API一致)
|
||||||
dataForm.evidence = response.data.url
|
dataForm.evidence = response.data.url
|
||||||
|
// 上传成功后清除该字段的验证错误
|
||||||
|
formRef.value?.clearValidate('evidence')
|
||||||
}
|
}
|
||||||
|
|
||||||
// 打开对话框
|
// 打开对话框
|
||||||
@@ -275,12 +280,6 @@ const openDialog = async (row?: any) => {
|
|||||||
const dialogSubmit = async () => {
|
const dialogSubmit = async () => {
|
||||||
if (!formRef.value) return
|
if (!formRef.value) return
|
||||||
|
|
||||||
// 验证证明材料是否上传
|
|
||||||
if (!dataForm.evidence) {
|
|
||||||
message.warning("请上传证明材料")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
await formRef.value.validate(async (valid: boolean) => {
|
await formRef.value.validate(async (valid: boolean) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
submitLoading.value = true
|
submitLoading.value = true
|
||||||
@@ -293,7 +292,7 @@ const dialogSubmit = async () => {
|
|||||||
inOfficeDate: dataForm.inOfficeDate,
|
inOfficeDate: dataForm.inOfficeDate,
|
||||||
certificateNumber: dataForm.certificateNumber,
|
certificateNumber: dataForm.certificateNumber,
|
||||||
evidence: dataForm.evidence,
|
evidence: dataForm.evidence,
|
||||||
state: '0' // 待审核
|
state: '' // 待审核
|
||||||
}
|
}
|
||||||
|
|
||||||
// 编辑时需要传递 id
|
// 编辑时需要传递 id
|
||||||
|
|||||||
@@ -201,15 +201,13 @@
|
|||||||
@size-change="sizeChangeHandle"
|
@size-change="sizeChangeHandle"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<!-- 材料预览对话框 -->
|
<!-- 材料预览:图片直接显示,PDF 在组件内部 dialog 中显示 -->
|
||||||
<el-dialog v-model="dialogVisible" title="职称材料" append-to-body width="90%">
|
<auth-img
|
||||||
<auth-img
|
v-for="src in imgUrl"
|
||||||
v-for="src in imgUrl"
|
:key="src.title"
|
||||||
:key="src.title"
|
:authSrc="src.url"
|
||||||
:authSrc="src.url"
|
dialog-title="职称材料"
|
||||||
style="height:1000px;"
|
/>
|
||||||
/>
|
|
||||||
</el-dialog>
|
|
||||||
|
|
||||||
<!-- 子组件 -->
|
<!-- 子组件 -->
|
||||||
<MultiDialog ref="multiDialogRef" @getList="getDataList" :page="state.pagination" :nowRow="null" />
|
<MultiDialog ref="multiDialogRef" @getList="getDataList" :page="state.pagination" :nowRow="null" />
|
||||||
@@ -283,7 +281,6 @@ const search = reactive({
|
|||||||
})
|
})
|
||||||
|
|
||||||
// 材料预览
|
// 材料预览
|
||||||
const dialogVisible = ref(false)
|
|
||||||
const imgUrl = ref<Array<{ title: string; url: string }>>([])
|
const imgUrl = ref<Array<{ title: string; url: string }>>([])
|
||||||
|
|
||||||
// 导出加载状态
|
// 导出加载状态
|
||||||
@@ -328,9 +325,6 @@ const handlePreview = (list: string[]) => {
|
|||||||
url: v
|
url: v
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
nextTick(() => {
|
|
||||||
dialogVisible.value = true
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -393,7 +393,7 @@
|
|||||||
type="date"
|
type="date"
|
||||||
placeholder="选择日期"
|
placeholder="选择日期"
|
||||||
format="yyyy-MM-dd"
|
format="yyyy-MM-dd"
|
||||||
value-format="yyyy-MM-dd"
|
value-format="yyyy-MM-dd HH:mm:ss"
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|||||||
Reference in New Issue
Block a user