123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401 |
- <template>
- <div class="pb_content" style="background: unset">
- <div class="sm_box">
- <div class="sm_left">
- <div class="nav active">
- <span class="icon gradeI"></span>
- <span class="name">年级管理</span>
- </div>
- <div class="nav" @click="
- goTo(
- '/class?userid=' +
- userid +
- '&oid=' +
- oid +
- '&org=' +
- org +
- '&role=' +
- role
- )
- ">
- <span class="icon classI"></span>
- <span class="name">班级管理</span>
- </div>
- <div class="nav" @click="
- goTo(
- '/student?userid=' +
- userid +
- '&oid=' +
- oid +
- '&org=' +
- org +
- '&role=' +
- role
- )
- ">
- <span class="icon studentI"></span>
- <span class="name">学生管理</span>
- </div>
- </div>
- <div class="sm_right">
- <div v-if="ctype == 1" class="pb_content_body" style="
- background: #fff;
- padding: 0px 25px;
- box-sizing: border-box;
- border-radius: 5px;
- ">
- <div class="pb_head top">
- <div style="
- display: flex;
- align-items: center;
- ">
- <span>年级管理</span>
- </div>
- <div style="border-radius: 4px">
- <el-button type="primary" class="bgColor student_button" @click="dialogVisible = true">添加年级</el-button>
- </div>
- </div>
- <div class="student_head">
- <div class="student_search">
- <span>
- <el-input class="student_input" placeholder="请输入年级名称" v-model="sClassName" clearable>
- </el-input>
- </span>
- <el-button class="student_button" type="primary" @click="searchClass">查询</el-button>
- </div>
- </div>
- </div>
- <div class="pb_content_body" v-if="ctype == 1">
- <div class="student_table">
- <el-table v-if="ctype == 1" ref="table" :key="1" :data="tableData" border :height="tableHeight" :fit="true"
- v-loading="isLoading" style="width: 100%; height: 60%" :header-cell-style="{ background: '#f1f1f1' }"
- :row-class-name="tableRowClassName">
- <el-table-column prop="name" label="年级名称" min-width="40%" align="center">
- </el-table-column>
- <el-table-column prop="pnum" label="班级数" min-width="40%" align="center">
- </el-table-column>
- <el-table-column label="操作" width="250px">
- <template slot-scope="scope">
- <el-button type="primary" size="small" @click="getStudent(scope.row.id)">查看班级</el-button>
- <el-button type="primary" size="small" @click="openUpdate(scope.row.id, scope.row.name)">修改</el-button>
- <el-button type="primary" size="small" @click="deleteGrade(scope.row.id)">删除</el-button>
- </template>
- </el-table-column>
- </el-table>
- </div>
- <div class="student_page">
- <el-pagination background layout="prev, pager, next" :page-size="10" :total="total" v-if="page"
- @current-change="handleCurrentChange">
- </el-pagination>
- </div>
- </div>
- <div v-if="ctype == 2" class="pb_content_body" style="
- background: #fff;
- padding: 0px 25px;
- box-sizing: border-box;
- border-radius: 5px;
- ">
- <div class="pb_head top">
- <span>查看班级-{{ getGrade(cid) }} </span>
- <div class="student_button" style="border-radius: 4px">
- <el-button type="primary" class="bgColor student_button" @click="(ctype = 1), getClass()">返回</el-button>
- </div>
- </div>
- <div class="student_head">
- <div class="student_search">
- <span>
- <el-input class="student_input" v-model="sPhoneUser" placeholder="请输入班级"></el-input>
- </span>
- <el-button class="student_button" @click="searchStudent">查询</el-button>
- </div>
- <div>
- <el-button @click="addStudent" class="student_button">添加班级</el-button>
- </div>
- </div>
- </div>
- <div class="pb_content_body" v-if="ctype == 2">
- <div class="student_table">
- <el-table v-if="ctype == 2" :key="2" ref="table2" :data="tableData2" border :height="tableHeight" :fit="true"
- v-loading="isLoading" style="width: 100%" :header-cell-style="{ background: '#f1f1f1', fontSize: '17px' }"
- :row-class-name="tableRowClassName">
- <el-table-column label="班级" min-width="10" align="center">
- <template slot-scope="scope">
- <div>
- {{ scope.row.name }}
- </div>
- </template>
- </el-table-column>
- <el-table-column prop="pnum" label="学生数" min-width="15" align="center">
- </el-table-column>
- <el-table-column label="操作" width="250px">
- <template slot-scope="scope">
- <div class="btnBox">
- <el-button class="de_button" type="primary" size="small"
- @click="deleteClassStudent(scope.row.id)">移除</el-button>
- <!-- <div class="delete">
- <img src="../../../../assets/remove.png" alt @click="deleteStudent(scope.row.userid, scope.row.state)" />
- </div> -->
- </div>
- </template>
- </el-table-column>
- </el-table>
- </div>
- <div class="student_page">
- <el-pagination background layout="prev, pager, next" :page-size="10" :total="total2" v-if="page2"
- @current-change="handleCurrentChange2"></el-pagination>
- </div>
- </div>
- </div>
- </div>
- <el-dialog :visible.sync="dialogVisibleAddStudent" :append-to-body="true" width="700px" :before-close="handleClose"
- class="add_student">
- <div slot="title" class="header-title">
- <div class="logoImg">
- <img src="../../../../assets/logo.png" alt />
- </div>
- <div class="title_add_student">添加学生</div>
- </div>
- <el-form>
- <el-form-item label="学生姓名" :label-width="formLabelWidth">
- <span>
- <el-input placeholder="请输入学生姓名" clearable v-model="sName" class="add_input"></el-input>
- </span>
- </el-form-item>
- <el-form-item label="学生学号" :label-width="formLabelWidth">
- <span>
- <el-input placeholder="请输入学生学号" clearable v-model="sId" class="add_input"></el-input>
- </span>
- </el-form-item>
- <el-form-item label="学生手机号" :label-width="formLabelWidth">
- <span>
- <el-input placeholder="请输入学生手机号" clearable v-model="sPhone" class="add_input"></el-input>
- </span>
- </el-form-item>
- <el-form-item label="学生账号" :label-width="formLabelWidth">
- <span>
- <el-input placeholder="请输入学生账号" clearable v-model="sMail" class="add_input"></el-input>
- </span>
- </el-form-item>
- <el-form-item label="所属学校" :label-width="formLabelWidth">
- <el-input disabled style="width: 300px" v-model="schoolName"></el-input>
- </el-form-item>
- <el-form-item label="班级" :label-width="formLabelWidth">
- <el-select v-model="cid" placeholder="请选择班级" disabled>
- <el-option v-for="(item, index) in classJuri" :key="index" :label="item.name" :value="item.id"></el-option>
- </el-select>
- </el-form-item>
- <div style="text-align: center; color: #adb3b7">
- 注:添加学生的账号密码为123456
- </div>
- </el-form>
- <span slot="footer" class="dialog-footer flex">
- <el-button class="right" @click="insertStudent">确认</el-button>
- </span>
- </el-dialog>
- <el-dialog :visible.sync="dialogVisibleUpdate" :append-to-body="true" width="700px" :before-close="handleClose"
- class="add_student">
- <div slot="title" class="header-title">
- <div class="logoImg">
- <img src="../../../../assets/logo.png" alt />
- </div>
- <div class="title_add_student">修改学生</div>
- </div>
- <el-form>
- <el-form-item label="学生名称" :label-width="formLabelWidth">
- <span>
- <el-input placeholder="请输入学生姓名" clearable v-model="userinfo.name" class="add_input"></el-input>
- </span>
- </el-form-item>
- <el-form-item label="学生学号" :label-width="formLabelWidth">
- <span>
- <el-input placeholder="请输入学生学号" clearable v-model="userinfo.studentid" class="add_input"></el-input>
- </span>
- </el-form-item>
- <el-form-item label="学生手机号" :label-width="formLabelWidth">
- <span>
- <el-input placeholder="请输入学生手机号" clearable v-model="userinfo.phonenumber" class="add_input"></el-input>
- </span>
- </el-form-item>
- <el-form-item label="学生账号" :label-width="formLabelWidth">
- <span>
- <el-input placeholder="请输入学生账号" clearable v-model="userinfo.un" class="add_input"></el-input>
- </span>
- </el-form-item>
- <el-form-item label="所属学校" :label-width="formLabelWidth">
- <el-input disabled style="width: 300px" v-model="schoolName"></el-input>
- </el-form-item>
- <el-form-item label="班级" :label-width="formLabelWidth">
- <el-select multiple collapse-tags v-model="userinfo.classid" placeholder="请选择班级">
- <el-option v-for="(item, index) in classJuri" :key="index" :label="item.name" :value="item.id"></el-option>
- </el-select>
- </el-form-item>
- <div style="text-align: center; color: #adb3b7">
- 注:添加学生的账号密码为123456
- </div>
- </el-form>
- <span slot="footer" class="dialog-footer flex">
- <el-button class="right" @click="updateStudent">修改</el-button>
- </span>
- </el-dialog>
- <el-dialog title="添加年级" :visible.sync="dialogVisible" :append-to-body="true" width="400px" :before-close="handleClose"
- class="dialog_diy">
- <el-form>
- <el-form-item label="添加年级" :label-width="formLabelWidth">
- <el-input v-model="className" auto-complete="off" placeholder="请输入年级..."></el-input>
- </el-form-item>
- </el-form>
- <span slot="footer" class="dialog-footer">
- <el-button @click="dialogVisible = false">取 消</el-button>
- <el-button type="primary" @click="insertGrade">确 定</el-button>
- </span>
- </el-dialog>
- <el-dialog title="修改年级" :visible.sync="dialogVisible1" :append-to-body="true" width="25%" :before-close="handleClose"
- class="dialog_diy">
- <el-form>
- <el-form-item label="年级名称" :label-width="formLabelWidth">
- <el-input v-model="className1" auto-complete="off" placeholder="请输入年级..."></el-input>
- </el-form-item>
- </el-form>
- <span slot="footer" class="dialog-footer">
- <el-button @click="dialogVisible1 = false">取 消</el-button>
- <el-button type="primary" @click="updateGrade">确 定</el-button>
- </span>
- </el-dialog>
- <el-dialog title="选择班级" :visible.sync="dialogVisibleMember" :append-to-body="true" width="500px" height="80%"
- :before-close="handleClose" class="addNewPP">
- <div class="people">
- <div class="people_top">
- <div class="people_top_right">
- <div class="people_search">
- <el-input placeholder="搜索班级名称" v-model="searchTN" @keyup.enter.native="getClassStudent"></el-input>
- <div class="search_img" @click="getClassStudent">
- <img src="../../../../assets/icon/search.png" alt />
- </div>
- </div>
- </div>
- <div class="people_nav">选择班级</div>
- </div>
- <!-- <div
- class="t_j_box"
- style="
- padding: 20px 0 0 25px;
- width: calc(100% - 55px);
- margin-left: 25px;
- "
- >
- <span>班级</span>
- </div> -->
- <el-checkbox-group v-model="checkboxList3" class="people_name" v-if="teacherJuri.length" v-loading="isLoading2">
- <el-checkbox v-for="item in teacherJuri" :key="item.id" :label="item.id">
- <div class="t_j_box">
- <span>{{ item.name }}</span>
- </div>
- </el-checkbox>
- </el-checkbox-group>
- <div style="text-align: center; margin-top: 10px" v-else>暂无数据</div>
- </div>
- <div style="margin-top: 10px">
- <el-pagination background layout="prev, pager, next" :page-size="pageSize3" :total="total3"
- v-if="page3 && teacherJuri.length" style="padding-bottom: 20px"
- @current-change="handleCurrentChange3"></el-pagination>
- </div>
- <span slot="footer" class="dialog-footer">
- <el-button @click="dialogVisibleMember = false">取 消</el-button>
- <el-button type="primary" @click="addClassStudent">确定</el-button>
- </span>
- </el-dialog>
- </div>
- </template>
-
- <script>
- export default {
- data() {
- return {
- tableHeight: "500px",
- isLoading: false,
- formLabelWidth: "100px",
- sClassName: "",
- className: "",
- className1: "",
- classid: "",
- dialogVisible: false,
- dialogVisible1: false,
- dialogVisibleUpdate: false,
- dialogVisibleAddStudent: false,
- tableData: [],
- page: 1,
- total: 0,
- tableData2: [],
- page2: 1,
- total2: 0,
- userid: this.$route.query.userid,
- org: this.$route.query.org,
- oid: this.$route.query.oid,
- role: this.$route.query.role,
- cid: "",
- ctype: 1,
- sName: "",
- sPhone: "",
- sId: "",
- schoolName: "",
- sByClass: "",
- sMail: "",
- classJuri: [],
- userinfo: {},
- userinfoA: {},
- sPhoneUser: "",
- tx: require("../../../../assets/avatar.png"),
- dialogVisibleMember: false,
- checkboxList3: [],
- teacherJuri: [],
- pageSize3: 10,
- total3: 0,
- page3: 1,
- isLoading2: false,
- searchTN: "",
- };
- },
- created() {
- this.page = 1;
- this.getClass();
- this.getClass2();
- this.getSchoolName();
- },
- computed: {
- getGrade() {
- return function (gid) {
- let name = "";
- this.classJuri.forEach((element) => {
- if (element.id == gid) {
- name = element.name;
- }
- });
- return name ? name : "暂无";
- };
- },
- },
- mounted() {
- this.$nextTick(function () {
- this.tableHeight =
- window.innerHeight - this.$refs.table.$el.offsetTop - 200;
- if (this.tableHeight <= 530) {
- this.tableHeight = 530;
- }
- // 监听窗口大小变化
- let self = this;
- window.onresize = function () {
- self.tableHeight =
- window.innerHeight - self.$refs.table.$el.offsetTop - 200;
- if (self.tableHeight <= 530) {
- self.tableHeight = 530;
- }
- };
- });
- },
- methods: {
- goTo(path) {
- this.$router.push(path);
- },
- tableRowClassName({ row, rowIndex }) {
- if ((rowIndex + 1) % 2 === 0) {
- return "even_row";
- } else {
- return "";
- }
- },
- handleCurrentChange(val) {
- this.page = val;
- this.getClass();
- },
- handleClose(done) {
- done();
- },
- time() {
- if (!this.now) {
- this.now = new Date().getTime();
- return true;
- } else {
- let time = new Date().getTime();
- if (time - this.now > 3000) {
- this.now = time;
- return true;
- } else {
- return false;
- }
- }
- },
- searchClass() {
- this.page = 1;
- this.getClass();
- },
- openUpdate(id, n) {
- this.classid = id;
- this.className1 = n;
- this.dialogVisible1 = true;
- },
- //新增年级
- insertGrade() {
- let params = {
- name: this.className,
- oid: this.oid,
- uid: this.userid,
- };
- this.ajax
- .get(this.$store.state.api + "insertGrade", params)
- .then((res) => {
- if (res.data[0] && res.data[0][0].classname == 1) {
- this.$message({
- message: "不能与其他年级名称相同!",
- type: "error",
- });
- } else {
- this.$message({
- message: "新增成功",
- type: "success",
- });
- this.dialogVisible = false;
- this.sClassName = "";
- this.getClass();
- this.className = "";
- }
- })
- .catch((err) => {
- this.$message({
- message: "新增失败",
- type: "error",
- });
- console.error(err);
- });
- },
- //修改年级
- updateGrade() {
- let params = {
- id: this.classid,
- n: this.className1,
- oid: this.oid,
- };
- this.ajax
- .get(this.$store.state.api + "updateGrade", params)
- .then((res) => {
- if (res.data[0] && res.data[0][0].classname == 1) {
- this.$message({
- message: "不能与其他年级名称相同!",
- type: "error",
- });
- } else {
- this.$message({
- message: "修改成功",
- type: "success",
- });
- this.dialogVisible1 = false;
- this.getClass();
- this.classid = "";
- this.className1 = "";
- }
- })
- .catch((err) => {
- this.$message({
- message: "修改失败",
- type: "error",
- });
- console.error(err);
- });
- },
- //获取年级列表
- getClass() {
- this.isLoading = true;
- let params = {
- // username: this.$store.state.userInfo.userid,
- cu: "",
- oid: this.oid,
- cn: this.sClassName,
- page: this.page,
- };
- this.ajax
- .get(this.$store.state.api + "selectGrade", params)
- .then((res) => {
- this.isLoading = false;
- this.total = res.data[0].length > 0 ? res.data[0][0].num : 0;
- this.tableData = res.data[0];
- })
- .catch((err) => {
- this.isLoading = false;
- console.error(err);
- });
- },
- //删除年级
- deleteGrade(id) {
- let params = {
- id: id,
- };
- if (this.time()) {
- this.$confirm("确定删除此年级吗?", "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- })
- .then(() => {
- this.ajax
- .get(this.$store.state.api + "deleteGrade", params)
- .then((res) => {
- this.$message({
- message: "删除成功",
- type: "success",
- });
- if (this.page != 1 && this.tableData.length == 1) {
- this.page - 1;
- }
- this.getClass();
- })
- .catch((err) => {
- this.$message.error("删除失败");
- console.error(err);
- });
- })
- .catch(() => { });
- }
- },
- addStudent() {
- // this.dialogVisibleAddStudent = true;
- // (this.sName = ""), (this.sPhone = ""), (this.sByClass = ""), this.sMail;
- // this.getClass2();
- this.dialogVisibleMember = true;
- this.searchTN = "";
- this.getClassStudent();
- },
- //新增学生
- insertStudent() {
- if (this.sName === "") {
- this.$message.error("学生姓名不能为空");
- return;
- } else if (
- this.sPhone != "" &&
- !/^[1][3,4,5,7,8][0-9]{9}$/.test(this.sPhone)
- ) {
- this.$message.error("手机号格式不正确");
- return;
- } else if (
- !/^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+/.test(this.sMail)
- ) {
- this.$message.error("邮箱格式不正确");
- return;
- }
- if (this.time()) {
- let params = { un: this.sMail };
- this.ajax
- .get(this.$store.state.api + "findMail", params)
- .then((res) => {
- if (res.data[0].length > 0) {
- this.$message.error("此学生账号已被注册");
- } else {
- this.add_Student();
- }
- })
- .catch((err) => {
- console.error(err);
- });
- }
- },
- add_Student() {
- let params = [
- {
- username: this.sMail,
- userpassword: 123456,
- alias: this.sName,
- oid: this.oid,
- ph: this.sPhone,
- sid: this.sId,
- cid: this.cid,
- },
- ];
- this.ajax
- .post(this.$store.state.api + "batchRegistration", params)
- .then((res) => {
- let params = [
- {
- userid: res.data.uid,
- username: this.sName,
- sid: this.sId,
- type: 2,
- oid: res.data.oid,
- phone: res.data.ph,
- cid: res.data.cid,
- intro: "",
- sex: "0",
- },
- ];
- this.ajax
- .post(this.$store.state.api + "updateUserByEdu", params)
- .then((res) => {
- console.log(res);
- })
- .catch((err) => {
- console.error(err);
- });
- this.$message({
- message: "新增成功",
- type: "success",
- });
- this.dialogVisibleAddStudent = false;
- this.sPhone = "";
- this.sName = "";
- this.sByClass = [];
- this.sMail = "";
- this.getStudent(this.cid);
- })
- .catch((err) => {
- this.isLoading = false;
- this.$message({
- message: "新增失败",
- type: "error",
- });
- console.error(err);
- });
- },
- updateStudentA(res) {
- this.userinfo = JSON.parse(JSON.stringify(res));
- this.userinfoA = JSON.parse(JSON.stringify(res));
- this.userinfo.classid = this.userinfo.classid.split(",");
- this.dialogVisibleUpdate = true;
- },
- updateStudent() {
- if (this.userinfo.name === "") {
- this.$message.error("学生姓名不能为空");
- return;
- } else if (!this.userinfo.classid) {
- this.$message.error("请为学生选择年级");
- return;
- } else if (
- this.userinfo.phonenumber &&
- !/^[1][3,4,5,7,8][0-9]{9}$/.test(this.userinfo.phonenumber)
- ) {
- this.$message.error("手机号格式不正确");
- return;
- } else if (
- !/^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+/.test(
- this.userinfo.un
- )
- ) {
- this.$message.error("邮箱格式不正确");
- return;
- }
- if (this.time()) {
- if (this.userinfoA.un != this.userinfo.un) {
- let params = { un: this.userinfo.un };
- this.ajax
- .get(this.$store.state.api + "findMail", params)
- .then((res) => {
- if (res.data[0].length > 0) {
- this.$message.error("此学生账号已被注册");
- } else {
- this.update_Student();
- }
- })
- .catch((err) => {
- console.error(err);
- });
- } else {
- this.update_Student();
- }
- }
- },
- update_Student() {
- let params = [
- {
- userid: this.userinfo.userid,
- username: this.userinfo.un,
- alias: this.userinfo.name,
- ph: this.userinfo.phonenumber,
- sid: this.userinfo.studentid,
- cid: this.userinfo.classid.join(","),
- },
- ];
- this.ajax
- .post(this.$store.state.api + "updateStudentInfo", params)
- .then((res) => {
- this.$message({
- message: "修改成功",
- type: "success",
- });
- this.dialogVisibleUpdate = false;
- this.getStudent(this.cid);
- })
- .catch((err) => {
- this.isLoading = false;
- this.$message({
- message: "修改失败",
- type: "error",
- });
- console.error(err);
- });
- },
- deleteClassStudent(id) {
- let params = [{ uid: id, cid: this.cid }];
- this.$confirm("确定在本年级移除此班级吗?", "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- })
- .then(() => {
- this.ajax
- .post(this.$store.state.api + "deleteGradeClass", params)
- .then((res) => {
- this.$message({
- message: "操作成功",
- type: "success",
- });
- this.getStudent(this.cid);
- })
- .catch((err) => {
- this.$message.error("操作失败");
- console.error(err);
- });
- })
- .catch(() => { });
- },
- //获取班级列表
- getClass2() {
- this.isLoading = true;
- let params = {
- oid: this.oid,
- };
- this.ajax
- .get(this.$store.state.api + "selectGrageBySchool", params)
- .then((res) => {
- this.isLoading = false;
- this.classJuri = res.data[0];
- })
- .catch((err) => {
- this.isLoading = false;
- console.error(err);
- });
- },
- getSchoolName() {
- let params = {
- oid: this.oid,
- };
- this.ajax
- .get(this.$store.state.api + "selectSchoolName2", params)
- .then((res) => {
- this.schoolName = res.data[0][0].name;
- })
- .catch((err) => {
- console.error(err);
- });
- },
- searchStudent() {
- this.page2 = 1;
- this.getStudent(this.cid);
- },
- handleCurrentChange2(val) {
- this.page2 = val;
- this.getStudent(this.cid);
- },
- handleCurrentChange3(val) {
- this.page3 = val;
- this.getClassStudent();
- },
- getStudent(cid) {
- this.cid = cid;
- this.ctype = 2;
- this.isLoading = true;
- let params = {
- cid: this.cid,
- oid: this.oid,
- cn: this.sPhoneUser,
- page: this.page2,
- };
- this.ajax
- .get(this.$store.state.api + "selectClass2", params)
- .then((res) => {
- this.isLoading = false;
- this.total2 = res.data[0].length > 0 ? res.data[0][0].num : 0;
- this.tableData2 = res.data[0];
- this.getClass2();
- })
- .catch((err) => {
- this.isLoading = false;
- console.error(err);
- });
- },
- getClassStudent() {
- this.isLoading2 = true;
- let params = {
- oid: this.oid,
- cid: this.cid,
- cn: this.searchTN,
- page: this.page3,
- num: this.pageSize3,
- };
- this.ajax
- .get(this.$store.state.api + "getGradeClass", params)
- .then((res) => {
- this.isLoading2 = false;
- this.total3 = res.data[0].length > 0 ? res.data[0][0].num : 0;
- this.teacherJuri = res.data[0];
- })
- .catch((err) => {
- this.isLoading2 = false;
- console.error(err);
- });
- },
- addClassStudent() {
- if (!this.checkboxList3.length) {
- this.$message.error("请选择要添加的班级");
- return;
- }
- let params = [
- {
- cid: this.cid,
- student: JSON.stringify(this.checkboxList3),
- },
- ];
- this.ajax
- .post(this.$store.state.api + "addGradeClass", params)
- .then((res) => {
- this.checkboxList3 = [];
- this.dialogVisibleMember = false;
- this.getStudent(this.cid);
- })
- .catch((err) => {
- console.error(err);
- });
- },
- iniPassword(id) {
- this.$confirm("确定" + "初始化" + "此学生的密码吗?", "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- })
- .then(() => {
- let params = [
- {
- uid: id,
- pa: 123456,
- },
- ];
- this.ajax
- .post(this.$store.state.api + "iniPassword", params)
- .then((res) => {
- this.$message({
- message: "初始化密码成功!",
- type: "success",
- });
- })
- .catch((err) => {
- console.error(err);
- });
- })
- .catch(() => { });
- },
- },
- };
- </script>
-
- <style scoped>
- .dialog_diy>>>.el-dialog__header {
- background: #3d67bc !important;
- padding: 15px 20px;
- }
- .dialog_diy>>>.el-dialog__title {
- color: #fff;
- }
- .student_table>>>.el-table--border td {
- border-right: 0px !important;
- }
- .dialog_diy>>>.el-dialog__headerbtn {
- top: 19px;
- }
- .dialog_diy>>>.el-dialog__headerbtn .el-dialog__close {
- color: #fff;
- }
- .dialog_diy>>>.el-dialog__headerbtn .el-dialog__close:hover {
- color: #fff;
- }
- .student_head>>>.el-button--primary {
- background-color: #2268bc;
- }
- .xls_button {
- font-size: 14px;
- cursor: pointer;
- text-decoration: underline;
- color: rgb(34, 104, 188);
- }
- .pb_head {
- margin: 0 !important;
- width: 100% !important;
- }
- .student_page {
- margin-top: 10px;
- display: flex;
- justify-content: flex-end;
- }
- .student_head {
- margin-top: 10px;
- padding-bottom: 15px;
- display: flex;
- justify-content: space-between;
- }
- .student_search {
- display: flex;
- align-items: center;
- width: 300px;
- line-height: 40px;
- }
- .student_search span {
- /* margin: 0 10px 0 0; */
- }
- .student_button {
- /* display: flex; */
- /* height: 40px; */
- }
- .student_button .el-button--primary {
- /* margin-right: 10px; */
- }
- .upload-demo {
- display: flex;
- flex-direction: column;
- align-items: end;
- /* position: relative; */
- width: 100px;
- overflow: hidden;
- }
- .student_table {
- /* margin: 20px 0; */
- }
- .el-table>>>.even_row {
- background-color: #f1f1f1;
- }
- .top {
- display: flex;
- justify-content: space-between;
- }
- .bgColor {
- background: #2167bc;
- }
- .student_table>>>.el-table,
- .student_table>>>.el-table__body-wrapper {
- height: auto !important;
- }
- .student_head {
- margin-top: 10px;
- padding-bottom: 10px;
- display: flex;
- justify-content: space-between;
- }
- .head_left {
- display: flex;
- align-items: center;
- line-height: 40px;
- }
- .head_right {
- display: flex;
- flex-direction: row;
- flex-wrap: nowrap;
- align-items: center;
- line-height: 40px;
- }
- /* .student_input >>> .el-input__inner {
- width: 190px;
- font-size: 13px;
- padding: 0 10px;
- } */
- .student_button {
- color: #fff;
- background: #2268bc;
- }
- .head_right>button:nth-child(1) {
- color: #fff;
- background: #2268bc;
- }
- .head_right>div {
- line-height: 40px;
- margin-left: 10px;
- color: #2a6dbe;
- text-decoration: underline;
- cursor: pointer;
- }
- .userImg {
- display: flex;
- flex-direction: row;
- justify-content: center;
- align-items: center;
- }
- .tx {
- width: 40px;
- margin-right: 10px;
- }
- .delete {
- width: 25px;
- height: 25px;
- cursor: pointer;
- margin-left: 10px;
- }
- .tx>img,
- .delete>img {
- width: 100%;
- height: 100%;
- }
- .btnBox {
- display: flex;
- align-items: center;
- }
- .add_student>>>.el-dialog__header {
- padding: 20px 20px 10px;
- text-align: center;
- background: #32455b;
- }
- .add_student>>>.el-dialog__title {
- font-size: 14px !important;
- color: #fff !important;
- }
- .add_student>>>.el-dialog__headerbtn {
- font-size: 20px !important;
- }
- .add_student>>>.el-form-item__label {
- margin-left: 65px;
- }
- .add_student>>>.el-form-item {
- display: flex;
- }
- .add_student>>>.el-form-item__content {
- margin: 0 !important;
- }
- .add_input {
- width: 365px;
- }
- .add_student>>>.el-dialog__footer {
- text-align: center !important;
- }
- .right {
- width: 250px;
- color: #fff;
- background: #0e72e6;
- margin-bottom: 20px;
- }
- .header-title {
- display: flex;
- }
- .logoImg {
- width: 30px;
- }
- .logoImg>img {
- width: 100%;
- height: 100%;
- }
- .title_add_student {
- margin: 0 auto;
- color: #fff;
- }
- .upload-demo {
- line-height: 0px !important;
- }
- .upload-demo>>>.el-button {
- color: #fff;
- background: #2268bc;
- width: 70px;
- height: 30px;
- padding: 0 !important;
- font-size: 12px;
- line-height: 0 !important;
- }
- .people {
- border: 1px solid rgb(229 229 229);
- height: 450px;
- border-radius: 5px;
- width: 100%;
- overflow: auto;
- }
- .people_top {
- display: flex;
- width: 100%;
- /* justify-content: space-between; */
- /* align-items: center; */
- flex-direction: column;
- padding: 10px 25px 0;
- box-sizing: border-box;
- }
- .people_nav,
- .people_top_right {
- /* padding: 20px 0 0 20px; */
- }
- .people_top_right {
- height: 40px;
- margin-bottom: 10px;
- }
- .people_search {
- display: flex;
- position: relative;
- }
- .people_search>>>.el-input__inner {
- /* height: 25px; */
- width: 95%;
- }
- .search_img {
- width: 20px;
- height: 20px;
- position: absolute;
- right: 30px;
- top: 50%;
- transform: translateY(-50%);
- }
- .search_img>img {
- width: 100%;
- height: 100%;
- }
- .people_name {
- display: flex;
- justify-content: flex-start;
- padding: 10px 0 0 25px;
- flex-direction: column;
- flex-wrap: nowrap;
- height: calc(100% - 140px);
- overflow-y: auto;
- overflow-x: hidden;
- flex-direction: column;
- }
- .people_name>>>.el-checkbox {
- width: 100%;
- display: flex;
- align-items: center;
- margin-bottom: 10px;
- }
- .people_name>>>.el-checkbox__label {
- text-overflow: ellipsis;
- overflow: hidden;
- width: 100%;
- }
- .addNewPP>>>.el-dialog {
- margin-top: 5vh !important;
- }
- .addNewPP>>>.el-dialog__body {
- padding: 5px 20px;
- }
- .t_j_box {
- display: flex;
- }
- .t_j_box span:nth-child(1) {
- width: 100%;
- overflow: hidden;
- margin-right: 10px;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- .t_j_box span:nth-child(2) {
- width: 50%;
- overflow: hidden;
- margin-right: 10px;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- .student_input>>>.el-input__inner {
- height: 30px;
- width: 190px;
- font-size: 13px;
- padding: 0 10px;
- }
- .student_input.el-input {
- width: auto;
- }
- .student_input {
- margin-right: 10px;
- }
- .student_input>>>.el-input__icon {
- line-height: unset;
- }
- .student_button {
- color: #fff;
- background: #2268bc;
- width: 60px;
- height: 30px;
- padding: 0 !important;
- font-size: 12px;
- line-height: 30px;
- }
- .sub_head {
- position: relative;
- }
- .sub_head::after {
- content: "";
- width: 100%;
- background: #5a9cea;
- height: 2px;
- position: absolute;
- left: 0;
- bottom: -10px;
- }
- .subClick {
- /* font-size: 16px; */
- font-size: 26px;
- cursor: pointer;
- /* margin-left: 17.5px; */
- /* color: #ab582f; */
- /* color: #409eff; */
- color: #999;
- }
- .subClick:hover {
- color: #000;
- }
- .sub_head+.subClick,
- .subClick+.subClick,
- .subClick+.sub_head {
- margin-left: 17.5px;
- }
- .pb_content_body {
- width: 100% !important;
- }
- .sm_box {
- display: flex;
- width: calc(100% - 20px);
- margin: 0 auto;
- }
- .sm_right {
- width: calc(100% - 210px);
- margin-left: 210px;
- }
- .sm_left {
- width: 200px;
- background: #fff;
- height: calc(100vh - 20px);
- position: fixed;
- left: 10px;
- top: 10px;
- border-radius: 5px;
- }
- .nav {
- height: 55px;
- display: flex;
- align-items: center;
- justify-content: center;
- cursor: pointer;
- color: #777777;
- transition: all .5s;
- }
- .nav:hover {
- background: rgb(204, 204, 204);
- }
- .nav.active {
- background: #3d67bc !important;
- color: #fff;
- }
- .nav .icon {
- width: 16px;
- height: 16px;
- margin-right: 5px;
- background-size: 100% 100%;
- }
- .nav .name {}
- .nav .icon.gradeI {
- background-image: url(../../../../assets/icon/studentManage/grade.png);
- }
- .nav .icon.classI {
- background-image: url(../../../../assets/icon/studentManage/class.png);
- }
- .nav .icon.studentI {
- background-image: url(../../../../assets/icon/studentManage/student.png);
- }
- .nav.active .icon.gradeI {
- background-image: url(../../../../assets/icon/studentManage/grade-a.png);
- }
- .nav.active .icon.classI {
- background-image: url(../../../../assets/icon/studentManage/class-a.png);
- }
- .nav.active .icon.studentI {
- background-image: url(../../../../assets/icon/studentManage/student-a.png);
- }
- </style>
-
|