Showing
6 changed files
with
442 additions
and
3 deletions
report-ui/src/api/platform.js
0 → 100644
1 | +import request from '@/utils/request' | ||
2 | +import { getShareToken, getToken } from "@/utils/auth"; | ||
3 | +import axios from 'axios'; | ||
4 | +//自监控平台接口数据联调 // Start LSQ 2022/1/13 10:52 TODO | ||
5 | +export function getData(data) { | ||
6 | + return request({ | ||
7 | + url: 'reportDashboard/getData', | ||
8 | + method: 'post', | ||
9 | + headers: { 'Share-Token': getShareToken(), 'Authorization': getToken() }, | ||
10 | + data, | ||
11 | + }) | ||
12 | +} | ||
13 | +export function queryAllDataSet(data) { | ||
14 | + return request({ | ||
15 | + url: 'dataSet/queryAllDataSet', | ||
16 | + method: 'get', | ||
17 | + | ||
18 | + }) | ||
19 | +} |
1 | +/* | ||
2 | +* 健康度情况json | ||
3 | +* author lsq | ||
4 | +* 2022/01/13 | ||
5 | +* */ | ||
6 | +export const monitorHealthStatus = { | ||
7 | + code: 'monitor-health-status', | ||
8 | + type: 'html', | ||
9 | + label: '健康度', | ||
10 | + icon: 'iconbiaoge', | ||
11 | + options: { | ||
12 | + setup: [ | ||
13 | + { | ||
14 | + type: 'el-input-text', | ||
15 | + label: '图层名称', | ||
16 | + name: 'layerName', | ||
17 | + required: false, | ||
18 | + placeholder: '', | ||
19 | + value: '健康度', | ||
20 | + }, | ||
21 | + { | ||
22 | + type: 'custom-upload', | ||
23 | + label: '标题图片地址', | ||
24 | + name: 'imageAdress', | ||
25 | + required: false, | ||
26 | + placeholder: '', | ||
27 | + value: require("../../../../../../../assets/images/healthStatus/title-asset.png"), | ||
28 | + }, | ||
29 | + { | ||
30 | + type: 'el-input-number', | ||
31 | + label: '显示数据数', | ||
32 | + name: 'dataNum', | ||
33 | + required: false, | ||
34 | + placeholder: '', | ||
35 | + value: '3' | ||
36 | + }, | ||
37 | + { | ||
38 | + type: 'custom-upload', | ||
39 | + label: '状态默认图片地址', | ||
40 | + name: 'imageAdressHealthBg', | ||
41 | + required: false, | ||
42 | + placeholder: '', | ||
43 | + value: require("../../../../../../../assets/images/healthStatus/state_bg.png"), | ||
44 | + }, | ||
45 | + { | ||
46 | + type: 'custom-upload', | ||
47 | + label: '优-图片地址', | ||
48 | + name: 'imageAdressHealthGood', | ||
49 | + required: false, | ||
50 | + placeholder: '', | ||
51 | + value: require("../../../../../../../assets/images/healthStatus/state_01.png"), | ||
52 | + }, | ||
53 | + { | ||
54 | + type: 'custom-upload', | ||
55 | + label: '良-图片地址', | ||
56 | + name: 'imageAdressHealthWorse', | ||
57 | + required: false, | ||
58 | + placeholder: '', | ||
59 | + value:require("../../../../../../../assets/images/healthStatus/state_02.png"), | ||
60 | + }, | ||
61 | + { | ||
62 | + type: 'custom-upload', | ||
63 | + label: '差-图片地址', | ||
64 | + name: 'imageAdressHealthBad', | ||
65 | + required: false, | ||
66 | + placeholder: '', | ||
67 | + value: require("../../../../../../../assets/images/healthStatus/state_03.png"), | ||
68 | + }, | ||
69 | + { | ||
70 | + type: 'el-select', | ||
71 | + label: '标题图片位置', | ||
72 | + name: 'textAlign', | ||
73 | + required: false, | ||
74 | + placeholder: '', | ||
75 | + selectOptions: [ | ||
76 | + {code: 'center', name: '居中'}, | ||
77 | + {code: 'left', name: '左对齐'}, | ||
78 | + {code: 'right', name: '右对齐'}, | ||
79 | + ], | ||
80 | + value: 'left' | ||
81 | + }, | ||
82 | + { | ||
83 | + type: 'el-input-number', | ||
84 | + label: '字体大小', | ||
85 | + name: 'fontSize', | ||
86 | + required: false, | ||
87 | + placeholder: '', | ||
88 | + value: '16' | ||
89 | + } | ||
90 | + ], | ||
91 | + data: [ | ||
92 | + { | ||
93 | + type: 'el-radio-group', | ||
94 | + label: '数据类型', | ||
95 | + name: 'dataType', | ||
96 | + require: false, | ||
97 | + placeholder: '', | ||
98 | + selectValue: true, | ||
99 | + selectOptions: [ | ||
100 | + { | ||
101 | + code: 'staticData', | ||
102 | + name: '静态数据', | ||
103 | + }, | ||
104 | + { | ||
105 | + code: 'dynamicData', | ||
106 | + name: '动态数据', | ||
107 | + }, | ||
108 | + ], | ||
109 | + value: 'staticData', | ||
110 | + }, | ||
111 | + { | ||
112 | + type: 'el-input-number', | ||
113 | + label: '刷新时间(毫秒)', | ||
114 | + name: 'refreshTime', | ||
115 | + relactiveDom: 'dataType', | ||
116 | + relactiveDomValue: 'dynamicData', | ||
117 | + value: 30000 | ||
118 | + }, | ||
119 | + { | ||
120 | + type: 'el-button', | ||
121 | + label: '静态数据', | ||
122 | + name: 'staticData', | ||
123 | + required: false, | ||
124 | + placeholder: '', | ||
125 | + relactiveDom: 'dataType', | ||
126 | + relactiveDomValue: 'staticData', | ||
127 | + value: [ | ||
128 | + { | ||
129 | + name:'服务器', | ||
130 | + id:'001', | ||
131 | + healthStatus: 1, | ||
132 | + healthStatusUrl:'' | ||
133 | + }, | ||
134 | + { | ||
135 | + name:'应用', | ||
136 | + id:'002', | ||
137 | + healthStatus: 1, | ||
138 | + healthStatusUrl:'' | ||
139 | + }, | ||
140 | + /*{ | ||
141 | + name:'日志', | ||
142 | + id:'003', | ||
143 | + healthStatus: 1, | ||
144 | + healthStatusUrl:'' | ||
145 | + }*/ | ||
146 | + ], | ||
147 | + }, | ||
148 | + { | ||
149 | + type: 'dycustComponents', | ||
150 | + label: '', | ||
151 | + name: 'dynamicData', | ||
152 | + required: false, | ||
153 | + placeholder: '', | ||
154 | + relactiveDom: 'dataType', | ||
155 | + relactiveDomValue: 'dynamicData', | ||
156 | + chartType: 'widget-table', | ||
157 | + dictKey: 'TEXT_PROPERTIES', //表格的暂不起作用 | ||
158 | + value: '', | ||
159 | + }, | ||
160 | + ], | ||
161 | + position: [ | ||
162 | + { | ||
163 | + type: 'el-input-number', | ||
164 | + label: '左边距', | ||
165 | + name: 'left', | ||
166 | + required: false, | ||
167 | + placeholder: '', | ||
168 | + value: 0, | ||
169 | + }, | ||
170 | + { | ||
171 | + type: 'el-input-number', | ||
172 | + label: '上边距', | ||
173 | + name: 'top', | ||
174 | + required: false, | ||
175 | + placeholder: '', | ||
176 | + value: 0, | ||
177 | + }, | ||
178 | + { | ||
179 | + type: 'el-input-number', | ||
180 | + label: '宽度', | ||
181 | + name: 'width', | ||
182 | + required: false, | ||
183 | + placeholder: '该容器在1920px大屏中的宽度', | ||
184 | + value: 600, | ||
185 | + }, | ||
186 | + { | ||
187 | + type: 'el-input-number', | ||
188 | + label: '高度', | ||
189 | + name: 'height', | ||
190 | + required: false, | ||
191 | + placeholder: '该容器在1080px大屏中的高度', | ||
192 | + value: 300, | ||
193 | + }, | ||
194 | + ] | ||
195 | + } | ||
196 | +} |
@@ -34,6 +34,8 @@ import {widgetBarCompare} from "./echartsConfigJson/widget-bar-compare" | @@ -34,6 +34,8 @@ import {widgetBarCompare} from "./echartsConfigJson/widget-bar-compare" | ||
34 | import {widgetLineCompare} from "./echartsConfigJson/widget-line-compare" | 34 | import {widgetLineCompare} from "./echartsConfigJson/widget-line-compare" |
35 | import {widgetDecoratePie} from "./echartsConfigJson/widget-decorate-pie"; | 35 | import {widgetDecoratePie} from "./echartsConfigJson/widget-decorate-pie"; |
36 | 36 | ||
37 | +import {monitorHealthStatus} from "./echartsConfigJson/monitorConfigJson/monitor-health-status"; | ||
38 | + | ||
37 | export const widgetTool = [ | 39 | export const widgetTool = [ |
38 | // type=html类型的组件 | 40 | // type=html类型的组件 |
39 | widgetText, | 41 | widgetText, |
@@ -61,5 +63,6 @@ export const widgetTool = [ | @@ -61,5 +63,6 @@ export const widgetTool = [ | ||
61 | widgetLineStack, | 63 | widgetLineStack, |
62 | widgetBarCompare, | 64 | widgetBarCompare, |
63 | widgetLineCompare, | 65 | widgetLineCompare, |
64 | - widgetDecoratePie | 66 | + widgetDecoratePie, |
67 | + monitorHealthStatus, | ||
65 | ] | 68 | ] |
1 | +<template> | ||
2 | + <div class="healthStatus-container" :style="styleObj"> | ||
3 | +<!-- <div class="healthStatus-container">--> | ||
4 | + <div class="title-div" :style="styleColor"> | ||
5 | + <img :src="imgStyle.imageAdress" :style="imgStyle" alt=""> | ||
6 | + </div> | ||
7 | + <el-row> | ||
8 | + <el-col :span="8" v-for="item in healthDataComputed" :key="item.id"> | ||
9 | + <div class="health-service"> | ||
10 | + <span class="health-name">{{item.name}}</span> | ||
11 | + <img v-if="item.healthStatusUrl" :src="item.healthStatusUrl" alt=""> | ||
12 | + </div> | ||
13 | + </el-col> | ||
14 | + | ||
15 | + </el-row> | ||
16 | + </div> | ||
17 | +</template> | ||
18 | + | ||
19 | +<script> | ||
20 | +import { | ||
21 | + getData | ||
22 | +} from "@/api/platform"; | ||
23 | +export default { | ||
24 | + name: "healthStatus", | ||
25 | + data() { | ||
26 | + return { | ||
27 | + options: {}, | ||
28 | + healthData:[ | ||
29 | + /*{ | ||
30 | + name:'服务器', | ||
31 | + id:'001', | ||
32 | + healthStatus: 1, | ||
33 | + healthStatusUrl:'' | ||
34 | + }, | ||
35 | + { | ||
36 | + name:'应用', | ||
37 | + healthStatus: 2, | ||
38 | + id:'002', | ||
39 | + healthStatusUrl:'' | ||
40 | + },{ | ||
41 | + name:'日和', | ||
42 | + id:'003', | ||
43 | + healthStatus: 3, | ||
44 | + healthStatusUrl:'' | ||
45 | + }, | ||
46 | + { | ||
47 | + name:'日志', | ||
48 | + id:'004', | ||
49 | + healthStatus: 3, | ||
50 | + healthStatusUrl:'' | ||
51 | + }*/ | ||
52 | + ], | ||
53 | + optionsSetUp: {}, | ||
54 | + optionsData:{} | ||
55 | + } | ||
56 | + }, | ||
57 | + components: {}, | ||
58 | + props: { | ||
59 | + value: Object, | ||
60 | + ispreview: Boolean | ||
61 | + }, | ||
62 | + computed: { | ||
63 | + transStyle() { | ||
64 | + return this.objToOne(this.options); | ||
65 | + }, | ||
66 | + styleObj() { | ||
67 | + const allStyle = this.optionsSetUp; | ||
68 | + return { | ||
69 | + position: this.ispreview ? "absolute" : "static", | ||
70 | + width: allStyle.width + "px", | ||
71 | + height: allStyle.height + "px", | ||
72 | + left: allStyle.left + "px", | ||
73 | + top: allStyle.top + "px", | ||
74 | + // background:this.transStyle.BgColor | ||
75 | + }; | ||
76 | + }, | ||
77 | + | ||
78 | + styleColor() { | ||
79 | + return { | ||
80 | + "text-align": this.transStyle.textAlign, | ||
81 | + | ||
82 | + }; | ||
83 | + }, | ||
84 | + | ||
85 | + imgStyle() { | ||
86 | + | ||
87 | + return { | ||
88 | + imageAdress: this.transStyle.imageAdress?this.transStyle.imageAdress:require("../../../../../../assets/images/healthStatus/title-asset.png"), | ||
89 | + | ||
90 | + "border-radius": this.transStyle.borderRadius + "px", | ||
91 | + opacity: this.transStyle.transparency / 100, | ||
92 | + }; | ||
93 | + }, | ||
94 | + imgStyleHealth() { | ||
95 | + return { | ||
96 | + imageAdressHealthBg:this.transStyle.imageAdressHealthBg?this.transStyle.imageAdressHealthBg:require("../../../../../../assets/images/healthStatus/state_bg.png"), | ||
97 | + imageAdressHealthGood:this.transStyle.imageAdressHealthGood?this.transStyle.imageAdressHealthGood:require("../../../../../../assets/images/healthStatus/state_01.png"), | ||
98 | + imageAdressHealthWorse:this.transStyle.imageAdressHealthWorse?this.transStyle.imageAdressHealthWorse:require("../../../../../../assets/images/healthStatus/state_02.png"), | ||
99 | + imageAdressHealthBad:this.transStyle.imageAdressHealthBad?this.transStyle.imageAdressHealthBad:require("../../../../../../assets/images/healthStatus/state_03.png"), | ||
100 | + dataNum:this.transStyle.dataNum?this.transStyle.dataNum:'3' | ||
101 | + }; | ||
102 | + }, | ||
103 | + healthDataComputed(){ | ||
104 | + let healthData=this.healthData; | ||
105 | + healthData=this.initImageUrl(); | ||
106 | + console.log("datanum",this.imgStyleHealth.dataNum) | ||
107 | + if(this.imgStyleHealth.dataNum){ | ||
108 | + healthData=healthData.slice(0,this.imgStyleHealth.dataNum); | ||
109 | + } | ||
110 | + | ||
111 | + return healthData; | ||
112 | + } | ||
113 | + }, | ||
114 | + watch: { | ||
115 | + value: { | ||
116 | + handler(val) { | ||
117 | + this.options = val; | ||
118 | + this.optionsSetUp = val.setup; | ||
119 | + this.optionsData=val.data; | ||
120 | + this.handlerData(); | ||
121 | + }, | ||
122 | + deep: true | ||
123 | + } | ||
124 | + }, | ||
125 | + mounted() { | ||
126 | + // this.initImageUrl(); | ||
127 | + this.optionsSetUp = this.value.setup; | ||
128 | + this.optionsData = this.value.data; | ||
129 | + this.handlerData(); | ||
130 | + }, | ||
131 | + methods: { | ||
132 | + initImageUrl(){ | ||
133 | + console.log("len",this.healthData.length) | ||
134 | + if(this.healthData && this.healthData.length<3){ | ||
135 | + let len=3-this.healthData.length; | ||
136 | + for(let i=0;i<len;i++){ | ||
137 | + console.log("i",i) | ||
138 | + this.healthData.push({ | ||
139 | + name:'', | ||
140 | + healthStatusUrl:'' | ||
141 | + }) | ||
142 | + } | ||
143 | + } | ||
144 | + console.log("healthData",this.healthData) | ||
145 | + | ||
146 | + this.healthData.map(item=>{ | ||
147 | + console.log("abc",this.imgStyleHealth.dataNum) | ||
148 | + if(!item.healthStatusUrl){ | ||
149 | + item.healthStatusUrl=this.imgStyleHealth.imageAdressHealthBg; | ||
150 | + } | ||
151 | + if(item.healthStatus==1){ | ||
152 | + item.healthStatusUrl=this.imgStyleHealth.imageAdressHealthGood; | ||
153 | + }else if(item.healthStatus==2){ | ||
154 | + item.healthStatusUrl=this.imgStyleHealth.imageAdressHealthWorse; | ||
155 | + }else if(item.healthStatus==3){ | ||
156 | + item.healthStatusUrl=this.imgStyleHealth.imageAdressHealthBad; | ||
157 | + }else{ | ||
158 | + item.healthStatusUrl=this.imgStyleHealth.imageAdressHealthBg; | ||
159 | + } | ||
160 | + }) | ||
161 | + return this.healthData; | ||
162 | + | ||
163 | + }, | ||
164 | + async init(){ | ||
165 | + const reportCode = this.$route.query.reportCode; | ||
166 | + const { code, data } = await getData(reportCode); | ||
167 | + if (code != 200) return; | ||
168 | + }, | ||
169 | + handlerData() { | ||
170 | + const resData = this.optionsData; | ||
171 | + console.log("resdata",resData) | ||
172 | + resData.dataType == "staticData" | ||
173 | + ? this.handlerStaticData(resData.staticData) | ||
174 | + : this.handlerDynamicData(resData.dynamicData, resData.refreshTime); | ||
175 | + }, | ||
176 | + handlerStaticData(data) { | ||
177 | + this.healthData = data; | ||
178 | + }, | ||
179 | + handlerDynamicData(data, refreshTime) { | ||
180 | + if (!data) return; | ||
181 | + /* if (this.ispreview) { | ||
182 | + this.getEchartData(data); | ||
183 | + this.flagInter = setInterval(() => { | ||
184 | + this.getEchartData(data); | ||
185 | + }, refreshTime); | ||
186 | + } else { | ||
187 | + this.getEchartData(data); | ||
188 | + }*/ | ||
189 | + }, | ||
190 | + | ||
191 | + }, | ||
192 | +} | ||
193 | +</script> | ||
194 | + | ||
195 | +<style scoped lang="scss"> | ||
196 | +.healthStatus-container{ | ||
197 | + max-width:700px; | ||
198 | +} | ||
199 | +.title-div{ | ||
200 | + text-align: left; | ||
201 | + padding:10px; | ||
202 | +} | ||
203 | +.health-service{ | ||
204 | + position: relative; | ||
205 | +} | ||
206 | +.health-name{ | ||
207 | + position: absolute; | ||
208 | + top:15px; | ||
209 | + left:0; | ||
210 | + right:0; | ||
211 | + color:#FFFFFF; | ||
212 | +} | ||
213 | +</style> |
@@ -37,6 +37,8 @@ import widgetBarCompareChart from "./bar/widgetBarCompareChart"; | @@ -37,6 +37,8 @@ import widgetBarCompareChart from "./bar/widgetBarCompareChart"; | ||
37 | import widgetLineCompareChart from "./line/widgetLineCompareChart"; | 37 | import widgetLineCompareChart from "./line/widgetLineCompareChart"; |
38 | import widgetDecoratePieChart from "./decorate/widgetDecoratePieChart"; | 38 | import widgetDecoratePieChart from "./decorate/widgetDecoratePieChart"; |
39 | 39 | ||
40 | +import monitorHealthStatus from "./monitor/healthStatus"; | ||
41 | + | ||
40 | export default { | 42 | export default { |
41 | name: "WidgetTemp", | 43 | name: "WidgetTemp", |
42 | components: { | 44 | components: { |
@@ -64,7 +66,9 @@ export default { | @@ -64,7 +66,9 @@ export default { | ||
64 | widgetLineStackChart, | 66 | widgetLineStackChart, |
65 | widgetBarCompareChart, | 67 | widgetBarCompareChart, |
66 | widgetLineCompareChart, | 68 | widgetLineCompareChart, |
67 | - widgetDecoratePieChart | 69 | + widgetDecoratePieChart, |
70 | + | ||
71 | + monitorHealthStatus | ||
68 | }, | 72 | }, |
69 | model: { | 73 | model: { |
70 | prop: "value", | 74 | prop: "value", |
@@ -48,6 +48,9 @@ import widgetBarCompareChart from "./bar/widgetBarCompareChart"; | @@ -48,6 +48,9 @@ import widgetBarCompareChart from "./bar/widgetBarCompareChart"; | ||
48 | import widgetLineCompareChart from "./line/widgetLineCompareChart"; | 48 | import widgetLineCompareChart from "./line/widgetLineCompareChart"; |
49 | import widgetDecoratePieChart from "./decorate/widgetDecoratePieChart"; | 49 | import widgetDecoratePieChart from "./decorate/widgetDecoratePieChart"; |
50 | 50 | ||
51 | +import monitorHealthStatus from "./monitor/healthStatus"; | ||
52 | + | ||
53 | + | ||
51 | export default { | 54 | export default { |
52 | name: "Widget", | 55 | name: "Widget", |
53 | components: { | 56 | components: { |
@@ -75,7 +78,8 @@ export default { | @@ -75,7 +78,8 @@ export default { | ||
75 | widgetLineStackChart, | 78 | widgetLineStackChart, |
76 | widgetBarCompareChart, | 79 | widgetBarCompareChart, |
77 | widgetLineCompareChart, | 80 | widgetLineCompareChart, |
78 | - widgetDecoratePieChart | 81 | + widgetDecoratePieChart, |
82 | + monitorHealthStatus, | ||
79 | }, | 83 | }, |
80 | model: { | 84 | model: { |
81 | prop: "value", | 85 | prop: "value", |
-
Please register or login to post a comment