소스 검색

fix: 修改key

mtruning 3 년 전
부모
커밋
d54c9d2388
36개의 변경된 파일130개의 추가작업 그리고 86개의 파일을 삭제
  1. 11 2
      src/components/LoadingComponent/index.ts
  2. 1 1
      src/components/LoadingComponent/index.vue
  3. 1 1
      src/packages/components/Chart/Bars/BarCommon/index.ts
  4. 1 1
      src/packages/components/Chart/Bars/BarCrossrange/index.ts
  5. 1 1
      src/packages/components/Chart/Lines/LineCommon/index.ts
  6. 1 1
      src/packages/components/Chart/Lines/LineGradientSingle/index.ts
  7. 1 1
      src/packages/components/Chart/Lines/LineGradients/index.ts
  8. 1 1
      src/packages/components/Chart/Maps/MapChine/index.ts
  9. 1 1
      src/packages/components/Chart/Mores/Funnel/index.ts
  10. 1 1
      src/packages/components/Chart/Mores/Heatmap/index.ts
  11. 1 1
      src/packages/components/Chart/Mores/Point/index.ts
  12. 1 1
      src/packages/components/Chart/Mores/Radar/index.ts
  13. 1 1
      src/packages/components/Chart/Mores/TreeMap/index.ts
  14. 1 1
      src/packages/components/Chart/Mores/Variable/index.ts
  15. 1 1
      src/packages/components/Chart/Pies/PieCommon/index.ts
  16. 1 1
      src/packages/components/Decorate/Mores/Number/index.ts
  17. 1 1
      src/packages/components/Decorate/Mores/Time/index.ts
  18. 1 1
      src/packages/components/Decorate/Mores/Weather/index.ts
  19. 1 1
      src/packages/components/Decorate/Mores/WeatherTime/index.ts
  20. 1 1
      src/packages/components/Decorate/borders/borderCommon/index.ts
  21. 1 1
      src/packages/components/Information/Mores/Image/index.ts
  22. 1 1
      src/packages/components/Information/Mores/TextCloud/index.ts
  23. 1 1
      src/packages/components/Information/Texts/TextCommon/index.ts
  24. 1 1
      src/packages/components/Information/Titles/TitleBevelAngle/index.ts
  25. 1 1
      src/packages/components/Information/Titles/TitleCommon/index.ts
  26. 1 1
      src/packages/components/Information/Titles/TitlePro/index.ts
  27. 1 1
      src/packages/components/Tables/TableCategory/index.ts
  28. 1 1
      src/packages/components/Tables/tableCommon/index.ts
  29. 0 0
      src/packages/echarts/index.d.ts
  30. 0 0
      src/packages/echarts/index.ts
  31. 1 1
      src/store/modules/chartLayoutStore/chartLayoutStore.ts
  32. 14 0
      src/utils/componets.ts
  33. 1 1
      src/utils/utils.ts
  34. 65 41
      src/views/chart/components/ContentDetails/index.vue
  35. 11 12
      src/views/chart/components/HeaderLeftBtn/index.vue
  36. 0 2
      src/views/chart/index.vue

+ 11 - 2
src/components/LoadingComponent/index.ts

@@ -1,3 +1,12 @@
-import LoadingComponent from './index.vue';
+import type { App } from 'vue'
+import LoadingComponent from './index.vue'
+import AsyncLoading from './index.vue'
 
-export { LoadingComponent };
+// 正常组件
+export { LoadingComponent }
+
+// 异步
+AsyncLoading.install = (app: App): void => {
+  app.component('AsyncLoading', AsyncLoading)
+}
+export { AsyncLoading }

+ 1 - 1
src/components/LoadingComponent/index.vue

@@ -1,6 +1,6 @@
 <template>
   <div>
-    <Skeleton repeat="3" :load="true"/>
+    <Skeleton :repeat="3" :load="true"/>
   </div>
 </template>
 

+ 1 - 1
src/packages/components/Chart/Bars/BarCommon/index.ts

