diff --git a/src/components/common/custom-module/model-image/model-image-style.vue b/src/components/common/custom-module/model-image/model-image-style.vue
index 19009184..d6dfbd33 100644
--- a/src/components/common/custom-module/model-image/model-image-style.vue
+++ b/src/components/common/custom-module/model-image/model-image-style.vue
@@ -8,7 +8,7 @@
-
+
diff --git a/src/components/common/custom-module/model-text/model-text-style.vue b/src/components/common/custom-module/model-text/model-text-style.vue
index 1bd36fc8..bf7d5a44 100644
--- a/src/components/common/custom-module/model-text/model-text-style.vue
+++ b/src/components/common/custom-module/model-text/model-text-style.vue
@@ -8,7 +8,7 @@
-
+
@@ -21,9 +21,6 @@
-
-
-
diff --git a/src/components/model-custom/model-custom-content.vue b/src/components/model-custom/model-custom-content.vue
index 0905ad95..2c7eb54a 100644
--- a/src/components/model-custom/model-custom-content.vue
+++ b/src/components/model-custom/model-custom-content.vue
@@ -4,8 +4,8 @@
数据源
-
-
+
+
内容设置
@@ -17,10 +17,10 @@
-
+
-
+
@@ -39,6 +39,7 @@
import Dialog from './components/dialog.vue';
import DragIndex from './components/index.vue';
import { cloneDeep } from 'lodash';
+import CustomAPI from '@/api/custom';
import { DataSourceStore } from '@/store';
const data_source = DataSourceStore();
@@ -56,12 +57,33 @@ const form = reactive(props.value);
let custom_list = reactive([]);
const center_height = ref(0);
-const options = [
- { id: 1, label: 'Option A', desc: 'Option A - 230506' },
- { id: 2, label: 'Option B', desc: 'Option B - 230506' },
- { id: 3, label: 'Option C', desc: 'Option C - 230506' },
- { id: 4, label: 'Option A', desc: 'Option A - 230507' },
-];
+const options = ref([]);
+interface data_list {
+ name: string;
+ field: string;
+ type: string;
+};
+interface source_list {
+ name: string;
+ data: data_list[];
+ type: string;
+};
+const init = () => {
+ CustomAPI.getCustominit().then((res) => {
+ const { data_source } = res.data;
+ options.value = data_source;
+ data_source.set_data_source(data_source);
+ });
+}
+
+onBeforeMount(() => {
+ if (!data_source.is_data_source_api) {
+ data_source.set_is_data_source_api(true);
+ init();
+ } else {
+ options.value = data_source.data_source_list;
+ }
+});
const diy_data = ref({
key: '',
@@ -99,6 +121,15 @@ const accomplish = () => {
}
form.height = center_height.value;
};
+const model_data_source = ref([])
+const changeDataSource = (key: any) => {
+ const list = options.value.filter(item => item.type == key);
+ if (list.length > 0) {
+ model_data_source.value = list[0].data;
+ } else {
+ model_data_source.value = [];
+ }
+}
diff --git a/src/store/modules/custom.ts b/src/store/modules/custom.ts
index 5b58d086..9a08ac96 100644
--- a/src/store/modules/custom.ts
+++ b/src/store/modules/custom.ts
@@ -2,21 +2,27 @@ import { ref } from 'vue';
import { defineStore } from 'pinia';
export const DataSourceStore = defineStore('dataSource', () => {
- interface product_list {
- id: number;
+ interface data_list {
name: string;
+ field: string;
+ type: string;
+ };
+ interface source_list {
+ name: string;
+ data: data_list[];
+ type: string;
};
// 上传是否需要调接口判断
const is_data_source_api = ref(false);
// 数据源
- const data_source_list = ref([]);
+ const data_source_list = ref([]);
// 存储上传分类列表
- const set_data_source = (category: product_list[], brand: product_list[]) => {
- data_source_list.value = category;
+ const set_data_source = (source_list: source_list[]) => {
+ data_source_list.value = source_list;
is_data_source_api.value = true;
};
// 如果为false 则转为true
- const set_is_shop_api = (bool: boolean) => {
+ const set_is_data_source_api = (bool: boolean) => {
is_data_source_api.value = bool;
};
@@ -24,6 +30,6 @@ export const DataSourceStore = defineStore('dataSource', () => {
data_source_list,
is_data_source_api,
set_data_source,
- set_is_shop_api,
+ set_is_data_source_api,
};
});