Merge remote-tracking branch 'origin/dev-yxl' into dev-sws
commit
d72f6b7b43
|
|
@ -0,0 +1,13 @@
|
||||||
|
import request from '@/utils/request';
|
||||||
|
|
||||||
|
class CustomAPI {
|
||||||
|
/** 分类品牌查询接口*/
|
||||||
|
static getCustominit() {
|
||||||
|
return request({
|
||||||
|
url: `diyapi/custominit`,
|
||||||
|
method: 'post',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default CustomAPI;
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
<upload v-model="form.img_src" :limit="1" size="50"></upload>
|
<upload v-model="form.img_src" :limit="1" size="50"></upload>
|
||||||
<div class="flex-row align-c gap-10 mt-12">
|
<div class="flex-row align-c gap-10 mt-12">
|
||||||
<el-select v-model="form.data_source_id" value-key="id" placeholder="请选择图片数据字段" size="default" class="flex-1">
|
<el-select v-model="form.data_source_id" value-key="id" placeholder="请选择图片数据字段" size="default" class="flex-1">
|
||||||
<el-option v-for="item in options" :key="item.id" :label="item.label" :value="item" />
|
<el-option v-for="item in options.filter(item => item.type == 'images')" :key="item.field" :label="item.name" :value="item.field" />
|
||||||
</el-select>
|
</el-select>
|
||||||
<el-popover placement="top-start" :width="200" trigger="hover" content="this is content, this is content, this is content">
|
<el-popover placement="top-start" :width="200" trigger="hover" content="this is content, this is content, this is content">
|
||||||
<template #reference>
|
<template #reference>
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
<el-input v-model="form.text_title" placeholder="请输入链接" type="textarea" :rows="3"></el-input>
|
<el-input v-model="form.text_title" placeholder="请输入链接" type="textarea" :rows="3"></el-input>
|
||||||
<div class="flex-row align-c gap-10 mt-12">
|
<div class="flex-row align-c gap-10 mt-12">
|
||||||
<el-select v-model="form.data_source_id" value-key="id" placeholder="请选择图片数据字段" size="default" class="flex-1">
|
<el-select v-model="form.data_source_id" value-key="id" placeholder="请选择图片数据字段" size="default" class="flex-1">
|
||||||
<el-option v-for="item in options" :key="item.id" :label="item.label" :value="item" />
|
<el-option v-for="item in options.filter(item => item.type == 'text')" :key="item.field" :label="item.name" :value="item.field" />
|
||||||
</el-select>
|
</el-select>
|
||||||
<el-popover placement="top-start" :width="200" trigger="hover" content="this is content, this is content, this is content">
|
<el-popover placement="top-start" :width="200" trigger="hover" content="this is content, this is content, this is content">
|
||||||
<template #reference>
|
<template #reference>
|
||||||
|
|
@ -21,9 +21,6 @@
|
||||||
<el-form-item label="链接">
|
<el-form-item label="链接">
|
||||||
<url-value v-model="form.text_link"></url-value>
|
<url-value v-model="form.text_link"></url-value>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="富文本">
|
|
||||||
<el-switch v-model="form.is_rich_text" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="文字颜色">
|
<el-form-item label="文字颜色">
|
||||||
<color-picker v-model="form.text_color" default-color="#FF3F3F"></color-picker>
|
<color-picker v-model="form.text_color" default-color="#FF3F3F"></color-picker>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,8 @@
|
||||||
<card-container class="common-content-height">
|
<card-container class="common-content-height">
|
||||||
<div class="mb-20">数据源</div>
|
<div class="mb-20">数据源</div>
|
||||||
<el-form-item label="动态数据">
|
<el-form-item label="动态数据">
|
||||||
<el-select v-model="form.data_source" value-key="id" placeholder="Select" size="default">
|
<el-select v-model="form.data_source" value-key="id" placeholder="请选择数据源" @change="changeDataSource">
|
||||||
<el-option v-for="item in options" :key="item.id" :label="item.label" :value="item" />
|
<el-option v-for="item in options" :key="item.type" :label="item.name" :value="item.type" />
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<div class="mb-20">内容设置</div>
|
<div class="mb-20">内容设置</div>
|
||||||
|
|
@ -17,10 +17,10 @@
|
||||||
<DragIndex ref="draglist" :key="dragkey" v-model:height="center_height" :list="custom_list" @right-update="right_update"></DragIndex>
|
<DragIndex ref="draglist" :key="dragkey" v-model:height="center_height" :list="custom_list" @right-update="right_update"></DragIndex>
|
||||||
<div class="settings">
|
<div class="settings">
|
||||||
<template v-if="diy_data.key === 'img'">
|
<template v-if="diy_data.key === 'img'">
|
||||||
<model-image-style :key="key" v-model:height="center_height" :value="diy_data"></model-image-style>
|
<model-image-style :key="key" v-model:height="center_height" :options="model_data_source" :value="diy_data"></model-image-style>
|
||||||
</template>
|
</template>
|
||||||
<template v-else-if="diy_data.key == 'text'">
|
<template v-else-if="diy_data.key == 'text'">
|
||||||
<model-text-style :key="key" v-model:height="center_height" :value="diy_data"></model-text-style>
|
<model-text-style :key="key" v-model:height="center_height" :options="model_data_source" :value="diy_data"></model-text-style>
|
||||||
</template>
|
</template>
|
||||||
<template v-else-if="diy_data.key == 'auxiliary-line'">
|
<template v-else-if="diy_data.key == 'auxiliary-line'">
|
||||||
<model-lines-style :key="key" v-model:height="center_height" :value="diy_data"></model-lines-style>
|
<model-lines-style :key="key" v-model:height="center_height" :value="diy_data"></model-lines-style>
|
||||||
|
|
@ -39,6 +39,10 @@
|
||||||
import Dialog from './components/dialog.vue';
|
import Dialog from './components/dialog.vue';
|
||||||
import DragIndex from './components/index.vue';
|
import DragIndex from './components/index.vue';
|
||||||
import { cloneDeep } from 'lodash';
|
import { cloneDeep } from 'lodash';
|
||||||
|
import CustomAPI from '@/api/custom';
|
||||||
|
import { DataSourceStore } from '@/store';
|
||||||
|
const data_source = DataSourceStore();
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
value: {
|
value: {
|
||||||
type: Object,
|
type: Object,
|
||||||
|
|
@ -53,12 +57,33 @@ const form = reactive(props.value);
|
||||||
let custom_list = reactive([]);
|
let custom_list = reactive([]);
|
||||||
const center_height = ref(0);
|
const center_height = ref(0);
|
||||||
|
|
||||||
const options = [
|
const options = ref<source_list[]>([]);
|
||||||
{ id: 1, label: 'Option A', desc: 'Option A - 230506' },
|
interface data_list {
|
||||||
{ id: 2, label: 'Option B', desc: 'Option B - 230506' },
|
name: string;
|
||||||
{ id: 3, label: 'Option C', desc: 'Option C - 230506' },
|
field: string;
|
||||||
{ id: 4, label: 'Option A', desc: 'Option A - 230507' },
|
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<diy>({
|
const diy_data = ref<diy>({
|
||||||
key: '',
|
key: '',
|
||||||
|
|
@ -96,6 +121,15 @@ const accomplish = () => {
|
||||||
}
|
}
|
||||||
form.height = center_height.value;
|
form.height = center_height.value;
|
||||||
};
|
};
|
||||||
|
const model_data_source = ref<data_list[]>([])
|
||||||
|
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 = [];
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.card.mb-8 {
|
.card.mb-8 {
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-else class="flex-row align-c jc-sb">
|
<div v-else class="flex-row align-c jc-sb">
|
||||||
<div class="flex-row align-c nowrap text-line-1">
|
<div class="flex-row align-c nowrap">
|
||||||
<div v-if="is_show('2')" class="num" :style="`color: ${ new_style.shop_price_color }`"><span class="identifying">{{ item.show_price_symbol }}</span><span :style="trends_config('price')">{{ item.min_price }}</span><span class="identifying">{{ item.show_price_unit }}</span></div>
|
<div v-if="is_show('2')" class="num" :style="`color: ${ new_style.shop_price_color }`"><span class="identifying">{{ item.show_price_symbol }}</span><span :style="trends_config('price')">{{ item.min_price }}</span><span class="identifying">{{ item.show_price_unit }}</span></div>
|
||||||
<div v-if="show_content && is_show('5')" class="size-10 flex"><span class="original-price-left"></span><span class="original-price flex-1 text-line-1">{{ item.show_original_price_symbol }}{{ item.min_original_price }}{{ item.show_original_price_unit }}</span></div>
|
<div v-if="show_content && is_show('5')" class="size-10 flex"><span class="original-price-left"></span><span class="original-price flex-1 text-line-1">{{ item.show_original_price_symbol }}{{ item.min_original_price }}{{ item.show_original_price_unit }}</span></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -133,17 +133,6 @@ const default_list = {
|
||||||
new_src: []
|
new_src: []
|
||||||
}
|
}
|
||||||
const list = ref<product_list[]>([]);
|
const list = ref<product_list[]>([]);
|
||||||
watchEffect(() => {
|
|
||||||
if (form.value.product_check == '0') {
|
|
||||||
if (!isEmpty(form.value.product_list)) {
|
|
||||||
list.value = form.value.product_list;
|
|
||||||
} else {
|
|
||||||
list.value = Array(4).fill(default_list);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
get_products();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
const get_products = () => {
|
const get_products = () => {
|
||||||
const { goods_category_ids, goods_brand_ids, number, sort, sort_rules } = form.value;
|
const { goods_category_ids, goods_brand_ids, number, sort, sort_rules } = form.value;
|
||||||
const params = {
|
const params = {
|
||||||
|
|
@ -163,6 +152,17 @@ const get_products = () => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
watchEffect(() => {
|
||||||
|
if (form.value.product_check == '0') {
|
||||||
|
if (!isEmpty(form.value.product_list)) {
|
||||||
|
list.value = form.value.product_list;
|
||||||
|
} else {
|
||||||
|
list.value = Array(4).fill(default_list);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
get_products();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// 圆角设置
|
// 圆角设置
|
||||||
const content_radius = computed(() => radius_computer(new_style.value.shop_radius));
|
const content_radius = computed(() => radius_computer(new_style.value.shop_radius));
|
||||||
|
|
@ -376,7 +376,7 @@ const style_container = computed(() => {
|
||||||
height: 11.4rem;
|
height: 11.4rem;
|
||||||
}
|
}
|
||||||
.flex-img4 {
|
.flex-img4 {
|
||||||
width: 100%;
|
width: 7rem;
|
||||||
height: 7rem;
|
height: 7rem;
|
||||||
}
|
}
|
||||||
.flex-img5 {
|
.flex-img5 {
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="显示数量">
|
<el-form-item label="显示数量">
|
||||||
<el-input-number v-model="form.number" :min="1" :max="100" type="number" placeholder="请输入显示数量" value-on-clear="min" class="w" controls-position="right"></el-input-number>
|
<el-input-number v-model="form.number" :min="1" :max="100" type="number" placeholder="请输入显示数量" value-on-clear="min" class="w number-show" controls-position="right"></el-input-number>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="排序类型">
|
<el-form-item label="排序类型">
|
||||||
<el-radio-group v-model="form.sort">
|
<el-radio-group v-model="form.sort">
|
||||||
|
|
@ -91,7 +91,7 @@ const state = reactive({
|
||||||
// 如果需要解构,确保使用toRefs
|
// 如果需要解构,确保使用toRefs
|
||||||
const { form } = toRefs(state);
|
const { form } = toRefs(state);
|
||||||
|
|
||||||
const base_list = {
|
const base_list = reactive({
|
||||||
product_style_list: [
|
product_style_list: [
|
||||||
{ name: '单列展示', value: '0' },
|
{ name: '单列展示', value: '0' },
|
||||||
{ name: '大图展示', value: '2' },
|
{ name: '大图展示', value: '2' },
|
||||||
|
|
@ -117,6 +117,15 @@ const base_list = {
|
||||||
{ name: '降序(desc)', value: '0' },
|
{ name: '降序(desc)', value: '0' },
|
||||||
{ name: '升序(asc)', value: '1' },
|
{ name: '升序(asc)', value: '1' },
|
||||||
]
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
const init = () => {
|
||||||
|
ShopAPI.getShop().then((res) => {
|
||||||
|
const { goods_category, brand_list } = res.data;
|
||||||
|
base_list.product_category_list = goods_category;
|
||||||
|
base_list.product_brand_list = brand_list;
|
||||||
|
shop_store.set_category_brand(goods_category, brand_list);
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
onBeforeMount(() => {
|
onBeforeMount(() => {
|
||||||
|
|
@ -129,15 +138,6 @@ onBeforeMount(() => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const init = () => {
|
|
||||||
ShopAPI.getShop().then((res) => {
|
|
||||||
const { goods_category, brand_list } = res.data;
|
|
||||||
base_list.product_category_list = goods_category;
|
|
||||||
base_list.product_brand_list = brand_list;
|
|
||||||
shop_store.set_category_brand(goods_category, brand_list);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const product_list_remove = (index: number) => {
|
const product_list_remove = (index: number) => {
|
||||||
form.value.product_list.splice(index, 1);
|
form.value.product_list.splice(index, 1);
|
||||||
};
|
};
|
||||||
|
|
@ -179,4 +179,9 @@ const change_style = (val: any):void => {
|
||||||
width: 4rem;
|
width: 4rem;
|
||||||
height: 4rem;
|
height: 4rem;
|
||||||
}
|
}
|
||||||
|
.number-show {
|
||||||
|
:deep(.el-input__wrapper .el-input__inner) {
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
|
|
@ -59,12 +59,12 @@
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<el-form-item label="商品分类">
|
<el-form-item label="商品分类">
|
||||||
<el-select v-model="row.product_type" multiple collapse-tags placeholder="请选择文章分类">
|
<el-select v-model="row.product_type" multiple collapse-tags placeholder="请选择文章分类">
|
||||||
<el-option v-for="item in base_list.product_type_list" :key="item.value" :label="item.name" :value="item.value" />
|
<el-option v-for="item in base_list.product_category_list" :key="item.id" :label="item.name" :value="item.id" />
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="指定品牌">
|
<el-form-item label="指定品牌">
|
||||||
<el-select v-model="row.product_type" multiple collapse-tags placeholder="请选择文章分类">
|
<el-select v-model="row.product_type" multiple collapse-tags placeholder="请选择文章分类">
|
||||||
<el-option v-for="item in base_list.product_type_list" :key="item.value" :label="item.name" :value="item.value" />
|
<el-option v-for="item in base_list.product_brand_list" :key="item.id" :label="item.name" :value="item.id" />
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="显示数量">
|
<el-form-item label="显示数量">
|
||||||
|
|
@ -95,6 +95,14 @@
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { get_math } from '@/utils';
|
import { get_math } from '@/utils';
|
||||||
|
import ShopAPI from '@/api/shop';
|
||||||
|
import { ShopStore } from '@/store';
|
||||||
|
const shop_store = ShopStore();
|
||||||
|
interface shop_list {
|
||||||
|
id: number;
|
||||||
|
name: string;
|
||||||
|
};
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
value: {
|
value: {
|
||||||
type: Object,
|
type: Object,
|
||||||
|
|
@ -128,11 +136,8 @@ const base_list = reactive({
|
||||||
{ name: '指定商品', value: '0' },
|
{ name: '指定商品', value: '0' },
|
||||||
{ name: '选择商品', value: '1' },
|
{ name: '选择商品', value: '1' },
|
||||||
],
|
],
|
||||||
product_type_list: [
|
product_category_list: [] as shop_list[],
|
||||||
{ name: '样式一', value: '0' },
|
product_brand_list: [] as shop_list[],
|
||||||
{ name: '样式二', value: '1' },
|
|
||||||
{ name: '样式三', value: '2' },
|
|
||||||
],
|
|
||||||
sort_list: [
|
sort_list: [
|
||||||
{ name: '综合', value: '0' },
|
{ name: '综合', value: '0' },
|
||||||
{ name: '销量', value: '1' },
|
{ name: '销量', value: '1' },
|
||||||
|
|
@ -149,6 +154,27 @@ const base_list = reactive({
|
||||||
{ name: '浏览量', value: '1' },
|
{ name: '浏览量', value: '1' },
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
// 获取商品分类和品牌分类
|
||||||
|
const init = () => {
|
||||||
|
ShopAPI.getShop().then((res) => {
|
||||||
|
const { goods_category, brand_list } = res.data;
|
||||||
|
base_list.product_category_list = goods_category;
|
||||||
|
base_list.product_brand_list = brand_list;
|
||||||
|
shop_store.set_category_brand(goods_category, brand_list);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
onBeforeMount(() => {
|
||||||
|
// 判断是否有历史数据
|
||||||
|
if (!shop_store.is_shop_api) {
|
||||||
|
shop_store.set_is_shop_api(true);
|
||||||
|
init();
|
||||||
|
} else {
|
||||||
|
base_list.product_category_list = shop_store.category_list;
|
||||||
|
base_list.product_brand_list = shop_store.brand_list;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
const active_index = ref(0);
|
const active_index = ref(0);
|
||||||
const tabs_list_click = (item: any, index: number) => {
|
const tabs_list_click = (item: any, index: number) => {
|
||||||
active_index.value = index;
|
active_index.value = index;
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,9 @@ interface articleTabsList {
|
||||||
img: string;
|
img: string;
|
||||||
desc: string;
|
desc: string;
|
||||||
product_check: string;
|
product_check: string;
|
||||||
product_type: string[];
|
goods_category_ids: string[];
|
||||||
|
goods_brand_ids: string[];
|
||||||
|
is_price_solo: boolean;
|
||||||
number: number;
|
number: number;
|
||||||
sort: string;
|
sort: string;
|
||||||
sort_rules: string;
|
sort_rules: string;
|
||||||
|
|
@ -63,10 +65,10 @@ const defaultProductList: DefaultProductList = {
|
||||||
tabs_top_up: false,
|
tabs_top_up: false,
|
||||||
product_style: '0',
|
product_style: '0',
|
||||||
tabs_list: [
|
tabs_list: [
|
||||||
{ id: '1', title: '热门推荐', img: '', desc: '简介', product_check: '0', product_type: [], number: 4, sort: '0', sort_rules: '0', product_list: [] },
|
{ id: '1', title: '热门推荐', img: '', desc: '简介', product_check: '0', goods_category_ids: [], goods_brand_ids: [], number: 4, is_price_solo: true, sort: '0', sort_rules: '0', product_list: [] },
|
||||||
{ id: '2', title: '测试一', img: '', desc: '简介', product_check: '0', product_type: [], number: 4, sort: '0', sort_rules: '0', product_list: [] },
|
{ id: '2', title: '测试一', img: '', desc: '简介', product_check: '0', goods_category_ids: [], goods_brand_ids: [], number: 4, is_price_solo: true, sort: '0', sort_rules: '0', product_list: [] },
|
||||||
{ id: '3', title: '测试二', img: '', desc: '简介', product_check: '0', product_type: [], number: 4, sort: '0', sort_rules: '0', product_list: [] },
|
{ id: '3', title: '测试二', img: '', desc: '简介', product_check: '0', goods_category_ids: [], goods_brand_ids: [], number: 4, is_price_solo: true, sort: '0', sort_rules: '0', product_list: [] },
|
||||||
{ id: '4', title: '测试三', img: '', desc: '简介', product_check: '0', product_type: [], number: 4, sort: '0', sort_rules: '0', product_list: [] },
|
{ id: '4', title: '测试三', img: '', desc: '简介', product_check: '0', goods_category_ids: [], goods_brand_ids: [], number: 4, is_price_solo: true, sort: '0', sort_rules: '0', product_list: [] },
|
||||||
],
|
],
|
||||||
is_show: ['0', '1', '2', '3', '4', '5'],
|
is_show: ['0', '1', '2', '3', '4', '5'],
|
||||||
is_shop_show: true,
|
is_shop_show: true,
|
||||||
|
|
|
||||||
|
|
@ -11,4 +11,5 @@ export * from './modules/footer-nav-content';
|
||||||
export * from './modules/upload';
|
export * from './modules/upload';
|
||||||
export * from './modules/shop';
|
export * from './modules/shop';
|
||||||
export * from './modules/url-value';
|
export * from './modules/url-value';
|
||||||
|
export * from './modules/custom';
|
||||||
export { store };
|
export { store };
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,35 @@
|
||||||
|
import { ref } from 'vue';
|
||||||
|
import { defineStore } from 'pinia';
|
||||||
|
|
||||||
|
export const DataSourceStore = defineStore('dataSource', () => {
|
||||||
|
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<source_list[]>([]);
|
||||||
|
// 存储上传分类列表
|
||||||
|
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_data_source_api = (bool: boolean) => {
|
||||||
|
is_data_source_api.value = bool;
|
||||||
|
};
|
||||||
|
|
||||||
|
return {
|
||||||
|
data_source_list,
|
||||||
|
is_data_source_api,
|
||||||
|
set_data_source,
|
||||||
|
set_is_data_source_api,
|
||||||
|
};
|
||||||
|
});
|
||||||
Loading…
Reference in New Issue