默认判断文件类型

main
MY-SH\lenovo 12 months ago
parent 16e5c64ae0
commit 2a9053ef8b

@ -20,7 +20,7 @@
<div class="el-upload__tip" slot="tip" v-if="showTip">
请上传
<template v-if="fileSize"> <b style="color: #f56c6c">{{ fileSize }}MB</b> </template>
<template v-if="fileType"> <b style="color: #f56c6c">{{ fileType.join("/") }}</b> </template>
<template v-if="fileType && noFileType==false "> 格式为 <b style="color: #f56c6c">{{ fileType.join("/") }}</b> </template>
的文件
</div>
</el-upload>
@ -66,6 +66,11 @@ export default {
isShowTip: {
type: Boolean,
default: true
},
//
noFileType: {
type: Boolean,
default: false
}
},
data() {
@ -113,6 +118,8 @@ export default {
methods: {
//
handleBeforeUpload(file) {
//
if(!this.noFileType){
//
if (this.fileType) {
const fileName = file.name.split('.');
@ -123,6 +130,7 @@ export default {
return false;
}
}
}
//
if (this.fileSize) {
const isLt = file.size / 1024 / 1024 < this.fileSize;

@ -138,7 +138,7 @@
</el-select>
</el-form-item>
<el-form-item label="上报模板" v-if="taskShow">
<file-upload v-model="form.fileTempName" :fileType="['md']"/>
<file-upload v-model="form.fileTempName" :noFileType="true" />
</el-form-item>
<el-form-item label="内容">
<editor v-model="form.displayContent" :min-height="192"/>
@ -157,11 +157,16 @@
</el-dialog>
<!-- 上报企业统计 -->
<el-dialog :title="title" :visible.sync="openFile" width="500px" append-to-body>
<el-table v-loading="loading" :data="ehsNoticeMessageFileList" @selection-change="handleSelectionChange" @cell-click="dload">
<el-table v-loading="loading" :data="ehsNoticeMessageFileList" @selection-change="handleSelectionChange">
<el-table-column label="部门名称" align="center" prop="deptName" />
<el-table-column label="上报情况" align="center" prop="originalName" >
<template slot-scope="scope">
<span> {{scope.row.originalName==null?"未上报":scope.row.originalName}}</span>
<span v-if="scope.row.originalName==null"></span>
<span v-else>
<el-tooltip class="item" effect="dark" content="点击下载文件" placement="right">
<el-link type="primary" @click="dload(scope.row)">{{scope.row.originalName}}</el-link>
</el-tooltip>
</span>
</template>
</el-table-column>
</el-table>
@ -170,7 +175,7 @@
small
:page.sync="pageNum"
:limit.sync="pageSize"
@pagination="handleListFile"
@pagination="diloagListFile"
:hide-on-single-page="true"
:total="total1">
</el-pagination>
@ -413,7 +418,7 @@ export default {
},
//
handleListFile(row){
diloagListFile(row){
this.loading = true;
this.openFile = true;
let data = { pageNum : this.pageNum, pageSize: this.pageSize, "noticeMessageId":row.noticeMessageId}

Loading…
Cancel
Save