提交 c19b75fe authored 作者: 翟畅's avatar 翟畅

zc文件上传限制

上级 59ffad79
<template> <template>
<div> <!-- 导入 --> <div> <!-- 导入 -->
<el-dialog :title="title" :visible.sync="dialogImport" :close-on-click-modal="false" :before-close="close" @open="openDialog()" width="430px" class="importDialog"> <el-dialog :title="title" :visible.sync="dialogImport" :close-on-click-modal="false" :before-close="close" @open="openDialog()" width="430px" class="importDialog">
<div class="importTip">操作提示:全部上传完成前请勿关闭窗口,避免数据丢失!</div> <div class="importTip">操作提示:单次上传最多20个文件,全部上传完成前请勿关闭窗口,避免数据丢失!</div>
<el-upload <el-upload
class="upload-demo" class="upload-demo"
ref="upload" ref="upload"
:accept="accept" :accept="accept"
multiple multiple
:limit="20"
:action="`${courseUrl}${action}`" :action="`${courseUrl}${action}`"
:on-progress="getListLength"
:on-preview="handlePreview" :on-preview="handlePreview"
:on-remove="handleRemove" :on-remove="handleRemove"
:file-list="fileList" :file-list="fileList"
:on-exceed="handleExceed"
:on-success="handleSuccess" :on-success="handleSuccess"
:before-upload="beforeUpload"> :before-upload="beforeUpload">
<el-button type="primary" plain size="small">选择文件(可多选)</el-button> <el-button type="primary" plain size="small">选择文件(可多选)</el-button>
</el-upload> </el-upload>
<div class="tipNum">
<div class="selectLength">共选择上传数量:{{currentFileList.length}}</div>
<div class="uploadLength">已成功上传数量:{{commonList.length}}</div>
</div>
<div class="relationBook" v-if="type!='book'"> <div class="relationBook" v-if="type!='book'">
所属图书: 所属图书:
<el-select value-key="id" v-model="bookList.name" class="global_width" clearable filterable remote default-first-option placeholder="请输入并关联所属图书" :remote-method="getBookList" @clear="resourceBookList=[]" @change="selectChange"> <el-select value-key="id" v-model="bookList.name" class="global_width" clearable filterable remote default-first-option placeholder="请输入并关联所属图书" :remote-method="getBookList" @clear="resourceBookList=[]" @change="selectChange">
...@@ -83,6 +89,7 @@ export default { ...@@ -83,6 +89,7 @@ export default {
resourceBookList:[], resourceBookList:[],
showRelationDialog:false, showRelationDialog:false,
bookList: {}, bookList: {},
currentFileList:[],
} }
}, },
methods: { methods: {
...@@ -104,6 +111,9 @@ export default { ...@@ -104,6 +111,9 @@ export default {
handlePreview() { handlePreview() {
}, },
getListLength(event, file, fileList){
this.currentFileList = fileList
},
handleRemove(file, fileList) {//移除 handleRemove(file, fileList) {//移除
this.bookEpub = [] this.bookEpub = []
if(this.type == 'book') { if(this.type == 'book') {
...@@ -151,7 +161,7 @@ export default { ...@@ -151,7 +161,7 @@ export default {
} }
}, },
handleExceed(files, fileList) { //上传限制 handleExceed(files, fileList) { //上传限制
this.$message.warning(`当前限制选择 10 个文件`); this.$message.warning(`当前限制选择 20 个文件`);
}, },
beforeUpload(file) { beforeUpload(file) {
let type = file.name.slice(file.name.lastIndexOf('.')+1).toLowerCase() let type = file.name.slice(file.name.lastIndexOf('.')+1).toLowerCase()
...@@ -284,9 +294,25 @@ export default { ...@@ -284,9 +294,25 @@ export default {
padding: 0 6px; padding: 0 6px;
} }
.relationBook{ .relationBook{
padding-top: 20px; padding-top: 5px;
.book_list{ .book_list{
padding-top: 10px; padding-top: 10px;
} }
} }
.tipNum{
height: 30px;
display: flex;
justify-content: center;
align-items: center;
margin: 15px auto;
.selectLength{
font-size: 16px;
color: #DE0000;
padding-right:40px;
}
.uploadLength{
font-size: 16px;
color: #219177;
}
}
</style> </style>
\ No newline at end of file
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
multiple multiple
:limit="10" :limit="10"
:action="`${pdfFileUrl}`" :action="`${pdfFileUrl}`"
:on-progress="getListLength"
:on-preview="handlePreview" :on-preview="handlePreview"
:on-remove="handleRemove" :on-remove="handleRemove"
:file-list="fileList" :file-list="fileList"
...@@ -17,6 +18,10 @@ ...@@ -17,6 +18,10 @@
:before-upload="beforeUpload"> :before-upload="beforeUpload">
<el-button type="primary" plain size="small">选择文件(可多选)</el-button> <el-button type="primary" plain size="small">选择文件(可多选)</el-button>
</el-upload> </el-upload>
<div class="tipNum">
<div class="selectLength">共选择上传数量:{{currentFileList.length}}</div>
<div class="uploadLength">已成功上传数量:{{commonList.length}}</div>
</div>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button size="small" @click="cancelAll">全部取消</el-button> <el-button size="small" @click="cancelAll">全部取消</el-button>
<el-button size="small" style="background:#1F71FF;color:#fff" @click="importSubmit" :loading="sending">全部上传</el-button> <el-button size="small" style="background:#1F71FF;color:#fff" @click="importSubmit" :loading="sending">全部上传</el-button>
...@@ -62,6 +67,7 @@ export default { ...@@ -62,6 +67,7 @@ export default {
pdfFileUrl, pdfFileUrl,
bookEpub: [], bookEpub: [],
commonList: [], commonList: [],
currentFileList:[],
} }
}, },
methods: { methods: {
...@@ -117,6 +123,9 @@ export default { ...@@ -117,6 +123,9 @@ export default {
} }
} }
}, },
getListLength(event, file, fileList){
this.currentFileList = fileList
},
handleSuccess(response, file, fileList) { handleSuccess(response, file, fileList) {
this.$message.success('上传成功') this.$message.success('上传成功')
if(this.type == 'pdf') { //pdf if(this.type == 'pdf') { //pdf
...@@ -178,4 +187,20 @@ export default { ...@@ -178,4 +187,20 @@ export default {
margin-top: 14px; margin-top: 14px;
padding: 0 6px; padding: 0 6px;
} }
.tipNum{
height: 30px;
display: flex;
justify-content: center;
align-items: center;
margin: 15px auto;
.selectLength{
font-size: 16px;
color: #DE0000;
padding-right:40px;
}
.uploadLength{
font-size: 16px;
color: #219177;
}
}
</style> </style>
\ No newline at end of file
...@@ -168,8 +168,9 @@ import { getSelectionIds } from "@/filters/getIds"; ...@@ -168,8 +168,9 @@ import { getSelectionIds } from "@/filters/getIds";
import editPrice from "@/components/dialog/editPrice"; import editPrice from "@/components/dialog/editPrice";
import editSort from "@/components/dialog/editSort"; import editSort from "@/components/dialog/editSort";
import importDia from "@/components/dialog/import"; import importDia from "@/components/dialog/import";
import { pcUrl } from '@/utils/global' import { baseUrl, pcUrl, requestPath} from '@/utils/global'
import QRCode from "qrcodejs2"; import QRCode from "qrcodejs2";
import queryString from "query-string";
export default { export default {
name:'video_module', name:'video_module',
components: { components: {
...@@ -179,6 +180,7 @@ export default { ...@@ -179,6 +180,7 @@ export default {
}, },
data() { data() {
return { return {
requestPath,
topBtn:[], topBtn:[],
lineBtn:[], lineBtn:[],
classisyFlag:false, classisyFlag:false,
...@@ -341,9 +343,31 @@ export default { ...@@ -341,9 +343,31 @@ export default {
qrCodeLine: () => { qrCodeLine: () => {
this.qrCodeCreate(id) this.qrCodeCreate(id)
}, },
batchExportQrBtn: () => {
this.getBatchExport()
}
}; };
status[btnName](); status[btnName]();
}, },
getBatchExport(){
if (this.isExist(this.chooiceList)) {//至少选中一条
let ids = getSelectionIds(this.chooiceList);
let data = {
ids:ids
}
let {...params} = data
let tempParams = {}
for (const key in params) {
if (({}).hasOwnProperty.call(params, key) && params[key]!== null && params[key]!== '' && params[key]!== undefined) {
tempParams[key] = params[key]
}
}
let paramStr = queryString.stringify(tempParams)
confirm.apply(this, ["确定批量导出选中的视频二维码吗?"]).then(() => {
window.open(`${process.env.VUE_APP_BASE_API}${requestPath.resource}/video-library/batch/download?${paramStr}`)
});
}
},
qrCodeCreate(id){ qrCodeCreate(id){
this.centerQRDialogVisible = true this.centerQRDialogVisible = true
setTimeout(() => { setTimeout(() => {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论