student.vue 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920
  1. <template>
  2. <section class="content">
  3. <div class="box box-info">
  4. <!-- 正文信息 -->
  5. <div class="box-body">
  6. <el-form
  7. :model="formSearch"
  8. :inline="true"
  9. ref="formSearch"
  10. label-width="100px"
  11. >
  12. <el-form-item v-if="isSuperAdmin" label="顶级机构">
  13. <el-select
  14. v-model="formSearch.rootOrgId"
  15. placeholder="请选择"
  16. class="input"
  17. >
  18. <el-option
  19. v-for="item in rootOrgList"
  20. :label="item.name"
  21. :value="item.id"
  22. :key="item.id"
  23. >
  24. </el-option>
  25. </el-select>
  26. </el-form-item>
  27. <el-form-item label="姓名">
  28. <el-input
  29. placeholder="请输入姓名"
  30. v-model="formSearch.name"
  31. class="input"
  32. ></el-input>
  33. </el-form-item>
  34. <el-form-item label="学号">
  35. <el-input
  36. placeholder="请输入学号"
  37. v-model="formSearch.studentCode"
  38. class="input"
  39. ></el-input>
  40. </el-form-item>
  41. <el-form-item label="身份证">
  42. <el-input
  43. placeholder="请输入身份证"
  44. v-model="formSearch.identityNumber"
  45. class="input"
  46. ></el-input>
  47. </el-form-item>
  48. <el-form-item label="是否上传照片">
  49. <el-select v-model="formSearch.hasPhoto" class="input">
  50. <el-option label="未选择" value="ALL"> </el-option>
  51. <el-option label="是" value="TRUE"> </el-option>
  52. <el-option label="否" value="FALSE"> </el-option>
  53. </el-select>
  54. </el-form-item>
  55. <el-form-item class="pull-right">
  56. <el-button
  57. v-if="rolePrivileges.search_student"
  58. size="small"
  59. type="primary"
  60. icon="el-icon-search"
  61. @click="searchForm"
  62. >查询
  63. </el-button>
  64. <el-button size="small" @click="resetSearchForm"> 重置 </el-button>
  65. </el-form-item>
  66. </el-form>
  67. <span>操作:</span>
  68. <el-button
  69. v-if="rolePrivileges.upload_student_photo"
  70. size="small"
  71. type="info"
  72. @click="uploadPhoto"
  73. >上传照片
  74. </el-button>
  75. <el-button
  76. v-if="rolePrivileges.reset_student_password"
  77. size="small"
  78. type="warning"
  79. :disabled="noBatchSelected"
  80. @click="resetPassword('')"
  81. >重置密码
  82. </el-button>
  83. <el-button
  84. v-if="rolePrivileges.change_student_availability"
  85. size="small"
  86. type="success"
  87. :disabled="noBatchSelected"
  88. @click="enableStudent('')"
  89. >
  90. <i class="fa fa-check" aria-hidden="true"></i>启用
  91. </el-button>
  92. <el-button
  93. v-if="rolePrivileges.change_student_availability"
  94. size="small"
  95. type="danger"
  96. :disabled="noBatchSelected"
  97. @click="disableStudent('')"
  98. >
  99. <i class="fa fa-close" aria-hidden="true"></i>禁用
  100. </el-button>
  101. <el-button size="small" type="primary" @click="exportStudent">
  102. <i class="fa fa-download" aria-hidden="true"></i>导出
  103. </el-button>
  104. <div style="width: 100%;margin-bottom: 10px;"></div>
  105. <!-- 页面列表 -->
  106. <el-table
  107. :data="tableData"
  108. border
  109. style="width: 100%;text-align:center;"
  110. @selection-change="selectChange"
  111. >
  112. <el-table-column type="selection" width="50"></el-table-column>
  113. <el-table-column prop="id" width="100" label="ID"></el-table-column>
  114. <el-table-column label="考生" width="100">
  115. <template slot-scope="scope">
  116. <el-popover trigger="hover" placement="left">
  117. <div style="font-size: 18px;font-family: 新宋体">
  118. <tr>
  119. <td style="color: green">姓名</td>
  120. <td style="color:purple;padding-left: 20px;">
  121. {{ scope.row.name }}
  122. </td>
  123. </tr>
  124. <tr>
  125. <td style="color: green">身份证号</td>
  126. <td style="color:purple;padding-left: 20px;">
  127. {{ scope.row.identityNumber }}
  128. </td>
  129. </tr>
  130. <tr>
  131. <td style="color: green">学号</td>
  132. <td style="color:purple;padding-left: 20px;">
  133. {{ scope.row.studentCode }}
  134. </td>
  135. </tr>
  136. <tr>
  137. <td style="color: green">学习中心</td>
  138. <td style="color:purple;padding-left: 20px;">
  139. {{ scope.row.orgName }}
  140. </td>
  141. </tr>
  142. <tr>
  143. <td style="color: green">手机号</td>
  144. <td style="color:purple;padding-left: 20px;">
  145. {{ scope.row.phoneNumber }}
  146. </td>
  147. </tr>
  148. <tr>
  149. <td style="color: green">安全手机号</td>
  150. <td style="color:purple;padding-left: 20px;">
  151. {{ scope.row.securityPhone }}
  152. </td>
  153. </tr>
  154. <tr>
  155. <td style="color: green">创建时间</td>
  156. <td style="color:purple;padding-left: 20px;">
  157. {{ scope.row.creationTime }}
  158. </td>
  159. </tr>
  160. </div>
  161. <div slot="reference" class="name-wrapper">
  162. <span>{{ scope.row.name }}</span>
  163. </div>
  164. </el-popover>
  165. </template>
  166. </el-table-column>
  167. <el-table-column
  168. prop="studentCode"
  169. width=""
  170. label="学号"
  171. ></el-table-column>
  172. <el-table-column
  173. prop="identityNumber"
  174. width=""
  175. label="身份证"
  176. ></el-table-column>
  177. <el-table-column
  178. prop="updateTime"
  179. width="168"
  180. label="更新时间"
  181. ></el-table-column>
  182. <el-table-column width="60" label="状态">
  183. <span slot-scope="scope"> {{ getStatus(scope.row.enable) }} </span>
  184. </el-table-column>
  185. <el-table-column label="操作" width="260">
  186. <div slot-scope="scope">
  187. <el-button
  188. v-if="scope.row.photoPath"
  189. size="mini"
  190. type="warning"
  191. @click="showPhoto(scope.row)"
  192. ><i class="fa fa-check" aria-hidden="true"></i>查看照片
  193. </el-button>
  194. <el-button
  195. v-if="
  196. null != scope.row.enable &&
  197. !scope.row.enable &&
  198. rolePrivileges.change_student_availability
  199. "
  200. size="mini"
  201. type="success"
  202. @click="enableStudent(scope.row)"
  203. >
  204. <i class="fa fa-check" aria-hidden="true"></i>启用
  205. </el-button>
  206. <el-button
  207. v-else-if="rolePrivileges.change_student_availability"
  208. size="mini"
  209. type="danger"
  210. @click="disableStudent(scope.row)"
  211. >
  212. <i class="fa fa-close" aria-hidden="true"></i>禁用
  213. </el-button>
  214. <el-dropdown style="margin-left: 10px;">
  215. <el-button type="primary" plain size="mini">
  216. 更多<i class="el-icon-arrow-down el-icon--right"></i>
  217. </el-button>
  218. <el-dropdown-menu slot="dropdown">
  219. <el-dropdown-item
  220. v-if="rolePrivileges.reset_student_password"
  221. >
  222. <el-button
  223. size="mini"
  224. type="warning"
  225. @click="resetPassword(scope.row)"
  226. >重置密码
  227. </el-button>
  228. </el-dropdown-item>
  229. <el-dropdown-item>
  230. <el-button
  231. size="mini"
  232. type="warning"
  233. @click="showStuExamDialog(scope.row)"
  234. >考试记录
  235. </el-button>
  236. </el-dropdown-item>
  237. <el-dropdown-item v-if="rolePrivileges.unbind_student_code">
  238. <el-button
  239. size="mini"
  240. type="warning"
  241. @click="unbindStudentCode(scope.row)"
  242. >解绑学号
  243. </el-button>
  244. </el-dropdown-item>
  245. <el-dropdown-item v-if="rolePrivileges.unbind_security_phone">
  246. <el-button
  247. size="mini"
  248. type="warning"
  249. @click="unbindSecurityPhone(scope.row)"
  250. >解绑安全手机
  251. </el-button>
  252. </el-dropdown-item>
  253. </el-dropdown-menu>
  254. </el-dropdown>
  255. </div>
  256. </el-table-column>
  257. </el-table>
  258. <div class="page pull-right">
  259. <el-pagination
  260. @current-change="handleCurrentChange"
  261. :current-page="currentPage"
  262. :page-size="pageSize"
  263. :page-sizes="[10, 30, 50, 100]"
  264. @size-change="handleSizeChange"
  265. layout="total, sizes, prev, pager, next, jumper"
  266. :total="total"
  267. >
  268. </el-pagination>
  269. </div>
  270. <!-- 考试记录 -->
  271. <el-dialog
  272. title="学生考试记录"
  273. size="small"
  274. :visible.sync="stuExamDialog"
  275. v-loading="stuExamLoading"
  276. element-loading-text="拼命加载中"
  277. >
  278. <el-form
  279. :inline="true"
  280. :model="stuExamSearch"
  281. label-position="right"
  282. label-width="100px"
  283. >
  284. <el-form-item label="考试" class="pull-left">
  285. <el-select
  286. class="input"
  287. :remote-method="queryExams4Search"
  288. remote
  289. :loading="queryExams4SearchLoading"
  290. filterable
  291. clearable
  292. v-model="stuExamSearch.examId"
  293. placeholder="请选择"
  294. >
  295. <el-option
  296. v-for="item in examList4Search"
  297. :label="item.name"
  298. :value="item.id"
  299. :key="item.id"
  300. >
  301. </el-option>
  302. </el-select>
  303. </el-form-item>
  304. <el-form-item class="pull-left">
  305. <el-button
  306. size="small"
  307. type="primary"
  308. icon="el-icon-search"
  309. @click="searchStuExam"
  310. >查询
  311. </el-button>
  312. </el-form-item>
  313. </el-form>
  314. <el-table
  315. :data="stuExamList"
  316. border
  317. style="width: 100%;text-align:center;"
  318. >
  319. <el-table-column inline-template label="学生姓名">
  320. <div>
  321. <span>{{ row.studentName }}</span>
  322. </div>
  323. </el-table-column>
  324. <el-table-column inline-template label="学号">
  325. <div>
  326. <span>{{ row.studentCode }}</span>
  327. </div>
  328. </el-table-column>
  329. <el-table-column inline-template label="身份证">
  330. <div>
  331. <span>{{ row.identityNumber }}</span>
  332. </div>
  333. </el-table-column>
  334. <el-table-column inline-template label="考试">
  335. <div>
  336. <span>{{ row.examName }}</span>
  337. </div>
  338. </el-table-column>
  339. <el-table-column inline-template label="课程">
  340. <div>
  341. <span>{{ row.courseName }}</span>
  342. </div>
  343. </el-table-column>
  344. <el-table-column inline-template width="100" label="考试状态">
  345. <div>
  346. <span v-if="null == row.started"></span>
  347. <span v-else-if="row.started">已考</span>
  348. <span v-else>未考</span>
  349. </div>
  350. </el-table-column>
  351. </el-table>
  352. <div class="page pull-right">
  353. <el-pagination
  354. @current-change="stuExamCurChange"
  355. :current-page="stuExamCurPage"
  356. :page-size="stuExamPageSize"
  357. layout="total, prev, pager, next, jumper"
  358. :total="stuExamTotal"
  359. >
  360. </el-pagination>
  361. </div>
  362. </el-dialog>
  363. <!-- 导入弹窗 -->
  364. <el-dialog
  365. title="学生照片导入页"
  366. size="tiny"
  367. :visible.sync="photoUploadDialog"
  368. >
  369. <el-form>
  370. <el-row>
  371. <el-form-item style="margin-left:30px">
  372. <el-upload
  373. class="form_left"
  374. ref="upload"
  375. list-type="picture"
  376. :action="uploadAction"
  377. :headers="uploadHeaders"
  378. :data="uploadData"
  379. :before-upload="beforeUpload"
  380. :on-progress="uploadProgress"
  381. :on-success="uploadSuccess"
  382. :on-error="uploadError"
  383. :file-list="fileList"
  384. :auto-upload="false"
  385. :multiple="false"
  386. >
  387. <el-button size="small" slot="trigger" type="primary"
  388. >选择文件
  389. </el-button>
  390. <el-button
  391. size="small"
  392. style="margin-left:10px;"
  393. type="success"
  394. @click="submitUpload"
  395. >确认上传
  396. </el-button>
  397. <div slot="tip" class="el-upload__tip">
  398. 只能上传jpg,png文件
  399. </div>
  400. </el-upload>
  401. </el-form-item>
  402. </el-row>
  403. </el-form>
  404. </el-dialog>
  405. <el-dialog
  406. title="照片"
  407. :visible.sync="photoDialog"
  408. width="300px"
  409. :center="true"
  410. >
  411. <img :src="photo.url" alt="学生照片" height="100%" width="100%" />
  412. </el-dialog>
  413. </div>
  414. </div>
  415. </section>
  416. </template>
  417. <script>
  418. import {
  419. CORE_API,
  420. EXAM_WORK_API,
  421. EXCHANGE_API
  422. } from "@/constants/constants.js";
  423. import { mapState } from "vuex";
  424. export default {
  425. data() {
  426. return {
  427. rolePrivileges: {
  428. search_student: false,
  429. upload_student_photo: false,
  430. reset_student_password: false,
  431. change_student_availability: false,
  432. unbind_student_code: false,
  433. unbind_security_phone: false
  434. },
  435. isSuperAdmin: false,
  436. rootOrgList: null,
  437. stuExamLoading: false,
  438. button: {},
  439. formSearch: {
  440. rootOrgId: null,
  441. name: "",
  442. studentCode: "",
  443. identityNumber: "",
  444. enable: "",
  445. hasPhoto: "ALL"
  446. },
  447. selectedStuIds: [],
  448. statusList: [
  449. {
  450. value: true,
  451. label: "启用"
  452. },
  453. {
  454. value: false,
  455. label: "禁用"
  456. }
  457. ],
  458. tableData: [],
  459. currentPage: 1,
  460. pageSize: 10,
  461. total: 10,
  462. photoDialog: false,
  463. photo: { url: "" },
  464. errMessages: [],
  465. uploadAction: EXCHANGE_API + "/facepp/add",
  466. uploadData: {},
  467. fileLoading: false,
  468. fileList: [],
  469. uploadHeaders: {},
  470. photoUploadDialog: false,
  471. stuExamCurPage: 1,
  472. stuExamPageSize: 10,
  473. stuExamTotal: 10,
  474. stuExamDialog: false,
  475. stuExamList: [],
  476. examList4Search: [],
  477. queryExams4SearchLoading: false,
  478. stuExamSearch: {
  479. rootOrgId: "",
  480. examId: "",
  481. studentCode: "",
  482. studentName: "",
  483. orgId: "",
  484. specialtyName: "",
  485. courseCode: "",
  486. courseName: "",
  487. infoCollector: "",
  488. identityNumber: "",
  489. identityNumberLike: false,
  490. withStarted: true
  491. }
  492. };
  493. },
  494. computed: {
  495. ...mapState({ user: state => state.user }),
  496. stuIds() {
  497. var stuIds = "";
  498. for (let stuId of this.selectedStuIds) {
  499. if (!stuIds) {
  500. stuIds += stuId;
  501. } else {
  502. stuIds += "," + stuId;
  503. }
  504. }
  505. return stuIds;
  506. },
  507. noBatchSelected() {
  508. return this.selectedStuIds.length === 0;
  509. }
  510. },
  511. methods: {
  512. queryExams4Search(name) {
  513. this.queryExams(name, "search");
  514. },
  515. queryExams(name, where) {
  516. console.log("queryExams; name: " + name);
  517. if ("search" == where) {
  518. this.queryExams4SearchLoading = true;
  519. }
  520. this.$http
  521. .get(EXAM_WORK_API + "/exam/queryByNameLike?name=" + name)
  522. .then(response => {
  523. if ("search" == where) {
  524. this.queryExams4SearchLoading = false;
  525. this.examList4Search = response.body;
  526. }
  527. })
  528. .catch(response => {
  529. if (response.status == 500) {
  530. this.$notify({
  531. showClose: true,
  532. message: response.body.desc,
  533. type: "error"
  534. });
  535. }
  536. if ("search" == where) {
  537. this.queryExams4SearchLoading = false;
  538. }
  539. });
  540. },
  541. closeStuExamDialog() {
  542. this.stuExamDialog = false;
  543. },
  544. showStuExamDialog(row) {
  545. this.stuExamSearch.identityNumber = row.identityNumber;
  546. this.stuExamList = [];
  547. this.stuExamTotal = 0;
  548. this.searchStuExam();
  549. this.stuExamDialog = true;
  550. },
  551. searchStuExam() {
  552. var param = new URLSearchParams(this.stuExamSearch);
  553. this.stuExamLoading = true;
  554. var url =
  555. EXAM_WORK_API +
  556. "/exam_student/examStudentPage/" +
  557. (this.stuExamCurPage - 1) +
  558. "/" +
  559. this.stuExamPageSize +
  560. "?" +
  561. param;
  562. this.$http
  563. .get(url)
  564. .then(response => {
  565. this.stuExamList = response.data.list;
  566. this.stuExamTotal = response.data.total;
  567. this.stuExamLoading = false;
  568. })
  569. .catch(function(response) {
  570. if (response.status == 500) {
  571. this.$notify({
  572. showClose: true,
  573. message: response.body.desc,
  574. type: "error"
  575. });
  576. }
  577. this.stuExamLoading = false;
  578. });
  579. },
  580. stuExamCurChange(val) {
  581. this.stuExamCurPage = val;
  582. this.stuExamSearch.page = val - 1;
  583. this.searchStuExam();
  584. },
  585. getStatus(status) {
  586. if (status == true) {
  587. return "启用";
  588. } else if (status == false) {
  589. return "禁用";
  590. }
  591. return status;
  592. },
  593. showPhoto(row) {
  594. if (row.photoPath) {
  595. this.photo.url = row.photoPath;
  596. this.photoDialog = true;
  597. } else {
  598. this.$notify({
  599. showClose: true,
  600. message: "未上传照片",
  601. type: "error"
  602. });
  603. }
  604. },
  605. uploadPhoto() {
  606. this.photoUploadDialog = true;
  607. this.initUpload();
  608. },
  609. selectChange(row) {
  610. this.selectedStuIds = [];
  611. row.forEach((element, index) => {
  612. console.log(index);
  613. this.selectedStuIds.push(element.id);
  614. });
  615. console.log(this.selectedStuIds);
  616. },
  617. handleCurrentChange(val) {
  618. this.currentPage = val;
  619. this.searchForm();
  620. },
  621. handleSizeChange(val) {
  622. this.pageSize = val;
  623. this.searchForm();
  624. },
  625. resetSearchForm() {
  626. this.formSearch.name = "";
  627. this.formSearch.studentCode = "";
  628. this.formSearch.identityNumber = "";
  629. this.formSearch.enable = "";
  630. this.formSearch.hasPhoto = "ALL";
  631. },
  632. //查询方法
  633. searchForm() {
  634. var param = new URLSearchParams(this.formSearch);
  635. var url =
  636. CORE_API +
  637. "/student/studentPage/" +
  638. (this.currentPage - 1) +
  639. "/" +
  640. this.pageSize +
  641. "?" +
  642. param;
  643. this.$http
  644. .get(url)
  645. .then(response => {
  646. this.tableData = response.data.list;
  647. this.total = response.data.total;
  648. })
  649. .catch(function(response) {
  650. if (response.status == 500) {
  651. this.$notify({
  652. showClose: true,
  653. message: response.body.desc,
  654. type: "error"
  655. });
  656. }
  657. });
  658. },
  659. exportStudent() {
  660. var param = new URLSearchParams(this.formSearch);
  661. window.open(
  662. CORE_API +
  663. "/student/export?$key=" +
  664. this.user.key +
  665. "&$token=" +
  666. this.user.token +
  667. "&" +
  668. param
  669. );
  670. },
  671. checkIds(row) {
  672. if (row) {
  673. return row.id;
  674. } else {
  675. if (this.stuIds.length == 0) {
  676. this.$notify({
  677. type: "warning",
  678. message: "请选择学生"
  679. });
  680. return "";
  681. } else {
  682. return this.stuIds;
  683. }
  684. }
  685. },
  686. unbindStudentCode(row) {
  687. var stuIds = this.checkIds(row);
  688. if (!stuIds) return;
  689. this.$confirm("是否解绑学号?", "提示", {
  690. confirmButtonText: "确定",
  691. cancelButtonText: "取消",
  692. type: "warning"
  693. }).then(() => {
  694. var url = CORE_API + "/student/unbindStudentCode/" + stuIds;
  695. this.$http.put(url).then(response => {
  696. console.log(response);
  697. this.$notify({
  698. type: "success",
  699. message: "解绑成功"
  700. });
  701. this.searchForm();
  702. });
  703. });
  704. },
  705. unbindSecurityPhone(row) {
  706. var stuIds = this.checkIds(row);
  707. if (!stuIds) return;
  708. this.$confirm("是否解绑安全手机号?", "提示", {
  709. confirmButtonText: "确定",
  710. cancelButtonText: "取消",
  711. type: "warning"
  712. }).then(() => {
  713. var url = CORE_API + "/student/unbindSecurityPhone/" + stuIds;
  714. this.$http.put(url).then(response => {
  715. console.log(response);
  716. this.$notify({
  717. type: "success",
  718. message: "解绑成功"
  719. });
  720. this.searchForm();
  721. });
  722. });
  723. },
  724. //重置密码方法
  725. resetPassword(row) {
  726. var stuIds = this.checkIds(row);
  727. if (!stuIds) return;
  728. this.$confirm("是否重置所选学生的密码?", "提示", {
  729. confirmButtonText: "确定",
  730. cancelButtonText: "取消",
  731. type: "warning"
  732. }).then(() => {
  733. var url = CORE_API + "/student/resetPass/" + stuIds;
  734. this.$http.put(url).then(response => {
  735. console.log(response);
  736. this.$notify({
  737. type: "success",
  738. message: "重置密码成功"
  739. });
  740. this.searchForm();
  741. });
  742. });
  743. },
  744. //禁用
  745. disableStudent(row) {
  746. var stuIds = this.checkIds(row);
  747. if (!stuIds) return;
  748. this.$confirm("是否禁用所选学生?", "提示", {
  749. confirmButtonText: "确定",
  750. cancelButtonText: "取消",
  751. type: "warning"
  752. }).then(() => {
  753. var url = CORE_API + "/student/disable/" + stuIds;
  754. this.$http.put(url).then(response => {
  755. console.log(response);
  756. this.$notify({
  757. type: "success",
  758. message: "禁用成功"
  759. });
  760. this.searchForm();
  761. });
  762. });
  763. },
  764. //启用
  765. enableStudent(row) {
  766. var stuIds = this.checkIds(row);
  767. if (!stuIds) return;
  768. this.$confirm("是否启用所选学生?", "提示", {
  769. confirmButtonText: "确定",
  770. cancelButtonText: "取消",
  771. type: "warning"
  772. }).then(() => {
  773. var url = CORE_API + "/student/enable/" + stuIds;
  774. this.$http.put(url).then(response => {
  775. console.log(response);
  776. this.$notify({
  777. type: "success",
  778. message: "启用成功"
  779. });
  780. this.searchForm();
  781. });
  782. });
  783. },
  784. beforeUpload(file) {
  785. console.log(file);
  786. },
  787. uploadProgress(event, file, fileList) {
  788. console.log("uploadProgress");
  789. console.log(event);
  790. console.log(file);
  791. console.log(fileList);
  792. },
  793. uploadSuccess(response, file, fileList) {
  794. console.log(response);
  795. console.log(file);
  796. console.log(fileList);
  797. this.$notify({
  798. message: "上传成功",
  799. type: "success"
  800. });
  801. this.fileLoading = false;
  802. this.photoUploadDialog = false;
  803. this.searchForm();
  804. },
  805. uploadError(response, file, fileList) {
  806. console.log(response);
  807. console.log(file);
  808. console.log(fileList);
  809. var json = JSON.parse(response.message);
  810. if (response.status == 500) {
  811. this.$notify({
  812. message: json.desc,
  813. type: "error"
  814. });
  815. }
  816. this.fileLoading = false;
  817. },
  818. initUpload() {
  819. this.fileList = [];
  820. },
  821. checkUpload() {
  822. var fileList = this.$refs.upload.uploadFiles;
  823. if (fileList.length == 0) {
  824. this.$notify({
  825. message: "上传文件不能为空",
  826. type: "error"
  827. });
  828. return false;
  829. }
  830. if (fileList.length > 1) {
  831. this.$notify({
  832. message: "每次只能上传一个文件",
  833. type: "error"
  834. });
  835. return false;
  836. }
  837. for (let file of fileList) {
  838. let f = file.name.toLowerCase();
  839. if (!f.endsWith(".jpg") && !f.endsWith(".png")) {
  840. this.$notify({
  841. message: "上传文件必须为jpg或者png格式",
  842. type: "error"
  843. });
  844. this.initUpload();
  845. return false;
  846. }
  847. }
  848. return true;
  849. },
  850. //确定上传
  851. submitUpload() {
  852. if (!this.checkUpload()) {
  853. return false;
  854. }
  855. this.$refs.upload.submit();
  856. this.fileLoading = true;
  857. },
  858. //清空文件
  859. removeFile() {
  860. this.$refs.upload.clearFiles();
  861. },
  862. initPrivileges() {
  863. let params = new URLSearchParams({
  864. privilegeCodes: Object.keys(this.rolePrivileges).toString()
  865. });
  866. let url = CORE_API + "/rolePrivilege/checkPrivileges?" + params;
  867. this.$http.post(url).then(response => {
  868. this.rolePrivileges = response.data;
  869. });
  870. },
  871. init() {
  872. this.initPrivileges();
  873. for (let role of this.user.roleList) {
  874. if (role.roleCode == "SUPER_ADMIN") {
  875. this.isSuperAdmin = true;
  876. break;
  877. }
  878. }
  879. var url = CORE_API + "/org/getRootOrgList";
  880. this.$http.get(url).then(response => {
  881. this.rootOrgList = response.data;
  882. this.formSearch.rootOrgId = this.user.rootOrgId;
  883. this.searchForm();
  884. });
  885. }
  886. },
  887. created() {
  888. this.init();
  889. this.uploadHeaders = {
  890. key: this.user.key,
  891. token: this.user.token
  892. };
  893. }
  894. };
  895. </script>
  896. <style scoped>
  897. .input {
  898. width: 200px;
  899. }
  900. </style>