main
wwl 2024-05-08 13:41:28 +08:00
parent 21a629b4fb
commit d233857ce2
2 changed files with 85 additions and 74 deletions

View File

@ -543,9 +543,9 @@ const title = (tit) => {
</el-icon>
</div>
<div class="bottomclom" v-if="showDropdown1">
<div v-if="dataLeft" v-for="item in dataLeft">
<span class="container" @click="handleSelect(item)">{{ item.title }}</span>
<el-dropdown max-height="100px" @command="down">
<div v-if="dataLeft" v-for="item in dataLeft[0].fileList">
<span class="container" @click="down({ it: item })">{{ item.name }}</span>
<!-- <el-dropdown max-height="100px" @command="down">
<el-icon size="25">
<CaretBottom />
</el-icon>
@ -560,7 +560,7 @@ const title = (tit) => {
>
</el-dropdown-menu>
</template>
</el-dropdown>
</el-dropdown> -->
</div>
</div>
</AppBlock>
@ -573,7 +573,7 @@ const title = (tit) => {
class="mt20px mx10px h60px flex items-center justify-center rd-30px text-24px text-#fff bg-#000/45"
>
<p
:alt="form.lable1.title"
:alt="form.lable2.title"
style="width: 300px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis"
>
<n-popover trigger="hover" placement="top-start">
@ -585,7 +585,7 @@ const title = (tit) => {
class="!h-20px !w-auto mr-2"
alt=""
/>
<span>{{ form.lable1.title }}</span>
<span>{{ form.lable2.title }}</span>
</div>
<!-- {{ form.lable2.title }} -->
</template>
@ -617,14 +617,14 @@ const title = (tit) => {
</el-icon>
</div>
<div class="bottomclom" v-if="showDropdown2">
<div v-if="dataRight" v-for="item in dataRight">
<span class="container" @click="handleSelect2(item)">{{ item.title }}</span>
<el-dropdown max-height="100px" @command="down">
<el-icon size="25">
<CaretBottom />
</el-icon>
<div v-if="dataRight" v-for="ite in dataRight[0].fileList">
<span class="container" @click="down({ it: ite })">{{ ite.name }}</span>
<!-- <el-dropdown max-height="100px" @command="down"> -->
<!-- <el-icon size="25">
<CaretBottom />
</el-icon> -->
<template #dropdown>
<!-- <template #dropdown>
<el-dropdown-menu>
<el-dropdown-item
v-if="item.fileList"
@ -633,8 +633,8 @@ const title = (tit) => {
>{{ it.name }}</el-dropdown-item
>
</el-dropdown-menu>
</template>
</el-dropdown>
</template> -->
<!-- </el-dropdown> -->
</div>
</div>
</AppBlock>

View File

@ -1,65 +1,76 @@
import * as echarts from "echarts";
import {topStat} from '@/api/daikin/base'
import {getPreviousMonths} from '@/utils/format'
import * as echarts from 'echarts'
import { topStat } from '@/api/daikin/base'
import { getPreviousMonths } from '@/utils/format'
function formatDate(inputDate: string) {
const dateRegex = /^(\d{4})-(\d{2})$/
const match = inputDate.match(dateRegex)
const dateRegex = /^(\d{4})-(\d{2})$/
const match = inputDate.match(dateRegex)
if (match) {
const year = match[1]
let month = match[2]
if (month.startsWith('0')) {
month = month.substring(1)
}
return `${year}${month}`
} else {
return inputDate
}
if (match) {
const year = match[1]
let month = match[2]
if (month.startsWith('0')) {
month = month.substring(1)
}
return `${year}${month}`
} else {
return inputDate
}
}
export function useChart21() {
const chartRef = ref()
const optionRef = ref()
getData()
async function getData() {
const { data } = await topStat()
const chartRef = ref()
const optionRef = ref()
getData()
async function getData() {
const { data } = await topStat()
const option = {
legend: {},
title: {
text: '件',
textStyle: { fontSize: 14, fontWeight: 500 },
subtext: '数',
subtextStyle: { fontSize: 14, fontWeight: 500, color: '#000' },
top: '45%'
},
tooltip: {
trigger: 'axis',
axisPointer: {
animation: false
}
},
grid: {
left: '6%',
right: '4%',
bottom: '5%',
containLabel: true
},
yAxis: {
type: 'value',
show: true
},
xAxis: {
type: 'category',
data: data[0]?.month
? data[0].month.map((item: any) => {
return formatDate(item)
})
: []
},
series: data
}
optionRef.value = option
}
return { chartRef, option: optionRef }
}
const option = {
legend: {
orient: 'vertical',
right: 0,
top: '40%',
itemgrap: 10,
textStyle: {
width: 50,
overflow: 'break'
},
itemStyle: {}
},
title: {
text: '件',
textStyle: { fontSize: 14, fontWeight: 500 },
subtext: '数',
subtextStyle: { fontSize: 14, fontWeight: 500, color: '#000' },
top: '45%'
},
tooltip: {
trigger: 'axis',
axisPointer: {
animation: false
}
},
grid: {
top: '5%',
left: '6%',
right: '24%',
bottom: '5%',
containLabel: true
},
yAxis: {
type: 'value',
show: true
},
xAxis: {
type: 'category',
data: data[0]?.month
? data[0].month.map((item: any) => {
return formatDate(item)
})
: []
},
series: data
}
optionRef.value = option
}
return { chartRef, option: optionRef }
}