From 42f23491e5f1fb3b0c7dcc38e5eb257d4d4d5e92 Mon Sep 17 00:00:00 2001 From: guochunsi <1595020186@qq.com> Date: Sun, 4 Jan 2026 19:01:51 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=BA=E5=91=98=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../professionaltitlerelation.ts | 11 ++ src/components/tools/auth-img.vue | 40 +++--- .../professionaltitlerelation/form.vue | 136 ++++++++---------- .../professional/teacherbase/multiDialog.vue | 4 + 4 files changed, 93 insertions(+), 98 deletions(-) diff --git a/src/api/professional/professionaluser/professionaltitlerelation.ts b/src/api/professional/professionaluser/professionaltitlerelation.ts index 9c415a3..31bfae0 100644 --- a/src/api/professional/professionaluser/professionaltitlerelation.ts +++ b/src/api/professional/professionaluser/professionaltitlerelation.ts @@ -81,6 +81,17 @@ export const delObj = (id: string | number) => { }); }; +/**审核 + * @param obj + */ +export const examObj = (obj: any) => { + return request({ + url: '/professional/professionaltitlerelation/exam', + method: 'post', + data: obj, + }); +}; + /** * 删除职称对象 * @param id diff --git a/src/components/tools/auth-img.vue b/src/components/tools/auth-img.vue index 19c9383..6ed74d5 100644 --- a/src/components/tools/auth-img.vue +++ b/src/components/tools/auth-img.vue @@ -53,26 +53,26 @@ const getImgSrcByToken = (src?: string) => { }); } else { // 图片处理逻辑(已注释,如需要可取消注释并更新) - // showIframe.value = false; - // const imgSrc = src || props.authSrc; - // const tenantId = Session.getTenant(); - // const img = imgRef.value; - // if (!img) return; - // - // const request = new XMLHttpRequest(); - // request.responseType = 'blob'; - // request.open('get', imgSrc, true); - // request.setRequestHeader('Authorization', "Bearer " + Session.getToken()); - // request.setRequestHeader('TENANT-ID', tenantId); - // request.onreadystatechange = () => { - // if (request.readyState == XMLHttpRequest.DONE && request.status == 200) { - // img.src = URL.createObjectURL(request.response); - // img.onload = () => { - // URL.revokeObjectURL(img.src); - // } - // } - // }; - // request.send(null); + showIframe.value = false; + const imgSrc = src || props.authSrc; + const tenantId = Session.getTenant(); + const img = imgRef.value; + if (!img) return; + + const request = new XMLHttpRequest(); + request.responseType = 'blob'; + request.open('get', imgSrc, true); + request.setRequestHeader('Authorization', "Bearer " + Session.getToken()); + request.setRequestHeader('TENANT-ID', tenantId); + request.onreadystatechange = () => { + if (request.readyState == XMLHttpRequest.DONE && request.status == 200) { + img.src = URL.createObjectURL(request.response); + img.onload = () => { + URL.revokeObjectURL(img.src); + } + } + }; + request.send(null); } }; diff --git a/src/views/professional/professionaltitlerelation/form.vue b/src/views/professional/professionaltitlerelation/form.vue index fdf130c..580e5ee 100644 --- a/src/views/professional/professionaltitlerelation/form.vue +++ b/src/views/professional/professionaltitlerelation/form.vue @@ -12,8 +12,7 @@ v-model="dataForm.professionalTitleConfigId" filterable clearable - placeholder="请选择职称等级" - style="width: 100%" + placeholder="请选择职称等级" > @@ -59,7 +56,6 @@ placeholder="请选择职称任职时间" format="YYYY-MM-DD" value-format="YYYY-MM-DD HH:mm:ss" - style="width: 100%" /> @@ -74,7 +70,7 @@ /> - + { } // 统一使用 evidence 字段存储证明材料URL(与后端API一致) dataForm.evidence = response.data.url - dataForm.materialA = response.data.url } // 打开对话框 const openDialog = async (row?: any) => { - // 新增时 row 可能为 null 或 undefined - if (row && row.teacherNo) { - // 编辑模式:使用传入的 teacherNo(编辑不需要检查锁定) - url.value = `/professional/file/teacherAboutInfoUpload?teacherNo=${row.teacherNo}&type=2` + // 新增模式:先检查是否锁定 + if (!row || !row.id) { + try { + const lockResponse = await checkLocked('title') + if (lockResponse.data) { + message.warning("新增功能已锁定,暂不允许操作") + return + } + } catch (error) { + message.error('操作失败') + return + } + } + + // 公共设置 + url.value = `/professional/file/teacherAboutInfoUpload?type=2` + fileList.value = [] + + // 根据是否有 row 设置不同的表单数据 + if (row && row.id) { + // 编辑模式:使用传入的数据 Object.assign(dataForm, { professionalTitleConfigId: row.professionalTitleConfigId || '', majorStation: row.majorStation || '', @@ -241,50 +251,27 @@ const openDialog = async (row?: any) => { materialA: row.materialA || '', evidence: row.evidence || '', state: row.state || '', - teacherNo: row.teacherNo || '', id: row.id || '' }) - fileList.value = [] - // 先加载字典数据,再显示表单 - await initDicData() - showForm.value = true - dialogVisible.value = true } else { - // 新增模式:先检查是否锁定,再获取当前用户的 teacherNo - try { - const lockResponse = await checkLocked('title') - if (lockResponse.data) { - // 已锁定 - message.warning("新增功能已锁定,暂不允许操作") - return - } - - // 未锁定,继续获取 teacherNo - const response = await getMyTeacherNo() - const teacherNo = response.data - url.value = `/professional/file/teacherAboutInfoUpload?teacherNo=${teacherNo}&type=2` - Object.assign(dataForm, { - professionalTitleConfigId: '', - majorStation: '', - certificateTime: '', - inOfficeDate: '', - certificateNumber: '', - materialA: '', - evidence: '', - state: '', - teacherNo: teacherNo, - id: '' - }) - fileList.value = [] - // 先加载字典数据,再显示表单 - await initDicData() - showForm.value = true - dialogVisible.value = true - } catch (error) { - message.error('获取教师编号失败') - return - } + // 新增模式:重置为空 + Object.assign(dataForm, { + professionalTitleConfigId: '', + majorStation: '', + certificateTime: '', + inOfficeDate: '', + certificateNumber: '', + materialA: '', + evidence: '', + state: '', + id: '' + }) } + + // 公共操作:加载字典数据并显示对话框 + await initDicData() + showForm.value = true + dialogVisible.value = true } // 提交表单 @@ -301,31 +288,24 @@ const dialogSubmit = async () => { if (valid) { submitLoading.value = true try { - if (dataForm.id) { - // 编辑:使用 putObj 接口(管理员编辑) - dataForm.state = '0' - await putObj(dataForm) - message.success("修改成功") - } else { - // 新增:使用 updateOtherInfo 接口(与 MultiDialog 保持一致) - const submitData: any = { - type: 2, // 职称类型 - teacherNo: dataForm.teacherNo, - professionalTitleConfigId: dataForm.professionalTitleConfigId, - majorStation: dataForm.majorStation, - certificateTime: dataForm.certificateTime, - inOfficeDate: dataForm.inOfficeDate, - certificateNumber: dataForm.certificateNumber, - mateA: dataForm.evidence || dataForm.materialA // 使用 mateA 字段(与 MultiDialog 一致) - } - - const res = await updateOtherInfo(submitData) - if (res.data == '-1') { - message.warning("当前不允许提交") - } else { - message.success("提交成功") - } + // 统一使用 addObj 接口(新增和编辑都使用) + const submitData: any = { + professionalTitleConfigId: dataForm.professionalTitleConfigId, + majorStation: dataForm.majorStation, + certificateTime: dataForm.certificateTime, + inOfficeDate: dataForm.inOfficeDate, + certificateNumber: dataForm.certificateNumber, + evidence: dataForm.evidence, + state: '0' // 待审核 } + + // 编辑时需要传递 id + if (dataForm.id) { + submitData.id = dataForm.id + } + + await addObj(submitData) + message.success(dataForm.id ? "修改成功" : "提交成功") dialogVisible.value = false emit('refreshData') } catch (error: any) { diff --git a/src/views/professional/teacherbase/multiDialog.vue b/src/views/professional/teacherbase/multiDialog.vue index 2386702..8726058 100644 --- a/src/views/professional/teacherbase/multiDialog.vue +++ b/src/views/professional/teacherbase/multiDialog.vue @@ -18,6 +18,8 @@ @@ -200,6 +202,8 @@