diff --git a/common/js/common/common.js b/common/js/common/common.js
index 995529cd..f2a974c7 100644
--- a/common/js/common/common.js
+++ b/common/js/common/common.js
@@ -143,7 +143,7 @@ export const get_indicator_location = (new_style) => {
* @param props 额外属性,包含自定义组和数据源等信息
* @returns 返回一个布尔值,表示是否符合条件
*/
-export const get_is_eligible = (field_list, condition, sourceList, isCustom, customGroupFieldId) => {
+export const get_is_eligible = (field_list, condition, sourceList, isCustom, isCustomGroup, customGroupFieldId) => {
try {
// 条件加特殊标识,避免选择的时候出现重复的
let new_field = condition.field;
@@ -155,23 +155,23 @@ export const get_is_eligible = (field_list, condition, sourceList, isCustom, cus
let option = {};
if (field_list) {
// 判断是否是自定义组并且 自定义组选则了对应的数据源
- if (!isCustom && !isEmpty(customGroupFieldId)) {
+ if (isCustomGroup && !isEmpty(customGroupFieldId)) {
// 取出对应自定义组的内容
const group_option_list = field_list.find(item => item.field === customGroupFieldId);
// 取出自定义组内部数据源参数的详细数据
const new_field_list = group_option_list?.data || [];
// 通过对应条件,筛选出对应的数据
- option = new_field_list.find(item => item.field === condition.field);
+ option = new_field_list.find(item => item.field === new_field);
} else {
- option = field_list.find(item => item.field === condition.field);
+ option = field_list.find(item => item.field === new_field);
}
}
// 找不到对应的字段,就直接返回为成功,条件不存在
if (!isEmpty(option)) {
// 获取到字段的真实数据, option的使用主要是为了获取的他的中间参数和前缀,后缀等拼接在一起
- const field_value = custom_condition_data(condition.field || '', option || {}, sourceList, isCustom);
+ const field_value = custom_condition_data(new_field || '', option || {}, sourceList, isCustom);
// 判断条件字段是否为空并且是显示面板才会生效,则直接返回true
- if (!isEmpty(condition.field) && !isEmpty(condition.type)) {
+ if (!isEmpty(new_field) && !isEmpty(condition.type)) {
return custom_condition_judg(field_value, condition.type, condition.value);
} else {
return true;
diff --git a/components/diy/custom.vue b/components/diy/custom.vue
index 9fb54392..ebeedd35 100644
--- a/components/diy/custom.vue
+++ b/components/diy/custom.vue
@@ -9,7 +9,7 @@
-
+
@@ -22,7 +22,7 @@
-
+
diff --git a/components/diy/modules/custom/data-group-rendering.vue b/components/diy/modules/custom/data-group-rendering.vue
index 1d22f7f1..9fc6b951 100644
--- a/components/diy/modules/custom/data-group-rendering.vue
+++ b/components/diy/modules/custom/data-group-rendering.vue
@@ -2,19 +2,19 @@
-
+
-
+
-
+
-
+
-
+
@@ -68,6 +68,10 @@ export default {
type: Boolean,
default: false,
},
+ propIsCustomGroup: {
+ type: Boolean,
+ default: false
+ },
propShowData: {
type: Object,
default: () => ({
diff --git a/components/diy/modules/custom/data-rendering.vue b/components/diy/modules/custom/data-rendering.vue
index 86b2ebb5..784229f8 100644
--- a/components/diy/modules/custom/data-rendering.vue
+++ b/components/diy/modules/custom/data-rendering.vue
@@ -2,22 +2,22 @@
-
+
-
+
-
+
-
+
-
+
-
+
@@ -53,6 +53,12 @@ export default {
return {};
}
},
+ propGroupSourceList: {
+ type: Array,
+ default: () => {
+ return [];
+ }
+ },
propDataHeight: {
type: Number,
default: 0,
@@ -73,6 +79,10 @@ export default {
type: Boolean,
default: false,
},
+ propIsCustomGroup: {
+ type: Boolean,
+ default: false
+ },
propShowData: {
type: Object,
default: () => ({
diff --git a/components/diy/modules/custom/model-custom-group.vue b/components/diy/modules/custom/model-custom-group.vue
index 52f6b87e..b529f618 100644
--- a/components/diy/modules/custom/model-custom-group.vue
+++ b/components/diy/modules/custom/model-custom-group.vue
@@ -9,7 +9,7 @@
-
+
@@ -22,7 +22,7 @@
-
+
@@ -100,6 +100,19 @@
propFieldList: {
type: Array,
default: []
+ },
+ propGroupSourceList: {
+ type: Array,
+ default: () => {
+ return [];
+ }
+ },
+ propShowData: {
+ type: Object,
+ default: () => ({
+ data_key: 'id',
+ data_name: 'name',
+ })
}
},
data() {
@@ -177,9 +190,19 @@
init() {
const new_form = this.propValue;
const new_style = this.propValue.data_style;
- const list = this.get_data_source_content_list(this.propSourceList, new_form);
- // 数据来源的内容
- const new_list = list.length > 0 ? this.get_list(list, new_form, new_style) : [];
+ const data_source_id = new_form?.data_source_field?.id || '';
+ // 自定义组的数据源内容切换, 判断是取自定义组数据源内容还是取自定义数据源内容
+ const is_data_source_id = this.propFieldList.filter((item) => item.field == data_source_id);
+ let new_list = [];
+ // 如果自定义组选择了数据源,就按照自定义组的数据源的方式走,否则的话就按照自定义的数据走
+ if (is_data_source_id.length > 0) {
+ const list = this.get_data_source_content_list(this.propSourceList, new_form);
+ // 数据来源的内容
+ new_list = list.length > 0 ? this.get_list(list, new_form, new_style) : [];
+ } else {
+ // 自定义数据,专门为自定义组使用的数据
+ new_list = this.propGroupSourceList;
+ }
// 初始化数据
const { common_style, data_content_style, data_style } = new_style;
const old_width = this.propDataWidth * this.propScale;
@@ -246,11 +269,11 @@
get_is_show(form) {
// 取出条件判断的内容
const condition = form?.condition || { field: '', type: '', value: '' };
- return get_is_eligible(this.propFieldList, condition, this.propSourceList, this.propIsCustom, this.propCustomGroupFieldId);
+ return get_is_eligible(this.propFieldList, condition, this.propSourceList, this.propIsCustom, false, this.propCustomGroupFieldId);
},
get_data_source_content_list(sourceList, form) {
if (!isEmpty(sourceList)) {
- const data_source_id = form.data_source_field.id;
+ const data_source_id = form?.data_source_field.id || '';
let list = this.get_nested_property(sourceList, data_source_id);
// 如果是自定义标题,进一步处理嵌套对象中的数据
if (sourceList.data) {
diff --git a/components/diy/modules/custom/model-icon.vue b/components/diy/modules/custom/model-icon.vue
index f06e49ba..190a5d94 100644
--- a/components/diy/modules/custom/model-icon.vue
+++ b/components/diy/modules/custom/model-icon.vue
@@ -33,6 +33,10 @@
type: Boolean,
default: false
},
+ propIsCustomGroup: {
+ type: Boolean,
+ default: false
+ },
propCustomGroupFieldId: {
type: String,
default: ''
@@ -101,7 +105,7 @@
get_is_show(form) {
// 取出条件判断的内容
const condition = form?.condition || { field: '', type: '', value: '' };
- return get_is_eligible(this.propFieldList, condition, this.propSourceList, this.propIsCustom, this.propCustomGroupFieldId);
+ return get_is_eligible(this.propFieldList, condition, this.propSourceList, this.propIsCustom, this.propIsCustomGroup, this.propCustomGroupFieldId);
},
get_icon_link(new_form) {
let url = '';
diff --git a/components/diy/modules/custom/model-image.vue b/components/diy/modules/custom/model-image.vue
index 51742717..07e9240e 100644
--- a/components/diy/modules/custom/model-image.vue
+++ b/components/diy/modules/custom/model-image.vue
@@ -36,6 +36,10 @@
type: Boolean,
default: false
},
+ propIsCustomGroup: {
+ type: Boolean,
+ default: false
+ },
propImgParams: {
type: String,
default: ''
@@ -87,7 +91,7 @@
get_is_show(form) {
// 取出条件判断的内容
const condition = form?.condition || { field: '', type: '', value: '' };
- return get_is_eligible(this.propFieldList, condition, this.propSourceList, this.propIsCustom, this.propCustomGroupFieldId);
+ return get_is_eligible(this.propFieldList, condition, this.propSourceList, this.propIsCustom, this.propIsCustomGroup, this.propCustomGroupFieldId);
},
get_img_link() {
let url = '';
diff --git a/components/diy/modules/custom/model-lines.vue b/components/diy/modules/custom/model-lines.vue
index bb899263..2d2ae884 100644
--- a/components/diy/modules/custom/model-lines.vue
+++ b/components/diy/modules/custom/model-lines.vue
@@ -30,6 +30,10 @@
type: Boolean,
default: false
},
+ propIsCustomGroup: {
+ type: Boolean,
+ default: false
+ },
propCustomGroupFieldId: {
type: String,
default: ''
@@ -66,7 +70,7 @@
get_is_show(form) {
// 取出条件判断的内容
const condition = form?.condition || { field: '', type: '', value: '' };
- return get_is_eligible(this.propFieldList, condition, this.propSourceList, this.propIsCustom, this.propCustomGroupFieldId);
+ return get_is_eligible(this.propFieldList, condition, this.propSourceList, this.propIsCustom, this.propIsCustomGroup, this.propCustomGroupFieldId);
},
get_border_style(form, scale) {
if (form.line_settings === 'horizontal') {
diff --git a/components/diy/modules/custom/model-panel.vue b/components/diy/modules/custom/model-panel.vue
index d0672cc8..c9faa9a7 100644
--- a/components/diy/modules/custom/model-panel.vue
+++ b/components/diy/modules/custom/model-panel.vue
@@ -33,6 +33,10 @@
type: Boolean,
default: false
},
+ propIsCustomGroup: {
+ type: Boolean,
+ default: false
+ },
propCustomGroupFieldId: {
type: String,
default: ''
@@ -84,7 +88,7 @@
get_is_show(form) {
// 取出条件判断的内容
const condition = form?.condition || { field: '', type: '', value: '' };
- return get_is_eligible(this.propFieldList, condition, this.propSourceList, this.propIsCustom, this.propCustomGroupFieldId);
+ return get_is_eligible(this.propFieldList, condition, this.propSourceList, this.propIsCustom, this.propIsCustomGroup, this.propCustomGroupFieldId);
},
get_com_style(form, scale) {
let style = `${ gradient_handle(form.color_list, form.direction) } ${radius_computer(form.bg_radius, scale, true)}; transform: rotate(${form.panel_rotate}deg);`;
diff --git a/components/diy/modules/custom/model-text.vue b/components/diy/modules/custom/model-text.vue
index a0005149..c0414acf 100644
--- a/components/diy/modules/custom/model-text.vue
+++ b/components/diy/modules/custom/model-text.vue
@@ -40,6 +40,10 @@
type: Boolean,
default: false
},
+ propIsCustomGroup: {
+ type: Boolean,
+ default: false
+ },
propCustomGroupFieldId: {
type: String,
default: ''
@@ -102,7 +106,7 @@
get_is_show(form) {
// 取出条件判断的内容
const condition = form?.condition || { field: '', type: '', value: '' };
- return get_is_eligible(this.propFieldList, condition, this.propSourceList, this.propIsCustom, this.propCustomGroupFieldId);
+ return get_is_eligible(this.propFieldList, condition, this.propSourceList, this.propIsCustom, this.propIsCustomGroup, this.propCustomGroupFieldId);
},
get_text_title(form) {
let text = '';
@@ -111,7 +115,7 @@
let new_title = JSON.parse(JSON.stringify((form.text_title)));
let new_field_list = this.propFieldList;
// 判断是否是自定义组
- if (!this.propIsCustom && !isEmpty(this.propCustomGroupFieldId)) {
+ if (this.propIsCustomGroup && !isEmpty(this.propCustomGroupFieldId)) {
// 取出对应自定义组的内容
const group_option_list = new_field_list.find((item) => item.field === this.propCustomGroupFieldId);
// 取出自定义组内部数据源参数的详细数据
diff --git a/components/diy/modules/data-magic/custom/index.vue b/components/diy/modules/data-magic/custom/index.vue
index bf6e3ab6..06a5fad0 100644
--- a/components/diy/modules/data-magic/custom/index.vue
+++ b/components/diy/modules/data-magic/custom/index.vue
@@ -7,7 +7,7 @@
-
+
@@ -20,7 +20,7 @@
-
+