index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516
  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: "isOptions",
  194. options: [
  195. {
  196. label: "录播",
  197. value: 1,
  198. },
  199. {
  200. label: "直播",
  201. value: 2,
  202. },
  203. {
  204. label: "回放",
  205. value: 3,
  206. },
  207. ],
  208. width: "120px",
  209. },
  210. {
  211. label: "节时长",
  212. prop: "durationTime",
  213. hidden: true,
  214. scope: "convert",
  215. },
  216. {
  217. label: "URL地址/直播地址",
  218. prop: "sectionType",
  219. prop1: "recordingUrl",
  220. prop2: "liveUrl",
  221. hidden: true,
  222. scope: "liveAndUrl",
  223. },
  224. // {
  225. // label: "直播开始时间",
  226. // prop: "liveStartTime",
  227. // hidden: true,
  228. // scope: "aTimeList",
  229. // width: "160",
  230. // },
  231. // {
  232. // label: "直播结束时间",
  233. // prop: "liveEndTime",
  234. // hidden: true,
  235. // scope: "aTimeList",
  236. // width: "160",
  237. // },
  238. {
  239. label: "最后编辑时间",
  240. prop: "updateTime",
  241. scope: "aTimeList",
  242. hidden: true,
  243. },
  244. {
  245. label: "创建时间",
  246. prop: "createTime",
  247. scope: "aTimeList",
  248. hidden: true,
  249. },
  250. {
  251. label: "发布状态",
  252. prop: "publishStatus",
  253. hidden: true,
  254. scope: "fabStatus",
  255. },
  256. ],
  257. tableData: [], //表单数据
  258. total: 0, //一共多少条
  259. pageSize: 10, //每页多少条数据
  260. currentPage: 1, //当前页码
  261. errorData: "", //导入错误原因
  262. dialogERROR: false,
  263. loading: false,
  264. };
  265. },
  266. mounted() {
  267. this.search();
  268. },
  269. activated() {
  270. this.search();
  271. },
  272. methods: {
  273. batchDel() {
  274. if (!this.$refs.tableList.allCheckData.length) {
  275. this.$message.warning("请勾选需要删除的节");
  276. return;
  277. }
  278. this.$confirm(
  279. `此操作将永久删除所勾选的${this.$refs.tableList.allCheckData.length}条节, 是否继续?`,
  280. "提示",
  281. {
  282. confirmButtonText: "确定",
  283. cancelButtonText: "取消",
  284. type: "warning",
  285. }
  286. )
  287. .then(() => {
  288. const ids = this.$refs.tableList.allCheckData.map(
  289. (item) => item.sectionId
  290. );
  291. sectionBatchDel({
  292. status: -1,
  293. ids,
  294. }).then((res) => {
  295. this.$message.success("批量删除成功");
  296. this.$refs.tableList.clearMoreActive();
  297. this.search(1);
  298. });
  299. })
  300. .catch(() => {});
  301. },
  302. moreActive() {
  303. this.dialogDR = true;
  304. },
  305. editInfo(v) {
  306. this.addClick(v, 0);
  307. },
  308. search(int) {
  309. this.loading = true;
  310. if (int === 1) {
  311. this.formData.pageNum = 1;
  312. }
  313. if (int === 2) {
  314. this.formData = {
  315. status: "0,1",
  316. pageSize: 10,
  317. pageNum: 1,
  318. };
  319. this.$refs.tableList.clearMoreActive();
  320. }
  321. this.$api
  322. .inquireCourseSection(this.formData)
  323. .then((res) => {
  324. this.tableData = res.rows;
  325. this.total = res.total;
  326. this.navText.index = res.total;
  327. })
  328. .finally(() => {
  329. this.loading = false;
  330. });
  331. },
  332. init() {
  333. this.search(2);
  334. },
  335. del(v) {
  336. this.$api
  337. .gradecheckGoodsChange({ sectionId: v.sectionId })
  338. .then((res) => {
  339. if (res.data > 0) {
  340. this.$message.error("已有学员正在学习,无法删除");
  341. return;
  342. } else {
  343. this.$alert(
  344. "确定删除此内容?<br />内容删除后将无法恢复,请慎重考虑",
  345. "提示",
  346. {
  347. dangerouslyUseHTMLString: true,
  348. }
  349. )
  350. .then(() => {
  351. var data = {
  352. sectionId: v.sectionId,
  353. status: -1,
  354. };
  355. this.$api.editCourseSection(data).then((res) => {
  356. this.$message.success("删除成功");
  357. this.$refs.tableList.clearMoreActive();
  358. this.search();
  359. });
  360. })
  361. .catch(() => {
  362. this.$message({
  363. type: "info",
  364. message: "已取消删除",
  365. });
  366. });
  367. }
  368. });
  369. },
  370. addClick(v, int) {
  371. if (v === undefined) {
  372. this.$router.push({
  373. path: "festivalAdd",
  374. });
  375. } else {
  376. const jump = () => {
  377. this.$store.dispatch("changefestivalPage", null);
  378. this.$router.push({
  379. path: "festivalEdit",
  380. query: {
  381. id: v.sectionId,
  382. },
  383. });
  384. };
  385. const statusPage = this.$store.state.tagsView.visitedViews.some(
  386. (item) => {
  387. return item.name == "FestivalEdit";
  388. }
  389. );
  390. if (statusPage) {
  391. this.$store
  392. .dispatch("tagsView/delCachedView", {
  393. name: "FestivalEdit",
  394. })
  395. .then((res) => {
  396. jump();
  397. });
  398. } else {
  399. jump();
  400. }
  401. }
  402. },
  403. handleSizeChange(v) {
  404. this.formData.pageSize = v;
  405. this.formData.pageNum = 1;
  406. this.search();
  407. },
  408. handleCurrentChange(v) {
  409. this.formData.pageNum = v;
  410. this.search();
  411. },
  412. },
  413. };
  414. </script>
  415. <style lang="less" scoped>
  416. /deep/.el-button {
  417. border-radius: 8px;
  418. }
  419. /deep/.el-dialog {
  420. border-radius: 8px;
  421. .el-dialog__header {
  422. padding: 0;
  423. .hearders {
  424. height: 40px;
  425. display: flex;
  426. align-items: center;
  427. justify-content: space-between;
  428. padding: 0px 18px 0px 20px;
  429. border-bottom: 1px solid #e2e2e2;
  430. .leftTitle {
  431. font-size: 14px;
  432. font-weight: bold;
  433. color: #2f4378;
  434. }
  435. .rightBoxs {
  436. display: flex;
  437. align-items: center;
  438. img {
  439. width: 14px;
  440. height: 14px;
  441. margin-left: 13px;
  442. cursor: pointer;
  443. }
  444. }
  445. }
  446. }
  447. .el-dialog__footer {
  448. padding: 0;
  449. .dialog-footer {
  450. padding: 0px 40px;
  451. height: 70px;
  452. border-top: 1px solid #e2e2e2;
  453. display: flex;
  454. align-items: center;
  455. justify-content: flex-end;
  456. }
  457. }
  458. }
  459. .swq {
  460. text-align: center;
  461. border-bottom: 1px solid #eee;
  462. }
  463. .dowmStys {
  464. color: blue;
  465. cursor: pointer;
  466. }
  467. .imgBox {
  468. width: 100%;
  469. // height: 210px;
  470. border: 1px solid #e2e2e2;
  471. border-radius: 8px;
  472. padding: 8px 8px 3px;
  473. display: flex;
  474. flex-direction: column;
  475. align-items: center;
  476. .imgLabel {
  477. flex: 1;
  478. width: 100%;
  479. border: 1px dotted #e2e2e2;
  480. color: #999;
  481. font-size: 14px;
  482. cursor: pointer;
  483. border-radius: 8px;
  484. .msPhoto {
  485. display: flex;
  486. justify-content: center;
  487. align-items: center;
  488. max-width: 100%;
  489. max-height: 270px;
  490. img {
  491. max-width: 100%;
  492. max-height: 270px;
  493. }
  494. }
  495. .imgbbx {
  496. display: flex;
  497. flex-direction: column;
  498. align-items: center;
  499. justify-content: center;
  500. width: 100%;
  501. height: 100%;
  502. i {
  503. font-weight: bold;
  504. margin: 14px 0;
  505. font-size: 24px;
  506. }
  507. }
  508. }
  509. p {
  510. margin: 5px 0px;
  511. }
  512. }
  513. </style>