From 82317d6b3e5c0f34d87d438791fe0bd48ed15417 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8E=E8=82=96=E7=A3=8A?= <18851179580@163.com> Date: Mon, 13 Jan 2025 14:40:51 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=87=AA=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E7=BB=84=E5=86=85=E5=AE=B9=E7=9A=84=E5=A4=84=E7=90=86=E9=80=BB?= =?UTF-8?q?=E8=BE=91=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/carousel-indicator/index.vue | 2 +- .../custom-module/data-rendering/index.vue | 10 +++- .../model-custom-group/index.vue | 46 ++++++++++++++----- .../common/custom-module/model-icon/index.vue | 4 ++ .../custom-module/model-image/index.vue | 4 ++ .../custom-module/model-lines/index.vue | 4 ++ .../custom-module/model-panel/index.vue | 4 ++ .../common/custom-module/model-text/index.vue | 6 ++- .../model-carousel/model-carousel-content.vue | 10 +++- .../components/custom-config/index.vue | 25 ++++++++-- .../model-custom/components/index.vue | 14 +++--- src/components/model-custom/index.vue | 4 +- .../model-custom/model-custom-content.vue | 15 ++++-- .../components/custom/index.vue | 4 +- .../model-tabs-carousel-content.vue | 7 ++- .../model-tabs/model-tabs-content.vue | 10 +++- src/utils/index.ts | 2 +- 17 files changed, 130 insertions(+), 41 deletions(-) diff --git a/src/components/common/carousel-indicator/index.vue b/src/components/common/carousel-indicator/index.vue index 023fe003..7db034e3 100644 --- a/src/components/common/carousel-indicator/index.vue +++ b/src/components/common/carousel-indicator/index.vue @@ -3,7 +3,7 @@
- +
diff --git a/src/components/common/custom-module/data-rendering/index.vue b/src/components/common/custom-module/data-rendering/index.vue index 46b5c0d7..46f69c0e 100644 --- a/src/components/common/custom-module/data-rendering/index.vue +++ b/src/components/common/custom-module/data-rendering/index.vue @@ -2,7 +2,7 @@
@@ -66,6 +66,12 @@ const props = defineProps({ type: Boolean, default: false }, + groupSourceList: { + type: Array, + default: () => { + return []; + } + }, customGroupFieldId: { type: String, default: '' diff --git a/src/components/common/custom-module/model-custom-group/index.vue b/src/components/common/custom-module/model-custom-group/index.vue index 6fd64d0b..c1ec2921 100644 --- a/src/components/common/custom-module/model-custom-group/index.vue +++ b/src/components/common/custom-module/model-custom-group/index.vue @@ -8,7 +8,7 @@
- +
@@ -19,7 +19,7 @@
- +
@@ -38,7 +38,7 @@ @@ -87,6 +87,23 @@ const props = defineProps({ isCustom: { type: Boolean, default: false + }, + groupSourceList: { + type: Array, + default: () => { + return []; + } + }, + showData: { + type: Object as PropType<{ + data_key: string; + data_name: string; + data_logo?: string; + }>, + default: () => ({ + data_key: 'id', + data_name: 'name', + }) } }); // 用于页面判断显示 @@ -102,19 +119,24 @@ const is_show = computed(() => { //#region 自定义组真实数据 const data_source_content_list = computed(() => { - if (!isEmpty(props.sourceList)) { - const data_source_id = form.value.data_source_field.id; - let list = get_nested_property(props.sourceList, data_source_id); - // 如果是自定义标题,进一步处理嵌套对象中的数据 - if (props.sourceList.data) { - list = get_nested_property(props.sourceList.data, data_source_id); + const data_source_id = form.value?.data_source_field?.id || ''; + // 自定义组的数据源内容切换 + const is_data_source_id = field_list.value.filter((item: any) => item.field == data_source_id); + if (is_data_source_id.length > 0) { + if (!isEmpty(props.sourceList)) { + let list = get_nested_property(props.sourceList, data_source_id); + // 如果是自定义标题,进一步处理嵌套对象中的数据 + if (props.sourceList.data) { + list = get_nested_property(props.sourceList.data, data_source_id); + } + return list == '' ? [] : list; + } else { + return []; } - return list == '' ? [] : list; } else { - return []; + return props.groupSourceList; } }); - const get_nested_property = (obj: any, path: string) => { // 检查路径参数是否为字符串且非空,若不满足条件则返回空字符串 if (typeof path !== 'string' || !path) return []; diff --git a/src/components/common/custom-module/model-icon/index.vue b/src/components/common/custom-module/model-icon/index.vue index 87785781..1a9b9ffd 100644 --- a/src/components/common/custom-module/model-icon/index.vue +++ b/src/components/common/custom-module/model-icon/index.vue @@ -37,6 +37,10 @@ const props = defineProps({ type: Boolean, default: false }, + isCustomGroup: { + type: Boolean, + default: false + }, customGroupFieldId: { type: String, default: '' diff --git a/src/components/common/custom-module/model-image/index.vue b/src/components/common/custom-module/model-image/index.vue index 62a35308..1e8bb07c 100644 --- a/src/components/common/custom-module/model-image/index.vue +++ b/src/components/common/custom-module/model-image/index.vue @@ -32,6 +32,10 @@ const props = defineProps({ type: Boolean, default: false }, + isCustomGroup: { + type: Boolean, + default: false + }, customGroupFieldId: { type: String, default: '' diff --git a/src/components/common/custom-module/model-lines/index.vue b/src/components/common/custom-module/model-lines/index.vue index ba33120b..20b01dfd 100644 --- a/src/components/common/custom-module/model-lines/index.vue +++ b/src/components/common/custom-module/model-lines/index.vue @@ -26,6 +26,10 @@ const props = defineProps({ type: Boolean, default: false }, + isCustomGroup: { + type: Boolean, + default: false + }, customGroupFieldId: { type: String, default: '' diff --git a/src/components/common/custom-module/model-panel/index.vue b/src/components/common/custom-module/model-panel/index.vue index 35b89ffe..cd1fb763 100644 --- a/src/components/common/custom-module/model-panel/index.vue +++ b/src/components/common/custom-module/model-panel/index.vue @@ -28,6 +28,10 @@ const props = defineProps({ type: Boolean, default: false }, + isCustomGroup: { + type: Boolean, + default: false + }, customGroupFieldId: { type: String, default: '' diff --git a/src/components/common/custom-module/model-text/index.vue b/src/components/common/custom-module/model-text/index.vue index 3ec3ef79..fc5daf1b 100644 --- a/src/components/common/custom-module/model-text/index.vue +++ b/src/components/common/custom-module/model-text/index.vue @@ -39,6 +39,10 @@ const props = defineProps({ type: Boolean, default: false }, + isCustomGroup: { + type: Boolean, + default: false + }, customGroupFieldId: { type: String, default: '' @@ -87,7 +91,7 @@ const text_title = computed(() => { let new_title = cloneDeep(formValue.text_title); let new_field_list = field_list.value; // 判断是否是自定义组 - if (!props.isCustom && !isEmpty(props.customGroupFieldId)) { + if (props.isCustomGroup && !isEmpty(props.customGroupFieldId)) { // 取出对应自定义组的内容 const group_option_list = new_field_list.find((item: any) => item.field === props.customGroupFieldId); // 取出自定义组内部数据源参数的详细数据 diff --git a/src/components/model-carousel/model-carousel-content.vue b/src/components/model-carousel/model-carousel-content.vue index 97dd1948..8d5ce844 100644 --- a/src/components/model-carousel/model-carousel-content.vue +++ b/src/components/model-carousel/model-carousel-content.vue @@ -1,8 +1,10 @@