修改默认数据处理问题
parent
529ec678f2
commit
7240fc729a
|
|
@ -100,7 +100,7 @@ onBeforeMount(() => {
|
||||||
// 获取到默认值
|
// 获取到默认值
|
||||||
const old_defalut = new_dataInterface.value[item.form_name];
|
const old_defalut = new_dataInterface.value[item.form_name];
|
||||||
// 默认值不为空的时候,进行处理查看当前数据是否存在默认值数据
|
// 默认值不为空的时候,进行处理查看当前数据是否存在默认值数据
|
||||||
if (old_defalut != '' && old_defalut != undefined && ['select', 'radio', 'checkout'].includes(item.type)) {
|
if (old_defalut !== '' && old_defalut !== undefined && ['select', 'radio', 'checkout'].includes(item.type)) {
|
||||||
if (item.type == 'select' && +item?.config?.is_level == 1) { // 如果是级联的效果
|
if (item.type == 'select' && +item?.config?.is_level == 1) { // 如果是级联的效果
|
||||||
const result = contains_value(options_list, item, [], item?.config?.children || '');
|
const result = contains_value(options_list, item, [], item?.config?.children || '');
|
||||||
new_dataInterface.value[item.form_name] = result;
|
new_dataInterface.value[item.form_name] = result;
|
||||||
|
|
|
||||||
|
|
@ -121,7 +121,7 @@ watchEffect(() => {
|
||||||
const staging_data : any = {};
|
const staging_data : any = {};
|
||||||
pagination_data.value = {
|
pagination_data.value = {
|
||||||
page: 1,
|
page: 1,
|
||||||
page_size: props?.config?.page_size || '',
|
page_size: props?.config?.page_size || undefined,
|
||||||
data_total: 0,
|
data_total: 0,
|
||||||
}
|
}
|
||||||
const filter_form_config = props?.config?.filter_form_config || [];
|
const filter_form_config = props?.config?.filter_form_config || [];
|
||||||
|
|
@ -131,11 +131,11 @@ watchEffect(() => {
|
||||||
filter_form_config.forEach((item: any) => {
|
filter_form_config.forEach((item: any) => {
|
||||||
let value : number | string | Array<any> = '';
|
let value : number | string | Array<any> = '';
|
||||||
if (item.type == 'checkbox' || item.type == 'select' && +item?.config?.is_multiple == 1) { // 多选
|
if (item.type == 'checkbox' || item.type == 'select' && +item?.config?.is_multiple == 1) { // 多选
|
||||||
value = item?.config?.default || [];
|
value = item?.config?.default ?? [];
|
||||||
} else if ((item.type == 'input' && item?.config?.type == 'number') || item.type == 'switch') { // 数字/开关
|
} else if ((item.type == 'input' && item?.config?.type == 'number') || item.type == 'switch') { // 数字/开关
|
||||||
value = Number(item?.config?.default || 0);
|
value = Number(item?.config?.default ?? 0);
|
||||||
} else { // 其他
|
} else { // 其他
|
||||||
value = item?.config?.default || '';
|
value = item?.config?.default ?? '';
|
||||||
}
|
}
|
||||||
staging_data[item.form_name] = value;
|
staging_data[item.form_name] = value;
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -325,11 +325,11 @@ const changeDataSource = (key: string) => {
|
||||||
default_type_data.value?.filter_config?.filter_form_config.forEach((item: any) => {
|
default_type_data.value?.filter_config?.filter_form_config.forEach((item: any) => {
|
||||||
let value : number | string | Array<any> = '';
|
let value : number | string | Array<any> = '';
|
||||||
if (item.type == 'checkbox' || (item.type == 'select' && +item?.config?.is_multiple == 1)) { // 多选
|
if (item.type == 'checkbox' || (item.type == 'select' && +item?.config?.is_multiple == 1)) { // 多选
|
||||||
value = item?.config?.default || [];
|
value = item?.config?.default ?? [];
|
||||||
} else if ((item.type == 'input' && item?.config?.type == 'number') || item.type == 'switch') { // 数字/开关
|
} else if ((item.type == 'input' && item?.config?.type == 'number') || item.type == 'switch') { // 数字/开关
|
||||||
value = Number(item?.config?.default || 0);
|
value = Number(item?.config?.default ?? 0);
|
||||||
} else {
|
} else {
|
||||||
value = item?.config?.default || '';
|
value = item?.config?.default ?? '';
|
||||||
}
|
}
|
||||||
staging_data[item.form_name] = value;
|
staging_data[item.form_name] = value;
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue