12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517 |
- <template>
- <div class="pb_content" style="background: unset">
- <div class="sm_box">
- <div class="sm_left">
- <div class="nav" @click="
- goTo(
- '/grade?userid=' +
- userid +
- '&oid=' +
- oid +
- '&org=' +
- org +
- '&role=' +
- role
- )
- ">
- <span class="icon gradeI"></span>
- <span class="name">年级管理</span>
- </div>
- <div class="nav active">
- <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 placeholder="请输入班级名称" v-model="sClassName" clearable class="student_input">
- </el-input>
- </span>
- <el-button type="primary" @click="searchClass" class="student_button">查询</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="班级名称" align="center">
- </el-table-column>
- <el-table-column label="所属年级" align="center">
- <template slot-scope="{ row }">
- {{ getGrade(row.pid) }}
- </template>
- </el-table-column>
- <el-table-column prop="pnum" label="人数" align="center">
- </el-table-column>
- <el-table-column label="操作" width="600px">
- <template slot-scope="scope">
- <div class="classButtonBox">
- <el-button type="primary" size="small" @click="getStudent(scope.row.id)">查看学生</el-button>
- <el-button type="primary" size="small" @click="updateG(scope.row.pid, scope.row.id)">修改年级</el-button>
- <el-button type="primary" size="small"
- @click="openUpdate(scope.row.id, scope.row.name)">修改名称</el-button>
- <el-button class="de_button" type="primary" size="small" @click="
- goTo(
- '/studentEva?userid=' +
- userid +
- '&oid=' +
- oid +
- '&org=' +
- org +
- '&cid=' +
- scope.row.id +
- '&role=' +
- role
- )
- ">查看评价</el-button>
- <el-button type="primary" size="small" @click="deleteClass(scope.row.id)">删除</el-button>
- </div>
- </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>查看学生</span>
- <div 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="head_left">
- <el-input v-model="sPhoneUser" class="student_input" placeholder="请输入用户名"></el-input>
- <el-select disabled v-model="cid" placeholder="请选择班级" class="student_input" @change="searchStudent">
- <el-option label="所有人" value=""></el-option>
- <el-option v-for="(item, index) in classJuri" :key="index" :label="item.name"
- :value="item.id"></el-option>
- </el-select>
- <el-button type="primary" class="student_button" @click="searchStudent">查询</el-button>
- </div>
- <div class="head_right">
- <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 class="userImg">
- <div class="tx">
- <img :src="scope.row.headportrait != null
- ? scope.row.headportrait
- : tx
- " alt />
- </div>
- <div style="
- width: 150px;
- text-align: left;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- ">
- {{ scope.row.name }}
- </div>
- </div>
- </template>
- </el-table-column>
- <el-table-column label="学生账号" min-width="15" align="center">
- <template slot-scope="scope">
- <div>{{ scope.row.un ? scope.row.un : "" }}</div>
- </template>
- </el-table-column>
- <el-table-column prop="classname2" 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="iniPassword(scope.row.userid)">初始化密码</el-button>
- <el-button class="de_button" type="primary" size="small"
- @click="updateStudentA(scope.row)">修改</el-button>
- <el-button class="de_button" type="primary" size="small"
- @click="deleteClassStudent(scope.row.userid)">移除</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="25%" :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="insertClass">确 定</el-button>
- </span>
- </el-dialog>
- <el-dialog title="修改年级" :visible.sync="dialogVisibleGrade" :append-to-body="true" width="25%"
- :before-close="handleClose" class="dialog_diy">
- <el-form>
- <el-form-item label="选择年级" :label-width="formLabelWidth">
- <el-select v-model="gid" placeholder="请选择班级" class="student_input" clearable>
- <el-option v-for="(item, index) in grade" :key="index" :label="item.name" :value="item.id"></el-option>
- </el-select>
- </el-form-item>
- </el-form>
- <span slot="footer" class="dialog-footer">
- <el-button @click="dialogVisibleGrade = false">取 消</el-button>
- <el-button type="primary" @click="updateGrade">确 定</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="updateClass">确 定</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>
- <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.userid" :label="item.userid">
- <div class="t_j_box">
- <el-tooltip placement="top" :content="item.name ? item.name : '暂无姓名'">
- <span>{{ item.name ? item.name : "暂无姓名" }}</span>
- </el-tooltip>
- <el-tooltip placement="top" :content="item.username">
- <span>{{ item.username }}</span>
- </el-tooltip>
- </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>
- import TaskListHeader from "gantt-elastic/src/components/TaskList/TaskListHeader.vue";
- 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: "",
- grade: [],
- gid: "",
- dialogVisibleGrade: false,
- };
- },
- created() {
- this.page = 1;
- this.getClass();
- this.getClass2();
- this.selectGrage();
- this.getSchoolName();
- },
- computed: {
- getGrade() {
- return function (gid) {
- let name = "";
- this.grade.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);
- },
- //获取班级列表
- selectGrage() {
- let params = {
- oid: this.oid,
- };
- this.ajax
- .get(this.$store.state.api + "selectGrageBySchool", params)
- .then((res) => {
- this.grade = res.data[0];
- })
- .catch((err) => {
- console.error(err);
- });
- },
- 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();
- },
- updateG(gid, id) {
- this.gid = gid;
- this.classid = id;
- this.dialogVisibleGrade = true;
- },
- updateGrade() {
- this.$confirm("确定修改吗?", "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- })
- .then(() => {
- let params = [
- {
- cid: this.gid,
- student: JSON.stringify([this.classid]),
- },
- ];
- this.ajax
- .post(this.$store.state.api + "addGradeClass", params)
- .then((res) => {
- this.gid = "";
- this.classid = "";
- this.dialogVisibleGrade = false;
- this.getClass();
- })
- .catch((err) => {
- console.error(err);
- });
- })
- .catch(() => { });
- },
- openUpdate(id, n) {
- this.classid = id;
- this.className1 = n;
- this.dialogVisible1 = true;
- },
- //新增班级
- insertClass() {
- let params = {
- name: this.className,
- oid: this.oid,
- uid: this.userid,
- };
- this.ajax
- .get(this.$store.state.api + "insertClass", 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);
- });
- },
- //修改班级
- updateClass() {
- let params = {
- id: this.classid,
- n: this.className1,
- oid: this.oid,
- };
- this.ajax
- .get(this.$store.state.api + "updateClass", 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 + "selectClass", 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);
- });
- },
- //删除班级
- deleteClass(id) {
- let params = {
- id: id,
- };
- if (this.time()) {
- this.$confirm("确定删除此班级吗?", "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- })
- .then(() => {
- this.ajax
- .get(this.$store.state.api + "deleteClass", 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 + "deleteClassStudent", params)
- .then((res) => {
- this.$message({
- message: "操作成功",
- type: "success",
- });
- this.getStudent(this.cid);
- })
- .catch((err) => {
- this.$message.error("操作失败");
- console.error(err);
- });
- })
- .catch(() => { });
- },
- //获取班级列表
- getClass2() {
- let params = {
- oid: this.oid,
- };
- this.ajax
- .get(this.$store.state.api + "selectClassBySchool", params)
- .then((res) => {
- this.classJuri = res.data[0];
- })
- .catch((err) => {
- 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 = {
- oid: this.oid,
- cid: this.cid,
- cu: "",
- cn: this.sPhoneUser,
- page: this.page2,
- };
- this.ajax
- .get(this.$store.state.api + "selectStudent2", 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 + "getClassStudent", 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 + "addClassStudent", 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;
- width: 300px;
- line-height: 40px;
- align-items: center;
- }
- .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: 495px;
- 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__body {
- padding: 5px 20px;
- }
- .t_j_box {
- display: flex;
- }
- .t_j_box span:nth-child(1) {
- width: 50%;
- 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;
- }
- .classButtonBox {
- display: flex;
- flex-direction: row;
- flex-wrap: wrap;
- align-items: center;
- }
- .classButtonBox>>>.el-button:not(:last-child),
- .classButtonBox>>>.el-button:not(:first-child) {
- margin-left: 10px;
- }
- .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>
|