Showing
2 changed files
with
44 additions
and
1 deletions
| 1 | +import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore' | ||
| 2 | +import { canvasCut, downloadTextFile, JSONStringify } from '@/utils' | ||
| 3 | +const chartEditStore = useChartEditStore() | ||
| 4 | + | ||
| 5 | +// 导出 | ||
| 6 | +export const exportHandle = () => { | ||
| 7 | + // 取消选中 | ||
| 8 | + chartEditStore.setTargetSelectChart(undefined) | ||
| 9 | + | ||
| 10 | + // 导出数据 | ||
| 11 | + downloadTextFile( | ||
| 12 | + JSONStringify(chartEditStore.getStorageInfo || []), | ||
| 13 | + undefined, | ||
| 14 | + 'json' | ||
| 15 | + ) | ||
| 16 | + | ||
| 17 | + // 导出图片 | ||
| 18 | + const range = document.querySelector('.go-edit-range') as HTMLElement | ||
| 19 | + const watermark = document.getElementById('go-edit-watermark') | ||
| 20 | + // 隐藏边距线 | ||
| 21 | + if (!range || !watermark) { | ||
| 22 | + window['$message'].error('导出失败!') | ||
| 23 | + return | ||
| 24 | + } | ||
| 25 | + | ||
| 26 | + // 记录缩放比例 | ||
| 27 | + const scaleTemp = chartEditStore.getEditCanvas.scale | ||
| 28 | + // 百分百展示页面 | ||
| 29 | + chartEditStore.setScale(1, true) | ||
| 30 | + // 展示水印 | ||
| 31 | + // THINGS_KIT 隐藏水印 | ||
| 32 | + watermark.style.display = 'none' | ||
| 33 | + | ||
| 34 | + //注释导出图片逻辑 | ||
| 35 | + // setTimeout(() => { | ||
| 36 | + // canvasCut(range, () => { | ||
| 37 | + // // 隐藏水印 | ||
| 38 | + // if (watermark) watermark.style.display = 'none' | ||
| 39 | + // // 还原页面大小 | ||
| 40 | + // chartEditStore.setScale(scaleTemp, true) | ||
| 41 | + // }) | ||
| 42 | + // }, 600) | ||
| 43 | +} |
| @@ -78,7 +78,7 @@ import { EditEnum } from '@/enums/pageEnum' | @@ -78,7 +78,7 @@ import { EditEnum } from '@/enums/pageEnum' | ||
| 78 | import { StorageEnum } from '@/enums/storageEnum' | 78 | import { StorageEnum } from '@/enums/storageEnum' |
| 79 | import { useRoute } from 'vue-router' | 79 | import { useRoute } from 'vue-router' |
| 80 | import { GoSystemSet } from '@/components/GoSystemSet/index' | 80 | import { GoSystemSet } from '@/components/GoSystemSet/index' |
| 81 | -import { exportHandle } from './utils' | 81 | +import { exportHandle } from './external'// THINGS_KIT 修改引入路径 |
| 82 | import { useFile } from './hooks/useFile.hooks' | 82 | import { useFile } from './hooks/useFile.hooks' |
| 83 | import { useSyncUpdate } from './hooks/useSyncUpdate.hook' | 83 | import { useSyncUpdate } from './hooks/useSyncUpdate.hook' |
| 84 | import { BtnListType, TypeEnum } from './index.d' | 84 | import { BtnListType, TypeEnum } from './index.d' |