index.vue 10 KB

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