addPage.vue 36 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258
  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: this.uploadUrl(), // 上传的图片服务器地址
  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. if(response.code==200){
  453. this.msgSuccess(response.msg)
  454. this.outPageButton()
  455. }else if(response.code==205){
  456. this.$confirm(response.msg, "警告", {
  457. confirmButtonText: "确定",
  458. cancelButtonText: "取消",
  459. type: "warning"
  460. }).then(() => {
  461. // 确定
  462. this.$router.push({ path: '/comprehensive/laboratoryManagement/accessAuthorization' });
  463. }).catch(function() {
  464. // 取消
  465. this.outPageButton();
  466. });
  467. }
  468. });
  469. }else{
  470. //新增
  471. addUserStudent(this.form).then(response => {
  472. if(response.code==200){
  473. this.msgSuccess(response.msg)
  474. this.outPageButton()
  475. }else if(response.code==205){
  476. this.$confirm(response.msg, "警告", {
  477. confirmButtonText: "确定",
  478. cancelButtonText: "取消",
  479. type: "warning"
  480. }).then(() => {
  481. // 确定
  482. this.$router.push({ path: '/comprehensive/laboratoryManagement/accessAuthorization' });
  483. }).catch(function() {
  484. // 取消
  485. this.outPageButton();
  486. });
  487. }
  488. });
  489. }
  490. }
  491. });
  492. },
  493. //查询所有搜索接口数据
  494. getAll(){
  495. //学籍状态查询
  496. getVague({dictType:"student_status", dictLabel:""}).then(response => {
  497. this.workStatusOptions = response.data;
  498. });
  499. //学生类别查询
  500. getVague({dictType:"education",dictLabel:""}).then(response => {
  501. this.educationOptions = response.data;
  502. });
  503. },
  504. getSelect(){
  505. //导师查询
  506. if(this.propsData.tutorUserName){
  507. getTeacherOption({nickName:this.propsData.tutorUserName}).then(response => {
  508. this.tutorUserOptions = response.data;
  509. });
  510. }
  511. //专业查询
  512. getMajorList({majorName:this.propsData.major}).then(response => {
  513. this.majorOptions = response.data;
  514. });
  515. //班级查询
  516. getWorkList({className:this.propsData.className}).then(response => {
  517. this.gradeOptions = response.data;
  518. this.gradeOptions.push({className:"+ 添加班级",id:9981});
  519. });
  520. //学籍状态查询
  521. getVague({dictType:"student_status", dictLabel:""}).then(response => {
  522. this.workStatusOptions = response.data;
  523. });
  524. //学生类别查询
  525. getVague({dictType:"education",dictLabel:""}).then(response => {
  526. this.educationOptions = response.data;
  527. });
  528. },
  529. //新增班级关闭
  530. gradeOpenOff(){
  531. this.gradeOpen = false;
  532. },
  533. //新增班级提交
  534. gradeOpenUp(){
  535. this.$refs["gradeForm"].validate(valid => {
  536. if (valid) {
  537. let obj = {
  538. className:this.gradeForm.gradeName,
  539. }
  540. addSystemClass(obj).then(response => {
  541. this.gradeOptions.unshift({className:response.data.classObject.className,id:response.data.classObject.id});
  542. this.form.grade = response.data.classObject.id;
  543. this.gradeOpen = false;
  544. this.msgSuccess(response.msg);
  545. });
  546. }
  547. });
  548. },
  549. //账号启用停用开关
  550. changeIsNeedCaptcha(){
  551. this.form.status = this.form.status == 1?0:1;
  552. },
  553. //*************************学籍状态查询
  554. workStatusSelect(query){
  555. if (query !== '') {
  556. let obj = {
  557. dictType:"student_status",
  558. dictLabel:query
  559. };
  560. getVague(obj).then(response => {
  561. this.workStatusOptions = response.data;
  562. });
  563. } else {
  564. this.workStatusOptions = [];
  565. }
  566. },
  567. //学籍状态选中触发
  568. workStatusSelectClick(data){
  569. console.log("学籍状态选中触发",data)
  570. },
  571. //学籍状态清空触发
  572. workStatusClearClick(){
  573. console.log("学籍状态清空触发")
  574. getVague({dictType:"student_status", dictLabel:""}).then(response => {
  575. this.workStatusOptions = response.data;
  576. });
  577. },
  578. //*************************学生类别查询
  579. educationSelect(query){
  580. if (query !== '') {
  581. let obj = {
  582. dictType:"education",
  583. dictLabel:query
  584. };
  585. getVague(obj).then(response => {
  586. this.educationOptions = response.data;
  587. });
  588. } else {
  589. this.educationOptions = [];
  590. }
  591. },
  592. //学生类别选中触发
  593. educationSelectClick(data){
  594. console.log("学生类别选中触发",data)
  595. },
  596. //学生类别清空触发
  597. educationClearClick(){
  598. console.log("学生类别清空触发")
  599. getVague({dictType:"education",dictLabel:""}).then(response => {
  600. this.educationOptions = response.data;
  601. });
  602. },
  603. //*************************班级查询
  604. gradeSelectNull(type){
  605. if(!type&&!this.gradeOptions[1]){
  606. this.gradeSelectAll();
  607. }
  608. },
  609. gradeSelectAll(){
  610. let obj = {
  611. className:'',
  612. }
  613. getWorkList(obj).then(response => {
  614. this.gradeOptions = response.data;
  615. this.gradeOptions.push({className:"+ 添加班级",id:9981});
  616. });
  617. },
  618. gradeSelect(query){
  619. if (query !== '') {
  620. let obj = {
  621. className:query,
  622. }
  623. getWorkList(obj).then(response => {
  624. this.gradeOptions = response.data;
  625. this.gradeOptions.push({className:"+ 添加班级",id:9981});
  626. });
  627. } else {
  628. this.optionsUser = [];
  629. }
  630. },
  631. //班级选中触发
  632. gradeSelectClick(data){
  633. console.log("班级选中触发",data);
  634. if(data == 9981){
  635. this.gradeForm.gradeName = "";
  636. this.form.grade = "";
  637. this.gradeOpen = true;
  638. }
  639. },
  640. //班级清空触发
  641. gradeClearClick(){
  642. console.log("班级清空触发")
  643. this.gradeSelectAll();
  644. },
  645. //*************************专业查询
  646. majorSelectNull(type){
  647. console.log("type",type);
  648. if(!type&&!this.majorOptions[0]){
  649. this.majorSelectAll();
  650. }
  651. },
  652. majorSelectAll(){
  653. let obj = {
  654. majorName:'',
  655. };
  656. getMajorList(obj).then(response => {
  657. this.majorOptions = response.data;
  658. });
  659. },
  660. majorSelect(query){
  661. if (query !== '') {
  662. let obj = {
  663. majorName:query,
  664. };
  665. getMajorList(obj).then(response => {
  666. this.majorOptions = response.data;
  667. });
  668. } else {
  669. this.majorOptions = [];
  670. }
  671. },
  672. //专业选中触发
  673. majorSelectClick(data){
  674. console.log("专业选中触发",data)
  675. },
  676. //专业清空触发
  677. majorClearClick(){
  678. console.log("专业清空触发")
  679. this.majorSelectAll();
  680. },
  681. //*************************导师查询
  682. tutorUserSelect(query){
  683. if (query !== '') {
  684. let obj = {
  685. nickName:query,
  686. }
  687. getTeacherOption(obj).then(response => {
  688. this.tutorUserOptions = response.data;
  689. });
  690. } else {
  691. this.tutorUserOptions = [];
  692. }
  693. },
  694. //导师选中触发
  695. tutorUserSelectClick(data){
  696. console.log("导师选中触发",data)
  697. },
  698. //导师清空触发
  699. tutorUserClearClick(){
  700. console.log("导师清空触发")
  701. this.tutorUserOptions = [];
  702. },
  703. //获取学院列表
  704. listDepartments(){
  705. listDepartments().then(response => {
  706. this.deptOptions = response.data;
  707. });
  708. },
  709. //上传
  710. handleAvatarSuccess(res, file) {
  711. console.log(res.data.url);
  712. this.form.avatar = res.data.url;
  713. this.$forceUpdate()
  714. },
  715. beforeAvatarUpload(file) {
  716. let type = false;
  717. console.log('file',file);
  718. if (file.type == 'image/png' || file.type == 'image/jpeg' || file.type == 'image/gif') {
  719. type = true;
  720. }else{
  721. this.$message.error('只能上传png/jpeg/gif格式图片');
  722. type = false;
  723. }
  724. return type;
  725. },
  726. //导入用户权限
  727. importUser(){
  728. this.$refs.userOpen.show();
  729. },
  730. //返回事件
  731. outPageButton(){
  732. this.$parent.outPage(1);
  733. },
  734. //模板选中
  735. templateClick(id){
  736. let self = this;
  737. if(this.templateKey != id){
  738. this.templateKey = id;
  739. for(let i=0;i<self.templateList.length;i++){
  740. if(id == self.templateList[i].id){
  741. this.templateName = self.templateList[i].name;
  742. }
  743. }
  744. }else{
  745. this.templateKey = "";
  746. this.templateName = "";
  747. }
  748. },
  749. //清除模板选中
  750. templateDel(){
  751. this.templateKey = "";
  752. this.templateName = "";
  753. },
  754. //权限详情按钮
  755. permissionDetails(item){
  756. console.log('item',item)
  757. let num = 0;
  758. for(let i=0;i<item.children.length;i++){
  759. if(item.children[i].checkType){
  760. num++
  761. }
  762. }
  763. this.allCheckType = num != 0;
  764. this.$set(this,'permissionCheckData',item)
  765. this.permissionOpen = true;
  766. },
  767. //数据范围刷新
  768. optionChange(){
  769. this.$forceUpdate()
  770. },
  771. //模块勾选逻辑
  772. itemCheckClick(status,type,item){
  773. if(status == 1 || status == 2 || status == 3){
  774. //一级菜单勾选
  775. if(item.children){
  776. for(let i=0;i<item.children.length;i++){
  777. item.children[i].checkType = !!type;
  778. if(item.children[i].children){
  779. for(let o=0;o<item.children[i].children.length;o++){
  780. item.children[i].children[o].checkType = !!type;
  781. if(item.children[i].children[o].children){
  782. for(let x=0;x<item.children[i].children[o].children.length;x++){
  783. item.children[i].children[o].children[x].checkType = !!type;
  784. }
  785. }
  786. if(item.children[i].children[o].menuType == 'C'){
  787. item.children[i].children[o].scopeCheckType = !!type;
  788. item.children[i].children[o].value = type?0:"";
  789. item.children[i].children[o].permissionCheckType = !!type;
  790. }
  791. }
  792. }
  793. if(item.children[i].menuType == 'C'){
  794. item.children[i].scopeCheckType = !!type;
  795. item.children[i].value = type?0:"";
  796. item.children[i].permissionCheckType = !!type;
  797. }
  798. }
  799. }
  800. if(item.menuType == 'C'){
  801. item.scopeCheckType = !!type;
  802. item.value = type?0:"";
  803. item.permissionCheckType = !!type;
  804. }
  805. }else if(status == 4){
  806. //数据范围勾选
  807. item.scopeCheckType = !!type;
  808. item.value = type?0:"";
  809. }else if(status == 5){
  810. //管理权限勾选
  811. item.permissionCheckType = !!type;
  812. for(let i=0;i<item.children.length;i++){
  813. item.children[i].checkType = !!type;
  814. }
  815. }
  816. },
  817. //权限勾选逻辑
  818. permissionCheckClick(status,type){
  819. let self = this;
  820. if(status == 1){
  821. for(let i=0;i<self.permissionCheckData.children.length;i++){
  822. self.permissionCheckData.children[i].checkType = !!type;
  823. self.permissionCheckData.permissionCheckType = !!type;
  824. }
  825. }else if(status == 2){
  826. if(type&&!this.allCheckType){
  827. this.allCheckType = true;
  828. this.permissionCheckData.permissionCheckType = true;
  829. }else{
  830. let num = 0;
  831. for(let i=0;i<self.permissionCheckData.children.length;i++){
  832. if(!self.permissionCheckData.children[i].checkType){
  833. num++
  834. }
  835. }
  836. if(num == self.permissionCheckData.children.length){
  837. this.allCheckType = false;
  838. this.permissionCheckData.permissionCheckType = false;
  839. }
  840. }
  841. }
  842. this.$forceUpdate();
  843. },
  844. showText(){
  845. console.log("1")
  846. this.textType = true;
  847. },
  848. hideText(){
  849. console.log("2")
  850. this.textType = false;
  851. },
  852. }
  853. }
  854. </script>
  855. <style scoped lang="scss">
  856. .student-add-page{
  857. flex:1;
  858. display: flex;
  859. flex-direction: column;
  860. box-shadow: 0 0 8px 2px rgba(0, 0, 0, 0.1);
  861. padding:0 0 20px!important;
  862. *{
  863. margin:0;
  864. }
  865. .top-title-box{
  866. border-bottom:1px solid #E0E0E0;
  867. display: flex;
  868. p:nth-child(1){
  869. color:#0045AF;
  870. line-height:80px;
  871. margin-left:24px;
  872. font-size:18px;
  873. flex:1;
  874. }
  875. p:nth-child(2){
  876. border:1px solid #0045AF;
  877. color:#0045AF;
  878. width:80px;
  879. height:30px;
  880. text-align: center;
  881. font-size:16px;
  882. border-radius: 6px;
  883. line-height:30px;
  884. margin:25px 20px 0 0;
  885. cursor: pointer;
  886. }
  887. }
  888. .top-info-box{
  889. display: flex;
  890. padding:40px 20px 0;
  891. .left-info-box{
  892. margin-right:20px;
  893. img{
  894. width:100px;
  895. height:120px;
  896. }
  897. p{
  898. width: 80px;
  899. height: 26px;
  900. border: 1px solid #0183FA;
  901. border-radius: 6px;
  902. line-height:24px;
  903. font-size:12px;
  904. color:#0183FA;
  905. text-align: center;
  906. margin:24px 10px;
  907. }
  908. }
  909. }
  910. .for-button-list{
  911. background: #E5F2FE;
  912. margin:0 20px;
  913. display: flex;
  914. .for-title-p{
  915. width:175px;
  916. height:80px;
  917. line-height:80px;
  918. font-size:16px;
  919. color:#333;
  920. text-align: center;
  921. }
  922. .for-button-max-box{
  923. flex:1;
  924. .for-button-min-box{
  925. font-size:16px;
  926. display: inline-block;
  927. overflow: hidden;
  928. height:30px;
  929. line-height:30px;
  930. border-radius:6px;
  931. margin:25px 28px 0 0;
  932. cursor: pointer;
  933. i{
  934. height:30px;
  935. line-height:30px;
  936. font-size:16px;
  937. color:#fff;
  938. margin-right:6px;
  939. }
  940. }
  941. .colorAA{
  942. color: #ffffff;
  943. background: #0183FA;
  944. padding:0 26px 0 16px;
  945. }
  946. .colorBB{
  947. padding:0 26px;
  948. color: #333;
  949. background: #E0E0E0;
  950. }
  951. }
  952. }
  953. .template-name-box{
  954. display: flex;
  955. .template-name-p{
  956. font-weight:500;
  957. height:80px;
  958. line-height:80px;
  959. font-size:16px;
  960. color:#333;
  961. margin-left:20px;
  962. flex: 1;
  963. }
  964. .template-name-button{
  965. width:80px;
  966. height:40px;
  967. line-height:40px;
  968. margin:20px 20px 0 0;
  969. }
  970. .template-name-button-one{
  971. width:180px;
  972. height:40px;
  973. line-height:40px;
  974. margin:20px 40px 0 0;
  975. color:#fff;
  976. background: #0183FA;
  977. border: 1px solid #E0E0E0;
  978. cursor: pointer;
  979. font-size: 14px;
  980. text-align: center;
  981. border-radius: 6px;
  982. }
  983. }
  984. .table-for-max-box{
  985. border:1px solid #D7D7D7;
  986. margin:0 20px;
  987. *{
  988. margin:0;
  989. padding:0;
  990. }
  991. .table-title-box{
  992. background: rgba(1,131,250,0.1);
  993. display: flex;
  994. p{
  995. font-size:14px;
  996. font-weight:700;
  997. color:#333;
  998. line-height:48px;
  999. padding-left:20px;
  1000. }
  1001. p:nth-child(1){
  1002. width:615px;
  1003. border-right:1px solid #D7D7D7;
  1004. }
  1005. }
  1006. .table-for-big-box{
  1007. border-top:1px solid #D7D7D7;
  1008. display: flex;
  1009. font-size:14px;
  1010. .max-title-box-null{
  1011. width:615px!important;
  1012. }
  1013. .max-title-box{
  1014. width:230px;
  1015. border-right:1px solid #D7D7D7;
  1016. min-height:48px;
  1017. position: relative;
  1018. p{
  1019. position: absolute;
  1020. top:50%;
  1021. left:20px;
  1022. height:18px;
  1023. line-height:18px;
  1024. margin-top:-9px;
  1025. }
  1026. }
  1027. .max-right-box{
  1028. flex:5;
  1029. min-height:48px;
  1030. .big-box:nth-child(1){
  1031. border:none!important;
  1032. }
  1033. .big-box-null{
  1034. line-height:48px;
  1035. margin-left:20px;
  1036. color:#606266;
  1037. }
  1038. .big-box{
  1039. display: flex;
  1040. border-top:1px solid #D7D7D7;
  1041. .big-title-box-null{
  1042. width:385px!important;
  1043. }
  1044. .big-title-box{
  1045. width:180px;
  1046. border-right:1px solid #D7D7D7;
  1047. min-height:48px;
  1048. position: relative;
  1049. overflow: hidden;
  1050. p{
  1051. position: absolute;
  1052. top:50%;
  1053. left:20px;
  1054. height:48px;
  1055. line-height:48px;
  1056. margin-top:-24px;
  1057. }
  1058. }
  1059. .big-right-box-null{
  1060. display: flex;
  1061. .scope-box{
  1062. width:430px;
  1063. position: relative;
  1064. overflow: hidden;
  1065. border-right:1px solid #D7D7D7;
  1066. p{
  1067. position: absolute;
  1068. top:50%;
  1069. left:20px;
  1070. height:48px;
  1071. line-height:48px;
  1072. margin-top:-24px;
  1073. }
  1074. }
  1075. .permission-box{
  1076. flex:1;
  1077. position: relative;
  1078. overflow: hidden;
  1079. display: flex;
  1080. .check-left-p{
  1081. margin-left:20px;
  1082. height:48px;
  1083. line-height:48px;
  1084. }
  1085. .check-button-box{
  1086. width:130px;
  1087. height:36px;
  1088. margin:6px 0 0 36px;
  1089. line-height:36px;
  1090. display: flex;
  1091. color:#333;
  1092. cursor: pointer;
  1093. img{
  1094. width:16px;
  1095. height:16px;
  1096. margin:10px 14px 0 19px;
  1097. }
  1098. }
  1099. .check-button-box-colorA{
  1100. background: #CCE6FE;
  1101. color:#0183FA;
  1102. }
  1103. .check-button-box-colorB{
  1104. background: #E0E0E0;
  1105. color:#333;
  1106. }
  1107. }
  1108. }
  1109. .big-right-box{
  1110. flex:5;
  1111. min-height:48px;
  1112. .min-box:nth-child(1){
  1113. border:none!important;
  1114. }
  1115. .min-box{
  1116. display: flex;
  1117. border-top:1px solid #D7D7D7;
  1118. .min-title-box{
  1119. width:205px;
  1120. border-right:1px solid #D7D7D7;
  1121. min-height:48px;
  1122. position: relative;
  1123. overflow: hidden;
  1124. p{
  1125. position: absolute;
  1126. top:50%;
  1127. left:20px;
  1128. height:48px;
  1129. line-height:48px;
  1130. margin-top:-24px;
  1131. }
  1132. }
  1133. .min-right-box{
  1134. flex:5;
  1135. min-height:48px;
  1136. display: flex;
  1137. .scope-box{
  1138. width:430px;
  1139. position: relative;
  1140. overflow: hidden;
  1141. border-right:1px solid #D7D7D7;
  1142. p{
  1143. position: absolute;
  1144. top:50%;
  1145. left:20px;
  1146. height:48px;
  1147. line-height:48px;
  1148. margin-top:-24px;
  1149. }
  1150. }
  1151. .permission-box{
  1152. flex:1;
  1153. position: relative;
  1154. overflow: hidden;
  1155. display: flex;
  1156. .check-left-p{
  1157. margin-left:20px;
  1158. height:48px;
  1159. line-height:48px;
  1160. }
  1161. .check-button-box{
  1162. width:130px;
  1163. height:36px;
  1164. margin:6px 0 0 36px;
  1165. line-height:36px;
  1166. display: flex;
  1167. color:#333;
  1168. cursor: pointer;
  1169. img{
  1170. width:16px;
  1171. height:16px;
  1172. margin:10px 14px 0 19px;
  1173. }
  1174. }
  1175. .check-button-box-colorA{
  1176. background: #CCE6FE;
  1177. color:#0183FA;
  1178. }
  1179. .check-button-box-colorB{
  1180. background: #E0E0E0;
  1181. color:#333;
  1182. }
  1183. }
  1184. }
  1185. }
  1186. }
  1187. }
  1188. }
  1189. }
  1190. }
  1191. .bottom-button-box{
  1192. display: flex;
  1193. width:100px;
  1194. margin:30px auto 10px;
  1195. p:nth-child(1){
  1196. width:100px;
  1197. }
  1198. }
  1199. }
  1200. </style>
  1201. <style lang="scss">
  1202. .student-add-page{
  1203. .top-info-box{
  1204. .el-form-item{
  1205. height:70px;
  1206. }
  1207. .el-input--small{
  1208. width:180px!important;
  1209. }
  1210. .el-select{
  1211. width:180px!important;
  1212. }
  1213. .el-input{
  1214. width:180px!important;
  1215. }
  1216. .el-input__inner{
  1217. width:180px!important;
  1218. }
  1219. .el-radio-group{
  1220. width:180px!important;
  1221. }
  1222. .is-disabled{
  1223. width:180px!important;
  1224. }
  1225. .switch .el-switch__label {
  1226. position: absolute;
  1227. display: none;
  1228. color: #fff !important;
  1229. }
  1230. .switch .el-switch__label--right {
  1231. z-index: 1;
  1232. }
  1233. .switch .el-switch__label--right span{
  1234. margin-left: 10px;
  1235. }
  1236. .switch .el-switch__label--left {
  1237. z-index: 1;
  1238. }
  1239. .switch .el-switch__label--left span{
  1240. margin-left: 24px;
  1241. }
  1242. .switch .el-switch__label.is-active {
  1243. display: block;
  1244. }
  1245. .switch.el-switch .el-switch__core,
  1246. .el-switch .el-switch__label {
  1247. width: 64px !important;
  1248. margin: 0;
  1249. }
  1250. }
  1251. }
  1252. </style>