index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428
  1. <template>
  2. <div id="testPaperManagement">
  3. <search-box-new
  4. ref="searchBox"
  5. :formData="formData"
  6. :formList="formList"
  7. @search="search"
  8. @init="init"
  9. />
  10. <table-list
  11. :tableSets="tableSet"
  12. :tableData="tableData"
  13. :navText="navText"
  14. @addClick="addClick"
  15. :loading="loading"
  16. @editInfo="editInfo"
  17. ref="tableList"
  18. rowKey="examId"
  19. >
  20. <template slot="customize">
  21. <el-button size="medium" @click="batchDel" type="warning"
  22. >批量删除</el-button
  23. >
  24. </template>
  25. <template slot="btn" slot-scope="props">
  26. <el-button type="text" @click="addClick(props.scope.row, 1)"
  27. >基本信息</el-button
  28. >
  29. <el-button type="text" @click="addClick(props.scope.row, 2)"
  30. >题目内容</el-button
  31. >
  32. <el-button type="text" @click="preview(props.scope.row.examId)"
  33. >预览</el-button
  34. >
  35. <el-button type="text" @click="del(props.scope.row)">删除</el-button>
  36. </template>
  37. </table-list>
  38. <pagination
  39. :total="total"
  40. :pageSize="formData.pageSize"
  41. :currentPage="formData.pageNum"
  42. @handleSizeChange="handleSizeChange"
  43. @handleCurrentChange="handleCurrentChange"
  44. />
  45. <test-paper-preview ref="testPaperPreview" />
  46. </div>
  47. </template>
  48. <script>
  49. import searchBoxNew from "@/components/searchBoxNew";
  50. import tableList from "@/components/tableList";
  51. import pagination from "@/components/pagination";
  52. import testPaperPreview from "@/components/testPaperPreview";
  53. import { paperBatchDel } from "@/api/resource/volumeManagement";
  54. export default {
  55. name: "TestPaperManagement",
  56. components: { tableList, pagination, searchBoxNew, testPaperPreview },
  57. data() {
  58. return {
  59. loading: false, //当前表单加载是否加载动画
  60. navText: {
  61. title: "试卷管理",
  62. index: 0,
  63. ch: "条",
  64. num: true,
  65. border: true,
  66. choice: true,
  67. changeWidth: "240px",
  68. addHide: false,
  69. openCheckMore: true,
  70. backFatherBtn: {
  71. status: false,
  72. title: "未定义",
  73. },
  74. },
  75. //搜索
  76. formList: [
  77. {
  78. prop: "educationTypeId",
  79. placeholder: "教育类型",
  80. scope: "educationType",
  81. },
  82. {
  83. prop: "businessId",
  84. placeholder: "业务层次",
  85. scope: "businessLevel",
  86. edu: "educationTypeId",
  87. },
  88. {
  89. prop: "subjectId",
  90. placeholder: "科目",
  91. scope: "sujectType",
  92. edu: "educationTypeId",
  93. },
  94. {
  95. prop: "publishStatus",
  96. placeholder: "发布状态",
  97. scope: "select",
  98. options: [
  99. {
  100. label: "发布",
  101. value: 1,
  102. },
  103. {
  104. label: "未发布",
  105. value: 0,
  106. },
  107. ],
  108. },
  109. {
  110. prop: "prefixName",
  111. placeholder: "请输入名称前缀",
  112. },
  113. {
  114. prop: "examName",
  115. placeholder: "请输入试卷名称",
  116. },
  117. ],
  118. formData: {
  119. status: "0,1",
  120. pageSize: 10,
  121. pageNum: 1,
  122. },
  123. // 表单
  124. tableSet: [
  125. {
  126. label: "试卷编码",
  127. prop: "code",
  128. hidden: false,
  129. },
  130. {
  131. label: "名称前缀",
  132. prop: "prefixName",
  133. hidden: false,
  134. },
  135. {
  136. label: "试卷名称",
  137. prop: "examName",
  138. hidden: true,
  139. scope: "editInfo",
  140. },
  141. {
  142. label: "试卷类型",
  143. prop: "paperName",
  144. hidden: true
  145. },
  146. {
  147. label: "适用业务层级",
  148. prop1: "educationName",
  149. prop2: "projectName",
  150. prop3: "businessName",
  151. prop4: "subjectName",
  152. hidden: false,
  153. scope: "eduTypes",
  154. },
  155. {
  156. label: "发布状态",
  157. prop: "publishStatus",
  158. hidden: true,
  159. scope: "fabStatus",
  160. },
  161. {
  162. label: "最后编辑时间",
  163. prop: "updateTime",
  164. hidden: true,
  165. scope: "aTimeList",
  166. },
  167. {
  168. label: "创建时间",
  169. prop: "createTime",
  170. hidden: true,
  171. scope: "aTimeList",
  172. },
  173. {
  174. label: "关联商品",
  175. prop: "goodsList",
  176. prop1: "goodsName",
  177. hidden: false,
  178. scope: "aboutChapter",
  179. int: 6,
  180. },
  181. ],
  182. tableData: [], //表单数据
  183. total: 0, //一共多少条
  184. };
  185. },
  186. mounted() {
  187. this.search();
  188. },
  189. activated() {
  190. this.search();
  191. },
  192. methods: {
  193. batchDel() {
  194. if (!this.$refs.tableList.allCheckData.length) {
  195. this.$message.warning("请勾选需要删除的试卷");
  196. return;
  197. }
  198. this.$confirm(
  199. `此操作将永久删除所勾选的${this.$refs.tableList.allCheckData.length}条试卷, 是否继续?`,
  200. "提示",
  201. {
  202. confirmButtonText: "确定",
  203. cancelButtonText: "取消",
  204. type: "warning",
  205. }
  206. )
  207. .then(() => {
  208. const ids = this.$refs.tableList.allCheckData.map(
  209. (item) => item.examId
  210. );
  211. paperBatchDel({
  212. status: -1,
  213. ids,
  214. }).then((res) => {
  215. this.$message.success("批量删除成功");
  216. this.$refs.tableList.clearMoreActive();
  217. this.search(1);
  218. });
  219. })
  220. .catch(() => {});
  221. },
  222. preview(id) {
  223. this.$refs.testPaperPreview.openBox(1, id);
  224. },
  225. editInfo(v) {
  226. this.addClick(v, 1);
  227. },
  228. search(int) {
  229. this.loading = true;
  230. if (int === 1) {
  231. this.formData.pageNum = 1;
  232. }
  233. if (int === 2) {
  234. this.formData = {
  235. status: "0,1",
  236. pageSize: 10,
  237. pageNum: 1,
  238. };
  239. }
  240. this.$api
  241. .inquirebankexamList(this.formData)
  242. .then((res) => {
  243. this.tableData = res.rows;
  244. this.total = res.total;
  245. this.navText.index = res.total;
  246. })
  247. .finally(() => {
  248. this.loading = false;
  249. });
  250. },
  251. init() {
  252. this.search(2);
  253. },
  254. del(v) {
  255. this.$api.gradecheckGoodsChange({ examId: v.examId }).then((res) => {
  256. if (res.data > 0) {
  257. this.$message.error("已有学员正在学习,无法删除");
  258. return;
  259. } else {
  260. this.$alert(
  261. "确定删除此内容?<br />内容删除后将无法恢复,请慎重考虑",
  262. "提示",
  263. {
  264. dangerouslyUseHTMLString: true,
  265. }
  266. )
  267. .then(() => {
  268. var data = {
  269. examId: v.examId,
  270. status: -1,
  271. };
  272. this.$api.editbankexam(data).then((res) => {
  273. this.$message.success("删除成功");
  274. this.search();
  275. });
  276. })
  277. .catch(() => {
  278. this.$message({
  279. type: "info",
  280. message: "已取消删除",
  281. });
  282. });
  283. }
  284. });
  285. },
  286. addClick(v, int) {
  287. if (v === undefined) {
  288. this.$router.push({
  289. path: "AddPaper",
  290. });
  291. return;
  292. }
  293. if (int === 1 || int === 2) {
  294. const jump = () => {
  295. this.$store.dispatch("changetestPaperPage", null);
  296. this.$router.push({
  297. path: "editPaper",
  298. query: {
  299. id: v.examId,
  300. code: v.code,
  301. name: int,
  302. },
  303. });
  304. };
  305. const statusPage = this.$store.state.tagsView.visitedViews.some(
  306. (item) => {
  307. return item.name == "EditPaper";
  308. }
  309. );
  310. if (statusPage) {
  311. this.$store
  312. .dispatch("tagsView/delCachedView", {
  313. name: "EditPaper",
  314. })
  315. .then((res) => {
  316. jump();
  317. });
  318. } else {
  319. jump();
  320. }
  321. return;
  322. }
  323. },
  324. handleSizeChange(v) {
  325. this.formData.pageSize = v;
  326. this.formData.pageNum = 1;
  327. this.search();
  328. },
  329. handleCurrentChange(v) {
  330. this.formData.pageNum = v;
  331. this.search();
  332. },
  333. },
  334. };
  335. </script>
  336. <style lang="less" scoped>
  337. /deep/.el-button {
  338. border-radius: 8px;
  339. }
  340. /deep/.el-dialog {
  341. border-radius: 8px;
  342. .el-dialog__header {
  343. padding: 0;
  344. .hearders {
  345. height: 40px;
  346. display: flex;
  347. align-items: center;
  348. justify-content: space-between;
  349. padding: 0px 18px 0px 20px;
  350. border-bottom: 1px solid #e2e2e2;
  351. .leftTitle {
  352. font-size: 14px;
  353. font-weight: bold;
  354. color: #2f4378;
  355. }
  356. .rightBoxs {
  357. display: flex;
  358. align-items: center;
  359. img {
  360. width: 14px;
  361. height: 14px;
  362. margin-left: 13px;
  363. cursor: pointer;
  364. }
  365. }
  366. }
  367. }
  368. .el-dialog__footer {
  369. padding: 0;
  370. .dialog-footer {
  371. padding: 0px 40px;
  372. height: 70px;
  373. border-top: 1px solid #e2e2e2;
  374. display: flex;
  375. align-items: center;
  376. justify-content: flex-end;
  377. }
  378. }
  379. }
  380. .imgBox {
  381. width: 100%;
  382. // height: 210px;
  383. border: 1px solid #e2e2e2;
  384. border-radius: 8px;
  385. padding: 8px 8px 3px;
  386. display: flex;
  387. flex-direction: column;
  388. align-items: center;
  389. .imgLabel {
  390. flex: 1;
  391. width: 100%;
  392. border: 1px dotted #e2e2e2;
  393. color: #999;
  394. font-size: 14px;
  395. cursor: pointer;
  396. border-radius: 8px;
  397. .msPhoto {
  398. display: flex;
  399. justify-content: center;
  400. align-items: center;
  401. max-width: 100%;
  402. max-height: 270px;
  403. img {
  404. max-width: 100%;
  405. max-height: 270px;
  406. }
  407. }
  408. .imgbbx {
  409. display: flex;
  410. flex-direction: column;
  411. align-items: center;
  412. justify-content: center;
  413. width: 100%;
  414. height: 100%;
  415. i {
  416. font-weight: bold;
  417. margin: 14px 0;
  418. font-size: 24px;
  419. }
  420. }
  421. }
  422. p {
  423. margin: 5px 0px;
  424. }
  425. }
  426. </style>