diff --git a/src/components/common/custom-module/model-text/index.vue b/src/components/common/custom-module/model-text/index.vue index 654cd50d..34239060 100644 --- a/src/components/common/custom-module/model-text/index.vue +++ b/src/components/common/custom-module/model-text/index.vue @@ -38,8 +38,8 @@ const text_title = computed(() => { let text = ''; if (!isEmpty(form.text_title)) { text = form.text_title; - } else if(!isEmpty(props.sourceList[form.data_source_id])) { - text = props.sourceList[form.data_source_id]; + } else if(props.sourceList[form.data_source_id] != undefined) { + text = props.sourceList[form.data_source_id]; } else if(!props.isPercentage){ text = '请在此输入文字'; } diff --git a/src/components/model-custom/model-custom-content.vue b/src/components/model-custom/model-custom-content.vue index 115855f5..2d4028bf 100644 --- a/src/components/model-custom/model-custom-content.vue +++ b/src/components/model-custom/model-custom-content.vue @@ -7,7 +7,7 @@ -
+
替换数据
@@ -75,6 +75,7 @@ interface data_list { type: string; } interface data_source_content { + appoint_data?: object; name: string; data: data_list[]; type: string; @@ -101,15 +102,21 @@ onBeforeMount(() => { }); // 处理显示的图片和传递到下去的数据结构 const model_data_source = ref([]); +const is_show_more = ref(true); const processing_data = (key: string) => { const list = options.value.filter((item) => item.type == key); if (list.length > 0) { model_data_source.value = list[0].data; - // 从中取出包含图片的内容 - const field_list = list[0].data.filter((item) => item.type == 'images'); - // 取出图片的key - if (field_list.length > 0) { - form.img_key = field_list[0].field; + if (!isEmpty(list[0].appoint_data)) { + is_show_more.value = false; + } else { + is_show_more.value = true; + // 从中取出包含图片的内容 + const field_list = list[0].data.filter((item) => item.type == 'images'); + // 取出图片的key + if (field_list.length > 0) { + form.img_key = field_list[0].field; + } } } else { model_data_source.value = []; @@ -158,10 +165,15 @@ const accomplish = () => { // 打开弹出框 const url_value_dialog_visible = ref(false); const changeDataSource = (key: string) => { + const type_data = options.value.filter((item) => item.type == key); processing_data(key); - form.data_source_content = {}; - if (!isEmpty(key)) { - url_value_dialog_visible.value = true; + if (type_data.length > 0 && !isEmpty(type_data[0].appoint_data)) { + form.data_source_content = type_data[0].appoint_data; + } else { + form.data_source_content = {}; + if (!isEmpty(key)) { + url_value_dialog_visible.value = true; + } } }; diff --git a/src/store/modules/custom.ts b/src/store/modules/custom.ts index 64aa145b..5add16de 100644 --- a/src/store/modules/custom.ts +++ b/src/store/modules/custom.ts @@ -8,6 +8,7 @@ export const DataSourceStore = defineStore('dataSource', () => { type: string; }; interface data_source_content { + appoint_data?: object; name: string; data: data_list[]; type: string; diff --git a/src/views/layout/components/main/index.vue b/src/views/layout/components/main/index.vue index 16c44596..c0ac50a2 100644 --- a/src/views/layout/components/main/index.vue +++ b/src/views/layout/components/main/index.vue @@ -6,7 +6,7 @@