index.vue 8.2 KB

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