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