|
@@ -17,31 +17,44 @@
|
|
|
placement="left"
|
|
placement="left"
|
|
|
>
|
|
>
|
|
|
<template #trigger>
|
|
<template #trigger>
|
|
|
- <n-button
|
|
|
|
|
- v-show="!isMini"
|
|
|
|
|
- class="btn-item"
|
|
|
|
|
- :class="[btnList.length - 1 === index && 'go-mb-0']"
|
|
|
|
|
- :circle="isAside"
|
|
|
|
|
- secondary
|
|
|
|
|
- @click="item.handle"
|
|
|
|
|
- >
|
|
|
|
|
- <template #icon>
|
|
|
|
|
- <n-icon size="22" v-if="isAside">
|
|
|
|
|
- <component :is="item.icon"></component>
|
|
|
|
|
- </n-icon>
|
|
|
|
|
- <component v-else :is="item.icon"></component>
|
|
|
|
|
- </template>
|
|
|
|
|
- <n-text depth="3" v-show="!isAside">{{ item.name }}</n-text>
|
|
|
|
|
- </n-button>
|
|
|
|
|
|
|
+ <div v-show="!isMini" class="btn-item" :class="[btnList.length - 1 === index && 'go-mb-0']">
|
|
|
|
|
+ <n-button v-if="item.type === TypeEnum.BOTTON" :circle="isAside" secondary @click="item.handle">
|
|
|
|
|
+ <template #icon>
|
|
|
|
|
+ <n-icon size="22" v-if="isAside">
|
|
|
|
|
+ <component :is="item.icon"></component>
|
|
|
|
|
+ </n-icon>
|
|
|
|
|
+ <component v-else :is="item.icon"></component>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ <n-text depth="3" v-show="!isAside">{{ item.name }}</n-text>
|
|
|
|
|
+ </n-button>
|
|
|
|
|
+ <!-- 下载 -->
|
|
|
|
|
+ <n-upload
|
|
|
|
|
+ v-else-if="item.type === TypeEnum.IMPORTUPLOAD"
|
|
|
|
|
+ v-model:file-list="importUploadFileListRef"
|
|
|
|
|
+ :show-file-list="false"
|
|
|
|
|
+ :customRequest="importCustomRequest"
|
|
|
|
|
+ @before-upload="importBeforeUpload"
|
|
|
|
|
+ >
|
|
|
|
|
+ <n-button :circle="isAside" secondary>
|
|
|
|
|
+ <template #icon>
|
|
|
|
|
+ <n-icon size="22" v-if="isAside">
|
|
|
|
|
+ <component :is="item.icon"></component>
|
|
|
|
|
+ </n-icon>
|
|
|
|
|
+ <component v-else :is="item.icon"></component>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ <n-text depth="3" v-show="!isAside">{{ item.name }}</n-text>
|
|
|
|
|
+ </n-button>
|
|
|
|
|
+ </n-upload>
|
|
|
|
|
+ </div>
|
|
|
</template>
|
|
</template>
|
|
|
<!-- 提示 -->
|
|
<!-- 提示 -->
|
|
|
<span>{{ item.name }}</span>
|
|
<span>{{ item.name }}</span>
|
|
|
</n-tooltip>
|
|
</n-tooltip>
|
|
|
<!-- PawIcon -->
|
|
<!-- PawIcon -->
|
|
|
<n-icon
|
|
<n-icon
|
|
|
|
|
+ v-if="isAside"
|
|
|
v-show="settingStore.getChartToolsStatus === ToolsStatusEnum.ASIDE && isMini"
|
|
v-show="settingStore.getChartToolsStatus === ToolsStatusEnum.ASIDE && isMini"
|
|
|
size="22"
|
|
size="22"
|
|
|
- v-if="isAside"
|
|
|
|
|
>
|
|
>
|
|
|
<PawIcon></PawIcon>
|
|
<PawIcon></PawIcon>
|
|
|
</n-icon>
|
|
</n-icon>
|
|
@@ -49,10 +62,12 @@
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
|
<script setup lang="ts">
|
|
|
-import { ref, computed, h } from 'vue';
|
|
|
|
|
|
|
+import { ref, computed } from 'vue';
|
|
|
import { useSettingStore } from '@/store/modules/settingStore/settingStore'
|
|
import { useSettingStore } from '@/store/modules/settingStore/settingStore'
|
|
|
import { ToolsStatusEnum } from '@/store/modules/settingStore/settingStore.d'
|
|
import { ToolsStatusEnum } from '@/store/modules/settingStore/settingStore.d'
|
|
|
-import { importHandle, exportHandle } from './utils'
|
|
|
|
|
|
|
+import { exportHandle } from './utils'
|
|
|
|
|
+import { useFile } from './hooks/useFile.hooks'
|
|
|
|
|
+import { BtnListType, TypeEnum } from './index.d'
|
|
|
import { icon } from '@/plugins'
|
|
import { icon } from '@/plugins'
|
|
|
|
|
|
|
|
const { DownloadIcon, ShareIcon, PawIcon } = icon.ionicons5
|
|
const { DownloadIcon, ShareIcon, PawIcon } = icon.ionicons5
|
|
@@ -63,14 +78,17 @@ let mouseTime: any = null
|
|
|
const isMini = ref<boolean>(true)
|
|
const isMini = ref<boolean>(true)
|
|
|
// 是否是侧边栏
|
|
// 是否是侧边栏
|
|
|
const isAside = computed(() => settingStore.getChartToolsStatus === ToolsStatusEnum.ASIDE)
|
|
const isAside = computed(() => settingStore.getChartToolsStatus === ToolsStatusEnum.ASIDE)
|
|
|
|
|
+// 文件上传
|
|
|
|
|
+const { importUploadFileListRef, importCustomRequest, importBeforeUpload } = useFile()
|
|
|
|
|
|
|
|
-const btnList = [{
|
|
|
|
|
|
|
+const btnList: BtnListType[] = [{
|
|
|
key: 'import',
|
|
key: 'import',
|
|
|
|
|
+ type: TypeEnum.IMPORTUPLOAD,
|
|
|
name: '导入',
|
|
name: '导入',
|
|
|
icon: DownloadIcon,
|
|
icon: DownloadIcon,
|
|
|
- handle: importHandle
|
|
|
|
|
}, {
|
|
}, {
|
|
|
key: 'export',
|
|
key: 'export',
|
|
|
|
|
+ type: TypeEnum.BOTTON,
|
|
|
name: '导出',
|
|
name: '导出',
|
|
|
icon: ShareIcon,
|
|
icon: ShareIcon,
|
|
|
handle: exportHandle
|
|
handle: exportHandle
|
|
@@ -108,7 +126,7 @@ $asideBottom: 70px;
|
|
|
border-radius: 25px;
|
|
border-radius: 25px;
|
|
|
border: 1px solid;
|
|
border: 1px solid;
|
|
|
mix-blend-mode: luminosity;
|
|
mix-blend-mode: luminosity;
|
|
|
- transition: height ease-in 1s, padding 0.4s, bottom .4s;
|
|
|
|
|
|
|
+ transition: height ease-in 1s, padding 0.4s, bottom 0.4s;
|
|
|
@include filter-border-color("hover-border-color-shallow");
|
|
@include filter-border-color("hover-border-color-shallow");
|
|
|
&.aside {
|
|
&.aside {
|
|
|
flex-direction: column;
|
|
flex-direction: column;
|
|
@@ -118,7 +136,6 @@ $asideBottom: 70px;
|
|
|
bottom: $asideBottom;
|
|
bottom: $asideBottom;
|
|
|
.btn-item {
|
|
.btn-item {
|
|
|
margin-bottom: 10px;
|
|
margin-bottom: 10px;
|
|
|
- padding-bottom: 6px;
|
|
|
|
|
/* 没生效,用上面的 go-mb-0 代替 */
|
|
/* 没生效,用上面的 go-mb-0 代替 */
|
|
|
&:last-child {
|
|
&:last-child {
|
|
|
margin-bottom: 0;
|
|
margin-bottom: 0;
|
|
@@ -126,6 +143,7 @@ $asideBottom: 70px;
|
|
|
@include deep() {
|
|
@include deep() {
|
|
|
.n-button__icon {
|
|
.n-button__icon {
|
|
|
margin-right: 4px;
|
|
margin-right: 4px;
|
|
|
|
|
+ margin-bottom: 14px;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|