2024-06-22 10:54:02 +08:00
|
|
|
<script lang="ts" setup>
|
|
|
|
import {charts} from "~/config/charts";
|
2024-07-23 17:34:23 +08:00
|
|
|
import { ArrowRight,ArrowLeft } from 'lucide-vue-next';
|
|
|
|
import {useMainLayoutStore} from "~/strores/UseMainLayoutStore";
|
|
|
|
import type { CascaderOption } from 'naive-ui'
|
|
|
|
|
|
|
|
const current = ref<number | undefined>(1)
|
|
|
|
const selectChart = ref<number>(0)
|
|
|
|
const mainLayoutStore=useMainLayoutStore()
|
|
|
|
const options=ref<CascaderOption[]>([])
|
|
|
|
const value=ref<number|string|null>(null)
|
|
|
|
const prev=()=>{
|
|
|
|
if (current.value === 0)
|
|
|
|
current.value = undefined
|
|
|
|
else if (!current.value)
|
|
|
|
current.value = 4
|
|
|
|
else current.value--
|
|
|
|
}
|
|
|
|
const next=()=>{
|
|
|
|
if (current.value === 4)
|
|
|
|
current.value=4
|
|
|
|
else if (!current.value)
|
|
|
|
current.value = 1
|
|
|
|
else current.value++
|
2024-06-22 10:54:02 +08:00
|
|
|
}
|
|
|
|
onMounted(() => {
|
|
|
|
$fetch('/Api/Job/GetJobList', {
|
|
|
|
method: 'GET',
|
|
|
|
headers: {
|
|
|
|
'Content-Type': 'application/json',
|
|
|
|
'Authorization': 'Bearer ' + useCookie('token').value
|
|
|
|
},
|
|
|
|
params: {
|
2024-07-23 12:51:10 +08:00
|
|
|
serverId: mainLayoutStore.SelectServer.value
|
2024-06-22 10:54:02 +08:00
|
|
|
},
|
|
|
|
baseURL: useRuntimeConfig().public.baseUrl
|
|
|
|
}).then(res => {
|
|
|
|
console.log(res)
|
2024-07-23 17:34:23 +08:00
|
|
|
const data=res as any[]
|
|
|
|
data.forEach(d=>{
|
|
|
|
options.value.push({label:d.groupName,value:d.groupName, children:d.items.map(r=>{return {label:r.dataName,value:r.dataType}})})
|
|
|
|
console.log(options.value)
|
2024-06-22 10:54:02 +08:00
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<div class="setting-card-layout">
|
2024-07-23 17:34:23 +08:00
|
|
|
<n-steps v-model:current="current" class="setting-card-header">
|
|
|
|
<n-step
|
|
|
|
title="选择图表"
|
|
|
|
/>
|
|
|
|
<n-step
|
|
|
|
title="选择数据"
|
|
|
|
/>
|
|
|
|
<n-step
|
|
|
|
title="设置卡片"
|
|
|
|
/>
|
|
|
|
<n-step
|
|
|
|
title="预览"
|
|
|
|
/>
|
|
|
|
</n-steps>
|
|
|
|
<div class="setting-card-content">
|
|
|
|
<n-scrollbar>
|
|
|
|
<div v-if="current===1" class="step1-box">
|
|
|
|
<div v-for="(chart,index) in charts" :class="{'chart-box':true,'chart-box-active':selectChart===index}" @click="selectChart=index" :key="index">
|
|
|
|
<n-image
|
|
|
|
width="100"
|
|
|
|
:src="chart.image"
|
|
|
|
/>
|
|
|
|
<p>{{chart.description}}</p>
|
2024-06-22 10:54:02 +08:00
|
|
|
</div>
|
|
|
|
</div>
|
2024-07-23 17:34:23 +08:00
|
|
|
<div v-if="current===2" class="step2-box">
|
|
|
|
<n-cascader
|
|
|
|
v-model:value="value"
|
|
|
|
placeholder="没啥用的值"
|
|
|
|
expand-trigger="click"
|
|
|
|
:options="options"
|
|
|
|
|
|
|
|
check-strategy="child"
|
|
|
|
/>
|
2024-06-22 10:54:02 +08:00
|
|
|
</div>
|
2024-07-23 17:34:23 +08:00
|
|
|
<!-- 空布局-->
|
|
|
|
<n-empty description="你什么也找不到" v-if="current&¤t>= 5||current&¤t<=0">
|
|
|
|
</n-empty>
|
|
|
|
</n-scrollbar>
|
2024-06-22 10:54:02 +08:00
|
|
|
</div>
|
2024-07-23 17:34:23 +08:00
|
|
|
<div class="setting-card-folder">
|
|
|
|
<n-button @click="prev" quaternary type="info" v-if="current!==1">
|
|
|
|
<template #icon>
|
|
|
|
<n-icon>
|
|
|
|
<ArrowLeft />
|
|
|
|
</n-icon>
|
|
|
|
</template>
|
|
|
|
上一步
|
|
|
|
</n-button>
|
|
|
|
<n-button @click="next" type="info">
|
|
|
|
<template #icon>
|
|
|
|
<n-icon>
|
|
|
|
<ArrowRight />
|
|
|
|
</n-icon>
|
|
|
|
</template>
|
|
|
|
下一步
|
|
|
|
</n-button>
|
2024-06-22 10:54:02 +08:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
@import "base";
|
|
|
|
|
|
|
|
.setting-card-layout {
|
|
|
|
width: 100%;
|
|
|
|
display: grid;
|
|
|
|
padding: $padding*2;
|
|
|
|
grid-template-rows: auto auto 1fr auto;
|
2024-07-23 17:34:23 +08:00
|
|
|
gap: $gap*5;
|
2024-06-22 10:54:02 +08:00
|
|
|
background: $light-bg-color;
|
|
|
|
border-radius: $radius*2;
|
2024-07-23 17:34:23 +08:00
|
|
|
*{
|
|
|
|
@include SC_Font()
|
|
|
|
}
|
2024-06-22 10:54:02 +08:00
|
|
|
.dark-mode & {
|
|
|
|
background: $dark-bg-color;
|
|
|
|
}
|
|
|
|
}
|
2024-07-23 17:34:23 +08:00
|
|
|
.setting-card-header{
|
2024-06-22 10:54:02 +08:00
|
|
|
|
|
|
|
}
|
2024-07-23 17:34:23 +08:00
|
|
|
.setting-card-content {
|
|
|
|
min-height: 400px;
|
|
|
|
max-height: 800px;
|
2024-06-22 10:54:02 +08:00
|
|
|
}
|
2024-07-23 17:34:23 +08:00
|
|
|
.step1-box{
|
2024-06-22 10:54:02 +08:00
|
|
|
display: grid;
|
|
|
|
gap: $gap*2;
|
2024-07-23 17:34:23 +08:00
|
|
|
grid-template-columns: repeat(3,1fr);
|
|
|
|
place-content: center;
|
|
|
|
place-items: center;
|
|
|
|
.chart-box{
|
2024-06-22 10:54:02 +08:00
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
gap: $gap;
|
2024-07-23 17:34:23 +08:00
|
|
|
font-size: 12px;
|
|
|
|
font-weight: 900;
|
|
|
|
justify-content: center;
|
2024-06-22 10:54:02 +08:00
|
|
|
align-items: center;
|
2024-07-23 17:34:23 +08:00
|
|
|
cursor: pointer;
|
|
|
|
background: rgba(238, 238, 238, 0.1);
|
|
|
|
border: $border;
|
|
|
|
height: 140px;
|
|
|
|
border-radius: $radius*2;
|
|
|
|
width: 140px;
|
2024-06-22 10:54:02 +08:00
|
|
|
}
|
|
|
|
|
2024-07-23 17:34:23 +08:00
|
|
|
.chart-box-active{
|
|
|
|
border-color: $primary-color;
|
|
|
|
background: rgba(238, 238, 238, 1);
|
2024-06-22 10:54:02 +08:00
|
|
|
}
|
|
|
|
}
|
2024-07-23 17:34:23 +08:00
|
|
|
.setting-card-folder{
|
|
|
|
display: flex;
|
2024-06-22 10:54:02 +08:00
|
|
|
gap: $gap*2;
|
2024-07-23 17:34:23 +08:00
|
|
|
button{
|
|
|
|
flex: 1;
|
2024-06-22 10:54:02 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2024-07-23 17:34:23 +08:00
|
|
|
:deep(.n-cascader-menu .n-cascader-submenu.n-cascader-submenu--virtual){
|
|
|
|
width: auto;
|
2024-06-22 10:54:02 +08:00
|
|
|
}
|
|
|
|
</style>
|