master
xy 2 years ago
parent f7dc99442f
commit 3373b1b0d1

@ -309,7 +309,11 @@ export default {
class: "el-upload__tip", class: "el-upload__tip",
slot: "tip", slot: "tip",
}, },
"文件不超过500kb" [
h('span','支持文件格式:.docx.xlsx.pdf.png.jpg'),
h('br'),
h('span','单个文件不能超过50M')
]
), ),
]; ];
} }
@ -319,11 +323,12 @@ export default {
let props = {}; let props = {};
if (info.edit_input === "file" || info.edit_input === "files") { if (info.edit_input === "file" || info.edit_input === "files") {
props.fileList = this.file[info.field]; props.fileList = this.file[info.field];
props.accept = ".doc,.docx,.pdf,.jpg,.png,.xls,.xlsx"
props.beforeUpload = (file) => { props.beforeUpload = (file) => {
if (file.size / 1000 > 500) { if (file.size / 1000 > 50 * 1024) {
this.$message({ this.$message({
type: "warning", type: "warning",
message: "上传图片大小超过500kb", message: "上传文件大小超过50Mb",
}); });
return false; return false;
} }

@ -10,13 +10,18 @@
:action="action" :action="action"
:file-list="fileList" :file-list="fileList"
:auto-upload="false" :auto-upload="false"
accept=".doc,.docx,.pdf,.jpg,.png,.xls,.xlsx"
:before-upload="beforeUpload" :before-upload="beforeUpload"
:on-success="onSuccess" :on-success="onSuccess"
:on-remove="onRemove" :on-remove="onRemove"
:on-error="onError"> :on-error="onError">
<el-button slot="trigger" size="small" type="primary">选取文件</el-button> <el-button slot="trigger" size="small" type="primary">选取文件</el-button>
<el-button style="margin-left: 10px;" size="small" type="success" @click="$refs['upload'].submit()"></el-button> <el-button style="margin-left: 10px;" size="small" type="success" @click="$refs['upload'].submit()"></el-button>
<div slot="tip" class="el-upload__tip">只能上传jpg/png文件且不超过500kb</div> <div slot="tip" class="el-upload__tip">
<span>支持文件格式.docx.xlsx.pdf.png.jpg</span>
<br>
<span>单个文件不能超过50M</span>
</div>
</el-upload> </el-upload>
<formList ref="formList" @selected="selectedHandler"></formList> <formList ref="formList" @selected="selectedHandler"></formList>
@ -47,10 +52,10 @@ export default {
}, },
beforeUpload (file) { beforeUpload (file) {
if (file.size / 1000 > 500) { if (file.size / 1000 > 50 * 1024) {
this.$message({ this.$message({
type: "warning", type: "warning",
message: "上传图片大小超过500kb", message: "上传文件大小超过500Mb",
}); });
return false; return false;
} }

@ -43,21 +43,6 @@ export default {
width: 54, width: 54,
type: 'selection' type: 'selection'
}, },
{
key: 'nianfen',
title: '年份',
width: 100
},
{
key: 'wenjian',
title: '文件',
width: 120
},
{
key: 'bianhao',
title: '编号',
width: 120
},
{ {
key: 'files', key: 'files',
title: '附件', title: '附件',

Loading…
Cancel
Save