addPage.vue 41 KB

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