index.vue 7.4 KB

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