|
|
"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[19519],{58726:function(e,t,n){n.r(t),n.d(t,{default:function(){return B}});var s=n(861),a=n.n(s),r=n(17061),i=n.n(r),l=n(17156),o=n.n(l),c=n(27424),d=n.n(c),u=n(70215),p=n.n(u),m=n(67294),x=n(88275),h=n(91773),f=n(14446),_=n(2453),y=n(71230),j=n(76661),v=n(84519),g="wrap___N68Ys",b=n(6171),k=n(27484),w=n.n(k),Z=n(82749),S=n(39132),T=n(42122),C=n.n(T),N=n(36182),I=n(83062),P=n(96101),L=n(11486),F=n(71577),O=n(92421),V=n(246),z=n.n(V),A=n(73290),M=n(81728),Y="addStudentContainer___vm8uG",H="listItem___GgL6_",D=n(24969),E=n(29427),G=n(59758),R=n(85893),q=N.Z.TabPane,K=(0,x.connect)((function(e){return{classroomList:e.classroomList,loading:e.loading}}))((function(e){var t,n,s=e.classroomList,r=(e.loading,e.dispatch),l=(0,x.useParams)(),c=s.actionTabs,u=(0,m.useState)([]),p=d()(u,2),y=p[0],g=p[1],b=(0,m.useState)(!0),k=d()(b,2),Z=k[0],S=k[1],T=(0,m.useState)(!1),V=d()(T,2),K=V[0],W=V[1],B=h.Z.useForm(),Q=d()(B,1)[0],U=(0,m.useState)([]),J=d()(U,2),X=J[0],$=J[1],ee=(0,m.useState)(1),te=d()(ee,2),ne=te[0],se=te[1],ae=(0,m.useState)([]),re=d()(ae,2),ie=re[0],le=re[1],oe=(0,m.useState)(!0),ce=d()(oe,2),de=ce[0],ue=ce[1],pe=(0,m.useState)([]),me=d()(pe,2),xe=me[0],he=me[1],fe=(0,m.useState)("1"),_e=d()(fe,2),ye=_e[0],je=_e[1],ve=(0,m.useState)(!1),ge=d()(ve,2),be=ge[0],ke=ge[1];(0,m.useRef)();(0,m.useEffect)((function(){"添加学生"===s.actionTabs.key&&(ue(!0),we(),je(s.actionTabs.tab))}),[s.actionTabs.key]);var we=function(){var e=o()(i()().mark((function e(){var t,n;return i()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,v.ZP)("/api/schools/department_list.json",{method:"get"});case 2:n=e.sent,g(null===(t=n.department_names)||void 0===t?void 0:t.map((function(e){return{value:e}})));case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Ze={onRemove:function(){he([])},beforeUpload:function(e){var t=[];return t.push(e),he([].concat(t)),!1},fileList:xe,accept:".xls,.xlsx"},Se=function(){var e=o()(i()().mark((function e(){var t,n,s,r,o=arguments;return i()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=o.length>0&&void 0!==o[0]&&o[0],!Z||K){e.next=11;break}return s=Q.getFieldValue(),W(!0),se(t?1:ne+1),e.next=7,(0,A.nQ)(C()(C()({page:t?1:ne+1,container_id:l.coursesId,container_type:1,school_name:null==s?void 0:s.school_name,keyword:null==s?void 0:s.keyword,source:"school_manage"},s),{},{role:4}));case 7:r=e.sent,$(t?a()(r.users):[].concat(a()(X),a()(r.users))),W(!1),(null===(n=r.users)||void 0===n?void 0:n.length)<10&&S(!1);case 11:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Te=function(){var e=o()(i()().mark((function e(){var t;return i()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(""!=ie){e.next=4;break}_.ZP.error("请选择人数"),e.next=10;break;case 4:return ke(!0),e.next=7,(0,v.ZP)("/api/student_groups/".concat(null==l?void 0:l.couserid,"/add_user.json"),{method:"POST",body:{user_ids:ie}});case 7:t=e.sent,ke(!1),0===t.status&&r({type:"classroomList/setActionTabs",payload:{key:"刷新列表",types:1,list:null==t?void 0:t.audit_users}});case 10:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Ce=function(){var e=o()(i()().mark((function e(){var t,n;return i()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!((null==xe?void 0:xe.length)<=0)){e.next=3;break}return _.ZP.info("请上传文件"),e.abrupt("return");case 3:return ke(!0),(t=new FormData).append("file",xe[0]),e.next=8,(0,v.ZP)("/api/student_groups/".concat(l.couserid,"/import_user.json"),{method:"post",body:t},!0);case 8:0===(null==(n=e.sent)?void 0:n.status)&&r({type:"classroomList/setActionTabs",payload:{key:"刷新列表",types:2,list:null==n?void 0:n.audit_users}}),ke(!1);case 11:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Ne=[{title:"姓名",width:100,ellipsis:!0,dataIndex:"username",render:function(e,t){return(0,R.jsx)(I.Z,{placement:"bottom",title:e,children:(0,R.jsx)(x.Link,{className:"bold c-black",to:"/users/".concat(t.login),target:"_blank",children:e||"--"})})}},{title:"学号/工号",width:100,dataIndex:"student_number",ellipsis:!0,render:function(e){return(0,R.jsx)(I.Z,{placement:"bottom",title:e,children:(0,R.jsx)("span",{children:e||"--"})})}},{title:"班级",width:100,dataIndex:"student_name",ellipsis:!0,render:function(e){return(0,R.jsx)(I.Z,{placement:"bottom",title:e,children:(0,R.jsx)("span",{children:e||"--"})})}},{title:"院系/部门",dataIndex:"depart_name",width:130,ellipsis:!0,render:function(e){return(0,R.jsx)(I.Z,{placement:"bottom",title:e,children:(0,R.jsx)("span",{children:e||"--"})})}},{title:"手机",width:100,dataIndex:"phone",ellipsis:!0,render:function(e){return(0,R.jsx)(I.Z,{placement:"bottom",title:e,children:(0,R.jsx)("span",{children:e||"--"})})}},{title:"邮箱",dataIndex:"email",width:100,ellipsis:!0,render:function(e){return(0,R.jsx)(I.Z,{placement:"bottom",title:e,children:(0,R.jsx)("span",{children:e||"--"})})}},{title:"最后登录时间",dataIndex:"last_login_on",width:140,ellipsis:!0,render:function(e){return(0,R.jsx)(I.Z,{placement:"bottom",title:e?w()(e).format("YYYY-MM-DD HH:mm"):"- -",children:(0,R.jsx)("span",{children:e?w()(e).format("YYYY-MM-DD HH:mm"):"- -"})})}}];return(0,R.jsx)(f.Z,{centered:!0,title:"添加学生",open:"添加学生"===s.actionTabs.key,okText:"确定",cancelText:"取消",width:"1"===ye?1100:600,zIndex:1e3,afterClose:function(){he([])},confirmLoading:be,bodyStyle:{minHeight:200},onOk:o()(i()().mark((function e(){return i()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("1"!==ye){e.next=3;break}return Te(),e.abrupt("return");case 3:Ce();case 4:case"end":return e.stop()}}),e)}))),onCancel:function(){le([]),r({type:"classroomList/setActionTabs",payload:{}})},children:(0,R.jsxs)(N.Z,{activeKey:ye,onChange:function(e){return je(e)},className:Y,children:[(0,R.jsx)(q,{tab:"手动添加",children:(0,R.jsxs)("div",{className:H,children:[(0,R.jsxs)(h.Z,{layout:"inline",form:Q,initialValues:{school_name:"",keyword:"",search_type:"1"},className:"mt10",children:[(0,R.jsx)(h.Z.Item,{name:"search_type",label:"搜索类型",children:(0,R.jsxs)(P.Z,{children:[(0,R.jsx)(P.Z.Option,{value:"1",children:"姓名"}),(0,R.jsx)(P.Z.Option,{value:"2",children:"手机号"}),(0,R.jsx)(P.Z.Option,{value:"3",children:"邮箱"})]})}),(0,R.jsx)(h.Z.Item,{name:"keyword",label:"搜索内容",children:(0,R.jsx)(L.Z,{allowClear:!0,style:{width:240},defaultValue:(null===(t=c.selectArrs)||void 0===t?void 0:t.category_name)||(null===(n=c.selectArrs)||void 0===n?void 0:n.name)})}),(0,R.jsx)(h.Z.Item,{name:"department_name",label:"院系:",children:(0,R.jsx)(P.Z,{style:{width:200},children:null==y?void 0:y.map((function(e){return(0,R.jsx)(P.Z.Option,{value:null==e?void 0:e.value,children:null==e?void 0:e.value})}))})}),(0,R.jsx)(h.Z.Item,{children:(0,R.jsx)(F.ZP,{htmlType:"submit",type:"primary",onClick:function(){return function(){var e;if(""===(null===(e=Q.getFieldValue())||void 0===e?void 0:e.keyword))return $([]),void _.ZP.error("请输入搜索内容");ue(!1),Z=!0,S(!0),le([]),W(!1),setTimeout((function(){Se(!0)}),300)}()},children:"搜索"})})]}),de&&(0,R.jsxs)("div",{className:"tc font16 c-light-black mt40 pb30",children:[(0,R.jsx)("img",{src:M.L6,width:"250",alt:""}),(0,R.jsx)("br",{}),(0,R.jsx)("p",{className:"mt20",children:"请搜索要添加的人员"})]}),!de&&""==X&&!K&&(0,R.jsxs)("div",{className:"tc font16 c-light-black mt40 pb30",children:[(0,R.jsx)("img",{src:M.z3,width:"100",alt:""}),(0,R.jsx)("br",{}),(0,R.jsx)("p",{className:"mt20",children:"暂时还没有相关数据哦!"})]}),(!de&&""!=X||K)&&(0,R.jsxs)("section",{children:[(0,R.jsx)("div",{className:"flexd-table-header mt20"}),(0,R.jsx)("div",{style:{maxHeight:260,overflow:"auto"},children:(0,R.jsx)(z(),{initialLoad:!1,pageStart:1,threshold:20,loadMore:function(e){Se()},hasMore:Z,useWindow:!1,children:(0,R.jsx)(j.Z,{loading:K,rowKey:function(e){return e.numid},rowSelection:{type:"checkbox",onChange:function(e){le(e)}},pagination:!1,dataSource:X,columns:Ne})})})]})]})},"1"),(0,R.jsx)(q,{tab:"批量导入",children:(0,R.jsx)("div",{className:H,children:(0,R.jsxs)("div",{className:"mt20",style:{marginLeft:86},children:[(0,R.jsxs)("div",{className:"mb20",children:[(0,R.jsx)("span",{className:"mr40",children:"步骤1:"}),"下载",(0,R.jsx)("a",{className:"ml5 mr5",onClick:o()(i()().mark((function e(){return i()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:(0,E.FH)("",(0,E.NY)({url:G.Z.API_SERVER+"/api/student_groups/down_template",query:{}}));case 1:case"end":return e.stop()}}),e)}))),children:"导入学生模版"}),"批量导入成员。"]}),(0,R.jsxs)("div",{children:[(0,R.jsx)("span",{className:"mr40",children:"步骤2:"}),"上传填写好的《导入学生模版》。"]}),(0,R.jsx)("div",{style:{margin:"4px 0px 20px 94px"},children:(0,R.jsx)(O.Z,C()(C()({},Ze),{},{children:(0,R.jsx)(F.ZP,{type:"primary",className:"mt10",icon:(0,R.jsx)(D.Z,{}),children:"选择文件"})}))})]})})},"2")]})})})),W=["classroomList","globalSetting","loading","user","dispatch","location"];w().locale("ZH-cn");var B=(0,x.connect)((function(e){var t=e.classroomList,n=e.loading,s=e.globalSetting,a=e.user;return{classroomList:t,globalSetting:s,loading:n.models.classroomList,user:a}}))((function(e){var t,n=e.classroomList,s=(e.globalSetting,e.loading,e.user,e.dispatch),r=e.location,l=(p()(e,W),(0,x.useParams)(),(0,m.useState)()),c=d()(l,2),u=c[0],k=c[1],w=(0,m.useState)(1),T=d()(w,2),C=T[0],N=T[1],I=(0,m.useState)(null),P=d()(I,2),L=(P[0],P[1],(0,m.useState)(!0)),F=d()(L,2),O=F[0],V=F[1],z=(0,m.useState)(20),A=d()(z,2),M=A[0],Y=(A[1],(0,m.useState)(!1)),H=d()(Y,2),D=H[0],E=H[1],G=h.Z.useForm(),q=(d()(G,1)[0],(0,x.useParams)()),B=(0,m.useState)([]),Q=d()(B,2),U=Q[0],J=Q[1],X=(0,m.useState)(""),$=d()(X,2),ee=$[0],te=$[1];function ne(e){return se.apply(this,arguments)}function se(){return se=o()(i()().mark((function e(t){var n,s;return i()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return V(!0),n=t||C,e.next=4,(0,v.ZP)("/api/student_groups/".concat(null==q?void 0:q.couserid,".json"),{method:"get",params:{page:n,limit:M,keyword:ee||""}});case 4:s=e.sent,k(s),V(!1);case 7:case"end":return e.stop()}}),e)}))),se.apply(this,arguments)}(0,m.useEffect)((function(){ne()}),[C,q,ee]),(0,m.useEffect)((function(){var e;"刷新列表"===n.actionTabs.key&&(ne(),(null===(e=n.actionTabs.list)||void 0===e?void 0:e.length)>0&&E(!0))}),[n.actionTabs.key]);var ae=[{title:"序号",dataIndex:"name",align:"left",key:"name",ellipsis:!0,width:50,render:function(e,t,n){return(0,R.jsx)("span",{children:M*(C-1)+n+1})}},{title:"姓名",dataIndex:"real_name",align:"left",key:"content",render:function(e){return(0,R.jsx)("span",{style:{fontWeight:500},children:e})}},{title:"学号",dataIndex:"student_id",align:"left",key:"clazz"},{title:"院系/部门",dataIndex:"department_name",align:"left",key:"created_at",render:function(e){return(0,R.jsx)("span",{className:"c-grey-666",children:e})}},{title:"手机号",dataIndex:"phone",align:"left",key:"created_at",render:function(e){return(0,R.jsx)("span",{className:"c-grey-666",children:e})}},{title:"邮箱账号",dataIndex:"mail",align:"left",key:"created_at",render:function(e){return(0,R.jsx)("span",{className:"c-grey-666",children:e})}},{title:"操作",dataIndex:"id",align:"right",key:"remark",width:150,ellipsis:!0,render:function(e,t,n){return(0,R.jsxs)(y.Z,{align:"middle",justify:"space-between",children:[(0,R.jsx)("a",{style:{marginRight:"10px",color:"#165DFF"},onClick:function(){var t,n;t=e,f.Z.confirm({centered:!0,width:488,okText:"确定",cancelText:"取消",title:"提示",icon:null,className:S.Z.CustomTipsModalCss,content:(0,R.jsxs)("div",{children:[(0,R.jsxs)("div",{children:["重置该学生密码后,学生密码为默认密码:",(0,R.jsx)("span",{style:{color:"#000"},children:"12345678"})]}),(0,R.jsx)("p",{children:"且该学生将收到密码重置消息通知,请提醒该学生及时更改密码"})]}),onOk:(n=o()(i()().mark((function e(){var n;return i()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,v.ZP)("/api/student_groups/".concat(q.couserid,"/reset_password.json"),{method:"post",body:{user_id:t}});case 2:0===e.sent.status&&(_.ZP.info("重置成功"),ne(1===(null==u||null===(n=u.assets)||void 0===n?void 0:n.length)&&C>1?C-1:C));case 4:case"end":return e.stop()}}),e)}))),function(){return n.apply(this,arguments)})})},children:"重置密码"}),(0,R.jsx)("a",{style:{color:"#165DFF"},onClick:function(){var t,n;t=e,f.Z.confirm({centered:!0,width:488,okText:"确定",cancelText:"取消",title:"提示",icon:null,className:S.Z.CustomTipsModalCss,content:"请确认是否将该学员移除该班级,移除后该学生将分配在未分班中,其他老师可拉入该学员进入班级",onOk:(n=o()(i()().mark((function e(){var n;return i()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,v.ZP)("/api/student_groups/".concat(q.couserid,"/destroy_user.json"),{method:"post",body:{user_id:t}});case 2:0===e.sent.status&&(_.ZP.info("移除成功"),ne(1===(null==u||null===(n=u.assets)||void 0===n?void 0:n.length)&&C>1?C-1:C));case 4:case"end":return e.stop()}}),e)}))),function(){return n.apply(this,arguments)})})},children:"移除"})]})}}],re=[{title:"学号",dataIndex:"student_id",align:"left",key:"student_id",ellipsis:!0,width:50,render:function(e,t,n){return(0,R.jsx)("span",{children:e})}},{title:"姓名",dataIndex:"real_name",align:"left",key:"content",render:function(e){return(0,R.jsx)("span",{style:{fontWeight:500},children:e})}},{title:"班级",dataIndex:"student_group_name",align:"left",key:"clazz"},{title:"院系",dataIndex:"department_name",align:"left",key:"created_at",render:function(e){return(0,R.jsx)("span",{className:"c-grey-666",children:e})}},{title:"负责教师",dataIndex:"teacher_names",align:"left",key:"created_at",render:function(e){return(0,R.jsx)("span",{className:"c-grey-666",children:e})}}];return(0,R.jsxs)("div",{className:g,children:[(0,R.jsxs)(y.Z,{justify:"space-between",style:{marginBottom:"36px"},align:"middle",className:"mt8",children:[(0,R.jsxs)("span",{children:[(0,R.jsxs)("span",{style:{cursor:"pointer",fontSize:"14px"},onClick:function(){x.history.push("/users/".concat(null==q?void 0:q.username,"/classmanagement")),s({type:"classroomList/setActionTabs",payload:{key:""}})},children:[(0,R.jsx)(b.Z,{})," ",r&&(null===(t=r.query)||void 0===t?void 0:t.department_name)]}),(0,R.jsxs)("span",{style:{color:"#5F6368",marginLeft:20},children:["共",(0,R.jsx)("span",{style:{color:"#1869FF"},children:null==u?void 0:u.total_count}),"个学生"]})]}),(0,R.jsxs)("span",{style:{display:"flex"},children:[(0,R.jsx)(Z.op,{onClick:function(){s({type:"classroomList/setActionTabs",payload:{key:"添加学生",tab:"2"}})},type:"primary",children:"导入学生"}),(0,R.jsx)(Z.op,{style:{margin:"0px 30px"},onClick:function(){s({type:"classroomList/setActionTabs",payload:{key:"添加学生",tab:"1"}})},type:"primary",children:"添加学生"}),(0,R.jsx)(Z.t7,{style:{width:300},onChange:function(e){te(e)},placeholder:"请输入姓名学号名称进行搜索"})]})]}),(0,R.jsx)(Z.Gi,{children:(0,R.jsx)(j.Z,{columns:ae,loading:O,dataSource:null==u?void 0:u.user_list,pagination:{hideOnSinglePage:!0,pageSize:M,showSizeChanger:!1,current:C,position:["bottomCenter"],onChange:function(e,t){N(e)},total:null==u?void 0:u.total_count}})}),(0,R.jsx)(K,{}),(0,R.jsxs)(f.Z,{visible:D,wrapClassName:S.Z.CustomCss,okText:"申请审核",title:1===n.actionTabs.types?"添加学生":"导入学生",cancelText:"取消",width:880,onCancel:function(){E(!1)},onOk:o()(i()().mark((function e(){var t;return i()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return console.log("---",U),e.next=3,(0,v.ZP)("/api/group_audit_records.json",{method:"post",body:{user_ids:U,student_group_id:q.couserid}});case 3:0===(null==(t=e.sent)?void 0:t.status)&&(_.ZP.info("申请成功"),E(!1));case 5:case"end":return e.stop()}}),e)}))),children:[(0,R.jsxs)("p",{style:{color:"#5F6367"},children:["检测到",1===n.actionTabs.types?"添加":"导入","的学生,已存在班级,避免误加导致添加错误,请联系该学生负责的教师沟通,将其移出班级再添加,或勾选需要添加的学生,并向管理员审核,审核后学生自动加入您的班级"]}),(0,R.jsx)(Z.Gi,{children:(0,R.jsx)(j.Z,{columns:re,loading:O,rowKey:function(e){return e.id},rowSelection:{type:"checkbox",onChange:function(e){J(a()(e))}},dataSource:n.actionTabs.list,pagination:!1})})]})]})}))},39132:function(e,t){t.Z={flex_box_center:"flex_box_center___vG4eV",flex_space_between:"flex_space_between___qVVxe",flex_box_vertical_center:"flex_box_vertical_center___P8Z8s",flex_box_center_end:"flex_box_center_end___VMme3",flex_box_column:"flex_box_column___VMHwm",dropdownmenus:"dropdownmenus___oVzoj",popupClassNames:"popupClassNames___OcZq7",selectdown:"selectdown___mmcA8"}}}]); |