From d990d1b7e205a0f9979b98be5cbd63308b56f736 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E4=BA=8E=E8=82=96=E7=A3=8A?= <18851179580@163.com>
Date: Tue, 8 Oct 2024 18:12:55 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=87=AA=E5=AE=9A=E4=B9=89?=
=?UTF-8?q?=E6=98=BE=E7=A4=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../common/custom-module/model-text/index.vue | 4 +--
.../model-custom/model-custom-content.vue | 30 +++++++++++++------
src/store/modules/custom.ts | 1 +
3 files changed, 24 insertions(+), 11 deletions(-)
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;