fuguobin
1 year ago
11 changed files with 206 additions and 73 deletions
@ -0,0 +1,14 @@ |
|||||
|
.details { |
||||
|
padding: 1.5rem; |
||||
|
.search { |
||||
|
margin-bottom: 1.5rem; |
||||
|
} |
||||
|
.echart { |
||||
|
.comparisonInfo { |
||||
|
.stackedLine { |
||||
|
width: 100%; |
||||
|
height: 500px; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
@ -1,62 +1,187 @@ |
|||||
<template> |
<template> |
||||
<div class="roleContainer"> |
<div class="details"> |
||||
<el-card class="search" shadow="always"> |
<el-card class="search" shadow="always"> |
||||
<el-form ref="queryFormRef" :model="searchForm" :inline="true"> |
<el-form ref="searchRef" :inline="true" :model="searchForm" label-width="100px" class="demo-ruleForm"> |
||||
<el-form-item label="关键字" prop="keywords"> |
<el-form-item label="时间" prop="time"> |
||||
<el-input |
<el-date-picker |
||||
v-model="searchForm.keywords" |
v-model="searchForm.time" |
||||
clearable |
type="datetimerange" |
||||
style="width: 200px" |
start-placeholder="开始时间" |
||||
placeholder="用户名/昵称/手机号" |
end-placeholder="结束时间" |
||||
@keyup.enter="getUserData" |
:default-time="defaultTime1" |
||||
/> |
/> |
||||
</el-form-item> |
</el-form-item> |
||||
|
<el-form-item label="颗粒度" prop="particle"> |
||||
|
<el-select v-model="searchForm.particle" placeholder="请选择"> |
||||
|
<el-option v-for="item in optionss" :key="item.value" :label="item.label" :value="item.value" /> |
||||
|
</el-select> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="设备" prop="device"> |
||||
|
<el-select v-model="searchForm.device" placeholder="请选择"> |
||||
|
<el-option v-for="item in optionss" :key="item.value" :label="item.label" :value="item.value" /> |
||||
|
</el-select> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="参数" prop="parameter"> |
||||
|
<el-select v-model="searchForm.parameter" placeholder="请选择"> |
||||
|
<el-option v-for="item in optionss" :key="item.value" :label="item.label" :value="item.value" /> |
||||
|
</el-select> |
||||
|
</el-form-item> |
||||
<el-form-item> |
<el-form-item> |
||||
<el-button type="primary" @click="getUserData"><i-ep-search />搜索</el-button> |
<el-button type="primary" @click="submitForm(searchRef)">确认</el-button> |
||||
<el-button @click="resetClick"><i-ep-refresh />重置</el-button> |
<el-button @click="resetForm(searchRef)">重置</el-button> |
||||
</el-form-item> |
</el-form-item> |
||||
</el-form> |
</el-form> |
||||
</el-card> |
</el-card> |
||||
<el-card class="list" shadow="always"> 内容 </el-card> |
<el-card class="echart" shadow="always"> |
||||
|
<div class="comparisonInfo"> |
||||
|
<div ref="stackedRef" class="stackedLine" /> |
||||
|
</div> |
||||
|
</el-card> |
||||
</div> |
</div> |
||||
</template> |
</template> |
||||
|
|
||||
<script lang="ts" setup> |
<script lang="ts" setup> |
||||
// import { getRolePage } from '@/api/role'; |
import * as echarts from 'echarts'; |
||||
// import { listMenuOptions } from '@/api/menu'; |
import { Ref } from 'vue'; |
||||
// import { RolePageVO, RoleForm, RoleQuery } from '@/api/role/types'; |
const stackedRef: Ref<HTMLElement | any> = ref(null); |
||||
|
import type { FormInstance } from 'element-plus'; |
||||
|
|
||||
// const queryFormRef = ref(ElForm); |
const searchRef = ref<FormInstance>(); |
||||
// const roleData = ref<RolePageVO[]>(); |
const defaultTime1 = new Date(2000, 1, 1, 12, 0, 0); // '12:00:00' |
||||
// const searchForm = reactive<RoleQuery>({ |
const searchForm = reactive({ |
||||
// pageNum: 1, |
time: '', |
||||
// pageSize: 10 |
particle: '', |
||||
// }); |
device: '', |
||||
|
parameter: '' |
||||
|
}); |
||||
|
|
||||
onMounted(() => { |
const submitForm = (formEl: FormInstance | undefined) => { |
||||
// getUserData(); |
if (!formEl) return; |
||||
|
formEl.validate(valid => { |
||||
|
if (valid) { |
||||
|
console.log('submit!'); |
||||
|
} else { |
||||
|
console.log('error submit!'); |
||||
|
return false; |
||||
|
} |
||||
}); |
}); |
||||
|
}; |
||||
|
|
||||
//列表数据 |
const resetForm = (formEl: FormInstance | undefined) => { |
||||
// function getUserData() { |
if (!formEl) return; |
||||
// loading.value = true; |
formEl.resetFields(); |
||||
// getRolePage(searchForm) |
}; |
||||
// .then(({ data }) => { |
const optionss = [ |
||||
// // roleData.value = data.list; |
{ |
||||
// }) |
value: 'Option1', |
||||
// .finally(() => { |
label: 'Option1' |
||||
// loading.value = false; |
}, |
||||
// }); |
{ |
||||
// } |
value: 'Option2', |
||||
|
label: 'Option2' |
||||
|
}, |
||||
|
{ |
||||
|
value: 'Option3', |
||||
|
label: 'Option3' |
||||
|
}, |
||||
|
{ |
||||
|
value: 'Option4', |
||||
|
label: 'Option4' |
||||
|
}, |
||||
|
{ |
||||
|
value: 'Option5', |
||||
|
label: 'Option5' |
||||
|
} |
||||
|
]; |
||||
|
|
||||
//搜索 |
const options = { |
||||
// function resetClick() { |
title: { |
||||
// queryFormRef.value.resetFields(); |
text: 'Temperature Change in the Coming Week' |
||||
// searchForm.pageNum = 1; |
}, |
||||
// getUserData(); |
tooltip: { |
||||
// } |
trigger: 'axis' |
||||
</script> |
}, |
||||
|
legend: {}, |
||||
|
toolbox: { |
||||
|
show: true, |
||||
|
feature: { |
||||
|
dataZoom: { |
||||
|
yAxisIndex: 'none' |
||||
|
}, |
||||
|
dataView: { readOnly: false }, |
||||
|
magicType: { type: ['line', 'bar'] }, |
||||
|
restore: {}, |
||||
|
saveAsImage: {} |
||||
|
} |
||||
|
}, |
||||
|
xAxis: { |
||||
|
type: 'category', |
||||
|
boundaryGap: false, |
||||
|
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] |
||||
|
}, |
||||
|
yAxis: { |
||||
|
type: 'value', |
||||
|
axisLabel: { |
||||
|
formatter: '{value} °C' |
||||
|
} |
||||
|
}, |
||||
|
series: [ |
||||
|
{ |
||||
|
name: 'Highest', |
||||
|
type: 'line', |
||||
|
data: [10, 11, 13, 11, 12, 12, 9], |
||||
|
markPoint: { |
||||
|
data: [ |
||||
|
{ type: 'max', name: 'Max' }, |
||||
|
{ type: 'min', name: 'Min' } |
||||
|
] |
||||
|
}, |
||||
|
markLine: { |
||||
|
data: [{ type: 'average', name: 'Avg' }] |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
name: 'Lowest', |
||||
|
type: 'line', |
||||
|
data: [1, -2, 2, 5, 3, 2, 0], |
||||
|
markPoint: { |
||||
|
data: [{ name: '周最低', value: -2, xAxis: 1, yAxis: -1.5 }] |
||||
|
}, |
||||
|
markLine: { |
||||
|
data: [ |
||||
|
{ type: 'average', name: 'Avg' }, |
||||
|
[ |
||||
|
{ |
||||
|
symbol: 'none', |
||||
|
x: '90%', |
||||
|
yAxis: 'max' |
||||
|
}, |
||||
|
{ |
||||
|
symbol: 'circle', |
||||
|
label: { |
||||
|
position: 'start', |
||||
|
formatter: 'Max' |
||||
|
}, |
||||
|
type: 'max', |
||||
|
name: '最高点' |
||||
|
} |
||||
|
] |
||||
|
] |
||||
|
} |
||||
|
} |
||||
|
] |
||||
|
}; |
||||
|
|
||||
|
onMounted(() => { |
||||
|
// 图表初始化 |
||||
|
const chart = echarts.init(stackedRef.value); |
||||
|
chart.setOption(options); |
||||
|
|
||||
|
// 大小自适应 |
||||
|
window.addEventListener('resize', () => { |
||||
|
chart.resize(); |
||||
|
}); |
||||
|
}); |
||||
|
</script> |
||||
<style lang="scss" scoped> |
<style lang="scss" scoped> |
||||
@import './index.scss'; |
@import './index.scss'; |
||||
</style> |
</style> |
||||
|
Loading…
Reference in new issue