index.vue 9.8 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. >
  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="addClick(props.scope.row, 1)"
  23. >章节内容</el-button
  24. > -->
  25. <el-button type="text" @click="edit(props.scope.row)">修改</el-button>
  26. <el-button type="text" @click="del(props.scope.row)">删除</el-button>
  27. </template>
  28. </table-list>
  29. <pagination
  30. :total="total"
  31. :pageSize="formData.pageSize"
  32. :currentPage="formData.pageNum"
  33. @handleSizeChange="handleSizeChange"
  34. @handleCurrentChange="handleCurrentChange"
  35. />
  36. </div>
  37. </template>
  38. <script>
  39. import searchBoxNew from "@/components/searchBoxNew";
  40. import tableList from "@/components/tableList";
  41. import pagination from "@/components/pagination";
  42. export default {
  43. name: "ModuleManagement",
  44. components: { searchBoxNew, tableList, pagination },
  45. data() {
  46. return {
  47. loading: false, //当前表单加载是否加载动画
  48. navText: {
  49. title: "课程管理",
  50. index: 0,
  51. ch: "条",
  52. num: true,
  53. border: true,
  54. choice: true,
  55. addHide: false,
  56. changeWidth: "160px",
  57. backFatherBtn: {
  58. status: false,
  59. title: "未定义",
  60. },
  61. },
  62. //搜索
  63. formList: [
  64. {
  65. prop: "educationTypeId",
  66. placeholder: "教育类型",
  67. scope: "educationType",
  68. },
  69. {
  70. prop: "businessId",
  71. placeholder: "业务层次",
  72. scope: "businessLevel",
  73. edu: "educationTypeId",
  74. },
  75. {
  76. prop: "schoolId",
  77. placeholder: "院校",
  78. scope: "schoolList",
  79. edu: "educationTypeId",
  80. },
  81. {
  82. prop: "majorId",
  83. placeholder: "专业",
  84. scope: "Professional",
  85. edu: "educationTypeId",
  86. },
  87. {
  88. prop: "subjectId",
  89. placeholder: "科目",
  90. scope: "sujectType",
  91. edu: "educationTypeId",
  92. },
  93. {
  94. prop: "prefixName",
  95. placeholder: "请输入标题前缀",
  96. },
  97. {
  98. prop: "publishStatus",
  99. placeholder: "发布状态",
  100. scope: "select",
  101. options: [
  102. {
  103. label: "发布",
  104. value: 1,
  105. },
  106. {
  107. label: "未发布",
  108. value: 0,
  109. },
  110. ],
  111. },
  112. {
  113. prop: "courseName",
  114. placeholder: "请输入课程名称",
  115. scope: false,
  116. },
  117. ],
  118. formData: {
  119. status: "0,1",
  120. pageSize: 10,
  121. pageNum: 1,
  122. },
  123. // 表单
  124. tableSet: [
  125. {
  126. label: "课程编码",
  127. prop: "code",
  128. hidden: true,
  129. width: "120px",
  130. },
  131. {
  132. label: "名称前缀",
  133. prop: "prefixName",
  134. hidden: true,
  135. width: "180px",
  136. },
  137. {
  138. label: "课程名称",
  139. prop: "courseName",
  140. hidden: true,
  141. scope: "editInfo",
  142. width: "260px",
  143. },
  144. {
  145. label: "科目",
  146. prop: "subjectName",
  147. hidden: true,
  148. },
  149. {
  150. label: "专业",
  151. prop: "categoryName",
  152. hidden: true,
  153. },
  154. {
  155. label: "院校",
  156. prop: "schoolName",
  157. hidden: true,
  158. width: "120px",
  159. },
  160. {
  161. label: "业务层次",
  162. prop1: "projectName",
  163. prop2: "businessName",
  164. hidden: true,
  165. width: "340px",
  166. scope: "InfoMore",
  167. },
  168. {
  169. label: "教育类型",
  170. prop: "educationName",
  171. hidden: true,
  172. width: "140px",
  173. },
  174. {
  175. label: "发布状态",
  176. prop: "publishStatus",
  177. hidden: true,
  178. scope: "fabStatus",
  179. },
  180. {
  181. label: "最后编辑时间",
  182. prop: "updateTime",
  183. scope: "aTimeList",
  184. hidden: true,
  185. width: "160px",
  186. },
  187. {
  188. label: "创建时间",
  189. prop: "createTime",
  190. scope: "aTimeList",
  191. hidden: true,
  192. width: "160px",
  193. },
  194. {
  195. label: "课程章节",
  196. prop: "courseId",
  197. hidden: true,
  198. width: "120px",
  199. scope: "aboutTrees",
  200. },
  201. {
  202. label: "关联商品",
  203. hidden: true,
  204. prop: "goodsList",
  205. prop1: "goodsName",
  206. width: "210px",
  207. scope: "aboutChapter",
  208. int: 4,
  209. },
  210. ],
  211. tableData: [], //表单数据
  212. total: 0, //一共多少条
  213. pageSize: 10, //每页多少条数据
  214. currentPage: 1, //当前页码
  215. };
  216. },
  217. mounted() {
  218. this.search();
  219. },
  220. activated() {
  221. this.search();
  222. },
  223. methods: {
  224. edit(v) {
  225. const jump = () => {
  226. this.$router.push({
  227. path: "editCourse",
  228. query: {
  229. id: v.courseId,
  230. },
  231. });
  232. };
  233. const statusPage = this.$store.state.tagsView.visitedViews.some(
  234. (item) => {
  235. return item.name == "EditCourse";
  236. }
  237. );
  238. if (statusPage) {
  239. this.$store
  240. .dispatch("tagsView/delCachedView", {
  241. name: "EditCourse",
  242. })
  243. .then((res) => {
  244. jump();
  245. });
  246. } else {
  247. jump();
  248. }
  249. },
  250. editInfo(v) {
  251. this.edit(v);
  252. },
  253. search(int) {
  254. this.loading = true;
  255. if (int === 1) {
  256. this.formData.pageNum = 1;
  257. }
  258. if (int === 2) {
  259. this.formData = {
  260. status: "0,1",
  261. pageSize: 10,
  262. pageNum: 1,
  263. };
  264. }
  265. this.$api
  266. .inquireCourseListS(this.formData)
  267. .then((res) => {
  268. this.tableData = res.rows;
  269. this.total = res.total;
  270. this.navText.index = res.total;
  271. })
  272. .finally(() => {
  273. this.loading = false;
  274. });
  275. },
  276. init() {
  277. this.search(2);
  278. },
  279. del(v) {
  280. this.$api.gradecheckGoodsChange({ courseId: v.courseId }).then((res) => {
  281. if (res.data > 0) {
  282. this.$message.error("已有学员正在学习该课程,无法删除");
  283. return;
  284. } else {
  285. this.$alert(
  286. "确定删除此内容?<br />内容删除后将无法恢复,请慎重考虑",
  287. "提示",
  288. {
  289. dangerouslyUseHTMLString: true,
  290. }
  291. )
  292. .then(() => {
  293. var data = {
  294. courseId: v.courseId,
  295. status: -1,
  296. };
  297. this.$api.editCourse(data).then((res) => {
  298. this.$message.success("删除成功");
  299. this.search();
  300. });
  301. })
  302. .catch(() => {
  303. this.$message({
  304. type: "info",
  305. message: "已取消删除",
  306. });
  307. });
  308. }
  309. });
  310. },
  311. addClick(v, int) {
  312. if (v === undefined) {
  313. this.$router.push({
  314. path: "basicInfoAdd",
  315. });
  316. } else {
  317. if (int === 1) {
  318. this.$router.push({
  319. path: "chapterContent",
  320. query: {
  321. id: v.courseId,
  322. },
  323. });
  324. } else {
  325. this.$router.push({
  326. path: "BasicInfoEdit",
  327. query: {
  328. id: v.courseId,
  329. },
  330. });
  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>