student.vue 27 KB

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