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

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

parent a0adf02f
<template> <template>
<div class="input-upload"> <div>
<el-input <div class="input-upload">
v-bind="items" <el-input
:disabled="status" v-bind="items"
v-model="model.value" :disabled="status"
style="width: 50%" v-model="model.value"
placeholder="请输入" style="width: 50%"
@input="input" placeholder="请输入"
/> @input="input"
/>
<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" :before-remove="beforeRemove"
:on-remove="handleRemove" :show-file-list="false"
:before-remove="beforeRemove" :limit="1"
:show-file-list="false" accept=".pdf ,.doc ,.docx ,.xls, .xlsx"
:limit="1" :on-success="handleSuccess"
accept=".pdf ,.doc ,.docx ,.xls, .xlsx" :on-exceed="handleExceed"
:on-success="handleSuccess" :headers="headers"
:on-exceed="handleExceed" >
:headers="headers" <el-button size="small" :disabled="status" type="primary"
>
<el-button size="small" :disabled="status" type="primary"
>上传文件</el-button >上传文件</el-button
>
<div slot="tip" class="el-upload__tip">
<div v-if="model.path">
<el-link :href="model.path">{{ model.name }}</el-link>
</div>
</div>
</el-upload>
</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"
> >
<div slot="tip" class="el-upload__tip"> <el-button size="small" :disabled="status" type="text"
<div v-if="model.path"> >当车企没有授权的第三方应用时,点击此处上传声明文件</el-button>
<el-link :href="model.path">{{ model.name }}</el-link> <div slot="tip" class="el-upload__tip">
<div v-if="model.statementPath">
<el-link :href="model.statementPath">{{ model.statementName }}</el-link>
</div>
</div> </div>
</div> </el-upload>
</el-upload> </div>
</div> </div>
</template> </template>
<script> <script>
...@@ -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