|
|
@@ -1337,36 +1337,18 @@ export default {
|
|
|
handleUpdate() {
|
|
|
this.reset()
|
|
|
getStoreInfo().then(response => {
|
|
|
- this.form = response.data;
|
|
|
- // 确保 brokerageType 是字符串类型
|
|
|
- if (this.form.brokerageType) {
|
|
|
- this.form.brokerageType = this.form.brokerageType.toString();
|
|
|
- }
|
|
|
- // 处理食品经营许可证字段,将逗号分隔的字符串转换为数组
|
|
|
- if (this.form.foodLicense) {
|
|
|
- if (typeof this.form.foodLicense === 'string') {
|
|
|
- // 如果是逗号分隔的字符串,转换为数组
|
|
|
- this.form.foodLicense = this.form.foodLicense.split(',').filter(url => url.trim() !== '');
|
|
|
- } else if (!Array.isArray(this.form.foodLicense)) {
|
|
|
- // 如果既不是字符串也不是数组,初始化为空数组
|
|
|
- this.form.foodLicense = [];
|
|
|
- }
|
|
|
- } else {
|
|
|
- this.form.foodLicense = [];
|
|
|
+ const data = response.data || {};
|
|
|
+
|
|
|
+ if (data.brokerageType) {
|
|
|
+ data.brokerageType = data.brokerageType.toString();
|
|
|
}
|
|
|
- this.switchValue = this.form.isBusinessLicensePermanent == 1;
|
|
|
- this.switchMedicalValue = this.form.isMedicalDevice1ExpiryPermanent == 1;
|
|
|
- this.medicalDevice2ExpiryValue = this.form.isMedicalDevice2ExpiryPermanent == 1;
|
|
|
- this.medicalLicenseExpiryValue = this.form.isMedicalLicenseExpiryPermanent == 1;
|
|
|
- this.foodLicenseExpiryValue = this.form.isFoodLicenseExpiryPermanent == 1;
|
|
|
- if (this.form.drugScopeHasFrozen === undefined) {
|
|
|
- this.form.drugScopeHasFrozen = 0;
|
|
|
+ if (data.drugScopeHasFrozen === undefined) {
|
|
|
+ data.drugScopeHasFrozen = 0;
|
|
|
}
|
|
|
- this.open = true;
|
|
|
- this.title = "修改店铺";
|
|
|
- let str = this.form.shippingType
|
|
|
- this.form.shippingType = str.split(",")
|
|
|
- this.form.cityIds = ((this.form.cityIds).split(",")).map(Number)
|
|
|
+
|
|
|
+ // 空值保护,避免 split 报错导致后续日期等字段无法回填
|
|
|
+ data.shippingType = data.shippingType ? data.shippingType.split(',') : [];
|
|
|
+ data.cityIds = data.cityIds ? data.cityIds.split(',').map(Number) : [];
|
|
|
|
|
|
const dateFields = [
|
|
|
'drugLicenseExpiry',
|
|
|
@@ -1380,34 +1362,43 @@ export default {
|
|
|
dateFields.forEach(field => {
|
|
|
const startField = field + 'Start';
|
|
|
const endField = field + 'End';
|
|
|
- if (this.form[startField] && this.form[endField]) {
|
|
|
- this.$set(this.form, field, [this.form[startField], this.form[endField]]);
|
|
|
+ if (data[startField] && data[endField]) {
|
|
|
+ data[field] = [data[startField], data[endField]];
|
|
|
}
|
|
|
});
|
|
|
|
|
|
-
|
|
|
- // 入驻协议有效期
|
|
|
- if (this.form.settlementAgreementStart && this.form.settlementAgreementEnd) {
|
|
|
- this.$set(this.form, 'settlementAgreementExpiry', [
|
|
|
- this.form.settlementAgreementStart,
|
|
|
- this.form.settlementAgreementEnd
|
|
|
- ]);
|
|
|
+ if (data.settlementAgreementStart && data.settlementAgreementEnd) {
|
|
|
+ data.settlementAgreementExpiry = [data.settlementAgreementStart, data.settlementAgreementEnd];
|
|
|
}
|
|
|
-
|
|
|
- // 质量保证协议有效期
|
|
|
- if (this.form.qualityAssuranceAgreementStart && this.form.qualityAssuranceAgreementEnd) {
|
|
|
- this.$set(this.form, 'qualityAssuranceAgreementExpiry', [
|
|
|
- this.form.qualityAssuranceAgreementStart,
|
|
|
- this.form.qualityAssuranceAgreementEnd
|
|
|
- ]);
|
|
|
+ if (data.qualityAssuranceAgreementStart && data.qualityAssuranceAgreementEnd) {
|
|
|
+ data.qualityAssuranceAgreementExpiry = [data.qualityAssuranceAgreementStart, data.qualityAssuranceAgreementEnd];
|
|
|
}
|
|
|
- // 其它特殊资质有效期
|
|
|
- if (this.form.otherSpecialQualificationStart && this.form.otherSpecialQualificationEnd) {
|
|
|
- this.$set(this.form, 'otherSpecialQualificationExpiry', [
|
|
|
- this.form.otherSpecialQualificationStart,
|
|
|
- this.form.otherSpecialQualificationEnd
|
|
|
- ]);
|
|
|
+ if (data.otherSpecialQualificationStart && data.otherSpecialQualificationEnd) {
|
|
|
+ data.otherSpecialQualificationExpiry = [data.otherSpecialQualificationStart, data.otherSpecialQualificationEnd];
|
|
|
}
|
|
|
+
|
|
|
+ if (data.foodLicense) {
|
|
|
+ if (typeof data.foodLicense === 'string') {
|
|
|
+ data.foodLicense = data.foodLicense.split(',').filter(url => url.trim() !== '');
|
|
|
+ } else if (!Array.isArray(data.foodLicense)) {
|
|
|
+ data.foodLicense = [];
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ data.foodLicense = [];
|
|
|
+ }
|
|
|
+
|
|
|
+ this.form = data;
|
|
|
+
|
|
|
+ this.switchValue = this.form.isBusinessLicensePermanent == 1;
|
|
|
+ this.switchMedicalValue = this.form.isMedicalDevice1ExpiryPermanent == 1;
|
|
|
+ this.medicalDevice2ExpiryValue = this.form.isMedicalDevice2ExpiryPermanent == 1;
|
|
|
+ this.medicalLicenseExpiryValue = this.form.isMedicalLicenseExpiryPermanent == 1;
|
|
|
+ this.foodLicenseExpiryValue = this.form.isFoodLicenseExpiryPermanent == 1;
|
|
|
+ this.medicalDevice3ExpiryValue = this.form.isMedicalDevice3ExpiryPermanent == 1;
|
|
|
+ this.drugLicenseValue = this.form.isDrugLicensePermanent == 1;
|
|
|
+
|
|
|
+ this.open = true;
|
|
|
+ this.title = '修改店铺';
|
|
|
this.reportFileList = this.urlToFileList(this.form.reportUrl);
|
|
|
this.fileList = this.urlToFileList(this.form.filingUrl);
|
|
|
this.originalForm = JSON.parse(JSON.stringify(this.form));
|