Merge remote-tracking branch 'origin/dev-yxl' into dev-sws

v1.0.0
sws 2024-10-08 18:48:17 +08:00
commit f3da252707
4 changed files with 25 additions and 12 deletions

View File

@ -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 = '请在此输入文字';
}

View File

@ -7,7 +7,7 @@
<el-select v-model="form.data_source" value-key="id" placeholder="请选择数据源" filterable clearable @change="changeDataSource">
<el-option v-for="item in options" :key="item.type" :label="item.name" :value="item.type" />
</el-select>
<div v-if="!isEmpty(form.data_source_content)" class="flex-row mt-20 gap-20">
<div v-if="!isEmpty(form.data_source_content) && is_show_more" class="flex-row mt-20 gap-20">
<div class="re flex align-c">
<image-empty v-model="form.data_source_content[form.img_key]" fit="contain" style="width: 10rem;height: 10rem" error-img-style="width: 3rem; height: 3rem;"></image-empty>
<div class="plr-10 bg-f abs replace-data size-10" @click="replace_data"></div>
@ -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<data_list[]>([]);
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;
}
}
};

View File

@ -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;

View File

@ -6,7 +6,7 @@
<el-collapse-item v-if="com.data.length > 0" :key="i" :title="com.name" :name="com.key">
<VueDraggable v-model="com.data" :animation="500" ghost-class="ghost" handle=".is-drag" :group="{ name: 'people', pull: 'clone', put: false }" class="component flex-row flex-wrap" :clone="clone_item_com_data" :sort="false" :force-fallback="true">
<template v-for="item in com.data" :key="item.key">
<el-tooltip effect="dark" :show-after="200" :hide-after="200" content="该组件只可以点击添加, 并且只能添加一次" placement="top" :disabled="!['tabs', 'tabs-carousel'].includes(item.key)">
<el-tooltip effect="dark" :show-after="200" :hide-after="200" content="<span>该组件只可以点击添加, 并且只能添加一次。<br/>如果页面设置开启沉浸模式, 则不可添加</span>" raw-content placement="top" :disabled="!['tabs', 'tabs-carousel'].includes(item.key)">
<div :class="['item', { 'is-drag': !['tabs', 'tabs-carousel'].includes(item.key) }]" @click.stop="draggable_click(item)">
<div class="main-border siderbar-hidden main-show tc">释放鼠标将组件添加到此处</div>
<div class="siderbar-show main-hidden flex-col jc-c align-c gap-4">