This commit is contained in:
2023-09-01 09:40:37 +08:00
parent fb1d79d026
commit a9c620e3ec

View File

@ -384,6 +384,7 @@
multiple
placeholder="请选择角色"
@change="changeroleIds"
@remove-tag="remove"
>
<el-option
v-for="item in roleOptions"
@ -398,12 +399,45 @@
<el-col :span="12">
<kindergarlog
v-if="kinshow"
:nameicon="true"
:iddnamelist="form"
@kinbatlist="kinbatlist"
style="width: 500px; display: inline;"
style="width: 500px; display: inline"
ref="kinresets"
></kindergarlog>
</el-col>
<el-col :span="12">
<el-form-item label="所属班级" prop="classInfoList" class="is-required" v-if="statusitem">
<el-button
@click="innerVisibleclick"
style="
width: 220px;
text-align: left;
height: 36px;
color: #c0c4cc;
"
v-if="classinfoName.length == 0"
>请选择所属班级</el-button>
<el-tag
v-for="(tag, index) in classinfoName"
v-else
:key="index"
closable
type
:disable-transitions="true"
@close="handleClose(tag, index)"
style="margin-right: 10px"
>{{ tag.className }}</el-tag>
<el-tag
v-if="classinfoName.length != 0"
type="primary"
plain
:disable-transitions="true"
@click="innerVisibletrue2"
style="float: right; margin-top: 4px"
>选择所属班级</el-tag>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
@ -418,7 +452,98 @@
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
<!-- // -->
<el-dialog
width="1000px"
title="选择所属班级"
:visible.sync="innerVisible"
append-to-body
:before-close="cancel3"
>
<el-form
:model="classinfoList2"
ref="queryForm"
size="small"
:inline="true"
v-show="showSearch"
label-width="90px"
>
<el-form-item label="班级名称" prop="className">
<el-input
style="width: 150px"
v-model="classinfoList2.className"
placeholder="请输入班级名称"
clearable
@keyup.enter.native="handleQuery2"
/>
</el-form-item>
<el-form-item label="班级类型" prop="classType">
<el-select v-model="classinfoList2.classType" placeholder="请选择" style="width: 150px">
<el-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.classType"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="班主任姓名" prop="classTeacher">
<el-input
v-model="classinfoList2.classTeacher"
placeholder="请输入班主任姓名"
style="width: 150px"
clearable
@keyup.enter.native="handleQuery2"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery2">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery3">重置</el-button>
</el-form-item>
</el-form>
<el-table
:data="classinfoList"
align="center"
style="margin-top: 10px"
@cell-dblclick="classinfoclick"
>
<el-table-column label="请选择" width="70" align="center">
<template slot-scope="scope">
<el-button
:type="containsclass(scope.row.id) ? 'primary' : ''"
style="width: 20px; height: 20px"
circle
@click="classinfoclick(scope.row)"
></el-button>
</template>
</el-table-column>
<el-table-column property="kindergartenName" label="幼儿园名称" width="190" align="center" />
<el-table-column property="className" label="班级名称" width="180" align="center"></el-table-column>
<el-table-column property="classType" label="班级类型" width="160" align="center">
<template slot-scope="scope">
{{ scope.row.classType == dictValue1 ? "大班" : "" }}
{{ scope.row.classType == dictValue2 ? "中班" : "" }}
{{ scope.row.classType == dictValue3 ? "小班" : "" }}
{{ scope.row.classType == dictValue4 ? "毕业" : "" }}
</template>
</el-table-column>
<el-table-column property="classTeacher" label="班主任姓名" width="180" align="center"></el-table-column>
<el-table-column property="phone" label="联系电话" width="190" align="center"></el-table-column>
</el-table>
<pagination
v-show="total2 > 0"
:total="total2"
:page.sync="classinfoList2.pageNum"
:limit.sync="classinfoList2.pageSize"
@pagination="getclassinfo"
/>
<div slot="footer" class="dialog-footer" style="height: 50px;">
<el-button type="primary" @click="cancel3" style="float: left;">选择完成</el-button>
<el-button @click="innerVisiblecancel" style="float: left;">取消选择</el-button>
</div>
</el-dialog>
<!-- 用户导入对话框 -->
<el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
<el-upload
@ -462,6 +587,8 @@
<script>
import { listArea } from "@/api/system/area.js";
import kindergarlog from "../../assembly/kindergarlog.vue";
import { listClassinfo } from "@/api/system/classinfo";
import { getClassInfo } from "@/api/system/teacherInfo";
import {
listUser,
getUser,
@ -485,6 +612,40 @@ export default {
return {
//
loading: true,
dictValue1: "",
dictValue2: "",
dictValue3: "",
dictValue4: "",
classinfoList: [],
total2: 0,
innerVisible: false,
formkindergartenId: "",
classinfoList2: {
pageNum: 1,
pageSize: 10,
kindergartenId: null,
className: null,
classType: null
},
classinfoName: [],
options: [
{
classType: "",
label: "大班"
},
{
classType: "",
label: "中班"
},
{
classType: "",
label: "小班"
},
{
classType: "",
label: "毕业"
}
],
//
memberGrades: [
{ memberGrade: "COMMON", name: "普通" },
@ -521,7 +682,10 @@ export default {
//
areaList: [],
//
form: {},
form: {
classInfoList: [],
kindergartenId: null
},
defaultProps: {
children: "children",
label: "label"
@ -547,6 +711,8 @@ export default {
name: "",
code: ""
},
ClassType: "class_type",
statusitem: false,
queryParams: {
pageNum: 1,
pageSize: 10,
@ -579,6 +745,9 @@ export default {
trigger: "blur"
}
],
classInfoList: [
{ required: true, message: "所属班级不能为空", trigger: "blur" }
],
nickName: [
{ required: true, message: "用户昵称不能为空", trigger: "blur" }
],
@ -615,7 +784,16 @@ export default {
this.$refs.tree.filter(val);
}
},
computed: {
//id id true
containsclass() {
return function(id) {
return this.form.classInfoList.find(e => e == id);
};
}
},
created() {
this.info();
this.getList();
this.getTreeselect();
this.usermemberGrade();
@ -625,8 +803,148 @@ export default {
});
},
methods: {
innerVisibletrue2() {
if (this.form.kindergartenId == "" || !this.form.kindergartenId) {
this.$message.error("请先选择幼儿园");
} else {
this.classinfoList2.kindergartenId = this.form.kindergartenId;
this.innerVisible = true;
this.getclassinfo();
}
},
//tage
handleClose(tag, index) {
this.form.classInfoList.splice(index, 1);
this.classinfoName.splice(index, 1);
},
resetQuery3() {
this.classinfoList2 = {
pageNum: 1,
pageSize: 10,
kindergartenId: this.form.kindergartenId,
className: null,
classType: null,
classTeacher: null
};
this.handleQuery2();
},
handleQuery2() {
listClassinfo(this.classinfoList2).then(response => {
this.classinfoList = response.rows;
this.total2 = response.total;
});
},
innerVisiblecancel() {
this.innerVisible = false;
this.classinfoName = [];
},
cancel3() {
// if (Array.isArray(this.classinfoName)) {
// this.classinfoName = this.classinfoName.join(",");
// } else {
// }
this.innerVisible = false;
this.innerVisible2 = false;
this.classinfoList2 = {
pageNum: 1,
pageSize: 10,
kindergartenId: null,
className: null,
classType: null
};
// this.classinfoName = "";
// this.classinfoid = "";
// if (this.classinfoName > 1) {
// } else if (this.classinfoName.length == 1) {
// this.classinfoName = JSON.parse(this.classinfoName);
// }
},
innerVisibleclick() {
if (
this.form.kindergartenId == "" ||
!this.form.kindergartenId ||
this.form.kindergartenId == null
) {
this.$message.error("请先选择幼儿园");
} else {
this.classinfoList2.kindergartenId = this.form.kindergartenId;
this.innerVisible = true;
this.getclassinfo();
}
},
info() {
tKindergartenInfo(this.ClassType).then(res => {
this.options[0].classType = res.data[0].dictValue;
this.options[1].classType = res.data[1].dictValue;
this.options[2].classType = res.data[2].dictValue;
this.options[3].classType = res.data[3].dictValue;
this.dictValue1 = res.data[0].dictValue;
this.dictValue2 = res.data[1].dictValue;
this.dictValue3 = res.data[2].dictValue;
this.dictValue4 = res.data[3].dictValue;
});
},
classinfoclick2(item) {},
classinfoclick(item) {
if (this.form.classInfoList.findIndex(e => e == item.id) != -1) {
this.form.classInfoList = this.form.classInfoList.filter(
e => e != item.id
);
this.classinfoName = this.classinfoName.filter(e => e.id != item.id);
} else {
this.form.classInfoList.push(item.id);
if (Array.isArray(this.classinfoName)) {
this.classinfoName.push(item);
} else {
this.classinfoName = this.classinfoName.split(",");
this.classinfoName.push(item);
}
}
},
//
getclassinfo() {
listClassinfo(this.classinfoList2).then(response => {
this.classinfoList = response.rows;
this.total2 = response.total;
});
},
changeroleIds(row) {
this.kinshow = false;
var b = row.map(String);
if (b.length > 0) {
if (b.includes("6") == true) {
this.statusitem = true;
if (this.formkindergartenId) {
this.form.kindergartenId = this.formkindergartenId;
}
this.kinshow = true;
} else if (b.includes("10") == true) {
this.form.classInfoList = null;
// this.form.kindergartenId = null;
this.classinfoName = [];
this.form.kindergartenId;
this.kinshow = true;
this.statusitem = false;
} else if (b.includes("5") == true) {
this.form.classInfoList = null;
// this.form.kindergartenId = null;
this.classinfoName = [];
this.kinshow = true;
this.statusitem = false;
} else {
this.statusitem = false;
this.kinshow = false;
}
} else {
this.kinshow = false;
this.statusitem = false;
this.form.classInfoList = null;
this.form.kindergartenId = null;
this.classinfoName = [];
}
// this.kinshow = false;
var obj = {};
this.roleOptions.forEach(el => {
if (el.roleKey == "enchou") {
@ -636,15 +954,32 @@ export default {
row.forEach(e => {
if (e == obj.roleId) {
this.kinshow = true;
this.form.kindergartenId = "";
this.form.kindergartenName = "请选择幼儿园";
// this.form.kindergartenId = "";
// this.form.kindergartenName = "";
}
});
},
remove(e) {
// if (e) {
// if (e == 6) {
// this.form.classInfoList = null;
// // this.form.kindergartenId = null;
// this.classinfoName = [];
// }
// else if (e == 5 || e == 10) {
// // this.classinfoName= [];
// // this.form.classInfoList=null;
// // this.form.kindergartenId = null;
// }
// }
},
//
kinbatlist(e) {
this.kindergartenId = e;
this.form.kindergartenId = e;
kinbatlist(id, name) {
this.$set(this.form, "kindergartenId", id);
this.$set(this.form, "kindergartenName", name);
this.classinfoName = [];
this.form.classInfoList = [];
this.form.classinfoName = [];
},
//
usermemberGrade() {
@ -721,7 +1056,7 @@ export default {
//
reset() {
this.form = {
kindergartenId: undefined,
kindergartenId: null,
userId: undefined,
areaId: undefined,
deptId: undefined,
@ -735,7 +1070,8 @@ export default {
status: "0",
remark: undefined,
postIds: [],
roleIds: []
roleIds: [],
classInfoList: []
};
this.resetForm("form");
},
@ -772,6 +1108,7 @@ export default {
/** 新增按钮操作 */
handleAdd() {
this.kinshow = false;
this.statusitem = false;
this.reset();
this.getTreeselect();
getUser().then(response => {
@ -785,15 +1122,42 @@ export default {
/** 修改按钮操作 */
handleUpdate(row) {
this.kinshow = false;
this.classinfoName = [];
this.reset();
this.getTreeselect();
const userId = row.userId || this.ids;
getUser(userId).then(response => {
response.data.classinfoName = response.data.classInfoList;
response.data.classInfoList
? (response.data.classInfoList = response.data.classInfoList.map(
e => e.id
))
: (response.data.classInfoList = []);
this.form = response.data;
if (response.data.kindergartenId) {
this.formkindergartenId = response.data.kindergartenId;
}
this.postOptions = response.posts;
this.roleOptions = response.roles;
this.form.postIds = response.postIds;
this.form.roleIds = response.roleIds;
var b = this.form.roleIds.map(String);
response.data.classinfoName
? (this.classinfoName = response.data.classinfoName)
: (this.classinfoName = []);
if (b.includes("6") == true) {
this.statusitem = true;
this.kinshow = true;
} else if (b.includes("10") == true) {
this.kinshow = true;
this.statusitem = false;
} else if (b.includes("5") == true) {
this.kinshow = true;
this.statusitem = false;
} else {
this.statusitem = false;
this.kinshow = false;
}
this.title = "修改用户";
this.form.password = "";
var obj = {};
@ -812,6 +1176,18 @@ export default {
}
this.open = true;
});
// .then((el) => {
// this.getclassinfo();
// })
// .then((val) => {
// getClassInfo({
// id: row.id,
// }).then((res) => {
// this.form.classInfoList = res.data.map((e) => e.id);
// this.form.classInfoList.join(",");
// res.data.map((e) => this.classinfoName.push(e));
// });
// });
},
/** 重置密码按钮操作 */
handleResetPwd(row) {
@ -824,7 +1200,9 @@ export default {
})
.then(({ value }) => {
resetUserPwd(row.userId, value).then(response => {
this.$modal.msgSuccess("修改成功,新密码是:" + value);
if (response.code == 200) {
this.$modal.msgSuccess("修改成功,新密码是:" + value);
}
});
})
.catch(() => {});
@ -836,19 +1214,24 @@ export default {
},
/** 提交按钮 */
submitForm: function() {
var b = this.form.roleIds.map(String);
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.userId != undefined) {
updateUser(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
if (response.code == 200) {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
}
});
} else {
addUser(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
if (response.code == 200) {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
}
});
}
}