From c66ef64b908d6e51a719a4d200336041fb6057e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E8=82=A5=E7=BE=8A?= <1048382248@qq.com> Date: Fri, 12 Sep 2025 18:31:58 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=20=E5=AD=A6=E6=A0=A1?= =?UTF-8?q?=E6=95=99=E5=B8=88=20=E6=96=B0=E5=A2=9E=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E8=81=8C=E4=BD=8D=E7=9A=84=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/student.ts | 10 ++++ src/views/student/edit.vue | 64 +++++++++++++++++--------- src/views/teacher/edit.vue | 45 +++++++++++++++--- src/views/toschoolinfomanage/index.vue | 33 ++++++++----- 4 files changed, 111 insertions(+), 41 deletions(-) diff --git a/src/api/student.ts b/src/api/student.ts index d78e012..51084d8 100644 --- a/src/api/student.ts +++ b/src/api/student.ts @@ -72,3 +72,13 @@ export function PageList(data) { export function StudentInfo(uid) { return http.request>("get", `Student/Info?uid=${uid}`); } + +/** + * @description 通过职位信息获取职位id + * @return {object} + */ +export function PosititonIds(data:any[]) { + return http.request>("post", `Student/PosititonIds`, { + data + }); +} diff --git a/src/views/student/edit.vue b/src/views/student/edit.vue index c44751c..09e76e9 100644 --- a/src/views/student/edit.vue +++ b/src/views/student/edit.vue @@ -19,20 +19,6 @@ - - - - - - - - @@ -198,14 +184,14 @@ - + 添加就读班级
提示:任职信息所有项值必填, + >提示:就读信息所有项值必填, 如若查询不到对应班级,请先添加 @@ -314,6 +300,8 @@ import { ElMessage, FormInstance } from "element-plus"; import { ComboModel, gradeComboModel } from "@/components/hTable/hTable"; import { Check, Delete, Edit, Message, Search, Star } from "@element-plus/icons-vue"; +import { PosititonIds } from "@/api/student"; + interface FormData { id: number; uId?: number; @@ -343,7 +331,7 @@ interface FormData { amountRelief?: number; reliefSubTime?: number; reliefType?: number; - reliefApplication?: number; + reliefApplication?: boolean; } interface DialogConfig { @@ -484,12 +472,14 @@ function AddPosition() { gradeLevel: "", classId: null, subjectId: null, - positionType: 2, - positionLevel: null, + positionType: 1, + positionLevel: 4, status: true, }; - AddPositionArr.push((p as unknown) as Position); - positionList.value.push((p as unknown) as Position); + let p1 = (p as unknown) as Position; + form.value.positionList.push(p1); + AddPositionArr.push(p1); + positionList.value.push(p1); } const emit = defineEmits(["handlePagedCallback"]); const handlePagedCallback = () => { @@ -508,6 +498,34 @@ const handleSubmitForm = async () => { } try { loading.value = true; + + const postIdArr = positionList.value.map((s) => s.id).filter((s) => s != null); + const addPArr = positionList.value + .filter((s) => s.id == null) + .map((s) => { + return { + positionType: 1, + positionLevel: 4, + subjectId: s.subjectId, + schoolId: s.schoolId, + classId: s.classId, + gradeLevel: s.grade[0], + graduationYear: parseInt(s.grade.slice(1, 5)), + }; + }); + if (addPArr.length > 0) { + const resPId = await PosititonIds(addPArr); + if ( + resPId.code != 200 || + resPId.data.length == 0 || + resPId.data.length != addPArr.length + ) { + ElMessage.warning("校验添加的职位数据异常,请删除后重新选择!"); + return; + } + postIdArr.push(...resPId.data); + } + const formData = { id: form.value.uId || 0, userType: form.value.userType || 1, @@ -519,13 +537,13 @@ const handleSubmitForm = async () => { templateId: form.value.templateId || 0, subjectLevels: form.value.subjectLevels || [], subjectLevel: form.value.subjectLevel || { ...defaultSubjectLevel }, - positionIds: form.value.positionIds || [], gLSubject: form.value.gLSubject, gSubject1: form.value.gSubject1, gSubject2: form.value.gSubject2, idCard: form.value.idCard, cloudSchoolId: form.value.cloudSchoolId, phone: form.value.phone, + positionIds: postIdArr, }; let res = await editUser(formData); @@ -578,7 +596,7 @@ const handleResetForm = () => { amountRelief: null, reliefSubTime: null, reliefType: null, - reliefApplication: null, + reliefApplication: false, }; positionList.value = []; }; diff --git a/src/views/teacher/edit.vue b/src/views/teacher/edit.vue index 5f845ee..fb16dbc 100644 --- a/src/views/teacher/edit.vue +++ b/src/views/teacher/edit.vue @@ -191,10 +191,12 @@ import { } from "@/api/userCenter"; import PositionForm from "./positionForm.vue"; import { getenum, getenumDic } from "@/api/enum"; +import { PosititonIds } from "@/api/student"; import { ruleRequired, rulePhone } from "@/utils/rules"; import { ElMessage, FormInstance } from "element-plus"; import { ComboModel, gradeComboModel } from "@/components/hTable/hTable"; import { Check, Delete, Edit, Message, Search, Star } from "@element-plus/icons-vue"; +import { de } from "element-plus/es/locales.mjs"; interface FormData { id: number; @@ -363,8 +365,10 @@ function AddPosition() { positionLevel: null, status: true, }; - AddPositionArr.push((p as unknown) as Position); - positionList.value.push((p as unknown) as Position); + let p1 = (p as unknown) as Position; + form.value.positionList.push(p1); + AddPositionArr.push(p1); + positionList.value.push(p1); } const handlePagedCallback = () => { @@ -382,10 +386,39 @@ const handleSubmitForm = async () => { } try { loading.value = true; + debugger; + const postIdArr = positionList.value.map((s) => s.id).filter((s) => s != null); + + const addPArr = positionList.value + .filter((s) => s.id == null) + .map((s) => { + return { + positionLevel: s.positionLevel, + subjectId: s.subjectId, + schoolId: s.schoolId, + classId: s.classId, + positionType: 2, + gradeLevel: s.grade[0], + graduationYear: parseInt(s.grade.slice(1, 5)), + }; + }); + if (addPArr.length > 0) { + const resPId = await PosititonIds(addPArr); + if ( + resPId.code != 200 || + resPId.data.length == 0 || + resPId.data.length != addPArr.length + ) { + ElMessage.warning("校验添加的职位数据异常,请删除后重新选择!"); + return; + } + postIdArr.push(...resPId.data); + } + const formData = { ...form.value, account: form.value.phone || "", - positionIds: positionList.value.map((s) => s.id), + positionIds: postIdArr, }; const res = await editUser(formData); @@ -397,7 +430,7 @@ const handleSubmitForm = async () => { ElMessage.error(res.message); } } catch (error) { - ElMessage.error("请求失败!" + JSON.stringify(error)); + ElMessage.error("请求失败!" + (error.message ?? JSON.stringify(error))); loading.value = false; } }; @@ -430,7 +463,7 @@ const fetchInitData = async () => { userTypeList.value = typeRes.data; schoolList.value = (await getSchoolData()).data; - subjectList.value = (await getenum("SubjectEnum")).data; + subjectList.value = (await getenum("SubjectEnum")).data.filter((s) => s.value < 10); // // 云校 // const schoolRes = await cloudSchoolCombo(); @@ -479,7 +512,7 @@ const fetchFormData = () => { phone: res.data.phone, cloudSchoolId: res.data.cloudSchoolId, pointPenSN: res.data.pointPenSN, - positionList: positionList.value, + positionList: positionList.value ?? [], }); positionList.value = res.data.positions .filter((s: Position) => s.enable) diff --git a/src/views/toschoolinfomanage/index.vue b/src/views/toschoolinfomanage/index.vue index 1803cd3..7802a43 100644 --- a/src/views/toschoolinfomanage/index.vue +++ b/src/views/toschoolinfomanage/index.vue @@ -31,8 +31,13 @@ :label="g.label" :value="g.value" /> - - + + - - + + @@ -200,6 +203,8 @@ interface TableItem { school: string; grade: string; people: string; + gradeLevel?: string; + gradeYear?: number; canOperate: boolean; // 是否可以跟进 times: string; // YYYY-MM-DD endTime: string; //预计解决时间 @@ -213,15 +218,19 @@ const schoolOptions = ref([]); const peopleOptions = ref([]); const isDetail = ref(false); -const tableRowClassName = ({ row, rowIndex }: { row: any; rowIndex: number }) => { +const tableRowClassName = ({ row, rowIndex }: { row: TableItem; rowIndex: number }) => { if (row.endTime == null || row.endTime == "" || row.solutionEnd) return ""; const nD = new Date(); const d = new Date(row.endTime + " "); + const startTime = new Date(row.times + " "); + const daysDiff1 = Math.floor( + (nD.getTime() - startTime.getTime()) / (1000 * 60 * 60 * 24) + ); const daysDiff = Math.floor((d.getTime() - nD.getTime()) / (1000 * 60 * 60 * 24)); - if (daysDiff >= 2) { - return "warning-row"; - } else if (daysDiff < 2) { + if (daysDiff < -1) { return "error-row"; + } else if (daysDiff1 > 7) { + return "warning-row"; } return ""; }; @@ -310,7 +319,7 @@ const addOrEdit = () => { const query = reactive({ school: "" as string | undefined, grade: "" as string | undefined, - gradeYear: 2025 as number , + gradeYear: 2025 as number, people: "" as string | undefined, solutionEnd: undefined, times: [] as string[], @@ -357,7 +366,7 @@ async function loadList() { orderBy: "startTime", }; if (query.school) payload.schoolId = query.school; - if (query.grade && query.gradeYear) payload.grade = query.grade+query.gradeYear; + if (query.grade && query.gradeYear) payload.grade = query.grade + query.gradeYear; if (query.people) { payload.UserName = query.people; }