修改自定义显示

v1.0.0
于肖磊 2024-10-08 18:12:55 +08:00
parent 8e4607071c
commit d990d1b7e2
3 changed files with 24 additions and 11 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;