index.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337
  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: "educationName",
  134. // hidden: true,
  135. // },
  136. // {
  137. // label: "章总数",
  138. // prop: "chapterNum",
  139. // hidden: true,
  140. // },
  141. {
  142. label: "节总数",
  143. prop: "sectionNum",
  144. hidden: true,
  145. },
  146. {
  147. label: "学习时长",
  148. prop: "durationTime",
  149. hidden: true,
  150. ch: "分钟",
  151. },
  152. {
  153. label: "发布状态",
  154. prop: "publishStatus",
  155. hidden: true,
  156. scope: "fabStatus",
  157. },
  158. ],
  159. tableData: [], //表单数据
  160. total: 0, //一共多少条
  161. };
  162. },
  163. mounted() {
  164. this.search();
  165. },
  166. methods: {
  167. editInfo(v) {
  168. this.addClick(v, 0);
  169. },
  170. search(int) {
  171. this.loading = true;
  172. if (int === 1) {
  173. this.formData.pageNum = 1;
  174. }
  175. if (int === 2) {
  176. this.formData = {
  177. status: "0,1",
  178. pageSize: 10,
  179. pageNum: 1,
  180. };
  181. }
  182. this.$api.inquireCourseListmodule(this.formData).then((res) => {
  183. this.tableData = res.rows;
  184. this.total = res.total;
  185. this.navText.index = res.total;
  186. }).finally(()=>{
  187. this.loading = false;
  188. })
  189. },
  190. init() {
  191. this.search(2);
  192. },
  193. del(v) {
  194. this.$alert(
  195. "确定删除此内容?<br />内容删除后将无法恢复,请慎重考虑",
  196. "提示",
  197. {
  198. dangerouslyUseHTMLString: true,
  199. }
  200. )
  201. .then(() => {
  202. var data = {
  203. moduleId: v.moduleId,
  204. status: -1,
  205. };
  206. this.$api.editCoursemodule(data).then((res) => {
  207. this.$message.success("删除成功");
  208. this.search();
  209. });
  210. })
  211. .catch(() => {
  212. this.$message({
  213. type: "info",
  214. message: "已取消删除",
  215. });
  216. });
  217. },
  218. addClick(v, int) {
  219. if (v === undefined) {
  220. this.$router.push({
  221. path: "moduleManagementAdd",
  222. });
  223. } else {
  224. this.$router.push({
  225. path: "moduleManagementEdit",
  226. query: {
  227. id: v.moduleId,
  228. },
  229. });
  230. }
  231. },
  232. handleSizeChange(v) {
  233. this.formData.pageSize = v;
  234. this.formData.pageNum = 1;
  235. this.search();
  236. },
  237. handleCurrentChange(v) {
  238. this.formData.pageNum = v;
  239. this.search();
  240. },
  241. },
  242. };
  243. </script>
  244. <style lang="less" scoped>
  245. /deep/.el-button {
  246. border-radius: 8px;
  247. }
  248. /deep/.el-dialog {
  249. border-radius: 8px;
  250. .el-dialog__header {
  251. padding: 0;
  252. .hearders {
  253. height: 40px;
  254. display: flex;
  255. align-items: center;
  256. justify-content: space-between;
  257. padding: 0px 18px 0px 20px;
  258. border-bottom: 1px solid #e2e2e2;
  259. .leftTitle {
  260. font-size: 14px;
  261. font-weight: bold;
  262. color: #2f4378;
  263. }
  264. .rightBoxs {
  265. display: flex;
  266. align-items: center;
  267. img {
  268. width: 14px;
  269. height: 14px;
  270. margin-left: 13px;
  271. cursor: pointer;
  272. }
  273. }
  274. }
  275. }
  276. .el-dialog__footer {
  277. padding: 0;
  278. .dialog-footer {
  279. padding: 0px 40px;
  280. height: 70px;
  281. border-top: 1px solid #e2e2e2;
  282. display: flex;
  283. align-items: center;
  284. justify-content: flex-end;
  285. }
  286. }
  287. }
  288. .imgBox {
  289. width: 100%;
  290. // height: 210px;
  291. border: 1px solid #e2e2e2;
  292. border-radius: 8px;
  293. padding: 8px 8px 3px;
  294. display: flex;
  295. flex-direction: column;
  296. align-items: center;
  297. .imgLabel {
  298. flex: 1;
  299. width: 100%;
  300. border: 1px dotted #e2e2e2;
  301. color: #999;
  302. font-size: 14px;
  303. cursor: pointer;
  304. border-radius: 8px;
  305. .msPhoto {
  306. display: flex;
  307. justify-content: center;
  308. align-items: center;
  309. max-width: 100%;
  310. max-height: 270px;
  311. img {
  312. max-width: 100%;
  313. max-height: 270px;
  314. }
  315. }
  316. .imgbbx {
  317. display: flex;
  318. flex-direction: column;
  319. align-items: center;
  320. justify-content: center;
  321. width: 100%;
  322. height: 100%;
  323. i {
  324. font-weight: bold;
  325. margin: 14px 0;
  326. font-size: 24px;
  327. }
  328. }
  329. }
  330. p {
  331. margin: 5px 0px;
  332. }
  333. }
  334. </style>