|
@@ -375,7 +375,7 @@
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
<!-- 上传控件 - 始终显示 -->
|
|
<!-- 上传控件 - 始终显示 -->
|
|
|
<div class="upload-area-wrapper">
|
|
<div class="upload-area-wrapper">
|
|
|
<el-upload
|
|
<el-upload
|
|
@@ -740,7 +740,7 @@ export default {
|
|
|
currentCount = this.form.foodLicense.length;
|
|
currentCount = this.form.foodLicense.length;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// 只有当实际图片数量达到上限时才提示
|
|
// 只有当实际图片数量达到上限时才提示
|
|
|
if (currentCount >= 3) {
|
|
if (currentCount >= 3) {
|
|
|
this.$message.warning('最多只能上传3张图片');
|
|
this.$message.warning('最多只能上传3张图片');
|
|
@@ -945,6 +945,10 @@ export default {
|
|
|
},
|
|
},
|
|
|
submitForm() {
|
|
submitForm() {
|
|
|
this.$refs["form"].validate(valid => {
|
|
this.$refs["form"].validate(valid => {
|
|
|
|
|
+ // 添加所有执照有效性检查
|
|
|
|
|
+ if (!this.validateLicenses()) {
|
|
|
|
|
+ return; // 验证失败,停止提交
|
|
|
|
|
+ }
|
|
|
if (valid) {
|
|
if (valid) {
|
|
|
// 如果存在营业执照且不为空,先进行校验
|
|
// 如果存在营业执照且不为空,先进行校验
|
|
|
if (this.form.businessLicense) {
|
|
if (this.form.businessLicense) {
|
|
@@ -965,6 +969,75 @@ export default {
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
|
|
+ // 验证所有执照有效性验证方法
|
|
|
|
|
+ validateLicenses() {
|
|
|
|
|
+ // 验证营业执照
|
|
|
|
|
+ if (!this.validateSingleLicense(!this.switchValue, this.form.businessLicenseExpire, "营业执照")) {
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ // 验证2类医疗器械备案
|
|
|
|
|
+ if (!this.validateSingleLicense(!this.medicalDevice2ExpiryValue, this.form.medicalDevice2Expiry, "2类医疗器械备案")) {
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ // 验证食品经营许可证/备案凭证
|
|
|
|
|
+ if (!this.validateSingleLicense(!this.foodLicenseExpiryValue, this.form.foodLicenseExpiry, "食品经营许可证/备案凭证")) {
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ // 验证药品经营许可证(无长期有效开关,直接检查有效期)
|
|
|
|
|
+ if (!this.validateLicenseWithoutSwitch(this.form.drugLicenseExpiry, "药品经营许可证")) {
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ // 验证3类器械经营许可证(无长期有效开关,直接检查有效期)
|
|
|
|
|
+ if (!this.validateLicenseWithoutSwitch(this.form.medicalDevice3Expiry, "3类器械经营许可证")) {
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ return true;
|
|
|
|
|
+ },
|
|
|
|
|
+ // 验证单个执照的方法(适用于有长期有效开关的证件)
|
|
|
|
|
+ validateSingleLicense(isExpiryRequired, expiryDateRange, licenseName) {
|
|
|
|
|
+ // 如果不是长期有效,检查是否过期
|
|
|
|
|
+ if (isExpiryRequired) {
|
|
|
|
|
+ // 检查是否设置了有效期
|
|
|
|
|
+ if (!expiryDateRange || expiryDateRange.length !== 2) {
|
|
|
|
|
+ this.$message.warning(`请设置${licenseName}的有效期!`);
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ // 获取结束日期
|
|
|
|
|
+ const endDate = new Date(expiryDateRange[1]);
|
|
|
|
|
+ // 获取当前日期
|
|
|
|
|
+ const currentDate = new Date();
|
|
|
|
|
+ // 比较日期(忽略时间部分)
|
|
|
|
|
+ endDate.setHours(0, 0, 0, 0);
|
|
|
|
|
+ currentDate.setHours(0, 0, 0, 0);
|
|
|
|
|
+ // 如果结束日期早于当前日期,说明已过期
|
|
|
|
|
+ if (endDate < currentDate) {
|
|
|
|
|
+ this.$message.warning(`${licenseName}已过期,请更新${licenseName}有效期时间或设置为长期有效!`);
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return true;
|
|
|
|
|
+ },
|
|
|
|
|
+ // 验证无开关控制的证件有效期
|
|
|
|
|
+ validateLicenseWithoutSwitch(expiryDateRange, licenseName) {
|
|
|
|
|
+ // 检查是否设置了有效期
|
|
|
|
|
+ if (!expiryDateRange || expiryDateRange.length !== 2) {
|
|
|
|
|
+ this.$message.warning(`请设置${licenseName}的有效期!`);
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ // 获取结束日期
|
|
|
|
|
+ const endDate = new Date(expiryDateRange[1]);
|
|
|
|
|
+ // 获取当前日期
|
|
|
|
|
+ const currentDate = new Date();
|
|
|
|
|
+ // 比较日期(忽略时间部分)
|
|
|
|
|
+ endDate.setHours(0, 0, 0, 0);
|
|
|
|
|
+ currentDate.setHours(0, 0, 0, 0);
|
|
|
|
|
+ // 如果结束日期早于当前日期,说明已过期
|
|
|
|
|
+ if (endDate < currentDate) {
|
|
|
|
|
+ this.$message.warning(`${licenseName}已过期,请更新${licenseName}有效期时间!`);
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ return true;
|
|
|
|
|
+ },
|
|
|
|
|
|
|
|
/** 提交按钮 */
|
|
/** 提交按钮 */
|
|
|
submitFormData() {
|
|
submitFormData() {
|
|
@@ -1424,4 +1497,4 @@ export default {
|
|
|
cursor: pointer;
|
|
cursor: pointer;
|
|
|
font-size: 14px;
|
|
font-size: 14px;
|
|
|
}
|
|
}
|
|
|
-</style>
|
|
|
|
|
|
|
+</style>
|