index.vue 8.8 KB

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