index.vue 12 KB

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