index.vue 12 KB

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