parent
76ae8c4fb1
commit
5aeb8a45d5
|
@ -1,7 +1,7 @@
|
|||
<template>
|
||||
<div v-loading="listLoading">
|
||||
<div style="padding:20px">
|
||||
<el-form ref="form" :model="form" label-width="210px">
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="210px">
|
||||
<!-- 动态生成表单项 -->
|
||||
<el-row v-for="(item, index) in uploadConfig" :key="index">
|
||||
<el-col :span="12">
|
||||
|
@ -40,12 +40,12 @@
|
|||
|
||||
<script>
|
||||
import Pagination from '@/components/Pagination' // 通过 el-pagination二次打包
|
||||
import {requestFN} from '@/utils/request'
|
||||
import { requestFN } from '@/utils/request'
|
||||
import SelectTree from '@/components/SelectTree'
|
||||
import {upload} from "../../../../../utils/upload";
|
||||
import { upload } from '../../../../../utils/upload'
|
||||
|
||||
export default {
|
||||
components: {Pagination, SelectTree},
|
||||
components: { Pagination, SelectTree },
|
||||
data() {
|
||||
return {
|
||||
listQuery: {
|
||||
|
@ -70,7 +70,7 @@ export default {
|
|||
VEHICLE_TYPE: '',
|
||||
CONTACT: '',
|
||||
PHONE: '',
|
||||
EMISSION_STANDARDS: '',
|
||||
EMISSION_STANDARDS: ''
|
||||
},
|
||||
form: {
|
||||
CORPINFO_ID: JSON.parse(sessionStorage.getItem('user')).CORPINFO_ID,
|
||||
|
@ -81,14 +81,19 @@ export default {
|
|||
TRANSPORT_PERMIT_FILE: '',
|
||||
HAZARDOUS_CHEMICALS_FILE: ''
|
||||
},
|
||||
rules: {
|
||||
REQUISITION_FILE: [{ required: true, message: '请上传智能口门管理系统账号申请单', trigger: 'blur' }],
|
||||
COMMITMENT_FILE: [{ required: true, message: '请上传智能口门管理系统使用承诺书', trigger: 'blur' }],
|
||||
LICENSE_FILE: [{ required: true, message: '请上传营业执照', trigger: 'blur' }]
|
||||
},
|
||||
uploadConfig: [
|
||||
{label: '智能口门管理系统账号申请单', prop: 'REQUISITION_FILE', hideUpload: false},
|
||||
{label: '智能口门管理系统使用承诺书', prop: 'COMMITMENT_FILE', hideUpload: false},
|
||||
{label: '营业执照', prop: 'LICENSE_FILE', hideUpload: false},
|
||||
{label: '道路运输经营许可证', prop: 'TRANSPORT_PERMIT_FILE', hideUpload: false},
|
||||
{label: '危险化学品经营许可证', prop: 'HAZARDOUS_CHEMICALS_FILE', hideUpload: false}
|
||||
{ label: '智能口门管理系统账号申请单', prop: 'REQUISITION_FILE', hideUpload: false },
|
||||
{ label: '智能口门管理系统使用承诺书', prop: 'COMMITMENT_FILE', hideUpload: false },
|
||||
{ label: '营业执照', prop: 'LICENSE_FILE', hideUpload: false },
|
||||
{ label: '道路运输经营许可证', prop: 'TRANSPORT_PERMIT_FILE', hideUpload: false },
|
||||
{ label: '危险化学品经营许可证', prop: 'HAZARDOUS_CHEMICALS_FILE', hideUpload: false }
|
||||
],
|
||||
urlfromdsfe:{}
|
||||
urlfromdsfe: {}
|
||||
}
|
||||
},
|
||||
async created() {
|
||||
|
@ -119,7 +124,7 @@ export default {
|
|||
getList() {
|
||||
this.listLoading = true
|
||||
requestFN(
|
||||
'/mkmj/management/carInfoList?showCount=' + this.listQuery.limit + '¤tPage=' + this.listQuery.page, this.form
|
||||
'/mkmj/management/carInfoList?showCount=' + this.listQuery.limit + '¤tPage=' + this.listQuery.page, this.form
|
||||
).then((data) => {
|
||||
console.log(data)
|
||||
this.listLoading = false
|
||||
|
@ -133,35 +138,35 @@ export default {
|
|||
},
|
||||
// 通用文件移除处理
|
||||
handleRemove(file, fileList, prop) {
|
||||
this.form[prop] = fileList;
|
||||
const configItem = this.uploadConfig.find(item => item.prop === prop);
|
||||
this.form[prop] = fileList
|
||||
const configItem = this.uploadConfig.find(item => item.prop === prop)
|
||||
if (configItem) {
|
||||
configItem.hideUpload = fileList.length >= 1;
|
||||
configItem.hideUpload = fileList.length >= 1
|
||||
}
|
||||
},
|
||||
// 通用文件上传处理
|
||||
handleChange(file, fileList, prop) {
|
||||
const types = ['image/jpeg', 'image/jpg', 'image/png'];
|
||||
const isImage = types.includes(file.raw.type);
|
||||
const types = ['image/jpeg', 'image/jpg', 'image/png']
|
||||
const isImage = types.includes(file.raw.type)
|
||||
if (!isImage) {
|
||||
this.$message.error('上传图片只能是 JPG、JPEG、PNG 格式!');
|
||||
fileList.pop();
|
||||
this.form[prop] = [];
|
||||
return;
|
||||
this.$message.error('上传图片只能是 JPG、JPEG、PNG 格式!')
|
||||
fileList.pop()
|
||||
this.form[prop] = []
|
||||
return
|
||||
}
|
||||
this.form[prop] = [];
|
||||
this.form[prop].push(file);
|
||||
const configItem = this.uploadConfig.find(item => item.prop === prop);
|
||||
this.form[prop] = []
|
||||
this.form[prop].push(file)
|
||||
const configItem = this.uploadConfig.find(item => item.prop === prop)
|
||||
if (configItem) {
|
||||
configItem.hideUpload = fileList.length >= 1;
|
||||
configItem.hideUpload = fileList.length >= 1
|
||||
}
|
||||
},
|
||||
getUploadedFiles() {
|
||||
try {
|
||||
this.listLoading = true
|
||||
requestFN(
|
||||
'/mkmj/management/getUploadedFiles',{
|
||||
MOTORCADE_ID :this.form.MOTORCADE_ID
|
||||
'/mkmj/management/getUploadedFiles', {
|
||||
MOTORCADE_ID: this.form.MOTORCADE_ID
|
||||
}
|
||||
).then((data) => {
|
||||
console.log(data)
|
||||
|
@ -174,47 +179,49 @@ export default {
|
|||
this.form[item.prop] = [{
|
||||
url: this.config.fileUrl + this.urlfromdsfe[item.prop],
|
||||
name: this.urlfromdsfe[item.prop].split('/').pop()
|
||||
}];
|
||||
}]
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
this.listLoading = false;
|
||||
this.listLoading = false
|
||||
}).catch((e) => {
|
||||
this.listLoading = false
|
||||
})
|
||||
|
||||
|
||||
|
||||
} catch (error) {
|
||||
console.error('获取已上传文件失败', error);
|
||||
console.error('获取已上传文件失败', error)
|
||||
}
|
||||
},
|
||||
confirm() {
|
||||
this.listLoading = true;
|
||||
console.log(this.form);
|
||||
const formData = new FormData();
|
||||
formData.append('CORPINFO_ID', this.form.CORPINFO_ID);
|
||||
formData.append("MOTORCADE_ID",this.form.MOTORCADE_ID);
|
||||
formData.append('REQUISITION_FILE', this.form.REQUISITION_FILE[0].raw);
|
||||
formData.append('COMMITMENT_FILE', this.form.COMMITMENT_FILE[0].raw);
|
||||
formData.append('LICENSE_FILE', this.form.LICENSE_FILE[0].raw);
|
||||
formData.append('TRANSPORT_PERMIT_FILE', this.form.TRANSPORT_PERMIT_FILE[0].raw);
|
||||
formData.append('HAZARDOUS_CHEMICALS_FILE', this.form.HAZARDOUS_CHEMICALS_FILE[0].raw);
|
||||
this.$refs.form.validate((valid) => {
|
||||
if (!valid) {
|
||||
return false
|
||||
}
|
||||
this.listLoading = true
|
||||
console.log(this.form)
|
||||
const formData = new FormData()
|
||||
formData.append('CORPINFO_ID', this.form.CORPINFO_ID)
|
||||
formData.append('MOTORCADE_ID', this.form.MOTORCADE_ID)
|
||||
formData.append('REQUISITION_FILE', this.form.REQUISITION_FILE[0].raw)
|
||||
formData.append('COMMITMENT_FILE', this.form.COMMITMENT_FILE[0].raw)
|
||||
formData.append('LICENSE_FILE', this.form.LICENSE_FILE[0].raw)
|
||||
formData.append('TRANSPORT_PERMIT_FILE', this.form.TRANSPORT_PERMIT_FILE[0].raw)
|
||||
formData.append('HAZARDOUS_CHEMICALS_FILE', this.form.HAZARDOUS_CHEMICALS_FILE[0].raw)
|
||||
|
||||
console.log(formData); // 打印 FormData 对象
|
||||
console.log(formData) // 打印 FormData 对象
|
||||
|
||||
upload(
|
||||
'/mkmj/management/fleetFilingApply',
|
||||
formData
|
||||
).then(response => {
|
||||
console.log('上传成功', response);
|
||||
this.listLoading = false;
|
||||
this.goBack()
|
||||
}).catch(error => {
|
||||
console.error('上传失败', error);
|
||||
this.listLoading = false;
|
||||
});
|
||||
upload(
|
||||
'/mkmj/management/fleetFilingApply',
|
||||
formData
|
||||
).then(response => {
|
||||
console.log('上传成功', response)
|
||||
this.listLoading = false
|
||||
this.goBack()
|
||||
}).catch(error => {
|
||||
console.error('上传失败', error)
|
||||
this.listLoading = false
|
||||
})
|
||||
})
|
||||
},
|
||||
goBack() {
|
||||
this.$parent.activeName = 'List'
|
||||
|
|
Loading…
Reference in New Issue