index.vue 12 KB

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