This commit is contained in:
parent
3d22070bfa
commit
fae098d826
|
|
@ -7,7 +7,8 @@
|
|||
placeholder="请输入关键字"
|
||||
maxlength="100"
|
||||
show-word-limit
|
||||
clearable v-no-whitespace
|
||||
clearable
|
||||
v-no-whitespace
|
||||
@keyup.enter.native="handleSearch"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
|
@ -22,7 +23,9 @@
|
|||
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd">新建文件夹</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleDownload(null)">批量下载</el-button>
|
||||
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleDownload(null)">
|
||||
批量下载
|
||||
</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
|
|
@ -38,12 +41,13 @@
|
|||
@selection-change="handleSelectionChange"
|
||||
@select-all="handleSelectAll"
|
||||
>
|
||||
<el-table-column
|
||||
type="selection"
|
||||
:selectable="isSelectable"
|
||||
width="55">
|
||||
<el-table-column type="selection" :selectable="isSelectable" width="55"></el-table-column>
|
||||
<el-table-column label="课件库名称" show-overflow-tooltip align="left">
|
||||
<template slot-scope="{ row }">
|
||||
<i class="el-icon-folder-opened" v-if="row.fileType == 1"></i>
|
||||
{{ row.coursewareName }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="课件库名称" prop="coursewareName" show-overflow-tooltip align="left" />
|
||||
<el-table-column label="类型" prop="fileType" align="center">
|
||||
<template slot-scope="scope">
|
||||
<div v-if="scope.row.fileType == 1">{{ '文件夹' }}</div>
|
||||
|
|
@ -80,6 +84,7 @@
|
|||
<el-button type="text" size="mini" @click="handleDownload(scope.row)" :loading="downLoading">
|
||||
下载
|
||||
</el-button>
|
||||
<el-button type="text" size="mini" @click="handlePreview(scope.row)">预览</el-button>
|
||||
<el-button type="text" size="mini" @click="handleMove(scope.row)">移动</el-button>
|
||||
<el-button type="text" size="mini" @click="handleEdit(scope.row)">重命名</el-button>
|
||||
<el-button type="text" size="mini" @click="handleRemark(scope.row)">备注</el-button>
|
||||
|
|
@ -98,7 +103,13 @@
|
|||
<el-form :model="questionForm" ref="questionForm" size="small" label-width="80px" :rules="questionRules">
|
||||
<el-form-item :label="questionLabel">
|
||||
<!-- 使用树下拉 -->
|
||||
<el-input v-model="questionForm.selectedTree" placeholder="请选择位置" @focus="showTree = true" readonly v-no-whitespace/>
|
||||
<el-input
|
||||
v-model="questionForm.selectedTree"
|
||||
placeholder="请选择位置"
|
||||
@focus="showTree = true"
|
||||
readonly
|
||||
v-no-whitespace
|
||||
/>
|
||||
<el-tree
|
||||
v-show="showTree"
|
||||
:data="treeData"
|
||||
|
|
@ -113,7 +124,8 @@
|
|||
<el-form-item label="课件名称" prop="coursewareName" v-if="!isMove">
|
||||
<el-input
|
||||
v-model="questionForm.coursewareName"
|
||||
maxlength="100" v-no-whitespace
|
||||
maxlength="100"
|
||||
v-no-whitespace
|
||||
show-word-limit
|
||||
placeholder="请输入课件名称"
|
||||
clearable
|
||||
|
|
@ -130,26 +142,28 @@
|
|||
<el-dialog :title="editAndRemark" :visible.sync="dialogVisible" width="25%">
|
||||
<el-form :model="dialogForm" ref="dialogForm" size="small" label-width="80px" :rules="rules">
|
||||
<el-form-item label="旧的名称" prop="oldCoursewareName" v-if="isEdit">
|
||||
<el-input v-model="dialogForm.oldCoursewareName" disabled v-no-whitespace/>
|
||||
<el-input v-model="dialogForm.oldCoursewareName" disabled v-no-whitespace />
|
||||
</el-form-item>
|
||||
<el-form-item label="新的名称" prop="coursewareName" v-if="isEdit">
|
||||
<el-input
|
||||
v-model="dialogForm.coursewareName"
|
||||
maxlength="100"
|
||||
show-word-limit v-no-whitespace
|
||||
show-word-limit
|
||||
v-no-whitespace
|
||||
placeholder="请输入文件名"
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="文件名称" prop="oldCoursewareName" v-if="isRemark">
|
||||
<el-input v-model="dialogForm.oldCoursewareName" disabled v-no-whitespace/>
|
||||
<el-input v-model="dialogForm.oldCoursewareName" disabled v-no-whitespace />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="marl" v-if="isRemark">
|
||||
<el-input
|
||||
type="textarea"
|
||||
v-model="dialogForm.marl"
|
||||
placeholder="请输入备注"
|
||||
clearable v-no-whitespace
|
||||
clearable
|
||||
v-no-whitespace
|
||||
maxlength="255"
|
||||
show-word-limit
|
||||
rows="5"
|
||||
|
|
@ -163,12 +177,23 @@
|
|||
</el-dialog>
|
||||
|
||||
<!-- 上传弹框 -->
|
||||
<el-dialog ref="upload" title="上传文件" :visible.sync="uploadVisible" width="55%" style="height: 75vh"
|
||||
:destroy-on-close="true"
|
||||
<el-dialog
|
||||
ref="upload"
|
||||
title="上传文件"
|
||||
:visible.sync="uploadVisible"
|
||||
width="55%"
|
||||
style="height: 75vh"
|
||||
:destroy-on-close="true"
|
||||
>
|
||||
<div style="height: 50vh">
|
||||
<mini-file-upload file-url="" ref="miniUpload" parent-id="" :params-data="row" v-on:uploadSuccess="uploadSuccess" />
|
||||
<div style="height: 5vh; position: absolute;left: 82%;top: 87%">
|
||||
<mini-file-upload
|
||||
file-url=""
|
||||
ref="miniUpload"
|
||||
parent-id=""
|
||||
:params-data="row"
|
||||
v-on:uploadSuccess="uploadSuccess"
|
||||
/>
|
||||
<div style="height: 5vh; position: absolute; left: 82%; top: 87%">
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button size="small" type="primary" @click="startUpload" v-preventReClick="5000">确 定</el-button>
|
||||
<el-button size="small" @click="uploadVisible = false">取 消</el-button>
|
||||
|
|
@ -176,6 +201,12 @@
|
|||
</div>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog title="文件查看" :visible.sync="documentPreview" width="80%" top="5vh" append-to-body>
|
||||
<div style="width: 100%; height: 720px">
|
||||
<bns-kkFile-preview :items="kkFilePreview"></bns-kkFile-preview>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
|
@ -187,17 +218,25 @@ import {
|
|||
operFolderOrFile,
|
||||
uploadFiles,
|
||||
downLoadFile,
|
||||
downLoadCoursewareFile
|
||||
downLoadCoursewareFile,
|
||||
} from '@/api/educationalTraining/resourceAdministration'
|
||||
import axios from 'axios'
|
||||
import { getToken } from '@/utils/auth'
|
||||
import { download } from '@/utils/request'
|
||||
import MiniFileUpload from '@/views/educationalTraining/resourceAdministration/coursewareStore/miniFileUpload.vue'
|
||||
|
||||
import bnsKkFilePreview from '@/components/pro-tabs/bns-kkFile-preview.vue'
|
||||
|
||||
export default {
|
||||
components: { MiniFileUpload },
|
||||
components: { MiniFileUpload, bnsKkFilePreview },
|
||||
data() {
|
||||
return {
|
||||
documentPreview: false, // 文件预览
|
||||
kkFilePreview: {
|
||||
filePreviewUrl: '',
|
||||
fileName: '',
|
||||
showDownloadButton: false,
|
||||
}, // 文件预览列表
|
||||
fullscreenLoading: false, // 上传loading
|
||||
uploadVisible: false, // 上传弹框
|
||||
fileList: [], // 上传文件列表
|
||||
|
|
@ -206,7 +245,7 @@ export default {
|
|||
// 查询参数
|
||||
queryParams: {
|
||||
// 关键字
|
||||
keyWord: ''
|
||||
keyWord: '',
|
||||
},
|
||||
// 列表数据
|
||||
tableData: [],
|
||||
|
|
@ -216,20 +255,20 @@ export default {
|
|||
dialogForm: {
|
||||
coursewareName: '', // 课件名
|
||||
oldCoursewareName: '', // 旧的名称
|
||||
marl: '' // 备注
|
||||
marl: '', // 备注
|
||||
},
|
||||
isEdit: false, // 是否重命名
|
||||
isRemark: false, // 是否备注
|
||||
isMove: false, // 是否移动
|
||||
// 弹框表单验证
|
||||
rules: {
|
||||
coursewareName: [{ required: true, message: '请输入课件名', trigger: 'blur' }]
|
||||
coursewareName: [{ required: true, message: '请输入课件名', trigger: 'blur' }],
|
||||
},
|
||||
showTree: false, // 是否显示树
|
||||
treeData: [], // 树数据
|
||||
defaultProps: {
|
||||
children: 'children',
|
||||
label: 'coursewareName'
|
||||
label: 'coursewareName',
|
||||
},
|
||||
// 新建题库
|
||||
questionTitle: '新建题库', // 弹框标题
|
||||
|
|
@ -237,52 +276,51 @@ export default {
|
|||
questionForm: {
|
||||
coursewareName: '', // 题库名称
|
||||
selectedTree: '', // 选中的树节点
|
||||
parentId: 0 // 父级id
|
||||
parentId: 0, // 父级id
|
||||
},
|
||||
questionRules: {
|
||||
coursewareName: [{ required: true, message: '请输入题库名称', trigger: 'blur' }]
|
||||
coursewareName: [{ required: true, message: '请输入题库名称', trigger: 'blur' }],
|
||||
},
|
||||
questionLabel: '位置',
|
||||
row: {}, // 当前行
|
||||
editAndRemark: '重命名', // 弹框标题
|
||||
downLoading: false, // 下载loading
|
||||
coursewareIds: [], // 选中的课件id
|
||||
isSelect:false
|
||||
isSelect: false,
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getList()
|
||||
},
|
||||
mounted() {
|
||||
},
|
||||
mounted() {},
|
||||
methods: {
|
||||
isSelectable(row, index) {
|
||||
return ![1, 2].includes(Number(row.fileType));
|
||||
return ![1, 2].includes(Number(row.fileType))
|
||||
},
|
||||
handleSelectAll() {
|
||||
if (!this.isSelect){
|
||||
this.coursewareIds = this.getCoursewareIds(this.tableData);
|
||||
if (!this.isSelect) {
|
||||
this.coursewareIds = this.getCoursewareIds(this.tableData)
|
||||
//设置可选状态的行 选中
|
||||
this.isSelect = true
|
||||
}else{
|
||||
} else {
|
||||
this.$refs.table.clearSelection()
|
||||
this.coursewareIds = []
|
||||
this.isSelect = false
|
||||
}
|
||||
},
|
||||
getCoursewareIds(data) {
|
||||
let ids = [];
|
||||
let ids = []
|
||||
data.forEach(node => {
|
||||
console.log('🚀 ~ getCoursewareIds ~ node:', node)
|
||||
if (node.coursewareId && Number(node.fileType) !== 1 && Number(node.fileType) !== 2) {
|
||||
this.$refs.table.toggleRowSelection(node, true);
|
||||
ids.push(node.coursewareId);
|
||||
this.$refs.table.toggleRowSelection(node, true)
|
||||
ids.push(node.coursewareId)
|
||||
}
|
||||
if (node.children && node.children.length > 0) {
|
||||
ids = ids.concat(this.getCoursewareIds(node.children));
|
||||
ids = ids.concat(this.getCoursewareIds(node.children))
|
||||
}
|
||||
});
|
||||
return ids;
|
||||
})
|
||||
return ids
|
||||
},
|
||||
handleSelectionChange(val) {
|
||||
this.coursewareIds = val.map(item => item.coursewareId).join(',')
|
||||
|
|
@ -408,7 +446,7 @@ export default {
|
|||
// 批量下载
|
||||
const params = {
|
||||
coursewareId: this.coursewareIds,
|
||||
fileType: 1
|
||||
fileType: 1,
|
||||
}
|
||||
console.log('🚀 ~ handleDownload ~ params:', params)
|
||||
download('/exam/coursewareLibrary/downLoadFile', params, '课件库.zip').then(res => {
|
||||
|
|
@ -421,7 +459,7 @@ export default {
|
|||
}
|
||||
const params = {
|
||||
coursewareId: row.coursewareId,
|
||||
fileType: row.fileType
|
||||
fileType: row.fileType,
|
||||
}
|
||||
// dev-api/exam/coursewareLibrary/downLoadFile
|
||||
// 获取当前的 location.origin
|
||||
|
|
@ -534,14 +572,14 @@ export default {
|
|||
this.$confirm('是否确认删除?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
type: 'warning',
|
||||
}).then(() => {
|
||||
// 确定
|
||||
operFolderOrFile({
|
||||
operType: 3,
|
||||
coursewareId: row.coursewareId,
|
||||
fileType: row.fileType,
|
||||
parentId: row.parentId
|
||||
parentId: row.parentId,
|
||||
}).then(res => {
|
||||
console.log('🚀 ~ handleDelete ~ res:', res)
|
||||
// 刷新列表
|
||||
|
|
@ -564,7 +602,7 @@ export default {
|
|||
coursewareId: this.row.coursewareId,
|
||||
fileType: this.row.fileType,
|
||||
coursewareName: this.dialogForm.coursewareName,
|
||||
parentId: this.row.parentId
|
||||
parentId: this.row.parentId,
|
||||
}).then(res => {
|
||||
console.log('🚀 ~ handleSave ~ res:', res)
|
||||
// 关闭弹框
|
||||
|
|
@ -578,7 +616,7 @@ export default {
|
|||
operType: 2,
|
||||
coursewareId: this.row.coursewareId,
|
||||
fileType: this.row.fileType,
|
||||
marl: this.dialogForm.marl
|
||||
marl: this.dialogForm.marl,
|
||||
}).then(res => {
|
||||
console.log('🚀 ~ handleSave ~ res:', res)
|
||||
// 关闭弹框
|
||||
|
|
@ -595,7 +633,7 @@ export default {
|
|||
const params = {
|
||||
coursewareId: item.coursewareId,
|
||||
fileType: item.fileType,
|
||||
type: item.type
|
||||
type: item.type,
|
||||
}
|
||||
const res = await getCoursewareLibraryTree(params)
|
||||
console.log('🚀 ~ getCoursewareLibraryTree ~ res-位置树:', res)
|
||||
|
|
@ -637,7 +675,7 @@ export default {
|
|||
operType: 4,
|
||||
coursewareId: this.row.coursewareId,
|
||||
fileType: this.row.fileType,
|
||||
parentId: this.questionForm.parentId
|
||||
parentId: this.questionForm.parentId,
|
||||
}).then(res => {
|
||||
console.log('🚀 ~ handleQuestion ~ res:', res)
|
||||
// 关闭弹框
|
||||
|
|
@ -664,8 +702,15 @@ export default {
|
|||
uploadSuccess() {
|
||||
this.uploadVisible = false
|
||||
this.getList()
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// 文件预览按钮
|
||||
handlePreview(row) {
|
||||
this.kkFilePreview.filePreviewUrl = row.filePath
|
||||
this.kkFilePreview.fileName = row.coursewareName
|
||||
this.documentPreview = true
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue