课程分类管理选项菜单

This commit is contained in:
18571350067 2021-12-25 17:13:09 +08:00
parent 4fc3f27a8c
commit bac5df6af4
1 changed files with 123 additions and 79 deletions

View File

@ -22,32 +22,26 @@
</a-select-option>
</a-select>
<a-button type="primary" @click="showModal" style="margin-left: 20px"> 添加分类 </a-button>
<!-- 课件分类弹框 -->
<!-- <a-modal v-model="fileUpload.visible" title="模板下载" cancelText="关闭" :ok-button-props="{ style: { display: 'none' } }">
<s-table ref="table" :rowKey="(record) => record.id" :columns="fileUpload.columns" :alert="false" :data="loadData" :showPagination="false" :expandRowByClick="true">
<span slot="type" slot-scope="text, record">
<a-tag color="cyan" v-if="text === 0">
{{ record.type | typeFilter }}
</a-tag>
<a-tag color="blue" v-if="text === 1">
{{ record.type | typeFilter }}
</a-tag>
<a-tag color="purple" v-if="text === 2">
{{ record.type | typeFilter }}
</a-tag>
</span>
<a-modal v-model="fileUpload.visible" title="课程分类管理" cancelText="关闭" :ok-button-props="{ style: { display: 'none' } }">
<div class="table-operator">
<a-button type="primary" icon="plus">新增分类</a-button>
</div>
<s-table ref="table" :rowKey="(record) => record.id" :columns="columns" :alert="false" :data="classfiy" :showPagination="false" :expandRowByClick="true">
<span slot="action" slot-scope="text, record">
<template>
<a v-if="hasPerm('sys:menu:add') && record.type !== 2" @click="$refs.menuForm.add(record.id)">新增下级</a>
<a-divider type="vertical" v-if="hasPerm('sys:menu:add') && record.type !== 2 && hasPerm('sys:menu:edit')" />
<a v-if="hasPerm('sys:menu:edit')" @click="$refs.menuForm.edit(record)">编辑</a>
<a-divider type="vertical" v-if="hasPerm('sys:menu:edit')" />
<a-divider type="vertical" v-if="hasPerm('sys:menu:edit') && hasPerm('sys:menu:delete') " />
<a-popconfirm v-if="hasPerm('sys:menu:delete')" placement="topRight" title="删除本菜单与下级?" @confirm="() => handleDel(record)">
<a>删除</a>
</a-popconfirm>
</template>
</span>
</s-table>
</a-modal> -->
</a-modal>
</div>
<div>课件大小&nbsp;
<a-input :disabled="true" :value="fileUpload.videoForm.sizeStr" style="width: 140px" />&nbsp;&nbsp;&nbsp; MB
@ -122,7 +116,8 @@
</a-tabs>
</a-tab-pane>
<a-tab-pane key="2" tab="视频服务器链接" :disabled="true"> <!-- videoServerLink.disabled -->
<a-tab-pane key="2" tab="视频服务器链接" :disabled="true">
<!-- videoServerLink.disabled -->
<div style="background: #ececec; padding: 30px">
<a-card title="视频服务器链接" :bordered="false" style="width: 100%">
<div style="margin-bottom: 30px">
@ -174,7 +169,8 @@
</div>
</a-tab-pane>
<a-tab-pane key="3" tab="第三方连接" :disabled="true"> <!-- thirdAddress.disabled -->
<a-tab-pane key="3" tab="第三方连接" :disabled="true">
<!-- thirdAddress.disabled -->
<div style="background: #ececec; padding: 30px">
<a-card title="第三方连接" :bordered="false" style="width: 100%">
<div style="margin-bottom: 30px">
@ -232,17 +228,21 @@
<script>
import { STable } from '@/components'
import { coursewareDeatil } from '@/api/course/courseware'
import { ACCESS_TOKEN } from '@/store/mutation-types'
import storage from 'store'
import axios from 'axios'
import { ossUpload } from '@/api/sys/oss'
import { coursewareAdd } from '@/api/course/courseware'
import { dictionaryDropDown } from '@/api/sys/dictionaryItem'
import { coursewareAdd, coursewareClassList } from '@/api/course/courseware'
import { listToTree } from '@/utils/util'
const rootParentId = 0
export default {
data() {
return {
treeData: [],
courseware: {}, //
queryParam: { coursewareId: this.$route.query.coursewareId }, //
successOssFile: [],
@ -274,64 +274,57 @@ export default {
sizeStr: '',
type: '4',
},
columns: [
{
title: '名称',
dataIndex: 'name',
key: 'name',
ellipsis: true,
},
{
title: '操作',
dataIndex: 'action',
width: '200px',
scopedSlots: { customRender: 'action' },
},
],
}
},
components: {},
components: { STable, listToTree },
created() {
//
if (this.queryParam.coursewareId) {
let parameter = {}
coursewareDeatil(Object.assign(parameter, this.queryParam)).then((res) => {
this.courseware = res.data
//
this.fileUpload.disabled = true
this.fileUpload.videoForm.disabled = true
this.fileUpload.textForm.disabled = true
this.videoServerLink.disabled = true
this.thirdAddress.disabled = true
//
if (this.courseware.type == '1' || this.courseware.type == '2') {
this.parentTabKey = '1'
if (this.courseware.type == '1') {
this.fileUpload.tabkey = '1'
this.fileUpload.videoForm = this.courseware
this.fileUpload.videoForm.disabled = false
this.courseware.videoList.forEach(element => {
let successOssFile_ = {};
successOssFile_["id"] = element.id;
successOssFile_["uid"] = element.id;
successOssFile_["uuid"] = element.id;
successOssFile_["code"] = 200;
successOssFile_["name"] = element.name;
successOssFile_["url"] = element.path;
successOssFile_["size"] = element.size;
this.successOssFile.push(successOssFile_);
});
console.log('11------', this.successOssFile)
} else {
this.fileUpload.tabkey = '2'
this.fileUpload.textForm = this.courseware
this.fileUpload.textForm.disabled = false
}
}
if (this.courseware.type == '3') {
this.parentTabKey = '2'
this.videoServerLink = this.courseware
this.videoServerLink.disabled = false
}
if (this.courseware.type == '4') {
this.parentTabKey = '3'
this.thirdAddress = this.courseware
this.thirdAddress.disabled = false
}
})
}
//
if (this.queryParam.coursewareId) this.load()
},
methods: {
//
showModal() {
this.fileUpload.visible = true
// this.classfiy()
},
//
classfiy() {
let parameter = {}
return coursewareClassList(Object.assign(parameter, this.queryParam)).then((res) => {
const list2tree1 = (list, parentId) => {
return list.filter((item) => {
//
// if (this.treeDataOne) this.treeDataOne.push(item.id)
if (item.parentid === parentId) {
item.children = list2tree1(list, item.id)
return true
}
return false
})
}
// const coursewareClassList = listToTree(res.data, [], rootParentId)
let coursewareClassList = list2tree1(res.data, 0)
console.log('coursewareClassList::::', coursewareClassList)
this.treeData = coursewareClassList
return coursewareClassList
})
},
//
goback() {
this.$router.push({
@ -435,7 +428,7 @@ export default {
//
if (this.queryParam.coursewareId) {
//
//
if (this.fileUpload.tabkey == '1' && this.parentcallback == '1') {
this.fileUpload.videoForm.size =
this.fileUpload.videoForm.size + parseFloat(videoSize) + parseFloat(this.fileUpload.videoForm.sizeStr)
@ -471,11 +464,6 @@ export default {
this.refreshFileSize()
},
//
showModal() {
this.fileUpload.visible = true
},
//
save() {
//
@ -586,6 +574,62 @@ export default {
form = this.thirdAddress
return form
},
//
load() {
//
if (this.queryParam.coursewareId) {
let parameter = {}
coursewareDeatil(Object.assign(parameter, this.queryParam)).then((res) => {
this.courseware = res.data
//
this.fileUpload.disabled = true
this.fileUpload.videoForm.disabled = true
this.fileUpload.textForm.disabled = true
this.videoServerLink.disabled = true
this.thirdAddress.disabled = true
//
if (this.courseware.type == '1' || this.courseware.type == '2') {
this.parentTabKey = '1'
if (this.courseware.type == '1') {
this.fileUpload.tabkey = '1'
this.fileUpload.videoForm = this.courseware
this.fileUpload.videoForm.disabled = false
this.courseware.videoList.forEach((element) => {
let successOssFile_ = {}
successOssFile_['id'] = element.id
successOssFile_['uid'] = element.id
successOssFile_['uuid'] = element.id
successOssFile_['code'] = 200
successOssFile_['name'] = element.name
successOssFile_['url'] = element.path
successOssFile_['size'] = element.size
this.successOssFile.push(successOssFile_)
})
console.log('11------', this.successOssFile)
} else {
this.fileUpload.tabkey = '2'
this.fileUpload.textForm = this.courseware
this.fileUpload.textForm.disabled = false
}
}
if (this.courseware.type == '3') {
this.parentTabKey = '2'
this.videoServerLink = this.courseware
this.videoServerLink.disabled = false
}
if (this.courseware.type == '4') {
this.parentTabKey = '3'
this.thirdAddress = this.courseware
this.thirdAddress.disabled = false
}
})
}
},
},
}
</script>