|
@@ -1437,15 +1437,6 @@ export default {
|
|
|
this.citys = res.data;
|
|
this.citys = res.data;
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
-
|
|
|
|
|
- licensehandleAvatarSuccess(res, file) {
|
|
|
|
|
- if (res.code === 200) {
|
|
|
|
|
- this.form.licenseImages = res.url;
|
|
|
|
|
- this.$forceUpdate()
|
|
|
|
|
- } else {
|
|
|
|
|
- this.msgError(res.msg);
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
handleAvatarSuccess(res, file) {
|
|
handleAvatarSuccess(res, file) {
|
|
|
if (res.code === 200) {
|
|
if (res.code === 200) {
|
|
|
this.form.logoUrl = res.url;
|
|
this.form.logoUrl = res.url;
|
|
@@ -1461,22 +1452,6 @@ export default {
|
|
|
}
|
|
}
|
|
|
return isLt1M;
|
|
return isLt1M;
|
|
|
},
|
|
},
|
|
|
- handleBizLicenseSuccess(res, file) {
|
|
|
|
|
- if (res.code === 200) {
|
|
|
|
|
- this.form.bizLicense = res.url;
|
|
|
|
|
- this.$forceUpdate()
|
|
|
|
|
- } else {
|
|
|
|
|
- this.msgError(res.msg);
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
- beforeBizLicenseUpload(file) {
|
|
|
|
|
- const isLt1M = file.size / 1024 / 1024 < 5;
|
|
|
|
|
- if (!isLt1M) {
|
|
|
|
|
- this.$message.error('上传图片大小不能超过 5MB!');
|
|
|
|
|
- }
|
|
|
|
|
- return isLt1M;
|
|
|
|
|
- },
|
|
|
|
|
-
|
|
|
|
|
// 通用文件上传成功处理函数
|
|
// 通用文件上传成功处理函数
|
|
|
handleFileSuccess(response, file, field) {
|
|
handleFileSuccess(response, file, field) {
|
|
|
if (response.code === 200) {
|
|
if (response.code === 200) {
|
|
@@ -1784,74 +1759,60 @@ export default {
|
|
|
},
|
|
},
|
|
|
// 验证所有执照有效性验证方法
|
|
// 验证所有执照有效性验证方法
|
|
|
validateLicenses() {
|
|
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, "药品经营许可证")) {
|
|
|
|
|
|
|
+ const currentDate = new Date();
|
|
|
|
|
+ //营业执照证
|
|
|
|
|
+ const businessLicenseExpireEndDate = new Date(this.form.businessLicenseExpire[1]);
|
|
|
|
|
+ if (businessLicenseExpireEndDate < currentDate) {
|
|
|
|
|
+ this.$message.warning('营业执照证已过期,无法提交');
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
- // 验证3类器械经营许可证(无长期有效开关,直接检查有效期)
|
|
|
|
|
- if (!this.validateLicenseWithoutSwitch(this.form.medicalDevice3Expiry, "3类器械经营许可证")) {
|
|
|
|
|
|
|
+ //药品经营许
|
|
|
|
|
+ const drugLicenseExpiryEndDate = new Date(this.form.drugLicenseExpiry[1]);
|
|
|
|
|
+ if (drugLicenseExpiryEndDate < currentDate) {
|
|
|
|
|
+ this.$message.warning('药品经营许可证已过期,无法提交');
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
- return true;
|
|
|
|
|
- },
|
|
|
|
|
- // 验证单个执照的方法(适用于有长期有效开关的证件)
|
|
|
|
|
- validateSingleLicense(isExpiryRequired, expiryDateRange, licenseName) {
|
|
|
|
|
- // 如果不是长期有效,检查是否过期
|
|
|
|
|
- if (isExpiryRequired) {
|
|
|
|
|
- // 检查是否设置了有效期
|
|
|
|
|
- if (!expiryDateRange || expiryDateRange.length !== 2) {
|
|
|
|
|
- this.$message.warning(`请设置${licenseName}的有效期!`);
|
|
|
|
|
|
|
+ //2类
|
|
|
|
|
+ if(!!this.form.medicalDevice2 && !this.medicalDevice2ExpiryValue){
|
|
|
|
|
+ if(!this.form.medicalDevice2Expiry){
|
|
|
|
|
+ this.$message.warning('2类医疗器械备案有效期不为空!');
|
|
|
return false;
|
|
return false;
|
|
|
|
|
+ }else{
|
|
|
|
|
+ const medicalDevice2ExpiryEndDate = new Date(this.form.medicalDevice2Expiry[1]);
|
|
|
|
|
+ if (medicalDevice2ExpiryEndDate < currentDate) {
|
|
|
|
|
+ this.$message.warning('2类医疗器械可证已过期,无法提交');
|
|
|
|
|
+ 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}有效期时间或设置为长期有效!`);
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+ //3类医疗器械备案
|
|
|
|
|
+ if(!!this.form.medicalDevice3 && !this.medicalDevice3ExpiryValue){
|
|
|
|
|
+ if(!this.form.medicalDevice3Expiry){
|
|
|
|
|
+ this.$message.warning('3类医疗器械备案有效期不为空!');
|
|
|
return false;
|
|
return false;
|
|
|
|
|
+ }else{
|
|
|
|
|
+ const medicalDevice3ExpiryEndDate = new Date(this.form.medicalDevice3Expiry[1]);
|
|
|
|
|
+ if (medicalDevice3ExpiryEndDate < currentDate) {
|
|
|
|
|
+ this.$message.warning('3类医疗器械可证已过期,无法提交');
|
|
|
|
|
+ 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;
|
|
|
|
|
|
|
+ //食品经营许可证
|
|
|
|
|
+ if(this.form.foodLicense.length > 0 && !this.foodLicenseExpiryValue){
|
|
|
|
|
+ if(!this.form.foodLicenseExpiry){
|
|
|
|
|
+ this.$message.warning('食品经营许可证/备案凭证有效期不为空!');
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }else{
|
|
|
|
|
+ const foodLicenseExpiryEndDate = new Date(this.form.foodLicenseExpiry[1]);
|
|
|
|
|
+ if (foodLicenseExpiryEndDate < currentDate) {
|
|
|
|
|
+ this.$message.warning('食品经营许可证/备案凭证已过期,无法提交');
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
return true;
|
|
return true;
|
|
|
},
|
|
},
|
|
|
-
|
|
|
|
|
/** 提交按钮 */
|
|
/** 提交按钮 */
|
|
|
submitForm() {
|
|
submitForm() {
|
|
|
this.$refs["form"].validate(valid => {
|
|
this.$refs["form"].validate(valid => {
|
|
@@ -1862,6 +1823,19 @@ export default {
|
|
|
}
|
|
}
|
|
|
// 处理表单数据
|
|
// 处理表单数据
|
|
|
const formData = Object.assign({}, this.form);
|
|
const formData = Object.assign({}, this.form);
|
|
|
|
|
+ //清空非必填日期控件
|
|
|
|
|
+ if(formData.medicalDevice2Expiry == null){
|
|
|
|
|
+ formData.medicalDevice2ExpiryEnd = null;
|
|
|
|
|
+ formData.medicalDevice2ExpiryStart = null;
|
|
|
|
|
+ }
|
|
|
|
|
+ if(formData.medicalDevice3Expiry == null){
|
|
|
|
|
+ formData.medicalDevice3ExpiryEnd = null;
|
|
|
|
|
+ formData.medicalDevice3ExpiryStart = null;
|
|
|
|
|
+ }
|
|
|
|
|
+ if(formData.foodLicenseExpiry == null){
|
|
|
|
|
+ formData.foodLicenseExpiryEnd = null;
|
|
|
|
|
+ formData.foodLicenseExpiryStart = null;
|
|
|
|
|
+ }
|
|
|
// 处理城市ID
|
|
// 处理城市ID
|
|
|
if (formData.cityIds) {
|
|
if (formData.cityIds) {
|
|
|
formData.cityIds = formData.cityIds.toString();
|
|
formData.cityIds = formData.cityIds.toString();
|