(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-6102e396"],{9142:function(e,t,l){},e18f:function(e,t,l){"use strict";l("9142")},e4cc:function(e,t,l){"use strict";l.r(t);var a=l("f2bf");const o=e=>(Object(a["pushScopeId"])("data-v-57fc2ca8"),e=e(),Object(a["popScopeId"])(),e),s={class:"course-stats"},i={class:"course-top"},c=o(()=>Object(a["createElementVNode"])("span",null,"学生管理",-1)),d={class:"course-header"},n={style:{display:"flex"}},r={class:"course-list"},h={class:"course-page"},u={class:"dialog-footer"},b=o(()=>Object(a["createElementVNode"])("div",{style:{margin:"15px 0"}},null,-1)),m={class:"footer-margin"},p=o(()=>Object(a["createElementVNode"])("div",{style:{margin:"15px 0"}},null,-1)),g={class:"footer-margin"},O={class:"upload-dialog"},j={style:{display:"flex","justify-content":"center","margin-top":"30px"}};function C(e,t,l,o,C,V){const f=Object(a["resolveComponent"])("el-breadcrumb-item"),w=Object(a["resolveComponent"])("el-breadcrumb"),N=Object(a["resolveComponent"])("el-button"),x=Object(a["resolveComponent"])("el-table-column"),k=Object(a["resolveComponent"])("el-popconfirm"),I=Object(a["resolveComponent"])("el-table"),S=Object(a["resolveComponent"])("el-pagination"),L=Object(a["resolveComponent"])("el-input"),v=Object(a["resolveComponent"])("el-form-item"),_=(Object(a["resolveComponent"])("el-radio"),Object(a["resolveComponent"])("el-radio-group"),Object(a["resolveComponent"])("el-form")),y=Object(a["resolveComponent"])("el-dialog"),U=Object(a["resolveComponent"])("el-checkbox"),E=Object(a["resolveComponent"])("el-checkbox-group"),T=Object(a["resolveComponent"])("el-upload"),$=Object(a["resolveDirective"])("loading");return Object(a["openBlock"])(),Object(a["createElementBlock"])("div",s,[Object(a["createElementVNode"])("div",i,[c,Object(a["createVNode"])(w,{"separator-class":"el-icon-arrow-right"},{default:Object(a["withCtx"])(()=>[Object(a["createVNode"])(f,{to:{name:"admin-home"}},{default:Object(a["withCtx"])(()=>[Object(a["createTextVNode"])("首页")]),_:1}),Object(a["createVNode"])(f,null,{default:Object(a["withCtx"])(()=>[Object(a["createTextVNode"])("学生管理")]),_:1})]),_:1})]),Object(a["createElementVNode"])("div",d,[Object(a["createElementVNode"])("div",n,[Object(a["createVNode"])(N,{onClick:V.handleClickCreate},{default:Object(a["withCtx"])(()=>[Object(a["createTextVNode"])("创建")]),_:1},8,["onClick"]),Object(a["createVNode"])(N,{onClick:t[0]||(t[0]=e=>C.dialogUploadVisible=!0)},{default:Object(a["withCtx"])(()=>[Object(a["createTextVNode"])("导入")]),_:1}),Object(a["createVNode"])(N,{onClick:V.handleClickExport},{default:Object(a["withCtx"])(()=>[Object(a["createTextVNode"])("导出")]),_:1},8,["onClick"])])]),Object(a["createElementVNode"])("div",r,[Object(a["withDirectives"])((Object(a["openBlock"])(),Object(a["createBlock"])(I,{ref:"multipleTable",data:C.tableData,"tooltip-effect":"dark",height:C.tableHeight,style:{width:"100%"}},{default:Object(a["withCtx"])(()=>[Object(a["createVNode"])(x,{prop:"lastName",label:"姓"}),Object(a["createVNode"])(x,{prop:"firstName",label:"名"}),Object(a["createVNode"])(x,{prop:"username",label:"用户名"}),Object(a["createVNode"])(x,{prop:"className",label:"班级"}),Object(a["createVNode"])(x,{label:"操作",width:"160"},{default:Object(a["withCtx"])(e=>[Object(a["createVNode"])(N,{onClick:t=>V.handleClick(e.row),type:"text",size:"small"},{default:Object(a["withCtx"])(()=>[Object(a["createTextVNode"])("编辑")]),_:2},1032,["onClick"]),Object(a["createVNode"])(N,{onClick:t=>V.handleClickCourse(e.row),type:"text",size:"small"},{default:Object(a["withCtx"])(()=>[Object(a["createTextVNode"])("课程分配")]),_:2},1032,["onClick"]),Object(a["createVNode"])(k,{title:"Are you sure to delete this?",onConfirm:t=>V.handleDelete(e.row)},{reference:Object(a["withCtx"])(()=>[Object(a["createVNode"])(N,{type:"text",size:"small"},{default:Object(a["withCtx"])(()=>[Object(a["createTextVNode"])("删除")]),_:1})]),_:2},1032,["onConfirm"])]),_:1})]),_:1},8,["data","height"])),[[$,C.loading]])]),Object(a["createElementVNode"])("div",h,[Object(a["createVNode"])(S,{background:"",layout:"prev, pager, next","current-page":C.pageNum,"onUpdate:currentPage":t[1]||(t[1]=e=>C.pageNum=e),"page-size":C.pageSize,total:C.total,onCurrentChange:V.getInfoList},null,8,["current-page","page-size","total","onCurrentChange"])]),Object(a["createVNode"])(y,{title:C.dialogModelEdit?"编辑":"创建",modelValue:C.dialogVisible,"onUpdate:modelValue":t[9]||(t[9]=e=>C.dialogVisible=e),width:"50%"},{default:Object(a["withCtx"])(()=>[Object(a["createVNode"])(_,{ref:"ruleForm",model:C.form,rules:C.rules,"label-width":"80px"},{default:Object(a["withCtx"])(()=>[Object(a["createVNode"])(v,{label:"姓",prop:"lastname"},{default:Object(a["withCtx"])(()=>[Object(a["createVNode"])(L,{modelValue:C.form.lastname,"onUpdate:modelValue":t[2]||(t[2]=e=>C.form.lastname=e)},null,8,["modelValue"])]),_:1}),Object(a["createVNode"])(v,{label:"名",prop:"firstname"},{default:Object(a["withCtx"])(()=>[Object(a["createVNode"])(L,{modelValue:C.form.firstname,"onUpdate:modelValue":t[3]||(t[3]=e=>C.form.firstname=e)},null,8,["modelValue"])]),_:1}),Object(a["createVNode"])(v,{label:"用户名",prop:"username"},{default:Object(a["withCtx"])(()=>[Object(a["createVNode"])(L,{modelValue:C.form.username,"onUpdate:modelValue":t[4]||(t[4]=e=>C.form.username=e)},null,8,["modelValue"])]),_:1}),Object(a["createVNode"])(v,{label:"密码",prop:"password"},{default:Object(a["withCtx"])(()=>[Object(a["createVNode"])(L,{modelValue:C.form.password,"onUpdate:modelValue":t[5]||(t[5]=e=>C.form.password=e)},null,8,["modelValue"])]),_:1}),Object(a["createCommentVNode"])("",!0)]),_:1},8,["model","rules"]),Object(a["createElementVNode"])("span",u,[Object(a["createVNode"])(N,{onClick:t[7]||(t[7]=e=>C.dialogVisible=!1)},{default:Object(a["withCtx"])(()=>[Object(a["createTextVNode"])("取 消")]),_:1}),Object(a["createVNode"])(N,{type:"primary",onClick:t[8]||(t[8]=e=>V.onSubmit())},{default:Object(a["withCtx"])(()=>[Object(a["createTextVNode"])("确 定")]),_:1})])]),_:1},8,["title","modelValue"]),Object(a["createVNode"])(y,{title:"课程分配",modelValue:C.dialogClassVisible,"onUpdate:modelValue":t[14]||(t[14]=e=>C.dialogClassVisible=e),width:"50%"},{default:Object(a["withCtx"])(()=>[Object(a["createVNode"])(U,{indeterminate:C.isIndeterminate,modelValue:C.checkAll,"onUpdate:modelValue":t[10]||(t[10]=e=>C.checkAll=e),onChange:V.handleCheckAllChange},{default:Object(a["withCtx"])(()=>[Object(a["createTextVNode"])("全选")]),_:1},8,["indeterminate","modelValue","onChange"]),b,Object(a["createVNode"])(E,{modelValue:C.checkedList,"onUpdate:modelValue":t[11]||(t[11]=e=>C.checkedList=e),onChange:V.handleCheckedListChange},{default:Object(a["withCtx"])(()=>[(Object(a["openBlock"])(!0),Object(a["createElementBlock"])(a["Fragment"],null,Object(a["renderList"])(C.listOption,e=>(Object(a["openBlock"])(),Object(a["createBlock"])(U,{label:e.id,key:e.id},{default:Object(a["withCtx"])(()=>[Object(a["createTextVNode"])(Object(a["toDisplayString"])(e.title),1)]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue","onChange"]),Object(a["createElementVNode"])("span",m,[Object(a["createVNode"])(N,{onClick:t[12]||(t[12]=e=>C.dialogClassVisible=!1)},{default:Object(a["withCtx"])(()=>[Object(a["createTextVNode"])("取 消")]),_:1}),Object(a["createVNode"])(N,{type:"primary",onClick:t[13]||(t[13]=e=>{V.onSubmitClass(),C.dialogClassVisible=!1})},{default:Object(a["withCtx"])(()=>[Object(a["createTextVNode"])("确 定")]),_:1})])]),_:1},8,["modelValue"]),Object(a["createVNode"])(y,{title:"课程分配",modelValue:C.dialogClassVisible,"onUpdate:modelValue":t[19]||(t[19]=e=>C.dialogClassVisible=e),width:"50%"},{default:Object(a["withCtx"])(()=>[Object(a["createVNode"])(U,{indeterminate:C.isIndeterminate,modelValue:C.checkAll,"onUpdate:modelValue":t[15]||(t[15]=e=>C.checkAll=e),onChange:V.handleCheckAllChange},{default:Object(a["withCtx"])(()=>[Object(a["createTextVNode"])("全选")]),_:1},8,["indeterminate","modelValue","onChange"]),p,Object(a["createVNode"])(E,{modelValue:C.checkedList,"onUpdate:modelValue":t[16]||(t[16]=e=>C.checkedList=e),onChange:V.handleCheckedListChange},{default:Object(a["withCtx"])(()=>[(Object(a["openBlock"])(!0),Object(a["createElementBlock"])(a["Fragment"],null,Object(a["renderList"])(C.listOption,e=>(Object(a["openBlock"])(),Object(a["createBlock"])(U,{label:e.id,key:e.id},{default:Object(a["withCtx"])(()=>[Object(a["createTextVNode"])(Object(a["toDisplayString"])(e.title),1)]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue","onChange"]),Object(a["createElementVNode"])("span",g,[Object(a["createVNode"])(N,{onClick:t[17]||(t[17]=e=>C.dialogClassVisible=!1)},{default:Object(a["withCtx"])(()=>[Object(a["createTextVNode"])("取 消")]),_:1}),Object(a["createVNode"])(N,{type:"primary",onClick:t[18]||(t[18]=e=>{V.onSubmitClass(),C.dialogClassVisible=!1})},{default:Object(a["withCtx"])(()=>[Object(a["createTextVNode"])("确 定")]),_:1})])]),_:1},8,["modelValue"]),Object(a["createElementVNode"])("div",O,[Object(a["createVNode"])(y,{title:"学生导入",modelValue:C.dialogUploadVisible,"onUpdate:modelValue":t[21]||(t[21]=e=>C.dialogUploadVisible=e),width:"50%"},{default:Object(a["withCtx"])(()=>[Object(a["createElementVNode"])("span",j,[Object(a["createVNode"])(N,{style:{"margin-right":"10px"},onClick:t[20]||(t[20]=e=>C.dialogUploadVisible=!1)},{default:Object(a["withCtx"])(()=>[Object(a["createTextVNode"])("取 消")]),_:1}),Object(a["createVNode"])(T,{action:"","http-request":V.handleClickImport,accept:".xlsx","before-upload":V.beforeUpload,limit:1,"on-exceed":V.handleExceed,"on-success":V.handleSuccess,"on-error":V.handleError,"file-list":C.fileList},{default:Object(a["withCtx"])(()=>[Object(a["createVNode"])(N,{type:"primary"},{default:Object(a["withCtx"])(()=>[Object(a["createTextVNode"])("确定")]),_:1})]),_:1},8,["http-request","before-upload","on-exceed","on-success","on-error","file-list"])])]),_:1},8,["modelValue"])])])}var V=l("7864"),f={name:"students",inject:["$global","$api","$message"],data(){return{tableHeight:300,loading:!1,tableData:[],total:0,pageNum:1,pageSize:10,searchKey:"",searchClassId:-1,classRes:[],dialogVisible:!1,dialogModelEdit:!1,editStudentId:-1,form:{classId:null,lastname:"",firstname:"",username:"",password:"",status:!0},rules:{classId:[{required:!0,message:"请选择所属班级",trigger:"blur"}],lastname:[{required:!0,message:"请输入姓",trigger:"blur"}],firstname:[{required:!0,message:"请输入名",trigger:"change"}],username:[{required:!0,message:"请输入用户名",trigger:"change"}]},dialogClassVisible:!1,listOption:[],checkAll:!1,checkedList:[],isIndeterminate:!1,editClassStudentId:-1,fileList:[],upFile:new FormData,uploadClassId:null,dialogUploadVisible:!1}},mounted(){this.$nextTick((function(){this.tableHeight=window.innerHeight-this.$refs.multipleTable.$el.offsetTop-200;let e=this;window.onresize=function(){e.tableHeight=window.innerHeight-e.$refs.multipleTable.$el.offsetTop-200}}))},created(){this.classList(),this.getInfoList()},methods:{classList(){let e={token:this.$global.ss.getItem("userToken")};this.$api.admin.classList(e).then(e=>{let t=e.data;"0"==t.code?(console.log("api classList success ",t.data),this.classRes=t.data):console.log("api classList error")}).catch(()=>{console.log("api classList error")})},getInfoList(){this.loading=!0,this.tableData=[];let e=-1==this.searchClassId?"":this.searchClassId,t={pageNum:this.pageNum,pageSize:this.pageSize,username:this.searchKey,classId:e};this.$api.admin.getStudentList(t,{token:this.$global.ss.getItem("userToken")}).then(e=>{let t=e.data;this.loading=!1,"0"==t.code?(console.log("api getStudentList success"),this.tableData=t.data.list,this.total=t.data.total):console.log("api getStudentList error")}).catch(()=>{this.loading=!1,console.log("api getInfoList error")})},handleClickCreate(){this.dialogVisible=!0,this.dialogModelEdit=!1,this.form={classId:null,lastname:"",firstname:"",username:"",password:"",status:!0}},handleClick(e){console.log(e),this.dialogVisible=!0,this.dialogModelEdit=!0,this.editStudentId=e.id,this.form={classId:e.partySchoolClassId,lastname:e.lastName,firstname:e.firstName,username:e.username,password:"",status:!0}},handleDelete(e){let t=[e.id];this.$api.admin.deleteStudent(t).then(e=>{let t=e.data;"0"==t.code?(console.log("api deleteStudent success "),this.getInfoList()):console.log("api deleteStudent error")}).catch(()=>{console.log("api deleteStudent error")})},handleClickCourse(e){this.dialogClassVisible=!0,this.editClassStudentId=e.id,this.checkedList=[],this.$api.admin.getSchedule(e.id,{token:this.$global.ss.getItem("userToken")}).then(e=>{let t=e.data;"0"==t.code?(console.log("api getSchedule success ",t.data),this.listOption=t.data,this.listOption.forEach(e=>{1==e.selected&&this.checkedList.push(e.id)}),this.handleCheckedListChange(this.checkedList)):console.log("api getSchedule error")}).catch(()=>{console.log("api getSchedule error")})},handleCheckAllChange(e){this.checkedList=[],e&&this.listOption.forEach(e=>{this.checkedList.push(e.id)}),this.isIndeterminate=!1},handleCheckedListChange(e){console.log(e);let t=e.length;this.checkAll=t===this.listOption.length,this.isIndeterminate=t>0&&t{if(!e)return!1;{let e={username:this.form.username,firstName:this.form.firstname,lastName:this.form.lastname,password:this.form.password,partySchoolClassId:this.form.classId};console.log("submit! ",e),0==this.dialogModelEdit?this.$api.admin.addNewStudent(e).then(e=>{let t=e.data;if("0"==t.code){console.log("api addNewStudent success ");let e=t.data.orgPassword;""==this.form.password&&e&&V["b"].alert("默认密码为: "+e,"提示",{confirmButtonText:"OK"}),this.dialogVisible=!1,this.getInfoList()}else console.log("api addNewStudent error"),t.msg&&V["a"].error(t.msg)}).catch(()=>{console.log("api addNewStudent error"),V["a"].error("创建失败")}):(e.id=this.editStudentId,""==this.form.password.trim()&&delete e.password,this.$api.admin.upgradeStudent(e).then(e=>{let t=e.data;"0"==t.code?(console.log("api upgradeStudent success "),this.dialogVisible=!1,this.getInfoList()):(console.log("api upgradeStudent error"),t.msg&&V["a"].error(t.msg))}).catch(()=>{console.log("api upgradeStudent error"),V["a"].error("保存失败")}))}})},onSubmitClass(){console.log(`studentId: ${this.editClassStudentId} this.checkedList: ${this.checkedList}`),this.$api.admin.setSchedule(this.editClassStudentId,this.checkedList).then(e=>{let t=e.data;"0"==t.code?console.log("api setSchedule success "):console.log("api setSchedule error")}).catch(()=>{console.log("api setSchedule error")})},beforeUpload(e){console.log(e);let t=e.name.substring(e.name.lastIndexOf(".")+1),l=e.size/1024/1024;"xlsx"===t?l>10?this.$message.warning("文件大小不得超过10M"):(this.upFile.append("file",e),console.log(this.upFile)):this.$message.warning("只能上传后缀是.xlsx的文件")},handleRemove(e,t){},handleExceed(e,t){this.$message.warning(`只能选择1个文件,当前共选择了 ${e.length+t.length} 个`)},handleSuccess(e,t,l){},handleError(e,t,l){},async handleClickImport(){let e=-1==this.uploadClassId?"":this.uploadClassId;console.log("doUpload :",e,this.upFile),this.dialogUploadVisible=!1,this.fileList=[],this.$api.admin.studentImport(e,this.upFile).then(e=>{if(console.log(e),"application/json"==e.headers["content-type"]){var t=new FileReader;t.readAsText(e.data),t.onload=function(){console.log(this.result);let e=JSON.parse(this.result);console.log("api doUpload success: ",e.msg),V["a"].error(e.msg)}}else{V["a"].success("导入成功");const t=new Blob([e.data]),l=document.createElement("a"),a=window.URL.createObjectURL(t),o="学生管理列表.xlsx";l.href=a,l.download=o,document.body.appendChild(l),l.click(),window.URL.revokeObjectURL(a),document.body.removeChild(l)}}).catch(()=>{console.log("api doUpload error"),V["a"].error("导入失败")})},handleClickExport(){let e=-1==this.searchClassId?"":this.searchClassId,t={username:this.searchKey,classId:e};this.$api.admin.studentExport(t,{token:this.$global.ss.getItem("userToken")}).then(e=>{console.log(e);var t,l=decodeURI(e.headers["content-disposition"]),a=/filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/;a.exec(l);console.log(t);const o=new Blob([e.data]),s=document.createElement("a"),i=window.URL.createObjectURL(o);s.href=i,s.download=t,document.body.appendChild(s),s.click(),window.URL.revokeObjectURL(i),document.body.removeChild(s)}).catch(()=>{console.log("api doUpload error")})}}},w=(l("e18f"),l("6b0d")),N=l.n(w);const x=N()(f,[["render",C],["__scopeId","data-v-57fc2ca8"]]);t["default"]=x}}]);