修改内容设置

master
于肖磊 2025-01-08 15:04:41 +08:00
parent bb84986cc1
commit 94f5a0c07e
3 changed files with 52 additions and 11 deletions

View File

@ -145,6 +145,12 @@ export const get_indicator_location = (new_style) => {
*/
export const get_is_eligible = (field_list, condition, sourceList, isCustom, customGroupFieldId) => {
try {
// 条件加特殊标识,避免选择的时候出现重复的
let new_field = condition.field;
// 如果包含{|},则取第一个字段
if (condition.field.includes('{|}')) {
new_field = condition.field.split('{|}')[0];
}
// 获取对应条件字段的字段数据
let option = {};
if (field_list) {
@ -160,11 +166,16 @@ export const get_is_eligible = (field_list, condition, sourceList, isCustom, cus
option = field_list.find(item => item.field === condition.field);
}
}
// 获取到字段的真实数据, option的使用主要是为了获取的他的中间参数和前缀后缀等拼接在一起
const field_value = custom_condition_data(condition.field || '', option || {}, sourceList, isCustom);
// 判断条件字段是否为空并且是显示面板才会生效则直接返回true
if (!isEmpty(condition.field) && !isEmpty(condition.type)) {
return custom_condition_judg(field_value, condition.type, condition.value);
// 找不到对应的字段,就直接返回为成功,条件不存在
if (!isEmpty(option)) {
// 获取到字段的真实数据, option的使用主要是为了获取的他的中间参数和前缀后缀等拼接在一起
const field_value = custom_condition_data(condition.field || '', option || {}, sourceList, isCustom);
// 判断条件字段是否为空并且是显示面板才会生效则直接返回true
if (!isEmpty(condition.field) && !isEmpty(condition.type)) {
return custom_condition_judg(field_value, condition.type, condition.value);
} else {
return true;
}
} else {
return true;
}

View File

@ -11,7 +11,7 @@
</view>
</template>
<script>
import { radius_computer, padding_computer, isEmpty, gradient_handle, get_nested_property, get_custom_link, get_is_eligible } from '@/common/js/common/common.js';
import { radius_computer, padding_computer, isEmpty, gradient_handle, get_nested_property, get_custom_link, get_is_eligible, custom_condition_data } from '@/common/js/common/common.js';
export default {
props: {
@ -92,7 +92,7 @@
}
this.setData({
form: new_form,
text_title: this.get_text_title(new_form),
text_title: (new_form?.text_captions || '') + this.get_text_title(new_form),
text_style: this.get_text_style(new_form, this.propScale),
com_style: this.get_com_style(new_form, this.propScale),
text_url: url,
@ -107,7 +107,32 @@
get_text_title(form) {
let text = '';
if (!isEmpty(form.text_title)) {
text = form.text_title;
//
let new_title = JSON.parse(JSON.stringify((form.text_title)));
let new_field_list = this.propFieldList;
//
if (!this.propIsCustom && !isEmpty(this.propCustomGroupFieldId)) {
//
const group_option_list = new_field_list.find((item) => item.field === this.propCustomGroupFieldId);
//
new_field_list = group_option_list?.data || [];
}
//
if (!isEmpty(new_field_list)) {
new_field_list.forEach((item) => {
const new_field = '${' + item.field + '}';
if (form.text_title.includes(new_field)) {
//
const field_value = custom_condition_data(item.field, item, this.propSourceList, this.propIsCustom);
// 使
const regular = new RegExp(`\\$\\{\\s*${item.field}\\s*\\}`, 'g');
// ,
new_title = new_title.replace(regular, field_value);
}
});
}
//
text = new_title;
} else {
let text_title = '';
// ID
@ -116,8 +141,9 @@
const option = form?.data_source_field?.option || [];
//
if (data_source_id.length > 0) {
text_title += form?.data_split?.left || '';
//
data_source_id.forEach(source_id => {
data_source_id.forEach((source_id, index) => {
const sourceList = option.find((item) => item.field == source_id);
// ID
if (source_id.includes(';')) {
@ -130,7 +156,11 @@
} else {
text_title += (sourceList?.first || '') + this.data_handling(source_id) + (sourceList?.last || '');
}
if (index < data_source_id.length - 1) {
text_title += form?.data_split?.middle || '';
}
});
text_title += form?.data_split?.right || '';
}
//
text = text_title;

View File

@ -149,8 +149,8 @@
this.setData({
tabs_data: new_tabs_data,
style_container: this.propIsCommon ? common_styles_computer(new_style.common_style) + new_tabs_background : new_content.tabs_top_up == '1' ? gradient_computer(new_style.common_style) + new_tabs_background : '', //
style_img_container: this.propIsCommon ? common_img_computer(new_style.common_style, this.propIndex) : new_content.tabs_top_up == '1' ? background_computer(new_style.common_style) + margin_computer(this.propSpacingCommonStyle) + padding_computer(this.propSpacingCommonStyle, 1, true) + 'box-sizing: border-box;' : '', //
style_container: this.propIsCommon ? common_styles_computer(new_style.common_style) + new_tabs_background : new_content.tabs_top_up == '1' ? gradient_computer(new_style.common_style) + margin_computer(this.propSpacingCommonStyle) + new_tabs_background : '', //
style_img_container: this.propIsCommon ? common_img_computer(new_style.common_style, this.propIndex) : new_content.tabs_top_up == '1' ? background_computer(new_style.common_style) + padding_computer(this.propSpacingCommonStyle, 1, true) + 'box-sizing: border-box;' : '', //
tabs_top_style: new_tabs_top_style,
//
top_up: new_top_up,