student.vue 26 KB

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