addPage.vue 38 KB

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