修复 老师无法修改账户问题
This commit is contained in:
parent
e46a54ddb9
commit
7aafe7c84e
|
|
@ -73,7 +73,7 @@ export default defineConfig([
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
...tseslint.config({
|
...tseslint.config({
|
||||||
extends: [...tseslint.configs.recommended],
|
extends: [...tseslint.configs.recommended, "plugin:prettier/recommended"],
|
||||||
files: ["**/*.?([cm])ts", "**/*.?([cm])tsx"],
|
files: ["**/*.?([cm])ts", "**/*.?([cm])tsx"],
|
||||||
rules: {
|
rules: {
|
||||||
"@typescript-eslint/no-redeclare": "error",
|
"@typescript-eslint/no-redeclare": "error",
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<el-form
|
<el-form ref="userEditForm" :model="form" :label-width="formLabelWidth" clearable>
|
||||||
ref="userEditForm"
|
|
||||||
:model="form"
|
|
||||||
:label-width="formLabelWidth"
|
|
||||||
clearable
|
|
||||||
>
|
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="电话号码" :rules="rulePhone" prop="phone">
|
|
||||||
<el-input v-model="form.phone" type="text" />
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="姓名:" prop="realName" :rules="ruleRequired">
|
<el-form-item label="姓名:" prop="realName" :rules="ruleRequired">
|
||||||
<el-input
|
<el-input
|
||||||
|
|
@ -23,9 +13,6 @@
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
|
||||||
|
|
||||||
<el-row>
|
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="职务:" prop="studentId">
|
<el-form-item label="职务:" prop="studentId">
|
||||||
<el-input
|
<el-input
|
||||||
|
|
@ -38,16 +25,23 @@
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="账号" :rules="ruleRequiredI(20, 6)" prop="account">
|
||||||
|
<el-input v-model="form.account" type="text" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="电话号码" :rules="rulePhone" prop="phone">
|
||||||
|
<el-input v-model="form.phone" type="text" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="24">
|
<el-col :span="24">
|
||||||
<el-form-item
|
<el-form-item label="任教信息:" prop="positionList" :rules="ruleRequired">
|
||||||
label="任教信息:"
|
<el-button type="success" @click="AddPosition()">添加职位</el-button>
|
||||||
prop="positionList"
|
|
||||||
:rules="ruleRequired"
|
|
||||||
>
|
|
||||||
<el-button type="success" @click="AddPosition()"
|
|
||||||
>添加职位</el-button
|
|
||||||
>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
@ -73,10 +67,7 @@
|
||||||
@click="positionClose(position)"
|
@click="positionClose(position)"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item
|
<el-form-item :prop="`${index}.positionLevel`" :rules="ruleRequired">
|
||||||
:prop="`${index}.positionLevel`"
|
|
||||||
:rules="ruleRequired"
|
|
||||||
>
|
|
||||||
<el-select
|
<el-select
|
||||||
v-model="position.positionLevel"
|
v-model="position.positionLevel"
|
||||||
:disabled="position.id != undefined"
|
:disabled="position.id != undefined"
|
||||||
|
|
@ -196,12 +187,12 @@ import {
|
||||||
editUser,
|
editUser,
|
||||||
Position,
|
Position,
|
||||||
getSchoolData,
|
getSchoolData,
|
||||||
getClassCombo
|
getClassCombo,
|
||||||
} from "@/api/userCenter";
|
} from "@/api/userCenter";
|
||||||
import PositionForm from "./positionForm.vue";
|
import PositionForm from "./positionForm.vue";
|
||||||
import { getenum, getenumDic } from "@/api/enum";
|
import { getenum, getenumDic } from "@/api/enum";
|
||||||
import { PosititonIds } from "@/api/student";
|
import { PosititonIds } from "@/api/student";
|
||||||
import { ruleRequired, rulePhone } from "@/utils/rules";
|
import { ruleRequired, rulePhone, ruleRequiredI } from "@/utils/rules";
|
||||||
import { ElMessage, FormInstance } from "element-plus";
|
import { ElMessage, FormInstance } from "element-plus";
|
||||||
import { ComboModel, gradeComboModel } from "@/components/hTable/hTable";
|
import { ComboModel, gradeComboModel } from "@/components/hTable/hTable";
|
||||||
import {
|
import {
|
||||||
|
|
@ -209,11 +200,12 @@ import {
|
||||||
Delete,
|
Delete,
|
||||||
Edit,
|
Edit,
|
||||||
Message,
|
Message,
|
||||||
|
Phone,
|
||||||
Search,
|
Search,
|
||||||
Star
|
Star,
|
||||||
} from "@element-plus/icons-vue";
|
} from "@element-plus/icons-vue";
|
||||||
import { de } from "element-plus/es/locales.mjs";
|
import { de } from "element-plus/es/locales.mjs";
|
||||||
|
import { request } from "node_modules/axios/index.cjs";
|
||||||
interface FormData {
|
interface FormData {
|
||||||
id: number;
|
id: number;
|
||||||
account: string;
|
account: string;
|
||||||
|
|
@ -244,7 +236,7 @@ interface DialogConfig {
|
||||||
width: string;
|
width: string;
|
||||||
}
|
}
|
||||||
defineOptions({
|
defineOptions({
|
||||||
name: "UserEditForm"
|
name: "UserEditForm",
|
||||||
});
|
});
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
|
|
@ -257,14 +249,14 @@ const loading = ref(false);
|
||||||
|
|
||||||
const subject1 = ref<ComboModel[]>([
|
const subject1 = ref<ComboModel[]>([
|
||||||
{ value: 4, text: "物理" },
|
{ value: 4, text: "物理" },
|
||||||
{ value: 8, text: "历史" }
|
{ value: 8, text: "历史" },
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const subject2 = ref<ComboModel[]>([
|
const subject2 = ref<ComboModel[]>([
|
||||||
{ value: 5, text: "化学" },
|
{ value: 5, text: "化学" },
|
||||||
{ value: 6, text: "生物" },
|
{ value: 6, text: "生物" },
|
||||||
{ value: 9, text: "地理" },
|
{ value: 9, text: "地理" },
|
||||||
{ value: 7, text: "政治" }
|
{ value: 7, text: "政治" },
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const emit = defineEmits(["handlePagedCallback"]);
|
const emit = defineEmits(["handlePagedCallback"]);
|
||||||
|
|
@ -284,7 +276,7 @@ const subjectList = ref<ComboModel[]>([]);
|
||||||
const positionEnumList = ref<ComboModel[]>([
|
const positionEnumList = ref<ComboModel[]>([
|
||||||
{ text: "年级主任", value: 3 },
|
{ text: "年级主任", value: 3 },
|
||||||
{ text: "班主任", value: 4 },
|
{ text: "班主任", value: 4 },
|
||||||
{ text: "科任老师", value: 5 }
|
{ text: "科任老师", value: 5 },
|
||||||
]);
|
]);
|
||||||
function schoolChange(p: Position) {
|
function schoolChange(p: Position) {
|
||||||
p.graduationYear = null;
|
p.graduationYear = null;
|
||||||
|
|
@ -303,9 +295,9 @@ function getClass(p: Position) {
|
||||||
const data = {
|
const data = {
|
||||||
schoolId: p.schoolId || 0,
|
schoolId: p.schoolId || 0,
|
||||||
graduationYear: p.graduationYear || 0,
|
graduationYear: p.graduationYear || 0,
|
||||||
grade: p.grade
|
grade: p.grade,
|
||||||
};
|
};
|
||||||
getClassCombo(data).then(res => {
|
getClassCombo(data).then((res) => {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
p.classList = res.data;
|
p.classList = res.data;
|
||||||
}
|
}
|
||||||
|
|
@ -324,7 +316,7 @@ const defaultSubjectLevel = reactive({
|
||||||
Subject7: 0,
|
Subject7: 0,
|
||||||
Subject8: 0,
|
Subject8: 0,
|
||||||
Subject9: 0,
|
Subject9: 0,
|
||||||
CreatePositionId: 1
|
CreatePositionId: 1,
|
||||||
});
|
});
|
||||||
|
|
||||||
const form = ref<FormData>({
|
const form = ref<FormData>({
|
||||||
|
|
@ -342,14 +334,14 @@ const form = ref<FormData>({
|
||||||
subjectLevels: [],
|
subjectLevels: [],
|
||||||
subjectLevel: { ...defaultSubjectLevel },
|
subjectLevel: { ...defaultSubjectLevel },
|
||||||
positionIds: [],
|
positionIds: [],
|
||||||
positionFormIds: []
|
positionFormIds: [],
|
||||||
});
|
});
|
||||||
|
|
||||||
const dialog = reactive<DialogConfig>({
|
const dialog = reactive<DialogConfig>({
|
||||||
close: false,
|
close: false,
|
||||||
title: "",
|
title: "",
|
||||||
visible: false,
|
visible: false,
|
||||||
width: "1200px"
|
width: "1200px",
|
||||||
});
|
});
|
||||||
|
|
||||||
const customeRules = reactive({
|
const customeRules = reactive({
|
||||||
|
|
@ -358,13 +350,13 @@ const customeRules = reactive({
|
||||||
{
|
{
|
||||||
pattern: /^1[3456789]\d{9}$/,
|
pattern: /^1[3456789]\d{9}$/,
|
||||||
message: "手机号码格式不正确",
|
message: "手机号码格式不正确",
|
||||||
trigger: "blur"
|
trigger: "blur",
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
function positionClose(p: Position) {
|
function positionClose(p: Position) {
|
||||||
positionList.value = positionList.value.filter(s => s != p);
|
positionList.value = positionList.value.filter((s) => s != p);
|
||||||
}
|
}
|
||||||
|
|
||||||
const AddPositionArr: Position[] = [];
|
const AddPositionArr: Position[] = [];
|
||||||
|
|
@ -379,9 +371,9 @@ function AddPosition() {
|
||||||
subjectId: null,
|
subjectId: null,
|
||||||
positionType: 2,
|
positionType: 2,
|
||||||
positionLevel: null,
|
positionLevel: null,
|
||||||
status: true
|
status: true,
|
||||||
};
|
};
|
||||||
let p1 = p as unknown as Position;
|
let p1 = (p as unknown) as Position;
|
||||||
form.value.positionList.push(p1);
|
form.value.positionList.push(p1);
|
||||||
AddPositionArr.push(p1);
|
AddPositionArr.push(p1);
|
||||||
positionList.value.push(p1);
|
positionList.value.push(p1);
|
||||||
|
|
@ -402,11 +394,11 @@ const handleSubmitForm = async () => {
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
const postIdArr = positionList.value.map(s => s.id).filter(s => s != null);
|
const postIdArr = positionList.value.map((s) => s.id).filter((s) => s != null);
|
||||||
|
|
||||||
const addPArr = positionList.value
|
const addPArr = positionList.value
|
||||||
.filter(s => s.id == null)
|
.filter((s) => s.id == null)
|
||||||
.map(s => {
|
.map((s) => {
|
||||||
return {
|
return {
|
||||||
positionLevel: s.positionLevel,
|
positionLevel: s.positionLevel,
|
||||||
subjectId: s.subjectId,
|
subjectId: s.subjectId,
|
||||||
|
|
@ -414,7 +406,7 @@ const handleSubmitForm = async () => {
|
||||||
classId: s.classId,
|
classId: s.classId,
|
||||||
positionType: 2,
|
positionType: 2,
|
||||||
gradeLevel: s.grade[0],
|
gradeLevel: s.grade[0],
|
||||||
graduationYear: parseInt(s.grade.slice(1, 5))
|
graduationYear: parseInt(s.grade.slice(1, 5)),
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
if (addPArr.length > 0) {
|
if (addPArr.length > 0) {
|
||||||
|
|
@ -432,8 +424,9 @@ const handleSubmitForm = async () => {
|
||||||
|
|
||||||
const formData = {
|
const formData = {
|
||||||
...form.value,
|
...form.value,
|
||||||
account: form.value.phone || "",
|
account: form.value.account || "",
|
||||||
positionIds: postIdArr
|
phone: form.value.phone || "",
|
||||||
|
positionIds: postIdArr,
|
||||||
};
|
};
|
||||||
|
|
||||||
const res = await editUser(formData);
|
const res = await editUser(formData);
|
||||||
|
|
@ -465,7 +458,7 @@ const handleResetForm = () => {
|
||||||
idCard: "",
|
idCard: "",
|
||||||
phone: "",
|
phone: "",
|
||||||
cloudSchoolId: "",
|
cloudSchoolId: "",
|
||||||
pointPenSN: ""
|
pointPenSN: "",
|
||||||
});
|
});
|
||||||
positionList.value = [];
|
positionList.value = [];
|
||||||
};
|
};
|
||||||
|
|
@ -478,9 +471,7 @@ const fetchInitData = async () => {
|
||||||
userTypeList.value = typeRes.data;
|
userTypeList.value = typeRes.data;
|
||||||
|
|
||||||
schoolList.value = (await getSchoolData()).data;
|
schoolList.value = (await getSchoolData()).data;
|
||||||
subjectList.value = (await getenum("SubjectEnum")).data.filter(
|
subjectList.value = (await getenum("SubjectEnum")).data.filter((s) => s.value < 10);
|
||||||
s => s.value < 10
|
|
||||||
);
|
|
||||||
|
|
||||||
// // 云校
|
// // 云校
|
||||||
// const schoolRes = await cloudSchoolCombo();
|
// const schoolRes = await cloudSchoolCombo();
|
||||||
|
|
@ -495,7 +486,7 @@ const fetchInitData = async () => {
|
||||||
const fetchFormData = () => {
|
const fetchFormData = () => {
|
||||||
handleResetForm();
|
handleResetForm();
|
||||||
if (props.id !== 0) {
|
if (props.id !== 0) {
|
||||||
getUserInfo(props.id).then(res => {
|
getUserInfo(props.id).then((res) => {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
if (res.data.SubjectLevel && res.data.SubjectLevel.CreatePositionId) {
|
if (res.data.SubjectLevel && res.data.SubjectLevel.CreatePositionId) {
|
||||||
delete res.data.SubjectLevel.CreatePositionId;
|
delete res.data.SubjectLevel.CreatePositionId;
|
||||||
|
|
@ -529,7 +520,7 @@ const fetchFormData = () => {
|
||||||
phone: res.data.phone,
|
phone: res.data.phone,
|
||||||
cloudSchoolId: res.data.cloudSchoolId,
|
cloudSchoolId: res.data.cloudSchoolId,
|
||||||
pointPenSN: res.data.pointPenSN,
|
pointPenSN: res.data.pointPenSN,
|
||||||
positionList: positionList.value ?? []
|
positionList: positionList.value ?? [],
|
||||||
});
|
});
|
||||||
positionList.value = res.data.positions
|
positionList.value = res.data.positions
|
||||||
.filter((s: Position) => s.enable)
|
.filter((s: Position) => s.enable)
|
||||||
|
|
@ -560,17 +551,17 @@ const CheckPosition = () => {
|
||||||
dialog.title = "选择职位";
|
dialog.title = "选择职位";
|
||||||
dialog.visible = true;
|
dialog.visible = true;
|
||||||
PositionFormIds.value = positionList.value
|
PositionFormIds.value = positionList.value
|
||||||
.filter(s => s.enable !== false)
|
.filter((s) => s.enable !== false)
|
||||||
.map(s => s.id);
|
.map((s) => s.id);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleCheckCallback = (checkPosition: Position[]) => {
|
const handleCheckCallback = (checkPosition: Position[]) => {
|
||||||
dialog.visible = false;
|
dialog.visible = false;
|
||||||
positionList.value = checkPosition.map(s => {
|
positionList.value = checkPosition.map((s) => {
|
||||||
s.enable = true;
|
s.enable = true;
|
||||||
return s;
|
return s;
|
||||||
});
|
});
|
||||||
form.value.positionIds = positionList.value.map(w => w.id);
|
form.value.positionIds = positionList.value.map((w) => w.id);
|
||||||
};
|
};
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
|
|
@ -599,6 +590,7 @@ onMounted(async () => {
|
||||||
margin-right: 0px !important;
|
margin-right: 0px !important;
|
||||||
margin-bottom: 10px !important;
|
margin-bottom: 10px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.subjectTagEnableDiv .el-select {
|
.subjectTagEnableDiv .el-select {
|
||||||
margin-right: 5px;
|
margin-right: 5px;
|
||||||
}
|
}
|
||||||
|
|
@ -612,14 +604,17 @@ onMounted(async () => {
|
||||||
background-color: #909399;
|
background-color: #909399;
|
||||||
color: white;
|
color: white;
|
||||||
}
|
}
|
||||||
|
|
||||||
.classTag {
|
.classTag {
|
||||||
color: #a3bf08 !important;
|
color: #a3bf08 !important;
|
||||||
background-color: #f4fbd1 !important;
|
background-color: #f4fbd1 !important;
|
||||||
border-color: #f4fbd1 !important;
|
border-color: #f4fbd1 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.subjectTagEnableDiv {
|
.subjectTagEnableDiv {
|
||||||
padding: 1px;
|
padding: 1px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.subjectTag {
|
.subjectTag {
|
||||||
color: #eb0de4 !important;
|
color: #eb0de4 !important;
|
||||||
background-color: #fbd9ff !important;
|
background-color: #fbd9ff !important;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue