1
|
-export default {
|
|
|
2
|
- name: 'addIndex',
|
|
|
3
|
- template: '',
|
|
|
4
|
- components: {
|
|
|
5
|
- 'LineChart': Vue.defineAsyncComponent(
|
|
|
6
|
- () => myImport('views/zjdaping/components/lineChart/index')
|
|
|
7
|
- )
|
|
|
8
|
- },
|
|
|
9
|
- data() {
|
|
|
10
|
- return {
|
|
|
11
|
- commandVal:'max',
|
|
|
12
|
- domainName:sessionStorage.getItem('domainName'),
|
|
|
13
|
- apiUrl:'/api-web/ContrastAnalysis/getLineData',
|
|
|
14
|
- optionData:'',
|
|
|
15
|
- titleFontSize:'30',
|
|
|
16
|
- allData: '',
|
|
|
17
|
- newCommandVal:this.commandVal,
|
|
|
18
|
- startValue: 0, // 区域缩放的起点值
|
|
|
19
|
- endValue: 6, // 区域缩放的终点值
|
|
|
20
|
- timerId: null,// 定时器的标识
|
|
|
21
|
- props: {
|
|
|
22
|
- label: 'label',
|
|
|
23
|
- children: 'children'
|
|
|
24
|
- }
|
|
|
25
|
- }
|
|
|
26
|
- },
|
|
|
27
|
- created() {
|
|
|
28
|
- this.loadResList();
|
|
|
29
|
- this.loadFrequency();
|
|
|
30
|
- this.getData()
|
|
|
31
|
- },
|
|
|
32
|
- props: {
|
|
|
33
|
- dialogFormVisible:false,
|
|
|
34
|
- height: {
|
|
|
35
|
- type: Number,
|
|
|
36
|
- default: 0
|
|
|
37
|
- },
|
|
|
38
|
- pageSize: {
|
|
|
39
|
- type: Number,
|
|
|
40
|
- default: 10
|
|
|
41
|
- },
|
|
|
42
|
- },
|
|
|
43
|
- setup(props, {attrs, slots, emit}) {
|
|
|
44
|
- const {proxy} = Vue.getCurrentInstance();
|
|
|
45
|
- // 分页信息
|
|
|
46
|
- const pageInfo = Vue.reactive({
|
|
|
47
|
- total: 0,
|
|
|
48
|
- limit: 50,
|
|
|
49
|
- page: 1,
|
|
|
50
|
- keyWords: ''
|
|
|
51
|
-
|
|
|
52
|
- })
|
|
|
53
|
- let temp ={
|
|
|
54
|
- }
|
|
|
55
|
- let dialogFormVisible= false
|
|
|
56
|
- let dialogStatus= ''
|
|
|
57
|
- let textMap ={
|
|
|
58
|
- update: '追加场景',
|
|
|
59
|
- create: 'Create'
|
|
|
60
|
- }
|
|
|
61
|
- let columns = Vue.ref([
|
|
|
62
|
- {
|
|
|
63
|
- prop: 'busId',
|
|
|
64
|
- label: '业务系统',
|
|
|
65
|
- sortable: true,
|
|
|
66
|
- align: 'right',
|
|
|
67
|
- },
|
|
|
68
|
- {
|
|
|
69
|
- prop: 'resTypeName',
|
|
|
70
|
- label: '资源类型',
|
|
|
71
|
- sortable: true,
|
|
|
72
|
- align: 'right',
|
|
|
73
|
- },
|
|
|
74
|
- {
|
|
|
75
|
- prop: 'resName',
|
|
|
76
|
- label: '资源名称',
|
|
|
77
|
- sortable: true,
|
|
|
78
|
- align: 'right',
|
|
|
79
|
- },
|
|
|
80
|
- {
|
|
|
81
|
- prop: 'ip',
|
|
|
82
|
- label: 'ip地址',
|
|
|
83
|
- sortable: true,
|
|
|
84
|
- align: 'right',
|
|
|
85
|
- },
|
|
|
86
|
- {
|
|
|
87
|
- prop: 'kpiId',
|
|
|
88
|
- label: '指标类型',
|
|
|
89
|
- sortable: true,
|
|
|
90
|
- align: 'right',
|
|
|
91
|
- }
|
|
|
92
|
-
|
|
|
93
|
- ]);
|
|
|
94
|
- const allData=Vue.ref({});
|
|
|
95
|
- let currentPage = Vue.ref(1);
|
|
|
96
|
- let frequencyArr= Vue.ref([]);
|
|
|
97
|
- // 表格数据对象
|
|
|
98
|
- const addedObj = Vue.ref([]);
|
|
|
99
|
- let resTypeArr = Vue.ref([]);
|
|
|
100
|
- let busTypeArr = Vue.ref([]);
|
|
|
101
|
- let kpiTypeArr = Vue.ref([]);
|
|
|
102
|
- // 搜索框内容
|
|
|
103
|
- let addedTotal = Vue.ref(0);
|
|
|
104
|
- // 表格数据对象
|
|
|
105
|
- const noaddObj = Vue.ref([]);
|
|
|
106
|
-
|
|
|
107
|
- let noaddTotal = Vue.ref(0);
|
|
|
108
|
- // 计算减去左侧树的宽度
|
|
|
109
|
- let max = (function () {
|
|
|
110
|
- let right = window.innerWidth;
|
|
|
111
|
- let treeWidth = (right / 24) * 4;
|
|
|
112
|
- return right - treeWidth;
|
|
|
113
|
- })();
|
|
|
114
|
- let loadFrequency = ()=> {
|
|
|
115
|
- let param = {
|
|
|
116
|
- ddicName:'Day'
|
|
|
117
|
- }
|
|
|
118
|
- proxy.$http.get(`/api-web/ContrastAnalysis/selectTogetherRate`, param, function (res) {
|
|
|
119
|
- if (res && res.data) {
|
|
|
120
|
- frequencyArr = res.data;
|
|
|
121
|
- console.log(frequencyArr);
|
|
|
122
|
- }
|
|
|
123
|
- });
|
|
|
124
|
- }
|
|
|
125
|
- let loadResList = () => {
|
|
|
126
|
- // 查询参数
|
|
|
127
|
- let params = {
|
|
|
128
|
- page: pageInfo.page,
|
|
|
129
|
- limit: pageInfo.limit,
|
|
|
130
|
- // keyWords: this.form.keyWords.value,
|
|
|
131
|
- resType: resTypeArr.value.join(','),
|
|
|
132
|
- kpiType: kpiTypeArr.value.join(','),
|
|
|
133
|
- bizType: busTypeArr.value.join(','),
|
|
|
134
|
- configId: 64,
|
|
|
135
|
- }
|
|
|
136
|
- proxy.$http.get(`/api-web/ContrastAnalysis/added`, params, function (res) {
|
|
|
137
|
- if (res && res.data) {
|
|
|
138
|
- addedObj.value = res.data;
|
|
|
139
|
- addedTotal.value = res.count;
|
|
|
140
|
- }
|
|
|
141
|
- });
|
|
|
142
|
- proxy.$http.get(`/api-web/ContrastAnalysis/notAdded`, params, function (res) {
|
|
|
143
|
- if (res && res.data) {
|
|
|
144
|
- noaddObj.value = res.data;
|
|
|
145
|
- noaddTotal.value = res.count;
|
|
|
146
|
- }
|
|
|
147
|
- });
|
|
|
148
|
- }
|
|
|
149
|
- let deleteRow = (row,index) => {
|
|
|
150
|
- proxy.$global.confirm("确认删除该项吗?", function () {
|
|
|
151
|
- if(row.isAdd && row.isAdd == 1){
|
|
|
152
|
- proxy.$global.showMsg("删除成功!")
|
|
|
153
|
- dataList.value.splice(index, 1);
|
|
|
154
|
- } else {
|
|
|
155
|
- // 删除配置项
|
|
|
156
|
- proxy.$http.post(`/api-web/ContrastAnalysis/delete/${row.id}`, {}, function (res) {
|
|
|
157
|
- if (res && res.success) {
|
|
|
158
|
- proxy.$global.showMsg("删除成功!");
|
|
|
159
|
- dataList.value.splice(index, 1);
|
|
|
160
|
- } else {
|
|
|
161
|
- proxy.$global.showMsg(res.msg && res.msg != '' ? res.msg : "删除失败!", "error");
|
|
|
162
|
- }
|
|
|
163
|
- });
|
|
|
164
|
- }
|
|
|
165
|
- })
|
|
|
166
|
- }
|
|
|
167
|
- let handleUpdate =(row,index) =>{
|
|
|
168
|
- console.log(row);
|
|
|
169
|
- console.log(index);
|
|
|
170
|
- // this.temp = Object.assign({}, row) // copy obj
|
|
|
171
|
- // this.temp.timestamp = new Date(this.temp.timestamp)
|
|
|
172
|
- // this.dialogStatus = 'update'
|
|
|
173
|
- dialogFormVisible = true
|
|
|
174
|
- // this.nextTick(() => {
|
|
|
175
|
- // this.$refs['dataForm'].clearValidate()
|
|
|
176
|
- // })
|
|
|
177
|
- }
|
|
|
178
|
- // 点击按钮搜索
|
|
|
179
|
- let onBtnSearch = () => {
|
|
|
180
|
- pageInfo.page = 1;
|
|
|
181
|
- loadResList();
|
|
|
182
|
- }
|
|
|
183
|
-
|
|
|
184
|
- let onReset = () => {
|
|
|
185
|
-
|
|
|
186
|
- }
|
|
|
187
|
- let getResType = (arr) => {
|
|
|
188
|
- console.log(arr);
|
|
|
189
|
- var types = arr.map(function (v) {
|
|
|
190
|
- return v.id;
|
|
|
191
|
- });
|
|
|
192
|
- resTypeArr.value = types;
|
|
|
193
|
- loadResList();
|
|
|
194
|
- }
|
|
|
195
|
- let getKpiType = (arr) => {
|
|
|
196
|
- console.log(arr);
|
|
|
197
|
- var types = arr.map(function (v) {e
|
|
|
198
|
- return v.kpiId;
|
|
|
199
|
- });
|
|
|
200
|
- kpiTypeArr.value = types;
|
|
|
201
|
- loadResList();
|
|
|
202
|
- }
|
|
|
203
|
- let getBizType = (arr) => {
|
|
|
204
|
- console.log(arr);
|
|
|
205
|
- var types = arr.map(function (v) {
|
|
|
206
|
- return v.busId;
|
|
|
207
|
- });
|
|
|
208
|
- busTypeArr.value = types;
|
|
|
209
|
- loadResList();
|
|
|
210
|
- }
|
|
|
211
|
- return {
|
|
|
212
|
- allData,
|
|
|
213
|
- temp,
|
|
|
214
|
- dialogFormVisible,
|
|
|
215
|
- dialogStatus,
|
|
|
216
|
- textMap,
|
|
|
217
|
- loadFrequency,
|
|
|
218
|
- frequencyArr,
|
|
|
219
|
- loadResList,
|
|
|
220
|
- getResType,
|
|
|
221
|
- getKpiType,
|
|
|
222
|
- onBtnSearch,
|
|
|
223
|
- handleUpdate,
|
|
|
224
|
- deleteRow,
|
|
|
225
|
- currentPage,
|
|
|
226
|
- columns,
|
|
|
227
|
- addedObj,
|
|
|
228
|
- addedTotal,
|
|
|
229
|
- noaddObj,
|
|
|
230
|
- noaddTotal,
|
|
|
231
|
- max
|
|
|
232
|
- }
|
|
|
233
|
-
|
|
|
234
|
- },
|
|
|
235
|
- mounted () {
|
|
|
236
|
- this.getData()
|
|
|
237
|
- window.addEventListener('resize', this.screenAdapter)
|
|
|
238
|
- this.screenAdapter()
|
|
|
239
|
- },
|
|
|
240
|
- unmounted () {
|
|
|
241
|
- window.removeEventListener('resize', this.screenAdapter)
|
|
|
242
|
- },
|
|
|
243
|
- watch:{
|
|
|
244
|
- commandVal(newValue, oldValue) {
|
|
|
245
|
- this.newCommandVal=newValue
|
|
|
246
|
- this.getData()
|
|
|
247
|
- }
|
|
|
248
|
-
|
|
|
249
|
- },
|
|
|
250
|
- methods: {
|
|
|
251
|
- getData () {
|
|
|
252
|
- let that=this;
|
|
|
253
|
- console.log(this.domainName)
|
|
|
254
|
- console.log(this.apiUrl)
|
|
|
255
|
-
|
|
|
256
|
- // 查询参数
|
|
|
257
|
- let params = {
|
|
|
258
|
- access_token: localStorage.getItem('access_token'),
|
|
|
259
|
- timeScope: 'Day',
|
|
|
260
|
- frequency: 5,
|
|
|
261
|
- resource :{
|
|
|
262
|
- resId :'i-k5e0597zznlzz1iaa8cc',
|
|
|
263
|
- kpiId : 'KPI05227E45',
|
|
|
264
|
- kpiFlg : 'base'
|
|
|
265
|
- }
|
|
|
266
|
-
|
|
|
267
|
- }
|
|
|
268
|
- that.$http.post(this.domainName +this.apiUrl, params, function (ret) {
|
|
|
269
|
- if(ret){
|
|
|
270
|
- let dataArr=[];
|
|
|
271
|
- let xAxisData='';
|
|
|
272
|
- if(ret.map){
|
|
|
273
|
- dataArr=ret.map.y
|
|
|
274
|
- xAxisData=ret.map.x
|
|
|
275
|
- }else{
|
|
|
276
|
- for(let i=0;i<12;i++){
|
|
|
277
|
- dataArr.push('0')
|
|
|
278
|
- }
|
|
|
279
|
-
|
|
|
280
|
- }
|
|
|
281
|
-
|
|
|
282
|
- that.allData= {
|
|
|
283
|
- polyline: {
|
|
|
284
|
- title: '',
|
|
|
285
|
- legend : ret.map.legend,
|
|
|
286
|
- unit: ret.map.units,
|
|
|
287
|
- data: {
|
|
|
288
|
- data: dataArr
|
|
|
289
|
- }
|
|
|
290
|
- },
|
|
|
291
|
- xAxis: xAxisData
|
|
|
292
|
-
|
|
|
293
|
- }
|
|
|
294
|
- that.updateChart()
|
|
|
295
|
- }
|
|
|
296
|
- })
|
|
|
297
|
-
|
|
|
298
|
- },
|
|
|
299
|
- updateChart () {
|
|
|
300
|
- console.log("ddd",this.allData)
|
|
|
301
|
- // 半透明的颜色值
|
|
|
302
|
- const colorArr1 = [
|
|
|
303
|
- 'rgba(11, 168, 44, 0.5)',
|
|
|
304
|
- 'rgba(44, 110, 255, 0.5)',
|
|
|
305
|
- 'rgba(22, 242, 217, 0.5)',
|
|
|
306
|
- 'rgba(35, 255, 255, 0.5)',
|
|
|
307
|
- 'rgba(254, 33, 30, 0.5)',
|
|
|
308
|
- 'rgba(250, 105, 0, 0.5)'
|
|
|
309
|
- ]
|
|
|
310
|
- // 全透明的颜色值
|
|
|
311
|
- const colorArr2 = [
|
|
|
312
|
- 'rgba(11, 168, 44, 0)',
|
|
|
313
|
- 'rgba(44, 110, 255, 0)',
|
|
|
314
|
- 'rgba(22, 242, 217, 0)',
|
|
|
315
|
- 'rgba(35, 255, 255, 0)',
|
|
|
316
|
- 'rgba(254, 33, 30, 0)',
|
|
|
317
|
- 'rgba(250, 105, 0, 0)'
|
|
|
318
|
- ]
|
|
|
319
|
- const timeArr = this.allData.xAxis
|
|
|
320
|
- const seriesData = this.allData.polyline.data
|
|
|
321
|
- // 图例的数据
|
|
|
322
|
- // const legendArr = this.allData.polyline.data.map(item => {
|
|
|
323
|
- // return item.name
|
|
|
324
|
- // })
|
|
|
325
|
- const legendArr=[];
|
|
|
326
|
- legendArr.push(this.allData.polyline.legend);
|
|
|
327
|
- const title = this.allData.polyline.title
|
|
|
328
|
-
|
|
|
329
|
-
|
|
|
330
|
- this.optionData = {
|
|
|
331
|
- title: {
|
|
|
332
|
- text: title,
|
|
|
333
|
- left: '10%',
|
|
|
334
|
- textStyle: {
|
|
|
335
|
- fontSize: this.titleFontSize*0.6,
|
|
|
336
|
- color:'#ffffff'
|
|
|
337
|
- }
|
|
|
338
|
- },
|
|
|
339
|
- tooltip: {
|
|
|
340
|
- trigger: 'axis',
|
|
|
341
|
- backgroundColor:'rgba(50,50,50,0.7)',
|
|
|
342
|
- borderColor:"#333",
|
|
|
343
|
- textStyle:{
|
|
|
344
|
- color:"#fff",
|
|
|
345
|
- align:'left'
|
|
|
346
|
- }
|
|
|
347
|
-
|
|
|
348
|
- },
|
|
|
349
|
- legend: {
|
|
|
350
|
- data: legendArr,
|
|
|
351
|
- itemHeight:0,//图例圆圈大小设置
|
|
|
352
|
- top:'10%',
|
|
|
353
|
- right:'20%',
|
|
|
354
|
- textStyle: {
|
|
|
355
|
- color: '#ffffff',
|
|
|
356
|
- fontsize:"12px"
|
|
|
357
|
- }
|
|
|
358
|
-
|
|
|
359
|
- },
|
|
|
360
|
- grid: {
|
|
|
361
|
- left: '3%',
|
|
|
362
|
- right: '4%',
|
|
|
363
|
- bottom: '3%',
|
|
|
364
|
- containLabel: true,
|
|
|
365
|
- },
|
|
|
366
|
- xAxis: {
|
|
|
367
|
- type: 'category',
|
|
|
368
|
- boundaryGap: false,
|
|
|
369
|
- data: timeArr,
|
|
|
370
|
-
|
|
|
371
|
- axisLine:{
|
|
|
372
|
- show:false,//是否显示坐标线
|
|
|
373
|
- },
|
|
|
374
|
- axisTick: {
|
|
|
375
|
- show: false //是否显示坐标刻度
|
|
|
376
|
- },
|
|
|
377
|
- axisLabel:{
|
|
|
378
|
- color:'#ffffff',
|
|
|
379
|
- },
|
|
|
380
|
-
|
|
|
381
|
- },
|
|
|
382
|
- yAxis: {
|
|
|
383
|
- axisLabel: {
|
|
|
384
|
- color:'#ffffff',
|
|
|
385
|
- },
|
|
|
386
|
- splitLine:{
|
|
|
387
|
- lineStyle: {
|
|
|
388
|
- color:'#0a1b31'
|
|
|
389
|
- }
|
|
|
390
|
- },
|
|
|
391
|
-
|
|
|
392
|
- },
|
|
|
393
|
- series: {
|
|
|
394
|
- type: 'line',
|
|
|
395
|
- data: seriesData,
|
|
|
396
|
- smooth: true,
|
|
|
397
|
- showSymbol:false,
|
|
|
398
|
- color:colorArr1[1],
|
|
|
399
|
- areaStyle: {
|
|
|
400
|
- color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
|
|
401
|
- {
|
|
|
402
|
- offset: 0,
|
|
|
403
|
- color: colorArr1[1]
|
|
|
404
|
- }, // %0的颜色值
|
|
|
405
|
- {
|
|
|
406
|
- offset: 1,
|
|
|
407
|
- color: colorArr2[1]
|
|
|
408
|
- } // 100%的颜色值
|
|
|
409
|
- ])
|
|
|
410
|
- }
|
|
|
411
|
- },
|
|
|
412
|
- itemStyle:{
|
|
|
413
|
- showSymbol:false
|
|
|
414
|
- }
|
|
|
415
|
- };
|
|
|
416
|
-
|
|
|
417
|
- },
|
|
|
418
|
-
|
|
|
419
|
- screenAdapter () {
|
|
|
420
|
- this.titleFontSize = document.getElementById('responsemonitor_ref').offsetWidth / 100 * 3.6
|
|
|
421
|
- const adapterOption = {
|
|
|
422
|
- title: {
|
|
|
423
|
- textStyle: {
|
|
|
424
|
- fontSize: this.titleFontSize / 1.5
|
|
|
425
|
- }
|
|
|
426
|
- },
|
|
|
427
|
- legend: {
|
|
|
428
|
- itemWidth: this.titleFontSize,
|
|
|
429
|
- itemHeight: this.titleFontSize,
|
|
|
430
|
- itemGap: this.titleFontSize,
|
|
|
431
|
- textStyle: {
|
|
|
432
|
- fontSize: this.titleFontSize / 2
|
|
|
433
|
- }
|
|
|
434
|
- }
|
|
|
435
|
- }
|
|
|
436
|
-
|
|
|
437
|
- },
|
|
|
438
|
-
|
|
|
439
|
- }
|
|
|
440
|
-} |
|
|