addPage.vue 38 KB

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