index.vue 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429
  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. >
  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: "CourseManagement",
  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. },
  130. {
  131. label: "名称前缀",
  132. prop: "prefixName",
  133. hidden: true,
  134. },
  135. {
  136. label: "课程名称",
  137. prop: "courseName",
  138. hidden: true,
  139. scope: "editInfo",
  140. },
  141. {
  142. label: "科目",
  143. prop: "subjectName",
  144. hidden: true,
  145. },
  146. {
  147. label: "专业",
  148. prop: "categoryName",
  149. hidden: true,
  150. },
  151. {
  152. label: "院校",
  153. prop: "schoolName",
  154. hidden: true,
  155. },
  156. {
  157. label: "业务层次",
  158. prop1: "projectName",
  159. prop2: "businessName",
  160. hidden: true,
  161. scope: "InfoMore",
  162. },
  163. {
  164. label: "教育类型",
  165. prop: "educationName",
  166. hidden: true,
  167. },
  168. {
  169. label: "发布状态",
  170. prop: "publishStatus",
  171. hidden: true,
  172. scope: "fabStatus",
  173. },
  174. {
  175. label: "最后编辑时间",
  176. prop: "updateTime",
  177. scope: "aTimeList",
  178. hidden: true,
  179. },
  180. {
  181. label: "创建时间",
  182. prop: "createTime",
  183. scope: "aTimeList",
  184. hidden: true,
  185. },
  186. {
  187. label: "课程章节",
  188. prop: "courseId",
  189. hidden: true,
  190. scope: "aboutTrees",
  191. },
  192. {
  193. label: "关联商品",
  194. hidden: true,
  195. prop: "goodsList",
  196. prop1: "goodsName",
  197. scope: "aboutChapter",
  198. int: 4,
  199. },
  200. ],
  201. tableData: [], //表单数据
  202. total: 0, //一共多少条
  203. pageSize: 10, //每页多少条数据
  204. currentPage: 1, //当前页码
  205. };
  206. },
  207. mounted() {
  208. this.search();
  209. },
  210. activated() {
  211. this.search();
  212. },
  213. methods: {
  214. edit(v) {
  215. const jump = () => {
  216. this.$router.push({
  217. path: "editCourse",
  218. query: {
  219. id: v.courseId,
  220. },
  221. });
  222. };
  223. const statusPage = this.$store.state.tagsView.visitedViews.some(
  224. (item) => {
  225. return item.name == "EditCourse";
  226. }
  227. );
  228. if (statusPage) {
  229. this.$store
  230. .dispatch("tagsView/delCachedView", {
  231. name: "EditCourse",
  232. })
  233. .then((res) => {
  234. jump();
  235. });
  236. } else {
  237. jump();
  238. }
  239. },
  240. editInfo(v) {
  241. this.edit(v);
  242. },
  243. search(int) {
  244. this.loading = true;
  245. if (int === 1) {
  246. this.formData.pageNum = 1;
  247. }
  248. if (int === 2) {
  249. this.formData = {
  250. status: "0,1",
  251. pageSize: 10,
  252. pageNum: 1,
  253. };
  254. }
  255. this.$api
  256. .inquireCourseListS(this.formData)
  257. .then((res) => {
  258. this.tableData = res.rows;
  259. this.total = res.total;
  260. this.navText.index = res.total;
  261. })
  262. .finally(() => {
  263. this.loading = false;
  264. });
  265. },
  266. init() {
  267. this.search(2);
  268. },
  269. del(v) {
  270. this.$api.gradecheckGoodsChange({ courseId: v.courseId }).then((res) => {
  271. if (res.data > 0) {
  272. this.$message.error("已有学员正在学习该课程,无法删除");
  273. return;
  274. } else {
  275. this.$alert(
  276. "确定删除此内容?<br />内容删除后将无法恢复,请慎重考虑",
  277. "提示",
  278. {
  279. dangerouslyUseHTMLString: true,
  280. }
  281. )
  282. .then(() => {
  283. var data = {
  284. courseId: v.courseId,
  285. status: -1,
  286. };
  287. this.$api.editCourse(data).then((res) => {
  288. this.$message.success("删除成功");
  289. this.search();
  290. });
  291. })
  292. .catch(() => {
  293. this.$message({
  294. type: "info",
  295. message: "已取消删除",
  296. });
  297. });
  298. }
  299. });
  300. },
  301. addClick(v, int) {
  302. if (v === undefined) {
  303. this.$router.push({
  304. path: "basicInfoAdd",
  305. });
  306. } else {
  307. if (int === 1) {
  308. this.$router.push({
  309. path: "chapterContent",
  310. query: {
  311. id: v.courseId,
  312. },
  313. });
  314. } else {
  315. this.$router.push({
  316. path: "BasicInfoEdit",
  317. query: {
  318. id: v.courseId,
  319. },
  320. });
  321. }
  322. }
  323. },
  324. handleSizeChange(v) {
  325. this.formData.pageSize = v;
  326. this.formData.pageNum = 1;
  327. this.search();
  328. },
  329. handleCurrentChange(v) {
  330. this.formData.pageNum = v;
  331. this.search();
  332. },
  333. },
  334. };
  335. </script>
  336. <style lang="less" scoped>
  337. /deep/.el-button {
  338. border-radius: 8px;
  339. }
  340. /deep/.el-dialog {
  341. border-radius: 8px;
  342. .el-dialog__header {
  343. padding: 0;
  344. .hearders {
  345. height: 40px;
  346. display: flex;
  347. align-items: center;
  348. justify-content: space-between;
  349. padding: 0px 18px 0px 20px;
  350. border-bottom: 1px solid #e2e2e2;
  351. .leftTitle {
  352. font-size: 14px;
  353. font-weight: bold;
  354. color: #2f4378;
  355. }
  356. .rightBoxs {
  357. display: flex;
  358. align-items: center;
  359. img {
  360. width: 14px;
  361. height: 14px;
  362. margin-left: 13px;
  363. cursor: pointer;
  364. }
  365. }
  366. }
  367. }
  368. .el-dialog__footer {
  369. padding: 0;
  370. .dialog-footer {
  371. padding: 0px 40px;
  372. height: 70px;
  373. border-top: 1px solid #e2e2e2;
  374. display: flex;
  375. align-items: center;
  376. justify-content: flex-end;
  377. }
  378. }
  379. }
  380. .imgBox {
  381. width: 100%;
  382. // height: 210px;
  383. border: 1px solid #e2e2e2;
  384. border-radius: 8px;
  385. padding: 8px 8px 3px;
  386. display: flex;
  387. flex-direction: column;
  388. align-items: center;
  389. .imgLabel {
  390. flex: 1;
  391. width: 100%;
  392. border: 1px dotted #e2e2e2;
  393. color: #999;
  394. font-size: 14px;
  395. cursor: pointer;
  396. border-radius: 8px;
  397. .msPhoto {
  398. display: flex;
  399. justify-content: center;
  400. align-items: center;
  401. max-width: 100%;
  402. max-height: 270px;
  403. img {
  404. max-width: 100%;
  405. max-height: 270px;
  406. }
  407. }
  408. .imgbbx {
  409. display: flex;
  410. flex-direction: column;
  411. align-items: center;
  412. justify-content: center;
  413. width: 100%;
  414. height: 100%;
  415. i {
  416. font-weight: bold;
  417. margin: 14px 0;
  418. font-size: 24px;
  419. }
  420. }
  421. }
  422. p {
  423. margin: 5px 0px;
  424. }
  425. }
  426. </style>