index.vue 8.6 KB

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