mirror of
https://gitee.com/dromara/go-view.git
synced 2025-04-25 06:50:10 +08:00
feat: 新增保存按钮
This commit is contained in:
parent
7a19346700
commit
68aeea70cf
@ -81,7 +81,8 @@ import {
|
|||||||
Scale as ScaleIcon,
|
Scale as ScaleIcon,
|
||||||
FitToScreen as FitToScreenIcon,
|
FitToScreen as FitToScreenIcon,
|
||||||
FitToHeight as FitToHeightIcon,
|
FitToHeight as FitToHeightIcon,
|
||||||
FitToWidth as FitToWidthIcon
|
FitToWidth as FitToWidthIcon,
|
||||||
|
Save as SaveIcon
|
||||||
} from '@vicons/carbon'
|
} from '@vicons/carbon'
|
||||||
|
|
||||||
const ionicons5 = {
|
const ionicons5 = {
|
||||||
@ -237,7 +238,9 @@ const carbon = {
|
|||||||
ScaleIcon,
|
ScaleIcon,
|
||||||
FitToScreenIcon,
|
FitToScreenIcon,
|
||||||
FitToHeightIcon,
|
FitToHeightIcon,
|
||||||
FitToWidthIcon
|
FitToWidthIcon,
|
||||||
|
// 保存
|
||||||
|
SaveIcon
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://www.xicons.org/#/ 还有很多
|
// https://www.xicons.org/#/ 还有很多
|
||||||
|
@ -29,26 +29,44 @@
|
|||||||
</template>
|
</template>
|
||||||
<span>{{ item.title }}</span>
|
<span>{{ item.title }}</span>
|
||||||
</n-tooltip>
|
</n-tooltip>
|
||||||
|
|
||||||
|
<n-divider vertical />
|
||||||
|
|
||||||
|
<!-- 保存 -->
|
||||||
|
<n-tooltip placement="bottom" trigger="hover">
|
||||||
|
<template #trigger>
|
||||||
|
<div class="save-btn" >
|
||||||
|
<n-button size="small" type="primary" ghost @click="dataSyncUpdate()">
|
||||||
|
<template #icon>
|
||||||
|
<n-icon>
|
||||||
|
<SaveIcon></SaveIcon>
|
||||||
|
</n-icon>
|
||||||
|
</template>
|
||||||
|
</n-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<span>保存</span>
|
||||||
|
</n-tooltip>
|
||||||
</n-space>
|
</n-space>
|
||||||
</n-space>
|
</n-space>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { toRefs, Ref, reactive, computed } from 'vue'
|
import { toRefs, ref, Ref, reactive, computed } from 'vue'
|
||||||
import { renderIcon, goDialog, goHome } from '@/utils'
|
import { renderIcon, goDialog, goHome } from '@/utils'
|
||||||
import { icon } from '@/plugins'
|
import { icon } from '@/plugins'
|
||||||
import { useRemoveKeyboard } from '../../hooks/useKeyboard.hook'
|
import { useRemoveKeyboard } from '../../hooks/useKeyboard.hook'
|
||||||
|
import { useSync } from '../../hooks/useSync.hook'
|
||||||
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
|
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
|
||||||
|
|
||||||
import { useChartHistoryStore } from '@/store/modules/chartHistoryStore/chartHistoryStore'
|
import { useChartHistoryStore } from '@/store/modules/chartHistoryStore/chartHistoryStore'
|
||||||
import { HistoryStackEnum } from '@/store/modules/chartHistoryStore/chartHistoryStore.d'
|
import { HistoryStackEnum } from '@/store/modules/chartHistoryStore/chartHistoryStore.d'
|
||||||
|
|
||||||
import { useChartLayoutStore } from '@/store/modules/chartLayoutStore/chartLayoutStore'
|
import { useChartLayoutStore } from '@/store/modules/chartLayoutStore/chartLayoutStore'
|
||||||
import { ChartLayoutStoreEnum } from '@/store/modules/chartLayoutStore/chartLayoutStore.d'
|
import { ChartLayoutStoreEnum } from '@/store/modules/chartLayoutStore/chartLayoutStore.d'
|
||||||
|
|
||||||
const { LayersIcon, BarChartIcon, PrismIcon, HomeIcon, ArrowBackIcon, ArrowForwardIcon } = icon.ionicons5
|
const { LayersIcon, BarChartIcon, PrismIcon, HomeIcon, ArrowBackIcon, ArrowForwardIcon } = icon.ionicons5
|
||||||
|
const { SaveIcon } = icon.carbon
|
||||||
const { setItem } = useChartLayoutStore()
|
const { setItem } = useChartLayoutStore()
|
||||||
|
const { dataSyncUpdate } = useSync()
|
||||||
const { getLayers, getCharts, getDetails } = toRefs(useChartLayoutStore())
|
const { getLayers, getCharts, getDetails } = toRefs(useChartLayoutStore())
|
||||||
const chartEditStore = useChartEditStore()
|
const chartEditStore = useChartEditStore()
|
||||||
const chartHistoryStore = useChartHistoryStore()
|
const chartHistoryStore = useChartHistoryStore()
|
||||||
|
@ -8,6 +8,7 @@ import { useSystemStore } from '@/store/modules/systemStore/systemStore'
|
|||||||
import { fetchChartComponent, fetchConfigComponent, createComponent } from '@/packages/index'
|
import { fetchChartComponent, fetchConfigComponent, createComponent } from '@/packages/index'
|
||||||
import { CreateComponentType } from '@/packages/index.d'
|
import { CreateComponentType } from '@/packages/index.d'
|
||||||
import { saveInterval } from '@/settings/designSetting'
|
import { saveInterval } from '@/settings/designSetting'
|
||||||
|
import throttle from 'lodash/throttle'
|
||||||
// 接口状态
|
// 接口状态
|
||||||
import { ResultEnum } from '@/enums/httpEnum'
|
import { ResultEnum } from '@/enums/httpEnum'
|
||||||
// 接口
|
// 接口
|
||||||
@ -119,7 +120,7 @@ export const useSync = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// * 数据保存
|
// * 数据保存
|
||||||
const dataSyncUpdate = async () => {
|
const dataSyncUpdate = throttle(async () => {
|
||||||
if(!fetchRouteParamsLocation()) return
|
if(!fetchRouteParamsLocation()) return
|
||||||
|
|
||||||
if(!systemStore.getFetchInfo.OSSUrl) {
|
if(!systemStore.getFetchInfo.OSSUrl) {
|
||||||
@ -164,7 +165,7 @@ export const useSync = () => {
|
|||||||
}
|
}
|
||||||
// 失败状态
|
// 失败状态
|
||||||
chartEditStore.setEditCanvas(EditCanvasTypeEnum.SAVE_STATUS, SyncEnum.FAILURE)
|
chartEditStore.setEditCanvas(EditCanvasTypeEnum.SAVE_STATUS, SyncEnum.FAILURE)
|
||||||
}
|
}, 3000)
|
||||||
|
|
||||||
// * 定时处理
|
// * 定时处理
|
||||||
const intervalDataSyncUpdate = () => {
|
const intervalDataSyncUpdate = () => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user