123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573 |
- <template>
- <div id="festival">
- <search-box-new
- ref="searchBox"
- :formData="formData"
- :formList="formList"
- @search="search"
- @init="init"
- />
- <table-list
- rowKey="sectionId"
- ref="tableList"
- :tableSets="tableSet"
- :tableData="tableData"
- :navText="navText"
- @addClick="addClick"
- :loading="loading"
- @editInfo="editInfo"
- >
- <template slot="customize">
- <el-button size="medium" type="success" @click="moreActive"
- >批量导入</el-button
- >
- </template>
- <template slot="btn" slot-scope="props">
- <el-button type="text" @click="addClick(props.scope.row, 0)"
- >修改</el-button
- >
- <el-button type="text" @click="del(props.scope.row)">删除</el-button>
- </template>
- </table-list>
- <pagination
- :total="total"
- :pageSize="formData.pageSize"
- :currentPage="formData.pageNum"
- @handleSizeChange="handleSizeChange"
- @handleCurrentChange="handleCurrentChange"
- />
- <el-dialog
- :visible.sync="dialogDR"
- width="660px"
- :show-close="false"
- :close-on-click-modal="false"
- >
- <div slot="title" class="hearders">
- <div class="leftTitle">导入</div>
- <div class="rightBoxs">
- <img
- src="@/assets/images/Close@2x.png"
- alt=""
- @click="dialogDR = false"
- />
- </div>
- </div>
- <div>
- <div class="swq">
- <img
- style="width: 182px; height: 168px"
- src="@/assets/images/dr.png"
- alt=""
- />
- </div>
- <div style="padding-left: 100px">
- <p>第一步:下载导入模板</p>
- <p style="padding-left: 50px">
- <i class="el-icon-upload"></i
- ><span class="dowmStys" @click="getDowm">下载模板</span>
- </p>
- <p>第二步:(批量新增):点击“上传Excel”完成导入</p>
- <label
- for="mobles"
- class="el-button el-button--primary"
- style="margin-left: 50px; padding: 10px 20px"
- >上传Excel</label
- ><input
- style="display: none"
- type="file"
- id="mobles"
- ref="input1"
- @change="importMobleadd"
- />
- </div>
- </div>
- <span slot="footer" class="dialog-footer">
- <el-button @click="dialogDR = false">取消</el-button>
- <!-- <el-button type="primary" @click="submitChecksDR">确定</el-button> -->
- </span>
- </el-dialog>
- <el-dialog
- append-to-body
- :visible.sync="dialogERROR"
- width="660px"
- :show-close="false"
- :close-on-click-modal="false"
- >
- <div slot="title" class="hearders">
- <div class="leftTitle">提示</div>
- <div class="rightBoxs">
- <img
- src="@/assets/images/Close@2x.png"
- alt=""
- @click="dialogERROR = false"
- />
- </div>
- </div>
- <div>
- <h4 style="margin-top: 0px; font-weight: bold; text-align: center">
- 导入失败原因
- </h4>
- <el-input
- readonly
- type="textarea"
- :autosize="{ minRows: 6, maxRows: 24 }"
- v-model="errorData"
- >
- </el-input>
- </div>
- <span slot="footer" class="dialog-footer">
- <el-button @click="dialogERROR = false">确定</el-button>
- </span>
- </el-dialog>
- </div>
- </template>
- <script>
- import * as baseUrls from "@/utils/request.js";
- import searchBoxNew from "@/components/searchBoxNew";
- import tableList from "@/components/tableList";
- import pagination from "@/components/pagination";
- export default {
- name: "Festival",
- components: { searchBoxNew, tableList, pagination },
- data() {
- return {
- dialogDR: false, //导入窗口
- loading: false, //当前表单加载是否加载动画
- navText: {
- title: "节类型",
- index: 0,
- ch: "条",
- num: true,
- border: true,
- choice: true,
- openCheckMore: true,
- addHide: false,
- backFatherBtn: {
- status: false,
- title: "未定义",
- },
- },
- //搜索
- formList: [
- {
- prop: "educationTypeId",
- placeholder: "教育类型",
- scope: "educationType",
- },
- {
- prop: "businessId",
- placeholder: "业务层次",
- scope: "businessLevel",
- edu: "educationTypeId",
- },
- {
- prop: "subjectId",
- placeholder: "科目",
- scope: "sujectType",
- edu: "educationTypeId",
- },
- {
- prop: "sectionType",
- placeholder: "节类型",
- scope: "select",
- options: [
- {
- label: "录播",
- value: 1,
- },
- {
- label: "直播",
- value: 2,
- },
- {
- label: "回放",
- value: 3,
- },
- ],
- },
- {
- prop: "prefixName",
- placeholder: "请输入标题前缀",
- },
- {
- prop: "publishStatus",
- placeholder: "发布状态",
- scope: "select",
- options: [
- {
- label: "发布",
- value: 1,
- },
- {
- label: "未发布",
- value: 0,
- },
- ],
- },
- {
- prop: "name",
- placeholder: "请输入节标题",
- },
- ],
- formData: {
- status: "0,1",
- pageSize: 10,
- pageNum: 1,
- },
- // 表单
- tableSet: [
- {
- label: "节编码",
- prop: "code",
- hidden: true,
- },
- {
- label: "标题前缀",
- prop: "prefixName",
- hidden: true,
- },
- {
- label: "节标题",
- prop: "name",
- hidden: true,
- scope: "editInfo",
- },
- {
- label: "适用业务层级",
- prop: "businessList",
- hidden: true,
- scope: "mapTypesMores",
- },
- {
- label: "关联章",
- prop: "chapterList",
- prop1: "chapterName",
- hidden: true,
- scope: "aboutChapter",
- int: 1,
- },
- // {
- // label: "关联模块",
- // prop: "educationName",
- // hidden: true,
- // },
- // {
- // label: "关联课程",
- // prop: "educationName",
- // hidden: true,
- // },
- {
- label: "节类型",
- prop: "sectionType",
- hidden: true,
- scope: "sectionTypesTTT",
- },
- {
- label: "节时长",
- prop: "durationTime",
- hidden: true,
- scope: "convert",
- },
- {
- label: "URL地址/直播地址",
- prop: "sectionType",
- prop1: "recordingUrl",
- prop2: "liveUrl",
- hidden: true,
- scope: "liveAndUrl",
- },
- // {
- // label: "直播开始时间",
- // prop: "liveStartTime",
- // hidden: true,
- // scope: "aTimeList",
- // width: "160",
- // },
- // {
- // label: "直播结束时间",
- // prop: "liveEndTime",
- // hidden: true,
- // scope: "aTimeList",
- // width: "160",
- // },
- {
- label: "最后编辑时间",
- prop: "updateTime",
- scope: "aTimeList",
- hidden: true,
- },
- {
- label: "创建时间",
- prop: "createTime",
- scope: "aTimeList",
- hidden: true,
- },
- {
- label: "发布状态",
- prop: "publishStatus",
- hidden: true,
- scope: "fabStatus",
- },
- ],
- tableData: [], //表单数据
- total: 0, //一共多少条
- pageSize: 10, //每页多少条数据
- currentPage: 1, //当前页码
- errorData: "", //导入错误原因
- dialogERROR: false,
- };
- },
- mounted() {
- this.search();
- },
- activated() {
- this.search();
- },
- methods: {
- getDowm() {
- let url = baseUrls.BASE_IMG_URL + "/oss/images/file/20220304/1646382321115.xlsx";
- let link = document.createElement("a");
- let fileName = "导入模板" + ".xlsx";
- document.body.appendChild(link);
- link.href = url;
- link.dowmload = fileName;
- link.click();
- link.remove();
- },
- importMobleadd(e) {
- var self = this;
- var file = e.target.files[0];
- let formData = new FormData();
- formData.append("file", file);
- this.$api
- .drCourseSectionimportData(formData)
- .then((res) => {
- if (res.code === 200) {
- if (!res.data.errorLog) {
- self.$message.success("导入成功");
- self.dialogDR = false;
- } else {
- self.errorData = res.data.errorLog;
- self.dialogERROR = true;
- }
- }
- })
- .finally(() => {
- self.search();
- e.target.value = "";
- });
- },
- moreActive() {
- this.dialogDR = true;
- },
- editInfo(v) {
- this.addClick(v, 0);
- },
- search(int) {
- this.loading = true;
- if (int === 1) {
- this.formData.pageNum = 1;
- }
- if (int === 2) {
- this.formData = {
- status: "0,1",
- pageSize: 10,
- pageNum: 1,
- };
- }
- this.$api
- .inquireCourseSection(this.formData)
- .then((res) => {
- this.tableData = res.rows;
- this.total = res.total;
- this.navText.index = res.total;
- })
- .finally(() => {
- this.loading = false;
- });
- },
- init() {
- this.search(2);
- },
- del(v) {
- this.$api
- .gradecheckGoodsChange({ sectionId: v.sectionId })
- .then((res) => {
- if (res.data > 0) {
- this.$message.error("已有学员正在学习,无法删除");
- return;
- } else {
- this.$alert(
- "确定删除此内容?<br />内容删除后将无法恢复,请慎重考虑",
- "提示",
- {
- dangerouslyUseHTMLString: true,
- }
- )
- .then(() => {
- var data = {
- sectionId: v.sectionId,
- status: -1,
- };
- this.$api.editCourseSection(data).then((res) => {
- this.$message.success("删除成功");
- this.$refs.tableList.clearMoreActive();
- this.search();
- });
- })
- .catch(() => {
- this.$message({
- type: "info",
- message: "已取消删除",
- });
- });
- }
- });
- },
- addClick(v, int) {
- if (v === undefined) {
- this.$router.push({
- path: "festivalAdd",
- });
- } else {
- const jump = () => {
- this.$router.push({
- path: "festivalEdit",
- query: {
- id: v.sectionId,
- },
- });
- };
- const statusPage = this.$store.state.tagsView.visitedViews.some(
- (item) => {
- return item.name == "FestivalEdit";
- }
- );
- if (statusPage) {
- this.$store
- .dispatch("tagsView/delCachedView", {
- name: "FestivalEdit",
- })
- .then((res) => {
- jump();
- });
- } else {
- jump();
- }
- }
- },
- handleSizeChange(v) {
- this.formData.pageSize = v;
- this.formData.pageNum = 1;
- this.search();
- },
- handleCurrentChange(v) {
- this.formData.pageNum = v;
- this.search();
- },
- },
- };
- </script>
- <style lang="less" scoped>
- /deep/.el-button {
- border-radius: 8px;
- }
- /deep/.el-dialog {
- border-radius: 8px;
- .el-dialog__header {
- padding: 0;
- .hearders {
- height: 40px;
- display: flex;
- align-items: center;
- justify-content: space-between;
- padding: 0px 18px 0px 20px;
- border-bottom: 1px solid #e2e2e2;
- .leftTitle {
- font-size: 14px;
- font-weight: bold;
- color: #2f4378;
- }
- .rightBoxs {
- display: flex;
- align-items: center;
- img {
- width: 14px;
- height: 14px;
- margin-left: 13px;
- cursor: pointer;
- }
- }
- }
- }
- .el-dialog__footer {
- padding: 0;
- .dialog-footer {
- padding: 0px 40px;
- height: 70px;
- border-top: 1px solid #e2e2e2;
- display: flex;
- align-items: center;
- justify-content: flex-end;
- }
- }
- }
- .swq {
- text-align: center;
- border-bottom: 1px solid #eee;
- }
- .dowmStys {
- color: blue;
- cursor: pointer;
- }
- .imgBox {
- width: 100%;
- // height: 210px;
- border: 1px solid #e2e2e2;
- border-radius: 8px;
- padding: 8px 8px 3px;
- display: flex;
- flex-direction: column;
- align-items: center;
- .imgLabel {
- flex: 1;
- width: 100%;
- border: 1px dotted #e2e2e2;
- color: #999;
- font-size: 14px;
- cursor: pointer;
- border-radius: 8px;
- .msPhoto {
- display: flex;
- justify-content: center;
- align-items: center;
- max-width: 100%;
- max-height: 270px;
- img {
- max-width: 100%;
- max-height: 270px;
- }
- }
- .imgbbx {
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- width: 100%;
- height: 100%;
- i {
- font-weight: bold;
- margin: 14px 0;
- font-size: 24px;
- }
- }
- }
- p {
- margin: 5px 0px;
- }
- }
- </style>
|