| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696 |
- <template>
- <div class="pb_content" style="background: unset">
- <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
- class="subClick"
- @click="
- goTo(
- '/student?userid=' +
- userid +
- '&oid=' +
- oid +
- '&org=' +
- org +
- '&role=' +
- role
- )
- "
- >学生管理</span
- >
- <span class="sub_head">班级管理</span>
- <span
- class="subClick"
- @click="
- goTo(
- '/grade?userid=' +
- userid +
- '&oid=' +
- oid +
- '&org=' +
- org +
- '&role=' +
- role
- )
- "
- >年级管理</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>
- <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">
- 注:添加学生的账号密码为Coco1234
- </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">
- 注:添加学生的账号密码为Coco1234
- </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: 'Coco1234',
- 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: 'Coco1234',
- },
- ];
- 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;
- }
- .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;
- }
- </style>
|