student.vue 27 KB

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