index.vue 9.0 KB

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