@@ -4,7 +4,7 @@ import { ConfigType } from '@/packages/index.d'
 import { ChatCategoryEnum } from '../../index.d'
 
 export const BarCommonConfig: ConfigType = {
-  key: 'BarCommon',
+  key: 'VBarCommon',
   title: '柱状图',
   category: ChatCategoryEnum.BAR,
   node: BarCommon,

+ 1 - 1
src/packages/components/Chart/Bars/BarCrossrange/index.ts

@@ -4,7 +4,7 @@ import { ConfigType } from '@/packages/index.d'
 import { ChatCategoryEnum } from '../../index.d'
 
 export const BarCrossrangefig: ConfigType = {
-  key: 'BarCrossrange',
+  key: 'VBarCrossrange',
   title: '横向柱状图',
   category: ChatCategoryEnum.BAR,
   node: BarCrossrange,

+ 1 - 1
src/packages/components/Chart/Lines/LineCommon/index.ts

@@ -4,7 +4,7 @@ import { ConfigType } from '@/packages/index.d'
 import { ChatCategoryEnum } from '../../index.d'
 
 export const LineCommonConfig: ConfigType = {
-  key: 'LineCommon',
+  key: 'VLineCommon',
   title: '折线图',
   category: ChatCategoryEnum.LINE,
   node: LineCommon,

+ 1 - 1
src/packages/components/Chart/Lines/LineGradientSingle/index.ts

@@ -4,7 +4,7 @@ import { ConfigType } from '@/packages/index.d'
 import { ChatCategoryEnum } from '../../index.d'
 
 export const LineGradientSingleConfig: ConfigType = {
-  key: 'LineGradientSingle',
+  key: 'VLineGradientSingle',
   title: '折线面积图',
   category: ChatCategoryEnum.LINE,
   node: LineGradientSingle,

+ 1 - 1
src/packages/components/Chart/Lines/LineGradients/index.ts

@@ -4,7 +4,7 @@ import { ConfigType } from '@/packages/index.d'
 import { ChatCategoryEnum } from '../../index.d'
 
 export const LineGradientsConfig: ConfigType = {
-  key: 'LineGradientSingle',
+  key: 'VLineGradientSingle',
   title: '折线面积图',
   category: ChatCategoryEnum.LINE,
   node: LineGradients,

+ 1 - 1
src/packages/components/Chart/Maps/MapChine/index.ts

@@ -4,7 +4,7 @@ import { ConfigType } from '@/packages/index.d'
 import { ChatCategoryEnum } from '../../index.d'
 
 export const MapChineConfig: ConfigType = {
-  key: 'MapChine',
+  key: 'VMapChine',
   title: '北京地图',
   category: ChatCategoryEnum.MAP,
   node: MapChine,

+ 1 - 1
src/packages/components/Chart/Mores/Funnel/index.ts

@@ -4,7 +4,7 @@ import { ConfigType } from '@/packages/index.d'
 import { ChatCategoryEnum } from '../../index.d'
 
 export const FunnelConfig: ConfigType = {
-  key: 'Funnel',
+  key: 'VFunnel',
   title: '漏斗图',
   category: ChatCategoryEnum.MORE,
   node: Funnel,

+ 1 - 1
src/packages/components/Chart/Mores/Heatmap/index.ts

@@ -4,7 +4,7 @@ import { ConfigType } from '@/packages/index.d'
 import { ChatCategoryEnum } from '../../index.d'
 
 export const HeatmapConfig: ConfigType = {
-  key: 'Heatmap',
+  key: 'VHeatmap',
   title: '热力图',
   category: ChatCategoryEnum.MORE,
   node: Heatmap,

+ 1 - 1
src/packages/components/Chart/Mores/Point/index.ts

@@ -4,7 +4,7 @@ import { ConfigType } from '@/packages/index.d'
 import { ChatCategoryEnum } from '../../index.d'
 
 export const PointConfig: ConfigType = {
-  key: 'Point',
+  key: 'VPoint',
   title: '热力图',
   category: ChatCategoryEnum.MORE,
   node: Point,

+ 1 - 1
src/packages/components/Chart/Mores/Radar/index.ts

@@ -4,7 +4,7 @@ import { ConfigType } from '@/packages/index.d'
 import { ChatCategoryEnum } from '../../index.d'
 
 export const RadarConfig: ConfigType = {
-  key: 'Radar',
+  key: 'VRadar',
   title: '雷达',
   category: ChatCategoryEnum.MORE,
   node: Radar,

+ 1 - 1
src/packages/components/Chart/Mores/TreeMap/index.ts

@@ -4,7 +4,7 @@ import { ConfigType } from '@/packages/index.d'
 import { ChatCategoryEnum } from '../../index.d'
 
 export const TreeMapConfig: ConfigType = {
-  key: 'TreeMap',
+  key: 'VTreeMap',
   title: '树形分布',
   category: ChatCategoryEnum.MORE,
   node: TreeMap,

+ 1 - 1
src/packages/components/Chart/Mores/Variable/index.ts

@@ -4,7 +4,7 @@ import { ConfigType } from '@/packages/index.d'
 import { ChatCategoryEnum } from '../../index.d'
 
 export const VariableConfig: ConfigType = {
-  key: 'Variable',
+  key: 'VVariable',
   title: '折线面积图',
   category: ChatCategoryEnum.MORE,
   node: Variable,

+ 1 - 1
src/packages/components/Chart/Pies/PieCommon/index.ts

@@ -4,7 +4,7 @@ import { ConfigType } from '@/packages/index.d'
 import { ChatCategoryEnum } from '../../index.d'
 
 export const PieCommonConfig: ConfigType = {
-  key: 'PieCommon',
+  key: 'VPieCommon',
   title: '计量图',
   category: ChatCategoryEnum.PIE,
   node: PieCommon,

+ 1 - 1
src/packages/components/Decorate/Mores/Number/index.ts

@@ -4,7 +4,7 @@ import { ConfigType } from '@/packages/index.d'
 import { ChatCategoryEnum } from '../../index.d'
 
 export const NumberConfig: ConfigType = {
-  key: 'Number',
+  key: 'VNumber',
   title: '数字翻牌',
   category: ChatCategoryEnum.MORE,
   node: Number,

+ 1 - 1
src/packages/components/Decorate/Mores/Time/index.ts

@@ -4,7 +4,7 @@ import { ConfigType } from '@/packages/index.d'
 import { ChatCategoryEnum } from '../../index.d'
 
 export const TimeConfig: ConfigType = {
-  key: 'Time',
+  key: 'VTime',
   title: '时间',
   category: ChatCategoryEnum.MORE,
   node: Time,

+ 1 - 1
src/packages/components/Decorate/Mores/Weather/index.ts

@@ -4,7 +4,7 @@ import { ConfigType } from '@/packages/index.d'
 import { ChatCategoryEnum } from '../../index.d'
 
 export const WeatherConfig: ConfigType = {
-  key: 'Weather',
+  key: 'VWeather',
   title: '天气',
   category: ChatCategoryEnum.MORE,
   node: Weather,

+ 1 - 1
src/packages/components/Decorate/Mores/WeatherTime/index.ts

@@ -4,7 +4,7 @@ import { ConfigType } from '@/packages/index.d'
 import { ChatCategoryEnum } from '../../index.d'
 
 export const WeatherTimeConfig: ConfigType = {
-  key: 'WeatherTime',
+  key: 'VWeatherTime',
   title: '天气和时间',
   category: ChatCategoryEnum.MORE,
   node: WeatherTime,

+ 1 - 1
src/packages/components/Decorate/borders/borderCommon/index.ts

@@ -4,7 +4,7 @@ import { ConfigType } from '@/packages/index.d'
 import { ChatCategoryEnum } from '../../index.d'
 
 export const BorderCommonConfig: ConfigType = {
-  key: 'BorderCommon',
+  key: 'VBorderCommon',
   title: '边框',
   category: ChatCategoryEnum.BORDER,
   node: BorderCommon,

+ 1 - 1
src/packages/components/Information/Mores/Image/index.ts

@@ -4,7 +4,7 @@ import { ConfigType } from '@/packages/index.d'
 import { ChatCategoryEnum } from '../../index.d'
 
 export const ImageConfig: ConfigType = {
-  key: 'Image',
+  key: 'VImage',
   title: '图片',
   category: ChatCategoryEnum.MORE,
   node: Image,

+ 1 - 1
src/packages/components/Information/Mores/TextCloud/index.ts

@@ -4,7 +4,7 @@ import { ConfigType } from '@/packages/index.d'
 import { ChatCategoryEnum } from '../../index.d'
 
 export const TextCloudConfig: ConfigType = {
-  key: 'TextCloud',
+  key: 'VTextCloud',
   title: '词云',
   category: ChatCategoryEnum.MORE,
   node: TextCloud,

+ 1 - 1
src/packages/components/Information/Texts/TextCommon/index.ts

@@ -4,7 +4,7 @@ import { ConfigType } from '@/packages/index.d'
 import { ChatCategoryEnum } from '../../index.d'
 
 export const TextCommonConfig: ConfigType = {
-  key: 'Text',
+  key: 'VText',
   title: '文字',
   category: ChatCategoryEnum.TEXT,
   node: TextCommon,

+ 1 - 1
src/packages/components/Information/Titles/TitleBevelAngle/index.ts

@@ -4,7 +4,7 @@ import { ConfigType } from '@/packages/index.d'
 import { ChatCategoryEnum } from '../../index.d'
 
 export const TitleBevelAngleConfig: ConfigType = {
-  key: 'TitleBevelAngle',
+  key: 'VTitleBevelAngle',
   title: '斜角标题',
   category: ChatCategoryEnum.TITLE,
   node: TitleBevelAngle,

+ 1 - 1
src/packages/components/Information/Titles/TitleCommon/index.ts

@@ -4,7 +4,7 @@ import { ConfigType } from '@/packages/index.d'
 import { ChatCategoryEnum } from '../../index.d'
 
 export const TitleCommonConfig: ConfigType = {
-  key: 'Text',
+  key: 'VText',
   title: '普通标题',
   category: ChatCategoryEnum.TITLE,
   node: TitleCommon,

+ 1 - 1
src/packages/components/Information/Titles/TitlePro/index.ts

@@ -4,7 +4,7 @@ import { ConfigType } from '@/packages/index.d'
 import { ChatCategoryEnum } from '../../index.d'
 
 export const TitleProConfig: ConfigType = {
-  key: 'TitlePro',
+  key: 'VTitlePro',
   title: '中心标题',
   category: ChatCategoryEnum.TITLE,
   node: TitlePro,

+ 1 - 1
src/packages/components/Tables/TableCategory/index.ts

@@ -4,7 +4,7 @@ import { ConfigType } from '@/packages/index.d'
 import { ChatCategoryEnum } from '../index.d'
 
 export const TableCategoryConfig: ConfigType = {
-  key: 'TableCategory',
+  key: 'VTableCategory',
   title: '归类表格',
   category: ChatCategoryEnum.table,
   node: TableCategory,

+ 1 - 1
src/packages/components/Tables/tableCommon/index.ts

@@ -4,7 +4,7 @@ import { ConfigType } from '@/packages/index.d'
 import { ChatCategoryEnum } from '../index.d'
 
 export const TableCommonConfig: ConfigType = {
-  key: 'TableCommon',
+  key: 'VTableCommon',
   title: '表格',
   category: ChatCategoryEnum.table,
   node: TableCommon,

+ 0 - 0
src/packages/echarts/index.d.ts


+ 0 - 0
src/packages/echarts/index.ts


+ 1 - 1
src/store/modules/chartLayoutStore/chartLayoutStore.ts

@@ -58,7 +58,7 @@ export const useChartLayoutStore = defineStore({
       ;(this as any)[key] = value
       setLocalStorage(GO_CHART_LAYOUT_STORE, this.$state)
     },
-    setFilter<T extends keyof ChartLayoutType>(key: T, value: boolean): void {
+    setFilter<T extends keyof ChartLayoutFilterType>(key: T, value: boolean): void {
       ;(this.filter as any)[key] = value
       setLocalStorage(GO_CHART_LAYOUT_STORE, this.$state)
     },

+ 14 - 0
src/utils/componets.ts

@@ -0,0 +1,14 @@
+import { defineAsyncComponent, AsyncComponentLoader } from 'vue'
+import { AsyncLoading } from '@/components/LoadingComponent'
+
+/**
+ * * 异步加载组件
+ * @param loader
+ * @returns
+ */
+export const loadAsyncComponent = (loader: AsyncComponentLoader<any>) =>
+  defineAsyncComponent({
+    loader,
+    loadingComponent: AsyncLoading,
+    delay: 20,
+  })

+ 1 - 1
src/utils/utils.ts

@@ -4,7 +4,7 @@ import screenfull from 'screenfull'
 import debounce from 'lodash/debounce'
 
 /**
- * * 生成一个不重复的ID
+ * * 生成一个不重复的ID
  * @param { Number } randomLength
  */
 export function getUUID(randomLength: number) {

+ 65 - 41
src/views/chart/components/ContentDetails/index.vue

@@ -1,76 +1,100 @@
 <template>
-  <ContentBox
-    class="go-content-layers go-boderbox"
-    :class="{ scoped: !chartLayoutStore.getDetails }"
-    :showTop="false"
-    :depth="2"
-  >
-    <n-tabs class="tabs-box" size="small" type="segment">
-      <n-tab-pane
-        v-for="item in tabList"
-        :key="item.key"
-        :name="item.key"
-        display-directive="show:lazy"
-      >
-        <template #tab>
-          <n-space>
-            <span>{{ item.title }}</span>
-            <n-icon size="16" class="icon-position">
-              <component :is="item.icon"></component>
-            </n-icon>
-          </n-space>
-        </template>
-        <component :is="item.render"></component>
-      </n-tab-pane>
-    </n-tabs>
-  </ContentBox>
+  <n-layout has-sider sider-placement="right">
+    <n-layout-content>
+      <!-- 为了展示折叠的按钮,放在了这里 呜呜呜 -->
+      <ContentDrag />
+    </n-layout-content>
+    <n-layout-sider
+      collapse-mode="transform"
+      :collapsed-width="0"
+      :width="350"
+      :collapsed="collapsed"
+      :native-scrollbar="false"
+      show-trigger="bar"
+      @collapse="collapsedHindle"
+      @expand="expandHindle"
+    >
+      <ContentBox class="go-content-layers go-boderbox" :showTop="false" :depth="2">
+        <n-tabs class="tabs-box" size="small" type="segment">
+          <n-tab-pane
+            v-for="item in tabList"
+            :key="item.key"
+            :name="item.key"
+            display-directive="show:lazy"
+          >
+            <template #tab>
+              <n-space>
+                <span>{{ item.title }}</span>
+                <n-icon size="16" class="icon-position">
+                  <component :is="item.icon"></component>
+                </n-icon>
+              </n-space>
+            </template>
+            <component :is="item.render"></component>
+          </n-tab-pane>
+        </n-tabs>
+      </ContentBox>
+    </n-layout-sider>
+  </n-layout>
 </template>
 
 <script setup lang="ts">
-import { reactive, shallowRef } from 'vue'
+import {  shallowRef, ref, toRefs, watch } from 'vue'
 import { icon } from '@/plugins'
 import { ContentBox } from '../ContentBox/index'
 import { useChartLayoutStore } from '@/store/modules/chartLayoutStore/chartLayoutStore'
+import { ChartLayoutStoreEnums } from '@/store/modules/chartLayoutStore/chartLayoutStore.d'
 import { Setting } from './components/Setting/index'
 import { Behind } from './components/Behind/index'
+import { ContentDrag } from '../ContentDrag/index'
 
-const chartLayoutStore = useChartLayoutStore()
+const { getDetails } = toRefs(useChartLayoutStore())
+const { setItem } = useChartLayoutStore()
 
 const { CubeIcon, FlashIcon } = icon.ionicons5
 
-const tabList = reactive([
+const collapsed = ref<boolean>(getDetails.value)
+
+const collapsedHindle = () => {
+  collapsed.value = true
+  setItem(ChartLayoutStoreEnums.DETAILS, true)
+}
+
+const expandHindle = () => {
+  collapsed.value = false
+  setItem(ChartLayoutStoreEnums.DETAILS, false)
+}
+
+watch(getDetails, (newData) => {
+  if (newData) {
+    collapsedHindle()
+  } else {
+    expandHindle()
+  }
+})
+
+const tabList = shallowRef([
   {
     key: 'setting',
     title: '配置项',
     icon: CubeIcon,
-    render: shallowRef(Setting)
+    render: Setting
   },
   {
     key: 'behind',
     title: '后端数据',
     icon: FlashIcon,
-    render: shallowRef(Behind)
+    render: Behind
   }
 ])
 </script>
 
 <style lang="scss" scoped>
-$wight: 400px;
 @include go(content-layers) {
-  width: $wight;
   padding: 10px;
   overflow: hidden;
-  @extend .go-transition;
   .icon-position {
     padding-top: 2px;
   }
-  &.scoped {
-    width: 0;
-    padding: 0;
-  }
-  .tabs-box {
-    /* padding 值 */
-    width: $wight - 2 * 10;
-  }
 }
 </style>

+ 11 - 12
src/views/chart/components/HeaderLeftBtn/index.vue

@@ -8,19 +8,9 @@
       </template>
     </n-button>
     <n-space>
-      <n-tooltip
-        v-for="item in btnList"
-        :key="item.key"
-        placement="bottom"
-        trigger="hover"
-      >
+      <n-tooltip v-for="item in btnList" :key="item.key" placement="bottom" trigger="hover">
         <template #trigger>
-          <n-button
-            :type="item.select ? 'success' : ''"
-            size="small"
-            ghost
-            @click="clickHandle(item)"
-          >
+          <n-button :type="styleHandle(item)" size="small" ghost @click="clickHandle(item)">
             <component :is="item.icon"></component>
           </n-button>
         </template>
@@ -69,6 +59,15 @@ const btnList = reactive<ItemType[]>([
   }
 ])
 
+
+// store 描述的是展示的值,所以和 ContentDetails 的 collapsed 是相反的
+const styleHandle = (item: ItemType) => {
+  if (item.key === ChartLayoutStoreEnums.DETAILS) {
+    return item.select ? '' : 'success'
+  }
+  return item.select ? 'success' : ''
+}
+
 const clickHandle = (item: ItemType) => {
   setItem(item.key, !item.select)
 }

+ 0 - 2
src/views/chart/index.vue

@@ -15,7 +15,6 @@
       <n-layout-content content-style="overflow:hidden; display: flex">
         <ContentCharts />
         <ContentLayers />
-        <ContentDrag />
         <ContentDetails />
       </n-layout-content>
     </n-layout>
@@ -29,7 +28,6 @@ import { HeaderRightBtn } from './components/HeaderRightBtn/index'
 import { HeaderTitle } from './components/HeaderTitle/index'
 import { ContentLayers } from './components/ContentLayers/index'
 import { ContentCharts } from './components/ContentCharts/index'
-import { ContentDrag } from './components/ContentDrag/index'
 import { ContentDetails } from './components/ContentDetails/index'
 </script>