| | |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="8"> |
| | | <el-col :span="12"> |
| | | <el-form-item prop="agency.certPath" label="资质证书"> |
| | | <el-upload accept="image/*" :action="state.uploadUrl" :headers="state.header" method="post" :on-success="(res, uploadFile)=>handleAvatarSuccess(res, uploadFile,'证书')" :on-exceed="showTip" :on-preview="handlePictureCardPreview" :limit='state.imgLimit' v-model:file-list="state.certList" list-type="picture-card" :before-upload="picSize" :on-remove="(file, uploadFiles)=>handleRemove(file, uploadFiles,'证书')" > |
| | | <el-icon><Plus /></el-icon> |
| | | <template #tip> |
| | | <div class="el-upload__tip">上传jpg/png图片尺寸小于5M,最多可上传1张</div> |
| | | <div class="el-upload__tip">上传jpg/png图片尺寸小于5M,最多可上传5张</div> |
| | | </template> |
| | | </el-upload> |
| | | </el-form-item> |
| | |
| | | busList: [], |
| | | fileList: [], |
| | | certList: [], |
| | | imgLimit: 1, |
| | | imgLimit: 5, |
| | | uploadUrl: import.meta.env.VITE_APP_BASE_API + '/system/common/uploadFile', |
| | | header: { |
| | | Authorization: 'Bearer ' + getToken() |
| | |
| | | { required: true, validator: equalToPassword, trigger: "blur" } |
| | | ] |
| | | }; |
| | | const cert = ref([]) |
| | | |
| | | const loading = ref(false) |
| | | const dialogVisible = ref(false) |
| | |
| | | state.fileList = imgUrl ? imgUrl.split(',').map(url => {return {url} }) : [] |
| | | } |
| | | if(res.data.certPath) { |
| | | const imgUrl = import.meta.env.VITE_APP_BASE_API + "/" + res.data.certPath |
| | | // cert.value.push(res.data.certPath) |
| | | const imgList = res.data.certPath.split(',') |
| | | cert.value = imgList |
| | | imgList.forEach((item,index) => { |
| | | if(item.includes(import.meta.env.VITE_APP_BASE_API)){ |
| | | |
| | | }else{ |
| | | imgList[index] = import.meta.env.VITE_APP_BASE_API + "/" + item |
| | | } |
| | | |
| | | }) |
| | | const imgUrl = imgList.join(',') |
| | | state.certList = imgUrl ? imgUrl.split(',').map(url => {return {url} }) : [] |
| | | } |
| | | |
| | |
| | | if(type === '上报表'){ |
| | | state.registerForm.agency.reportPath = res.data.path |
| | | }else { |
| | | state.registerForm.agency.certPath = res.data.path |
| | | cert.value.push(res.data.path) |
| | | state.registerForm.agency.certPath = cert.value.join(',') |
| | | console.log('cert',cert.value) |
| | | } |
| | | |
| | | }else{ |
| | |
| | | |
| | | const handleRemove = async (file, uploadFiles,type) => { |
| | | if(file && file.status == 'success'){ |
| | | |
| | | |
| | | let path = ''; |
| | | if(type === '上报表'){ |
| | | path = state.registerForm.agency.reportPath; |
| | | }else { |
| | | path = state.registerForm.agency.certPath; |
| | | path = file.url.substring(file.url.indexOf('upload')) |
| | | console.log('cert',cert.value) |
| | | cert.value = cert.value.filter(url => !file.url.includes(url)) |
| | | state.registerForm.agency.certPath = cert.value.join(',') |
| | | |
| | | } |
| | | const res = await delPic({path: path}) |
| | | if(res.code == 200){ |
| | |
| | | message: '文件已删除' |
| | | }) |
| | | }else{ |
| | | |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: res.message |
| | |
| | | const {confirmPassword,id, ...data} = JSON.parse(JSON.stringify(state.registerForm)) |
| | | data.password = Base64.encode(data.password) |
| | | data.agency.business = data.agency.business.join(',') |
| | | const cert = state.certList.map(item => item.response ?item.response.data.path:item.url) |
| | | data.agency.certPath = cert.join(',') |
| | | delete data.agency.area |
| | | delete data.agency.id |
| | | register(data).then(res => { |
| | |
| | | const {confirmPassword, ...data} = JSON.parse(JSON.stringify(state.registerForm)) |
| | | data.password = Base64.encode(data.password) |
| | | data.agency.business = data.agency.business.join(',') |
| | | console.log('rea',state.certList) |
| | | const cert = state.certList.map(item => item.response ?item.response.data.path:item.url) |
| | | data.agency.certPath = cert.join(',') |
| | | if(isReject.value) { |
| | | data.state = 1; |
| | | } |
| | | // delete data.agency.area |
| | | console.log('data',data) |
| | | // console.log('data',data) |
| | | editAgency(data).then(res => { |
| | | if(res.code == 200){ |
| | | ElMessage({ |
| | |
| | | proxy.$refs.registerRef.clearValidate() |
| | | state.fileList = [] |
| | | state.certList = [] |
| | | cert.value = [] |
| | | } |
| | | |
| | | defineExpose({ |