student.vue 27 KB

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