index.vue 7.4 KB

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