Commit 0ab8053f authored by 高滢's avatar 高滢

feat(检测方案): 添加声明文件

parent a0adf02f
<template> <template>
<div>
<div class="input-upload"> <div class="input-upload">
<el-input <el-input
v-bind="items" v-bind="items"
...@@ -12,10 +13,8 @@ ...@@ -12,10 +13,8 @@
<el-upload <el-upload
class="upload-demo" class="upload-demo"
:action="uploadImgUrl" :action="uploadImgUrl"
:on-preview="handlePreview"
v-model="model.file" v-model="model.file"
ref="fileUpload" ref="fileUpload"
:on-remove="handleRemove"
:before-remove="beforeRemove" :before-remove="beforeRemove"
:show-file-list="false" :show-file-list="false"
:limit="1" :limit="1"
...@@ -34,6 +33,30 @@ ...@@ -34,6 +33,30 @@
</div> </div>
</el-upload> </el-upload>
</div> </div>
<div v-if="prop=='chcek5'">
<el-upload
class="upload-demo"
:action="uploadImgUrl"
v-model="model.statementFile"
ref="fileUploadStatement"
:before-remove="beforeRemove"
:show-file-list="false"
:limit="1"
accept=".pdf ,.doc ,.docx ,.xls, .xlsx"
:on-success="handleSuccessFile"
:on-exceed="handleExceed"
:headers="headers"
>
<el-button size="small" :disabled="status" type="text"
>当车企没有授权的第三方应用时,点击此处上传声明文件</el-button>
<div slot="tip" class="el-upload__tip">
<div v-if="model.statementPath">
<el-link :href="model.statementPath">{{ model.statementName }}</el-link>
</div>
</div>
</el-upload>
</div>
</div>
</template> </template>
<script> <script>
export default { export default {
...@@ -60,7 +83,10 @@ export default { ...@@ -60,7 +83,10 @@ export default {
value: '', value: '',
file: '', file: '',
path: '', path: '',
name: '' name: '',
statementFile:'',
statementPath:'',
statementName:'',
}, },
headers: { headers: {
Authorization: 'Bearer ' + this.$store.getters.token Authorization: 'Bearer ' + this.$store.getters.token
...@@ -79,6 +105,7 @@ export default { ...@@ -79,6 +105,7 @@ export default {
} }
}, },
mounted() { mounted() {
console.log('12121212222222',this.prop)
if (this.defaultValue) { if (this.defaultValue) {
this.model = this.defaultValue this.model = this.defaultValue
this.$emit('changeVal', { name: this.prop, val: this.result }) this.$emit('changeVal', { name: this.prop, val: this.result })
...@@ -105,20 +132,18 @@ export default { ...@@ -105,20 +132,18 @@ export default {
value: '', value: '',
file: '', file: '',
path: '', path: '',
name: '' name: '',
statementFile:'',
statementPath:'',
statementName:'',
} }
}, },
setDefaultValue(val) { setDefaultValue(val) {
this.value = val this.value = val
}, },
handleRemove(file, fileList) {
console.log(file, fileList)
},
handlePreview(file) {
console.log(file)
},
handleSuccess(res, file) { handleSuccess(res, file) {
if (res.code === 200) { if (res.code === 200) {
console.log(this.model)
this.model.path = process.env.VUE_APP_IMAGE_API + res.url this.model.path = process.env.VUE_APP_IMAGE_API + res.url
this.model.name = res.originalFilename this.model.name = res.originalFilename
this.$refs.fileUpload.clearFiles() this.$refs.fileUpload.clearFiles()
...@@ -127,6 +152,17 @@ export default { ...@@ -127,6 +152,17 @@ export default {
this.$message.error('error') this.$message.error('error')
} }
}, },
handleSuccessFile(res, file) {
if (res.code === 200) {
console.log(this.model)
this.model.statementPath = process.env.VUE_APP_IMAGE_API + res.url
this.model.statementName = res.originalFilename
this.$refs.fileUploadStatement.clearFiles()
this.$message.success('上传成功')
} else {
this.$message.error('error')
}
},
handleExceed(files, fileList) { handleExceed(files, fileList) {
this.$message.warning( this.$message.warning(
`当前限制选择 1 个文件,本次选择了 ${files.length} 个文件,共选择了 ${ `当前限制选择 1 个文件,本次选择了 ${files.length} 个文件,共选择了 ${
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment