|
@@ -1,45 +1,312 @@
|
|
<template>
|
|
<template>
|
|
<div class="app-container">
|
|
<div class="app-container">
|
|
- <el-row :gutter="10" class="mb8">
|
|
|
|
- <el-col :span="12">
|
|
|
|
- <el-card>
|
|
|
|
- <div ref="echartsRef" style="width: 600px; height: 400px;"></div>
|
|
|
|
- </el-card>
|
|
|
|
- </el-col>
|
|
|
|
- <el-col :span="12"></el-col>
|
|
|
|
- </el-row>
|
|
|
|
|
|
+ <el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="0">
|
|
|
|
+ <el-form-item label="" style="width: 308px;margin-right:10px">
|
|
|
|
+ <el-date-picker
|
|
|
|
+ v-model="daterangeAlarmTime"
|
|
|
|
+ value-format="YYYY-MM-DD"
|
|
|
|
+ type="daterange"
|
|
|
|
+ range-separator="-"
|
|
|
|
+ start-placeholder="开始日期"
|
|
|
|
+ end-placeholder="结束日期"
|
|
|
|
+ ></el-date-picker>
|
|
|
|
+ </el-form-item>
|
|
|
|
+<!-- <el-form-item label="" style="width: 208px;margin-right:10px">-->
|
|
|
|
+<!-- <el-select v-model="queryParams.objType" placeholder="请选择业务类型" clearable style="width: 100%">-->
|
|
|
|
+<!-- <el-option-->
|
|
|
|
+<!-- v-for="dict in biz_type"-->
|
|
|
|
+<!-- :key="dict.value"-->
|
|
|
|
+<!-- :label="dict.label"-->
|
|
|
|
+<!-- :value="dict.value"-->
|
|
|
|
+<!-- ></el-option>-->
|
|
|
|
+<!-- </el-select>-->
|
|
|
|
+<!-- </el-form-item>-->
|
|
|
|
+ <el-form-item>
|
|
|
|
+ <el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
|
|
|
+ <el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-form>
|
|
|
|
+ <el-card>
|
|
|
|
+ <div ref="chartSort" style="height: 600px;"></div>
|
|
|
|
+ </el-card>
|
|
|
|
+ <!-- <el-table v-loading="loading" border :data="recordList">-->
|
|
|
|
+ <!-- <el-table-column label="告警ID" align="center" prop="objId" width="80"/>-->
|
|
|
|
+ <!-- <el-table-column label="告警对象/应用组件" align="center" prop="objName"/>-->
|
|
|
|
+ <!-- <el-table-column label="告警数量" align="center" prop="num"/>-->
|
|
|
|
+ <!-- <el-table-column label="操作" align="center" prop="alarmTime" width="180">-->
|
|
|
|
+ <!-- <template #default="scope">-->
|
|
|
|
+ <!-- <el-button type="text" plain icon="Position" @click="handleDetails(scope.row)">明细</el-button>-->
|
|
|
|
+ <!-- </template>-->
|
|
|
|
+ <!-- </el-table-column>-->
|
|
|
|
+ <!-- </el-table>-->
|
|
|
|
+
|
|
|
|
+ <!-- <pagination-->
|
|
|
|
+ <!-- v-show="total>0"-->
|
|
|
|
+ <!-- :total="total"-->
|
|
|
|
+ <!-- v-model:page="queryParams.pageNum"-->
|
|
|
|
+ <!-- v-model:limit="queryParams.pageSize"-->
|
|
|
|
+ <!-- @pagination="getList"-->
|
|
|
|
+ <!-- />-->
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
-<script setup>
|
|
|
|
-import {onMounted, ref} from 'vue';
|
|
|
|
-import * as echarts from 'echarts';
|
|
|
|
|
|
+<script setup name="Record">
|
|
|
|
+import {getBizSort} from "@/api/alarm/record";
|
|
|
|
+import {useRouter} from "vue-router";
|
|
|
|
+import * as echarts from "echarts";
|
|
|
|
+
|
|
|
|
+const {proxy} = getCurrentInstance();
|
|
|
|
+const {alarm_level} = proxy.useDict('alarm_level');
|
|
|
|
+const {biz_type} = proxy.useDict('biz_type');
|
|
|
|
+
|
|
|
|
+const recordList = ref([]);
|
|
|
|
+const open = ref(false);
|
|
|
|
+const loading = ref(true);
|
|
|
|
+const showSearch = ref(true);
|
|
|
|
+const total = ref(0);
|
|
|
|
+const daterangeAlarmTime = ref([]);
|
|
|
|
+const router = useRouter();
|
|
|
|
+const chartSort = ref();
|
|
|
|
+
|
|
|
|
+const data = reactive({
|
|
|
|
+ form: {},
|
|
|
|
+ queryParams: {
|
|
|
|
+ start: null,
|
|
|
|
+ end: null
|
|
|
|
+ },
|
|
|
|
+});
|
|
|
|
+
|
|
|
|
+const {queryParams, form} = toRefs(data);
|
|
|
|
|
|
-const echartsRef = ref(null);
|
|
|
|
|
|
+function handleDetails(row) {
|
|
|
|
+ console.log(row, router)
|
|
|
|
+}
|
|
|
|
|
|
-onMounted(() => {
|
|
|
|
- const chart = echarts.init(echartsRef.value);
|
|
|
|
- const option = {
|
|
|
|
- // ECharts 配置项
|
|
|
|
- title: {
|
|
|
|
- text: 'ECharts 示例'
|
|
|
|
|
|
+function initChart(res) {
|
|
|
|
+ const myChart = echarts.init(chartSort.value);
|
|
|
|
+ var ydata = [];
|
|
|
|
+ var salvProValue = [];
|
|
|
|
+ for (const i in res.data) {
|
|
|
|
+ let obj=res.data[i]
|
|
|
|
+ ydata.push(obj.objName);
|
|
|
|
+ salvProValue.push(obj.num);
|
|
|
|
+ }
|
|
|
|
+ let colorList = ['#fe8019', '#fec429', '#4a90e2', '#9095a7', '#4cb051', '#ec0019', '#dcb093','#fe8019', '#fec429', '#4a90e2', '#9095a7', '#4cb051', '#ec0019', '#dcb093'];
|
|
|
|
+ let option = {
|
|
|
|
+ backgroundColor: '#fff',
|
|
|
|
+ grid: {
|
|
|
|
+ left: '2%',
|
|
|
|
+ right: '4%',
|
|
|
|
+ bottom: '2%',
|
|
|
|
+ top: '2%',
|
|
|
|
+ containLabel: true,
|
|
|
|
+ },
|
|
|
|
+ tooltip: {
|
|
|
|
+ trigger: 'axis',
|
|
|
|
+ axisPointer: {
|
|
|
|
+ type: 'none'
|
|
|
|
+ },
|
|
|
|
+ formatter: '{b}:{c}',
|
|
},
|
|
},
|
|
- tooltip: {},
|
|
|
|
xAxis: {
|
|
xAxis: {
|
|
- data: ['衬衫', '羊毛衫', '雪纺衫', '裤子', '高跟鞋', '袜子']
|
|
|
|
|
|
+ show: false,
|
|
|
|
+ type: 'value',
|
|
|
|
+ },
|
|
|
|
+ yAxis: {
|
|
|
|
+ type: "category",
|
|
|
|
+ data: ydata,
|
|
|
|
+ axisLine: {
|
|
|
|
+ show: false,
|
|
|
|
+ },
|
|
|
|
+ axisTick: {
|
|
|
|
+ show: false,
|
|
|
|
+ },
|
|
|
|
+ axisLabel: {
|
|
|
|
+ margin: 30,
|
|
|
|
+ width: 16,
|
|
|
|
+ align: "left",
|
|
|
|
+ overflow: "truncate",
|
|
|
|
+ formatter: function (value, index) {
|
|
|
|
+ let ind = index + 1;
|
|
|
|
+ if (ind == ydata.length) {
|
|
|
|
+ return "{one|" + (ydata.length - index) + "} {a|" + value + "}";
|
|
|
|
+ } else if (ind + 1 == ydata.length) {
|
|
|
|
+ return "{two|" + (ydata.length - index) + "} {b|" + value + "}";
|
|
|
|
+ } else if (ind + 2 == ydata.length) {
|
|
|
|
+ return (
|
|
|
|
+ "{three|" + (ydata.length - index) + "} {c|" + value + "}"
|
|
|
|
+ );
|
|
|
|
+ }
|
|
|
|
+ if (ydata.length - index > 9) {
|
|
|
|
+ return (
|
|
|
|
+ "{five|" + (ydata.length - index) + "} {d|" + value + "}"
|
|
|
|
+ );
|
|
|
|
+ }
|
|
|
|
+ return "{four|" + (ydata.length - index) + "} {d|" + value + "}";
|
|
|
|
+ },
|
|
|
|
+ rich: {
|
|
|
|
+ a: {
|
|
|
|
+ color: "#59c9f9",
|
|
|
|
+ },
|
|
|
|
+ b: {
|
|
|
|
+ color: "#59c9f9",
|
|
|
|
+ },
|
|
|
|
+ c: {
|
|
|
|
+ color: "#59c9f9",
|
|
|
|
+ },
|
|
|
|
+ d: {
|
|
|
|
+ color: "#59c9f9",
|
|
|
|
+ },
|
|
|
|
+ // 第一名
|
|
|
|
+ one: {
|
|
|
|
+ backgroundColor: "#E86452",
|
|
|
|
+ color: "white",
|
|
|
|
+ width: 12,
|
|
|
|
+ height: 16,
|
|
|
|
+ padding: [1, 0, 0, 5],
|
|
|
|
+ borderRadius: 10,
|
|
|
|
+ fontSize: 11,
|
|
|
|
+ },
|
|
|
|
+ // 第二名
|
|
|
|
+ two: {
|
|
|
|
+ backgroundColor: "#FF9845",
|
|
|
|
+ color: "white",
|
|
|
|
+ width: 12,
|
|
|
|
+ height: 16,
|
|
|
|
+ padding: [1, 0, 0, 5],
|
|
|
|
+ borderRadius: 10,
|
|
|
|
+ fontSize: 11,
|
|
|
|
+ },
|
|
|
|
+ // 第三名
|
|
|
|
+ three: {
|
|
|
|
+ backgroundColor: "#F6BD16",
|
|
|
|
+ color: "white",
|
|
|
|
+ width: 12,
|
|
|
|
+ height: 16,
|
|
|
|
+ padding: [1, 0, 0, 5],
|
|
|
|
+ borderRadius: 10,
|
|
|
|
+ fontSize: 11,
|
|
|
|
+ },
|
|
|
|
+ // 一位数
|
|
|
|
+ four: {
|
|
|
|
+ backgroundColor: "rgba(0,0,0,0.15)",
|
|
|
|
+ color: "white",
|
|
|
|
+ width: 12,
|
|
|
|
+ height: 16,
|
|
|
|
+ padding: [1, 0, 0, 5],
|
|
|
|
+ borderRadius: 10,
|
|
|
|
+ fontSize: 11,
|
|
|
|
+ },
|
|
|
|
+ // 两位数
|
|
|
|
+ five: {
|
|
|
|
+ backgroundColor: "rgba(0,0,0,0.15)",
|
|
|
|
+ color: "white",
|
|
|
|
+ width: 16,
|
|
|
|
+ height: 16,
|
|
|
|
+ padding: [1, 0, 0, 1],
|
|
|
|
+ borderRadius: 10,
|
|
|
|
+ fontSize: 11,
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ },
|
|
},
|
|
},
|
|
- yAxis: {},
|
|
|
|
- series: [{
|
|
|
|
- name: '销量',
|
|
|
|
- type: 'bar',
|
|
|
|
- data: [5, 20, 36, 10, 10, 20]
|
|
|
|
- }]
|
|
|
|
|
|
+ series: [
|
|
|
|
+ {
|
|
|
|
+ name: 'value',
|
|
|
|
+ type: 'bar',
|
|
|
|
+ zlevel: 1,
|
|
|
|
+ showBackground: true,
|
|
|
|
+
|
|
|
|
+ itemStyle: {
|
|
|
|
+ normal: {
|
|
|
|
+ barBorderRadius: [0, 20, 20, 0], // 圆角(左上、右上、右下、左下)
|
|
|
|
+ color: (params) => {
|
|
|
|
+ return colorList[params.dataIndex]
|
|
|
|
+ },
|
|
|
|
+ // color: new echarts.graphic.LinearGradient(0, 0, 1, 0, [
|
|
|
|
+ // '#5CFFB1', '#24C879'
|
|
|
|
+ // ].map((color, offset) => ({
|
|
|
|
+ // color,
|
|
|
|
+ // offset
|
|
|
|
+ // }))), // 渐变
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ label: {
|
|
|
|
+ normal: {
|
|
|
|
+ color: '#000',
|
|
|
|
+ show: true,
|
|
|
|
+ position: [0, '-20px'],
|
|
|
|
+ textStyle: {
|
|
|
|
+ fontSize: 16,
|
|
|
|
+ },
|
|
|
|
+ formatter: '{b}',
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ barWidth: 20,
|
|
|
|
+ data: salvProValue,
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ name: '21',
|
|
|
|
+ type: 'bar',
|
|
|
|
+ barWidth: 20,
|
|
|
|
+ barGap: '-100%',
|
|
|
|
+ data: salvProValue,
|
|
|
|
+ itemStyle: {
|
|
|
|
+ normal: {
|
|
|
|
+ color: '#f5f8ff',
|
|
|
|
+ },
|
|
|
|
+ emphasis: {
|
|
|
|
+ color: '#f5f8ff',
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ label: {
|
|
|
|
+ normal: {
|
|
|
|
+ color: '#000',
|
|
|
|
+ show: true,
|
|
|
|
+ position: 'right',
|
|
|
|
+ distance: 4,
|
|
|
|
+ textStyle: {
|
|
|
|
+ fontSize: 16,
|
|
|
|
+ },
|
|
|
|
+ formatter: '{c}',
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ ],
|
|
};
|
|
};
|
|
|
|
|
|
- chart.setOption(option);
|
|
|
|
-});
|
|
|
|
-</script>
|
|
|
|
|
|
+ myChart.setOption(option)
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/** 查询告警记录列表 */
|
|
|
|
+function getList() {
|
|
|
|
+ loading.value = true;
|
|
|
|
+ queryParams.value.params = {};
|
|
|
|
+ if (null != daterangeAlarmTime && '' != daterangeAlarmTime) {
|
|
|
|
+ queryParams.value.start = daterangeAlarmTime.value[0];
|
|
|
|
+ queryParams.value.end = daterangeAlarmTime.value[1];
|
|
|
|
+ }
|
|
|
|
+ getBizSort(queryParams.value).then(response => {
|
|
|
|
+ // recordList.value = response.rows;
|
|
|
|
+ // total.value = response.total;
|
|
|
|
+ loading.value = false;
|
|
|
|
+ initChart(response);
|
|
|
|
+ });
|
|
|
|
+}
|
|
|
|
|
|
-<style>
|
|
|
|
-/* 你的样式 */
|
|
|
|
-</style>
|
|
|
|
|
|
+
|
|
|
|
+/** 搜索按钮操作 */
|
|
|
|
+function handleQuery() {
|
|
|
|
+ queryParams.value.pageNum = 1;
|
|
|
|
+ getList();
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/** 重置按钮操作 */
|
|
|
|
+function resetQuery() {
|
|
|
|
+ daterangeAlarmTime.value = [];
|
|
|
|
+ proxy.resetForm("queryRef");
|
|
|
|
+ handleQuery();
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+getList();
|
|
|
|
+</script>
|