修改地址校验逻辑处理和子表单校验处理

master
于肖磊 2025-10-22 18:47:28 +08:00
parent 2cff50bd8e
commit 341594259b
3 changed files with 27 additions and 9 deletions

View File

@ -145,9 +145,9 @@
});
//
const { is_error = '0', error_text = '' } = get_format_checks(this.com_data, data.province.id, false, 'address');
this.$emit('dataCheck', { is_error, error_text, value: [ data.province.id, data.city.id, data.areal.id ], id: this.propDataId });
this.$emit('dataCheck', { is_error, error_text, value: [ data.province.id, data.city.id, data.areal.id ], id: this.propDataId, province_name: data.province.name, city_name: data.city.name, county_name: data.areal.name });
// id
this.$emit('regionEvent', { value: [ data.province.id, data.city.id, data.areal.id ], province_name: data.province.name, city_name: data.city.name, county_name: data.areal.name, id: this.propDataId });
// this.$emit('regionEvent', { value: [ data.province.id, data.city.id, data.areal.id ], province_name: data.province.name, city_name: data.city.name, county_name: data.areal.name, id: this.propDataId });
},
input_value_event(e) {
//

View File

@ -47,7 +47,7 @@
</view>
<!-- 地址 -->
<view v-else-if="item.key == 'address'">
<component-address :propValue="item.com_data" :propKey="propKey" :propDataId="item.id" :propMobile="mobile" :propStyle="component_style" :propDirection="flex_direction" @dataCheck="data_check" @dataChange="data_change" @regionEvent="region_event" @dataAddressChange="data_address_change" @dataAddressBlur="data_address_blur" @zIndexChange="z_index_change"></component-address>
<component-address :propValue="item.com_data" :propKey="propKey" :propDataId="item.id" :propMobile="mobile" :propStyle="component_style" :propDirection="flex_direction" @dataCheck="data_check" @dataChange="data_change" @dataAddressChange="data_address_change" @dataAddressBlur="data_address_blur" @zIndexChange="z_index_change"></component-address>
</view>
<!-- 手机 -->
<view v-else-if="item.key == 'phone'">
@ -109,6 +109,7 @@
:propFormInputId="propFormInputId"
@helpIconEvent="subform_help_icon_event"
@subformDataChange="subform_data_change"
@subformDataCheck="subform_data_check"
@zIndexChange="z_index_change"
/>
</view>
@ -533,7 +534,7 @@ export default {
* 手机号验证码的校验
*/
data_code_check(e) {
const { is_error, error_text, value, id } = e;
const { is_error, error_text, value, id, province_name = '', city_name = '', county_name = '' } = e;
// id
const data = [...this.data_list];
data.forEach(item => {
@ -541,6 +542,11 @@ export default {
item.com_data.form_value_code = value;
item.com_data.common_config.is_error = is_error;
item.com_data.common_config.error_text = error_text;
if (item.key == 'address') {
item.com_data.province_name = province_name;
item.com_data.city_name = city_name;
item.com_data.county_name = county_name;
}
}
});
this.setData({ data_list: data });
@ -559,6 +565,16 @@ export default {
}
});
this.setData({ data_list: data });
},
subform_data_check(e, id) {
// id
const data = [...this.data_list];
data.forEach(item => {
if (item.id == id && item.com_data) {
item.com_data.data_list = e
}
});
this.setData({ data_list: data });
//
this.verify_when_data_changes(id);
},

View File

@ -58,7 +58,6 @@
@dataOptionChange="data_option_change"
@openRegion="open_region"
@helpIconEvent="subform_help_icon_event"
@regionEvent="region_event"
@zIndexChange="z_index_change"
/>
</template>
@ -112,7 +111,6 @@
@dataCheck="data_check"
@dataOptionChange="data_option_change"
@openRegion="open_region"
@regionEvent="region_event"
@zIndexChange="table_z_index_change"
/>
</view>
@ -160,7 +158,6 @@
@dataOptionChange="data_option_change"
@openRegion="open_region"
@helpIconEvent="subform_help_icon_event"
@regionEvent="region_event"
@zIndexChange="z_index_change"
/>
</view>
@ -498,7 +495,7 @@
},
//
data_check(e, index) {
const { is_error, error_text, value, id } = e;
const { is_error, error_text, value, id, province_name = '', city_name = '', county_name = '' } = e;
// id
const data = [...this.data_list];
data.forEach((item, index1) => {
@ -508,6 +505,11 @@
item1.com_data.form_value = value;
item1.com_data.common_config.is_error = is_error;
item1.com_data.common_config.error_text = error_text;
if (item1.key == 'address') {
item1.com_data.province_name = province_name;
item1.com_data.city_name = city_name;
item1.com_data.county_name = county_name;
}
}
});
}
@ -515,7 +517,7 @@
this.setData({
data_list: data
})
this.$emit('subformDataChange', data, this.propDataId);
this.$emit('subformDataCheck', data, this.propDataId);
},
//
data_change(e, index) {