ExportStructure.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803
  1. <template>
  2. <section class="content">
  3. <!-- 正文信息 -->
  4. <div class="box-body">
  5. <el-form
  6. :inline="true"
  7. :model="formSearch"
  8. label-position="right"
  9. label-width="70px"
  10. >
  11. <el-row>
  12. <el-col :span="6">
  13. <el-form-item label="考试类型">
  14. <el-select
  15. class="search_width"
  16. v-model="formSearch.examType"
  17. filterable
  18. clearable
  19. placeholder="请选择"
  20. size="small"
  21. @change="searchExams"
  22. >
  23. <el-option
  24. v-for="item in EXAM_TYPES"
  25. :label="item.label"
  26. :value="item.value"
  27. :key="item.value"
  28. >
  29. </el-option>
  30. </el-select>
  31. </el-form-item>
  32. </el-col>
  33. <el-col :span="6">
  34. <el-form-item label="考试名称">
  35. <el-select
  36. class="search_width"
  37. v-model="formSearch.examId"
  38. filterable
  39. :remote-method="getExams"
  40. remote
  41. clearable
  42. placeholder="请选择"
  43. size="small"
  44. >
  45. <el-option
  46. v-for="item in examList"
  47. :key="item.id"
  48. :label="item.name"
  49. :value="item.id"
  50. >
  51. </el-option>
  52. </el-select>
  53. </el-form-item>
  54. </el-col>
  55. <el-col :span="6">
  56. <el-form-item label="导出类型">
  57. <el-select
  58. class="search_width"
  59. v-model="formSearch.exportType"
  60. filterable
  61. clearable
  62. placeholder="请选择"
  63. size="small"
  64. >
  65. <el-option
  66. v-for="item in EXPORT_TYPES"
  67. :key="item.value"
  68. :label="item.label"
  69. :value="item.value"
  70. >
  71. </el-option>
  72. </el-select>
  73. </el-form-item>
  74. </el-col>
  75. <el-col :span="6">
  76. <div class="search_down">
  77. <el-button size="small" type="primary" @click="searchFrom"
  78. ><i class="el-icon-search"></i> 查询</el-button
  79. >
  80. <el-button size="small" @click="resetForm"
  81. ><i class="el-icon-refresh"></i> 重 置</el-button
  82. >
  83. <el-button size="small" type="primary" @click="add"
  84. ><i class="el-icon-plus"></i> 新增</el-button
  85. >
  86. </div>
  87. </el-col>
  88. </el-row>
  89. </el-form>
  90. <div
  91. style="width: 100%; border-bottom: 1px solid #ddd; margin: 10px 0;"
  92. ></div>
  93. <!-- 页面列表 -->
  94. <el-table border :data="tableData">
  95. <el-table-column label="考试类型">
  96. <template slot-scope="scope">
  97. <span>{{ scope.row.examType | examTypesFilter }}</span>
  98. </template>
  99. </el-table-column>
  100. <el-table-column label="考试名称">
  101. <template slot-scope="scope">
  102. <span>{{ scope.row.examName }}</span>
  103. </template>
  104. </el-table-column>
  105. <el-table-column label="导出类型">
  106. <template slot-scope="scope">
  107. <span>{{ scope.row.exportType | exportTypesFilter }}</span>
  108. </template>
  109. </el-table-column>
  110. <el-table-column label="题数">
  111. <template slot-scope="scope">
  112. <div
  113. v-show="scope.row.exportType == 'NORMAL'"
  114. v-for="(item, index) in scope.row.questionTypeNums"
  115. :key="index"
  116. >
  117. <span>{{ item.questionType | questionType }}</span>
  118. <span>{{ item.quantity }}</span>
  119. </div>
  120. </template>
  121. </el-table-column>
  122. <el-table-column label="操作" width="175">
  123. <template slot-scope="scope">
  124. <div class="operate_left">
  125. <el-button
  126. size="mini"
  127. type="primary"
  128. @click="copy(scope.row)"
  129. plain
  130. ><i class="el-icon-edit"></i>复用</el-button
  131. >
  132. <el-button size="mini" type="danger" @click="del(scope.row)"
  133. ><i class="el-icon-delete"></i> 删除</el-button
  134. >
  135. </div>
  136. </template>
  137. </el-table-column>
  138. </el-table>
  139. <div class="page pull-right">
  140. <el-pagination
  141. @current-change="handleCurrentChange"
  142. :current-page="currentPage"
  143. :page-size="pageSize"
  144. :page-sizes="[10, 20, 50, 100, 200, 300]"
  145. @size-change="handleSizeChange"
  146. layout="total, sizes, prev, pager, next, jumper"
  147. :total="total"
  148. >
  149. </el-pagination>
  150. </div>
  151. </div>
  152. <!-- 复用窗口 -->
  153. <el-dialog
  154. title="试卷结构复用"
  155. :visible.sync="dialogCopyModel"
  156. width="500px"
  157. >
  158. <el-form
  159. :model="exportStructureCopy"
  160. label-position="right"
  161. label-width="120px"
  162. >
  163. <el-tabs> <el-tab-pane label="原结构信息"></el-tab-pane> </el-tabs>
  164. <el-form-item label="考试类型">
  165. <el-select
  166. v-model="exportStructureCopy.examTypeOld"
  167. placeholder="请选择"
  168. disabled
  169. >
  170. <el-option
  171. v-for="item in EXAM_TYPES"
  172. :key="item.value"
  173. :label="item.label"
  174. :value="item.value"
  175. ></el-option>
  176. </el-select>
  177. </el-form-item>
  178. <el-form-item label="考试名称">
  179. <el-select
  180. v-model="exportStructureCopy.examIdOld"
  181. placeholder="请选择"
  182. disabled
  183. >
  184. <el-option
  185. v-for="item in examList"
  186. :key="item.id"
  187. :label="item.name"
  188. :value="item.id"
  189. ></el-option>
  190. </el-select>
  191. </el-form-item>
  192. <el-form-item label="导出类型">
  193. <el-select
  194. v-model="exportStructureCopy.exportTypeOld"
  195. placeholder="请选择"
  196. disabled
  197. >
  198. <el-option
  199. v-for="item in EXPORT_TYPES"
  200. :key="item.value"
  201. :label="item.label"
  202. :value="item.value"
  203. ></el-option>
  204. </el-select>
  205. </el-form-item>
  206. <el-tabs> <el-tab-pane label="新结构信息"></el-tab-pane> </el-tabs>
  207. <el-form-item label="考试类型">
  208. <el-select
  209. v-model="exportStructureCopy.examType"
  210. placeholder="请选择"
  211. @change="searchExamId"
  212. >
  213. <el-option
  214. v-for="item in EXAM_TYPES"
  215. :key="item.value"
  216. :label="item.label"
  217. :value="item.value"
  218. ></el-option>
  219. </el-select>
  220. <span
  221. class="error_message error_other"
  222. v-if="check_value(exportStructureCopy.examType)"
  223. >请选择考试类型</span
  224. >
  225. </el-form-item>
  226. <el-form-item label="考试名称">
  227. <el-select v-model="exportStructureCopy.examId" placeholder="请选择">
  228. <el-option
  229. v-for="item in examListNew"
  230. :key="item.id"
  231. :label="item.name"
  232. :value="item.id"
  233. ></el-option>
  234. </el-select>
  235. <span
  236. class="error_message error_other"
  237. v-if="check_value(exportStructureCopy.examId)"
  238. >请选择考试名称</span
  239. >
  240. </el-form-item>
  241. <el-row class="margin_top_10 margin_left_120">
  242. <el-button type="primary" @click="saveCopy">保 存</el-button>
  243. <!-- <el-button @click="resetForm3"
  244. ><i class="el-icon-refresh"></i> 重 置</el-button
  245. > -->
  246. <el-button @click="cancleCopy" type="primary"
  247. ><i class="el-icon-arrow-left"></i> 返 回</el-button
  248. >
  249. </el-row>
  250. </el-form>
  251. </el-dialog>
  252. <!-- 新增窗口 -->
  253. <el-dialog title="新增导出结构" :visible.sync="dialogModel" width="500px">
  254. <el-form
  255. :model="exportStructure"
  256. label-position="right"
  257. label-width="78px"
  258. :inline="true"
  259. >
  260. <el-row>
  261. <div style=" color: #f56c6c; margin-bottom: -30px;">*</div>
  262. <el-form-item label="考试类型">
  263. <el-select
  264. v-model="exportStructure.examType"
  265. placeholder="请选择"
  266. @change="searchExportStructure('examType')"
  267. >
  268. <el-option
  269. v-for="item in EXAM_TYPES"
  270. :key="item.value"
  271. :label="item.label"
  272. :value="item.value"
  273. ></el-option>
  274. </el-select>
  275. <span
  276. class="error_message error_other"
  277. v-if="check_value(exportStructure.examType)"
  278. >请选择考试类型</span
  279. >
  280. </el-form-item>
  281. </el-row>
  282. <el-row>
  283. <div style=" color: #f56c6c; margin-bottom: -30px;margin-top: 8px;">
  284. *
  285. </div>
  286. <el-form-item label="考试名称">
  287. <el-select
  288. v-model="exportStructure.examId"
  289. filterable
  290. placeholder="请选择"
  291. @change="searchExportStructure('examId')"
  292. >
  293. <el-option
  294. v-for="item in examListByExamType"
  295. :key="item.id"
  296. :label="item.name"
  297. :value="item.id"
  298. ></el-option>
  299. </el-select>
  300. <span
  301. class="error_message error_other"
  302. v-if="check_value(exportStructure.examId)"
  303. >请选择考试名称</span
  304. >
  305. </el-form-item>
  306. </el-row>
  307. <el-row>
  308. <div style=" color: #f56c6c; margin-bottom: -30px;margin-top: 8px;">
  309. *
  310. </div>
  311. <el-form-item label="导出类型">
  312. <el-select
  313. v-model="exportStructure.exportType"
  314. placeholder="请选择"
  315. :disabled="button"
  316. >
  317. <el-option
  318. v-for="item in EXPORT_TYPES"
  319. :key="item.value"
  320. :label="item.label"
  321. :value="item.value"
  322. ></el-option>
  323. </el-select>
  324. <span
  325. class="error_message error_other"
  326. v-if="check_value(exportStructure.exportType)"
  327. >请选择导出类型</span
  328. >
  329. </el-form-item>
  330. </el-row>
  331. <!-- 判断机考还是传统 -->
  332. <div v-if="exportStructure.exportType == 'NORMAL'">
  333. <div
  334. v-for="(item, index) in exportStructure.questionTypeNums"
  335. :key="index"
  336. >
  337. <el-row>
  338. <div
  339. style=" color: #f56c6c; margin-bottom: -30px;margin-left: 26px;margin-top: 8px;"
  340. >
  341. *
  342. </div>
  343. <el-form-item
  344. :label="item.questionType | questionType"
  345. label-width="78px"
  346. >
  347. <el-input
  348. v-model="item.quantity"
  349. style="width: 220px"
  350. :disabled="button"
  351. ></el-input>
  352. <span
  353. class="error_message error_other"
  354. v-if="check(item.quantity)"
  355. >
  356. 请输入正整数或0
  357. </span>
  358. </el-form-item>
  359. </el-row>
  360. </div>
  361. </div>
  362. <el-row class="margin_top_10 margin_left_120">
  363. <el-button type="primary" @click="save" :disabled="button"
  364. >保 存</el-button
  365. >
  366. <!-- <el-button @click="resetForm2"
  367. ><i class="el-icon-refresh"></i> 重 置</el-button
  368. > -->
  369. <el-button @click="cancel" type="primary"
  370. ><i class="el-icon-arrow-left"></i> 返 回</el-button
  371. >
  372. </el-row>
  373. </el-form>
  374. </el-dialog>
  375. </section>
  376. </template>
  377. <script>
  378. import { QUESTION_API, EXAM_WORK_API } from "@/constants/constants";
  379. import { EXAM_TYPES, EXPORT_TYPES } from "../constants/constants";
  380. import { mapState } from "vuex";
  381. import _ from "lodash";
  382. export default {
  383. data() {
  384. return {
  385. isShow: false,
  386. loading: false,
  387. dialogModel: false,
  388. dialogCopyModel: false,
  389. formSearch: {
  390. examType: null,
  391. examId: null,
  392. exportType: null
  393. },
  394. exportStructure: {
  395. examType: "",
  396. examId: "",
  397. examName: "",
  398. exportType: "",
  399. useable: "1", //默认启用
  400. questionTypeNums: [
  401. {
  402. questionType: "SINGLE_ANSWER_QUESTION",
  403. quantity: ""
  404. },
  405. {
  406. questionType: "MULTIPLE_ANSWER_QUESTION",
  407. quantity: ""
  408. },
  409. {
  410. questionType: "BOOL_ANSWER_QUESTION",
  411. quantity: ""
  412. }
  413. ]
  414. },
  415. exportStructureCopy: {
  416. examTypeOld: "",
  417. examIdOld: "",
  418. exportTypeOld: "",
  419. examType: "",
  420. examId: "",
  421. useable: "1",
  422. questionTypeNums: [
  423. {
  424. questionType: "SINGLE_ANSWER_QUESTION",
  425. quantity: ""
  426. },
  427. {
  428. questionType: "MULTIPLE_ANSWER_QUESTION",
  429. quantity: ""
  430. },
  431. {
  432. questionType: "BOOL_ANSWER_QUESTION",
  433. quantity: ""
  434. }
  435. ]
  436. },
  437. EXAM_TYPES: EXAM_TYPES,
  438. EXPORT_TYPES: EXPORT_TYPES,
  439. examList: [],
  440. examListByExamType: [],
  441. tableData: [],
  442. pageSize: 10,
  443. currentPage: 1,
  444. total: 10,
  445. button: false,
  446. examListNew: [],
  447. disMessage: false,
  448. reShow: false
  449. };
  450. },
  451. methods: {
  452. resetForm() {
  453. this.formSearch = {
  454. examType: null,
  455. examId: null,
  456. exportType: null
  457. };
  458. },
  459. searchFrom() {
  460. this.currentPage = 1;
  461. this.search();
  462. },
  463. search() {
  464. if (this.formSearch.examType === "") {
  465. this.formSearch.examType = null;
  466. }
  467. this.tableData = [];
  468. this.loading = true;
  469. var url =
  470. QUESTION_API +
  471. "/findPageByExportStructure/" +
  472. this.currentPage +
  473. "/" +
  474. this.pageSize;
  475. this.$http.post(url, this.formSearch).then(response => {
  476. this.tableData = response.data.content;
  477. this.total = response.data.totalElements;
  478. this.loading = false;
  479. });
  480. },
  481. //新增考试结构
  482. add() {
  483. this.dialogModel = true;
  484. this.button = false;
  485. this.isShow = false;
  486. this.exportStructure = {
  487. examType: "",
  488. examId: "",
  489. examName: "",
  490. exportType: "",
  491. useable: "1", //默认启用
  492. questionTypeNums: [
  493. {
  494. questionType: "SINGLE_ANSWER_QUESTION",
  495. quantity: ""
  496. },
  497. {
  498. questionType: "MULTIPLE_ANSWER_QUESTION",
  499. quantity: ""
  500. },
  501. {
  502. questionType: "BOOL_ANSWER_QUESTION",
  503. quantity: ""
  504. }
  505. ]
  506. };
  507. },
  508. handleCurrentChange(val) {
  509. this.currentPage = val;
  510. this.search();
  511. },
  512. handleSizeChange(val) {
  513. this.pageSize = val;
  514. this.currentPage = 1;
  515. this.search();
  516. },
  517. closeQuesDialog() {
  518. this.dialogModel = false;
  519. },
  520. //表单验证
  521. check(value) {
  522. if (this.disMessage) {
  523. return false;
  524. }
  525. if (this.reShow) {
  526. return false;
  527. }
  528. var r = /^\+?[1-9][0-9]*$/;
  529. if ((r.test(value) || value === "0") && this.isShow) {
  530. return false;
  531. }
  532. return true;
  533. },
  534. check_value(value) {
  535. if (!value && this.isShow) {
  536. return true;
  537. }
  538. return false;
  539. },
  540. save() {
  541. this.reShow = false;
  542. this.isShow = true;
  543. if (this.check_value(this.exportStructure.examType)) {
  544. return false;
  545. }
  546. if (this.check_value(this.exportStructure.examId)) {
  547. return false;
  548. }
  549. if (this.check_value(this.exportStructure.exportType)) {
  550. return false;
  551. }
  552. if (this.exportStructure.exportType == "NORMAL") {
  553. for (var i = 0; i < this.exportStructure.questionTypeNums.length; i++) {
  554. if (this.check(this.exportStructure.questionTypeNums[i].quantity)) {
  555. return false;
  556. }
  557. }
  558. }
  559. let examId = this.exportStructure.examId;
  560. this.exportStructure.examName = _.filter(this.examList, function(item) {
  561. return item.id == examId;
  562. })[0].name;
  563. this.$http
  564. .post(QUESTION_API + "/saveExportStructure", this.exportStructure)
  565. .then(() => {
  566. this.$notify({
  567. title: "提示",
  568. message: "保存成功",
  569. type: "success"
  570. });
  571. this.closeQuesDialog();
  572. this.search();
  573. });
  574. },
  575. //重置2
  576. resetForm2() {
  577. this.exportStructure = {
  578. examType: "",
  579. examId: "",
  580. examName: "",
  581. exportType: "",
  582. useable: "1", //默认启用
  583. questionTypeNums: [
  584. {
  585. questionType: "SINGLE_ANSWER_QUESTION",
  586. quantity: ""
  587. },
  588. {
  589. questionType: "MULTIPLE_ANSWER_QUESTION",
  590. quantity: ""
  591. },
  592. {
  593. questionType: "BOOL_ANSWER_QUESTION",
  594. quantity: ""
  595. }
  596. ]
  597. };
  598. this.isShow = false;
  599. this.button = false;
  600. },
  601. //取消
  602. cancel() {
  603. this.isShow = false;
  604. this.button = false;
  605. this.dialogModel = false;
  606. },
  607. //取消复用
  608. cancleCopy() {
  609. this.isShow = false;
  610. this.dialogCopyModel = false;
  611. },
  612. //重置3
  613. resetForm3() {
  614. this.exportStructureCopy.examType = "";
  615. this.exportStructureCopy.examId = "";
  616. this.isShow = false;
  617. },
  618. //复用
  619. copy(row) {
  620. this.dialogCopyModel = true;
  621. this.exportStructureCopy.examTypeOld = row.examType;
  622. this.exportStructureCopy.examIdOld = parseInt(row.examId);
  623. this.exportStructureCopy.exportTypeOld = row.exportType;
  624. this.exportStructureCopy.questionTypeNums = row.questionTypeNums;
  625. this.exportStructureCopy.examType = "";
  626. this.exportStructureCopy.examId = "";
  627. },
  628. //新增的时候,先查询
  629. searchExportStructure(type) {
  630. this.disMessage = false;
  631. if (type == "examType") {
  632. this.$http
  633. .get(
  634. EXAM_WORK_API +
  635. "/exam/queryByNameLike?enable=true&name=&examTypes=" +
  636. this.exportStructure.examType
  637. )
  638. .then(response => {
  639. this.examListByExamType = response.data;
  640. this.exportStructure.examId = "";
  641. this.resetExportStructure();
  642. });
  643. }
  644. if (this.exportStructure.examType && this.exportStructure.examId) {
  645. var url =
  646. QUESTION_API + "/findExportStructure/" + this.exportStructure.examId;
  647. this.$http
  648. .get(url)
  649. .then(response => {
  650. console.log(response);
  651. if (!response.data.id) {
  652. //如果没有数据
  653. this.resetExportStructure();
  654. } else {
  655. this.button = true;
  656. this.exportStructure.exportType = response.data.exportType;
  657. this.exportStructure.useable = response.data.useable
  658. ? response.data.useable.toString()
  659. : "1";
  660. for (
  661. var i = 0;
  662. i < this.exportStructure.questionTypeNums.length;
  663. i++
  664. ) {
  665. this.exportStructure.questionTypeNums[i].quantity =
  666. response.data.questionTypeNums[i].quantity;
  667. }
  668. this.disMessage = true;
  669. console.log("非空对象");
  670. }
  671. })
  672. .catch(() => {});
  673. }
  674. },
  675. resetExportStructure() {
  676. this.button = false;
  677. this.reShow = true;
  678. this.exportStructure.exportType = "";
  679. this.exportStructure.useable = "1";
  680. for (var i = 0; i < this.exportStructure.questionTypeNums.length; i++) {
  681. this.exportStructure.questionTypeNums[i].quantity = "";
  682. }
  683. },
  684. //点击复用,选择
  685. searchExamId() {
  686. if (this.exportStructureCopy.examType) {
  687. this.$http
  688. .get(
  689. EXAM_WORK_API +
  690. "/exam/queryByNameLike?enable=true&name=&examTypes=" +
  691. this.exportStructureCopy.examType
  692. )
  693. .then(response => {
  694. let examListFilter = response.data;
  695. var url =
  696. QUESTION_API +
  697. "/findExportStructureByExamType/" +
  698. this.exportStructureCopy.examType;
  699. this.$http.get(url).then(response => {
  700. let examListOld = response.data;
  701. //两个数组相减
  702. this.examListNew = _.filter(examListFilter, function(exam) {
  703. return examListOld.indexOf(exam.id.toString()) == -1;
  704. });
  705. });
  706. });
  707. }
  708. },
  709. //保存复用
  710. saveCopy() {
  711. this.isShow = true;
  712. if (this.check_value(this.exportStructureCopy.examType) === true) {
  713. return false;
  714. }
  715. if (this.check_value(this.exportStructureCopy.examId) === true) {
  716. return false;
  717. }
  718. this.exportStructure.examType = this.exportStructureCopy.examType;
  719. this.exportStructure.examId = this.exportStructureCopy.examId;
  720. this.exportStructure.exportType = this.exportStructureCopy.exportTypeOld;
  721. this.exportStructure.useable = this.exportStructureCopy.useable;
  722. this.exportStructure.questionTypeNums = this.exportStructureCopy.questionTypeNums;
  723. let examId = this.exportStructure.examId;
  724. this.exportStructure.examName = _.filter(this.examListNew, function(
  725. item
  726. ) {
  727. return item.id == examId;
  728. })[0].name;
  729. this.$http
  730. .post(QUESTION_API + "/saveExportStructure", this.exportStructure)
  731. .then(() => {
  732. this.$notify({
  733. title: "提示",
  734. message: "保存成功",
  735. type: "success"
  736. });
  737. this.dialogCopyModel = false;
  738. this.search();
  739. });
  740. },
  741. //删除
  742. del(row) {
  743. this.$confirm("是否删除该条导出结构", "提示", {
  744. confirmButtonText: "确定",
  745. cancelButtonText: "取消",
  746. type: "warning"
  747. }).then(() => {
  748. this.loading = true;
  749. var url = QUESTION_API + "/deleteExportStructure/" + row.id;
  750. this.$http.delete(url).then(
  751. () => {
  752. this.$notify({
  753. type: "success",
  754. message: "删除成功!"
  755. });
  756. this.loading = false;
  757. this.search();
  758. },
  759. () => {
  760. this.$notify({
  761. type: "error",
  762. message: "删除失败!"
  763. });
  764. this.loading = false;
  765. }
  766. );
  767. });
  768. this.loading = false;
  769. },
  770. //查询考试
  771. getExams(query) {
  772. query = query.trim();
  773. var examType = this.formSearch.examType;
  774. if (this.formSearch.examType == null) {
  775. examType = "";
  776. }
  777. this.$http
  778. .get(
  779. EXAM_WORK_API +
  780. "/exam/queryByNameLike?enable=true&name=" +
  781. query +
  782. "&examTypes=" +
  783. examType
  784. )
  785. .then(response => {
  786. this.examList = response.data;
  787. });
  788. },
  789. searchExams() {
  790. this.formSearch.examId = null;
  791. this.getExams("");
  792. }
  793. },
  794. computed: {
  795. ...mapState({ user: state => state.user })
  796. },
  797. created() {
  798. this.getExams("");
  799. this.search();
  800. }
  801. };
  802. </script>
  803. <style scoped src="../styles/Common.css"></style>