This commit is contained in:
Mrx
2026-04-06 17:34:42 +08:00
parent 7c2f828222
commit 33dc672440

View File

@@ -121,7 +121,7 @@
<!-- 暂时隐藏办公场地图片上传 -->
<el-row :gutter="16" class="mb-4">
<el-col :span="24">
<el-form-item label="办公场地照片">
<el-form-item label="办公场地照片" prop="officePlaceImageURLs">
<div class="text-xs mb-1 text-blue-500">
请在非 IE 浏览器下上传大小不超过 1M 的图片最多 10 需体现门楣 LOGO办公设备与工作人员
</div>
@@ -303,7 +303,7 @@
<el-row :gutter="16" class="mb-4">
<el-col :span="24">
<el-form-item label="应用场景附件">
<el-form-item label="应用场景附件" prop="scenarioAttachmentURLs">
<div class="text-xs mb-1 text-blue-500">
请在非 IE 浏览器下上传大小不超过 1M 的图片最多 10 张后台应用截图
</div>
@@ -493,6 +493,24 @@ const validatePhone = (rule, value, callback) => {
callback()
}
// 数组字段必填验证(至少上传/选择一项)
const validateRequiredArray = (message) => (rule, value, callback) => {
if (!Array.isArray(value) || value.length === 0) {
callback(new Error(message))
return
}
callback()
}
// 授权代表身份证要求:正反面都必须上传
const validateAuthorizedRepIDImages = (rule, value, callback) => {
if (!Array.isArray(value) || value.length < 2) {
callback(new Error('请上传授权代表身份证正反面图片'))
return
}
callback()
}
// 表单验证规则
const enterpriseRules = {
companyName: [
@@ -527,11 +545,17 @@ const enterpriseRules = {
businessLicenseImageURL: [
{ required: true, message: '请上传营业执照图片', trigger: 'change' }
],
officePlaceImageURLs: [
{ validator: validateRequiredArray('请上传办公场地照片'), trigger: 'change' }
],
// 暂时隐藏的表单项,校验已关闭,恢复显示时请还原
apiUsage: [
{ required: true, message: '请填写接口用途', trigger: 'blur' },
{ min: 5, max: 500, message: '接口用途长度应在5-500个字符之间', trigger: 'blur' }
],
scenarioAttachmentURLs: [
{ validator: validateRequiredArray('请上传应用场景附件'), trigger: 'change' }
],
authorizedRepName: [
{ required: true, message: '请输入授权代表姓名', trigger: 'blur' },
{ min: 2, max: 20, message: '授权代表姓名长度应在2-20个字符之间', trigger: 'blur' }
@@ -545,7 +569,7 @@ const enterpriseRules = {
{ validator: validatePhone, trigger: 'blur' }
],
authorizedRepIDImageURLs: [
{ required: true, message: '请上传授权代表身份证正反面图片', trigger: 'change' }
{ validator: validateAuthorizedRepIDImages, trigger: 'change' }
]
}
@@ -798,6 +822,7 @@ const updateAuthorizedRepIDImageURLs = () => {
if (frontUrl) urls.push(frontUrl)
if (backUrl) urls.push(backUrl)
form.value.authorizedRepIDImageURLs = urls
enterpriseFormRef.value?.validateField('authorizedRepIDImageURLs')
}
// 办公场地图片变更:选择即上传
@@ -807,11 +832,13 @@ const handleOfficePlaceChange = async (file, fileList) => {
await uploadFileOnceSelected(file)
}
form.value.officePlaceImageURLs = extractUrls(fileList)
enterpriseFormRef.value?.validateField('officePlaceImageURLs')
}
const handleOfficePlaceRemove = (file, fileList) => {
officePlaceFileList.value = fileList
form.value.officePlaceImageURLs = extractUrls(fileList)
enterpriseFormRef.value?.validateField('officePlaceImageURLs')
}
// 应用场景附件图片变更:选择即上传
@@ -821,11 +848,13 @@ const handleScenarioChange = async (file, fileList) => {
await uploadFileOnceSelected(file)
}
form.value.scenarioAttachmentURLs = extractUrls(fileList)
enterpriseFormRef.value?.validateField('scenarioAttachmentURLs')
}
const handleScenarioRemove = (file, fileList) => {
scenarioFileList.value = fileList
form.value.scenarioAttachmentURLs = extractUrls(fileList)
enterpriseFormRef.value?.validateField('scenarioAttachmentURLs')
}
// 提交表单