student.vue 29 KB

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