From 4bc0d3e1611da659c853a3589d84cf41d91f13d2 Mon Sep 17 00:00:00 2001
From: zhouwenxuan <1175765986@qq.com>
Date: Wed, 10 Apr 2024 09:55:08 +0800
Subject: [PATCH] bug修改
---
src/layout/components/Register/index.vue | 44 +++++++++++++++++++++++++++++++++++++++-----
1 files changed, 39 insertions(+), 5 deletions(-)
diff --git a/src/layout/components/Register/index.vue b/src/layout/components/Register/index.vue
index e284428..1b29454 100644
--- a/src/layout/components/Register/index.vue
+++ b/src/layout/components/Register/index.vue
@@ -139,6 +139,18 @@
</el-row>
<el-row :gutter="30">
<el-col :span="8">
+ <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>
+ </template>
+ </el-upload>
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row :gutter="30">
+ <el-col :span="8">
<el-form-item prop="agency.assetValue" label="固定资产总值">
<el-input
v-model="registerForm.agency.assetValue"
@@ -213,7 +225,7 @@
<!-- </div>-->
<!-- </template>-->
<!-- </el-upload>-->
- <el-upload accept="image/*" :action="state.uploadUrl" :headers="state.header" method="post" :on-success="handleAvatarSuccess" :on-exceed="showTip" :on-preview="handlePictureCardPreview" :limit='state.imgLimit' v-model:file-list="state.fileList" list-type="picture-card" :before-upload="picSize" :on-remove="handleRemove" :before-remove="beforeRemove">
+ <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.fileList" 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>
@@ -320,6 +332,7 @@
areaList: [],
busList: [],
fileList: [],
+ certList: [],
imgLimit: 1,
uploadUrl: import.meta.env.VITE_APP_BASE_API + '/system/common/uploadFile',
header: {
@@ -351,6 +364,7 @@
regAddress: '',
business: '',
reportPath: '',
+ certPath: ''
},
username: '',
phone: '',
@@ -476,6 +490,7 @@
"agency.regAddress": [{required: true, trigger: "blur", message: "请输入注册地址"}],
"agency.business": [{required: true, trigger: "blur", message: "请选择申请的法定安全评价业务范围"}],
"agency.reportPath": [{required: true, trigger: "blur", message: "请上传加盖公章的《机构信息上报表》"}],
+ "agency.certPath": [{required: true, trigger: "blur", message: "请上传资质证书"}],
username: [{ required: true, trigger: "blur", validator: validateUsername }],
phone: [{ required: true, trigger: "blur", validator: validateUserPhone }],
password: [{ required: true, trigger: "blur", validator: validatePwd }],
@@ -537,6 +552,10 @@
if(res.data.reportPath) {
const imgUrl = import.meta.env.VITE_APP_BASE_API + "/" + res.data.reportPath
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
+ state.certList = imgUrl ? imgUrl.split(',').map(url => {return {url} }) : []
}
}else{
@@ -613,9 +632,15 @@
};
-const handleAvatarSuccess = (res, uploadFile) => {
+const handleAvatarSuccess = (res, uploadFile,type) => {
if(res.code == 200){
- state.registerForm.agency.reportPath = res.data.path
+ console.log("type",type)
+ if(type === '上报表'){
+ state.registerForm.agency.reportPath = res.data.path
+ }else {
+ state.registerForm.agency.certPath = res.data.path
+ }
+
}else{
ElMessage({
type: 'warning',
@@ -624,8 +649,14 @@
}
}
-const handleRemove = async (file, uploadFiles) => {
- const res = await delPic({path: state.registerForm.agency.reportPath})
+const handleRemove = async (file, uploadFiles,type) => {
+ let path = '';
+ if(type === '上报表'){
+ path = state.registerForm.agency.reportPath;
+ }else {
+ path = state.registerForm.agency.certPath;
+ }
+ const res = await delPic({path: path})
if(res.code == 200){
ElMessage({
type: 'success',
@@ -663,6 +694,7 @@
proxy.$refs.registerRef.resetFields()
proxy.$refs.registerRef.clearValidate()
state.fileList = []
+ state.certList = []
loading.value = false
// router.push("/homePage")
}).catch(() => {})
@@ -694,6 +726,7 @@
proxy.$refs.registerRef.resetFields()
proxy.$refs.registerRef.clearValidate()
state.fileList = []
+ state.certList = []
loading.value = false
}else{
@@ -715,6 +748,7 @@
proxy.$refs.registerRef.resetFields()
proxy.$refs.registerRef.clearValidate()
state.fileList = []
+ state.certList = []
}
defineExpose({
--
Gitblit v1.9.2