index.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361
  1. <template>
  2. <div id="festival">
  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: "Chapter",
  40. components: { searchBoxNew, tableList, pagination },
  41. data() {
  42. return {
  43. loading: false, //当前表单加载是否加载动画
  44. navText: {
  45. title: "章类型",
  46. index: 0,
  47. ch: "条",
  48. num: true,
  49. border: true,
  50. choice: 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: "name",
  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: "name",
  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: "moduleList",
  136. prop1: "moduleName",
  137. hidden: true,
  138. scope: "aboutChapter",
  139. width: "150",
  140. int: 2,
  141. },
  142. // {
  143. // label: "关联课程",
  144. // prop: "educationName",
  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. pageSize: 10, //每页多少条数据
  168. currentPage: 1, //当前页码
  169. };
  170. },
  171. mounted() {
  172. this.search();
  173. },
  174. activated() {
  175. this.search();
  176. },
  177. methods: {
  178. editInfo(v) {
  179. this.addClick(v, 0);
  180. },
  181. search(int) {
  182. this.loading = true;
  183. if (int === 1) {
  184. this.formData.pageNum = 1;
  185. }
  186. if (int === 2) {
  187. this.formData = {
  188. status: "0,1",
  189. pageSize: 10,
  190. pageNum: 1,
  191. };
  192. }
  193. this.$api
  194. .inquireCourseListchapter(this.formData)
  195. .then((res) => {
  196. this.tableData = res.rows;
  197. this.total = res.total;
  198. this.navText.index = res.total;
  199. })
  200. .finally(() => {
  201. this.loading = false;
  202. });
  203. },
  204. init() {
  205. this.search(2);
  206. },
  207. del(v) {
  208. this.$api
  209. .gradecheckGoodsChange({ chapterId: v.chapterId })
  210. .then((res) => {
  211. if (res.data > 0) {
  212. this.$message.error("已有学员正在学习,无法删除");
  213. return;
  214. } else {
  215. this.$alert(
  216. "确定删除此内容?<br />内容删除后将无法恢复,请慎重考虑",
  217. "提示",
  218. {
  219. dangerouslyUseHTMLString: true,
  220. }
  221. )
  222. .then(() => {
  223. var data = {
  224. chapterId: v.chapterId,
  225. status: -1,
  226. };
  227. this.$api.editCoursechapter(data).then((res) => {
  228. this.$message.success("删除成功");
  229. this.search();
  230. });
  231. })
  232. .catch(() => {
  233. this.$message({
  234. type: "info",
  235. message: "已取消删除",
  236. });
  237. });
  238. }
  239. });
  240. },
  241. addClick(v, int) {
  242. if (v === undefined) {
  243. this.$router.push({
  244. path: "chapterAdd",
  245. });
  246. } else {
  247. this.$router.push({
  248. path: "chapterEdit",
  249. query: {
  250. id: v.chapterId,
  251. },
  252. });
  253. }
  254. },
  255. handleSizeChange(v) {
  256. this.formData.pageSize = v;
  257. this.formData.pageNum = 1;
  258. this.search();
  259. },
  260. handleCurrentChange(v) {
  261. this.formData.pageNum = v;
  262. this.search();
  263. },
  264. },
  265. };
  266. </script>
  267. <style lang="less" scoped>
  268. /deep/.el-button {
  269. border-radius: 8px;
  270. }
  271. /deep/.el-dialog {
  272. border-radius: 8px;
  273. .el-dialog__header {
  274. padding: 0;
  275. .hearders {
  276. height: 40px;
  277. display: flex;
  278. align-items: center;
  279. justify-content: space-between;
  280. padding: 0px 18px 0px 20px;
  281. border-bottom: 1px solid #e2e2e2;
  282. .leftTitle {
  283. font-size: 14px;
  284. font-weight: bold;
  285. color: #2f4378;
  286. }
  287. .rightBoxs {
  288. display: flex;
  289. align-items: center;
  290. img {
  291. width: 14px;
  292. height: 14px;
  293. margin-left: 13px;
  294. cursor: pointer;
  295. }
  296. }
  297. }
  298. }
  299. .el-dialog__footer {
  300. padding: 0;
  301. .dialog-footer {
  302. padding: 0px 40px;
  303. height: 70px;
  304. border-top: 1px solid #e2e2e2;
  305. display: flex;
  306. align-items: center;
  307. justify-content: flex-end;
  308. }
  309. }
  310. }
  311. .imgBox {
  312. width: 100%;
  313. // height: 210px;
  314. border: 1px solid #e2e2e2;
  315. border-radius: 8px;
  316. padding: 8px 8px 3px;
  317. display: flex;
  318. flex-direction: column;
  319. align-items: center;
  320. .imgLabel {
  321. flex: 1;
  322. width: 100%;
  323. border: 1px dotted #e2e2e2;
  324. color: #999;
  325. font-size: 14px;
  326. cursor: pointer;
  327. border-radius: 8px;
  328. .msPhoto {
  329. display: flex;
  330. justify-content: center;
  331. align-items: center;
  332. max-width: 100%;
  333. max-height: 270px;
  334. img {
  335. max-width: 100%;
  336. max-height: 270px;
  337. }
  338. }
  339. .imgbbx {
  340. display: flex;
  341. flex-direction: column;
  342. align-items: center;
  343. justify-content: center;
  344. width: 100%;
  345. height: 100%;
  346. i {
  347. font-weight: bold;
  348. margin: 14px 0;
  349. font-size: 24px;
  350. }
  351. }
  352. }
  353. p {
  354. margin: 5px 0px;
  355. }
  356. }
  357. </style>