mirror of
https://gitee.com/dromara/go-view.git
synced 2025-02-24 08:12:49 +08:00
feat: 新增数据池代码
This commit is contained in:
parent
5ea963fb93
commit
500795b7e5
@ -15,7 +15,9 @@ export enum RequestDataTypeEnum {
|
|||||||
// 静态数据
|
// 静态数据
|
||||||
STATIC = 0,
|
STATIC = 0,
|
||||||
// 请求数据
|
// 请求数据
|
||||||
AJAX = 1
|
AJAX = 1,
|
||||||
|
// 数据池
|
||||||
|
Pond = 2
|
||||||
}
|
}
|
||||||
|
|
||||||
// 请求主体类型
|
// 请求主体类型
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="go-content-charts-item-box" :class="{ double: chartMode === ChartModeEnum.DOUBLE }">
|
<div class="go-content-charts-item-animation-patch">
|
||||||
|
<div
|
||||||
|
ref="contentChartsItemBoxRef"
|
||||||
|
class="go-content-charts-item-box"
|
||||||
|
:class="[chartMode === ChartModeEnum.DOUBLE ? 'double' : 'single']"
|
||||||
|
>
|
||||||
<!-- 每一项组件的渲染 -->
|
<!-- 每一项组件的渲染 -->
|
||||||
<div
|
<div
|
||||||
class="item-box"
|
class="item-box"
|
||||||
@ -26,10 +31,11 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { PropType, ref, Ref, computed } from 'vue'
|
import { PropType, watch, ref, Ref, computed, nextTick } from 'vue'
|
||||||
import { MacOsControlBtn } from '@/components/Tips/MacOsControlBtn/index'
|
import { MacOsControlBtn } from '@/components/Tips/MacOsControlBtn/index'
|
||||||
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
|
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
|
||||||
import { EditCanvasTypeEnum } from '@/store/modules/chartEditStore/chartEditStore.d'
|
import { EditCanvasTypeEnum } from '@/store/modules/chartEditStore/chartEditStore.d'
|
||||||
@ -51,6 +57,7 @@ defineProps({
|
|||||||
})
|
})
|
||||||
|
|
||||||
const chartLayoutStore = useChartLayoutStore()
|
const chartLayoutStore = useChartLayoutStore()
|
||||||
|
const contentChartsItemBoxRef = ref()
|
||||||
|
|
||||||
// 组件展示状态
|
// 组件展示状态
|
||||||
const chartMode: Ref<ChartModeEnum> = computed(() => {
|
const chartMode: Ref<ChartModeEnum> = computed(() => {
|
||||||
@ -92,21 +99,38 @@ const dblclickHandle = async (item: ConfigType) => {
|
|||||||
window['$message'].warning(`图表正在研发中, 敬请期待...`)
|
window['$message'].warning(`图表正在研发中, 敬请期待...`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => chartMode.value,
|
||||||
|
(newValue: ChartModeEnum) => {
|
||||||
|
if (newValue === ChartModeEnum.DOUBLE) {
|
||||||
|
nextTick(() => {
|
||||||
|
contentChartsItemBoxRef.value.classList.add('miniAnimation')
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
/* 列表项宽度 */
|
/* 列表项宽度 */
|
||||||
$itemWidth: 100%;
|
$itemWidth: 100%;
|
||||||
|
$maxItemWidth: 180px;
|
||||||
$halfItemWidth: 46%;
|
$halfItemWidth: 46%;
|
||||||
/* 内容高度 */
|
/* 内容高度 */
|
||||||
$centerHeight: 100px;
|
$centerHeight: 100px;
|
||||||
$halfCenterHeight: 50px;
|
$halfCenterHeight: 50px;
|
||||||
|
|
||||||
|
@include go('content-charts-item-animation-patch') {
|
||||||
|
padding: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
@include go('content-charts-item-box') {
|
@include go('content-charts-item-box') {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
gap: 9px;
|
gap: 9px;
|
||||||
padding: 10px;
|
transition: all 0.7s linear;
|
||||||
.item-box {
|
.item-box {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
width: $itemWidth;
|
width: $itemWidth;
|
||||||
@ -115,7 +139,6 @@ $halfCenterHeight: 50px;
|
|||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
border: 1px solid rgba(0, 0, 0, 0);
|
border: 1px solid rgba(0, 0, 0, 0);
|
||||||
@include fetch-bg-color('background-color2');
|
@include fetch-bg-color('background-color2');
|
||||||
@extend .go-transition;
|
|
||||||
&:hover {
|
&:hover {
|
||||||
@include hover-border-color('background-color4');
|
@include hover-border-color('background-color4');
|
||||||
.list-img {
|
.list-img {
|
||||||
@ -153,6 +176,22 @@ $halfCenterHeight: 50px;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* 缩小展示 */
|
/* 缩小展示 */
|
||||||
|
@keyframes miniAnimation {
|
||||||
|
from {
|
||||||
|
width: $itemWidth * 2;
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
width: $itemWidth;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
&.miniAnimation {
|
||||||
|
animation: miniAnimation 0.5s;
|
||||||
|
}
|
||||||
|
&.single {
|
||||||
|
.item-box {
|
||||||
|
@extend .go-transition;
|
||||||
|
}
|
||||||
|
}
|
||||||
&.double {
|
&.double {
|
||||||
.list-header {
|
.list-header {
|
||||||
padding: 2px 5px;
|
padding: 2px 5px;
|
||||||
@ -165,6 +204,7 @@ $halfCenterHeight: 50px;
|
|||||||
}
|
}
|
||||||
.item-box {
|
.item-box {
|
||||||
width: $halfItemWidth;
|
width: $halfItemWidth;
|
||||||
|
max-width: $maxItemWidth;
|
||||||
}
|
}
|
||||||
.list-center {
|
.list-center {
|
||||||
height: $halfCenterHeight;
|
height: $halfCenterHeight;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="go-chart-configurations-animations" v-if="targetData">
|
<div class="go-chart-configurations-animations" v-if="targetData">
|
||||||
<n-button
|
<n-button
|
||||||
class="clear-btn"
|
class="clear-btn go-my-2"
|
||||||
:disabled="!targetData.styles.animations.length"
|
:disabled="!targetData.styles.animations.length"
|
||||||
@click="clearAnimation"
|
@click="clearAnimation"
|
||||||
>
|
>
|
||||||
@ -72,7 +72,7 @@ const addAnimation = (item: { label: string; value: string }) => {
|
|||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
@include go('chart-configurations-animations') {
|
@include go('chart-configurations-animations') {
|
||||||
padding: 20px 10px;
|
padding: 0;
|
||||||
.clear-btn {
|
.clear-btn {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
@ -41,13 +41,9 @@
|
|||||||
</n-input>
|
</n-input>
|
||||||
</setting-item-box>
|
</setting-item-box>
|
||||||
|
|
||||||
<n-space justify="end">
|
|
||||||
<n-text depth="3" style="font-size: 12px">更新内容请点击展示区域</n-text>
|
|
||||||
</n-space>
|
|
||||||
|
|
||||||
<div class="edit-text" @click="requestModelHandle">
|
<div class="edit-text" @click="requestModelHandle">
|
||||||
<div class="go-absolute-center">
|
<div class="go-absolute-center">
|
||||||
<n-button type="primary" secondary>查看更多</n-button>
|
<n-button type="primary" secondary>编辑配置</n-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</n-card>
|
</n-card>
|
||||||
@ -175,7 +171,7 @@ onBeforeUnmount(() => {
|
|||||||
top: 0px;
|
top: 0px;
|
||||||
left: 0px;
|
left: 0px;
|
||||||
width: 325px;
|
width: 325px;
|
||||||
height: 292px;
|
height: 270px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
transition: all 0.3s;
|
transition: all 0.3s;
|
||||||
|
@ -0,0 +1,3 @@
|
|||||||
|
import ChartDataPond from './index.vue'
|
||||||
|
|
||||||
|
export { ChartDataPond }
|
@ -0,0 +1,133 @@
|
|||||||
|
<template>
|
||||||
|
<div class="go-chart-data-pond">
|
||||||
|
<n-card class="n-card-shallow">
|
||||||
|
<setting-item-box name="请求配置">
|
||||||
|
<setting-item name="类型">
|
||||||
|
<n-tag :bordered="false" type="primary" style="border-radius: 5px">
|
||||||
|
{{ targetData.request.requestContentType === RequestContentTypeEnum.DEFAULT ? '普通请求' : 'SQL请求' }}
|
||||||
|
</n-tag>
|
||||||
|
</setting-item>
|
||||||
|
|
||||||
|
<setting-item name="方式">
|
||||||
|
<n-input size="small" :placeholder="targetData.request.requestHttpType || '暂无'" :disabled="true"></n-input>
|
||||||
|
</setting-item>
|
||||||
|
|
||||||
|
<setting-item name="组件间隔(高级)">
|
||||||
|
<n-input size="small" :placeholder="`${targetData.request.requestInterval || '暂无'}`" :disabled="true">
|
||||||
|
<template #suffix> {{ SelectHttpTimeNameObj[targetData.request.requestIntervalUnit] }} </template>
|
||||||
|
</n-input>
|
||||||
|
</setting-item>
|
||||||
|
|
||||||
|
<setting-item name="全局间隔(默认)">
|
||||||
|
<n-input size="small" :placeholder="`${GlobalRequestInterval || '暂无'} `" :disabled="true">
|
||||||
|
<template #suffix> {{ SelectHttpTimeNameObj[GlobalRequestIntervalUnit] }} </template>
|
||||||
|
</n-input>
|
||||||
|
</setting-item>
|
||||||
|
</setting-item-box>
|
||||||
|
|
||||||
|
<setting-item-box name="源地址" :alone="true">
|
||||||
|
<n-input size="small" :placeholder="requestOriginUrl || '暂无'" :disabled="true">
|
||||||
|
<template #prefix>
|
||||||
|
<n-icon :component="PulseIcon" />
|
||||||
|
</template>
|
||||||
|
</n-input>
|
||||||
|
</setting-item-box>
|
||||||
|
|
||||||
|
<setting-item-box name="组件地址" :alone="true">
|
||||||
|
<n-input size="small" :placeholder="targetData.request.requestUrl || '暂无'" :disabled="true">
|
||||||
|
<template #prefix>
|
||||||
|
<n-icon :component="FlashIcon" />
|
||||||
|
</template>
|
||||||
|
</n-input>
|
||||||
|
</setting-item-box>
|
||||||
|
|
||||||
|
<div class="edit-text" @click="requestModelHandle">
|
||||||
|
<div class="go-absolute-center">
|
||||||
|
<n-button type="primary" secondary>编辑配置</n-button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</n-card>
|
||||||
|
|
||||||
|
<!-- 列表 -->
|
||||||
|
<div class="pond-list-box">
|
||||||
|
<div v-for="(item, index) in requestDataPond" :key="index">
|
||||||
|
{{ item }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- 编辑 / 新增弹窗 -->
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { ref, toRefs, computed } from 'vue'
|
||||||
|
import { icon } from '@/plugins'
|
||||||
|
import { SettingItemBox, SettingItem } from '@/components/Pages/ChartItemSetting'
|
||||||
|
import { useDesignStore } from '@/store/modules/designStore/designStore'
|
||||||
|
import { useTargetData } from '../../../hooks/useTargetData.hook'
|
||||||
|
import { SelectHttpTimeNameObj, RequestContentTypeEnum } from '@/enums/httpEnum'
|
||||||
|
|
||||||
|
const designStore = useDesignStore()
|
||||||
|
const { HelpOutlineIcon, FlashIcon, PulseIcon } = icon.ionicons5
|
||||||
|
const { targetData, chartEditStore } = useTargetData()
|
||||||
|
|
||||||
|
const {
|
||||||
|
requestOriginUrl,
|
||||||
|
requestDataPond,
|
||||||
|
requestInterval: GlobalRequestInterval,
|
||||||
|
requestIntervalUnit: GlobalRequestIntervalUnit
|
||||||
|
} = toRefs(chartEditStore.getRequestGlobalConfig)
|
||||||
|
|
||||||
|
const requestShow = ref(false)
|
||||||
|
|
||||||
|
// 颜色
|
||||||
|
const themeColor = computed(() => {
|
||||||
|
return designStore.getAppTheme
|
||||||
|
})
|
||||||
|
|
||||||
|
// 请求配置 model
|
||||||
|
const requestModelHandle = () => {
|
||||||
|
requestShow.value = true
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
@include go('chart-data-pond') {
|
||||||
|
position: relative;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
.n-card-shallow {
|
||||||
|
&.n-card {
|
||||||
|
@extend .go-background-filter;
|
||||||
|
@include deep() {
|
||||||
|
.n-card__content {
|
||||||
|
padding: 10px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.edit-text {
|
||||||
|
position: absolute;
|
||||||
|
top: 0px;
|
||||||
|
left: 0px;
|
||||||
|
width: 325px;
|
||||||
|
height: 270px;
|
||||||
|
cursor: pointer;
|
||||||
|
opacity: 0;
|
||||||
|
transition: all 0.3s;
|
||||||
|
@extend .go-background-filter;
|
||||||
|
backdrop-filter: blur(2px) !important;
|
||||||
|
}
|
||||||
|
&:hover {
|
||||||
|
border-color: v-bind('themeColor');
|
||||||
|
.edit-text {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 列表 */
|
||||||
|
.pond-list-box {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
@ -16,6 +16,7 @@ export enum TimelineTitleEnum {
|
|||||||
export enum SelectCreateDataEnum {
|
export enum SelectCreateDataEnum {
|
||||||
STATIC = '静态数据',
|
STATIC = '静态数据',
|
||||||
AJAX = '动态请求',
|
AJAX = '动态请求',
|
||||||
|
Pond = '公共接口',
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SelectCreateDataType {
|
export interface SelectCreateDataType {
|
||||||
|
@ -3,24 +3,27 @@
|
|||||||
<setting-item-box name="请求方式" :alone="true">
|
<setting-item-box name="请求方式" :alone="true">
|
||||||
<n-select v-model:value="targetData.request.requestDataType" :disabled="isNotData" :options="selectOptions" />
|
<n-select v-model:value="targetData.request.requestDataType" :disabled="isNotData" :options="selectOptions" />
|
||||||
</setting-item-box>
|
</setting-item-box>
|
||||||
|
|
||||||
<!-- 静态 -->
|
<!-- 静态 -->
|
||||||
<chart-data-static v-if="targetData.request.requestDataType === RequestDataTypeEnum.STATIC"></chart-data-static>
|
<chart-data-static v-if="targetData.request.requestDataType === RequestDataTypeEnum.STATIC"></chart-data-static>
|
||||||
|
|
||||||
<!-- 动态 -->
|
<!-- 动态 -->
|
||||||
<chart-data-ajax v-else></chart-data-ajax>
|
<chart-data-ajax v-if="targetData.request.requestDataType === RequestDataTypeEnum.AJAX"></chart-data-ajax>
|
||||||
|
<!-- 数据池 -->
|
||||||
|
<chart-data-pond v-if="targetData.request.requestDataType === RequestDataTypeEnum.Pond"></chart-data-pond>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed } from 'vue'
|
import { computed } from 'vue'
|
||||||
|
import { loadAsyncComponent } from '@/utils'
|
||||||
import { SettingItemBox } from '@/components/Pages/ChartItemSetting'
|
import { SettingItemBox } from '@/components/Pages/ChartItemSetting'
|
||||||
import { useTargetData } from '../hooks/useTargetData.hook'
|
import { useTargetData } from '../hooks/useTargetData.hook'
|
||||||
import { ChartDataStatic } from './components/ChartDataStatic/index'
|
|
||||||
import { ChartDataAjax } from './components/ChartDataAjax/index'
|
|
||||||
import { SelectCreateDataType, SelectCreateDataEnum } from './index.d'
|
import { SelectCreateDataType, SelectCreateDataEnum } from './index.d'
|
||||||
import { RequestDataTypeEnum } from '@/enums/httpEnum'
|
import { RequestDataTypeEnum } from '@/enums/httpEnum'
|
||||||
|
|
||||||
|
const ChartDataStatic = loadAsyncComponent(() => import('./components/ChartDataStatic/index.vue'))
|
||||||
|
const ChartDataAjax = loadAsyncComponent(() => import('./components/ChartDataAjax/index.vue'))
|
||||||
|
const ChartDataPond = loadAsyncComponent(() => import('./components/ChartDataPond/index.vue'))
|
||||||
|
|
||||||
const { targetData } = useTargetData()
|
const { targetData } = useTargetData()
|
||||||
|
|
||||||
// 选项
|
// 选项
|
||||||
@ -32,6 +35,10 @@ const selectOptions: SelectCreateDataType[] = [
|
|||||||
{
|
{
|
||||||
label: SelectCreateDataEnum.AJAX,
|
label: SelectCreateDataEnum.AJAX,
|
||||||
value: RequestDataTypeEnum.AJAX
|
value: RequestDataTypeEnum.AJAX
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: SelectCreateDataEnum.Pond,
|
||||||
|
value: RequestDataTypeEnum.Pond
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user