addPage.vue 41 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402
  1. <template>
  2. <div class="student-add-page">
  3. <div class="top-title-box">
  4. <p>{{titleName}}</p>
  5. </div>
  6. <el-form :model="form" class="top-info-box" ref="form" :inline="true" :rules="rules" label-width="180px">
  7. <div class="left-info-box">
  8. <img :src="form.avatar" v-if="form.avatar">
  9. <img src="@/assets/ZDimages/tx_cion_one.png" v-if="!form.avatar">
  10. <el-upload
  11. v-if="!editType"
  12. class="certificate-avatar-uploader"
  13. :action="uploadImgUrl"
  14. :show-file-list="false"
  15. accept="image/jpeg,image/gif,image/png"
  16. :on-success="handleAvatarSuccess"
  17. :headers="headers"
  18. :before-upload="beforeAvatarUpload">
  19. <p>上传证件照</p>
  20. </el-upload>
  21. </div>
  22. <div class="right-info-box">
  23. <el-form-item label="姓名:" prop="nickName">
  24. <el-input
  25. :disabled="editType"
  26. style="width:218px;"
  27. maxlength="50"
  28. v-model="form.nickName"
  29. placeholder="请输入姓名"
  30. clearable
  31. size="small"
  32. />
  33. </el-form-item>
  34. <el-form-item label="性别:" prop="sex">
  35. <el-radio-group v-model="form.sex" v-if="!editType">
  36. <el-radio :label="0" style="margin-left:20px;width:70px;">男</el-radio>
  37. <el-radio :label="1">女</el-radio>
  38. </el-radio-group>
  39. <p v-if="editType" style="line-height:40px;color:#999;width:180px;padding-left:40px;">{{form.sex==0?'男':'女'}}</p>
  40. </el-form-item>
  41. <el-form-item label="学号:" prop="userName">
  42. <el-input
  43. style="width:218px;"
  44. :disabled="editType"
  45. maxlength="50"
  46. v-model="form.userName"
  47. placeholder="请输入学号"
  48. clearable
  49. size="small"
  50. />
  51. </el-form-item>
  52. <el-form-item label="所在学院:" prop="deptId">
  53. <el-select v-model="form.deptId" clearable :disabled="editType" placeholder="请选择所在学院">
  54. <el-option
  55. v-for="item in deptOptions"
  56. :key="item.deptId"
  57. :label="item.deptName"
  58. :value="item.deptId">
  59. </el-option>
  60. </el-select>
  61. </el-form-item>
  62. <el-form-item label="身份:" prop="position">
  63. <el-select
  64. :disabled="editType"
  65. v-model="form.position"
  66. filterable
  67. remote
  68. clearable
  69. reserve-keyword
  70. @change="positionSelectClick"
  71. @clear="positionClearClick"
  72. placeholder="请选择身份"
  73. :remote-method="positionSelect">
  74. <el-option
  75. v-for="item in positionOptions"
  76. :key="item.postId"
  77. :label="item.postName"
  78. :value="item.postId">
  79. </el-option>
  80. </el-select>
  81. </el-form-item>
  82. <!--<el-form-item label="角色:" prop="roleIds">-->
  83. <!--<el-select-->
  84. <!--:disabled="editType"-->
  85. <!--v-model="form.roleIds"-->
  86. <!--multiple-->
  87. <!--collapse-tags-->
  88. <!--placeholder="请选择角色">-->
  89. <!--<el-option-->
  90. <!--v-for="item in roleOptionselectOptions"-->
  91. <!--:key="item.roleId"-->
  92. <!--:label="item.roleName"-->
  93. <!--:value="item.roleId">-->
  94. <!--</el-option>-->
  95. <!--</el-select>-->
  96. <!--</el-form-item>-->
  97. <el-form-item label="专业:" prop="majorId">
  98. <el-select
  99. :disabled="editType"
  100. v-model="form.majorId"
  101. filterable
  102. remote
  103. clearable
  104. reserve-keyword
  105. @change="majorSelectClick"
  106. @clear="majorClearClick"
  107. placeholder="请选择专业"
  108. :remote-method="majorSelect">
  109. <el-option
  110. v-for="item in majorOptions"
  111. :key="item.id"
  112. :label="item.majorName"
  113. :value="item.id">
  114. </el-option>
  115. </el-select>
  116. </el-form-item>
  117. <el-form-item label="手机号码:" prop="phonenumber">
  118. <el-input
  119. :disabled="editType"
  120. style="width:218px;"
  121. maxlength="11"
  122. onkeyup="this.value=this.value.replace(/[^\d.]/g,'')"
  123. v-model="form.phonenumber"
  124. placeholder="请输入手机号码"
  125. clearable
  126. size="small"
  127. />
  128. </el-form-item>
  129. <el-form-item label="班级:" prop="grade">
  130. <el-select
  131. :disabled="editType"
  132. v-model="form.grade"
  133. filterable
  134. remote
  135. clearable
  136. reserve-keyword
  137. @change="gradeSelectClick"
  138. @clear="gradeClearClick"
  139. placeholder="请选择班级"
  140. :remote-method="gradeSelect">
  141. <el-option
  142. v-for="item in gradeOptions"
  143. :key="item.id"
  144. :label="item.className"
  145. :value="item.id">
  146. </el-option>
  147. </el-select>
  148. </el-form-item>
  149. <el-form-item label="出生日期:" prop="dateBirth">
  150. <el-date-picker
  151. :disabled="editType"
  152. v-model="form.dateBirth"
  153. type="date"
  154. placeholder="请选择出生日期">
  155. </el-date-picker>
  156. </el-form-item>
  157. <el-form-item label="邮箱:" prop="email">
  158. <el-input
  159. :disabled="editType"
  160. style="width:218px;"
  161. maxlength="40"
  162. v-model="form.email"
  163. placeholder="请输入邮箱"
  164. clearable
  165. size="small"
  166. />
  167. </el-form-item>
  168. <el-form-item label="导师:" prop="tutorUserId">
  169. <el-select
  170. :disabled="editType"
  171. v-model="form.tutorUserId"
  172. filterable
  173. remote
  174. clearable
  175. reserve-keyword
  176. @change="tutorUserSelectClick"
  177. @clear="tutorUserClearClick"
  178. placeholder="请选择"
  179. :remote-method="tutorUserSelect">
  180. <el-option
  181. v-for="item in tutorUserOptions"
  182. :key="item.userId"
  183. :label="item.nickName+'-'+item.userName"
  184. :value="item.userId">
  185. </el-option>
  186. </el-select>
  187. </el-form-item>
  188. <el-form-item label="学生类别:" prop="education">
  189. <el-select
  190. :disabled="editType"
  191. v-model="form.education"
  192. filterable
  193. remote
  194. clearable
  195. reserve-keyword
  196. @change="educationSelectClick"
  197. @clear="educationClearClick"
  198. placeholder="请选择学生类别"
  199. :remote-method="educationSelect">
  200. <el-option
  201. v-for="item in educationOptions"
  202. :key="item.dictValue"
  203. :label="item.dictLabel"
  204. :value="item.dictValue">
  205. </el-option>
  206. </el-select>
  207. </el-form-item>
  208. <el-form-item label="学籍状态:" prop="workStatus">
  209. <el-select
  210. :disabled="editType"
  211. v-model="form.workStatus"
  212. filterable
  213. remote
  214. clearable
  215. reserve-keyword
  216. @change="workStatusSelectClick"
  217. @clear="workStatusClearClick"
  218. placeholder="请选择学籍状态"
  219. :remote-method="workStatusSelect">
  220. <el-option
  221. v-for="item in workStatusOptions"
  222. :key="item.dictValue"
  223. :label="item.dictLabel"
  224. :value="item.dictValue">
  225. </el-option>
  226. </el-select>
  227. </el-form-item>
  228. <el-form-item label="校园卡号:" prop="cardNum">
  229. <el-input
  230. :disabled="editType"
  231. style="width:218px;"
  232. onkeyup="this.value=this.value.replace(/^\s*|\s*$/g,'')"
  233. maxlength="30"
  234. v-model="form.cardNum"
  235. placeholder="请输入校园卡号"
  236. clearable
  237. size="small"
  238. />
  239. </el-form-item>
  240. <el-form-item label="人脸照片:" prop="status" v-if="editType">
  241. <div style="width:180px;" v-if="form.faceImg">
  242. <img :src="form.faceImg" style="width:140px;height:140px;">
  243. </div>
  244. <p v-if="!form.faceImg" style="line-height:40px;color:#999;width:180px;padding-left:40px;">未上传</p>
  245. </el-form-item>
  246. <el-form-item label="电子签名:" prop="status" v-if="editType">
  247. <div style="width:180px;" v-if="form.signature">
  248. <img :src="form.signature" style="width:140px;height:140px;">
  249. </div>
  250. <p v-if="!form.signature" style="line-height:40px;color:#999;width:180px;padding-left:40px;">未上传</p>
  251. </el-form-item>
  252. </div>
  253. </el-form>
  254. <div class="bottom-button-box" v-if="editType">
  255. <p class="null-p"></p>
  256. <p class="button-p-1 reset-button-one" @click="outPageButton">返回</p>
  257. <p class="null-p"></p>
  258. </div>
  259. <div class="bottom-button-box" v-if="!editType">
  260. <p class="null-p"></p>
  261. <p class="button-p-1 reset-button-one" @click="outPageButton">返回</p>
  262. <addPageSubPageSZDX class="button-p-2" v-if="versionField() === 'suZhouDaXue'"></addPageSubPageSZDX>
  263. <addPageSubPagePublic class="button-p-2" v-else></addPageSubPagePublic>
  264. <!--<p class="inquire-button-one" @click="upDataClick">提交</p>-->
  265. <p class="null-p"></p>
  266. </div>
  267. <el-dialog title="添加班级" :visible.sync="gradeOpen" width="600px" append-to-body class="teacher-revise-dialog-box" :close-on-click-modal="false">
  268. <el-form :model="gradeForm" ref="gradeForm" :inline="true" :rules="rules" class="addCheckPage-min">
  269. <el-form-item label="班级名称" prop="gradeName" label-width="110px" >
  270. <el-input v-model="gradeForm.gradeName" clearable maxlength="20" style="width:420px;" placeholder="请输入班级名称"/>
  271. </el-form-item>
  272. </el-form>
  273. <div slot="footer" class="teacher-revise-dialog-button-box">
  274. <p class="reset-button-one" @click="gradeOpenOff">取消</p>
  275. <p class="inquire-button-one" @click="gradeOpenUp">确定</p>
  276. </div>
  277. </el-dialog>
  278. </div>
  279. </template>
  280. <script>
  281. import { listDepartments } from "@/api/system/dept";
  282. import { optionselect, roleOptionselect } from "@/api/system/user_teacher";
  283. import { getWorkList, getVague, addSystemClass, getMajorList,getTeacherOption,addUserStudent,putUserStudent } from "@/api/system/user_student";
  284. import { getToken } from "@/utils/auth";
  285. import addPageSubPagePublic from './differenceComponent/addPageSubPagePublic.vue'
  286. import addPageSubPageSZDX from './differenceComponent/addPageSubPageSZDX.vue'
  287. export default {
  288. name: "addPage",
  289. components: {
  290. addPageSubPagePublic,
  291. addPageSubPageSZDX
  292. },
  293. props:{
  294. editType:{},
  295. propsData:{},
  296. titleName:{},
  297. },
  298. data() {
  299. return {
  300. uploadImgUrl: this.uploadUrl(), // 上传的图片服务器地址
  301. headers: {
  302. Authorization: "Bearer " + getToken(),
  303. },
  304. menuList:[],
  305. form:{
  306. avatar:"",
  307. nickName:"",
  308. sex:0,
  309. userName:"",
  310. deptId:"",
  311. position:"", //身份
  312. roleIds:"", //角色
  313. majorId:"",
  314. grade:"",
  315. dateBirth:"",
  316. email:"",
  317. phonenumber:"",
  318. tutorUserId:"",
  319. education:"",
  320. workStatus:"",
  321. cardNum:"",
  322. status:0,
  323. },
  324. rules:{
  325. gradeName: [{ required: true, message: "请输入班级名称", trigger: "blur" },
  326. { required: true, message: "请输入班级名称", validator: this.spaceJudgment, trigger: "blur" }],
  327. nickName: [{ required: true, message: "请输入姓名", trigger: "blur" },
  328. { required: true, message: "请输入姓名", validator: this.spaceJudgment, trigger: "blur" }],
  329. userName: [{ required: true, message: "请输入学号", trigger: "blur" },
  330. { required: true, message: "请输入学号", validator: this.spaceJudgment, trigger: "blur" }],
  331. deptId: [{ required: true, message: "请选择所在学院", trigger: "blur" }],
  332. position: [{ required: true, message: "请选择身份", trigger: "blur" }],
  333. majorId: [{ required: true, message: "请选择专业", trigger: "blur" }],
  334. phonenumber: [
  335. { required: true, message: "请输入手机号码", trigger: "blur" },
  336. { required: true, message: "请输入手机号码", validator: this.spaceJudgment, trigger: "blur" }
  337. ],
  338. },
  339. textType:false,
  340. //数据范围列表
  341. optionsDataList:[
  342. {type: 0, value: "所有数据",},
  343. {type: 1, value: "本部门及下级部门数据",},
  344. {type: 2, value: "本部门及指定部门数据",},
  345. {type: 3, value: "当前账号数据",},
  346. ],
  347. //学院数据列表
  348. deptOptions:[],
  349. //快捷权限列表
  350. templateList:[{name:"校领导",id:"0"},{name:"教师",id:"1"},{name:"助教",id:"2"}],
  351. templateKey:"",
  352. templateName:"",
  353. //权限勾选数据
  354. permissionOpen:false,
  355. permissionCheckData:{},
  356. allCheckType:false,
  357. //身份列表
  358. positionOptions:[],
  359. //导师查询数据
  360. tutorUserOptions:[],
  361. //专业查询数据
  362. majorOptions:[],
  363. //班级查询数据
  364. gradeOptions:[
  365. {id:9981,className:"+ 添加班级"}
  366. ],
  367. //学生类别查询数据
  368. educationOptions:[],
  369. //学籍状态查询数据
  370. workStatusOptions:[],
  371. //新增班级弹窗开关
  372. gradeOpen:false,
  373. gradeForm:{
  374. gradeName:"",
  375. },
  376. //角色列表
  377. roleOptionselectOptions:[],
  378. }
  379. },
  380. created(){
  381. let self = this;
  382. if(this.propsData.userId){
  383. if(this.propsData.avatar){
  384. this.form.avatar = this.propsData.avatar;
  385. }else{
  386. this.form.avatar = '';
  387. }
  388. if(this.propsData.nickName){
  389. this.form.nickName = this.propsData.nickName;
  390. }else{
  391. this.form.nickName = '';
  392. }
  393. if(this.propsData.sex){
  394. this.form.sex = parseInt(this.propsData.sex);
  395. }else{
  396. this.form.sex = 0;
  397. }
  398. if(this.propsData.userName){
  399. this.form.userName = this.propsData.userName;
  400. }else{
  401. this.form.userName = '';
  402. }
  403. if(this.propsData.deptId){
  404. this.form.deptId = this.propsData.deptId;
  405. }else{
  406. this.form.deptId = '';
  407. }
  408. if(this.propsData.position){
  409. this.form.position = parseInt(this.propsData.position);
  410. }else{
  411. this.form.position = '';
  412. }
  413. if(this.propsData.majorId){
  414. this.form.majorId = parseInt(this.propsData.majorId);
  415. }else{
  416. this.form.majorId = '';
  417. }
  418. if(this.propsData.grade){
  419. this.form.grade = parseInt(this.propsData.grade);
  420. }else{
  421. this.form.grade = '';
  422. }
  423. if(this.propsData.dateBirth){
  424. this.form.dateBirth = this.propsData.dateBirth;
  425. }else{
  426. this.form.dateBirth = '';
  427. }
  428. if(this.propsData.email){
  429. this.form.email = this.propsData.email;
  430. }else{
  431. this.form.email = '';
  432. }
  433. if(this.propsData.phonenumber){
  434. this.form.phonenumber = this.propsData.phonenumber;
  435. }else{
  436. this.form.phonenumber = '';
  437. }
  438. if(this.propsData.tutorUserId){
  439. this.form.tutorUserId = this.propsData.tutorUserId;
  440. }else{
  441. this.form.tutorUserId = '';
  442. }
  443. if(this.propsData.education){
  444. this.form.education = this.propsData.education;
  445. }else{
  446. this.form.education = '';
  447. }
  448. if(this.propsData.workStatus){
  449. this.form.workStatus = this.propsData.workStatus;
  450. }else{
  451. this.form.workStatus = '';
  452. }
  453. if(this.propsData.cardNum){
  454. this.form.cardNum = this.propsData.cardNum;
  455. }else{
  456. this.form.cardNum = '';
  457. }
  458. if(this.propsData.status){
  459. this.form.status = parseInt(this.propsData.status);
  460. }else{
  461. this.form.status = '';
  462. }
  463. if(this.propsData.faceImg){
  464. this.form.faceImg = this.propsData.faceImg;
  465. }else{
  466. this.form.faceImg = '';
  467. }
  468. if(this.propsData.signature){
  469. this.form.signature = this.propsData.signature;
  470. }else{
  471. this.form.signature = '';
  472. }
  473. if(this.propsData.roleIds){
  474. this.form.roleIds = this.propsData.roleIds;
  475. }else{
  476. this.form.roleIds = [];
  477. }
  478. // if(this.propsData.position === '未定'){
  479. // this.form.position = null;
  480. // }
  481. // if(this.propsData.position){
  482. // this.form.position = this.propsData.position.split(',');
  483. // for(let i=0;i<self.form.position.length;i++){
  484. // self.form.position[i] = parseInt(self.form.position[i]);//字符串转数字
  485. // }
  486. // }else{
  487. // this.form.position = [];
  488. // }
  489. this.getSelect();
  490. }else{
  491. this.getAll();
  492. this.positionSelectAll();
  493. this.majorSelectAll();
  494. this.gradeSelectAll();
  495. this.positionSelect();
  496. }
  497. },
  498. mounted(){
  499. this.listDepartments();
  500. },
  501. methods:{
  502. upDataClick(){
  503. this.$refs["form"].validate(valid => {
  504. if (valid) {
  505. if(this.form.email){
  506. let re = /^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/;
  507. if(!re.test(this.form.email)){
  508. this.msgError('请输入正确的邮箱地址')
  509. return
  510. }
  511. }
  512. let obj = JSON.parse(JSON.stringify(this.form));
  513. // obj.position = obj.position+'';
  514. if(this.propsData.userId){
  515. //编辑
  516. obj.userId = this.propsData.userId
  517. putUserStudent(obj).then(response => {
  518. if(response.code==200){
  519. this.msgSuccess(response.msg)
  520. this.outPageButton()
  521. }else if(response.code==205){
  522. this.$confirm(response.msg, "警告", {
  523. confirmButtonText: "确定",
  524. cancelButtonText: "取消",
  525. type: "warning"
  526. }).then(() => {
  527. // 确定
  528. this.$router.push({ path: '/comprehensive/laboratoryManagement/accessAuthorization' });
  529. }).catch(function() {
  530. // 取消
  531. this.outPageButton();
  532. });
  533. }
  534. });
  535. }else{
  536. //新增
  537. addUserStudent(obj).then(response => {
  538. if(response.code==200){
  539. this.msgSuccess(response.msg)
  540. this.outPageButton()
  541. }else if(response.code==205){
  542. this.$confirm(response.msg, "警告", {
  543. confirmButtonText: "确定",
  544. cancelButtonText: "取消",
  545. type: "warning"
  546. }).then(() => {
  547. // 确定
  548. this.$router.push({ path: '/comprehensive/laboratoryManagement/accessAuthorization' });
  549. }).catch(function() {
  550. // 取消
  551. this.outPageButton();
  552. });
  553. }
  554. });
  555. }
  556. }
  557. });
  558. },
  559. //查询所有搜索接口数据
  560. getAll(){
  561. //查询角色
  562. roleOptionselect().then(response => {
  563. this.roleOptionselectOptions = response.data;
  564. });
  565. //学籍状态查询
  566. getVague({dictType:"student_status", dictLabel:""}).then(response => {
  567. this.workStatusOptions = response.data;
  568. });
  569. //学生类别查询
  570. getVague({dictType:"education",dictLabel:""}).then(response => {
  571. this.educationOptions = response.data;
  572. });
  573. },
  574. getSelect(){
  575. //身份查询
  576. this.positionSelectAll();
  577. //查询角色
  578. roleOptionselect().then(response => {
  579. this.roleOptionselectOptions = response.data;
  580. });
  581. //导师查询
  582. if(this.propsData.tutorUserName){
  583. getTeacherOption({nickName:this.propsData.tutorUserName}).then(response => {
  584. this.tutorUserOptions = response.data;
  585. });
  586. }
  587. //专业查询
  588. getMajorList({majorName:this.propsData.major}).then(response => {
  589. this.majorOptions = response.data;
  590. });
  591. //班级查询
  592. getWorkList({className:this.propsData.className}).then(response => {
  593. this.gradeOptions = response.data;
  594. this.gradeOptions.push({className:"+ 添加班级",id:9981});
  595. });
  596. //学籍状态查询
  597. getVague({dictType:"student_status", dictLabel:""}).then(response => {
  598. this.workStatusOptions = response.data;
  599. });
  600. //学生类别查询
  601. getVague({dictType:"education",dictLabel:""}).then(response => {
  602. this.educationOptions = response.data;
  603. });
  604. },
  605. //新增班级关闭
  606. gradeOpenOff(){
  607. this.gradeOpen = false;
  608. },
  609. //新增班级提交
  610. gradeOpenUp(){
  611. this.$refs["gradeForm"].validate(valid => {
  612. if (valid) {
  613. let obj = {
  614. className:this.gradeForm.gradeName,
  615. }
  616. addSystemClass(obj).then(response => {
  617. this.gradeOptions.unshift({className:response.data.classObject.className,id:response.data.classObject.id});
  618. this.form.grade = response.data.classObject.id;
  619. this.gradeOpen = false;
  620. this.msgSuccess(response.msg);
  621. });
  622. }
  623. });
  624. },
  625. //账号启用停用开关
  626. changeIsNeedCaptcha(){
  627. this.form.status = this.form.status == 1?0:1;
  628. },
  629. positionSelectNull(type){
  630. if(!type&&!this.positionOptions[0]){
  631. this.positionSelectAll();
  632. }
  633. },
  634. positionSelectAll(){
  635. let obj = {
  636. postName:'',
  637. };
  638. optionselect(obj).then(response => {
  639. let list = [];
  640. for(let i=0;i<response.data.length;i++){
  641. if(response.data[i].roleIds){
  642. list.push(response.data[i]);
  643. }
  644. }
  645. this.$set(this,'positionOptions',list)
  646. });
  647. },
  648. //查询身份
  649. positionSelect(query){
  650. let obj = {
  651. postName:query,
  652. };
  653. optionselect(obj).then(response => {
  654. let list = [];
  655. for(let i=0;i<response.data.length;i++){
  656. if(response.data[i].roleIds){
  657. list.push(response.data[i]);
  658. }
  659. }
  660. this.$set(this,'positionOptions',list)
  661. });
  662. },
  663. positionSelectClick(data){
  664. //选中
  665. let self = this;
  666. if(this.form.position){
  667. let num = 0;
  668. for(let i=0;i<self.positionOptions.length;i++){
  669. if(self.form.position == self.positionOptions[i].postId && self.positionOptions[i].roleIds){
  670. let list = self.positionOptions[i].roleIds.split(',')
  671. let newList = [];
  672. for(let o=0;o<list.length;o++){
  673. for(let s=0;s<self.roleOptionselectOptions.length;s++){
  674. if(list[o] == self.roleOptionselectOptions[s].roleId){
  675. newList.push(parseInt(list[o]));
  676. }
  677. }
  678. }
  679. self.$set(self.form,'roleIds',newList);
  680. num++
  681. }
  682. }
  683. if(num == 0){
  684. self.$set(self.form,'roleIds',[]);
  685. }
  686. }
  687. this.$forceUpdate();
  688. },
  689. positionClearClick(){
  690. // this.$set(this.form,'roleIds',[])
  691. this.positionSelectAll();
  692. },
  693. //*************************学籍状态查询
  694. workStatusSelect(query){
  695. if (query !== '') {
  696. let obj = {
  697. dictType:"student_status",
  698. dictLabel:query
  699. };
  700. getVague(obj).then(response => {
  701. this.workStatusOptions = response.data;
  702. });
  703. } else {
  704. this.workStatusOptions = [];
  705. }
  706. },
  707. //学籍状态选中触发
  708. workStatusSelectClick(data){
  709. console.log("学籍状态选中触发",data)
  710. },
  711. //学籍状态清空触发
  712. workStatusClearClick(){
  713. console.log("学籍状态清空触发")
  714. getVague({dictType:"student_status", dictLabel:""}).then(response => {
  715. this.workStatusOptions = response.data;
  716. });
  717. },
  718. //*************************学生类别查询
  719. educationSelect(query){
  720. if (query !== '') {
  721. let obj = {
  722. dictType:"education",
  723. dictLabel:query
  724. };
  725. getVague(obj).then(response => {
  726. this.educationOptions = response.data;
  727. });
  728. } else {
  729. this.educationOptions = [];
  730. }
  731. },
  732. //学生类别选中触发
  733. educationSelectClick(data){
  734. console.log("学生类别选中触发",data)
  735. },
  736. //学生类别清空触发
  737. educationClearClick(){
  738. console.log("学生类别清空触发")
  739. getVague({dictType:"education",dictLabel:""}).then(response => {
  740. this.educationOptions = response.data;
  741. });
  742. },
  743. //*************************班级查询
  744. gradeSelectNull(type){
  745. if(!type&&!this.gradeOptions[1]){
  746. this.gradeSelectAll();
  747. }
  748. },
  749. gradeSelectAll(){
  750. let obj = {
  751. className:'',
  752. }
  753. getWorkList(obj).then(response => {
  754. this.gradeOptions = response.data;
  755. this.gradeOptions.push({className:"+ 添加班级",id:9981});
  756. });
  757. },
  758. gradeSelect(query){
  759. let obj = {
  760. className:query,
  761. }
  762. getWorkList(obj).then(response => {
  763. this.gradeOptions = response.data;
  764. this.gradeOptions.push({className:"+ 添加班级",id:9981});
  765. });
  766. },
  767. //班级选中触发
  768. gradeSelectClick(data){
  769. console.log("班级选中触发",data);
  770. if(data == 9981){
  771. this.gradeForm.gradeName = "";
  772. this.form.grade = "";
  773. this.gradeOpen = true;
  774. }
  775. },
  776. //班级清空触发
  777. gradeClearClick(){
  778. console.log("班级清空触发")
  779. this.gradeSelectAll();
  780. },
  781. //*************************专业查询
  782. majorSelectNull(type){
  783. console.log("type",type);
  784. if(!type&&!this.majorOptions[0]){
  785. this.majorSelectAll();
  786. }
  787. },
  788. majorSelectAll(){
  789. let obj = {
  790. majorName:'',
  791. };
  792. getMajorList(obj).then(response => {
  793. this.majorOptions = response.data;
  794. });
  795. },
  796. majorSelect(query){
  797. let obj = {
  798. majorName:query,
  799. };
  800. getMajorList(obj).then(response => {
  801. this.majorOptions = response.data;
  802. });
  803. },
  804. //专业选中触发
  805. majorSelectClick(data){
  806. console.log("专业选中触发",data)
  807. },
  808. //专业清空触发
  809. majorClearClick(){
  810. console.log("专业清空触发")
  811. this.majorSelectAll();
  812. },
  813. //*************************导师查询
  814. tutorUserSelect(query){
  815. if (query !== '') {
  816. let obj = {
  817. nickName:query,
  818. }
  819. getTeacherOption(obj).then(response => {
  820. this.tutorUserOptions = response.data;
  821. });
  822. } else {
  823. this.tutorUserOptions = [];
  824. }
  825. },
  826. //导师选中触发
  827. tutorUserSelectClick(data){
  828. console.log("导师选中触发",data)
  829. },
  830. //导师清空触发
  831. tutorUserClearClick(){
  832. console.log("导师清空触发")
  833. this.tutorUserOptions = [];
  834. },
  835. //获取学院列表
  836. listDepartments(){
  837. listDepartments().then(response => {
  838. this.deptOptions = response.data;
  839. });
  840. },
  841. //上传
  842. handleAvatarSuccess(res, file) {
  843. console.log(res.data.url);
  844. this.form.avatar = res.data.url;
  845. this.$forceUpdate()
  846. },
  847. beforeAvatarUpload(file) {
  848. let type = false;
  849. console.log('file',file);
  850. if (file.type == 'image/png' || file.type == 'image/jpeg' || file.type == 'image/gif') {
  851. type = true;
  852. }else{
  853. this.$message.error('只能上传png/jpeg/gif格式图片');
  854. type = false;
  855. }
  856. return type;
  857. },
  858. //导入用户权限
  859. importUser(){
  860. this.$refs.userOpen.show();
  861. },
  862. //返回事件
  863. outPageButton(){
  864. this.$parent.outPage(1);
  865. },
  866. //模板选中
  867. templateClick(id){
  868. let self = this;
  869. if(this.templateKey != id){
  870. this.templateKey = id;
  871. for(let i=0;i<self.templateList.length;i++){
  872. if(id == self.templateList[i].id){
  873. this.templateName = self.templateList[i].name;
  874. }
  875. }
  876. }else{
  877. this.templateKey = "";
  878. this.templateName = "";
  879. }
  880. },
  881. //清除模板选中
  882. templateDel(){
  883. this.templateKey = "";
  884. this.templateName = "";
  885. },
  886. //权限详情按钮
  887. permissionDetails(item){
  888. console.log('item',item)
  889. let num = 0;
  890. for(let i=0;i<item.children.length;i++){
  891. if(item.children[i].checkType){
  892. num++
  893. }
  894. }
  895. this.allCheckType = num != 0;
  896. this.$set(this,'permissionCheckData',item)
  897. this.permissionOpen = true;
  898. },
  899. //数据范围刷新
  900. optionChange(){
  901. this.$forceUpdate()
  902. },
  903. //模块勾选逻辑
  904. itemCheckClick(status,type,item){
  905. if(status == 1 || status == 2 || status == 3){
  906. //一级菜单勾选
  907. if(item.children){
  908. for(let i=0;i<item.children.length;i++){
  909. item.children[i].checkType = !!type;
  910. if(item.children[i].children){
  911. for(let o=0;o<item.children[i].children.length;o++){
  912. item.children[i].children[o].checkType = !!type;
  913. if(item.children[i].children[o].children){
  914. for(let x=0;x<item.children[i].children[o].children.length;x++){
  915. item.children[i].children[o].children[x].checkType = !!type;
  916. }
  917. }
  918. if(item.children[i].children[o].menuType == 'C'){
  919. item.children[i].children[o].scopeCheckType = !!type;
  920. item.children[i].children[o].value = type?0:"";
  921. item.children[i].children[o].permissionCheckType = !!type;
  922. }
  923. }
  924. }
  925. if(item.children[i].menuType == 'C'){
  926. item.children[i].scopeCheckType = !!type;
  927. item.children[i].value = type?0:"";
  928. item.children[i].permissionCheckType = !!type;
  929. }
  930. }
  931. }
  932. if(item.menuType == 'C'){
  933. item.scopeCheckType = !!type;
  934. item.value = type?0:"";
  935. item.permissionCheckType = !!type;
  936. }
  937. }else if(status == 4){
  938. //数据范围勾选
  939. item.scopeCheckType = !!type;
  940. item.value = type?0:"";
  941. }else if(status == 5){
  942. //管理权限勾选
  943. item.permissionCheckType = !!type;
  944. for(let i=0;i<item.children.length;i++){
  945. item.children[i].checkType = !!type;
  946. }
  947. }
  948. },
  949. //权限勾选逻辑
  950. permissionCheckClick(status,type){
  951. let self = this;
  952. if(status == 1){
  953. for(let i=0;i<self.permissionCheckData.children.length;i++){
  954. self.permissionCheckData.children[i].checkType = !!type;
  955. self.permissionCheckData.permissionCheckType = !!type;
  956. }
  957. }else if(status == 2){
  958. if(type&&!this.allCheckType){
  959. this.allCheckType = true;
  960. this.permissionCheckData.permissionCheckType = true;
  961. }else{
  962. let num = 0;
  963. for(let i=0;i<self.permissionCheckData.children.length;i++){
  964. if(!self.permissionCheckData.children[i].checkType){
  965. num++
  966. }
  967. }
  968. if(num == self.permissionCheckData.children.length){
  969. this.allCheckType = false;
  970. this.permissionCheckData.permissionCheckType = false;
  971. }
  972. }
  973. }
  974. this.$forceUpdate();
  975. },
  976. showText(){
  977. console.log("1")
  978. this.textType = true;
  979. },
  980. hideText(){
  981. console.log("2")
  982. this.textType = false;
  983. },
  984. }
  985. }
  986. </script>
  987. <style scoped lang="scss">
  988. .student-add-page{
  989. flex:1;
  990. display: flex;
  991. flex-direction: column;
  992. box-shadow: 0 0 8px 2px rgba(0, 0, 0, 0.1);
  993. padding:0 0 20px!important;
  994. *{
  995. margin:0;
  996. }
  997. .top-title-box{
  998. border-bottom:1px solid #E0E0E0;
  999. display: flex;
  1000. p:nth-child(1){
  1001. color:#0045AF;
  1002. line-height:80px;
  1003. margin-left:24px;
  1004. font-size:18px;
  1005. flex:1;
  1006. }
  1007. p:nth-child(2){
  1008. border:1px solid #0045AF;
  1009. color:#0045AF;
  1010. width:80px;
  1011. height:30px;
  1012. text-align: center;
  1013. font-size:16px;
  1014. border-radius: 6px;
  1015. line-height:30px;
  1016. margin:25px 20px 0 0;
  1017. cursor: pointer;
  1018. }
  1019. }
  1020. .top-info-box{
  1021. flex:1;
  1022. display: flex;
  1023. padding:40px 20px 0;
  1024. .left-info-box{
  1025. margin-right:20px;
  1026. img{
  1027. width:100px;
  1028. height:120px;
  1029. }
  1030. p{
  1031. width: 80px;
  1032. height: 26px;
  1033. border: 1px solid #0183FA;
  1034. border-radius: 6px;
  1035. line-height:24px;
  1036. font-size:12px;
  1037. color:#0183FA;
  1038. text-align: center;
  1039. margin:24px 10px;
  1040. }
  1041. }
  1042. }
  1043. .for-button-list{
  1044. background: #E5F2FE;
  1045. margin:0 20px;
  1046. display: flex;
  1047. .for-title-p{
  1048. width:175px;
  1049. height:80px;
  1050. line-height:80px;
  1051. font-size:16px;
  1052. color:#333;
  1053. text-align: center;
  1054. }
  1055. .for-button-max-box{
  1056. flex:1;
  1057. .for-button-min-box{
  1058. font-size:16px;
  1059. display: inline-block;
  1060. overflow: hidden;
  1061. height:30px;
  1062. line-height:30px;
  1063. border-radius:6px;
  1064. margin:25px 28px 0 0;
  1065. cursor: pointer;
  1066. i{
  1067. height:30px;
  1068. line-height:30px;
  1069. font-size:16px;
  1070. color:#fff;
  1071. margin-right:6px;
  1072. }
  1073. }
  1074. .colorAA{
  1075. color: #ffffff;
  1076. background: #0183FA;
  1077. padding:0 26px 0 16px;
  1078. }
  1079. .colorBB{
  1080. padding:0 26px;
  1081. color: #333;
  1082. background: #E0E0E0;
  1083. }
  1084. }
  1085. }
  1086. .template-name-box{
  1087. display: flex;
  1088. .template-name-p{
  1089. font-weight:500;
  1090. height:80px;
  1091. line-height:80px;
  1092. font-size:16px;
  1093. color:#333;
  1094. margin-left:20px;
  1095. flex: 1;
  1096. }
  1097. .template-name-button{
  1098. width:80px;
  1099. height:40px;
  1100. line-height:40px;
  1101. margin:20px 20px 0 0;
  1102. }
  1103. .template-name-button-one{
  1104. width:180px;
  1105. height:40px;
  1106. line-height:40px;
  1107. margin:20px 40px 0 0;
  1108. color:#fff;
  1109. background: #0183FA;
  1110. border: 1px solid #E0E0E0;
  1111. cursor: pointer;
  1112. font-size: 14px;
  1113. text-align: center;
  1114. border-radius: 6px;
  1115. }
  1116. }
  1117. .table-for-max-box{
  1118. border:1px solid #D7D7D7;
  1119. margin:0 20px;
  1120. *{
  1121. margin:0;
  1122. padding:0;
  1123. }
  1124. .table-title-box{
  1125. background: rgba(1,131,250,0.1);
  1126. display: flex;
  1127. p{
  1128. font-size:14px;
  1129. font-weight:700;
  1130. color:#333;
  1131. line-height:48px;
  1132. padding-left:20px;
  1133. }
  1134. p:nth-child(1){
  1135. width:615px;
  1136. border-right:1px solid #D7D7D7;
  1137. }
  1138. }
  1139. .table-for-big-box{
  1140. border-top:1px solid #D7D7D7;
  1141. display: flex;
  1142. font-size:14px;
  1143. .max-title-box-null{
  1144. width:615px!important;
  1145. }
  1146. .max-title-box{
  1147. width:230px;
  1148. border-right:1px solid #D7D7D7;
  1149. min-height:48px;
  1150. position: relative;
  1151. p{
  1152. position: absolute;
  1153. top:50%;
  1154. left:20px;
  1155. height:18px;
  1156. line-height:18px;
  1157. margin-top:-9px;
  1158. }
  1159. }
  1160. .max-right-box{
  1161. flex:5;
  1162. min-height:48px;
  1163. .big-box:nth-child(1){
  1164. border:none!important;
  1165. }
  1166. .big-box-null{
  1167. line-height:48px;
  1168. margin-left:20px;
  1169. color:#606266;
  1170. }
  1171. .big-box{
  1172. display: flex;
  1173. border-top:1px solid #D7D7D7;
  1174. .big-title-box-null{
  1175. width:385px!important;
  1176. }
  1177. .big-title-box{
  1178. width:180px;
  1179. border-right:1px solid #D7D7D7;
  1180. min-height:48px;
  1181. position: relative;
  1182. overflow: hidden;
  1183. p{
  1184. position: absolute;
  1185. top:50%;
  1186. left:20px;
  1187. height:48px;
  1188. line-height:48px;
  1189. margin-top:-24px;
  1190. }
  1191. }
  1192. .big-right-box-null{
  1193. display: flex;
  1194. .scope-box{
  1195. width:430px;
  1196. position: relative;
  1197. overflow: hidden;
  1198. border-right:1px solid #D7D7D7;
  1199. p{
  1200. position: absolute;
  1201. top:50%;
  1202. left:20px;
  1203. height:48px;
  1204. line-height:48px;
  1205. margin-top:-24px;
  1206. }
  1207. }
  1208. .permission-box{
  1209. flex:1;
  1210. position: relative;
  1211. overflow: hidden;
  1212. display: flex;
  1213. .check-left-p{
  1214. margin-left:20px;
  1215. height:48px;
  1216. line-height:48px;
  1217. }
  1218. .check-button-box{
  1219. width:130px;
  1220. height:36px;
  1221. margin:6px 0 0 36px;
  1222. line-height:36px;
  1223. display: flex;
  1224. color:#333;
  1225. cursor: pointer;
  1226. img{
  1227. width:16px;
  1228. height:16px;
  1229. margin:10px 14px 0 19px;
  1230. }
  1231. }
  1232. .check-button-box-colorA{
  1233. background: #CCE6FE;
  1234. color:#0183FA;
  1235. }
  1236. .check-button-box-colorB{
  1237. background: #E0E0E0;
  1238. color:#333;
  1239. }
  1240. }
  1241. }
  1242. .big-right-box{
  1243. flex:5;
  1244. min-height:48px;
  1245. .min-box:nth-child(1){
  1246. border:none!important;
  1247. }
  1248. .min-box{
  1249. display: flex;
  1250. border-top:1px solid #D7D7D7;
  1251. .min-title-box{
  1252. width:205px;
  1253. border-right:1px solid #D7D7D7;
  1254. min-height:48px;
  1255. position: relative;
  1256. overflow: hidden;
  1257. p{
  1258. position: absolute;
  1259. top:50%;
  1260. left:20px;
  1261. height:48px;
  1262. line-height:48px;
  1263. margin-top:-24px;
  1264. }
  1265. }
  1266. .min-right-box{
  1267. flex:5;
  1268. min-height:48px;
  1269. display: flex;
  1270. .scope-box{
  1271. width:430px;
  1272. position: relative;
  1273. overflow: hidden;
  1274. border-right:1px solid #D7D7D7;
  1275. p{
  1276. position: absolute;
  1277. top:50%;
  1278. left:20px;
  1279. height:48px;
  1280. line-height:48px;
  1281. margin-top:-24px;
  1282. }
  1283. }
  1284. .permission-box{
  1285. flex:1;
  1286. position: relative;
  1287. overflow: hidden;
  1288. display: flex;
  1289. .check-left-p{
  1290. margin-left:20px;
  1291. height:48px;
  1292. line-height:48px;
  1293. }
  1294. .check-button-box{
  1295. width:130px;
  1296. height:36px;
  1297. margin:6px 0 0 36px;
  1298. line-height:36px;
  1299. display: flex;
  1300. color:#333;
  1301. cursor: pointer;
  1302. img{
  1303. width:16px;
  1304. height:16px;
  1305. margin:10px 14px 0 19px;
  1306. }
  1307. }
  1308. .check-button-box-colorA{
  1309. background: #CCE6FE;
  1310. color:#0183FA;
  1311. }
  1312. .check-button-box-colorB{
  1313. background: #E0E0E0;
  1314. color:#333;
  1315. }
  1316. }
  1317. }
  1318. }
  1319. }
  1320. }
  1321. }
  1322. }
  1323. }
  1324. .bottom-button-box{
  1325. display: flex;
  1326. width:600px;
  1327. margin:30px auto 10px;
  1328. .null-p{
  1329. flex:1;
  1330. }
  1331. .button-p-1{
  1332. width:100px;
  1333. margin-right:20px;
  1334. }
  1335. .button-p-2{
  1336. width:100px;
  1337. margin-right:20px;
  1338. }
  1339. .button-p-3{
  1340. width:180px;
  1341. }
  1342. }
  1343. }
  1344. </style>
  1345. <style lang="scss">
  1346. .student-add-page{
  1347. .top-info-box{
  1348. .el-form-item{
  1349. height:70px;
  1350. }
  1351. .el-input--small{
  1352. width:250px!important;
  1353. }
  1354. .el-select{
  1355. width:250px!important;
  1356. }
  1357. .el-input{
  1358. width:250px!important;
  1359. }
  1360. .el-input__inner{
  1361. width:250px!important;
  1362. }
  1363. .el-radio-group{
  1364. width:250px!important;
  1365. }
  1366. .is-disabled{
  1367. width:250px!important;
  1368. }
  1369. .switch .el-switch__label {
  1370. position: absolute;
  1371. display: none;
  1372. color: #fff !important;
  1373. }
  1374. .switch .el-switch__label--right {
  1375. z-index: 1;
  1376. }
  1377. .switch .el-switch__label--right span{
  1378. margin-left: 10px;
  1379. }
  1380. .switch .el-switch__label--left {
  1381. z-index: 1;
  1382. }
  1383. .switch .el-switch__label--left span{
  1384. margin-left: 24px;
  1385. }
  1386. .switch .el-switch__label.is-active {
  1387. display: block;
  1388. }
  1389. .switch.el-switch .el-switch__core,
  1390. .el-switch .el-switch__label {
  1391. width: 64px !important;
  1392. margin: 0;
  1393. }
  1394. }
  1395. }
  1396. </style>