addPage.vue 37 KB

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