index.vue 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <template>
  2. <!-- 工作台相关 -->
  3. <div class="go-chart">
  4. <n-layout>
  5. <layout-header-pro>
  6. <template #left>
  7. <header-left-btn></header-left-btn>
  8. </template>
  9. <template #center>
  10. <header-title></header-title>
  11. </template>
  12. <template #ri-left>
  13. <header-right-btn></header-right-btn>
  14. </template>
  15. </layout-header-pro>
  16. <n-layout-content content-style="overflow:hidden; display: flex">
  17. <content-charts></content-charts>
  18. <content-layers></content-layers>
  19. <content-configurations></content-configurations>
  20. </n-layout-content>
  21. </n-layout>
  22. </div>
  23. <!-- 右键 -->
  24. <n-dropdown
  25. placement="bottom-start"
  26. trigger="manual"
  27. size="small"
  28. :x="mousePosition.x"
  29. :y="mousePosition.y"
  30. :options="menuOptions"
  31. :show="chartEditStore.getRightMenuShow"
  32. :on-clickoutside="onClickoutside"
  33. @select="handleMenuSelect"
  34. ></n-dropdown>
  35. </template>
  36. <script setup lang="ts">
  37. import { loadAsyncComponent } from '@/utils'
  38. import { LayoutHeaderPro } from '@/layout/components/LayoutHeaderPro'
  39. import { useContextMenu } from './hooks/useContextMenu.hook'
  40. import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
  41. import { useChartHistoryStore } from '@/store/modules/chartHistoryStore/chartHistoryStore'
  42. const chartHistoryStoreStore = useChartHistoryStore()
  43. const chartEditStore = useChartEditStore()
  44. // 记录初始化
  45. chartHistoryStoreStore.canvasInit(chartEditStore.getEditCanvas)
  46. const HeaderLeftBtn = loadAsyncComponent(() =>
  47. import('./headerLeftBtn/index.vue')
  48. )
  49. const HeaderRightBtn = loadAsyncComponent(() =>
  50. import('./headerRightBtn/index.vue')
  51. )
  52. const HeaderTitle = loadAsyncComponent(() => import('./headerTitle/index.vue'))
  53. const ContentLayers = loadAsyncComponent(() =>
  54. import('./contentLayers/index.vue')
  55. )
  56. const ContentCharts = loadAsyncComponent(() =>
  57. import('./contentCharts/index.vue')
  58. )
  59. const ContentConfigurations = loadAsyncComponent(() =>
  60. import('./contentConfigurations/index.vue')
  61. )
  62. // 右键
  63. const {
  64. menuOptions,
  65. onClickoutside,
  66. mousePosition,
  67. handleMenuSelect
  68. } = useContextMenu()
  69. </script>
  70. <style lang="scss" scoped>
  71. @include go('chart') {
  72. height: 100vh;
  73. width: 100vw;
  74. overflow: hidden;
  75. @include background-image('background-image');
  76. }
  77. </style>