| | |
| | | <el-form-item label="模板名称:" prop="templateName"> |
| | | <el-input v-model.trim="state.form.templateName" :disabled="state.title =='查看'" placeholder="模板名称"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="分类:" prop="classify"> |
| | | <el-select v-model="state.form.classify" placeholder="请选择" style="width: 100%"> |
| | | <el-option |
| | | v-for="item in state.classifyList" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <!-- <el-form-item label="分类:" prop="classify">--> |
| | | <!-- <el-select v-model="state.form.classify" placeholder="请选择" style="width: 100%">--> |
| | | <!-- <el-option--> |
| | | <!-- v-for="item in state.classifyList"--> |
| | | <!-- :key="item.id"--> |
| | | <!-- :label="item.name"--> |
| | | <!-- :value="item.id"--> |
| | | <!-- />--> |
| | | <!-- </el-select>--> |
| | | <!-- </el-form-item>--> |
| | | <el-form-item label="模板文件:" prop="filePath"> |
| | | <el-upload accept=".doc,.docx,.pdf" :action="state.uploadUrl" :headers="state.header" method="post" :on-success="(res, uploadFile)=>handleAvatarSuccess(res, uploadFile)" :on-exceed="showTip" :limit='state.fileLimit' v-model:file-list="state.fileList" :before-upload="picSize" :on-remove="(file, uploadFiles)=>handleRemove(file, uploadFiles)" > |
| | | <el-button type="primary">点击上传</el-button> |
| | | <template #tip> |
| | | <div class="el-upload__tip">支持上传.doc、.docx、.pdf格式文档,尺寸小于5M,最多可上传1份</div> |
| | | <div class="el-upload__tip">支持上传.doc、.docx、.pdf格式文档,尺寸小于30M,最多可上传1份</div> |
| | | </template> |
| | | </el-upload> |
| | | </el-form-item> |
| | |
| | | if(value.filePath) { |
| | | const obj = { |
| | | url: value.filePath, |
| | | name: '模板文件' |
| | | name: value.templateName+value.format |
| | | } |
| | | state.fileList = [obj] |
| | | } |
| | |
| | | }); |
| | | } |
| | | const picSize = async (rawFile) => { |
| | | if(rawFile.size / 1024 / 1024 > 5){ |
| | | if(rawFile.size / 1024 / 1024 > 30){ |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: '文件大小不能超过5M' |
| | | message: '文件大小不能超过30M' |
| | | }); |
| | | return false |
| | | } |