index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468
  1. <template>
  2. <div id="courseManagement">
  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. ref="tableList"
  18. rowKey="courseId"
  19. >
  20. <template slot="customize">
  21. <el-button size="medium" @click="batchDel" type="warning"
  22. >批量删除</el-button
  23. >
  24. </template>
  25. <template slot="btn" slot-scope="props">
  26. <el-button type="text" @click="edit(props.scope.row, 1)"
  27. >基本信息</el-button
  28. >
  29. <el-button type="text" @click="edit(props.scope.row, 2)"
  30. >章节内容</el-button
  31. >
  32. <!-- <el-button type="text" @click="edit(props.scope.row)">修改</el-button> -->
  33. <el-button type="text" @click="del(props.scope.row)">删除</el-button>
  34. </template>
  35. </table-list>
  36. <pagination
  37. :total="total"
  38. :pageSize="formData.pageSize"
  39. :currentPage="formData.pageNum"
  40. @handleSizeChange="handleSizeChange"
  41. @handleCurrentChange="handleCurrentChange"
  42. />
  43. </div>
  44. </template>
  45. <script>
  46. import searchBoxNew from "@/components/searchBoxNew";
  47. import tableList from "@/components/tableList";
  48. import pagination from "@/components/pagination";
  49. import { courseBatchDel } from "@/api/resource/videoManagement";
  50. export default {
  51. name: "CourseManagement",
  52. components: { searchBoxNew, tableList, pagination },
  53. data() {
  54. return {
  55. loading: false, //当前表单加载是否加载动画
  56. navText: {
  57. title: "课程管理",
  58. index: 0,
  59. ch: "条",
  60. num: true,
  61. border: true,
  62. choice: true,
  63. addHide: false,
  64. changeWidth: "220px",
  65. openCheckMore: true,
  66. backFatherBtn: {
  67. status: false,
  68. title: "未定义",
  69. },
  70. },
  71. //搜索
  72. formList: [
  73. {
  74. prop: "educationTypeId",
  75. placeholder: "教育类型",
  76. scope: "educationType",
  77. },
  78. {
  79. prop: "businessId",
  80. placeholder: "业务层次",
  81. scope: "businessLevel",
  82. edu: "educationTypeId",
  83. },
  84. {
  85. prop: "schoolId",
  86. placeholder: "院校",
  87. scope: "schoolList",
  88. edu: "educationTypeId",
  89. },
  90. {
  91. prop: "majorId",
  92. placeholder: "专业",
  93. scope: "Professional",
  94. edu: "educationTypeId",
  95. },
  96. {
  97. prop: "subjectId",
  98. placeholder: "科目",
  99. scope: "sujectType",
  100. edu: "educationTypeId",
  101. },
  102. {
  103. prop: "prefixName",
  104. placeholder: "请输入标题前缀",
  105. },
  106. {
  107. prop: "publishStatus",
  108. placeholder: "发布状态",
  109. scope: "select",
  110. options: [
  111. {
  112. label: "发布",
  113. value: 1,
  114. },
  115. {
  116. label: "未发布",
  117. value: 0,
  118. },
  119. ],
  120. },
  121. {
  122. prop: "courseName",
  123. placeholder: "请输入课程名称",
  124. scope: false,
  125. },
  126. ],
  127. formData: {
  128. status: "0,1",
  129. pageSize: 10,
  130. pageNum: 1,
  131. },
  132. // 表单
  133. tableSet: [
  134. {
  135. label: "课程编码",
  136. prop: "code",
  137. hidden: false,
  138. },
  139. {
  140. label: "名称前缀",
  141. prop: "prefixName",
  142. hidden: false,
  143. },
  144. {
  145. label: "课程名称",
  146. prop: "courseName",
  147. hidden: true,
  148. scope: "editInfo",
  149. },
  150. {
  151. label: "科目",
  152. prop: "subjectName",
  153. hidden: true,
  154. },
  155. {
  156. label: "专业",
  157. prop: "categoryName",
  158. hidden: false,
  159. },
  160. {
  161. label: "院校",
  162. prop: "schoolName",
  163. hidden: false,
  164. },
  165. {
  166. label: "业务层次",
  167. prop1: "projectName",
  168. prop2: "businessName",
  169. hidden: true,
  170. scope: "InfoMore",
  171. },
  172. {
  173. label: "教育类型",
  174. prop: "educationName",
  175. hidden: true,
  176. },
  177. {
  178. label: "发布状态",
  179. prop: "publishStatus",
  180. hidden: true,
  181. scope: "fabStatus",
  182. },
  183. {
  184. label: "最后编辑时间",
  185. prop: "updateTime",
  186. scope: "aTimeList",
  187. hidden: true,
  188. },
  189. {
  190. label: "创建时间",
  191. prop: "createTime",
  192. scope: "aTimeList",
  193. hidden: true,
  194. },
  195. // {
  196. // label: "课程章节",
  197. // prop: "courseId",
  198. // hidden: true,
  199. // scope: "aboutTrees",
  200. // },
  201. {
  202. label: "关联商品",
  203. hidden: true,
  204. prop: "goodsList",
  205. prop1: "goodsName",
  206. scope: "aboutChapter",
  207. int: 4,
  208. },
  209. ],
  210. tableData: [], //表单数据
  211. total: 0, //一共多少条
  212. pageSize: 10, //每页多少条数据
  213. currentPage: 1, //当前页码
  214. };
  215. },
  216. mounted() {
  217. this.search();
  218. },
  219. activated() {
  220. this.search();
  221. },
  222. methods: {
  223. batchDel() {
  224. if (!this.$refs.tableList.allCheckData.length) {
  225. this.$message.warning("请勾选需要删除的课程");
  226. return;
  227. }
  228. this.$confirm(
  229. `此操作将永久删除所勾选的${this.$refs.tableList.allCheckData.length}条课程, 是否继续?`,
  230. "提示",
  231. {
  232. confirmButtonText: "确定",
  233. cancelButtonText: "取消",
  234. type: "warning",
  235. }
  236. )
  237. .then(() => {
  238. console.log(5646)
  239. const ids = this.$refs.tableList.allCheckData.map(
  240. (item) => item.courseId
  241. );
  242. courseBatchDel({
  243. status: -1,
  244. ids,
  245. }).then((res) => {
  246. this.$message.success("批量删除成功");
  247. this.$refs.tableList.clearMoreActive();
  248. this.search(1);
  249. });
  250. })
  251. .catch(() => {});
  252. },
  253. edit(v, int) {
  254. const jump = () => {
  255. this.$router.push({
  256. path: "editCourse",
  257. query: {
  258. id: v.courseId,
  259. name: int,
  260. },
  261. });
  262. };
  263. const statusPage = this.$store.state.tagsView.visitedViews.some(
  264. (item) => {
  265. return item.name == "EditCourse";
  266. }
  267. );
  268. if (statusPage) {
  269. this.$store
  270. .dispatch("tagsView/delCachedView", {
  271. name: "EditCourse",
  272. })
  273. .then((res) => {
  274. jump();
  275. });
  276. } else {
  277. jump();
  278. }
  279. },
  280. editInfo(v) {
  281. this.edit(v, 1);
  282. },
  283. search(int) {
  284. this.loading = true;
  285. if (int === 1) {
  286. this.formData.pageNum = 1;
  287. }
  288. if (int === 2) {
  289. this.formData = {
  290. status: "0,1",
  291. pageSize: 10,
  292. pageNum: 1,
  293. };
  294. }
  295. this.$api
  296. .inquireCourseListS(this.formData)
  297. .then((res) => {
  298. this.tableData = res.rows;
  299. this.total = res.total;
  300. this.navText.index = res.total;
  301. })
  302. .finally(() => {
  303. this.loading = false;
  304. });
  305. },
  306. init() {
  307. this.search(2);
  308. },
  309. del(v) {
  310. this.$api.gradecheckGoodsChange({ courseId: v.courseId }).then((res) => {
  311. if (res.data > 0) {
  312. this.$message.error("已有学员正在学习该课程,无法删除");
  313. return;
  314. } else {
  315. this.$alert(
  316. "确定删除此内容?<br />内容删除后将无法恢复,请慎重考虑",
  317. "提示",
  318. {
  319. dangerouslyUseHTMLString: true,
  320. }
  321. )
  322. .then(() => {
  323. var data = {
  324. courseId: v.courseId,
  325. status: -1,
  326. };
  327. this.$api.editCourse(data).then((res) => {
  328. this.$message.success("删除成功");
  329. this.search();
  330. });
  331. })
  332. .catch(() => {
  333. this.$message({
  334. type: "info",
  335. message: "已取消删除",
  336. });
  337. });
  338. }
  339. });
  340. },
  341. addClick(v, int) {
  342. if (v === undefined) {
  343. this.$router.push({
  344. path: "basicInfoAdd",
  345. });
  346. } else {
  347. if (int === 1) {
  348. this.$router.push({
  349. path: "chapterContent",
  350. query: {
  351. id: v.courseId,
  352. },
  353. });
  354. } else {
  355. this.$router.push({
  356. path: "BasicInfoEdit",
  357. query: {
  358. id: v.courseId,
  359. },
  360. });
  361. }
  362. }
  363. },
  364. handleSizeChange(v) {
  365. this.formData.pageSize = v;
  366. this.formData.pageNum = 1;
  367. this.search();
  368. },
  369. handleCurrentChange(v) {
  370. this.formData.pageNum = v;
  371. this.search();
  372. },
  373. },
  374. };
  375. </script>
  376. <style lang="less" scoped>
  377. /deep/.el-button {
  378. border-radius: 8px;
  379. }
  380. /deep/.el-dialog {
  381. border-radius: 8px;
  382. .el-dialog__header {
  383. padding: 0;
  384. .hearders {
  385. height: 40px;
  386. display: flex;
  387. align-items: center;
  388. justify-content: space-between;
  389. padding: 0px 18px 0px 20px;
  390. border-bottom: 1px solid #e2e2e2;
  391. .leftTitle {
  392. font-size: 14px;
  393. font-weight: bold;
  394. color: #2f4378;
  395. }
  396. .rightBoxs {
  397. display: flex;
  398. align-items: center;
  399. img {
  400. width: 14px;
  401. height: 14px;
  402. margin-left: 13px;
  403. cursor: pointer;
  404. }
  405. }
  406. }
  407. }
  408. .el-dialog__footer {
  409. padding: 0;
  410. .dialog-footer {
  411. padding: 0px 40px;
  412. height: 70px;
  413. border-top: 1px solid #e2e2e2;
  414. display: flex;
  415. align-items: center;
  416. justify-content: flex-end;
  417. }
  418. }
  419. }
  420. .imgBox {
  421. width: 100%;
  422. // height: 210px;
  423. border: 1px solid #e2e2e2;
  424. border-radius: 8px;
  425. padding: 8px 8px 3px;
  426. display: flex;
  427. flex-direction: column;
  428. align-items: center;
  429. .imgLabel {
  430. flex: 1;
  431. width: 100%;
  432. border: 1px dotted #e2e2e2;
  433. color: #999;
  434. font-size: 14px;
  435. cursor: pointer;
  436. border-radius: 8px;
  437. .msPhoto {
  438. display: flex;
  439. justify-content: center;
  440. align-items: center;
  441. max-width: 100%;
  442. max-height: 270px;
  443. img {
  444. max-width: 100%;
  445. max-height: 270px;
  446. }
  447. }
  448. .imgbbx {
  449. display: flex;
  450. flex-direction: column;
  451. align-items: center;
  452. justify-content: center;
  453. width: 100%;
  454. height: 100%;
  455. i {
  456. font-weight: bold;
  457. margin: 14px 0;
  458. font-size: 24px;
  459. }
  460. }
  461. }
  462. p {
  463. margin: 5px 0px;
  464. }
  465. }
  466. </style>