修改逻辑处理1

master
于肖磊 2025-10-22 17:57:11 +08:00
parent a9d9833575
commit ee3d997e26
2 changed files with 12 additions and 27 deletions

View File

@ -874,7 +874,7 @@ export default {
const data = JSON.parse(JSON.stringify(this.filteredDiyData));
const filter_data_list = data.filter((item) => ['subform', 'position', 'rich-text', 'upload-attachments', 'upload-img', 'upload-video'].includes(item.key) && item.id === id);
if (filter_data_list.length > 0) {
filter_data_list?.forEach((item, index) => {
filter_data_list?.forEach((item) => {
let com_data = item.com_data;
let message = '';
if (item.key === 'subform') {
@ -888,22 +888,15 @@ export default {
message = `${com_data.title}${com_data.common_config.error_text}`;
} else {
//
const line_error = com_data.data_list.filter((item) => item.com_data.common_config.is_error === '1')
if (line_error.length > 0) {
const err_list = line_error[0].com_data;
//
if (err_list && err_list.common_config && err_list.common_config.is_error == '1') {
if (err_list.common_config.error_text == '此项为必填项') {
message = `请填写「${err_list.title}`;
} else {
message = `请正确填写「${err_list.title}`;
}
}
const error_data = com_data.data_list.some((item) => item.data_list.some((list_item) => list_item.com_data.common_config.is_error === '1'))
if (error_data) {
//
message = `请检查${com_data.title}内的填写`;
} else {
message = '';
}
}
this.on_item_event({ id: item.id, key: item.key, value: subform_data, is_error: is_error, error_text: message }, 'subform', index);
this.on_item_event({ id: item.id, key: item.key, value: subform_data, is_error: is_error, error_text: message }, 'subform');
} else {
//
if (com_data.is_required === '1') {
@ -925,12 +918,12 @@ export default {
/*
* 单个文件更新触发的事件
*/
on_item_event(e, type = '', index = '') {
on_item_event(e, type = '') {
// id
const data = this.data_list.find((item) => item.id == e.id);
//
if (data) {
const form_value = {};
let form_value = {};
const com_data = data.com_data;
const value = com_data.form_value;
const form_name = data.form_name;
@ -973,11 +966,11 @@ export default {
form_value[`${ form_name }_other_value`] = com_data?.other_value || '';
}
} else if (type == 'subform') {
form_value[`${ form_name }`] = e.value;
form_value = e.value;
} else {
form_value[`${ form_name }`] = com_data?.form_value || '';
}
this.$emit('onItemEvent', { forminput_id: this.propFormInputId, type: e.is_error == '1' ? 'error' : 'success', message: e.error_text, value: form_value, form_name: data.form_name, subform_index: index, form_title: data.com_data.title });
this.$emit('onItemEvent', { forminput_id: this.propFormInputId, status: e.is_error == '1' ? 'error' : 'success', message: e.error_text, value: form_value, form_name: data.form_name, form_title: data.com_data.title, key: data.key, type: data.com_data?.type || '' });
}
},
/*

View File

@ -8,20 +8,12 @@
<view v-else-if="data_item.key == 'multi-text'" :style="data_item.com_data.common_style + 'padding: 18rpx 22rpx;'">
<component-textarea :propValue="data_item.com_data" :propKey="propKey" :propDataId="data_item.id" :propStyle="propComponentStyle" @dataCheck="data_check" @dataChange="data_change"></component-textarea>
</view>
<!-- 复选按钮组 -->
<view v-else-if="['select-multi', 'checkbox'].includes(data_item.key) && data_item.com_data.type == 'checkbox' && propDirection !== 'row'">
<component-checkbox :propValue="data_item.com_data" :propKey="propKey" :propDataId="data_item.id" :propMobile="propMobile" :propStyle="propComponentStyle" @dataCheck="data_check" @dataChange="data_change" @dataOptionChange="data_option_change"></component-checkbox>
</view>
<!-- 单选按钮组 -->
<view v-else-if="['single-text', 'radio-btns', 'select'].includes(data_item.key) && data_item.com_data.type == 'radio-btns' && propDirection !== 'row'">
<component-radio :propValue="data_item.com_data" :propKey="propKey" :propDataId="data_item.id" :propMobile="propMobile" :propStyle="propComponentStyle" @dataCheck="data_check" @dataChange="data_change"></component-radio>
</view>
<!-- 下拉框 -->
<view v-else-if="(['single-text', 'radio-btns', 'select'].includes(data_item.key) && data_item.com_data.type == 'select') || (['single-text', 'radio-btns', 'select'].includes(data_item.key) && data_item.com_data.type == 'radio-btns' && propDirection == 'row')" :style="data_item.com_data.common_style">
<view v-else-if="['single-text', 'radio-btns', 'select'].includes(data_item.key) && ['radio-btns', 'select'].includes(data_item.com_data.type)" :style="data_item.com_data.common_style">
<component-select :propValue="data_item.com_data" :propKey="propKey" :propDataId="data_item.id" :propMobile="propMobile" :propDirection="propDirection" :propStyle="propComponentStyle" @dataCheck="data_check" @dataChange="data_change" @zIndexChange="z_index_change"></component-select>
</view>
<!-- 下拉复选框 -->
<view v-else-if="(['select-multi', 'checkbox'].includes(data_item.key) && data_item.com_data.type == 'select-multi') || (['select-multi', 'checkbox'].includes(data_item.key) && data_item.com_data.type == 'checkbox' && propDirection == 'row')" :style="data_item.com_data.common_style">
<view v-else-if="['select-multi', 'checkbox'].includes(data_item.key) && ['select-multi', 'checkbox'].includes(data_item.com_data.type)" :style="data_item.com_data.common_style">
<component-select-multi :propValue="data_item.com_data" :propKey="propKey" :propDataId="data_item.id" :propMobile="propMobile" :propDirection="propDirection" :propStyle="propComponentStyle" @dataCheck="data_check" @dataChange="data_change" @dataOptionChange="data_option_change" @zIndexChange="z_index_change"></component-select-multi>
</view>
<!-- 数字 -->