Compare commits
210 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
df67b287b8 | ||
|
|
eef071e3ba | ||
|
|
a5ad2f5d17 | ||
|
|
fa4f47c10c | ||
|
|
adb1a19cde | ||
|
|
d170d94186 | ||
|
|
5214c27331 | ||
|
|
86639b92b0 | ||
|
|
c8e6ee5b20 | ||
|
|
34b4dfa3a6 | ||
|
|
7ef4df7312 | ||
|
|
19165c76d5 | ||
|
|
ea179f9897 | ||
|
|
67d2308e24 | ||
|
|
db075891e3 | ||
|
|
7511219232 | ||
|
|
55c84f2e39 | ||
|
|
f348038ff7 | ||
|
|
dd71c311e0 | ||
|
|
0ab42027c4 | ||
|
|
a492ed2440 | ||
|
|
4444645dfd | ||
|
|
c32a9f7d1b | ||
|
|
8472efd210 | ||
|
|
4a409393fb | ||
|
|
5f15d2432b | ||
|
|
dc10b761d8 | ||
|
|
800a2f0732 | ||
|
|
51ba52ae45 | ||
|
|
95b50c7d76 | ||
|
|
d76ddf1126 | ||
|
|
c5788f79b3 | ||
|
|
704a7bd8f8 | ||
|
|
db73346c71 | ||
|
|
ab5ade9be1 | ||
|
|
0d3418259c | ||
|
|
541ce8a083 | ||
|
|
6b9e993599 | ||
|
|
1ad0658a5f | ||
|
|
b89e5d702b | ||
|
|
fed515f844 | ||
|
|
9f9df3566f | ||
|
|
39e735b29c | ||
|
|
d2ad32e08e | ||
|
|
b75cbea6cc | ||
|
|
3c1ea60f21 | ||
|
|
32c5b216f2 | ||
|
|
a08e27da2d | ||
|
|
4c13dc3184 | ||
|
|
d91c86f01c | ||
|
|
5479a26832 | ||
|
|
1250829da6 | ||
|
|
ac2fd67688 | ||
|
|
dbc44bf419 | ||
|
|
1401a091eb | ||
|
|
f528eb29bc | ||
|
|
06921ea3f5 | ||
|
|
f2d9f14ea5 | ||
|
|
97e5d985bd | ||
|
|
bb1828b478 | ||
|
|
91c4cca62e | ||
|
|
c3140d3746 | ||
|
|
307cdd9e9a | ||
|
|
7bc8c16581 | ||
|
|
df01be729d | ||
|
|
ec051618e6 | ||
|
|
8caa588d3f | ||
|
|
0816f3fcbf | ||
|
|
6843f24263 | ||
|
|
7076c4deb7 | ||
|
|
59bfc78f0a | ||
|
|
4064339848 | ||
|
|
d2af67d6ad | ||
|
|
e979149cfb | ||
|
|
d0d031d1bb | ||
|
|
9127e6f44c | ||
|
|
bb610ff7ae | ||
|
|
c575cff727 | ||
|
|
5443c9647b | ||
|
|
271a02ff12 | ||
|
|
f747fd3506 | ||
|
|
b59c28b8ae | ||
|
|
b1a0e7b5e2 | ||
|
|
0d762f7d30 | ||
|
|
cc156a0a6b | ||
|
|
a77f4d6bf4 | ||
|
|
9e5676e5ed | ||
|
|
bc79e2f01f | ||
|
|
80f06afa02 | ||
|
|
3da84b2fa2 | ||
|
|
58ab3dee6d | ||
|
|
d7a3bb7ba0 | ||
|
|
2ad2af97e6 | ||
|
|
5387a7ad90 | ||
|
|
291a7bbc61 | ||
|
|
fe37435f79 | ||
|
|
1ef6d9797a | ||
|
|
27e2e2c68d | ||
|
|
c70d54c622 | ||
|
|
d74645d7b0 | ||
|
|
86910de3b2 | ||
|
|
47636ee680 | ||
|
|
9485931f5d | ||
|
|
20fa9e4afe | ||
|
|
cbd629d7f8 | ||
|
|
18e0729e54 | ||
|
|
d6afc50ac5 | ||
|
|
37676176e7 | ||
|
|
1551aa9ded | ||
|
|
895bca92ee | ||
|
|
1460ceb07e | ||
|
|
30bb48f294 | ||
|
|
d5eb3ec4e2 | ||
|
|
7eff3a29c1 | ||
|
|
33ca7af62d | ||
|
|
915e4a69e8 | ||
|
|
d9834482f3 | ||
|
|
6fe20c4655 | ||
|
|
0546b37186 | ||
|
|
9e0736c693 | ||
|
|
52389fa6fc | ||
|
|
bd7960b09a | ||
|
|
ddc09da8cb | ||
|
|
d84e47faa9 | ||
|
|
bcb2ca1cb5 | ||
|
|
23efce86fe | ||
|
|
6abeef182f | ||
|
|
346c8d439a | ||
|
|
c7f7c6a731 | ||
|
|
6063408d94 | ||
|
|
ff4140cbfb | ||
|
|
d8bcb4ab4f | ||
|
|
3d4e05b514 | ||
|
|
bb48745484 | ||
|
|
f9adeac742 | ||
|
|
8867a489a2 | ||
|
|
d8c55b6325 | ||
|
|
44ace74ca9 | ||
|
|
2e84b3d196 | ||
|
|
8f82c1fa59 | ||
|
|
7098e2e5e7 | ||
|
|
051ddcc2d4 | ||
|
|
773ae65085 | ||
|
|
e4db7cb8ff | ||
|
|
8bb0f5e3a5 | ||
|
|
93ed31f093 | ||
|
|
76e511daa0 | ||
|
|
a2184b19b3 | ||
|
|
ec9210d7e7 | ||
|
|
e0fe8f673c | ||
|
|
e3d388b5d9 | ||
|
|
7cf9c29a34 | ||
|
|
95466aa076 | ||
|
|
6e8e38e737 | ||
|
|
3008073829 | ||
|
|
0e0794338a | ||
|
|
5059c9ea65 | ||
|
|
50a8342c49 | ||
|
|
afad8e49b1 | ||
|
|
a3d97e56ab | ||
|
|
816c11a877 | ||
|
|
6fee63600b | ||
|
|
1dd055294c | ||
|
|
4aa41bbe36 | ||
|
|
9585bd07a3 | ||
|
|
aecba9c95e | ||
|
|
57ad9a2c7a | ||
|
|
e71fb22b22 | ||
|
|
d177ebc900 | ||
|
|
e18cf847cd | ||
|
|
31ed863d53 | ||
|
|
c7b2daa0b8 | ||
|
|
3a6990f124 | ||
|
|
9f41ad1811 | ||
|
|
0ec0a12b0f | ||
|
|
c18bc019d3 | ||
|
|
6bbe489162 | ||
|
|
54cdada560 | ||
|
|
048f3426fe | ||
|
|
c508aaa400 | ||
|
|
606cb753c4 | ||
|
|
01be79ee9a | ||
|
|
3137109c6d | ||
|
|
1d876418fe | ||
|
|
fd37ce6ede | ||
|
|
9693c0dedf | ||
|
|
dc8d7c86d7 | ||
|
|
8499d574dc | ||
|
|
0bb83c4131 | ||
|
|
38d542ce77 | ||
|
|
663cc94ae1 | ||
|
|
0370bc5c6c | ||
|
|
4dc8725b3e | ||
|
|
09a21f44c5 | ||
|
|
98b38640d1 | ||
|
|
89194848de | ||
|
|
7c1bcd0605 | ||
|
|
c1d98b03a9 | ||
|
|
66f4768285 | ||
|
|
ec6d8dedec | ||
|
|
99d20d99f9 | ||
|
|
0106d43467 | ||
|
|
231fb9dd29 | ||
|
|
f2ae08e62a | ||
|
|
e930ca1587 | ||
|
|
ddb125656a | ||
|
|
35cda43d95 | ||
|
|
e3faaad5e0 | ||
|
|
24ef446fd6 | ||
|
|
53b9e03e69 |
1
.gitignore
vendored
@@ -4,3 +4,4 @@ dist
|
||||
dist-ssr
|
||||
*.local
|
||||
.vscode
|
||||
.idea
|
||||
|
||||
15
package.json
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "go-view",
|
||||
"version": "2.2.2",
|
||||
"version": "2.2.6",
|
||||
"engines": {
|
||||
"node": ">=12.0"
|
||||
},
|
||||
@@ -21,7 +21,7 @@
|
||||
"@types/keymaster": "^1.6.30",
|
||||
"@types/lodash": "^4.14.184",
|
||||
"animate.css": "^4.1.1",
|
||||
"axios": "^0.27.2",
|
||||
"axios": "^1.4.0",
|
||||
"color": "^4.2.3",
|
||||
"crypto-js": "^4.1.1",
|
||||
"dayjs": "^1.11.7",
|
||||
@@ -33,6 +33,7 @@
|
||||
"highlight.js": "^11.5.0",
|
||||
"html2canvas": "^1.4.1",
|
||||
"keymaster": "^1.6.2",
|
||||
"mitt": "^3.0.0",
|
||||
"monaco-editor": "^0.33.0",
|
||||
"naive-ui": "2.34.3",
|
||||
"pinia": "^2.0.13",
|
||||
@@ -40,7 +41,7 @@
|
||||
"three": "^0.145.0",
|
||||
"vue": "^3.2.31",
|
||||
"vue-demi": "^0.13.1",
|
||||
"vue-i18n": "^9.2.2",
|
||||
"vue-i18n": "9.2.2",
|
||||
"vue-router": "4.0.12",
|
||||
"vue3-lazyload": "^0.2.5-beta",
|
||||
"vue3-sketch-ruler": "^1.3.3",
|
||||
@@ -49,14 +50,16 @@
|
||||
"devDependencies": {
|
||||
"@commitlint/cli": "^17.0.2",
|
||||
"@commitlint/config-conventional": "^17.0.2",
|
||||
"@iconify/types": "^2.0.0",
|
||||
"@iconify/vue": "^4.1.1",
|
||||
"@types/node": "^16.11.26",
|
||||
"@types/three": "^0.144.0",
|
||||
"@typescript-eslint/eslint-plugin": "^5.18.0",
|
||||
"@typescript-eslint/parser": "^5.18.0",
|
||||
"@vicons/carbon": "^0.12.0",
|
||||
"@vicons/ionicons5": "~0.11.0",
|
||||
"@vitejs/plugin-vue": "^1.10.2",
|
||||
"@vitejs/plugin-vue-jsx": "^1.3.9",
|
||||
"@vitejs/plugin-vue": "^4.2.3",
|
||||
"@vitejs/plugin-vue-jsx": "^3.0.1",
|
||||
"@vue/compiler-sfc": "^3.2.31",
|
||||
"@vueuse/core": "^7.7.1",
|
||||
"commitlint": "^17.0.2",
|
||||
@@ -75,7 +78,7 @@
|
||||
"sass": "^1.49.11",
|
||||
"sass-loader": "^12.6.0",
|
||||
"typescript": "4.6.3",
|
||||
"vite": "4.2.1",
|
||||
"vite": "4.3.6",
|
||||
"vite-plugin-compression": "^0.5.1",
|
||||
"vite-plugin-importer": "^0.2.5",
|
||||
"vite-plugin-mock": "^2.9.6",
|
||||
|
||||
960
pnpm-lock.yaml
generated
@@ -1,6 +1,6 @@
|
||||
import axios, { AxiosResponse, AxiosRequestConfig, Axios } from 'axios'
|
||||
import { ResultEnum, ModuleTypeEnum } from "@/enums/httpEnum"
|
||||
import { PageEnum, ErrorPageNameMap } from "@/enums/pageEnum"
|
||||
import axios, { AxiosResponse, AxiosRequestConfig, Axios, AxiosError, InternalAxiosRequestConfig } from 'axios'
|
||||
import { RequestHttpHeaderEnum, ResultEnum, ModuleTypeEnum } from '@/enums/httpEnum'
|
||||
import { PageEnum, ErrorPageNameMap } from '@/enums/pageEnum'
|
||||
import { StorageEnum } from '@/enums/storageEnum'
|
||||
import { axiosPre } from '@/settings/httpSetting'
|
||||
import { SystemStoreEnum, SystemStoreUserInfoEnum } from '@/store/modules/systemStore/systemStore.d'
|
||||
@@ -20,11 +20,11 @@ export interface MyRequestInstance extends Axios {
|
||||
|
||||
const axiosInstance = axios.create({
|
||||
baseURL: `${import.meta.env.PROD ? import.meta.env.VITE_PRO_PATH : ''}${axiosPre}`,
|
||||
timeout: ResultEnum.TIMEOUT,
|
||||
timeout: ResultEnum.TIMEOUT
|
||||
}) as unknown as MyRequestInstance
|
||||
|
||||
axiosInstance.interceptors.request.use(
|
||||
(config: AxiosRequestConfig) => {
|
||||
(config: InternalAxiosRequestConfig) => {
|
||||
// 白名单校验
|
||||
if (includes(fetchAllowList, config.url)) return config
|
||||
// 获取 token
|
||||
@@ -35,13 +35,10 @@ axiosInstance.interceptors.request.use(
|
||||
return config
|
||||
}
|
||||
const userInfo = info[SystemStoreEnum.USER_INFO]
|
||||
config.headers = {
|
||||
...config.headers,
|
||||
[userInfo[SystemStoreUserInfoEnum.TOKEN_NAME] || 'token']: userInfo[SystemStoreUserInfoEnum.USER_TOKEN] || ''
|
||||
}
|
||||
config.headers[userInfo[SystemStoreUserInfoEnum.TOKEN_NAME] || 'token'] = userInfo[SystemStoreUserInfoEnum.USER_TOKEN] || ''
|
||||
return config
|
||||
},
|
||||
(err: AxiosRequestConfig) => {
|
||||
(err: AxiosError) => {
|
||||
Promise.reject(err)
|
||||
}
|
||||
)
|
||||
@@ -74,13 +71,23 @@ axiosInstance.interceptors.response.use(
|
||||
redirectErrorPage(code)
|
||||
return Promise.resolve(res.data)
|
||||
}
|
||||
|
||||
|
||||
// 提示错误
|
||||
window['$message'].error(window['$t']((res.data as any).msg))
|
||||
return Promise.resolve(res.data)
|
||||
},
|
||||
(err: AxiosResponse) => {
|
||||
Promise.reject(err)
|
||||
(err: AxiosError) => {
|
||||
const status = err.response?.status
|
||||
switch (status) {
|
||||
case 401:
|
||||
routerTurnByName(PageEnum.BASE_LOGIN_NAME)
|
||||
Promise.reject(err)
|
||||
break
|
||||
|
||||
default:
|
||||
Promise.reject(err)
|
||||
break
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@@ -163,7 +163,6 @@ export const customizeHttp = (targetParams: RequestConfigType, globalParams: Req
|
||||
params = translateStr(params)
|
||||
// form 类型处理
|
||||
let formData: FormData = new FormData()
|
||||
formData.set('default', 'defaultData')
|
||||
// 类型处理
|
||||
|
||||
switch (requestParamsBodyType) {
|
||||
|
||||
BIN
src/assets/images/chart/charts/bar_line.png
Normal file
|
After Width: | Height: | Size: 26 KiB |
BIN
src/assets/images/chart/decorates/Pipeline_H.png
Normal file
|
After Width: | Height: | Size: 999 B |
BIN
src/assets/images/chart/decorates/Pipeline_V.png
Normal file
|
After Width: | Height: | Size: 983 B |
BIN
src/assets/images/chart/decorates/fullScreen.png
Normal file
|
After Width: | Height: | Size: 6.0 KiB |
BIN
src/assets/images/chart/icons/icon.png
Normal file
|
After Width: | Height: | Size: 7.9 KiB |
BIN
src/assets/images/chart/informations/inputs_pagination.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
src/assets/images/chart/photos/upload.png
Normal file
|
After Width: | Height: | Size: 3.4 KiB |
BIN
src/assets/images/chart/tables/tables_basic.png
Normal file
|
After Width: | Height: | Size: 22 KiB |
@@ -257,9 +257,36 @@
|
||||
<n-switch v-model:value="legend.show" size="small"></n-switch>
|
||||
</template>
|
||||
<setting-item-box name="图例文字">
|
||||
<setting-item>
|
||||
<setting-item name="颜色">
|
||||
<n-color-picker size="small" v-model:value="legend.textStyle.color"></n-color-picker>
|
||||
</setting-item>
|
||||
<setting-item name="大小">
|
||||
<n-input-number v-model:value="legend.textStyle.fontSize" :min="1" size="small"></n-input-number>
|
||||
</setting-item>
|
||||
</setting-item-box>
|
||||
<setting-item-box name="图例位置">
|
||||
<setting-item name="x轴">
|
||||
<n-select v-model:value="legend.x" size="small" :options="legendConfig.lengendX" />
|
||||
</setting-item>
|
||||
<setting-item name="y轴">
|
||||
<n-select v-model:value="legend.y" size="small" :options="legendConfig.lengendY" />
|
||||
</setting-item>
|
||||
</setting-item-box>
|
||||
<setting-item-box name="图例信息">
|
||||
<setting-item name="方向">
|
||||
<n-select v-model:value="legend.orient" size="small" :options="legendConfig.orient" />
|
||||
</setting-item>
|
||||
<setting-item name="形状">
|
||||
<n-select v-model:value="legend.icon" size="small" :options="legendConfig.shape" />
|
||||
</setting-item>
|
||||
</setting-item-box>
|
||||
<setting-item-box name="图例大小">
|
||||
<setting-item name="宽">
|
||||
<n-input-number v-model:value="legend.itemWidth" :min="1" size="small"></n-input-number>
|
||||
</setting-item>
|
||||
<setting-item name="高">
|
||||
<n-input-number v-model:value="legend.itemHeight" :min="1" size="small"></n-input-number>
|
||||
</setting-item>
|
||||
</setting-item-box>
|
||||
</collapse-item>
|
||||
|
||||
@@ -309,9 +336,9 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { PropType, computed } from 'vue'
|
||||
import { PropType, computed, watch } from 'vue'
|
||||
import { GlobalThemeJsonType } from '@/settings/chartThemes/index'
|
||||
import { axisConfig } from '@/packages/chartConfiguration/echarts/index'
|
||||
import { axisConfig, legendConfig } from '@/packages/chartConfiguration/echarts/index'
|
||||
import { CollapseItem, SettingItemBox, SettingItem, GlobalSettingPosition } from '@/components/Pages/ChartItemSetting'
|
||||
import { icon } from '@/plugins'
|
||||
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
|
||||
@@ -360,4 +387,18 @@ const grid = computed(() => {
|
||||
const visualMap = computed(() => {
|
||||
return props.optionData.visualMap
|
||||
})
|
||||
|
||||
// 监听legend color颜色改变type = scroll的颜色
|
||||
watch(() => legend.value && legend.value.textStyle.color, (newVal) => {
|
||||
if (legend.value && newVal) {
|
||||
if (!legend.value.pageTextStyle) {
|
||||
legend.value.pageTextStyle = { color: newVal }
|
||||
} else {
|
||||
legend.value.pageTextStyle.color = newVal
|
||||
}
|
||||
}
|
||||
}, {
|
||||
immediate: true,
|
||||
deep: true,
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -69,6 +69,22 @@
|
||||
</setting-item>
|
||||
</setting-item-box>
|
||||
|
||||
<!-- 预设滤镜 -->
|
||||
<div v-if="presetImageList.length" class="preset-filter">
|
||||
<n-image
|
||||
class="preset-img"
|
||||
width="46"
|
||||
preview-disabled
|
||||
object-fit="scale-down"
|
||||
v-for="(item, index) in presetImageList"
|
||||
:key="index"
|
||||
:class="{ 'active-preset': item.hueRotate === chartStyles.hueRotate }"
|
||||
:style="{ filter: `hue-rotate(${item.hueRotate}deg)` }"
|
||||
:src="item.src"
|
||||
@click="() => (chartStyles.hueRotate = item.hueRotate)"
|
||||
></n-image>
|
||||
</div>
|
||||
|
||||
<!-- 混合模式 -->
|
||||
<setting-item-box v-if="!isCanvas" :alone="true">
|
||||
<template #name>
|
||||
@@ -149,10 +165,12 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { PropType } from 'vue'
|
||||
import { ref, PropType } from 'vue'
|
||||
import { PickCreateComponentType, BlendModeEnumList } from '@/packages/index.d'
|
||||
import { SettingItemBox, SettingItem, CollapseItem } from '@/components/Pages/ChartItemSetting'
|
||||
import { icon } from '@/plugins'
|
||||
import logoImg from '@/assets/logo.png'
|
||||
import { useDesignStore } from '@/store/modules/designStore/designStore'
|
||||
|
||||
const props = defineProps({
|
||||
isGroup: {
|
||||
@@ -175,10 +193,48 @@ const { HelpOutlineIcon } = icon.ionicons5
|
||||
const sliderFormatTooltip = (v: string) => {
|
||||
return `${(parseFloat(v) * 100).toFixed(0)}%`
|
||||
}
|
||||
|
||||
// 角度格式化
|
||||
const degFormatTooltip = (v: string) => {
|
||||
return `${v}deg`
|
||||
}
|
||||
|
||||
// 预设滤镜
|
||||
interface presetImageData {
|
||||
index: number
|
||||
src: string
|
||||
hueRotate: number
|
||||
}
|
||||
|
||||
const presetImageList = ref([] as presetImageData[])
|
||||
for (let i = 1; i <= 12; i++) {
|
||||
presetImageList.value.push({
|
||||
index: i,
|
||||
src: logoImg,
|
||||
hueRotate: i * 30
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
<style lang="scss" scoped>
|
||||
// 预设滤镜
|
||||
.preset-filter {
|
||||
margin: 20px 0 10px 0;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: space-between;
|
||||
.preset-img {
|
||||
margin-bottom: 10px;
|
||||
padding: 2px;
|
||||
border-radius: 6px;
|
||||
transition: 0.2s all;
|
||||
cursor: pointer;
|
||||
&:hover {
|
||||
box-shadow: 0 0 0 2px #66a9c9;
|
||||
}
|
||||
}
|
||||
.active-preset {
|
||||
box-shadow: 0 0 0 2px #66a9c9;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
<template>
|
||||
<div class="go-Flipper" :class="[flipType, { go: isFlipping }]">
|
||||
<div class="go-flipper" :class="[flipType, { go: isFlipping }]">
|
||||
<div class="digital front" :data-front="frontTextFromData"></div>
|
||||
<div class="digital back" :data-back="backTextFromData"></div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, PropType, watch } from 'vue'
|
||||
import { FlipType } from './index'
|
||||
import { ref, PropType, watch, nextTick } from 'vue'
|
||||
import { FlipType } from './index'
|
||||
|
||||
const props = defineProps({
|
||||
flipType: {
|
||||
@@ -43,6 +43,10 @@ const props = defineProps({
|
||||
backColor: {
|
||||
type: String,
|
||||
default: '#000000'
|
||||
},
|
||||
borderWidth: {
|
||||
type: Number,
|
||||
default: 2
|
||||
}
|
||||
})
|
||||
|
||||
@@ -50,19 +54,27 @@ const isFlipping = ref(false)
|
||||
const frontTextFromData = ref(props.count || 0)
|
||||
const backTextFromData = ref(props.count || 0)
|
||||
|
||||
let timeoutID: any = 0
|
||||
|
||||
// 翻牌
|
||||
const flip = (front: string | number, back: string | number) => {
|
||||
const flip = async (front: string | number, back: string | number) => {
|
||||
// 如果处于翻转中,则不执行
|
||||
if (isFlipping.value) return
|
||||
if (isFlipping.value) {
|
||||
isFlipping.value = false // 立即结束此次动画
|
||||
clearTimeout(timeoutID) // 清除上一个计时器任务
|
||||
await nextTick()
|
||||
await flip(front, back) // 开始最后一次翻牌任务
|
||||
return
|
||||
}
|
||||
|
||||
// 设置翻盘前后数据
|
||||
backTextFromData.value = back
|
||||
frontTextFromData.value = front
|
||||
|
||||
// 设置翻转状态为true
|
||||
isFlipping.value = true
|
||||
|
||||
// 翻牌结束的行为
|
||||
setTimeout(() => {
|
||||
timeoutID = setTimeout(() => {
|
||||
isFlipping.value = false // 设置翻转状态为false
|
||||
frontTextFromData.value = back
|
||||
}, props.duration)
|
||||
@@ -86,6 +98,7 @@ $radius: v-bind('`${props.radius}px`');
|
||||
$width: v-bind('`${props.width}px`');
|
||||
$height: v-bind('`${props.height}px`');
|
||||
$perspective: v-bind('`${props.height * 2}px`');
|
||||
$borderWidth: v-bind('`${props.borderWidth * 2}px`');
|
||||
$speed: v-bind('`${props.duration / 1000}s`');
|
||||
$shadowColor: #000000;
|
||||
$lineColor: #4a9ef8;
|
||||
@@ -125,13 +138,12 @@ $lineColor: #4a9ef8;
|
||||
}
|
||||
// #endregion
|
||||
|
||||
.go-Flipper {
|
||||
.go-flipper {
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
width: $width;
|
||||
height: $height;
|
||||
line-height: $height;
|
||||
border: solid 1px $backColor;
|
||||
border-radius: $radius;
|
||||
background: $frontColor;
|
||||
font-size: $width;
|
||||
@@ -139,6 +151,17 @@ $lineColor: #4a9ef8;
|
||||
box-shadow: 0 0 6px rgba($color: $shadowColor, $alpha: 0.5); // 阴影部分
|
||||
text-align: center;
|
||||
// font-family: 'Helvetica Neue';
|
||||
&::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
z-index: 10;
|
||||
left: 0;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
box-shadow: inset 0 0 $borderWidth 0 $frontColor; // 内测阴影部分
|
||||
border-radius: $radius;
|
||||
}
|
||||
|
||||
.digital:before,
|
||||
.digital:after {
|
||||
@@ -186,11 +209,13 @@ $lineColor: #4a9ef8;
|
||||
&.down.go .front:before {
|
||||
transform-origin: 50% 100%;
|
||||
animation: frontFlipDown $speed ease-in-out both;
|
||||
box-shadow: 0 -2px 6px rgba($color: $lineColor, $alpha: 0.3);
|
||||
box-shadow: 0 -2px $borderWidth 0 $frontColor;
|
||||
backface-visibility: hidden;
|
||||
}
|
||||
&.down.go .back:after {
|
||||
animation: backFlipDown $speed ease-in-out both;
|
||||
box-shadow: 0 2px $borderWidth 0 $frontColor;
|
||||
backface-visibility: hidden;
|
||||
}
|
||||
/*向上翻*/
|
||||
&.up .front:after {
|
||||
@@ -208,11 +233,13 @@ $lineColor: #4a9ef8;
|
||||
&.up.go .front:after {
|
||||
transform-origin: 50% 0;
|
||||
animation: frontFlipUp $speed ease-in-out both;
|
||||
box-shadow: 0 2px 6px rgba($color: $lineColor, $alpha: 0.3);
|
||||
box-shadow: 0 2px $borderWidth 0 $frontColor;
|
||||
backface-visibility: hidden;
|
||||
}
|
||||
&.up.go .back:before {
|
||||
animation: backFlipUp $speed ease-in-out both;
|
||||
box-shadow: 0 -2px $borderWidth 0 $frontColor;
|
||||
backface-visibility: hidden;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -10,5 +10,7 @@ export enum StorageEnum {
|
||||
// 工作台布局配置
|
||||
GO_CHART_LAYOUT_STORE = 'GO_CHART_LAYOUT',
|
||||
// 工作台需要保存的数据
|
||||
GO_CHART_STORAGE_LIST = 'GO_CHART_STORAGE_LIST'
|
||||
GO_CHART_STORAGE_LIST = 'GO_CHART_STORAGE_LIST',
|
||||
// 用户存储的图片媒体
|
||||
GO_USER_MEDIA_PHOTOS = 'GO_USER_MEDIA_PHOTOS'
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ export const useChartDataFetch = (
|
||||
|
||||
// 普通初始化与组件交互处理监听
|
||||
watch(
|
||||
() => targetComponent.request,
|
||||
() => targetComponent.request.requestParams,
|
||||
() => {
|
||||
fetchFn()
|
||||
},
|
||||
@@ -105,7 +105,11 @@ export const useChartDataFetch = (
|
||||
// 单位
|
||||
const unit = targetInterval && targetInterval.value ? targetUnit.value : globalUnit.value
|
||||
// 开启轮询
|
||||
if (time) fetchInterval = setInterval(fetchFn, intervalUnitHandle(time, unit))
|
||||
if (time) {
|
||||
fetchInterval = setInterval(fetchFn, intervalUnitHandle(time, unit))
|
||||
} else {
|
||||
fetchFn()
|
||||
}
|
||||
}
|
||||
// eslint-disable-next-line no-empty
|
||||
} catch (error) {
|
||||
@@ -114,10 +118,11 @@ export const useChartDataFetch = (
|
||||
}
|
||||
|
||||
if (isPreview()) {
|
||||
// 判断是否是数据池类型
|
||||
targetComponent.request.requestDataType === RequestDataTypeEnum.Pond
|
||||
? addGlobalDataInterface(targetComponent, useChartEditStore, updateCallback || echartsUpdateHandle)
|
||||
: requestIntervalFn()
|
||||
} else {
|
||||
requestIntervalFn()
|
||||
}
|
||||
return { vChartRef }
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { toRaw } from 'vue'
|
||||
import { toRaw, watch, computed, ComputedRef } from 'vue'
|
||||
import { customizeHttp } from '@/api/http'
|
||||
import { CreateComponentType } from '@/packages/index.d'
|
||||
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
|
||||
@@ -20,7 +20,7 @@ const mittDataPondMap = new Map<string, DataPondMapType[]>()
|
||||
// 创建单个数据项轮询接口
|
||||
const newPondItemInterval = (
|
||||
requestGlobalConfig: RequestGlobalConfigType,
|
||||
requestDataPondItem: RequestDataPondItemType,
|
||||
requestDataPondItem: ComputedRef<RequestDataPondItemType>,
|
||||
dataPondMapItem?: DataPondMapType[]
|
||||
) => {
|
||||
if (!dataPondMapItem) return
|
||||
@@ -31,8 +31,7 @@ const newPondItemInterval = (
|
||||
// 请求
|
||||
const fetchFn = async () => {
|
||||
try {
|
||||
const res = await customizeHttp(toRaw(requestDataPondItem.dataPondRequestConfig), toRaw(requestGlobalConfig))
|
||||
|
||||
const res = await customizeHttp(toRaw(requestDataPondItem.value.dataPondRequestConfig), toRaw(requestGlobalConfig))
|
||||
if (res) {
|
||||
try {
|
||||
// 遍历更新回调函数
|
||||
@@ -49,19 +48,32 @@ const newPondItemInterval = (
|
||||
}
|
||||
}
|
||||
|
||||
watch(
|
||||
() => requestDataPondItem.value.dataPondRequestConfig.requestParams.Params,
|
||||
() => {
|
||||
fetchFn()
|
||||
},
|
||||
{
|
||||
immediate: false,
|
||||
deep: true
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
// 立即调用
|
||||
fetchFn()
|
||||
|
||||
const targetInterval = requestDataPondItem.dataPondRequestConfig.requestInterval
|
||||
const targetUnit = requestDataPondItem.dataPondRequestConfig.requestIntervalUnit
|
||||
|
||||
const targetInterval = requestDataPondItem.value.dataPondRequestConfig.requestInterval
|
||||
const targetUnit = requestDataPondItem.value.dataPondRequestConfig.requestIntervalUnit
|
||||
|
||||
const globalRequestInterval = requestGlobalConfig.requestInterval
|
||||
const globalUnit = requestGlobalConfig.requestIntervalUnit
|
||||
|
||||
// 定时时间
|
||||
const time = targetInterval ? targetInterval : globalRequestInterval
|
||||
const time = targetInterval ? targetInterval : globalRequestInterval
|
||||
// 单位
|
||||
const unit = targetInterval ? targetUnit : globalUnit
|
||||
const unit = targetInterval ? targetUnit : globalUnit
|
||||
// 开启轮询
|
||||
if (time) fetchInterval = setInterval(fetchFn, intervalUnitHandle(time, unit))
|
||||
}
|
||||
@@ -96,13 +108,16 @@ export const useChartDataPondFetch = () => {
|
||||
}
|
||||
|
||||
// 初始化数据池
|
||||
const initDataPond = (requestGlobalConfig: RequestGlobalConfigType) => {
|
||||
const { requestDataPond } = requestGlobalConfig
|
||||
const initDataPond = (useChartEditStore: ChartEditStoreType) => {
|
||||
const { requestGlobalConfig } = useChartEditStore()
|
||||
const chartEditStore = useChartEditStore()
|
||||
// 根据 mapId 查找对应的数据池配置
|
||||
for (let pondKey of mittDataPondMap.keys()) {
|
||||
const requestDataPondItem = requestDataPond.find(item => item.dataPondId === pondKey)
|
||||
const requestDataPondItem = computed(() => {
|
||||
return requestGlobalConfig.requestDataPond.find(item => item.dataPondId === pondKey)
|
||||
}) as ComputedRef<RequestDataPondItemType>
|
||||
if (requestDataPondItem) {
|
||||
newPondItemInterval(requestGlobalConfig, requestDataPondItem, mittDataPondMap.get(pondKey))
|
||||
newPondItemInterval(chartEditStore.requestGlobalConfig, requestDataPondItem, mittDataPondMap.get(pondKey))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { toRefs } from 'vue'
|
||||
import { isPreview } from '@/utils'
|
||||
import { CreateComponentType } from '@/packages/index.d'
|
||||
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
|
||||
|
||||
@@ -12,6 +13,7 @@ export const useChartInteract = (
|
||||
param: { [T: string]: any },
|
||||
interactEventOn: string
|
||||
) => {
|
||||
if (!isPreview()) return
|
||||
const chartEditStore = useChartEditStore()
|
||||
const { interactEvents } = chartConfig.events
|
||||
const fnOnEvent = interactEvents.filter(item => {
|
||||
@@ -20,20 +22,37 @@ export const useChartInteract = (
|
||||
|
||||
if (fnOnEvent.length === 0) return
|
||||
fnOnEvent.forEach(item => {
|
||||
const index = chartEditStore.fetchTargetIndex(item.interactComponentId)
|
||||
if (index === -1) return
|
||||
const { Params, Header } = toRefs(chartEditStore.componentList[index].request.requestParams)
|
||||
Object.keys(item.interactFn).forEach(key => {
|
||||
if (Params.value[key]) {
|
||||
Params.value[key] = param[item.interactFn[key]]
|
||||
}
|
||||
if (Header.value[key]) {
|
||||
Header.value[key] = param[item.interactFn[key]]
|
||||
}
|
||||
})
|
||||
|
||||
const globalConfigPindAprndex = chartEditStore.requestGlobalConfig.requestDataPond.findIndex(cItem =>
|
||||
cItem.dataPondId === item.interactComponentId
|
||||
)
|
||||
if (globalConfigPindAprndex !== -1) {
|
||||
const { Params, Header } = toRefs(chartEditStore.requestGlobalConfig.requestDataPond[globalConfigPindAprndex].dataPondRequestConfig.requestParams)
|
||||
|
||||
Object.keys(item.interactFn).forEach(key => {
|
||||
if (key in Params.value) {
|
||||
Params.value[key] = param[item.interactFn[key]]
|
||||
}
|
||||
if (key in Header.value) {
|
||||
Header.value[key] = param[item.interactFn[key]]
|
||||
}
|
||||
})
|
||||
} else {
|
||||
const index = chartEditStore.fetchTargetIndex(item.interactComponentId)
|
||||
if (index === -1) return
|
||||
const { Params, Header } = toRefs(chartEditStore.componentList[index].request.requestParams)
|
||||
|
||||
Object.keys(item.interactFn).forEach(key => {
|
||||
if (key in Params.value) {
|
||||
Params.value[key] = param[item.interactFn[key]]
|
||||
}
|
||||
if (key in Header.value) {
|
||||
Header.value[key] = param[item.interactFn[key]]
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 联动事件触发的 type 变更时,清除当前绑定内容
|
||||
export const clearInteractEvent = (chartConfig: CreateComponentType) => {
|
||||
|
||||
|
||||
@@ -48,10 +48,10 @@ export const useLifeHandler = (chartConfig: CreateComponentType | CreateComponen
|
||||
try {
|
||||
return new Function(`
|
||||
return (
|
||||
async function(mouseEvent){
|
||||
async function(components,mouseEvent){
|
||||
${fnStr}
|
||||
}
|
||||
)`)()
|
||||
)`)().bind(undefined,components)
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
}
|
||||
|
||||
@@ -1,218 +1,218 @@
|
||||
import throttle from 'lodash/throttle'
|
||||
|
||||
// 拆出来是为了更好的分离单独复用
|
||||
|
||||
// * 屏幕缩放适配(两边留白)
|
||||
export const usePreviewFitScale = (
|
||||
width: number,
|
||||
height: number,
|
||||
scaleDom: HTMLElement | null,
|
||||
callback?: (scale: {
|
||||
width: number;
|
||||
height: number;
|
||||
}) => void
|
||||
) => {
|
||||
// * 画布尺寸(px)
|
||||
const baseWidth = width
|
||||
const baseHeight = height
|
||||
|
||||
// * 默认缩放值
|
||||
const scale = {
|
||||
width: 1,
|
||||
height: 1,
|
||||
}
|
||||
|
||||
// * 需保持的比例
|
||||
const baseProportion = parseFloat((baseWidth / baseHeight).toFixed(5))
|
||||
const calcRate = () => {
|
||||
// 当前屏幕宽高比
|
||||
const currentRate = parseFloat(
|
||||
(window.innerWidth / window.innerHeight).toFixed(5)
|
||||
)
|
||||
if (scaleDom) {
|
||||
if (currentRate > baseProportion) {
|
||||
// 表示更宽
|
||||
scale.width = parseFloat(((window.innerHeight * baseProportion) / baseWidth).toFixed(5))
|
||||
scale.height = parseFloat((window.innerHeight / baseHeight).toFixed(5))
|
||||
scaleDom.style.transform = `scale(${scale.width}, ${scale.height})`
|
||||
} else {
|
||||
// 表示更高
|
||||
scale.height = parseFloat(((window.innerWidth / baseProportion) / baseHeight).toFixed(5))
|
||||
scale.width = parseFloat((window.innerWidth / baseWidth).toFixed(5))
|
||||
scaleDom.style.transform = `scale(${scale.width}, ${scale.height})`
|
||||
}
|
||||
if (callback) callback(scale)
|
||||
}
|
||||
}
|
||||
|
||||
const resize = throttle(() => {
|
||||
calcRate()
|
||||
}, 200)
|
||||
|
||||
// * 改变窗口大小重新绘制
|
||||
const windowResize = () => {
|
||||
window.addEventListener('resize', resize)
|
||||
}
|
||||
|
||||
// * 改变窗口大小重新绘制
|
||||
const unWindowResize = () => {
|
||||
window.removeEventListener('resize', resize)
|
||||
}
|
||||
|
||||
return {
|
||||
calcRate,
|
||||
windowResize,
|
||||
unWindowResize,
|
||||
}
|
||||
}
|
||||
|
||||
// * X轴撑满,Y轴滚动条
|
||||
export const usePreviewScrollYScale = (
|
||||
width: number,
|
||||
height: number,
|
||||
scaleDom: HTMLElement | null,
|
||||
callback?: (scale: {
|
||||
width: number;
|
||||
height: number;
|
||||
}) => void
|
||||
) => {
|
||||
// * 画布尺寸(px)
|
||||
const baseWidth = width
|
||||
const baseHeight = height
|
||||
|
||||
// * 默认缩放值
|
||||
const scale = {
|
||||
width: 1,
|
||||
height: 1,
|
||||
}
|
||||
|
||||
// * 需保持的比例
|
||||
const baseProportion = parseFloat((baseWidth / baseHeight).toFixed(5))
|
||||
const calcRate = () => {
|
||||
if (scaleDom) {
|
||||
scale.height = parseFloat(((window.innerWidth / baseProportion) / baseHeight).toFixed(5))
|
||||
scale.width = parseFloat((window.innerWidth / baseWidth).toFixed(5))
|
||||
scaleDom.style.transform = `scale(${scale.width}, ${scale.height})`
|
||||
if (callback) callback(scale)
|
||||
}
|
||||
}
|
||||
|
||||
const resize = throttle(() => {
|
||||
calcRate()
|
||||
}, 200)
|
||||
|
||||
// * 改变窗口大小重新绘制
|
||||
const windowResize = () => {
|
||||
window.addEventListener('resize', resize)
|
||||
}
|
||||
|
||||
// * 改变窗口大小重新绘制
|
||||
const unWindowResize = () => {
|
||||
window.removeEventListener('resize', resize)
|
||||
}
|
||||
|
||||
return {
|
||||
calcRate,
|
||||
windowResize,
|
||||
unWindowResize,
|
||||
}
|
||||
}
|
||||
|
||||
// * Y轴撑满,X轴滚动条
|
||||
export const usePreviewScrollXScale = (
|
||||
width: number,
|
||||
height: number,
|
||||
scaleDom: HTMLElement | null,
|
||||
callback?: (scale: {
|
||||
width: number;
|
||||
height: number;
|
||||
}) => void
|
||||
) => {
|
||||
// * 画布尺寸(px)
|
||||
const baseWidth = width
|
||||
const baseHeight = height
|
||||
|
||||
// * 默认缩放值
|
||||
const scale = {
|
||||
height: 1,
|
||||
width: 1,
|
||||
}
|
||||
|
||||
// * 需保持的比例
|
||||
const baseProportion = parseFloat((baseWidth / baseHeight).toFixed(5))
|
||||
const calcRate = () => {
|
||||
if (scaleDom) {
|
||||
scale.width = parseFloat(((window.innerHeight * baseProportion) / baseWidth).toFixed(5))
|
||||
scale.height = parseFloat((window.innerHeight / baseHeight).toFixed(5))
|
||||
scaleDom.style.transform = `scale(${scale.width}, ${scale.height})`
|
||||
if (callback) callback(scale)
|
||||
}
|
||||
}
|
||||
|
||||
const resize = throttle(() => {
|
||||
calcRate()
|
||||
}, 200)
|
||||
|
||||
// * 改变窗口大小重新绘制
|
||||
const windowResize = () => {
|
||||
window.addEventListener('resize', resize)
|
||||
}
|
||||
|
||||
// * 改变窗口大小重新绘制
|
||||
const unWindowResize = () => {
|
||||
window.removeEventListener('resize', resize)
|
||||
}
|
||||
|
||||
return {
|
||||
calcRate,
|
||||
windowResize,
|
||||
unWindowResize,
|
||||
}
|
||||
}
|
||||
|
||||
// * 变形内容,宽高铺满
|
||||
export const usePreviewFullScale = (
|
||||
width: number,
|
||||
height: number,
|
||||
scaleDom: HTMLElement | null,
|
||||
callback?: (scale: {
|
||||
width: number;
|
||||
height: number;
|
||||
}) => void
|
||||
) => {
|
||||
|
||||
// * 默认缩放值
|
||||
const scale = {
|
||||
width: 1,
|
||||
height: 1,
|
||||
}
|
||||
|
||||
const calcRate = () => {
|
||||
if (scaleDom) {
|
||||
scale.width = parseFloat((window.innerWidth / width).toFixed(5))
|
||||
scale.height = parseFloat((window.innerHeight / height).toFixed(5))
|
||||
scaleDom.style.transform = `scale(${scale.width}, ${scale.height})`
|
||||
if (callback) callback(scale)
|
||||
}
|
||||
}
|
||||
|
||||
const resize = throttle(() => {
|
||||
calcRate()
|
||||
}, 200)
|
||||
|
||||
// * 改变窗口大小重新绘制
|
||||
const windowResize = () => {
|
||||
window.addEventListener('resize', resize)
|
||||
}
|
||||
|
||||
// * 改变窗口大小重新绘制
|
||||
const unWindowResize = () => {
|
||||
window.removeEventListener('resize', resize)
|
||||
}
|
||||
|
||||
return {
|
||||
calcRate,
|
||||
windowResize,
|
||||
unWindowResize,
|
||||
}
|
||||
import throttle from 'lodash/throttle'
|
||||
|
||||
// 拆出来是为了更好的分离单独复用
|
||||
|
||||
// * 屏幕缩放适配(两边留白)
|
||||
export const usePreviewFitScale = (
|
||||
width: number,
|
||||
height: number,
|
||||
scaleDom: HTMLElement | null,
|
||||
callback?: (scale: {
|
||||
width: number;
|
||||
height: number;
|
||||
}) => void
|
||||
) => {
|
||||
// * 画布尺寸(px)
|
||||
const baseWidth = width
|
||||
const baseHeight = height
|
||||
|
||||
// * 默认缩放值
|
||||
const scale = {
|
||||
width: 1,
|
||||
height: 1,
|
||||
}
|
||||
|
||||
// * 需保持的比例
|
||||
const baseProportion = parseFloat((baseWidth / baseHeight).toFixed(5))
|
||||
const calcRate = () => {
|
||||
// 当前屏幕宽高比
|
||||
const currentRate = parseFloat(
|
||||
(window.innerWidth / window.innerHeight).toFixed(5)
|
||||
)
|
||||
if (scaleDom) {
|
||||
if (currentRate > baseProportion) {
|
||||
// 表示更宽
|
||||
scale.width = parseFloat(((window.innerHeight * baseProportion) / baseWidth).toFixed(5))
|
||||
scale.height = parseFloat((window.innerHeight / baseHeight).toFixed(5))
|
||||
scaleDom.style.transform = `scale(${scale.width}, ${scale.height})`
|
||||
} else {
|
||||
// 表示更高
|
||||
scale.height = parseFloat(((window.innerWidth / baseProportion) / baseHeight).toFixed(5))
|
||||
scale.width = parseFloat((window.innerWidth / baseWidth).toFixed(5))
|
||||
scaleDom.style.transform = `scale(${scale.width}, ${scale.height})`
|
||||
}
|
||||
if (callback) callback(scale)
|
||||
}
|
||||
}
|
||||
|
||||
const resize = throttle(() => {
|
||||
calcRate()
|
||||
}, 200)
|
||||
|
||||
// * 改变窗口大小重新绘制
|
||||
const windowResize = () => {
|
||||
window.addEventListener('resize', resize)
|
||||
}
|
||||
|
||||
// * 卸载监听
|
||||
const unWindowResize = () => {
|
||||
window.removeEventListener('resize', resize)
|
||||
}
|
||||
|
||||
return {
|
||||
calcRate,
|
||||
windowResize,
|
||||
unWindowResize,
|
||||
}
|
||||
}
|
||||
|
||||
// * X轴撑满,Y轴滚动条
|
||||
export const usePreviewScrollYScale = (
|
||||
width: number,
|
||||
height: number,
|
||||
scaleDom: HTMLElement | null,
|
||||
callback?: (scale: {
|
||||
width: number;
|
||||
height: number;
|
||||
}) => void
|
||||
) => {
|
||||
// * 画布尺寸(px)
|
||||
const baseWidth = width
|
||||
const baseHeight = height
|
||||
|
||||
// * 默认缩放值
|
||||
const scale = {
|
||||
width: 1,
|
||||
height: 1,
|
||||
}
|
||||
|
||||
// * 需保持的比例
|
||||
const baseProportion = parseFloat((baseWidth / baseHeight).toFixed(5))
|
||||
const calcRate = () => {
|
||||
if (scaleDom) {
|
||||
scale.height = parseFloat(((window.innerWidth / baseProportion) / baseHeight).toFixed(5))
|
||||
scale.width = parseFloat((window.innerWidth / baseWidth).toFixed(5))
|
||||
scaleDom.style.transform = `scale(${scale.width}, ${scale.height})`
|
||||
if (callback) callback(scale)
|
||||
}
|
||||
}
|
||||
|
||||
const resize = throttle(() => {
|
||||
calcRate()
|
||||
}, 200)
|
||||
|
||||
// * 改变窗口大小重新绘制
|
||||
const windowResize = () => {
|
||||
window.addEventListener('resize', resize)
|
||||
}
|
||||
|
||||
// * 卸载监听
|
||||
const unWindowResize = () => {
|
||||
window.removeEventListener('resize', resize)
|
||||
}
|
||||
|
||||
return {
|
||||
calcRate,
|
||||
windowResize,
|
||||
unWindowResize,
|
||||
}
|
||||
}
|
||||
|
||||
// * Y轴撑满,X轴滚动条
|
||||
export const usePreviewScrollXScale = (
|
||||
width: number,
|
||||
height: number,
|
||||
scaleDom: HTMLElement | null,
|
||||
callback?: (scale: {
|
||||
width: number;
|
||||
height: number;
|
||||
}) => void
|
||||
) => {
|
||||
// * 画布尺寸(px)
|
||||
const baseWidth = width
|
||||
const baseHeight = height
|
||||
|
||||
// * 默认缩放值
|
||||
const scale = {
|
||||
height: 1,
|
||||
width: 1,
|
||||
}
|
||||
|
||||
// * 需保持的比例
|
||||
const baseProportion = parseFloat((baseWidth / baseHeight).toFixed(5))
|
||||
const calcRate = () => {
|
||||
if (scaleDom) {
|
||||
scale.width = parseFloat(((window.innerHeight * baseProportion) / baseWidth).toFixed(5))
|
||||
scale.height = parseFloat((window.innerHeight / baseHeight).toFixed(5))
|
||||
scaleDom.style.transform = `scale(${scale.width}, ${scale.height})`
|
||||
if (callback) callback(scale)
|
||||
}
|
||||
}
|
||||
|
||||
const resize = throttle(() => {
|
||||
calcRate()
|
||||
}, 200)
|
||||
|
||||
// * 改变窗口大小重新绘制
|
||||
const windowResize = () => {
|
||||
window.addEventListener('resize', resize)
|
||||
}
|
||||
|
||||
// * 卸载监听
|
||||
const unWindowResize = () => {
|
||||
window.removeEventListener('resize', resize)
|
||||
}
|
||||
|
||||
return {
|
||||
calcRate,
|
||||
windowResize,
|
||||
unWindowResize,
|
||||
}
|
||||
}
|
||||
|
||||
// * 变形内容,宽高铺满
|
||||
export const usePreviewFullScale = (
|
||||
width: number,
|
||||
height: number,
|
||||
scaleDom: HTMLElement | null,
|
||||
callback?: (scale: {
|
||||
width: number;
|
||||
height: number;
|
||||
}) => void
|
||||
) => {
|
||||
|
||||
// * 默认缩放值
|
||||
const scale = {
|
||||
width: 1,
|
||||
height: 1,
|
||||
}
|
||||
|
||||
const calcRate = () => {
|
||||
if (scaleDom) {
|
||||
scale.width = parseFloat((window.innerWidth / width).toFixed(5))
|
||||
scale.height = parseFloat((window.innerHeight / height).toFixed(5))
|
||||
scaleDom.style.transform = `scale(${scale.width}, ${scale.height})`
|
||||
if (callback) callback(scale)
|
||||
}
|
||||
}
|
||||
|
||||
const resize = throttle(() => {
|
||||
calcRate()
|
||||
}, 200)
|
||||
|
||||
// * 改变窗口大小重新绘制
|
||||
const windowResize = () => {
|
||||
window.addEventListener('resize', resize)
|
||||
}
|
||||
|
||||
// * 卸载监听
|
||||
const unWindowResize = () => {
|
||||
window.removeEventListener('resize', resize)
|
||||
}
|
||||
|
||||
return {
|
||||
calcRate,
|
||||
windowResize,
|
||||
unWindowResize,
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
export * from './axis'
|
||||
export * from './line'
|
||||
export * from './label'
|
||||
export * from './label'
|
||||
export * from './legend'
|
||||
70
src/packages/chartConfiguration/echarts/legend.ts
Normal file
@@ -0,0 +1,70 @@
|
||||
export const legendConfig = {
|
||||
// X轴位置
|
||||
lengendX: [
|
||||
{
|
||||
label: '靠左',
|
||||
value: 'left'
|
||||
},
|
||||
{
|
||||
label: '居中',
|
||||
value: 'center'
|
||||
},
|
||||
{
|
||||
label: '靠右',
|
||||
value: 'right'
|
||||
}
|
||||
],
|
||||
// y轴位置
|
||||
lengendY: [
|
||||
{
|
||||
label: '靠上',
|
||||
value: 'top'
|
||||
},
|
||||
{
|
||||
label: '居中',
|
||||
value: 'center'
|
||||
},
|
||||
{
|
||||
label: '靠下',
|
||||
value: 'bottom'
|
||||
}
|
||||
],
|
||||
// 排列方向
|
||||
orient: [
|
||||
{
|
||||
label: '水平',
|
||||
value: 'horizontal'
|
||||
},
|
||||
{
|
||||
label: '垂直',
|
||||
value: 'vertical'
|
||||
}
|
||||
],
|
||||
// 形状
|
||||
shape: [
|
||||
{
|
||||
label: '圆形',
|
||||
value: 'circle'
|
||||
},
|
||||
{
|
||||
label: '方形',
|
||||
value: 'rect'
|
||||
},
|
||||
{
|
||||
label: '圆角方形',
|
||||
value: 'roundRect'
|
||||
},
|
||||
{
|
||||
label: '三角形',
|
||||
value: 'triangle'
|
||||
},
|
||||
{
|
||||
label: '钢笔形',
|
||||
value: 'pin'
|
||||
},
|
||||
{
|
||||
label: '箭头形',
|
||||
value: 'arrow'
|
||||
}
|
||||
]
|
||||
}
|
||||
75
src/packages/components/Charts/Bars/BarLine/config.ts
Normal file
@@ -0,0 +1,75 @@
|
||||
import { echartOptionProfixHandle, PublicConfigClass } from '@/packages/public'
|
||||
import { BarLineConfig } from './index'
|
||||
import { CreateComponentType } from '@/packages/index.d'
|
||||
import cloneDeep from 'lodash/cloneDeep'
|
||||
import dataJson from './data.json'
|
||||
|
||||
export const includes = ['legend', 'xAxis', 'yAxis', 'grid']
|
||||
// 柱状折线组合图 分别定义series
|
||||
// 写死name可以定义legend显示的名称
|
||||
export const barSeriesItem = {
|
||||
type: 'bar',
|
||||
barWidth: 15,
|
||||
label: {
|
||||
show: true,
|
||||
position: 'top',
|
||||
color: '#fff',
|
||||
fontSize: 12
|
||||
},
|
||||
itemStyle: {
|
||||
color: null,
|
||||
borderRadius: 2
|
||||
}
|
||||
}
|
||||
|
||||
export const lineSeriesItem = {
|
||||
type: 'line',
|
||||
symbol: 'circle',
|
||||
label: {
|
||||
show: true,
|
||||
position: 'top',
|
||||
color: '#fff',
|
||||
fontSize: 12
|
||||
},
|
||||
symbolSize: 5, //设定实心点的大小
|
||||
itemStyle: {
|
||||
color: '#FFE47A',
|
||||
borderWidth: 1
|
||||
},
|
||||
lineStyle: {
|
||||
type: 'solid',
|
||||
width: 3,
|
||||
color: null
|
||||
}
|
||||
}
|
||||
|
||||
export const option = {
|
||||
tooltip: {
|
||||
show: true,
|
||||
trigger: 'axis',
|
||||
axisPointer: {
|
||||
show: true,
|
||||
type: 'shadow'
|
||||
}
|
||||
},
|
||||
legend: {
|
||||
data: null
|
||||
},
|
||||
xAxis: {
|
||||
show: true,
|
||||
type: 'category'
|
||||
},
|
||||
yAxis: {
|
||||
show: true,
|
||||
type: 'value'
|
||||
},
|
||||
dataset: { ...dataJson },
|
||||
series: [barSeriesItem, lineSeriesItem]
|
||||
}
|
||||
|
||||
export default class Config extends PublicConfigClass implements CreateComponentType {
|
||||
public key = BarLineConfig.key
|
||||
public chartConfig = cloneDeep(BarLineConfig)
|
||||
// 图表配置项
|
||||
public option = echartOptionProfixHandle(option, includes)
|
||||
}
|
||||
93
src/packages/components/Charts/Bars/BarLine/config.vue
Normal file
@@ -0,0 +1,93 @@
|
||||
<template>
|
||||
<!-- Echarts 全局设置 -->
|
||||
<global-setting :optionData="optionData"></global-setting>
|
||||
<CollapseItem
|
||||
v-for="(item, index) in seriesList"
|
||||
:key="index"
|
||||
:name="`${item.type == 'bar' ? '柱状图' : '折线图'}`"
|
||||
:expanded="true"
|
||||
>
|
||||
<SettingItemBox name="图形" v-if="item.type == 'bar'">
|
||||
<SettingItem name="宽度">
|
||||
<n-input-number
|
||||
v-model:value="item.barWidth"
|
||||
:min="1"
|
||||
:max="100"
|
||||
size="small"
|
||||
placeholder="自动计算"
|
||||
></n-input-number>
|
||||
</SettingItem>
|
||||
<SettingItem name="圆角">
|
||||
<n-input-number v-model:value="item.itemStyle.borderRadius" :min="0" size="small"></n-input-number>
|
||||
</SettingItem>
|
||||
</SettingItemBox>
|
||||
<SettingItemBox name="线条" v-if="item.type == 'line'">
|
||||
<SettingItem name="宽度">
|
||||
<n-input-number
|
||||
v-model:value="item.lineStyle.width"
|
||||
:min="1"
|
||||
:max="100"
|
||||
size="small"
|
||||
placeholder="自动计算"
|
||||
></n-input-number>
|
||||
</SettingItem>
|
||||
<SettingItem name="类型">
|
||||
<n-select v-model:value="item.lineStyle.type" size="small" :options="lineConf.lineStyle.type"></n-select>
|
||||
</SettingItem>
|
||||
</SettingItemBox>
|
||||
<SettingItemBox name="实心点" v-if="item.type == 'line'">
|
||||
<SettingItem name="大小">
|
||||
<n-input-number
|
||||
v-model:value="item.symbolSize"
|
||||
:min="1"
|
||||
:max="100"
|
||||
size="small"
|
||||
placeholder="自动计算"
|
||||
></n-input-number>
|
||||
</SettingItem>
|
||||
</SettingItemBox>
|
||||
<setting-item-box name="标签">
|
||||
<setting-item>
|
||||
<n-space>
|
||||
<n-switch v-model:value="item.label.show" size="small" />
|
||||
<n-text>展示标签</n-text>
|
||||
</n-space>
|
||||
</setting-item>
|
||||
<setting-item name="大小">
|
||||
<n-input-number v-model:value="item.label.fontSize" size="small" :min="1"></n-input-number>
|
||||
</setting-item>
|
||||
<setting-item name="tip颜色">
|
||||
<n-color-picker size="small" :modes="['hex']" v-model:value="item.label.color"></n-color-picker>
|
||||
</setting-item>
|
||||
<setting-item name="位置">
|
||||
<n-select
|
||||
v-model:value="item.label.position"
|
||||
:options="[
|
||||
{ label: 'top', value: 'top' },
|
||||
{ label: 'left', value: 'left' },
|
||||
{ label: 'right', value: 'right' },
|
||||
{ label: 'bottom', value: 'bottom' }
|
||||
]"
|
||||
/>
|
||||
</setting-item>
|
||||
</setting-item-box>
|
||||
</CollapseItem>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { PropType, computed } from 'vue'
|
||||
import { GlobalSetting, CollapseItem, SettingItemBox, SettingItem } from '@/components/Pages/ChartItemSetting'
|
||||
import { lineConf } from '@/packages/chartConfiguration/echarts'
|
||||
import { GlobalThemeJsonType } from '@/settings/chartThemes'
|
||||
|
||||
const props = defineProps({
|
||||
optionData: {
|
||||
type: Object as PropType<GlobalThemeJsonType>,
|
||||
required: true
|
||||
}
|
||||
})
|
||||
|
||||
const seriesList = computed(() => {
|
||||
return props.optionData.series
|
||||
})
|
||||
</script>
|
||||
40
src/packages/components/Charts/Bars/BarLine/data.json
Normal file
@@ -0,0 +1,40 @@
|
||||
{
|
||||
"dimensions": ["product", "data1", "data2"],
|
||||
"source": [
|
||||
{
|
||||
"product": "1月",
|
||||
"data1": 104,
|
||||
"data2": 30
|
||||
},
|
||||
{
|
||||
"product": "2月",
|
||||
"data1": 56,
|
||||
"data2": 56
|
||||
},
|
||||
{
|
||||
"product": "3月",
|
||||
"data1": 136,
|
||||
"data2": 36
|
||||
},
|
||||
{
|
||||
"product": "4月",
|
||||
"data1": 86,
|
||||
"data2": 6
|
||||
},
|
||||
{
|
||||
"product": "5月",
|
||||
"data1": 98,
|
||||
"data2": 10
|
||||
},
|
||||
{
|
||||
"product": "6月",
|
||||
"data1": 86,
|
||||
"data2": 70
|
||||
},
|
||||
{
|
||||
"product": "7月",
|
||||
"data1": 77,
|
||||
"data2": 57
|
||||
}
|
||||
]
|
||||
}
|
||||
16
src/packages/components/Charts/Bars/BarLine/index.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
// 公共类型声明
|
||||
import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d'
|
||||
// 当前[信息模块]分类声明
|
||||
import { ChatCategoryEnum,ChatCategoryEnumName } from '../../index.d'
|
||||
|
||||
export const BarLineConfig: ConfigType = {
|
||||
key: 'BarLine',
|
||||
chartKey: 'VBarLine',
|
||||
conKey: 'VCBarLine',
|
||||
title: '柱状图 & 折线图',
|
||||
category: ChatCategoryEnum.BAR,
|
||||
categoryName: ChatCategoryEnumName.BAR,
|
||||
package: PackagesCategoryEnum.CHARTS,
|
||||
chartFrame: ChartFrameEnum.ECHARTS,
|
||||
image: 'bar_line.png'
|
||||
}
|
||||
73
src/packages/components/Charts/Bars/BarLine/index.vue
Normal file
@@ -0,0 +1,73 @@
|
||||
<template>
|
||||
<v-chart
|
||||
ref="vChartRef"
|
||||
:init-options="initOptions"
|
||||
:theme="themeColor"
|
||||
:option="option"
|
||||
:manual-update="isPreview()"
|
||||
autoresize
|
||||
></v-chart>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, computed, watch, PropType, nextTick } from 'vue'
|
||||
import VChart from 'vue-echarts'
|
||||
import { useCanvasInitOptions } from '@/hooks/useCanvasInitOptions.hook'
|
||||
import { use } from 'echarts/core'
|
||||
import { CanvasRenderer } from 'echarts/renderers'
|
||||
//引入柱状图 折线图
|
||||
import { BarChart, LineChart } from 'echarts/charts'
|
||||
import config, { includes, barSeriesItem, lineSeriesItem } from './config'
|
||||
import { mergeTheme } from '@/packages/public/chart'
|
||||
import { useChartDataFetch } from '@/hooks'
|
||||
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
|
||||
import { isPreview } from '@/utils'
|
||||
import { DatasetComponent, GridComponent, TooltipComponent, LegendComponent } from 'echarts/components'
|
||||
|
||||
const props = defineProps({
|
||||
themeSetting: {
|
||||
type: Object,
|
||||
required: true
|
||||
},
|
||||
themeColor: {
|
||||
type: Object,
|
||||
required: true
|
||||
},
|
||||
chartConfig: {
|
||||
type: Object as PropType<config>,
|
||||
required: true
|
||||
}
|
||||
})
|
||||
|
||||
const initOptions = useCanvasInitOptions(props.chartConfig.option, props.themeSetting)
|
||||
|
||||
use([DatasetComponent, CanvasRenderer, BarChart, LineChart, GridComponent, TooltipComponent, LegendComponent])
|
||||
|
||||
const replaceMergeArr = ref<string[]>()
|
||||
|
||||
const option = computed(() => {
|
||||
return mergeTheme(props.chartConfig.option, props.themeSetting, includes)
|
||||
})
|
||||
|
||||
watch(
|
||||
() => props.chartConfig.option.dataset,
|
||||
(newData, oldData) => {
|
||||
if (newData.dimensions.length !== oldData.dimensions.length) {
|
||||
const seriesArr = []
|
||||
for (let i = 0; i < newData.dimensions.length - 1; i++) {
|
||||
seriesArr.push(barSeriesItem, lineSeriesItem)
|
||||
}
|
||||
replaceMergeArr.value = ['series']
|
||||
props.chartConfig.option.series = seriesArr
|
||||
nextTick(() => {
|
||||
replaceMergeArr.value = []
|
||||
})
|
||||
}
|
||||
},
|
||||
{
|
||||
deep: false
|
||||
}
|
||||
)
|
||||
|
||||
const { vChartRef } = useChartDataFetch(props.chartConfig, useChartEditStore)
|
||||
</script>
|
||||
@@ -1,5 +1,6 @@
|
||||
import { BarCommonConfig } from './BarCommon/index'
|
||||
import { BarCrossrangeConfig } from './BarCrossrange/index'
|
||||
import { CapsuleChartConfig } from './CapsuleChart/index'
|
||||
|
||||
export default [BarCommonConfig, BarCrossrangeConfig, CapsuleChartConfig]
|
||||
import { BarCommonConfig } from './BarCommon/index'
|
||||
import { BarCrossrangeConfig } from './BarCrossrange/index'
|
||||
import { CapsuleChartConfig } from './CapsuleChart/index'
|
||||
import { BarLineConfig } from './BarLine/index'
|
||||
|
||||
export default [BarCommonConfig, BarCrossrangeConfig, BarLineConfig, CapsuleChartConfig]
|
||||
|
||||
@@ -33,6 +33,10 @@ export const option = {
|
||||
width: 3,
|
||||
color: {
|
||||
type: 'linear',
|
||||
x: 0,
|
||||
y: 0,
|
||||
x2: 0,
|
||||
y2: 1,
|
||||
colorStops: [
|
||||
{
|
||||
offset: 0,
|
||||
|
||||
@@ -16,7 +16,8 @@ export enum ThemeEnum {
|
||||
MACARON = 'macaron',
|
||||
BLUE = 'blue',
|
||||
DARKBLUE = 'darkblue',
|
||||
WINE = 'wine'
|
||||
WINE = 'wine',
|
||||
WEIXIN = 'tileLayer'
|
||||
}
|
||||
|
||||
export enum LangEnum {
|
||||
|
||||
@@ -134,6 +134,10 @@ const themeOptions = [
|
||||
{
|
||||
value: ThemeEnum.WINE,
|
||||
label: '酱籽'
|
||||
},
|
||||
{
|
||||
value: ThemeEnum.WEIXIN,
|
||||
label: '卫星'
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import AMapLoader from '@amap/amap-jsapi-loader'
|
||||
import { CreateComponentType } from '@/packages/index.d'
|
||||
import { useChartDataFetch } from '@/hooks'
|
||||
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
|
||||
import { MarkerEnum } from './config'
|
||||
import { MarkerEnum, ThemeEnum } from './config'
|
||||
import { isArray } from '@/utils'
|
||||
|
||||
const props = defineProps({
|
||||
@@ -51,7 +51,6 @@ const initMap = (newData: any) => {
|
||||
resizeEnable: true,
|
||||
zoom: amapZindex.value, // 地图显示的缩放级别
|
||||
center: [amapLon.value, amapLat.value],
|
||||
mapStyle: `amap://styles/${amapStyleKeyCustom.value !== '' ? amapStyleKeyCustom.value : amapStyleKey.value}`, //自定义地图的显示样式
|
||||
lang: lang.value,
|
||||
features: features.value,
|
||||
pitch: pitch.value, // 地图俯仰角度,有效范围 0 度- 83 度
|
||||
@@ -60,6 +59,14 @@ const initMap = (newData: any) => {
|
||||
willReadFrequently: true
|
||||
})
|
||||
dataHandle(props.chartConfig.option.dataset)
|
||||
let satellite = new AMap.TileLayer.Satellite()
|
||||
let roadNet = new AMap.TileLayer.RoadNet()
|
||||
if (newData.amapStyleKey === ThemeEnum.WEIXIN) {
|
||||
mapIns.add([satellite, roadNet])
|
||||
} else {
|
||||
mapIns.remove([satellite, roadNet])
|
||||
mapIns.setMapStyle(`amap://styles/${amapStyleKeyCustom.value !== '' ? amapStyleKeyCustom.value : amapStyleKey.value}`)
|
||||
}
|
||||
})
|
||||
.catch(e => {})
|
||||
}
|
||||
|
||||
@@ -11,7 +11,10 @@ export const option = {
|
||||
dataset: dataJson,
|
||||
mapRegion: {
|
||||
adcode: 'china',
|
||||
showHainanIsLands: true
|
||||
showHainanIsLands: true,
|
||||
enter: false,
|
||||
backSize: 20,
|
||||
backColor: '#ffffff'
|
||||
},
|
||||
tooltip: {
|
||||
show: true,
|
||||
@@ -84,7 +87,10 @@ export const option = {
|
||||
shadowColor: '#E1FFFF',
|
||||
shadowBlur: 10
|
||||
},
|
||||
data: []
|
||||
data: [],
|
||||
encode: {
|
||||
value: 2
|
||||
}
|
||||
},
|
||||
{
|
||||
name: '区域',
|
||||
@@ -100,19 +106,19 @@ export const option = {
|
||||
borderColor: 'rgba(147, 235, 248, 0.8)',
|
||||
textStyle: {
|
||||
color: '#FFFFFF',
|
||||
fontSize: 12,
|
||||
fontSize: 12
|
||||
}
|
||||
},
|
||||
label: {
|
||||
show: false,
|
||||
color: '#FFFFFF',
|
||||
fontSize: 12,
|
||||
fontSize: 12
|
||||
},
|
||||
emphasis: {
|
||||
disabled: false,
|
||||
label: {
|
||||
color: '#FFFFFF',
|
||||
fontSize: 12,
|
||||
fontSize: 12
|
||||
},
|
||||
itemStyle: {
|
||||
areaColor: '#389BB7',
|
||||
@@ -145,6 +151,26 @@ export const option = {
|
||||
shadowOffsetY: 2,
|
||||
shadowBlur: 10
|
||||
}
|
||||
},
|
||||
{
|
||||
type: 'lines',
|
||||
zlevel: 2,
|
||||
effect: {
|
||||
show: true,
|
||||
period: 4, //箭头指向速度,值越小速度越快
|
||||
trailLength: 0.4, //特效尾迹长度[0,1]值越大,尾迹越长重
|
||||
symbol: 'arrow', //箭头图标
|
||||
symbolSize: 7 //图标大小
|
||||
},
|
||||
lineStyle: {
|
||||
normal: {
|
||||
color: '#4fb6d2',
|
||||
width: 1, //线条宽度
|
||||
opacity: 0.1, //尾迹线条透明度
|
||||
curveness: 0.3 //尾迹线条曲直度
|
||||
}
|
||||
},
|
||||
data: []
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -69,11 +69,7 @@
|
||||
</n-space>
|
||||
</SettingItem>
|
||||
<SettingItem name="字体颜色">
|
||||
<n-color-picker
|
||||
size="small"
|
||||
:modes="['hex']"
|
||||
v-model:value="seriesList[1].label.color"
|
||||
></n-color-picker>
|
||||
<n-color-picker size="small" :modes="['hex']" v-model:value="seriesList[1].label.color"></n-color-picker>
|
||||
</SettingItem>
|
||||
<SettingItem name="字体大小">
|
||||
<n-input-number
|
||||
@@ -129,7 +125,7 @@
|
||||
></n-color-picker>
|
||||
</SettingItem>
|
||||
</SettingItemBox>
|
||||
|
||||
|
||||
<SettingItemBox name="悬浮弹窗">
|
||||
<SettingItem name="显示">
|
||||
<n-space>
|
||||
@@ -180,6 +176,22 @@
|
||||
<SettingItem>
|
||||
<n-checkbox v-model:checked="mapRegion.showHainanIsLands" size="small">显示南海群岛</n-checkbox>
|
||||
</SettingItem>
|
||||
<SettingItem v-if="seriesList[2]">
|
||||
<n-checkbox v-model:checked="mapRegion.enter" size="small">点击进入下级</n-checkbox>
|
||||
</SettingItem>
|
||||
</SettingItemBox>
|
||||
<SettingItemBox name="返回图标" v-if="mapRegion.enter">
|
||||
<SettingItem name="颜色">
|
||||
<n-color-picker size="small" :modes="['hex']" v-model:value="mapRegion.backColor"></n-color-picker>
|
||||
</SettingItem>
|
||||
<SettingItem name="大小">
|
||||
<n-input-number
|
||||
v-model:value="mapRegion.backSize"
|
||||
:min="1"
|
||||
size="small"
|
||||
placeholder="请输入字体大小"
|
||||
></n-input-number>
|
||||
</SettingItem>
|
||||
</SettingItemBox>
|
||||
</CollapseItem>
|
||||
<CollapseItem name="标记" :expanded="true">
|
||||
@@ -191,7 +203,7 @@
|
||||
<n-color-picker size="small" :modes="['hex']" v-model:value="seriesList[0].itemStyle.color"></n-color-picker>
|
||||
</SettingItem>
|
||||
</SettingItemBox>
|
||||
|
||||
|
||||
<SettingItemBox name="文本">
|
||||
<SettingItem name="显示">
|
||||
<n-space>
|
||||
@@ -223,6 +235,47 @@
|
||||
</SettingItem>
|
||||
</SettingItemBox>
|
||||
</CollapseItem>
|
||||
|
||||
<CollapseItem v-if="seriesList[2]" name="飞线" :expanded="true">
|
||||
<SettingItemBox name="箭头">
|
||||
<SettingItem name="速度">
|
||||
<n-tooltip trigger="hover">
|
||||
<template #trigger>
|
||||
<n-input-number v-model:value="seriesList[2].effect.period" size="small" :min="0"></n-input-number>
|
||||
</template>
|
||||
值越小速度越快
|
||||
</n-tooltip>
|
||||
</SettingItem>
|
||||
<SettingItem name="尾迹">
|
||||
<n-tooltip trigger="hover">
|
||||
<template #trigger>
|
||||
<n-input-number
|
||||
v-model:value="seriesList[2].effect.trailLength"
|
||||
size="small"
|
||||
:min="0"
|
||||
:max="1"
|
||||
></n-input-number>
|
||||
</template>
|
||||
特效尾迹长度[0,1]值越大,尾迹越长重
|
||||
</n-tooltip>
|
||||
</SettingItem>
|
||||
<SettingItem name="大小">
|
||||
<n-input-number v-model:value="seriesList[2].effect.symbolSize" size="small" :min="0"></n-input-number>
|
||||
</SettingItem>
|
||||
</SettingItemBox>
|
||||
<SettingItemBox name="配置">
|
||||
<SettingItem name="颜色">
|
||||
<n-color-picker
|
||||
size="small"
|
||||
:modes="['hex']"
|
||||
v-model:value="seriesList[2].lineStyle.normal.color"
|
||||
></n-color-picker>
|
||||
</SettingItem>
|
||||
<SettingItem name="宽度">
|
||||
<n-input-number v-model:value="seriesList[2].lineStyle.normal.width" size="small" :min="1"></n-input-number>
|
||||
</SettingItem>
|
||||
</SettingItemBox>
|
||||
</CollapseItem>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
|
||||
@@ -21,6 +21,32 @@
|
||||
"value": [126.642464, 45.756967, 101]
|
||||
}
|
||||
],
|
||||
"line": [
|
||||
{
|
||||
"coords": [
|
||||
[113.665412, 34.757975],
|
||||
[116.405285, 39.904989]
|
||||
]
|
||||
},
|
||||
{
|
||||
"coords": [
|
||||
[101.778916, 36.623178],
|
||||
[116.405285, 39.904989]
|
||||
]
|
||||
},
|
||||
{
|
||||
"coords": [
|
||||
[106.278179, 38.46637],
|
||||
[116.405285, 39.904989]
|
||||
]
|
||||
},
|
||||
{
|
||||
"coords": [
|
||||
[126.642464, 45.756967],
|
||||
[116.405285, 39.904989]
|
||||
]
|
||||
}
|
||||
],
|
||||
"map": [
|
||||
{
|
||||
"name": "北京市",
|
||||
|
||||
@@ -1,156 +1,256 @@
|
||||
<template>
|
||||
<v-chart ref="vChartRef" :init-options="initOptions" :theme="themeColor" :option="option.value" :manual-update="isPreview()" autoresize>
|
||||
</v-chart>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { PropType, reactive, watch, ref, nextTick } from 'vue'
|
||||
import config, { includes } from './config'
|
||||
import VChart from 'vue-echarts'
|
||||
import { useCanvasInitOptions } from '@/hooks/useCanvasInitOptions.hook'
|
||||
import { use, registerMap } from 'echarts/core'
|
||||
import { EffectScatterChart, MapChart } from 'echarts/charts'
|
||||
import { CanvasRenderer } from 'echarts/renderers'
|
||||
import { useChartDataFetch } from '@/hooks'
|
||||
import { mergeTheme, setOption } from '@/packages/public/chart'
|
||||
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
|
||||
import { isPreview } from '@/utils'
|
||||
import mapJsonWithoutHainanIsLands from './mapWithoutHainanIsLands.json'
|
||||
import { DatasetComponent, GridComponent, TooltipComponent, GeoComponent, VisualMapComponent } from 'echarts/components'
|
||||
|
||||
const props = defineProps({
|
||||
themeSetting: {
|
||||
type: Object,
|
||||
required: true
|
||||
},
|
||||
themeColor: {
|
||||
type: Object,
|
||||
required: true
|
||||
},
|
||||
chartConfig: {
|
||||
type: Object as PropType<config>,
|
||||
required: true
|
||||
}
|
||||
})
|
||||
|
||||
const initOptions = useCanvasInitOptions(props.chartConfig.option, props.themeSetting)
|
||||
|
||||
use([
|
||||
MapChart,
|
||||
DatasetComponent,
|
||||
CanvasRenderer,
|
||||
GridComponent,
|
||||
TooltipComponent,
|
||||
GeoComponent,
|
||||
EffectScatterChart,
|
||||
VisualMapComponent
|
||||
])
|
||||
|
||||
const option = reactive({
|
||||
value: mergeTheme(props.chartConfig.option, props.themeSetting, includes)
|
||||
})
|
||||
const vChartRef = ref<typeof VChart>()
|
||||
|
||||
//动态获取json注册地图
|
||||
const getGeojson = (regionId: string) => {
|
||||
return new Promise<boolean>(resolve => {
|
||||
import(`./mapGeojson/${regionId}.json`).then(data => {
|
||||
registerMap(regionId, { geoJSON: data.default as any, specialAreas: {} })
|
||||
resolve(true)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
//异步时先注册空的 保证初始化不报错
|
||||
registerMap(`${props.chartConfig.option.mapRegion.adcode}`, { geoJSON: {} as any, specialAreas: {} })
|
||||
|
||||
// 进行更换初始化地图 如果为china 单独处理
|
||||
const registerMapInitAsync = async () => {
|
||||
await nextTick()
|
||||
const adCode = `${props.chartConfig.option.mapRegion.adcode}`;
|
||||
if (adCode !== 'china') {
|
||||
await getGeojson(adCode)
|
||||
} else {
|
||||
await hainanLandsHandle(props.chartConfig.option.mapRegion.showHainanIsLands)
|
||||
}
|
||||
vEchartsSetOption()
|
||||
}
|
||||
registerMapInitAsync()
|
||||
|
||||
// 手动触发渲染
|
||||
const vEchartsSetOption = () => {
|
||||
option.value = props.chartConfig.option
|
||||
setOption(vChartRef.value, props.chartConfig.option)
|
||||
}
|
||||
|
||||
// 更新数据处理
|
||||
const dataSetHandle = async (dataset: any) => {
|
||||
props.chartConfig.option.series.forEach((item: any) => {
|
||||
if (item.type === 'effectScatter' && dataset.point) item.data = dataset.point
|
||||
else if (item.type === 'map' && dataset.map) item.data = dataset.map
|
||||
})
|
||||
if (dataset.pieces) props.chartConfig.option.visualMap.pieces = dataset.pieces
|
||||
|
||||
isPreview() && vEchartsSetOption()
|
||||
}
|
||||
// 处理海南群岛
|
||||
const hainanLandsHandle = async (newData: boolean) => {
|
||||
if (newData) {
|
||||
await getGeojson('china')
|
||||
} else {
|
||||
registerMap('china', { geoJSON: mapJsonWithoutHainanIsLands as any, specialAreas: {} })
|
||||
}
|
||||
}
|
||||
//监听 dataset 数据发生变化
|
||||
watch(
|
||||
() => props.chartConfig.option.dataset,
|
||||
newData => {
|
||||
dataSetHandle(newData)
|
||||
},
|
||||
{
|
||||
immediate: true,
|
||||
deep: false
|
||||
}
|
||||
)
|
||||
|
||||
//监听是否显示南海群岛
|
||||
watch(
|
||||
() => props.chartConfig.option.mapRegion.showHainanIsLands,
|
||||
async newData => {
|
||||
try {
|
||||
await hainanLandsHandle(newData)
|
||||
vEchartsSetOption()
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
},
|
||||
{
|
||||
deep: false
|
||||
}
|
||||
)
|
||||
|
||||
//监听地图展示区域发生变化
|
||||
watch(
|
||||
() => `${props.chartConfig.option.mapRegion.adcode}`,
|
||||
async newData => {
|
||||
try {
|
||||
await getGeojson(newData)
|
||||
props.chartConfig.option.geo.map = newData
|
||||
props.chartConfig.option.series.forEach((item: any) => {
|
||||
if (item.type === 'map') item.map = newData
|
||||
})
|
||||
vEchartsSetOption()
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
},
|
||||
{
|
||||
deep: false
|
||||
}
|
||||
)
|
||||
|
||||
// 预览
|
||||
useChartDataFetch(props.chartConfig, useChartEditStore, (newData: any) => {
|
||||
dataSetHandle(newData)
|
||||
})
|
||||
</script>
|
||||
<template>
|
||||
<div>
|
||||
<div class="back-icon" v-if="(enter && levelHistory.length !== 0) || (enter && !isPreview())" @click="backLevel">
|
||||
<n-icon :color="backColor" :size="backSize * 1.1">
|
||||
<ArrowBackIcon />
|
||||
</n-icon>
|
||||
<span
|
||||
:style="{
|
||||
'font-weight': 200,
|
||||
color: backColor,
|
||||
'font-size': `${backSize}px`
|
||||
}"
|
||||
>
|
||||
返回上级
|
||||
</span>
|
||||
</div>
|
||||
<v-chart
|
||||
ref="vChartRef"
|
||||
:init-options="initOptions"
|
||||
:theme="themeColor"
|
||||
:option="option.value"
|
||||
:manual-update="isPreview()"
|
||||
autoresize
|
||||
@click="chartPEvents"
|
||||
>
|
||||
</v-chart>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { PropType, reactive, watch, ref, nextTick, toRefs } from 'vue'
|
||||
import config, { includes } from './config'
|
||||
import VChart from 'vue-echarts'
|
||||
import { icon } from '@/plugins'
|
||||
import { useCanvasInitOptions } from '@/hooks/useCanvasInitOptions.hook'
|
||||
import { use, registerMap } from 'echarts/core'
|
||||
import { EffectScatterChart, MapChart } from 'echarts/charts'
|
||||
import { CanvasRenderer } from 'echarts/renderers'
|
||||
import { useChartDataFetch } from '@/hooks'
|
||||
import { mergeTheme, setOption } from '@/packages/public/chart'
|
||||
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
|
||||
import { isPreview } from '@/utils'
|
||||
import mapJsonWithoutHainanIsLands from './mapWithoutHainanIsLands.json'
|
||||
import mapChinaJson from './mapGeojson/china.json'
|
||||
import { DatasetComponent, GridComponent, TooltipComponent, GeoComponent, VisualMapComponent } from 'echarts/components'
|
||||
|
||||
const props = defineProps({
|
||||
themeSetting: {
|
||||
type: Object,
|
||||
required: true
|
||||
},
|
||||
themeColor: {
|
||||
type: Object,
|
||||
required: true
|
||||
},
|
||||
chartConfig: {
|
||||
type: Object as PropType<config>,
|
||||
required: true
|
||||
}
|
||||
})
|
||||
|
||||
const { ArrowBackIcon } = icon.ionicons5
|
||||
let levelHistory: any = ref([])
|
||||
|
||||
const { backColor, backSize, enter } = toRefs(props.chartConfig.option.mapRegion)
|
||||
const initOptions = useCanvasInitOptions(props.chartConfig.option, props.themeSetting)
|
||||
|
||||
use([
|
||||
MapChart,
|
||||
DatasetComponent,
|
||||
CanvasRenderer,
|
||||
GridComponent,
|
||||
TooltipComponent,
|
||||
GeoComponent,
|
||||
EffectScatterChart,
|
||||
VisualMapComponent
|
||||
])
|
||||
|
||||
const option = reactive({
|
||||
value: mergeTheme(props.chartConfig.option, props.themeSetting, includes)
|
||||
})
|
||||
const vChartRef = ref<typeof VChart>()
|
||||
|
||||
//动态获取json注册地图
|
||||
const getGeojson = (regionId: string) => {
|
||||
return new Promise<boolean>(resolve => {
|
||||
import(`./mapGeojson/${regionId}.json`).then(data => {
|
||||
registerMap(regionId, { geoJSON: data.default as any, specialAreas: {} })
|
||||
resolve(true)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
//异步时先注册空的 保证初始化不报错
|
||||
registerMap(`${props.chartConfig.option.mapRegion.adcode}`, { geoJSON: {} as any, specialAreas: {} })
|
||||
|
||||
// 进行更换初始化地图 如果为china 单独处理
|
||||
const registerMapInitAsync = async () => {
|
||||
await nextTick()
|
||||
const adCode = `${props.chartConfig.option.mapRegion.adcode}`
|
||||
if (adCode !== 'china') {
|
||||
await getGeojson(adCode)
|
||||
} else {
|
||||
await hainanLandsHandle(props.chartConfig.option.mapRegion.showHainanIsLands)
|
||||
}
|
||||
vEchartsSetOption()
|
||||
}
|
||||
registerMapInitAsync()
|
||||
|
||||
// 手动触发渲染
|
||||
const vEchartsSetOption = () => {
|
||||
option.value = props.chartConfig.option
|
||||
setOption(vChartRef.value, props.chartConfig.option)
|
||||
}
|
||||
|
||||
// 更新数据处理
|
||||
const dataSetHandle = async (dataset: any) => {
|
||||
props.chartConfig.option.series.forEach((item: any) => {
|
||||
if (item.type === 'effectScatter' && dataset.point) item.data = dataset.point
|
||||
else if (item.type === 'lines' && dataset.line) {
|
||||
item.data = dataset.line.map((it: any) => {
|
||||
return {
|
||||
...it,
|
||||
lineStyle: {
|
||||
color: props.chartConfig.option.series[2].lineStyle.normal.color
|
||||
}
|
||||
}
|
||||
})
|
||||
} else if (item.type === 'map' && dataset.map) item.data = dataset.map
|
||||
})
|
||||
if (dataset.pieces) props.chartConfig.option.visualMap.pieces = dataset.pieces
|
||||
|
||||
isPreview() && vEchartsSetOption()
|
||||
}
|
||||
// 处理海南群岛
|
||||
const hainanLandsHandle = async (newData: boolean) => {
|
||||
if (newData) {
|
||||
await getGeojson('china')
|
||||
} else {
|
||||
registerMap('china', { geoJSON: mapJsonWithoutHainanIsLands as any, specialAreas: {} })
|
||||
}
|
||||
}
|
||||
|
||||
// 点击区域
|
||||
const chartPEvents = (e: any) => {
|
||||
if (e.seriesType !== 'map') return
|
||||
if (!props.chartConfig.option.mapRegion.enter) {
|
||||
return
|
||||
}
|
||||
mapChinaJson.features.forEach(item => {
|
||||
var pattern = new RegExp(e.name)
|
||||
if (pattern.test(item.properties.name)) {
|
||||
let code = String(item.properties.adcode)
|
||||
levelHistory.value.push(code)
|
||||
checkOrMap(code)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 返回上一级
|
||||
const backLevel = () => {
|
||||
levelHistory.value = []
|
||||
if (levelHistory.value.length > 1) {
|
||||
levelHistory.value.pop()
|
||||
const code = levelHistory[levelHistory.value.length - 1]
|
||||
checkOrMap(code)
|
||||
} else {
|
||||
checkOrMap('china')
|
||||
}
|
||||
}
|
||||
|
||||
// 切换地图
|
||||
const checkOrMap = async (newData: string) => {
|
||||
await getGeojson(newData)
|
||||
props.chartConfig.option.geo.map = newData
|
||||
props.chartConfig.option.series.forEach((item: any) => {
|
||||
if (item.type === 'map') item.map = newData
|
||||
})
|
||||
vEchartsSetOption()
|
||||
}
|
||||
|
||||
//监听 dataset 数据发生变化
|
||||
watch(
|
||||
() => props.chartConfig.option.dataset,
|
||||
newData => {
|
||||
dataSetHandle(newData)
|
||||
},
|
||||
{
|
||||
immediate: true,
|
||||
deep: false
|
||||
}
|
||||
)
|
||||
|
||||
// 监听线的颜色
|
||||
if (props.chartConfig.option.series[2] && !isPreview()) {
|
||||
watch(
|
||||
() => props.chartConfig.option.series[2].lineStyle.normal.color,
|
||||
() => {
|
||||
dataSetHandle(props.chartConfig.option.dataset)
|
||||
},
|
||||
{
|
||||
deep: false
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
//监听是否显示南海群岛
|
||||
if (!isPreview()) {
|
||||
watch(
|
||||
() => props.chartConfig.option.mapRegion.showHainanIsLands,
|
||||
async newData => {
|
||||
try {
|
||||
await hainanLandsHandle(newData)
|
||||
vEchartsSetOption()
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
},
|
||||
{
|
||||
deep: false
|
||||
}
|
||||
)
|
||||
}
|
||||
//监听地图展示区域发生变化
|
||||
watch(
|
||||
() => `${props.chartConfig.option.mapRegion.adcode}`,
|
||||
newData => {
|
||||
try {
|
||||
checkOrMap(newData)
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
},
|
||||
{
|
||||
deep: false
|
||||
}
|
||||
)
|
||||
|
||||
// 预览
|
||||
useChartDataFetch(props.chartConfig, useChartEditStore, (newData: any) => {
|
||||
dataSetHandle(newData)
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scope lang="scss">
|
||||
.back-icon {
|
||||
z-index: 50;
|
||||
cursor: pointer;
|
||||
position: absolute;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
top: 0;
|
||||
left: 0;
|
||||
gap: 2px;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -9,7 +9,8 @@ export const includes = []
|
||||
// 关系图布局
|
||||
export const GraphLayout = [
|
||||
{ label: '无', value: 'none' },
|
||||
{ label: '环形', value: 'circular' }
|
||||
{ label: '环形', value: 'circular' },
|
||||
{ label: '力引导', value: 'force' }
|
||||
]
|
||||
|
||||
// 标签开关
|
||||
@@ -24,44 +25,57 @@ export const LabelPosition = [
|
||||
{ label: '右侧', value: 'right' },
|
||||
{ label: '顶部', value: 'top' },
|
||||
{ label: '底部', value: 'bottom' },
|
||||
{ label: '内部', value: 'inside' },
|
||||
{ label: '内部', value: 'inside' }
|
||||
]
|
||||
|
||||
// 图-迭代动画
|
||||
export const LayoutAnimation = [
|
||||
{ label: '开启', value: 1 },
|
||||
{ label: '关闭', value: 0 }
|
||||
]
|
||||
|
||||
export const option = {
|
||||
dataset: { ...dataJson },
|
||||
tooltip: {},
|
||||
legend:{
|
||||
show:true,
|
||||
textStyle:{
|
||||
color:"#eee",
|
||||
fontSize: 14 ,
|
||||
},
|
||||
data: dataJson.categories.map(function (a) {
|
||||
return a.name;
|
||||
})
|
||||
dataset: { ...dataJson },
|
||||
tooltip: {},
|
||||
legend: {
|
||||
show: true,
|
||||
textStyle: {
|
||||
color: '#eee',
|
||||
fontSize: 14
|
||||
},
|
||||
series: [
|
||||
{
|
||||
type: 'graph',
|
||||
layout: 'none', // none circular环形布局
|
||||
data: dataJson.nodes,
|
||||
links: dataJson.links,
|
||||
categories: dataJson.categories,
|
||||
label: { // 标签
|
||||
show: 1,
|
||||
position: 'right',
|
||||
formatter: '{b}'
|
||||
},
|
||||
labelLayout: {
|
||||
hideOverlap: true
|
||||
},
|
||||
lineStyle: {
|
||||
color: 'source', // 线条颜色
|
||||
curveness: 0.2 // 线条卷曲程度
|
||||
}
|
||||
data: dataJson.categories.map(function (a) {
|
||||
return a.name
|
||||
})
|
||||
},
|
||||
series: [
|
||||
{
|
||||
type: 'graph',
|
||||
layout: 'none', // none circular环形布局
|
||||
data: dataJson.nodes,
|
||||
links: dataJson.links,
|
||||
categories: dataJson.categories,
|
||||
label: {
|
||||
show: 1,
|
||||
position: 'right',
|
||||
formatter: '{b}'
|
||||
},
|
||||
labelLayout: {
|
||||
hideOverlap: true
|
||||
},
|
||||
lineStyle: {
|
||||
color: 'source', // 线条颜色
|
||||
curveness: 0.2 // 线条卷曲程度
|
||||
},
|
||||
force: {
|
||||
repulsion: 100,
|
||||
gravity: 0.1,
|
||||
edgeLength: 30,
|
||||
layoutAnimation: 1,
|
||||
friction: 0.6
|
||||
}
|
||||
]
|
||||
};
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
export default class Config extends PublicConfigClass implements CreateComponentType {
|
||||
public key = GraphConfig.key
|
||||
|
||||
@@ -16,14 +16,14 @@
|
||||
</SettingItemBox>
|
||||
<SettingItemBox name="线条">
|
||||
<SettingItem name="弧线">
|
||||
<!-- 需要输入两位的小数才会变化 -->
|
||||
<!-- 需要输入两位的小数才会变化 -->
|
||||
<n-input-number
|
||||
v-model:value="optionData.series[0].lineStyle.curveness"
|
||||
:min="0"
|
||||
:step="0.01"
|
||||
placeholder="弯曲程度"
|
||||
size="small"
|
||||
></n-input-number>
|
||||
v-model:value="optionData.series[0].lineStyle.curveness"
|
||||
:min="0"
|
||||
:step="0.01"
|
||||
placeholder="弯曲程度"
|
||||
size="small"
|
||||
></n-input-number>
|
||||
</SettingItem>
|
||||
</SettingItemBox>
|
||||
<SettingItemBox name="图例">
|
||||
@@ -32,10 +32,61 @@
|
||||
size="small"
|
||||
:modes="['hex']"
|
||||
v-model:value="optionData.legend.textStyle.color"
|
||||
></n-color-picker>
|
||||
></n-color-picker>
|
||||
</SettingItem>
|
||||
<SettingItem name="文本">
|
||||
<n-input-number v-model:value="optionData.legend.textStyle.fontSize" :min="0" :step="1" size="small" placeholder="文字大小">
|
||||
<n-input-number
|
||||
v-model:value="optionData.legend.textStyle.fontSize"
|
||||
:min="0"
|
||||
:step="1"
|
||||
size="small"
|
||||
placeholder="文字大小"
|
||||
>
|
||||
</n-input-number>
|
||||
</SettingItem>
|
||||
</SettingItemBox>
|
||||
<SettingItemBox name="力引导" v-if="optionData.series[0].force && graphConfig.layout == 'force'">
|
||||
<SettingItem name="斥力因子" v-if="optionData.series[0].force.repulsion">
|
||||
<n-input-number
|
||||
v-model:value="optionData.series[0].force.repulsion"
|
||||
:min="0"
|
||||
:step="1"
|
||||
size="small"
|
||||
placeholder="斥力因子大小"
|
||||
>
|
||||
</n-input-number>
|
||||
</SettingItem>
|
||||
<SettingItem name="引力因子" v-if="optionData.series[0].force.gravity">
|
||||
<n-input-number
|
||||
v-model:value="optionData.series[0].force.gravity"
|
||||
:min="0"
|
||||
:step="0.1"
|
||||
size="small"
|
||||
placeholder="引力因子"
|
||||
>
|
||||
</n-input-number>
|
||||
</SettingItem>
|
||||
<SettingItem name="节点距离">
|
||||
<n-input-number
|
||||
v-model:value="optionData.series[0].force.edgeLength"
|
||||
:min="0"
|
||||
:step="1"
|
||||
size="small"
|
||||
placeholder="节点距离"
|
||||
>
|
||||
</n-input-number>
|
||||
</SettingItem>
|
||||
<SettingItem name="迭代动画">
|
||||
<n-select v-model:value="graphConfig.force.layoutAnimation" :options="LayoutAnimation" size="small" />
|
||||
</SettingItem>
|
||||
<SettingItem name="节点速度">
|
||||
<n-input-number
|
||||
v-model:value="optionData.series[0].force.friction"
|
||||
:min="0"
|
||||
:step="0.1"
|
||||
size="small"
|
||||
placeholder="节点速度"
|
||||
>
|
||||
</n-input-number>
|
||||
</SettingItem>
|
||||
</SettingItemBox>
|
||||
@@ -46,7 +97,7 @@
|
||||
<script setup lang="ts">
|
||||
import { PropType, computed } from 'vue'
|
||||
import { CollapseItem, SettingItemBox, SettingItem } from '@/components/Pages/ChartItemSetting'
|
||||
import { option, GraphLayout, LabelSwitch, LabelPosition } from './config'
|
||||
import { option, GraphLayout, LabelSwitch, LabelPosition, LayoutAnimation } from './config'
|
||||
import { GlobalThemeJsonType } from '@/settings/chartThemes/index'
|
||||
|
||||
const props = defineProps({
|
||||
@@ -56,7 +107,7 @@ const props = defineProps({
|
||||
}
|
||||
})
|
||||
|
||||
const graphConfig = computed<typeof option.series[0]>(() => {
|
||||
const graphConfig = computed<(typeof option.series)[0]>(() => {
|
||||
return props.optionData.series[0]
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
<template>
|
||||
<v-chart ref="vChartRef" :init-options="initOptions" :theme="themeColor" :option="option" :manual-update="isPreview()" autoresize></v-chart>
|
||||
<v-chart
|
||||
ref="vChartRef"
|
||||
:init-options="initOptions"
|
||||
:theme="themeColor"
|
||||
:option="option"
|
||||
:manual-update="isPreview()"
|
||||
autoresize
|
||||
></v-chart>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
:type="type"
|
||||
:height="h"
|
||||
:processing="processing"
|
||||
:percentage="option.dataset"
|
||||
:percentage="dataset"
|
||||
:indicator-placement="indicatorPlacement"
|
||||
:color="color"
|
||||
:rail-color="railColor"
|
||||
@@ -15,7 +15,7 @@
|
||||
fontSize: `${indicatorTextSize}px`
|
||||
}"
|
||||
>
|
||||
{{ option.dataset }} {{ unit }}
|
||||
{{ dataset }} {{ unit }}
|
||||
</n-text>
|
||||
</n-progress>
|
||||
</template>
|
||||
|
||||
@@ -8,4 +8,14 @@ import { DialConfig } from './Dial/index'
|
||||
import { SankeyConfig } from './Sankey/index'
|
||||
import { GraphConfig } from './Graph/index'
|
||||
|
||||
export default [ProcessConfig, RadarConfig, FunnelConfig, HeatmapConfig, WaterPoloConfig, TreeMapConfig, GraphConfig, SankeyConfig, DialConfig]
|
||||
export default [
|
||||
ProcessConfig,
|
||||
RadarConfig,
|
||||
FunnelConfig,
|
||||
HeatmapConfig,
|
||||
WaterPoloConfig,
|
||||
TreeMapConfig,
|
||||
GraphConfig,
|
||||
SankeyConfig,
|
||||
DialConfig
|
||||
]
|
||||
|
||||
@@ -7,6 +7,22 @@
|
||||
</n-input-number>
|
||||
</SettingItem>
|
||||
</SettingItemBox>
|
||||
<!-- 中心标题 -->
|
||||
<SettingItemBox v-if="config.title" name="标题">
|
||||
<SettingItem name="颜色">
|
||||
<n-color-picker size="small" :modes="['hex']" v-model:value="config.title.textStyle.color"></n-color-picker>
|
||||
</SettingItem>
|
||||
<SettingItem name="字体大小">
|
||||
<n-input-number
|
||||
v-model:value="config.title.textStyle.fontSize"
|
||||
:min="0"
|
||||
:step="1"
|
||||
size="small"
|
||||
placeholder="字体大小"
|
||||
>
|
||||
</n-input-number>
|
||||
</SettingItem>
|
||||
</SettingItemBox>
|
||||
<!-- Echarts 全局设置 -->
|
||||
<SettingItemBox name="进度条">
|
||||
<SettingItem name="颜色">
|
||||
@@ -31,24 +47,8 @@
|
||||
></n-color-picker>
|
||||
</SettingItem>
|
||||
</SettingItemBox>
|
||||
<!-- 中心标题 -->
|
||||
<SettingItemBox v-if="config.title" name="标题">
|
||||
<SettingItem name="颜色">
|
||||
<n-color-picker size="small" :modes="['hex']" v-model:value="config.title.textStyle.color"></n-color-picker>
|
||||
</SettingItem>
|
||||
<SettingItem name="字体大小">
|
||||
<n-input-number
|
||||
v-model:value="config.title.textStyle.fontSize"
|
||||
:min="0"
|
||||
:step="1"
|
||||
size="small"
|
||||
placeholder="字体大小"
|
||||
>
|
||||
</n-input-number>
|
||||
</SettingItem>
|
||||
</SettingItemBox>
|
||||
<!-- 其他样式 -->
|
||||
<SettingItemBox name="轨道样式">
|
||||
<SettingItemBox name="轨道">
|
||||
<SettingItem name="颜色">
|
||||
<n-color-picker size="small" :modes="['hex']" v-model:value="item.data[1].itemStyle.color"></n-color-picker>
|
||||
</SettingItem>
|
||||
@@ -69,6 +69,18 @@
|
||||
v-model:value="item.data[1].itemStyle.shadowColor"
|
||||
></n-color-picker>
|
||||
</SettingItem>
|
||||
<SettingItem name="轨道宽度">
|
||||
<n-select
|
||||
v-model:value="item.radius[0]"
|
||||
size="small"
|
||||
:options="[
|
||||
{ label: '窄', value: '75%' },
|
||||
{ label: '中', value: '60%' },
|
||||
{ label: '宽', value: '45%' },
|
||||
{ label: '更宽', value: '30%' }
|
||||
]"
|
||||
/>
|
||||
</SettingItem>
|
||||
</SettingItemBox>
|
||||
</CollapseItem>
|
||||
</template>
|
||||
|
||||
@@ -41,7 +41,7 @@ const option = reactive({
|
||||
const dataHandle = (newData: any) => {
|
||||
const d = parseFloat(`${newData}`) * 100
|
||||
let config = props.chartConfig.option
|
||||
config.title.text = d.toFixed(2) + '%'
|
||||
config.title.text = `${+d.toFixed(2)}%`
|
||||
config.series[0].data[0].value[0] = d
|
||||
config.series[0].data[1].value[0] = 100 - d
|
||||
option.value = mergeTheme(props.chartConfig.option, props.themeSetting, includes)
|
||||
@@ -68,7 +68,7 @@ watch(
|
||||
useChartDataFetch(props.chartConfig, useChartEditStore, (resData: number) => {
|
||||
let d = parseFloat(`${resData}`) * 100
|
||||
// @ts-ignore
|
||||
option.value.title.text = d.toFixed(2) + '%'
|
||||
option.value.title.text = `${+d.toFixed(2)}%`
|
||||
// @ts-ignore
|
||||
option.value.series[0].data[0].value[0] = d
|
||||
// @ts-ignore
|
||||
|
||||
@@ -18,7 +18,14 @@ export const PieTypeObject = {
|
||||
[PieTypeEnum.ROSE]: 'rose'
|
||||
}
|
||||
|
||||
// 其它配置
|
||||
const otherConfig = {
|
||||
// 轮播动画
|
||||
isCarousel: false,
|
||||
}
|
||||
|
||||
const option = {
|
||||
...otherConfig,
|
||||
type: 'ring',
|
||||
tooltip: {
|
||||
show: true,
|
||||
|
||||
@@ -1,88 +1,99 @@
|
||||
<template>
|
||||
<!-- Echarts 全局设置 -->
|
||||
<global-setting :optionData="optionData"></global-setting>
|
||||
<CollapseItem name="饼图配置" :expanded="true">
|
||||
<SettingItemBox name="类型">
|
||||
<SettingItem>
|
||||
<n-select v-model:value="optionData.type" size="small" :options="fontWeightOptions" />
|
||||
</SettingItem>
|
||||
</SettingItemBox>
|
||||
<SettingItemBox name="标签">
|
||||
<SettingItem>
|
||||
<n-space>
|
||||
<n-switch v-model:value="optionData.series[0].label.show" size="small"></n-switch>
|
||||
<n-text>展示标签</n-text>
|
||||
</n-space>
|
||||
</SettingItem>
|
||||
<setting-item>
|
||||
<n-space>
|
||||
<n-switch v-model:value="optionData.series[0].labelLine.show" size="small"></n-switch>
|
||||
<n-text>引导线</n-text>
|
||||
</n-space>
|
||||
</setting-item>
|
||||
<SettingItem name="位置">
|
||||
<n-select v-model:value="optionData.series[0].label.position" size="small" :options="labelConfig.position" />
|
||||
</SettingItem>
|
||||
<setting-item name="展示类型">
|
||||
<n-select v-model:value="optionData.series[0].label.formatter" size="small" :options="labelFormatterOptions" />
|
||||
</setting-item>
|
||||
</SettingItemBox>
|
||||
<setting-item-box name="圆角">
|
||||
<setting-item>
|
||||
<n-space>
|
||||
<n-input-number
|
||||
v-model:value="optionData.series[0].itemStyle.borderRadius"
|
||||
size="small"
|
||||
:min="0"
|
||||
></n-input-number>
|
||||
<n-text>圆角大小</n-text>
|
||||
</n-space>
|
||||
</setting-item>
|
||||
<setting-item>
|
||||
<n-space>
|
||||
<n-input-number
|
||||
v-model:value="optionData.series[0].itemStyle.borderWidth"
|
||||
size="small"
|
||||
:min="0"
|
||||
></n-input-number>
|
||||
<n-text>线条宽度</n-text>
|
||||
</n-space>
|
||||
</setting-item>
|
||||
</setting-item-box>
|
||||
</CollapseItem>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { PropType, watch } from 'vue'
|
||||
import { GlobalThemeJsonType } from '@/settings/chartThemes/index'
|
||||
import { GlobalSetting, CollapseItem, SettingItemBox, SettingItem } from '@/components/Pages/ChartItemSetting'
|
||||
import { PieTypeObject, PieTypeEnum } from './config'
|
||||
import { labelConfig } from '@/packages/chartConfiguration/echarts'
|
||||
|
||||
const props = defineProps({
|
||||
optionData: {
|
||||
type: Object as PropType<GlobalThemeJsonType>,
|
||||
required: true
|
||||
}
|
||||
})
|
||||
const fontWeightOptions = [
|
||||
{
|
||||
label: PieTypeEnum.NORMAL,
|
||||
value: PieTypeObject[PieTypeEnum.NORMAL]
|
||||
},
|
||||
{
|
||||
label: PieTypeEnum.RING,
|
||||
value: PieTypeObject[PieTypeEnum.RING]
|
||||
},
|
||||
{
|
||||
label: PieTypeEnum.ROSE,
|
||||
value: PieTypeObject[PieTypeEnum.ROSE]
|
||||
}
|
||||
]
|
||||
|
||||
const labelFormatterOptions = [
|
||||
{ label: '数据名', value: '{b}' },
|
||||
{ label: '百分比', value: '{d}' },
|
||||
{ label: '列名:百分比', value: '{b}:{d}%' }
|
||||
]
|
||||
</script>
|
||||
<template>
|
||||
<!-- Echarts 全局设置 -->
|
||||
<global-setting :optionData="optionData"></global-setting>
|
||||
<CollapseItem name="饼图配置" :expanded="true">
|
||||
<SettingItemBox name="类型">
|
||||
<SettingItem>
|
||||
<n-select v-model:value="optionData.type" size="small" :options="fontWeightOptions" />
|
||||
</SettingItem>
|
||||
</SettingItemBox>
|
||||
<SettingItemBox name="动画" :alone="true">
|
||||
<SettingItem>
|
||||
<n-space>
|
||||
<n-switch v-model:value="optionData.isCarousel" size="small"></n-switch>
|
||||
<n-text>开启<n-text :depth="3">(将自动隐藏图例)</n-text></n-text>
|
||||
</n-space>
|
||||
</SettingItem>
|
||||
<SettingItem>
|
||||
<n-text :depth="3">无鼠标点击图例场景时,可强行打开图例</n-text>
|
||||
</SettingItem>
|
||||
</SettingItemBox>
|
||||
<SettingItemBox name="标签">
|
||||
<SettingItem>
|
||||
<n-space>
|
||||
<n-switch v-model:value="optionData.series[0].label.show" size="small"></n-switch>
|
||||
<n-text>展示标签</n-text>
|
||||
</n-space>
|
||||
</SettingItem>
|
||||
<setting-item>
|
||||
<n-space>
|
||||
<n-switch v-model:value="optionData.series[0].labelLine.show" size="small"></n-switch>
|
||||
<n-text>引导线</n-text>
|
||||
</n-space>
|
||||
</setting-item>
|
||||
<SettingItem name="位置">
|
||||
<n-select v-model:value="optionData.series[0].label.position" size="small" :options="labelConfig.position" />
|
||||
</SettingItem>
|
||||
<setting-item name="展示类型">
|
||||
<n-select v-model:value="optionData.series[0].label.formatter" size="small" :options="labelFormatterOptions" />
|
||||
</setting-item>
|
||||
</SettingItemBox>
|
||||
<setting-item-box name="圆角">
|
||||
<setting-item>
|
||||
<n-space>
|
||||
<n-input-number
|
||||
v-model:value="optionData.series[0].itemStyle.borderRadius"
|
||||
size="small"
|
||||
:min="0"
|
||||
></n-input-number>
|
||||
<n-text>圆角大小</n-text>
|
||||
</n-space>
|
||||
</setting-item>
|
||||
<setting-item>
|
||||
<n-space>
|
||||
<n-input-number
|
||||
v-model:value="optionData.series[0].itemStyle.borderWidth"
|
||||
size="small"
|
||||
:min="0"
|
||||
></n-input-number>
|
||||
<n-text>线条宽度</n-text>
|
||||
</n-space>
|
||||
</setting-item>
|
||||
</setting-item-box>
|
||||
</CollapseItem>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { PropType, watch } from 'vue'
|
||||
import { GlobalThemeJsonType } from '@/settings/chartThemes/index'
|
||||
import { GlobalSetting, CollapseItem, SettingItemBox, SettingItem } from '@/components/Pages/ChartItemSetting'
|
||||
import { PieTypeObject, PieTypeEnum } from './config'
|
||||
import { labelConfig } from '@/packages/chartConfiguration/echarts'
|
||||
|
||||
const props = defineProps({
|
||||
optionData: {
|
||||
type: Object as PropType<GlobalThemeJsonType>,
|
||||
required: true
|
||||
}
|
||||
})
|
||||
const fontWeightOptions = [
|
||||
{
|
||||
label: PieTypeEnum.NORMAL,
|
||||
value: PieTypeObject[PieTypeEnum.NORMAL]
|
||||
},
|
||||
{
|
||||
label: PieTypeEnum.RING,
|
||||
value: PieTypeObject[PieTypeEnum.RING]
|
||||
},
|
||||
{
|
||||
label: PieTypeEnum.ROSE,
|
||||
value: PieTypeObject[PieTypeEnum.ROSE]
|
||||
}
|
||||
]
|
||||
|
||||
const labelFormatterOptions = [
|
||||
{ label: '数据名', value: '{b}' },
|
||||
{ label: '百分比', value: '{d}' },
|
||||
{ label: '列名:百分比', value: '{b}:{d}%' }
|
||||
]
|
||||
</script>
|
||||
|
||||
@@ -1,64 +1,146 @@
|
||||
<template>
|
||||
<v-chart ref="vChartRef" :init-options="initOptions" :theme="themeColor" :option="option" :manual-update="isPreview()" autoresize></v-chart>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, PropType, reactive, watch } from 'vue'
|
||||
import VChart from 'vue-echarts'
|
||||
import { useCanvasInitOptions } from '@/hooks/useCanvasInitOptions.hook'
|
||||
import { use } from 'echarts/core'
|
||||
import { CanvasRenderer } from 'echarts/renderers'
|
||||
import { PieChart } from 'echarts/charts'
|
||||
import { mergeTheme } from '@/packages/public/chart'
|
||||
import config, { includes } from './config'
|
||||
import { useChartDataFetch } from '@/hooks'
|
||||
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
|
||||
import { isPreview } from '@/utils'
|
||||
import { DatasetComponent, GridComponent, TooltipComponent, LegendComponent } from 'echarts/components'
|
||||
|
||||
const props = defineProps({
|
||||
themeSetting: {
|
||||
type: Object,
|
||||
required: true
|
||||
},
|
||||
themeColor: {
|
||||
type: Object,
|
||||
required: true
|
||||
},
|
||||
chartConfig: {
|
||||
type: Object as PropType<config>,
|
||||
required: true
|
||||
}
|
||||
})
|
||||
|
||||
const initOptions = useCanvasInitOptions(props.chartConfig.option, props.themeSetting)
|
||||
|
||||
use([DatasetComponent, CanvasRenderer, PieChart, GridComponent, TooltipComponent, LegendComponent])
|
||||
|
||||
const option = computed(() => {
|
||||
return mergeTheme(props.chartConfig.option, props.themeSetting, includes)
|
||||
})
|
||||
|
||||
watch(
|
||||
() => props.chartConfig.option.type,
|
||||
newData => {
|
||||
try {
|
||||
if (newData === 'nomal') {
|
||||
props.chartConfig.option.series[0].radius = '70%'
|
||||
props.chartConfig.option.series[0].roseType = false
|
||||
} else if (newData === 'ring') {
|
||||
props.chartConfig.option.series[0].radius = ['40%', '65%']
|
||||
props.chartConfig.option.series[0].roseType = false
|
||||
} else {
|
||||
props.chartConfig.option.series[0].radius = '70%'
|
||||
props.chartConfig.option.series[0].roseType = true
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
},
|
||||
{ deep: false, immediate: true }
|
||||
)
|
||||
|
||||
const { vChartRef } = useChartDataFetch(props.chartConfig, useChartEditStore)
|
||||
</script>
|
||||
<template>
|
||||
<v-chart
|
||||
ref="vChartRef"
|
||||
autoresize
|
||||
:init-options="initOptions"
|
||||
:theme="themeColor"
|
||||
:option="option"
|
||||
:manual-update="isPreview()"
|
||||
@mouseover="handleHighlight"
|
||||
@mouseout="handleDownplay"
|
||||
></v-chart>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, PropType, onMounted, watch } from 'vue'
|
||||
import VChart from 'vue-echarts'
|
||||
import { useCanvasInitOptions } from '@/hooks/useCanvasInitOptions.hook'
|
||||
import { use } from 'echarts/core'
|
||||
import { CanvasRenderer } from 'echarts/renderers'
|
||||
import { PieChart } from 'echarts/charts'
|
||||
import { mergeTheme } from '@/packages/public/chart'
|
||||
import config, { includes } from './config'
|
||||
import { useChartDataFetch } from '@/hooks'
|
||||
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
|
||||
import { isPreview } from '@/utils'
|
||||
import { DatasetComponent, GridComponent, TooltipComponent, LegendComponent } from 'echarts/components'
|
||||
import dataJson from './data.json'
|
||||
|
||||
const props = defineProps({
|
||||
themeSetting: {
|
||||
type: Object,
|
||||
required: true
|
||||
},
|
||||
themeColor: {
|
||||
type: Object,
|
||||
required: true
|
||||
},
|
||||
chartConfig: {
|
||||
type: Object as PropType<config>,
|
||||
required: true
|
||||
}
|
||||
})
|
||||
const initOptions = useCanvasInitOptions(props.chartConfig.option, props.themeSetting)
|
||||
let seriesDataNum = -1
|
||||
let seriesDataMaxLength = 0
|
||||
let intervalInstance: any = null
|
||||
|
||||
use([DatasetComponent, CanvasRenderer, PieChart, GridComponent, TooltipComponent, LegendComponent])
|
||||
|
||||
const option = computed(() => {
|
||||
return mergeTheme(props.chartConfig.option, props.themeSetting, includes)
|
||||
})
|
||||
|
||||
// 会重新选择需要选中和展示的数据
|
||||
const handleSeriesData = () => {
|
||||
if (seriesDataNum > -1) {
|
||||
vChartRef.value?.dispatchAction({
|
||||
type: 'downplay',
|
||||
dataIndex: seriesDataNum
|
||||
})
|
||||
}
|
||||
seriesDataNum = seriesDataNum >= seriesDataMaxLength - 1 ? 0 : seriesDataNum + 1
|
||||
vChartRef.value?.dispatchAction({
|
||||
type: 'highlight',
|
||||
dataIndex: seriesDataNum
|
||||
})
|
||||
}
|
||||
|
||||
// 新增轮播
|
||||
const addPieInterval = (newData?: typeof dataJson, skipPre = false) => {
|
||||
if (!skipPre && !Array.isArray(newData?.source)) return
|
||||
if (!skipPre) seriesDataMaxLength = newData?.source.length || 0
|
||||
clearInterval(intervalInstance)
|
||||
intervalInstance = setInterval(() => {
|
||||
handleSeriesData()
|
||||
}, 1000)
|
||||
}
|
||||
|
||||
// 取消轮播
|
||||
const clearPieInterval = () => {
|
||||
vChartRef.value?.dispatchAction({
|
||||
type: 'downplay',
|
||||
dataIndex: seriesDataNum
|
||||
})
|
||||
clearInterval(intervalInstance)
|
||||
intervalInstance = null
|
||||
}
|
||||
|
||||
// 处理鼠标聚焦高亮内容
|
||||
const handleHighlight = () => {
|
||||
clearPieInterval()
|
||||
}
|
||||
|
||||
// 处理鼠标取消悬浮
|
||||
const handleDownplay = () => {
|
||||
if (props.chartConfig.option.isCarousel && !intervalInstance) {
|
||||
// 恢复轮播
|
||||
addPieInterval(undefined, true)
|
||||
}
|
||||
}
|
||||
|
||||
watch(
|
||||
() => props.chartConfig.option.type,
|
||||
newData => {
|
||||
try {
|
||||
if (newData === 'nomal') {
|
||||
props.chartConfig.option.series[0].radius = '70%'
|
||||
props.chartConfig.option.series[0].roseType = false
|
||||
} else if (newData === 'ring') {
|
||||
props.chartConfig.option.series[0].radius = ['40%', '65%']
|
||||
props.chartConfig.option.series[0].roseType = false
|
||||
} else {
|
||||
props.chartConfig.option.series[0].radius = '70%'
|
||||
props.chartConfig.option.series[0].roseType = true
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
},
|
||||
{ deep: false, immediate: true }
|
||||
)
|
||||
|
||||
watch(
|
||||
() => props.chartConfig.option.isCarousel,
|
||||
newData => {
|
||||
if (newData) {
|
||||
addPieInterval(undefined, true)
|
||||
props.chartConfig.option.legend.show = false
|
||||
} else {
|
||||
props.chartConfig.option.legend.show = true
|
||||
clearPieInterval()
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
const { vChartRef } = useChartDataFetch(props.chartConfig, useChartEditStore, (newData: typeof dataJson) => {
|
||||
addPieInterval(newData)
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
seriesDataMaxLength = dataJson.source.length
|
||||
if (props.chartConfig.option.isCarousel) {
|
||||
addPieInterval(undefined, true)
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
1
src/packages/components/Charts/index.d.ts
vendored
@@ -14,5 +14,6 @@ export enum ChatCategoryEnumName {
|
||||
LINE = '折线图',
|
||||
SCATTER = '散点图',
|
||||
MAP = '地图',
|
||||
COMBINATION = '组合图',
|
||||
MORE = '更多'
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ export interface OptionType {
|
||||
flipperGap: number
|
||||
flipperType: FlipType
|
||||
flipperSpeed: number
|
||||
flipperBorderWidth: number
|
||||
}
|
||||
|
||||
export const option: OptionType = {
|
||||
@@ -28,7 +29,8 @@ export const option: OptionType = {
|
||||
flipperRadius: 5,
|
||||
flipperGap: 10,
|
||||
flipperType: 'down',
|
||||
flipperSpeed: 450
|
||||
flipperSpeed: 450,
|
||||
flipperBorderWidth: 0,
|
||||
}
|
||||
|
||||
export default class Config extends PublicConfigClass implements CreateComponentType {
|
||||
|
||||
@@ -16,12 +16,16 @@
|
||||
<setting-item name="高度">
|
||||
<n-input-number v-model:value="optionData.flipperHeight" size="small" :min="1"></n-input-number>
|
||||
</setting-item>
|
||||
<setting-item name="间隔">
|
||||
<n-input-number v-model:value="optionData.flipperGap" size="small" :min="0"></n-input-number>
|
||||
<setting-item name="边框">
|
||||
<n-input-number v-model:value="optionData.flipperBorderWidth" size="small" :min="0" :max="10"></n-input-number>
|
||||
</setting-item>
|
||||
<setting-item name="圆角">
|
||||
<n-input-number v-model:value="optionData.flipperRadius" size="small" :min="0"></n-input-number>
|
||||
</setting-item>
|
||||
<setting-item name="翻牌间隔">
|
||||
<n-input-number v-model:value="optionData.flipperGap" size="small" :min="0"></n-input-number>
|
||||
</setting-item>
|
||||
<setting-item />
|
||||
<setting-item name="背景色">
|
||||
<n-color-picker
|
||||
size="small"
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
:radius="flipperRadius"
|
||||
:flip-type="flipperType"
|
||||
:duration="flipperSpeed"
|
||||
:border-width="flipperBorderWidth"
|
||||
v-for="(item, index) in flipperData"
|
||||
:key="index"
|
||||
class="go-d-block"
|
||||
@@ -42,7 +43,8 @@ const {
|
||||
flipperRadius,
|
||||
flipperGap,
|
||||
flipperType,
|
||||
flipperSpeed
|
||||
flipperSpeed,
|
||||
flipperBorderWidth
|
||||
} = toRefs(props.chartConfig.option as OptionType)
|
||||
|
||||
const flipperData = ref<string[] | number[]>([])
|
||||
@@ -61,7 +63,7 @@ watch(
|
||||
() => props.chartConfig.option,
|
||||
newVal => {
|
||||
try {
|
||||
updateDatasetHandler((newVal as OptionType).dataset)
|
||||
updateDatasetHandler((newVal as any as OptionType).dataset)
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
|
||||
18
src/packages/components/Decorates/Mores/FullScreen/config.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { PublicConfigClass } from '@/packages/public'
|
||||
import { CreateComponentType } from '@/packages/index.d'
|
||||
import { chartInitConfig } from '@/settings/designSetting'
|
||||
import { FullScreenConfig } from './index'
|
||||
import cloneDeep from 'lodash/cloneDeep'
|
||||
|
||||
export const option = {
|
||||
border: 6,
|
||||
bgColor: '#84a5e9',
|
||||
borderColor: '#84a5e9'
|
||||
}
|
||||
|
||||
export default class Config extends PublicConfigClass implements CreateComponentType {
|
||||
public key = FullScreenConfig.key
|
||||
public attr = { ...chartInitConfig, w: 150, h: 150, zIndex: -1 }
|
||||
public chartConfig = cloneDeep(FullScreenConfig)
|
||||
public option = cloneDeep(option)
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<template>
|
||||
<CollapseItem name="全屏按钮" expanded>
|
||||
<SettingItemBox name="按钮">
|
||||
<SettingItem name="背景色">
|
||||
<n-color-picker size="small" :modes="['hex']" v-model:value="optionData.bgColor"></n-color-picker>
|
||||
</SettingItem>
|
||||
<SettingItem name="边框色">
|
||||
<n-color-picker size="small" :modes="['hex']" v-model:value="optionData.borderColor"></n-color-picker>
|
||||
</SettingItem>
|
||||
<SettingItem name="边框大小">
|
||||
<n-input-number v-model:value="optionData.border" size="small" :step="0.5" :min="0"></n-input-number>
|
||||
</SettingItem>
|
||||
</SettingItemBox>
|
||||
</CollapseItem>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { PropType } from 'vue'
|
||||
import { CollapseItem, SettingItemBox, SettingItem } from '@/components/Pages/ChartItemSetting'
|
||||
import { option } from './config'
|
||||
|
||||
const props = defineProps({
|
||||
optionData: {
|
||||
type: Object as PropType<typeof option>,
|
||||
required: true
|
||||
}
|
||||
})
|
||||
</script>
|
||||
14
src/packages/components/Decorates/Mores/FullScreen/index.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d'
|
||||
import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d'
|
||||
|
||||
export const FullScreenConfig: ConfigType = {
|
||||
key: 'FullScreen',
|
||||
chartKey: 'VFullScreen',
|
||||
conKey: 'VCFullScreen',
|
||||
title: '全屏按钮',
|
||||
category: ChatCategoryEnum.MORE,
|
||||
categoryName: ChatCategoryEnumName.MORE,
|
||||
package: PackagesCategoryEnum.DECORATES,
|
||||
chartFrame: ChartFrameEnum.STATIC,
|
||||
image: 'fullScreen.png'
|
||||
}
|
||||
111
src/packages/components/Decorates/Mores/FullScreen/index.vue
Normal file
@@ -0,0 +1,111 @@
|
||||
<template>
|
||||
<svg @click="toggleFullscreen" v-if="!isFullscreen" viewBox="0 0 1024 1024">
|
||||
<path
|
||||
d="M665.6 1017.6c-19.2 0-38.4-19.2-38.4-38.4s19.2-38.4 38.4-38.4h268.8l6.4-268.8c0-19.2 19.2-38.4 38.4-38.4s38.4 19.2 38.4 38.4v294.4c0 32-25.6 51.2-51.2 51.2h-300.8zM51.2 396.8c-19.2 0-38.4-19.2-38.4-38.4V64C12.8 32 38.4 12.8 64 12.8h294.4c19.2 0 38.4 19.2 38.4 38.4s-19.2 38.4-38.4 38.4H89.6v268.8c0 19.2-19.2 38.4-38.4 38.4zM64 1017.6c-32 0-51.2-25.6-51.2-51.2v-294.4c0-19.2 19.2-38.4 38.4-38.4s38.4 19.2 38.4 38.4v217.6l198.4-198.4c6.4-6.4 19.2-12.8 25.6-12.8s19.2 6.4 25.6 12.8c6.4 6.4 12.8 19.2 12.8 25.6 0 12.8-6.4 19.2-12.8 25.6l-198.4 198.4h217.6c19.2 0 38.4 19.2 38.4 38.4s-19.2 38.4-38.4 38.4H64z m915.2-620.8c-19.2 0-38.4-19.2-38.4-38.4V140.8l-198.4 198.4c-6.4 6.4-19.2 12.8-25.6 12.8-12.8 0-19.2-6.4-25.6-12.8-12.8-12.8-12.8-38.4 0-51.2l198.4-198.4h-217.6c-19.2 0-38.4-19.2-38.4-38.4s19.2-38.4 38.4-38.4h294.4c32 0 51.2 25.6 51.2 51.2v294.4c0 19.2-19.2 38.4-38.4 38.4z"
|
||||
class="fullScreen-border"
|
||||
></path>
|
||||
</svg>
|
||||
<svg @click="toggleFullscreen" v-else viewBox="0 0 1024 1024">
|
||||
<path
|
||||
d="M379.336 697.237L153.362 921.55c-14.11 14.007-36.905 13.922-50.912-0.188-14.007-14.11-13.922-36.905 0.188-50.912l227.6-225.927H138.645c-18.99 0-34.385-15.446-34.385-34.5 0-19.053 15.395-34.5 34.385-34.5H413.72c18.99 0 34.384 15.447 34.384 34.5v276c0 9.15-3.622 17.926-10.07 24.396a34.326 34.326 0 0 1-24.314 10.104 34.326 34.326 0 0 1-24.314-10.104 34.559 34.559 0 0 1-10.071-24.396V697.237z m263.395-366.88l227.813-227.813c14.059-14.059 36.853-14.059 50.912 0 14.059 14.059 14.059 36.853 0 50.912l-225.18 225.18h187.147c18.99 0 34.385 15.445 34.385 34.5 0 19.053-15.395 34.5-34.385 34.5H608.346c-18.99 0-34.384-15.447-34.384-34.5v-276c0-9.15 3.622-17.926 10.07-24.396a34.326 34.326 0 0 1 24.314-10.105c9.12 0 17.865 3.635 24.314 10.105a34.559 34.559 0 0 1 10.07 24.395v193.223zM99.385 410a34.326 34.326 0 0 1-24.314-10.105A34.559 34.559 0 0 1 65 375.5v-276C65 80.446 80.395 65 99.385 65h275.077c18.99 0 34.384 15.446 34.384 34.5 0 19.054-15.394 34.5-34.384 34.5H133.769v241.5c0 9.15-3.622 17.925-10.07 24.395A34.326 34.326 0 0 1 99.384 410z m825.23 552H649.538c-18.99 0-34.384-15.446-34.384-34.5 0-19.054 15.394-34.5 34.384-34.5h240.693V651.5c0-19.054 15.394-34.5 34.384-34.5 18.99 0 34.385 15.446 34.385 34.5v276c0 19.054-15.395 34.5-34.385 34.5z"
|
||||
class="fullScreen-border"
|
||||
></path>
|
||||
</svg>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { PropType, toRefs, ref, onMounted, onUnmounted } from 'vue'
|
||||
import { CreateComponentType } from '@/packages/index.d'
|
||||
import { option } from './config'
|
||||
|
||||
const props = defineProps({
|
||||
chartConfig: {
|
||||
type: Object as PropType<CreateComponentType & typeof option>,
|
||||
required: true
|
||||
}
|
||||
})
|
||||
|
||||
let { border, bgColor, borderColor } = toRefs(props.chartConfig.option)
|
||||
const isFullscreen = ref(false)
|
||||
const checkFullscreen = () => {
|
||||
isFullscreen.value = !!(
|
||||
document.fullscreenElement ||
|
||||
(document as any).webkitFullscreenElement ||
|
||||
(document as any).mozFullScreenElement ||
|
||||
(document as any).msFullscreenElement
|
||||
)
|
||||
}
|
||||
checkFullscreen()
|
||||
|
||||
const requestFullscreen = (element: Element) => {
|
||||
if (element.requestFullscreen) {
|
||||
element.requestFullscreen()
|
||||
} else if ((document as any).mozRequestFullScreen) {
|
||||
/* Firefox */
|
||||
(document as any).mozRequestFullScreen()
|
||||
} else if ((document as any).webkitRequestFullscreen) {
|
||||
/* Chrome, Safari and Opera */
|
||||
(document as any).webkitRequestFullscreen()
|
||||
} else if ((document as any).msRequestFullscreen) {
|
||||
/* IE/Edge */
|
||||
(document as any).msRequestFullscreen()
|
||||
}
|
||||
}
|
||||
|
||||
const exitFullscreen = () => {
|
||||
if (document.fullscreenElement && document.exitFullscreen) {
|
||||
document.exitFullscreen()
|
||||
} else if ((document as any).mozFullScreenElement && (document as any).mozCancelFullScreen) {
|
||||
/* Firefox */
|
||||
(document as any).mozCancelFullScreen()
|
||||
} else if ((document as any).webkitFullscreenElement && (document as any).webkitExitFullscreen) {
|
||||
/* Chrome, Safari and Opera */
|
||||
(document as any).webkitExitFullscreen()
|
||||
} else if ((document as any).msFullscreenElement && (document as any).msExitFullscreen) {
|
||||
/* IE/Edge */
|
||||
(document as any).msExitFullscreen()
|
||||
}
|
||||
}
|
||||
|
||||
const toggleFullscreen = () => {
|
||||
if (!isFullscreen.value) {
|
||||
requestFullscreen(document.documentElement)
|
||||
} else {
|
||||
exitFullscreen()
|
||||
}
|
||||
isFullscreen.value = !isFullscreen.value
|
||||
// 由于全屏状态的改变不会立即生效,所以需要延迟一段时间再去获取全屏状态
|
||||
setTimeout(() => {
|
||||
checkFullscreen()
|
||||
}, 1000)
|
||||
}
|
||||
|
||||
// 监听全屏状态的改变,保证多个全屏组件的状态一致
|
||||
onMounted(() => {
|
||||
document.addEventListener('fullscreenchange', checkFullscreen)
|
||||
document.addEventListener('webkitfullscreenchange', checkFullscreen)
|
||||
document.addEventListener('mozfullscreenchange', checkFullscreen)
|
||||
document.addEventListener('MSFullscreenChange', checkFullscreen)
|
||||
})
|
||||
|
||||
onUnmounted(() => {
|
||||
document.removeEventListener('fullscreenchange', checkFullscreen)
|
||||
document.removeEventListener('webkitfullscreenchange', checkFullscreen)
|
||||
document.removeEventListener('mozfullscreenchange', checkFullscreen)
|
||||
document.removeEventListener('MSFullscreenChange', checkFullscreen)
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
svg {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
cursor: pointer;
|
||||
}
|
||||
.fullScreen-border {
|
||||
stroke: v-bind('borderColor');
|
||||
stroke-width: v-bind('border+"px"');
|
||||
fill: v-bind('bgColor');
|
||||
}
|
||||
</style>
|
||||
19
src/packages/components/Decorates/Mores/PipelineH/config.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import { PublicConfigClass } from '@/packages/public'
|
||||
import { CreateComponentType } from '@/packages/index.d'
|
||||
import { chartInitConfig } from '@/settings/designSetting'
|
||||
import { PipelineHConfig } from './index'
|
||||
import cloneDeep from 'lodash/cloneDeep'
|
||||
|
||||
export const option = {
|
||||
color_type: 1,
|
||||
o_color: '#0a7ae2',
|
||||
i_color: '#119bfa',
|
||||
line_class: 'svg_ani_flow'
|
||||
}
|
||||
|
||||
export default class Config extends PublicConfigClass implements CreateComponentType {
|
||||
public key = PipelineHConfig.key
|
||||
public attr = { ...chartInitConfig, w: 500, h: 15, zIndex: -1 }
|
||||
public chartConfig = cloneDeep(PipelineHConfig)
|
||||
public option = cloneDeep(option)
|
||||
}
|
||||
77
src/packages/components/Decorates/Mores/PipelineH/config.vue
Normal file
@@ -0,0 +1,77 @@
|
||||
<template>
|
||||
<CollapseItem name="管道" :expanded="true">
|
||||
<SettingItemBox name="默认颜色">
|
||||
<SettingItem>
|
||||
<n-select v-model:value="optionData.color_type" :options="colorOptions" @update:value="handleColorChange" />
|
||||
</SettingItem>
|
||||
</SettingItemBox>
|
||||
<SettingItemBox name="管道颜色">
|
||||
<SettingItem>
|
||||
<n-color-picker size="small" :modes="['hex']" v-model:value="optionData.o_color"></n-color-picker>
|
||||
</SettingItem>
|
||||
</SettingItemBox>
|
||||
<SettingItemBox name="水流颜色">
|
||||
<SettingItem>
|
||||
<n-color-picker size="small" :modes="['hex']" v-model:value="optionData.i_color"></n-color-picker>
|
||||
</SettingItem>
|
||||
</SettingItemBox>
|
||||
<SettingItemBox name="流向">
|
||||
<SettingItem>
|
||||
<n-select v-model:value="optionData.line_class" :options="options" />
|
||||
</SettingItem>
|
||||
</SettingItemBox>
|
||||
</CollapseItem>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { PropType, ref } from 'vue'
|
||||
import { CollapseItem, SettingItemBox, SettingItem } from '@/components/Pages/ChartItemSetting'
|
||||
import { option } from './config'
|
||||
|
||||
const props = defineProps({
|
||||
optionData: {
|
||||
type: Object as PropType<typeof option>,
|
||||
required: true
|
||||
}
|
||||
})
|
||||
|
||||
const options = ref([
|
||||
{
|
||||
value: 'svg_ani_flow',
|
||||
label: '正向'
|
||||
},
|
||||
{
|
||||
value: 'svg_ani_flow_back',
|
||||
label: '反向'
|
||||
},
|
||||
{
|
||||
value: 'svg_ani_flow_stop',
|
||||
label: '停止'
|
||||
}
|
||||
])
|
||||
|
||||
const colorOptions = ref([
|
||||
{
|
||||
value: 1,
|
||||
label: '蓝'
|
||||
},
|
||||
{
|
||||
value: 2,
|
||||
label: '黄'
|
||||
}
|
||||
])
|
||||
|
||||
// 默认颜色
|
||||
const handleColorChange = (e: number) => {
|
||||
switch (e) {
|
||||
case 1:
|
||||
props.optionData.o_color = '#0a7ae2'
|
||||
props.optionData.i_color = '#119bfa'
|
||||
break
|
||||
case 2:
|
||||
props.optionData.o_color = '#ff9d00'
|
||||
props.optionData.i_color = '#f7ea37'
|
||||
break
|
||||
}
|
||||
}
|
||||
</script>
|
||||
13
src/packages/components/Decorates/Mores/PipelineH/index.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import { ConfigType, PackagesCategoryEnum } from '@/packages/index.d'
|
||||
import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d'
|
||||
|
||||
export const PipelineHConfig: ConfigType = {
|
||||
key: 'PipelineH',
|
||||
chartKey: 'VPipelineH',
|
||||
conKey: 'VCPipelineH',
|
||||
title: '管道-横向',
|
||||
category: ChatCategoryEnum.MORE,
|
||||
categoryName: ChatCategoryEnumName.MORE,
|
||||
package: PackagesCategoryEnum.DECORATES,
|
||||
image: 'Pipeline_H.png'
|
||||
}
|
||||
141
src/packages/components/Decorates/Mores/PipelineH/index.vue
Normal file
@@ -0,0 +1,141 @@
|
||||
<template>
|
||||
<div class="go-decorates-line">
|
||||
<svg :width="w" :height="h">
|
||||
<line :x1="0" :y1="h / 2" :x2="w" :y2="h / 2" :stroke="o_color" :stroke-width="h"></line>
|
||||
<line :x1="0" :y1="h / 2" :x2="w" :y2="h / 2" :stroke="i_color" :stroke-width="h / 2" :class="line_class"></line>
|
||||
</svg>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { PropType, toRefs } from 'vue'
|
||||
import { CreateComponentType } from '@/packages/index.d'
|
||||
|
||||
const props = defineProps({
|
||||
chartConfig: {
|
||||
type: Object as PropType<CreateComponentType>,
|
||||
required: true
|
||||
}
|
||||
})
|
||||
|
||||
const { w, h } = toRefs(props.chartConfig.attr)
|
||||
const { o_color, i_color, line_class } = toRefs(props.chartConfig.option)
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.go-decorates-line {
|
||||
font-size: 0;
|
||||
}
|
||||
|
||||
/* 正向流动效果 */
|
||||
.svg_ani_flow {
|
||||
stroke-dasharray: 1000;
|
||||
stroke-dashoffset: 1000;
|
||||
animation: ani_flow 10s linear infinite;
|
||||
animation-fill-mode: forwards;
|
||||
-webkit-animation: ani_flow 10s linear infinite;
|
||||
-webkit-animation-fill-mode: forwards;
|
||||
}
|
||||
|
||||
@keyframes ani_flow {
|
||||
from {
|
||||
stroke-dasharray: 10, 5;
|
||||
}
|
||||
|
||||
to {
|
||||
stroke-dasharray: 13, 5;
|
||||
}
|
||||
}
|
||||
@-webkit-keyframes ani_flow {
|
||||
from {
|
||||
stroke-dasharray: 10, 5;
|
||||
}
|
||||
|
||||
to {
|
||||
stroke-dasharray: 13, 5;
|
||||
}
|
||||
}
|
||||
|
||||
/* 停止流动效果 */
|
||||
.svg_ani_flow_stop {
|
||||
stroke-dasharray: 1000;
|
||||
stroke-dashoffset: 1000;
|
||||
animation: ani_flow_stop 10s linear infinite;
|
||||
animation-fill-mode: forwards;
|
||||
-webkit-animation: ani_flow_stop 10s linear infinite;
|
||||
-webkit-animation-fill-mode: forwards;
|
||||
}
|
||||
|
||||
@keyframes ani_flow_stop {
|
||||
from {
|
||||
stroke-dasharray: 10, 5;
|
||||
}
|
||||
|
||||
to {
|
||||
stroke-dasharray: 10, 5;
|
||||
}
|
||||
}
|
||||
@-webkit-keyframes ani_flow_stop {
|
||||
from {
|
||||
stroke-dasharray: 10, 5;
|
||||
}
|
||||
|
||||
to {
|
||||
stroke-dasharray: 10, 5;
|
||||
}
|
||||
}
|
||||
/* 反向流动效果 */
|
||||
.svg_ani_flow_back {
|
||||
stroke-dasharray: 1000;
|
||||
stroke-dashoffset: 1000;
|
||||
animation: ani_flow_back 10s linear infinite;
|
||||
animation-fill-mode: forwards;
|
||||
-webkit-animation: ani_flow_back 10s linear infinite;
|
||||
-webkit-animation-fill-mode: forwards;
|
||||
}
|
||||
|
||||
@keyframes ani_flow_back {
|
||||
from {
|
||||
stroke-dasharray: 13, 5;
|
||||
}
|
||||
|
||||
to {
|
||||
stroke-dasharray: 10, 5;
|
||||
}
|
||||
}
|
||||
@-webkit-keyframes ani_flow_stop {
|
||||
from {
|
||||
stroke-dasharray: 10, 5;
|
||||
}
|
||||
|
||||
to {
|
||||
stroke-dasharray: 10, 5;
|
||||
}
|
||||
}
|
||||
/* 以最大40高度填充 */
|
||||
.svg_ani_fill_h40 {
|
||||
animation: ani_fill_h40 5s linear infinite;
|
||||
animation-fill-mode: forwards;
|
||||
-webkit-animation: ani_fill_h40 5s linear infinite;
|
||||
-webkit-animation-fill-mode: forwards;
|
||||
}
|
||||
|
||||
@keyframes ani_fill_h40 {
|
||||
from {
|
||||
height: 0px;
|
||||
}
|
||||
|
||||
to {
|
||||
height: 40px;
|
||||
}
|
||||
}
|
||||
@-webkit-keyframes ani_flow_stop {
|
||||
from {
|
||||
stroke-dasharray: 10, 5;
|
||||
}
|
||||
|
||||
to {
|
||||
stroke-dasharray: 10, 5;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
19
src/packages/components/Decorates/Mores/PipelineV/config.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import { PublicConfigClass } from '@/packages/public'
|
||||
import { CreateComponentType } from '@/packages/index.d'
|
||||
import { chartInitConfig } from '@/settings/designSetting'
|
||||
import { PipelineVConfig } from './index'
|
||||
import cloneDeep from 'lodash/cloneDeep'
|
||||
|
||||
export const option = {
|
||||
color_type: 1,
|
||||
o_color: '#0a7ae2',
|
||||
i_color: '#119bfa',
|
||||
line_class: 'svg_ani_flow'
|
||||
}
|
||||
|
||||
export default class Config extends PublicConfigClass implements CreateComponentType {
|
||||
public key = PipelineVConfig.key
|
||||
public attr = { ...chartInitConfig, w: 15, h: 500, zIndex: -1 }
|
||||
public chartConfig = cloneDeep(PipelineVConfig)
|
||||
public option = cloneDeep(option)
|
||||
}
|
||||
77
src/packages/components/Decorates/Mores/PipelineV/config.vue
Normal file
@@ -0,0 +1,77 @@
|
||||
<template>
|
||||
<CollapseItem name="管道" :expanded="true">
|
||||
<SettingItemBox name="默认颜色">
|
||||
<SettingItem>
|
||||
<n-select v-model:value="optionData.color_type" :options="colorOptions" @update:value="handleColorChange" />
|
||||
</SettingItem>
|
||||
</SettingItemBox>
|
||||
<SettingItemBox name="管道颜色">
|
||||
<SettingItem>
|
||||
<n-color-picker size="small" :modes="['hex']" v-model:value="optionData.o_color"></n-color-picker>
|
||||
</SettingItem>
|
||||
</SettingItemBox>
|
||||
<SettingItemBox name="水流颜色">
|
||||
<SettingItem>
|
||||
<n-color-picker size="small" :modes="['hex']" v-model:value="optionData.i_color"></n-color-picker>
|
||||
</SettingItem>
|
||||
</SettingItemBox>
|
||||
<SettingItemBox name="流向">
|
||||
<SettingItem>
|
||||
<n-select v-model:value="optionData.line_class" :options="options" />
|
||||
</SettingItem>
|
||||
</SettingItemBox>
|
||||
</CollapseItem>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { PropType, ref } from 'vue'
|
||||
import { CollapseItem, SettingItemBox, SettingItem } from '@/components/Pages/ChartItemSetting'
|
||||
import { option } from './config'
|
||||
|
||||
const props = defineProps({
|
||||
optionData: {
|
||||
type: Object as PropType<typeof option>,
|
||||
required: true
|
||||
}
|
||||
})
|
||||
|
||||
const options = ref([
|
||||
{
|
||||
value: 'svg_ani_flow',
|
||||
label: '正向'
|
||||
},
|
||||
{
|
||||
value: 'svg_ani_flow_back',
|
||||
label: '反向'
|
||||
},
|
||||
{
|
||||
value: 'svg_ani_flow_stop',
|
||||
label: '停止'
|
||||
}
|
||||
])
|
||||
|
||||
const colorOptions = ref([
|
||||
{
|
||||
value: 1,
|
||||
label: '蓝'
|
||||
},
|
||||
{
|
||||
value: 2,
|
||||
label: '黄'
|
||||
}
|
||||
])
|
||||
|
||||
// 默认颜色
|
||||
const handleColorChange = (e: number) => {
|
||||
switch (e) {
|
||||
case 1:
|
||||
props.optionData.o_color = '#0a7ae2'
|
||||
props.optionData.i_color = '#119bfa'
|
||||
break
|
||||
case 2:
|
||||
props.optionData.o_color = '#ff9d00'
|
||||
props.optionData.i_color = '#f7ea37'
|
||||
break
|
||||
}
|
||||
}
|
||||
</script>
|
||||
14
src/packages/components/Decorates/Mores/PipelineV/index.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { ConfigType, PackagesCategoryEnum } from '@/packages/index.d'
|
||||
import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d'
|
||||
|
||||
export const PipelineVConfig: ConfigType = {
|
||||
key: 'PipelineV',
|
||||
chartKey: 'VPipelineV',
|
||||
conKey: 'VCPipelineV',
|
||||
title: '管道-纵向',
|
||||
category: ChatCategoryEnum.MORE,
|
||||
categoryName: ChatCategoryEnumName.MORE,
|
||||
package: PackagesCategoryEnum.DECORATES,
|
||||
image: 'Pipeline_V.png'
|
||||
}
|
||||
|
||||
115
src/packages/components/Decorates/Mores/PipelineV/index.vue
Normal file
@@ -0,0 +1,115 @@
|
||||
<template>
|
||||
<div class="go-decorates-line">
|
||||
<svg :width="w" :height="h">
|
||||
<line :x1="w / 2" :y1="0" :x2="w / 2" :y2="h" :stroke="o_color" :stroke-width="w"></line>
|
||||
<line :x1="w / 2" :y1="0" :x2="w / 2" :y2="h" :stroke="i_color" :stroke-width="w / 2" :class="line_class"></line>
|
||||
</svg>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { PropType, toRefs } from 'vue'
|
||||
import { CreateComponentType } from '@/packages/index.d'
|
||||
|
||||
const props = defineProps({
|
||||
chartConfig: {
|
||||
type: Object as PropType<CreateComponentType>,
|
||||
required: true
|
||||
}
|
||||
})
|
||||
|
||||
const { w, h } = toRefs(props.chartConfig.attr)
|
||||
const { o_color, i_color, line_class } = toRefs(props.chartConfig.option)
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.go-decorates-line {
|
||||
font-size: 0;
|
||||
}
|
||||
|
||||
/* 正向流动效果 */
|
||||
.svg_ani_flow {
|
||||
stroke-dasharray: 1000;
|
||||
stroke-dashoffset: 1000;
|
||||
animation: ani_flow 10s linear infinite;
|
||||
animation-fill-mode: forwards;
|
||||
-webkit-animation: ani_flow 10s linear infinite;
|
||||
-webkit-animation-fill-mode: forwards;
|
||||
}
|
||||
|
||||
@keyframes ani_flow {
|
||||
from {
|
||||
stroke-dasharray: 10, 5;
|
||||
}
|
||||
|
||||
to {
|
||||
stroke-dasharray: 13, 5;
|
||||
}
|
||||
}
|
||||
@-webkit-keyframes ani_flow {
|
||||
from {
|
||||
stroke-dasharray: 10, 5;
|
||||
}
|
||||
|
||||
to {
|
||||
stroke-dasharray: 13, 5;
|
||||
}
|
||||
}
|
||||
|
||||
/* 停止流动效果 */
|
||||
.svg_ani_flow_stop {
|
||||
stroke-dasharray: 1000;
|
||||
stroke-dashoffset: 1000;
|
||||
animation: ani_flow_stop 10s linear infinite;
|
||||
animation-fill-mode: forwards;
|
||||
-webkit-animation: ani_flow_stop 10s linear infinite;
|
||||
-webkit-animation-fill-mode: forwards;
|
||||
}
|
||||
|
||||
@keyframes ani_flow_stop {
|
||||
from {
|
||||
stroke-dasharray: 10, 5;
|
||||
}
|
||||
|
||||
to {
|
||||
stroke-dasharray: 10, 5;
|
||||
}
|
||||
}
|
||||
@-webkit-keyframes ani_flow_stop {
|
||||
from {
|
||||
stroke-dasharray: 10, 5;
|
||||
}
|
||||
|
||||
to {
|
||||
stroke-dasharray: 10, 5;
|
||||
}
|
||||
}
|
||||
/* 反向流动效果 */
|
||||
.svg_ani_flow_back {
|
||||
stroke-dasharray: 1000;
|
||||
stroke-dashoffset: 1000;
|
||||
animation: ani_flow_back 10s linear infinite;
|
||||
animation-fill-mode: forwards;
|
||||
-webkit-animation: ani_flow_back 10s linear infinite;
|
||||
-webkit-animation-fill-mode: forwards;
|
||||
}
|
||||
|
||||
@keyframes ani_flow_back {
|
||||
from {
|
||||
stroke-dasharray: 13, 5;
|
||||
}
|
||||
|
||||
to {
|
||||
stroke-dasharray: 10, 5;
|
||||
}
|
||||
}
|
||||
@-webkit-keyframes ani_flow_back {
|
||||
from {
|
||||
stroke-dasharray: 13, 5;
|
||||
}
|
||||
|
||||
to {
|
||||
stroke-dasharray: 10, 5;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,7 +1,19 @@
|
||||
import { NumberConfig } from './Number/index'
|
||||
import { TimeCommonConfig } from './TimeCommon/index'
|
||||
import { ClockConfig } from './Clock/index'
|
||||
import { FullScreenConfig } from './FullScreen/index'
|
||||
import { CountDownConfig } from './CountDown/index'
|
||||
import { FlipperNumberConfig } from './FlipperNumber'
|
||||
import { PipelineHConfig } from './PipelineH/index'
|
||||
import { PipelineVConfig } from './PipelineV/index'
|
||||
|
||||
export default [NumberConfig, FlipperNumberConfig, TimeCommonConfig, CountDownConfig, ClockConfig]
|
||||
export default [
|
||||
NumberConfig,
|
||||
FlipperNumberConfig,
|
||||
TimeCommonConfig,
|
||||
CountDownConfig,
|
||||
ClockConfig,
|
||||
FullScreenConfig,
|
||||
PipelineHConfig,
|
||||
PipelineVConfig
|
||||
]
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-nocheck
|
||||
import {
|
||||
ArcCurve,
|
||||
|
||||
@@ -1,62 +1,63 @@
|
||||
/**
|
||||
* 创建 threejs 四大天王
|
||||
* 场景、相机、渲染器、控制器
|
||||
*/
|
||||
|
||||
import * as THREE from 'three'
|
||||
import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls'
|
||||
|
||||
export class Basic {
|
||||
public scene!: THREE.Scene
|
||||
public camera!: THREE.PerspectiveCamera
|
||||
public renderer!: THREE.WebGLRenderer
|
||||
public controls!: OrbitControls
|
||||
public dom: HTMLElement
|
||||
|
||||
constructor(dom: HTMLElement) {
|
||||
this.dom = dom
|
||||
this.initScenes()
|
||||
this.setControls()
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化场景
|
||||
*/
|
||||
initScenes() {
|
||||
this.scene = new THREE.Scene()
|
||||
|
||||
this.camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 100000)
|
||||
this.camera.position.set(0, 30, -250)
|
||||
|
||||
this.renderer = new THREE.WebGLRenderer({
|
||||
// canvas: this.dom,
|
||||
alpha: true, // 透明
|
||||
antialias: true // 抗锯齿
|
||||
})
|
||||
this.renderer.setPixelRatio(window.devicePixelRatio) // 设置屏幕像素比
|
||||
this.renderer.setSize(window.innerWidth, window.innerHeight) // 设置渲染器宽高
|
||||
this.dom.appendChild(this.renderer.domElement) // 添加到dom中
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置控制器
|
||||
*/
|
||||
setControls() {
|
||||
// 鼠标控制 相机,渲染dom
|
||||
this.controls = new OrbitControls(this.camera, this.renderer.domElement)
|
||||
|
||||
this.controls.autoRotateSpeed = 3
|
||||
// 使动画循环使用时阻尼或自转 意思是否有惯性
|
||||
this.controls.enableDamping = true
|
||||
// 动态阻尼系数 就是鼠标拖拽旋转灵敏度
|
||||
this.controls.dampingFactor = 0.05
|
||||
// 是否可以缩放
|
||||
this.controls.enableZoom = true
|
||||
// 设置相机距离原点的最远距离
|
||||
this.controls.minDistance = 100
|
||||
// 设置相机距离原点的最远距离
|
||||
this.controls.maxDistance = 300
|
||||
// 是否开启右键拖拽
|
||||
this.controls.enablePan = false
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 创建 threejs 四大天王
|
||||
* 场景、相机、渲染器、控制器
|
||||
*/
|
||||
|
||||
import * as THREE from 'three'
|
||||
import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls'
|
||||
|
||||
export class Basic {
|
||||
public scene!: THREE.Scene
|
||||
public camera!: THREE.PerspectiveCamera
|
||||
public renderer!: THREE.WebGLRenderer
|
||||
public controls!: OrbitControls
|
||||
public dom: HTMLElement
|
||||
|
||||
constructor(dom: HTMLElement) {
|
||||
this.dom = dom
|
||||
this.initScenes()
|
||||
this.setControls()
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化场景
|
||||
*/
|
||||
initScenes() {
|
||||
this.scene = new THREE.Scene()
|
||||
|
||||
this.camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 100000)
|
||||
this.camera.position.set(0, 30, -250)
|
||||
|
||||
this.renderer = new THREE.WebGLRenderer({
|
||||
// canvas: this.dom,
|
||||
alpha: true, // 透明
|
||||
antialias: true, // 抗锯齿
|
||||
preserveDrawingBuffer: true
|
||||
})
|
||||
this.renderer.setPixelRatio(window.devicePixelRatio) // 设置屏幕像素比
|
||||
this.renderer.setSize(window.innerWidth, window.innerHeight) // 设置渲染器宽高
|
||||
this.dom.appendChild(this.renderer.domElement) // 添加到dom中
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置控制器
|
||||
*/
|
||||
setControls() {
|
||||
// 鼠标控制 相机,渲染dom
|
||||
this.controls = new OrbitControls(this.camera, this.renderer.domElement)
|
||||
|
||||
this.controls.autoRotateSpeed = 3
|
||||
// 使动画循环使用时阻尼或自转 意思是否有惯性
|
||||
this.controls.enableDamping = true
|
||||
// 动态阻尼系数 就是鼠标拖拽旋转灵敏度
|
||||
this.controls.dampingFactor = 0.05
|
||||
// 是否可以缩放
|
||||
this.controls.enableZoom = true
|
||||
// 设置相机距离原点的最远距离
|
||||
this.controls.minDistance = 100
|
||||
// 设置相机距离原点的最远距离
|
||||
this.controls.maxDistance = 300
|
||||
// 是否开启右键拖拽
|
||||
this.controls.enablePan = false
|
||||
}
|
||||
}
|
||||
|
||||
84
src/packages/components/Icons/Common/index.ts
Normal file
@@ -0,0 +1,84 @@
|
||||
import { IconConfig } from '../Default/Icon/index'
|
||||
import { PackagesCategoryEnum } from '@/packages/index.d'
|
||||
import { ChatCategoryEnum, ChatCategoryEnumName } from '../index.d'
|
||||
|
||||
const iconNames = [
|
||||
'uim:adobe',
|
||||
'uim:airplay',
|
||||
'uim:align',
|
||||
'uim:angle-double-down',
|
||||
'uim:angle-double-left',
|
||||
'uim:angle-double-right',
|
||||
'uim:angle-double-up',
|
||||
'uim:angle-down',
|
||||
'uim:angle-left',
|
||||
'uim:angle-right',
|
||||
'uim:angle-up',
|
||||
'uim:android-alt',
|
||||
'uim:apple',
|
||||
'uim:apps',
|
||||
'uim:bag',
|
||||
'uim:battery-bolt',
|
||||
'uim:bing',
|
||||
'uim:box',
|
||||
'uim:briefcase',
|
||||
'uim:calender',
|
||||
'uim:chart',
|
||||
'uim:chart-pie',
|
||||
'uim:circle-layer',
|
||||
'uim:clinic-medical',
|
||||
'uim:clock',
|
||||
'uim:comment-alt',
|
||||
'uim:comment-alt-dots',
|
||||
'uim:docker',
|
||||
'uim:download-alt',
|
||||
'uim:dribbble',
|
||||
'uim:dropbox',
|
||||
'uim:entry',
|
||||
'uim:exclamation-circle',
|
||||
'uim:exclamation-triangle',
|
||||
'uim:exit',
|
||||
'uim:facebook',
|
||||
'uim:facebook-messenger',
|
||||
'uim:facebook-messenger-alt',
|
||||
'uim:google-drive',
|
||||
'uim:google-play',
|
||||
'uim:graph-bar',
|
||||
'uim:head-side-mask',
|
||||
'uim:horizontal-align-left',
|
||||
'uim:hospital',
|
||||
'uim:house-user',
|
||||
'uim:image-v',
|
||||
'uim:key-skeleton',
|
||||
'uim:layer-group',
|
||||
'uim:layers-alt',
|
||||
'uim:link-h',
|
||||
'uim:microscope',
|
||||
'uim:microsoft',
|
||||
'uim:object-group',
|
||||
'uim:object-ungroup',
|
||||
'uim:paypal',
|
||||
'uim:refresh',
|
||||
'uim:repeat',
|
||||
'uim:right-indent-alt',
|
||||
'uim:rocket',
|
||||
'uim:shield-plus',
|
||||
'uim:social-distancing',
|
||||
'uim:telegram-alt',
|
||||
'uim:user-md',
|
||||
'uim:toilet-paper',
|
||||
'uim:youtube'
|
||||
]
|
||||
const iconList = iconNames.map(name => ({
|
||||
...IconConfig,
|
||||
category: ChatCategoryEnum.COMMON,
|
||||
categoryName: ChatCategoryEnumName.COMMON,
|
||||
package: PackagesCategoryEnum.ICONS,
|
||||
image: name,
|
||||
icon: name,
|
||||
dataset: name,
|
||||
title: name.replace('uim:', ''),
|
||||
redirectComponent: `${IconConfig.package}/${IconConfig.category}/${IconConfig.key}` // 跳转组件路径规则:packageName/categoryName/componentKey
|
||||
}))
|
||||
|
||||
export default iconList
|
||||
20
src/packages/components/Icons/Default/Icon/config.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import { PublicConfigClass } from '@/packages/public'
|
||||
import { CreateComponentType } from '@/packages/index.d'
|
||||
import { chartInitConfig } from '@/settings/designSetting'
|
||||
import { IconConfig } from './index'
|
||||
import cloneDeep from 'lodash/cloneDeep'
|
||||
|
||||
export const option = {
|
||||
// 图标名称
|
||||
dataset: 'uim:apple',
|
||||
color: '#03A9F4',
|
||||
size: 64,
|
||||
rotate: 0 // 旋转角度
|
||||
}
|
||||
|
||||
export default class Config extends PublicConfigClass implements CreateComponentType {
|
||||
public key = IconConfig.key
|
||||
public attr = { ...chartInitConfig, w: 64, h: 64, zIndex: 1 }
|
||||
public chartConfig = cloneDeep(IconConfig)
|
||||
public option = cloneDeep(option)
|
||||
}
|
||||
50
src/packages/components/Icons/Default/Icon/config.vue
Normal file
@@ -0,0 +1,50 @@
|
||||
<template>
|
||||
<collapse-item name="属性" :expanded="true">
|
||||
<setting-item-box name="样式">
|
||||
<setting-item name="颜色">
|
||||
<n-color-picker size="small" :modes="['hex']" v-model:value="optionData.color"></n-color-picker>
|
||||
</setting-item>
|
||||
<setting-item name="尺寸">
|
||||
<n-input-number v-model:value="optionData.size" size="small" :min="0" placeholder="尺寸"></n-input-number>
|
||||
</setting-item>
|
||||
</setting-item-box>
|
||||
<setting-item-box name="旋转">
|
||||
<setting-item name="旋转">
|
||||
<n-select v-model:value="optionData.rotate" size="small" :options="rotateMode"></n-select>
|
||||
</setting-item>
|
||||
</setting-item-box>
|
||||
</collapse-item>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { PropType } from 'vue'
|
||||
import { option } from './config'
|
||||
import { CollapseItem, SettingItemBox, SettingItem } from '@/components/Pages/ChartItemSetting'
|
||||
|
||||
const props = defineProps({
|
||||
optionData: {
|
||||
type: Object as PropType<typeof option>,
|
||||
required: true
|
||||
}
|
||||
})
|
||||
|
||||
// 旋转方式
|
||||
const rotateMode = [
|
||||
{
|
||||
value: 0,
|
||||
label: '0°'
|
||||
},
|
||||
{
|
||||
value: 1,
|
||||
label: '90°'
|
||||
},
|
||||
{
|
||||
value: 2,
|
||||
label: '180°'
|
||||
},
|
||||
{
|
||||
value: 3,
|
||||
label: '270°'
|
||||
}
|
||||
]
|
||||
</script>
|
||||
14
src/packages/components/Icons/Default/Icon/index.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d'
|
||||
import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d'
|
||||
|
||||
export const IconConfig: ConfigType = {
|
||||
key: 'Icon',
|
||||
chartKey: 'VIcon',
|
||||
conKey: 'VCIcon',
|
||||
title: '图标',
|
||||
category: ChatCategoryEnum.DEFAULT,
|
||||
categoryName: ChatCategoryEnumName.DEFAULT,
|
||||
package: PackagesCategoryEnum.ICONS,
|
||||
chartFrame: ChartFrameEnum.STATIC,
|
||||
image: 'icon.png'
|
||||
}
|
||||
31
src/packages/components/Icons/Default/Icon/index.vue
Normal file
@@ -0,0 +1,31 @@
|
||||
<template>
|
||||
<div class="go-icon-box">
|
||||
<Icon :icon="((dataset || '') as string)" :color="color" :width="size" :rotate="rotate" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { PropType, toRefs } from 'vue'
|
||||
import { CreateComponentType } from '@/packages/index.d'
|
||||
import { Icon } from '@iconify/vue'
|
||||
|
||||
const props = defineProps({
|
||||
chartConfig: {
|
||||
type: Object as PropType<CreateComponentType>,
|
||||
required: true
|
||||
}
|
||||
})
|
||||
|
||||
const { w, h } = toRefs(props.chartConfig.attr)
|
||||
const { dataset, color, size, rotate } = toRefs(props.chartConfig.option)
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@include go('icon-box') {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: v-bind('`${w}px`');
|
||||
height: v-bind('`${h}px`');
|
||||
}
|
||||
</style>
|
||||
45
src/packages/components/Icons/MaterialLine/index.ts
Normal file
@@ -0,0 +1,45 @@
|
||||
import { IconConfig } from '../Default/Icon/index'
|
||||
import { PackagesCategoryEnum } from '@/packages/index.d'
|
||||
import { ChatCategoryEnum, ChatCategoryEnumName } from '../index.d'
|
||||
|
||||
const iconNames = [
|
||||
'line-md:beer-alt-filled-loop',
|
||||
'line-md:beer-alt-twotone-loop',
|
||||
'line-md:cloud-braces-loop',
|
||||
'line-md:cloud-download-loop',
|
||||
'line-md:cloud-download-outline-loop',
|
||||
'line-md:cloud-upload-loop',
|
||||
'line-md:cloud-upload-outline-loop',
|
||||
'line-md:coffee-half-empty-twotone-loop',
|
||||
'line-md:coffee-loop',
|
||||
'line-md:coffee-twotone-loop',
|
||||
'line-md:downloading-loop',
|
||||
'line-md:github-loop',
|
||||
'line-md:light-dark-loop',
|
||||
'line-md:loading-alt-loop',
|
||||
'line-md:loading-loop',
|
||||
'line-md:loading-twotone-loop',
|
||||
'line-md:moon-alt-loop',
|
||||
'line-md:moon-alt-to-sunny-outline-loop-transition',
|
||||
'line-md:moon-filled-loop',
|
||||
'line-md:moon-filled-to-sunny-filled-loop-transition',
|
||||
'line-md:star-pulsating-filled-loop',
|
||||
'line-md:star-pulsating-loop',
|
||||
'line-md:star-pulsating-twotone-loop',
|
||||
'line-md:upload-loop',
|
||||
'line-md:upload-outline-loop',
|
||||
'line-md:uploading-loop'
|
||||
]
|
||||
const iconList = iconNames.map(name => ({
|
||||
...IconConfig,
|
||||
category: ChatCategoryEnum.ML,
|
||||
categoryName: ChatCategoryEnumName.ML,
|
||||
package: PackagesCategoryEnum.ICONS,
|
||||
image: name,
|
||||
icon: name,
|
||||
dataset: name,
|
||||
title: name.replace('line-md:', ''),
|
||||
redirectComponent: `${IconConfig.package}/${IconConfig.category}/${IconConfig.key}` // 跳转组件路径规则:packageName/categoryName/componentKey
|
||||
}))
|
||||
|
||||
export default iconList
|
||||
53
src/packages/components/Icons/Weather/index.ts
Normal file
@@ -0,0 +1,53 @@
|
||||
import { IconConfig } from '../Default/Icon/index'
|
||||
import { PackagesCategoryEnum } from '@/packages/index.d'
|
||||
import { ChatCategoryEnum, ChatCategoryEnumName } from '../index.d'
|
||||
|
||||
const iconNames = [
|
||||
'wi:cloud',
|
||||
'wi:cloudy',
|
||||
'wi:cloudy-gusts',
|
||||
'wi:cloudy-windy',
|
||||
'wi:day-cloudy',
|
||||
'wi:day-cloudy-high',
|
||||
'wi:day-hail',
|
||||
'wi:day-haze',
|
||||
'wi:day-light-wind',
|
||||
'wi:day-lightning',
|
||||
'wi:day-rain',
|
||||
'wi:day-rain-mix',
|
||||
'wi:day-rain-wind',
|
||||
'wi:day-showers',
|
||||
'wi:day-sleet',
|
||||
'wi:day-sleet-storm',
|
||||
'wi:day-snow',
|
||||
'wi:day-snow-thunderstorm',
|
||||
'wi:day-snow-wind',
|
||||
'wi:day-sprinkle',
|
||||
'wi:day-storm-showers',
|
||||
'wi:day-sunny',
|
||||
'wi:day-sunny-overcast',
|
||||
'wi:hail',
|
||||
'wi:horizon',
|
||||
'wi:horizon-alt',
|
||||
'wi:hot',
|
||||
'wi:lightning',
|
||||
'wi:night-alt-cloudy',
|
||||
'wi:night-alt-cloudy-gusts',
|
||||
'wi:night-alt-cloudy-high',
|
||||
'wi:night-alt-hail',
|
||||
'wi:night-alt-lightning',
|
||||
'wi:umbrella'
|
||||
]
|
||||
const iconList = iconNames.map(name => ({
|
||||
...IconConfig,
|
||||
category: ChatCategoryEnum.WEATHER,
|
||||
categoryName: ChatCategoryEnumName.WEATHER,
|
||||
package: PackagesCategoryEnum.ICONS,
|
||||
image: name,
|
||||
icon: name,
|
||||
dataset: name,
|
||||
title: name.replace('wi:', ''),
|
||||
redirectComponent: `${IconConfig.package}/${IconConfig.category}/${IconConfig.key}` // 跳转组件路径规则:packageName/categoryName/componentKey
|
||||
}))
|
||||
|
||||
export default iconList
|
||||
13
src/packages/components/Icons/index.d.ts
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
export enum ChatCategoryEnum {
|
||||
ML = 'MaterialLine',
|
||||
COMMON = 'Common',
|
||||
WEATHER = 'Weather',
|
||||
DEFAULT = 'Default' // 这个仅用来表示组件分类目录,不要在 index.ts 中导入
|
||||
}
|
||||
|
||||
export enum ChatCategoryEnumName {
|
||||
ML = '动画',
|
||||
COMMON = '通用',
|
||||
WEATHER = '天气',
|
||||
DEFAULT = '默认'
|
||||
}
|
||||
5
src/packages/components/Icons/index.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
import MaterialLine from './MaterialLine'
|
||||
import Common from './Common'
|
||||
import Weather from './Weather'
|
||||
|
||||
export const IconList = [...MaterialLine, ...Weather, ...Common]
|
||||
11
src/packages/components/Informations/Inputs/InputsDate/config.ts
Normal file → Executable file
@@ -4,7 +4,7 @@ import { PublicConfigClass } from '@/packages/public'
|
||||
import { CreateComponentType } from '@/packages/index.d'
|
||||
import { chartInitConfig } from '@/settings/designSetting'
|
||||
import { COMPONENT_INTERACT_EVENT_KET } from '@/enums/eventEnum'
|
||||
import { interactActions, ComponentInteractEventEnum } from './interact'
|
||||
import { interactActions, ComponentInteractEventEnum, DefaultTypeEnum, DifferUnitEnum } from './interact'
|
||||
import { InputsDateConfig } from './index'
|
||||
|
||||
export const option = {
|
||||
@@ -12,7 +12,14 @@ export const option = {
|
||||
[COMPONENT_INTERACT_EVENT_KET]: ComponentInteractEventEnum.DATE,
|
||||
// 下拉展示
|
||||
isPanel: 0,
|
||||
dataset: dayjs().valueOf()
|
||||
// 默认值
|
||||
dataset: dayjs().valueOf() as number | number[] | null,
|
||||
// 默认值类型
|
||||
defaultType: DefaultTypeEnum.STATIC,
|
||||
// 动态默认值偏移单位
|
||||
differUnit: [DifferUnitEnum.DAY, DifferUnitEnum.DAY],
|
||||
// 动态默认值偏移值
|
||||
differValue: [0, 0]
|
||||
}
|
||||
|
||||
export default class Config extends PublicConfigClass implements CreateComponentType {
|
||||
|
||||
152
src/packages/components/Informations/Inputs/InputsDate/config.vue
Normal file → Executable file
@@ -1,41 +1,74 @@
|
||||
<template>
|
||||
<collapse-item name="展示方式" :expanded="true">
|
||||
<setting-item-box name="选择方式">
|
||||
<n-select
|
||||
v-model:value="optionData.isPanel"
|
||||
size="small"
|
||||
:options="panelOptions"
|
||||
/>
|
||||
<n-select v-model:value="optionData.isPanel" size="small" :options="panelOptions" />
|
||||
</setting-item-box>
|
||||
</collapse-item>
|
||||
|
||||
<collapse-item name="时间配置" :expanded="true">
|
||||
<setting-item-box name="基础">
|
||||
<setting-item name="类型">
|
||||
<n-select
|
||||
v-model:value="optionData.componentInteractEventKey"
|
||||
size="small"
|
||||
:options="datePickerTypeOptions"
|
||||
/>
|
||||
<n-select v-model:value="optionData.componentInteractEventKey" size="small" :options="datePickerTypeOptions"
|
||||
@update:value="datePickerTypeUpdate"/>
|
||||
</setting-item>
|
||||
</setting-item-box>
|
||||
|
||||
<setting-item-box name="默认值" :alone="true">
|
||||
<n-date-picker
|
||||
size="small"
|
||||
v-model:value="optionData.dataset"
|
||||
:type="optionData.componentInteractEventKey"
|
||||
/>
|
||||
<setting-item-box name="默认值">
|
||||
<setting-item name="类型">
|
||||
<n-select v-model:value="optionData.defaultType" size="small" :options="defaultTypeOptions"
|
||||
@update:value="defaultTypeUpdate" />
|
||||
</setting-item>
|
||||
|
||||
</setting-item-box>
|
||||
<setting-item-box v-if="optionData.defaultType === DefaultTypeEnum.STATIC" :alone="true">
|
||||
<setting-item name="静态默认值">
|
||||
<n-date-picker size="small" clearable v-model:value="optionData.dataset" :type="optionData.componentInteractEventKey" />
|
||||
</setting-item>
|
||||
</setting-item-box>
|
||||
<setting-item-box v-if="optionData.defaultType === DefaultTypeEnum.DYNAMIC" >
|
||||
<template #name>
|
||||
<n-text></n-text>
|
||||
<n-tooltip trigger="hover">
|
||||
<template #trigger>
|
||||
<n-icon size="21" :depth="3">
|
||||
<help-outline-icon></help-outline-icon>
|
||||
</n-icon>
|
||||
</template>
|
||||
<span>打开页面时浏览器操作系统的系统时间+偏移量(单位)</span>
|
||||
</n-tooltip>
|
||||
</template>
|
||||
<setting-item :name="differValueName">
|
||||
<n-input-number v-model:value="optionData.differValue[0]" class="input-num-width" size="small">
|
||||
<template #suffix>
|
||||
{{DifferUnitObject[optionData.differUnit[0]]}}
|
||||
</template>
|
||||
</n-input-number>
|
||||
</setting-item>
|
||||
<setting-item :name="differUnitName">
|
||||
<n-select v-model:value="optionData.differUnit[0]" size="small" :options="differUnitOptions" />
|
||||
</setting-item>
|
||||
<setting-item v-if="isRange" name="结束值动态偏移量">
|
||||
<n-input-number v-model:value="optionData.differValue[1]" class="input-num-width" size="small">
|
||||
<template #suffix>
|
||||
{{DifferUnitObject[optionData.differUnit[1]]}}
|
||||
</template>
|
||||
</n-input-number>
|
||||
</setting-item>
|
||||
<setting-item v-if="isRange" name="结束值偏移单位">
|
||||
<n-select v-model:value="optionData.differUnit[1]" size="small" :options="differUnitOptions" />
|
||||
</setting-item>
|
||||
</setting-item-box>
|
||||
|
||||
</collapse-item>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { PropType } from 'vue'
|
||||
import { PropType, computed } from 'vue'
|
||||
import { icon } from '@/plugins'
|
||||
import { CollapseItem, SettingItemBox, SettingItem } from '@/components/Pages/ChartItemSetting'
|
||||
import { option } from './config'
|
||||
import { ComponentInteractEventEnum } from './interact'
|
||||
import { ComponentInteractEventEnum, DefaultTypeEnum, DifferUnitEnum, DifferUnitObject } from './interact'
|
||||
import dayjs from "dayjs";
|
||||
|
||||
const { HelpOutlineIcon } = icon.ionicons5
|
||||
|
||||
@@ -95,4 +128,87 @@ const datePickerTypeOptions = [
|
||||
value: ComponentInteractEventEnum.QUARTER_RANGE
|
||||
}
|
||||
]
|
||||
|
||||
const defaultTypeOptions = [
|
||||
{
|
||||
label: '静态',
|
||||
value: DefaultTypeEnum.STATIC
|
||||
},
|
||||
{
|
||||
label: '动态',
|
||||
value: DefaultTypeEnum.DYNAMIC
|
||||
},
|
||||
{
|
||||
label: '无',
|
||||
value: DefaultTypeEnum.NONE
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
const differUnitOptions = [
|
||||
// ManipulateType
|
||||
{
|
||||
value: DifferUnitEnum.DAY,
|
||||
label: DifferUnitObject[DifferUnitEnum.DAY]
|
||||
},
|
||||
{
|
||||
value: DifferUnitEnum.WEEK,
|
||||
label: DifferUnitObject[DifferUnitEnum.WEEK]
|
||||
},
|
||||
{
|
||||
value: DifferUnitEnum.MONTH,
|
||||
label: DifferUnitObject[DifferUnitEnum.MONTH]
|
||||
},
|
||||
{
|
||||
value: DifferUnitEnum.QUARTER,
|
||||
label: DifferUnitObject[DifferUnitEnum.QUARTER]
|
||||
},
|
||||
{
|
||||
value: DifferUnitEnum.YEAR,
|
||||
label: DifferUnitObject[DifferUnitEnum.YEAR]
|
||||
},
|
||||
{
|
||||
value: DifferUnitEnum.HOUR,
|
||||
label: DifferUnitObject[DifferUnitEnum.HOUR]
|
||||
},
|
||||
{
|
||||
value: DifferUnitEnum.MINUTE,
|
||||
label: DifferUnitObject[DifferUnitEnum.MINUTE]
|
||||
},
|
||||
{
|
||||
value: DifferUnitEnum.SECOND,
|
||||
label: DifferUnitObject[DifferUnitEnum.SECOND]
|
||||
},
|
||||
{
|
||||
value: DifferUnitEnum.MILLISECOND,
|
||||
label: DifferUnitObject[DifferUnitEnum.MILLISECOND]
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
const isRange = computed(() => {
|
||||
return props.optionData.componentInteractEventKey.endsWith('range')
|
||||
})
|
||||
|
||||
const differValueName = computed(() => {
|
||||
return isRange.value ? '开始值动态偏移量' : '动态偏移量'
|
||||
})
|
||||
|
||||
const differUnitName = computed(() => {
|
||||
return isRange.value ? '开始值偏移单位' : '偏移单位'
|
||||
})
|
||||
|
||||
const datePickerTypeUpdate = () => {
|
||||
props.optionData.dataset = isRange.value ? [dayjs().valueOf(), dayjs().valueOf()] : dayjs().valueOf()
|
||||
}
|
||||
|
||||
const defaultTypeUpdate = (v: string) => {
|
||||
if (v === DefaultTypeEnum.STATIC) {
|
||||
datePickerTypeUpdate()
|
||||
} else {
|
||||
// DefaultTypeEnum.
|
||||
props.optionData.dataset = null
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
123
src/packages/components/Informations/Inputs/InputsDate/index.vue
Normal file → Executable file
@@ -1,6 +1,7 @@
|
||||
<template>
|
||||
<n-date-picker
|
||||
v-model:value="option.dataset"
|
||||
clearable
|
||||
:panel="!!chartConfig.option.isPanel"
|
||||
:type="chartConfig.option.componentInteractEventKey"
|
||||
:style="`width:${w}px;`"
|
||||
@@ -9,13 +10,15 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { PropType, toRefs, ref, shallowReactive, watch } from 'vue'
|
||||
import dayjs from 'dayjs'
|
||||
import { computed, PropType, ref, shallowReactive, toRefs, watch } from 'vue'
|
||||
import { CreateComponentType } from '@/packages/index.d'
|
||||
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
|
||||
import { useChartInteract } from '@/hooks'
|
||||
import { InteractEventOn } from '@/enums/eventEnum'
|
||||
import { ComponentInteractParamsEnum } from './interact'
|
||||
import {ComponentInteractEventEnum, ComponentInteractParamsEnum, DefaultTypeEnum} from './interact'
|
||||
import dayjs, {ManipulateType} from 'dayjs'
|
||||
import quarterOfYear from 'dayjs/plugin/quarterOfYear';
|
||||
|
||||
|
||||
const props = defineProps({
|
||||
chartConfig: {
|
||||
@@ -31,43 +34,107 @@ const option = shallowReactive({
|
||||
dataset: props.chartConfig.option.dataset
|
||||
})
|
||||
|
||||
const isRange = computed(() => {
|
||||
return props.chartConfig.option.componentInteractEventKey.endsWith('range')
|
||||
})
|
||||
|
||||
// 监听事件改变
|
||||
const onChange = (v: number | number[]) => {
|
||||
if (v instanceof Array) {
|
||||
const onChange = (v: number | number[] | null) => {
|
||||
if (isRange.value) {
|
||||
let dateStart = null
|
||||
let dateEnd = null
|
||||
let daterange = null
|
||||
if(v instanceof Array){
|
||||
dateStart = v[0]
|
||||
dateEnd = v[1]
|
||||
daterange = `${v[0]}-${v[1]}`
|
||||
}
|
||||
// 存储到联动数据
|
||||
useChartInteract(
|
||||
props.chartConfig,
|
||||
useChartEditStore,
|
||||
{
|
||||
[ComponentInteractParamsEnum.DATE_START]: v[0] | dayjs().valueOf(),
|
||||
[ComponentInteractParamsEnum.DATE_END]: v[1] | dayjs().valueOf(),
|
||||
[ComponentInteractParamsEnum.DATE_RANGE]: `${v[0]}-${v[1]}`
|
||||
},
|
||||
InteractEventOn.CHANGE
|
||||
props.chartConfig,
|
||||
useChartEditStore,
|
||||
{
|
||||
[ComponentInteractParamsEnum.DATE_START]: dateStart,
|
||||
[ComponentInteractParamsEnum.DATE_END]: dateEnd,
|
||||
[ComponentInteractParamsEnum.DATE_RANGE]: daterange
|
||||
},
|
||||
InteractEventOn.CHANGE
|
||||
)
|
||||
} else {
|
||||
// 存储到联动数据
|
||||
useChartInteract(
|
||||
props.chartConfig,
|
||||
useChartEditStore,
|
||||
{ [ComponentInteractParamsEnum.DATE]: v },
|
||||
InteractEventOn.CHANGE
|
||||
props.chartConfig,
|
||||
useChartEditStore,
|
||||
{ [ComponentInteractParamsEnum.DATE]: v },
|
||||
InteractEventOn.CHANGE
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
// 手动更新
|
||||
watch(
|
||||
() => props.chartConfig.option.dataset,
|
||||
(newData: number | number[]) => {
|
||||
option.dataset = newData
|
||||
// 关联目标组件首次请求带上默认内容
|
||||
onChange(newData)
|
||||
},
|
||||
{
|
||||
immediate: true
|
||||
const getDiffDate = (type: ComponentInteractEventEnum, date: dayjs.Dayjs) => {
|
||||
// 注册 quarterOfYear 插件
|
||||
dayjs.extend(quarterOfYear)
|
||||
switch (type) {
|
||||
case ComponentInteractEventEnum.DATE:
|
||||
case ComponentInteractEventEnum.DATE_RANGE:
|
||||
date = date.startOf('day')
|
||||
break
|
||||
case ComponentInteractEventEnum.MONTH:
|
||||
case ComponentInteractEventEnum.MONTH_RANGE:
|
||||
date = date.startOf('month')
|
||||
break
|
||||
case ComponentInteractEventEnum.YEAR:
|
||||
case ComponentInteractEventEnum.YEAR_RANGE:
|
||||
date = date.startOf('year')
|
||||
break
|
||||
case ComponentInteractEventEnum.QUARTER:
|
||||
case ComponentInteractEventEnum.QUARTER_RANGE:
|
||||
date = date.startOf('quarter')
|
||||
break
|
||||
default:
|
||||
break
|
||||
}
|
||||
)
|
||||
return date
|
||||
}
|
||||
|
||||
watch(
|
||||
() => {
|
||||
return {
|
||||
type: props.chartConfig.option.componentInteractEventKey as ComponentInteractEventEnum,
|
||||
defaultType: props.chartConfig.option.defaultType as string,
|
||||
differValue: props.chartConfig.option.differValue as number[],
|
||||
differUnit: props.chartConfig.option.differUnit as ManipulateType[],
|
||||
dataset: props.chartConfig.option.dataset as number | number[] | null,
|
||||
};
|
||||
},
|
||||
(newData, oldData) => {
|
||||
const hasTypeChanged = newData.type !== oldData?.type;
|
||||
const hasDefaultTypeChanged = newData.defaultType !== oldData?.defaultType;
|
||||
const hasDifferValueChanged = newData.differValue !== oldData?.differValue;
|
||||
const hasDifferUnitChanged = newData.differUnit !== oldData?.differUnit;
|
||||
|
||||
if (hasTypeChanged || hasDefaultTypeChanged || hasDifferValueChanged || hasDifferUnitChanged) {
|
||||
if (newData.defaultType === DefaultTypeEnum.NONE) {
|
||||
props.chartConfig.option.dataset = null;
|
||||
} else if (newData.defaultType === DefaultTypeEnum.DYNAMIC) {
|
||||
let date = dayjs();
|
||||
if (isRange.value) {
|
||||
props.chartConfig.option.dataset = [
|
||||
getDiffDate(newData.type,date.add(newData.differValue[0], newData.differUnit[0])).valueOf(),
|
||||
getDiffDate(newData.type,date.add(newData.differValue[1], newData.differUnit[1])).valueOf(),
|
||||
];
|
||||
} else {
|
||||
props.chartConfig.option.dataset = getDiffDate(newData.type,date.add(newData.differValue[0], newData.differUnit[0])).valueOf()
|
||||
}
|
||||
}
|
||||
}
|
||||
option.dataset = props.chartConfig.option.dataset;
|
||||
onChange(option.dataset);
|
||||
},
|
||||
{
|
||||
immediate: true,
|
||||
}
|
||||
);
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
31
src/packages/components/Informations/Inputs/InputsDate/interact.ts
Normal file → Executable file
@@ -22,6 +22,37 @@ export enum ComponentInteractParamsEnum {
|
||||
DATE_RANGE = 'daterange'
|
||||
}
|
||||
|
||||
export enum DefaultTypeEnum {
|
||||
NONE = "none",
|
||||
STATIC = "static",
|
||||
DYNAMIC = "dynamic"
|
||||
}
|
||||
|
||||
export enum DifferUnitEnum {
|
||||
DAY = 'd',
|
||||
WEEK = 'w',
|
||||
MONTH = 'M',
|
||||
QUARTER = 'Q',
|
||||
YEAR = 'y',
|
||||
HOUR = 'h',
|
||||
MINUTE = 'm',
|
||||
SECOND = 's',
|
||||
MILLISECOND = 'ms',
|
||||
}
|
||||
|
||||
export const DifferUnitObject = {
|
||||
// https://day.js.org/docs/en/manipulate/add
|
||||
[DifferUnitEnum.DAY]: '天',
|
||||
[DifferUnitEnum.WEEK]: '周',
|
||||
[DifferUnitEnum.MONTH]: '月',
|
||||
[DifferUnitEnum.QUARTER]: '季度',
|
||||
[DifferUnitEnum.YEAR]: '年',
|
||||
[DifferUnitEnum.HOUR]: '小时',
|
||||
[DifferUnitEnum.MINUTE]: '分钟',
|
||||
[DifferUnitEnum.SECOND]: '秒',
|
||||
[DifferUnitEnum.MILLISECOND]: '毫秒',
|
||||
}
|
||||
|
||||
const time = [
|
||||
{
|
||||
value: ComponentInteractParamsEnum.DATE,
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
import cloneDeep from 'lodash/cloneDeep'
|
||||
import { PublicConfigClass } from '@/packages/public'
|
||||
import { CreateComponentType } from '@/packages/index.d'
|
||||
import { chartInitConfig } from '@/settings/designSetting'
|
||||
import { COMPONENT_INTERACT_EVENT_KET } from '@/enums/eventEnum'
|
||||
import { interactActions, ComponentInteractEventEnum } from './interact'
|
||||
import {InputsInputConfig} from "./index";
|
||||
|
||||
export const option = {
|
||||
// 时间组件展示类型,必须和 interactActions 中定义的数据一致
|
||||
[COMPONENT_INTERACT_EVENT_KET]: ComponentInteractEventEnum.DATA,
|
||||
// 默认值
|
||||
inputValue: "0",
|
||||
// 暴露配置内容给用户
|
||||
dataset: ""
|
||||
}
|
||||
|
||||
export default class Config extends PublicConfigClass implements CreateComponentType {
|
||||
public key = InputsInputConfig.key
|
||||
public attr = { ...chartInitConfig, w: 260, h: 32, zIndex: -1 }
|
||||
public chartConfig = cloneDeep(InputsInputConfig)
|
||||
public interactActions = interactActions
|
||||
public option = cloneDeep(option)
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<template>
|
||||
<collapse-item name="输入框配置" :expanded="true">
|
||||
<setting-item-box name="默认值" :alone="true">
|
||||
<n-input v-model:value="optionData.dataset" placeholder="若未输入,则默认值为0"/>
|
||||
</setting-item-box>
|
||||
</collapse-item>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { PropType } from 'vue'
|
||||
import { CollapseItem, SettingItemBox } from '@/components/Pages/ChartItemSetting'
|
||||
import { option } from './config'
|
||||
defineProps({
|
||||
optionData: {
|
||||
type: Object as PropType<typeof option>,
|
||||
required: true
|
||||
}
|
||||
})
|
||||
</script>
|
||||
@@ -0,0 +1,14 @@
|
||||
import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d'
|
||||
import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d'
|
||||
|
||||
export const InputsInputConfig: ConfigType = {
|
||||
key: 'InputsInput',
|
||||
chartKey: 'VInputsInput',
|
||||
conKey: 'VCInputsInput',
|
||||
title: '输入框',
|
||||
category: ChatCategoryEnum.INPUTS,
|
||||
categoryName: ChatCategoryEnumName.INPUTS,
|
||||
package: PackagesCategoryEnum.INFORMATIONS,
|
||||
chartFrame: ChartFrameEnum.STATIC,
|
||||
image: 'inputs_select.png'
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
<template>
|
||||
<div>
|
||||
<n-input :style="`width:${w}px;`" type="text"
|
||||
v-model:value="option.value.dataset"
|
||||
placeholder="请输入"
|
||||
@change="onChange">
|
||||
|
||||
</n-input>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { PropType, toRefs, shallowReactive, watch } from 'vue'
|
||||
import { CreateComponentType } from '@/packages/index.d'
|
||||
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
|
||||
import { useChartInteract } from '@/hooks'
|
||||
import { InteractEventOn } from '@/enums/eventEnum'
|
||||
import { ComponentInteractParamsEnum } from './interact'
|
||||
|
||||
const props = defineProps({
|
||||
chartConfig: {
|
||||
type: Object as PropType<CreateComponentType>,
|
||||
required: true
|
||||
}
|
||||
})
|
||||
|
||||
const { w, h } = toRefs(props.chartConfig.attr)
|
||||
const option = shallowReactive({
|
||||
value: {
|
||||
inputValue: props.chartConfig.option.inputValue,
|
||||
dataset: props.chartConfig.option.dataset
|
||||
}
|
||||
})
|
||||
|
||||
const onChange = (v: string) => {
|
||||
if(v == undefined) return;
|
||||
// 存储到联动数据
|
||||
useChartInteract(
|
||||
props.chartConfig,
|
||||
useChartEditStore,
|
||||
{ [ComponentInteractParamsEnum.DATA]: v },
|
||||
InteractEventOn.CHANGE
|
||||
)
|
||||
}
|
||||
|
||||
// 手动更新
|
||||
watch(
|
||||
() => props.chartConfig.option,
|
||||
(newData: any) => {
|
||||
option.value = newData
|
||||
onChange(newData.inputValue)
|
||||
},
|
||||
{
|
||||
immediate: true,
|
||||
deep: true
|
||||
}
|
||||
)
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
import { InteractEventOn, InteractActionsType } from '@/enums/eventEnum'
|
||||
|
||||
// 时间组件类型
|
||||
export enum ComponentInteractEventEnum {
|
||||
DATA = 'data'
|
||||
}
|
||||
|
||||
// 联动参数
|
||||
export enum ComponentInteractParamsEnum {
|
||||
DATA = 'data'
|
||||
}
|
||||
|
||||
// 定义组件触发回调事件
|
||||
export const interactActions: InteractActionsType[] = [
|
||||
{
|
||||
interactType: InteractEventOn.CHANGE,
|
||||
interactName: '选择完成',
|
||||
componentEmitEvents: {
|
||||
[ComponentInteractEventEnum.DATA]: [
|
||||
{
|
||||
value: ComponentInteractParamsEnum.DATA,
|
||||
label: '选择项'
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,26 @@
|
||||
import cloneDeep from 'lodash/cloneDeep'
|
||||
import { PublicConfigClass } from '@/packages/public'
|
||||
import { CreateComponentType } from '@/packages/index.d'
|
||||
import { chartInitConfig } from '@/settings/designSetting'
|
||||
import { COMPONENT_INTERACT_EVENT_KET } from '@/enums/eventEnum'
|
||||
import { interactActions, ComponentInteractEventEnum } from './interact'
|
||||
import {InputsPaginationConfig} from "./index";
|
||||
|
||||
export const option = {
|
||||
// 时间组件展示类型,必须和 interactActions 中定义的数据一致
|
||||
[COMPONENT_INTERACT_EVENT_KET]: ComponentInteractEventEnum.DATA,
|
||||
// 默认值
|
||||
pageValue:1,
|
||||
sizeValue:[2,4,8,10,20],
|
||||
pageSize:4,
|
||||
// 暴露配置内容给用户
|
||||
dataset: 10
|
||||
}
|
||||
|
||||
export default class Config extends PublicConfigClass implements CreateComponentType {
|
||||
public key = InputsPaginationConfig.key
|
||||
public attr = { ...chartInitConfig, w: 395, h: 32, zIndex: -1 }
|
||||
public chartConfig = cloneDeep(InputsPaginationConfig)
|
||||
public interactActions = interactActions
|
||||
public option = cloneDeep(option)
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<template>
|
||||
<collapse-item name="分页配置" :expanded="true">
|
||||
<setting-item-box :alone="false" name="分页设置">
|
||||
<setting-item name="默认页码" :alone="true">
|
||||
<n-input-number v-model:value="optionData.pageValue" size="small" placeholder="字体大小"></n-input-number>
|
||||
</setting-item>
|
||||
<setting-item name="分页" :alone="true">
|
||||
<n-select v-model:value="optionData.pageSize" size="small"
|
||||
:options="page" />
|
||||
</setting-item>
|
||||
<setting-item name="页数" :alone="true">
|
||||
<n-input-number v-model:value="optionData.dataset" size="small" placeholder="字体大小"></n-input-number>
|
||||
</setting-item>
|
||||
</setting-item-box>
|
||||
</collapse-item>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { PropType } from 'vue'
|
||||
import {CollapseItem, SettingItem, SettingItemBox} from '@/components/Pages/ChartItemSetting'
|
||||
import { option } from './config'
|
||||
|
||||
const page = [
|
||||
{label:'2',value:2},
|
||||
{label:'4',value:4},
|
||||
{label:'8',value:8},
|
||||
{label:'10',value:10},
|
||||
{label:'20',value:20}
|
||||
]
|
||||
defineProps({
|
||||
optionData: {
|
||||
type: Object as PropType<typeof option>,
|
||||
required: true
|
||||
}
|
||||
})
|
||||
</script>
|
||||
@@ -0,0 +1,14 @@
|
||||
import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d'
|
||||
import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d'
|
||||
|
||||
export const InputsPaginationConfig: ConfigType = {
|
||||
key: 'InputsPagination',
|
||||
chartKey: 'VInputsPagination',
|
||||
conKey: 'VCInputsPagination',
|
||||
title: '分页',
|
||||
category: ChatCategoryEnum.INPUTS,
|
||||
categoryName: ChatCategoryEnumName.INPUTS,
|
||||
package: PackagesCategoryEnum.INFORMATIONS,
|
||||
chartFrame: ChartFrameEnum.STATIC,
|
||||
image: 'inputs_pagination.png'
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
<template>
|
||||
<div>
|
||||
<n-pagination
|
||||
@on-update:page="onChange" :style="`width:${w}px;`"
|
||||
v-model:page="option.value.pageValue"
|
||||
:page-count="option.value.dataset"
|
||||
:page-slot="7"
|
||||
show-size-picker
|
||||
:page-sizes="option.value.sizeValue"
|
||||
v-model:page-size="option.value.pageSize"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { PropType, toRefs, shallowReactive, watch } from 'vue'
|
||||
import { CreateComponentType } from '@/packages/index.d'
|
||||
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
|
||||
import { useChartInteract } from '@/hooks'
|
||||
import { InteractEventOn } from '@/enums/eventEnum'
|
||||
import { ComponentInteractParamsEnum } from './interact'
|
||||
|
||||
const props = defineProps({
|
||||
chartConfig: {
|
||||
type: Object as PropType<CreateComponentType>,
|
||||
required: true
|
||||
}
|
||||
})
|
||||
|
||||
const { w, h } = toRefs(props.chartConfig.attr)
|
||||
const option = shallowReactive({
|
||||
value: {
|
||||
pageValue: props.chartConfig.option.pageValue,
|
||||
dataset:props.chartConfig.option.dataset,
|
||||
sizeValue:props.chartConfig.option.sizeValue,
|
||||
pageSize:props.chartConfig.option.pageSize
|
||||
}
|
||||
})
|
||||
|
||||
const onChange = (v: number,v2:number) => {
|
||||
if(v == undefined) return;
|
||||
// 存储到联动数据
|
||||
useChartInteract(
|
||||
props.chartConfig,
|
||||
useChartEditStore,
|
||||
{
|
||||
[ComponentInteractParamsEnum.DATA]: v ,
|
||||
[ComponentInteractParamsEnum.DATA2]:v2
|
||||
},
|
||||
InteractEventOn.CHANGE
|
||||
)
|
||||
}
|
||||
|
||||
// 手动更新
|
||||
watch(
|
||||
() => props.chartConfig.option,
|
||||
(newData: any) => {
|
||||
option.value = newData
|
||||
onChange(newData.pageValue,newData.pageSize)
|
||||
},
|
||||
{
|
||||
immediate: true,
|
||||
deep: true
|
||||
}
|
||||
)
|
||||
</script>
|
||||
@@ -0,0 +1,32 @@
|
||||
import { InteractEventOn, InteractActionsType } from '@/enums/eventEnum'
|
||||
|
||||
// 时间组件类型
|
||||
export enum ComponentInteractEventEnum {
|
||||
DATA = 'data'
|
||||
}
|
||||
|
||||
// 联动参数
|
||||
export enum ComponentInteractParamsEnum {
|
||||
DATA = 'data',
|
||||
DATA2 = 'data2'
|
||||
}
|
||||
|
||||
// 定义组件触发回调事件
|
||||
export const interactActions: InteractActionsType[] = [
|
||||
{
|
||||
interactType: InteractEventOn.CHANGE,
|
||||
interactName: '选择完成',
|
||||
componentEmitEvents: {
|
||||
[ComponentInteractEventEnum.DATA]: [
|
||||
{
|
||||
value: ComponentInteractParamsEnum.DATA,
|
||||
label: '页数'
|
||||
},
|
||||
{
|
||||
value: ComponentInteractParamsEnum.DATA2,
|
||||
label: '每页条数'
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -1,8 +1,11 @@
|
||||
<template>
|
||||
<collapse-item name="标签页配置" :expanded="true">
|
||||
<setting-item-box name="默认值" :alone="true">
|
||||
<setting-item-box name="标签类型" :alone="true">
|
||||
<n-select size="small" v-model:value="optionData.tabType" :options="tabTypeOptions" />
|
||||
</setting-item-box>
|
||||
<setting-item-box name="默认值" :alone="true">
|
||||
<n-select size="small" v-model:value="optionData.tabLabel" value-field="label" :options="optionData.dataset" />
|
||||
</setting-item-box>
|
||||
</collapse-item>
|
||||
</template>
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<n-tabs :type="option.value.tabType" @update:value="onChange">
|
||||
<n-tabs :type="option.value.tabType" @update:value="onChange" :default-value="option.value.tabLabel">
|
||||
<n-tab v-for="(item, index) in option.value.dataset" :name="item.label" :key="index"> {{ item.label }} </n-tab>
|
||||
</n-tabs>
|
||||
</template>
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import { InputsDateConfig } from './InputsDate/index'
|
||||
import { InputsSelectConfig } from './InputsSelect/index'
|
||||
import { InputsTabConfig } from './InputsTab/index'
|
||||
import { InputsPaginationConfig } from "./InputsPagination/index";
|
||||
import { InputsInputConfig} from "./InputsInput/index";
|
||||
|
||||
export default [InputsDateConfig, InputsSelectConfig, InputsTabConfig]
|
||||
export default [InputsDateConfig, InputsSelectConfig, InputsTabConfig,InputsPaginationConfig,InputsInputConfig]
|
||||
|
||||
@@ -7,7 +7,8 @@
|
||||
:fallback-src="requireErrorImg()"
|
||||
:width="w"
|
||||
:height="h"
|
||||
></n-image>
|
||||
lazy
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
@@ -1,89 +1,89 @@
|
||||
<template>
|
||||
<collapse-item name="信息" :expanded="true">
|
||||
<setting-item-box name="文字" :alone="true">
|
||||
<setting-item>
|
||||
<n-input v-model:value="optionData.dataset" size="small"></n-input>
|
||||
</setting-item>
|
||||
</setting-item-box>
|
||||
</collapse-item>
|
||||
|
||||
<collapse-item name="样式" :expanded="true">
|
||||
<setting-item-box name="文字">
|
||||
<setting-item name="颜色">
|
||||
<n-color-picker size="small" :modes="['hex']" v-model:value="optionData.fontColor"></n-color-picker>
|
||||
</setting-item>
|
||||
<setting-item name="字体大小">
|
||||
<n-input-number v-model:value="optionData.fontSize" size="small" placeholder="字体大小"></n-input-number>
|
||||
</setting-item>
|
||||
<setting-item name="字体粗细">
|
||||
<n-select v-model:value="optionData.fontWeight" size="small" :options="fontWeightOptions" />
|
||||
</setting-item>
|
||||
|
||||
<setting-item name="字间距">
|
||||
<n-input-number v-model:value="optionData.letterSpacing" size="small" placeholder="输入字间距"></n-input-number>
|
||||
</setting-item>
|
||||
</setting-item-box>
|
||||
<setting-item-box name="阴影">
|
||||
<setting-item>
|
||||
<n-space>
|
||||
<n-switch v-model:value="optionData.showShadow" size="small" />
|
||||
<n-text>展示阴影</n-text>
|
||||
</n-space>
|
||||
</setting-item>
|
||||
<setting-item name="颜色">
|
||||
<n-color-picker size="small" :modes="['hex']" v-model:value="optionData.colorShadow"></n-color-picker
|
||||
></setting-item>
|
||||
<setting-item name="x">
|
||||
<n-input-number v-model:value="optionData.hShadow" size="small"></n-input-number
|
||||
></setting-item>
|
||||
<setting-item name="y">
|
||||
<n-input-number v-model:value="optionData.vShadow" size="small"></n-input-number
|
||||
></setting-item>
|
||||
<setting-item name="模糊">
|
||||
<n-input-number v-model:value="optionData.blurShadow" size="small"></n-input-number
|
||||
></setting-item>
|
||||
</setting-item-box>
|
||||
|
||||
<setting-item-box name="动画">
|
||||
<setting-item name="动画速度">
|
||||
<n-input-number
|
||||
v-model:value="optionData.animationSpeed"
|
||||
size="small"
|
||||
placeholder="动画速度"
|
||||
:min="0"
|
||||
></n-input-number>
|
||||
</setting-item>
|
||||
<setting-item name="动画间隔">
|
||||
<n-input-number
|
||||
v-model:value="optionData.animationTime"
|
||||
size="small"
|
||||
placeholder="动画间隔"
|
||||
:min="0"
|
||||
></n-input-number>
|
||||
</setting-item>
|
||||
</setting-item-box>
|
||||
</collapse-item>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { PropType } from 'vue'
|
||||
import { option, FontWeightEnum, FontWeightObject } from './config'
|
||||
import { CollapseItem, SettingItemBox, SettingItem } from '@/components/Pages/ChartItemSetting'
|
||||
const props = defineProps({
|
||||
optionData: {
|
||||
type: Object as PropType<typeof option>,
|
||||
required: true
|
||||
}
|
||||
})
|
||||
|
||||
const fontWeightOptions = [
|
||||
{
|
||||
label: FontWeightEnum.NORMAL,
|
||||
value: FontWeightObject[FontWeightEnum.NORMAL]
|
||||
},
|
||||
{
|
||||
label: FontWeightEnum.BOLD,
|
||||
value: FontWeightObject[FontWeightEnum.BOLD]
|
||||
}
|
||||
]
|
||||
</script>
|
||||
<template>
|
||||
<collapse-item name="信息" :expanded="true">
|
||||
<setting-item-box name="文字" :alone="true">
|
||||
<setting-item>
|
||||
<n-input v-model:value="optionData.dataset" type="textarea" size="small"></n-input>
|
||||
</setting-item>
|
||||
</setting-item-box>
|
||||
</collapse-item>
|
||||
|
||||
<collapse-item name="样式" :expanded="true">
|
||||
<setting-item-box name="文字">
|
||||
<setting-item name="颜色">
|
||||
<n-color-picker size="small" :modes="['hex']" v-model:value="optionData.fontColor"></n-color-picker>
|
||||
</setting-item>
|
||||
<setting-item name="字体大小">
|
||||
<n-input-number v-model:value="optionData.fontSize" size="small" placeholder="字体大小"></n-input-number>
|
||||
</setting-item>
|
||||
<setting-item name="字体粗细">
|
||||
<n-select v-model:value="optionData.fontWeight" size="small" :options="fontWeightOptions" />
|
||||
</setting-item>
|
||||
|
||||
<setting-item name="字间距">
|
||||
<n-input-number v-model:value="optionData.letterSpacing" size="small" placeholder="输入字间距"></n-input-number>
|
||||
</setting-item>
|
||||
</setting-item-box>
|
||||
<setting-item-box name="阴影">
|
||||
<setting-item>
|
||||
<n-space>
|
||||
<n-switch v-model:value="optionData.showShadow" size="small" />
|
||||
<n-text>展示阴影</n-text>
|
||||
</n-space>
|
||||
</setting-item>
|
||||
<setting-item name="颜色">
|
||||
<n-color-picker size="small" :modes="['hex']" v-model:value="optionData.colorShadow"></n-color-picker
|
||||
></setting-item>
|
||||
<setting-item name="x">
|
||||
<n-input-number v-model:value="optionData.hShadow" size="small"></n-input-number
|
||||
></setting-item>
|
||||
<setting-item name="y">
|
||||
<n-input-number v-model:value="optionData.vShadow" size="small"></n-input-number
|
||||
></setting-item>
|
||||
<setting-item name="模糊">
|
||||
<n-input-number v-model:value="optionData.blurShadow" size="small"></n-input-number
|
||||
></setting-item>
|
||||
</setting-item-box>
|
||||
|
||||
<setting-item-box name="动画">
|
||||
<setting-item name="动画速度">
|
||||
<n-input-number
|
||||
v-model:value="optionData.animationSpeed"
|
||||
size="small"
|
||||
placeholder="动画速度"
|
||||
:min="0"
|
||||
></n-input-number>
|
||||
</setting-item>
|
||||
<setting-item name="动画间隔">
|
||||
<n-input-number
|
||||
v-model:value="optionData.animationTime"
|
||||
size="small"
|
||||
placeholder="动画间隔"
|
||||
:min="0"
|
||||
></n-input-number>
|
||||
</setting-item>
|
||||
</setting-item-box>
|
||||
</collapse-item>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { PropType } from 'vue'
|
||||
import { option, FontWeightEnum, FontWeightObject } from './config'
|
||||
import { CollapseItem, SettingItemBox, SettingItem } from '@/components/Pages/ChartItemSetting'
|
||||
const props = defineProps({
|
||||
optionData: {
|
||||
type: Object as PropType<typeof option>,
|
||||
required: true
|
||||
}
|
||||
})
|
||||
|
||||
const fontWeightOptions = [
|
||||
{
|
||||
label: FontWeightEnum.NORMAL,
|
||||
value: FontWeightObject[FontWeightEnum.NORMAL]
|
||||
},
|
||||
{
|
||||
label: FontWeightEnum.BOLD,
|
||||
value: FontWeightObject[FontWeightEnum.BOLD]
|
||||
}
|
||||
]
|
||||
</script>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<collapse-item name="信息" :expanded="true">
|
||||
<setting-item-box name="文字" :alone="true">
|
||||
<setting-item>
|
||||
<n-input v-model:value="optionData.dataset" size="small"></n-input>
|
||||
<n-input v-model:value="optionData.dataset" type="textarea" size="small"></n-input>
|
||||
</setting-item>
|
||||
</setting-item-box>
|
||||
<setting-item-box name="链接" :alone="true">
|
||||
@@ -30,11 +30,7 @@
|
||||
<n-input-number v-model:value="optionData.fontSize" size="small" placeholder="字体大小"></n-input-number>
|
||||
</setting-item>
|
||||
<setting-item name="字体粗细">
|
||||
<n-select
|
||||
v-model:value="optionData.fontWeight"
|
||||
size="small"
|
||||
:options="fontWeightOptions"
|
||||
/>
|
||||
<n-select v-model:value="optionData.fontWeight" size="small" :options="fontWeightOptions" />
|
||||
</setting-item>
|
||||
<setting-item name="X轴内边距">
|
||||
<n-input-number v-model:value="optionData.paddingX" size="small" placeholder="输入内边距"></n-input-number>
|
||||
@@ -87,9 +83,7 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { PropType } from 'vue'
|
||||
import { option, WritingModeEnum, WritingModeObject,
|
||||
FontWeightEnum,
|
||||
FontWeightObject, } from './config'
|
||||
import { option, WritingModeEnum, WritingModeObject, FontWeightEnum, FontWeightObject } from './config'
|
||||
import { CollapseItem, SettingItemBox, SettingItem } from '@/components/Pages/ChartItemSetting'
|
||||
const props = defineProps({
|
||||
optionData: {
|
||||
@@ -117,13 +111,13 @@ const verticalOptions = [
|
||||
const fontWeightOptions = [
|
||||
{
|
||||
label: FontWeightEnum.NORMAL,
|
||||
value: FontWeightObject[FontWeightEnum.NORMAL],
|
||||
value: FontWeightObject[FontWeightEnum.NORMAL]
|
||||
},
|
||||
{
|
||||
label: FontWeightEnum.BOLD,
|
||||
value: FontWeightObject[FontWeightEnum.BOLD],
|
||||
},
|
||||
];
|
||||
value: FontWeightObject[FontWeightEnum.BOLD]
|
||||
}
|
||||
]
|
||||
const handleLinkClick = () => {
|
||||
window.open(props.optionData.linkHead + props.optionData.link)
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<template>
|
||||
<div class="go-text-box">
|
||||
<div class="content">
|
||||
<span style="cursor: pointer" v-if="link" @click="click">{{ option.dataset }}</span>
|
||||
<span v-else>{{ option.dataset }}</span>
|
||||
<span style="cursor: pointer; white-space: pre-wrap" v-if="link" @click="click">{{ option.dataset }}</span>
|
||||
<span style="white-space: pre-wrap" v-else>{{ option.dataset }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -82,7 +82,7 @@ const click = () => {
|
||||
border-width: v-bind('borderWidth + "px"');
|
||||
border-radius: v-bind('borderRadius + "px"');
|
||||
border-color: v-bind('borderColor');
|
||||
|
||||
|
||||
background-color: v-bind('backgroundColor');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,45 +1,45 @@
|
||||
<template>
|
||||
<collapse-item name="信息" :expanded="true">
|
||||
<setting-item-box name="文字" :alone="true">
|
||||
<setting-item>
|
||||
<n-input v-model:value="optionData.dataset" size="small"></n-input>
|
||||
</setting-item>
|
||||
</setting-item-box>
|
||||
</collapse-item>
|
||||
<collapse-item name="样式" :expanded="true">
|
||||
<setting-item-box name="文字">
|
||||
<setting-item name="字体大小">
|
||||
<n-input-number v-model:value="optionData.size" size="small" placeholder="字体大小"></n-input-number>
|
||||
</setting-item>
|
||||
</setting-item-box>
|
||||
<setting-item-box name="渐变色参数">
|
||||
<setting-item name="起始值">
|
||||
<n-color-picker size="small" :modes="['hex']" v-model:value="optionData.gradient.from"></n-color-picker>
|
||||
</setting-item>
|
||||
<setting-item name="结束值">
|
||||
<n-color-picker size="small" :modes="['hex']" v-model:value="optionData.gradient.to"></n-color-picker>
|
||||
</setting-item>
|
||||
<setting-item name="偏移角度">
|
||||
<n-input-number v-model:value="optionData.gradient.deg" size="small" placeholder="颜色旋转"></n-input-number>
|
||||
</setting-item>
|
||||
</setting-item-box>
|
||||
|
||||
</collapse-item>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { PropType } from 'vue'
|
||||
import { option } from './config'
|
||||
import {
|
||||
CollapseItem,
|
||||
SettingItemBox,
|
||||
SettingItem
|
||||
} from '@/components/Pages/ChartItemSetting'
|
||||
|
||||
const props = defineProps({
|
||||
optionData: {
|
||||
type: Object as PropType<typeof option>,
|
||||
required: true
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<template>
|
||||
<collapse-item name="信息" :expanded="true">
|
||||
<setting-item-box name="文字" :alone="true">
|
||||
<setting-item>
|
||||
<n-input v-model:value="optionData.dataset" type="textarea" size="small"></n-input>
|
||||
</setting-item>
|
||||
</setting-item-box>
|
||||
</collapse-item>
|
||||
<collapse-item name="样式" :expanded="true">
|
||||
<setting-item-box name="文字">
|
||||
<setting-item name="字体大小">
|
||||
<n-input-number v-model:value="optionData.size" size="small" placeholder="字体大小"></n-input-number>
|
||||
</setting-item>
|
||||
</setting-item-box>
|
||||
<setting-item-box name="渐变色参数">
|
||||
<setting-item name="起始值">
|
||||
<n-color-picker size="small" :modes="['hex']" v-model:value="optionData.gradient.from"></n-color-picker>
|
||||
</setting-item>
|
||||
<setting-item name="结束值">
|
||||
<n-color-picker size="small" :modes="['hex']" v-model:value="optionData.gradient.to"></n-color-picker>
|
||||
</setting-item>
|
||||
<setting-item name="偏移角度">
|
||||
<n-input-number v-model:value="optionData.gradient.deg" size="small" placeholder="颜色旋转"></n-input-number>
|
||||
</setting-item>
|
||||
</setting-item-box>
|
||||
|
||||
</collapse-item>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { PropType } from 'vue'
|
||||
import { option } from './config'
|
||||
import {
|
||||
CollapseItem,
|
||||
SettingItemBox,
|
||||
SettingItem
|
||||
} from '@/components/Pages/ChartItemSetting'
|
||||
|
||||
const props = defineProps({
|
||||
optionData: {
|
||||
type: Object as PropType<typeof option>,
|
||||
required: true
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
91
src/packages/components/Photos/Private/index.ts
Normal file
@@ -0,0 +1,91 @@
|
||||
import { ChartFrameEnum, ConfigType, PackagesCategoryEnum } from '@/packages/index.d'
|
||||
import { ImageConfig } from '@/packages/components/Informations/Mores/Image/index'
|
||||
import { ChatCategoryEnum, ChatCategoryEnumName } from '../index.d'
|
||||
import { setLocalStorage, getLocalStorage, goDialog } from '@/utils'
|
||||
import { StorageEnum } from '@/enums/storageEnum'
|
||||
import { FileTypeEnum } from '@/enums/fileTypeEnum'
|
||||
import { backgroundImageSize } from '@/settings/designSetting'
|
||||
import { usePackagesStore } from '@/store/modules/packagesStore/packagesStore'
|
||||
|
||||
const StoreKey = StorageEnum.GO_USER_MEDIA_PHOTOS
|
||||
|
||||
/**
|
||||
* 上传完成事件类型
|
||||
*/
|
||||
type UploadCompletedEventType = {
|
||||
fileName: string
|
||||
url: string
|
||||
}
|
||||
|
||||
const userPhotosList: ConfigType[] = getLocalStorage(StoreKey) || []
|
||||
|
||||
const uploadFile = (callback: Function | null = null) => {
|
||||
const input = document.createElement('input')
|
||||
input.type = 'file'
|
||||
input.accept = '.png,.jpg,.jpeg,.gif' // 这里只允许部分图片类型
|
||||
input.onchange = async () => {
|
||||
if (!input.files || !input.files.length) return
|
||||
const file = input.files[0]
|
||||
const { name, size, type } = file
|
||||
if (size > 1024 * 1024 * backgroundImageSize) {
|
||||
window['$message'].warning(`图片超出 ${backgroundImageSize}M 限制,请重新上传!`)
|
||||
return false
|
||||
}
|
||||
if (type !== FileTypeEnum.PNG && type !== FileTypeEnum.JPEG && type !== FileTypeEnum.GIF) {
|
||||
window['$message'].warning('文件格式不符合,请重新上传!')
|
||||
return false
|
||||
}
|
||||
const reader = new FileReader()
|
||||
reader.onload = () => {
|
||||
const eventObj: UploadCompletedEventType = { fileName: name, url: reader.result as string }
|
||||
callback && callback(eventObj)
|
||||
}
|
||||
reader.readAsDataURL(file)
|
||||
}
|
||||
input.click()
|
||||
}
|
||||
|
||||
const addConfig = {
|
||||
...ImageConfig,
|
||||
category: ChatCategoryEnum.PRIVATE,
|
||||
categoryName: ChatCategoryEnumName.PRIVATE,
|
||||
package: PackagesCategoryEnum.PHOTOS,
|
||||
chartFrame: ChartFrameEnum.STATIC,
|
||||
title: '点击上传图片',
|
||||
image: 'upload.png',
|
||||
redirectComponent: `${ImageConfig.package}/${ImageConfig.category}/${ImageConfig.key}`, // 跳转组件路径规则:packageName/categoryName/componentKey
|
||||
disabled: true,
|
||||
configEvents: {
|
||||
// 点击上传事件
|
||||
addHandle: (photoConfig: ConfigType) => {
|
||||
goDialog({
|
||||
message: `图片需小于 ${backgroundImageSize}M 且只暂存在浏览器中。当前图片暂存上限5M,超过不再缓存新图片,请自行对接后端接口!现编译成 base64 进行渲染,对接后端后请使用【URL地址】进行交互!`,
|
||||
transformOrigin: 'center',
|
||||
onPositiveCallback: () => {
|
||||
uploadFile((e: UploadCompletedEventType) => {
|
||||
// 和上传组件一样配置,更换标题,图片,预设数据
|
||||
const packagesStore = usePackagesStore()
|
||||
const newPhoto = {
|
||||
...ImageConfig,
|
||||
category: ChatCategoryEnum.PRIVATE,
|
||||
categoryName: ChatCategoryEnumName.PRIVATE,
|
||||
package: PackagesCategoryEnum.PHOTOS,
|
||||
chartFrame: ChartFrameEnum.STATIC,
|
||||
title: e.fileName,
|
||||
image: e.url,
|
||||
dataset: e.url,
|
||||
redirectComponent: `${ImageConfig.package}/${ImageConfig.category}/${ImageConfig.key}` // 跳转组件路径规则:packageName/categoryName/componentKey
|
||||
}
|
||||
userPhotosList.unshift(newPhoto)
|
||||
// 存储在本地数据中
|
||||
setLocalStorage(StoreKey, userPhotosList)
|
||||
// 插入到上传按钮前的位置
|
||||
packagesStore.addPhotos(newPhoto, 1)
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default [addConfig, ...userPhotosList]
|
||||
23
src/packages/components/Photos/Share/index.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { ChartFrameEnum, PackagesCategoryEnum } from '@/packages/index.d'
|
||||
import { ImageConfig } from '@/packages/components/Informations/Mores/Image/index'
|
||||
import { ChatCategoryEnum, ChatCategoryEnumName } from '../index.d'
|
||||
|
||||
// 远程共享库(调接口获取图像列表)
|
||||
const imageList = [
|
||||
{ imageName: 'carousel1', imageUrl: 'https://naive-ui.oss-cn-beijing.aliyuncs.com/carousel-img/carousel1.jpeg' },
|
||||
{ imageName: 'carousel2', imageUrl: 'https://naive-ui.oss-cn-beijing.aliyuncs.com/carousel-img/carousel2.jpeg' }
|
||||
]
|
||||
|
||||
const photoConfigList = imageList.map(i => ({
|
||||
...ImageConfig,
|
||||
category: ChatCategoryEnum.SHARE,
|
||||
categoryName: ChatCategoryEnumName.SHARE,
|
||||
package: PackagesCategoryEnum.PHOTOS,
|
||||
chartFrame: ChartFrameEnum.STATIC,
|
||||
image: i.imageUrl,
|
||||
dataset: i.imageUrl,
|
||||
title: i.imageName,
|
||||
redirectComponent: `${ImageConfig.package}/${ImageConfig.category}/${ImageConfig.key}` // 跳转组件路径规则:packageName/categoryName/componentKey
|
||||
}))
|
||||
|
||||
export default photoConfigList
|
||||