fix: 合并1.0.9

This commit is contained in:
奔跑的面条
2022-09-12 00:31:52 +08:00
104 changed files with 60168 additions and 470 deletions
@@ -79,7 +79,7 @@
<!-- 骨架图 -->
<go-skeleton :load="loading" :repeat="3"></go-skeleton>
<!-- 请求配置model -->
<chart-data-request v-model:modelShow="requestShow"></chart-data-request>
<chart-data-request v-model:modelShow="requestShow" @sendHandle="sendHandle"></chart-data-request>
</div>
</template>
@@ -33,7 +33,6 @@
</n-timeline-item>
<n-timeline-item type="success" :title="TimelineTitleEnum.CONTENT">
<n-space vertical>
<n-text depth="3">ECharts 图表需符合 ECharts-setdata 数据规范</n-text>
<n-space class="source-btn-box">
<n-upload
v-model:file-list="uploadFileListRef"
@@ -81,7 +80,7 @@
<script setup lang="ts">
import { ref, computed, watch } from 'vue'
import { PackagesCategoryEnum } from '@/packages/index.d'
import { ChartFrameEnum } from '@/packages/index.d'
import { RequestDataTypeEnum } from '@/enums/httpEnum'
import { icon } from '@/plugins'
import { DataResultEnum, TimelineTitleEnum } from '../../index.d'
@@ -120,9 +119,9 @@ const filterShow = computed(() => {
return targetData.value.request.requestDataType === RequestDataTypeEnum.AJAX
})
// 是图表类型
// 是支持 dataset 的图表类型
const isCharts = computed(() => {
return targetData.value.chartConfig.package === PackagesCategoryEnum.CHARTS
return targetData.value.chartConfig.chartFrame === ChartFrameEnum.ECHARTS
})
// 处理映射列表状态结果
@@ -165,21 +164,23 @@ const dimensionsAndSourceHandle = () => {
watch(
() => targetData.value?.option?.dataset,
(
newData: {
newData?: {
source: any
dimensions: any
} | null
) => {
if (newData && isObject(newData)) {
// 只有 Echarts 数据才有对应的格式
if (newData && targetData?.value?.chartConfig?.chartFrame === ChartFrameEnum.ECHARTS) {
// 只有 DataSet 数据才有对应的格式
source.value = newData
if (isCharts.value) {
dimensions.value = newData.dimensions
dimensionsAndSource.value = dimensionsAndSourceHandle()
}
} else {
} else if (newData !== undefined && newData !== null) {
dimensionsAndSource.value = null
source.value = newData
} else {
source.value = '此组件无数据源'
}
},
{
@@ -62,7 +62,17 @@ import { selectTypeOptions, selectTimeOptions } from '@/views/chart/ContentConfi
import { RequestHeader } from '../RequestHeader'
import { isDev } from '@/utils'
import { icon } from '@/plugins'
import { chartDataUrl, rankListUrl, scrollBoardUrl, numberFloatUrl, numberIntUrl, textUrl, imageUrl } from '@/api/mock'
import {
chartDataUrl,
chartSingleDataUrl,
rankListUrl,
scrollBoardUrl,
numberFloatUrl,
numberIntUrl,
textUrl,
imageUrl,
radarUrl
} from '@/api/mock'
const { HelpOutlineIcon } = icon.ionicons5
const { targetData, chartEditStore } = useTargetData()
@@ -73,6 +83,9 @@ const apiList = [
{
value: `【图表】${chartDataUrl}`
},
{
value: `【单数据图表】${chartSingleDataUrl}`
},
{
value: `【文本】${textUrl}`
},
@@ -90,6 +103,9 @@ const apiList = [
},
{
value: `【滚动表格】${scrollBoardUrl}`
},
{
value: `【雷达】${radarUrl}`
}
]
</script>
@@ -33,7 +33,7 @@ import { useTargetData } from '../../../hooks/useTargetData.hook'
import { RequestGlobalConfig } from './components/RequestGlobalConfig'
import { RequestTargetConfig } from './components/RequestTargetConfig'
const emit = defineEmits(['update:modelShow'])
const emit = defineEmits(['update:modelShow', 'sendHandle'])
const { targetData } = useTargetData()
// 解构基础配置
@@ -50,6 +50,7 @@ defineProps({
const closeHandle = () => {
emit('update:modelShow', false)
emit('sendHandle')
}
</script>
@@ -1,16 +1,11 @@
<template>
<div class="go-chart-configurations-data" v-if="targetData">
<setting-item-box name="请求方式" :alone="true">
<n-select
v-model:value="targetData.request.requestDataType"
:options="selectOptions"
/>
<n-select v-model:value="targetData.request.requestDataType" :disabled="isNotData" :options="selectOptions" />
</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>
@@ -18,6 +13,7 @@
</template>
<script setup lang="ts">
import { computed } from 'vue'
import { SettingItemBox } from '@/components/Pages/ChartItemSetting'
import { useTargetData } from '../hooks/useTargetData.hook'
import { ChartDataStatic } from './components/ChartDataStatic/index'
@@ -38,4 +34,9 @@ const selectOptions: SelectCreateDataType[] = [
value: RequestDataTypeEnum.AJAX
}
]
</script>
// 无数据源
const isNotData = computed(() => {
return typeof targetData.value?.option?.dataset === 'undefined'
})
</script>
+2 -1
View File
@@ -7,6 +7,7 @@
:showBottom="true"
:depth="1"
:xScroll="true"
@mousedown="mousedownHandleUnStop"
@drop="dragHandle"
@dragover="dragoverHandle"
@dragenter="dragoverHandle"
@@ -88,7 +89,7 @@ import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore
import { useLayout } from './hooks/useLayout.hook'
import { useAddKeyboard } from '../hooks/useKeyboard.hook'
import { useSync } from '../hooks/useSync.hook'
import { dragHandle, dragoverHandle, useMouseHandle } from './hooks/useDrag.hook'
import { dragHandle, dragoverHandle, mousedownHandleUnStop, useMouseHandle } from './hooks/useDrag.hook'
import { useComponentStyle, useSizeStyle } from './hooks/useStyle.hook'
import { ContentBox } from '../ContentBox/index'
@@ -20,6 +20,7 @@
round
placeholder="请输入项目名称"
v-model:value.trim="title"
@keyup.enter="handleBlur"
@blur="handleBlur"
></n-input>
</n-space>
@@ -43,7 +43,7 @@ const props = defineProps({
}
})
const { image } = toRefs(props.componentData.chartConfig)
const { image } = props.componentData.chartConfig
// 计算当前选中目标
const select = computed(() => {
+20 -13
View File
@@ -17,7 +17,7 @@
<n-text class="not-layer-text">暂无图层~</n-text>
</n-space>
<!-- https://github.com/SortableJS/vue.draggable.next -->
<draggable item-key="id" v-model="reverseList" ghostClass="ghost" @change="onMoveCallback">
<draggable item-key="id" v-model="layerList" ghostClass="ghost" @change="onMoveCallback">
<template #item="{ element }">
<div class="go-content-layer-box">
<!-- 组合 -->
@@ -27,7 +27,7 @@
v-else
:componentData="element"
@mousedown="mousedownHandle($event, element)"
@mouseenter="mouseenterHandle(element)"
@mouseenter="mouseenterHandle(element)"
@mouseleave="mouseleaveHandle(element)"
@contextmenu="handleContextMenu($event, element, optionsHandle)"
></layers-list-item>
@@ -38,7 +38,7 @@
</template>
<script setup lang="ts">
import { computed, toRaw } from 'vue'
import { computed, ref, watch } from 'vue'
import Draggable from 'vuedraggable'
import cloneDeep from 'lodash/cloneDeep'
import { ContentBox } from '../ContentBox/index'
@@ -58,9 +58,23 @@ import { icon } from '@/plugins'
const { LayersIcon } = icon.ionicons5
const chartLayoutStore = useChartLayoutStore()
const chartEditStore = useChartEditStore()
const { handleContextMenu, onClickOutSide } = useContextMenu()
const layerList = ref<any>([])
// 逆序展示
const reverseList = computed(() => {
const list: Array<CreateComponentType | CreateComponentGroupType> = cloneDeep(chartEditStore.getComponentList)
return list.reverse()
})
watch(
() => reverseList.value,
newValue => {
layerList.value = newValue
}
)
// 右键事件
const optionsHandle = (
targetList: MenuOptionsItemType[],
@@ -80,12 +94,6 @@ const optionsHandle = (
}
return targetList
}
// 逆序展示
const reverseList = computed(() => {
const list: Array<CreateComponentType | CreateComponentGroupType> = cloneDeep(chartEditStore.getComponentList)
return list.reverse()
})
// 缩小
const backHandle = () => {
@@ -95,14 +103,13 @@ const backHandle = () => {
// 移动结束处理
const onMoveCallback = (val: any) => {
const { oldIndex, newIndex } = val.moved
const moveTarget = toRaw(val.moved.element)
if (newIndex - oldIndex > 0) {
// 从上往下
chartEditStore.getComponentList.splice(-(oldIndex + 1), 1)
const moveTarget = chartEditStore.getComponentList.splice(-(oldIndex + 1), 1)[0]
chartEditStore.getComponentList.splice(-newIndex, 0, moveTarget)
} else {
// 从下往上
chartEditStore.getComponentList.splice(-(oldIndex + 1), 1)
const moveTarget = chartEditStore.getComponentList.splice(-(oldIndex + 1), 1)[0]
if (newIndex === 0) {
chartEditStore.getComponentList.push(moveTarget)
} else {