69 lines
1.6 KiB
Plaintext
69 lines
1.6 KiB
Plaintext
<template>
|
|
<div>
|
|
<el-row :gutter="15">
|
|
<el-form ref="financeTaskForm" :model="financeTaskFormData" :rules="rules" size="medium"
|
|
label-width="120px">
|
|
<el-col :span="24">
|
|
<el-form-item label="上传" prop="field101" required>
|
|
<el-upload ref="field101" :file-list="field101fileList" :action="field101Action"
|
|
:before-upload="field101BeforeUpload" list-type="picture-card">
|
|
<i class="el-icon-plus"></i>
|
|
</el-upload>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="24">
|
|
<el-form-item size="large">
|
|
<el-button type="primary" @click="submitForm">提交</el-button>
|
|
<el-button @click="resetForm">重置</el-button>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-form>
|
|
</el-row>
|
|
</div>
|
|
</template>
|
|
<script>
|
|
export default {
|
|
components: {},
|
|
props: [],
|
|
data() {
|
|
return {
|
|
financeTaskFormData: {
|
|
field101: null,
|
|
},
|
|
rules: {},
|
|
field101Action: '/dev-api/common/upload',
|
|
field101fileList: [],
|
|
}
|
|
},
|
|
computed: {},
|
|
watch: {},
|
|
created() {},
|
|
mounted() {},
|
|
methods: {
|
|
submitForm() {
|
|
this.$refs['financeTaskForm'].validate(valid => {
|
|
if (!valid) return
|
|
// TODO 提交表单
|
|
})
|
|
},
|
|
resetForm() {
|
|
this.$refs['financeTaskForm'].resetFields()
|
|
},
|
|
field101BeforeUpload(file) {
|
|
let isRightSize = file.size / 1024 / 1024 < 2
|
|
if (!isRightSize) {
|
|
this.$message.error('文件大小超过 2MB')
|
|
}
|
|
return isRightSize
|
|
},
|
|
}
|
|
}
|
|
|
|
</script>
|
|
<style>
|
|
.el-upload__tip {
|
|
line-height: 1.2;
|
|
}
|
|
|
|
</style>
|