student.vue 27 KB

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