@arkxos/arkos-app-gateway-manage 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +36 -0
- package/ark_dist/ark-meta.json +75 -0
- package/ark_dist/ark_userChunk_1.js +5 -0
- package/ark_dist/ark_userChunk_2.js +49 -0
- package/ark_dist/css/views/views-CreateGateway.41b2bde6.css +297 -0
- package/ark_dist/favicon.ico +0 -0
- package/ark_dist/img/404.png +0 -0
- package/ark_dist/img/auth_banner.jpg +0 -0
- package/ark_dist/img/avatar.jpg +0 -0
- package/ark_dist/img/avatar2.gif +0 -0
- package/ark_dist/img/avatar3.gif +0 -0
- package/ark_dist/img/loginbg.svg +1 -0
- package/ark_dist/img/logo-r.png +0 -0
- package/ark_dist/img/logo.png +0 -0
- package/ark_dist/img/no-widgets.svg +57 -0
- package/ark_dist/img/tasks-example.png +0 -0
- package/ark_dist/img/ver.svg +236 -0
- package/ark_dist/index.html +132 -0
- package/ark_dist/js/app.e014b7a5.js +1 -0
- package/ark_dist/js/views/views-CreateGateway.7db295a9.js +3 -0
- package/ark_dist/js/views/views-CreateGateway.7db295a9.js.LICENSE.txt +1 -0
- package/ark_dist/js/views/views-CreateGateway.7db295a9.js.map +1 -0
- package/ark_proxy/entry.js +30 -0
- package/ark_proxy_es/entry.js +18 -0
- package/package.json +156 -0
- package/scripts/check.js +13 -0
- package/scripts/meta.js +21 -0
- package/scripts/prepublishOnly.js +28 -0
- package/src/api/apidoc_api.js +35 -0
- package/src/api/authority.js +161 -0
- package/src/api/balanced_api.js +101 -0
- package/src/api/client_api.js +68 -0
- package/src/api/count_api.js +62 -0
- package/src/api/gateway-manage/client_api.js +68 -0
- package/src/api/gateway-manage/open_client.js +188 -0
- package/src/api/gateway_api.js +81 -0
- package/src/api/global_function.js +278 -0
- package/src/api/global_variable.js +35 -0
- package/src/api/groovyscript_api.js +130 -0
- package/src/api/ip_api.js +47 -0
- package/src/api/monitor_api.js +24 -0
- package/src/api/regserver_api.js +224 -0
- package/src/api/request.js +107 -0
- package/src/assets/font_1930435_u2cpsigmd9d.js +38 -0
- package/src/assets/font_ma6wg7gw3td/demo.css +539 -0
- package/src/assets/font_ma6wg7gw3td/demo_index.html +674 -0
- package/src/assets/font_ma6wg7gw3td/iconfont.css +105 -0
- package/src/assets/font_ma6wg7gw3td/iconfont.eot +0 -0
- package/src/assets/font_ma6wg7gw3td/iconfont.js +1 -0
- package/src/assets/font_ma6wg7gw3td/iconfont.json +163 -0
- package/src/assets/font_ma6wg7gw3td/iconfont.svg +92 -0
- package/src/assets/font_ma6wg7gw3td/iconfont.ttf +0 -0
- package/src/assets/font_ma6wg7gw3td/iconfont.woff +0 -0
- package/src/assets/font_ma6wg7gw3td/iconfont.woff2 +0 -0
- package/src/assets/logo.png +0 -0
- package/src/assets/particles.json +110 -0
- package/src/auto-imports.d.ts +307 -0
- package/src/component/BoxCard.vue +156 -0
- package/src/component/ClientInfo.vue +82 -0
- package/src/component/GroovyScriptTable.vue +74 -0
- package/src/component/PanThumb/index.vue +149 -0
- package/src/component/RouteAccessChart.vue +85 -0
- package/src/component/RouteInfo.vue +146 -0
- package/src/component/RouteRequestCount.vue +126 -0
- package/src/component/TextHoverEffect/Mallki.vue +120 -0
- package/src/configs/subApp.ts +9 -0
- package/src/entrance/libProperties.ts +30 -0
- package/src/entrance/libTypes.ts +27 -0
- package/src/main.ts +13 -0
- package/src/plugins/index.ts +11 -0
- package/src/router/constantRoutes.js +155 -0
- package/src/router/loadComponent.js +29 -0
- package/src/views/AddClientGateway.vue +253 -0
- package/src/views/AddGatewayClient.vue +360 -0
- package/src/views/AddGroovyScript.vue +337 -0
- package/src/views/ApiCount.vue +291 -0
- package/src/views/ApiDoc.vue +293 -0
- package/src/views/ApiMonitor.vue +292 -0
- package/src/views/ClientList.vue +217 -0
- package/src/views/CreateBalanced.vue +341 -0
- package/src/views/CreateClient.vue +171 -0
- package/src/views/CreateGateway.vue +836 -0
- package/src/views/GatewayList.vue +322 -0
- package/src/views/GatewayTopology.vue +245 -0
- package/src/views/IpList.vue +218 -0
- package/src/views/LoadBalanced.vue +389 -0
- package/src/views/Main.vue +98 -0
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<el-page-header @back="goBack" content="网关路由规则组件"></el-page-header>
|
|
4
|
+
<el-dialog title="添加规则组件" v-model="dialogFormVisible" width="70%" :close-on-click-modal="false">
|
|
5
|
+
<el-form :model="groovyForm" status-icon :rules="rules" ref="groovyForm" label-width="100px" size="mini">
|
|
6
|
+
<el-form-item label="组件名称" prop="name">
|
|
7
|
+
<el-input v-model="groovyForm.name" autocomplete="off" placeholder="请输入组件名称"></el-input>
|
|
8
|
+
</el-form-item>
|
|
9
|
+
<el-form-item label="扩展参数" prop="extendInfo">
|
|
10
|
+
<el-input v-model="groovyForm.extendInfo" autocomplete="off" placeholder="请输入组件参数,建议使用json格式"></el-input>
|
|
11
|
+
</el-form-item>
|
|
12
|
+
<el-form-item label="执行事件" prop="event">
|
|
13
|
+
<!-- <el-input v-model="groovyForm.event" autocomplete="off"></el-input> -->
|
|
14
|
+
<el-radio v-model="groovyForm.event" label="request">
|
|
15
|
+
<el-tag size="small" effect="plain">REQUEST</el-tag>
|
|
16
|
+
</el-radio>
|
|
17
|
+
<el-radio v-model="groovyForm.event" label="response">
|
|
18
|
+
<el-tag size="small" type="success" effect="plain">RESPONSE</el-tag>
|
|
19
|
+
</el-radio>
|
|
20
|
+
</el-form-item>
|
|
21
|
+
<el-form-item label="组件代码" prop="content">
|
|
22
|
+
<el-input type="textarea" :rows="25" v-model="groovyForm.content" placeholder="请输入内容"></el-input>
|
|
23
|
+
</el-form-item>
|
|
24
|
+
<el-form-item label="备注" prop="remarks">
|
|
25
|
+
<el-input v-model="groovyForm.remarks" autocomplete="off"></el-input>
|
|
26
|
+
</el-form-item>
|
|
27
|
+
|
|
28
|
+
<el-form-item label="编译说明">
|
|
29
|
+
<el-tag type="warning">组件代码采用GroovyScipt动态脚本语言,无缝支持java语法和包</el-tag>
|
|
30
|
+
<el-link type="primary" @click="showGroovyScriptCode">导入GroovyScipt示例代码</el-link>
|
|
31
|
+
<el-link v-show="submitVisible" icon="el-icon-upload2" type="primary"> 提交中 > </el-link>
|
|
32
|
+
<el-link v-show="submitVisible" icon="el-icon-loading" type="primary"> 编译中 > </el-link>
|
|
33
|
+
<el-link v-show="successVisible" icon="el-icon-finished" type="success"> 编译成功 </el-link>
|
|
34
|
+
<el-link v-show="failVisible" icon="el-icon-close" type="danger" @click="showLog"> 编译失败 查看失败日志 </el-link>
|
|
35
|
+
</el-form-item>
|
|
36
|
+
</el-form>
|
|
37
|
+
<el-dialog width="65%" title="编译失败日志" v-model="innerVisible" append-to-body>
|
|
38
|
+
<pre class="language-java line-numbers" style="height: 500px;"><code>{{codeErrorMsg}}</code></pre>
|
|
39
|
+
<div slot="footer" class="dialog-footer">
|
|
40
|
+
<el-button icon="el-icon-s-release" size="mini" type="warning" @click="innerVisible = false">关 闭</el-button>
|
|
41
|
+
</div>
|
|
42
|
+
</el-dialog>
|
|
43
|
+
<div slot="footer" class="dialog-footer">
|
|
44
|
+
<el-button icon="el-icon-s-claim" size="mini" type="success" @click="submitForm">提 交</el-button>
|
|
45
|
+
<el-button icon="el-icon-s-release" size="mini" type="warning" @click="dialogFormVisible = false">关 闭</el-button>
|
|
46
|
+
</div>
|
|
47
|
+
</el-dialog>
|
|
48
|
+
|
|
49
|
+
<el-dialog title="查看组件代码" v-model="dialogCodeVisible" width="60%" :close-on-click-modal="false">
|
|
50
|
+
<div >
|
|
51
|
+
<pre class="language-java line-numbers" style="height: 700px;"><code v-html="groovScriptCode"></code></pre>
|
|
52
|
+
</div>
|
|
53
|
+
<div slot="footer" class="dialog-footer">
|
|
54
|
+
<el-button icon="el-icon-s-release" size="mini" type="warning" @click="dialogCodeVisible = false">关 闭</el-button>
|
|
55
|
+
</div>
|
|
56
|
+
</el-dialog>
|
|
57
|
+
|
|
58
|
+
<el-row :gutter="20" style="margin-top: 20px;">
|
|
59
|
+
<el-col>
|
|
60
|
+
<el-card class="box-card">
|
|
61
|
+
<div slot="header" class="clearfix">
|
|
62
|
+
<span>规则组件</span>
|
|
63
|
+
<el-popover trigger="click" placement="bottom">
|
|
64
|
+
<div style="font-size: 10pt;">
|
|
65
|
+
<span>添加规则组件说明:</span><br/>
|
|
66
|
+
<span>1. 开启路由服务端规则组件后,客户端请求到网关路由后,会进入规则组件过滤器。</span><br/>
|
|
67
|
+
<span>2. 规则组件过滤器根据添加的GroovyScript组件排序一一触发执行,当顺序执行组件过程抛出任意异常,则打断请求进程,直接返回客户端提示。</span><br/>
|
|
68
|
+
<span>3. 新添加的路由服务端规则组件后,默认为关闭状态,请手动开启后,立即生效。</span><br/>
|
|
69
|
+
<span>4. 路由服务端规则组件代码采用GroovyScipt动态脚本语言,无缝支持java语法和包。</span><br/>
|
|
70
|
+
<span>5. 路由服务端规则组件适用场景为,解决网关代理调用路由服务端之前,增加业务规则较验,如:签名较验、数据加签、参数验证、格式化处理、权限判断等。</span><br/>
|
|
71
|
+
</div>
|
|
72
|
+
<el-button slot="reference" style="padding: 3px 0;" icon="el-icon-question" type="text" title="说明"></el-button>
|
|
73
|
+
</el-popover>
|
|
74
|
+
<span style="margin-left: 50px;">
|
|
75
|
+
<i class="el-icon-monitor"></i>
|
|
76
|
+
<span style="font-size: 11pt;">
|
|
77
|
+
<el-tag size="mini" style="font-weight: bold;">{{routeForm.name}}</el-tag>
|
|
78
|
+
</span>
|
|
79
|
+
</span>
|
|
80
|
+
<div style="float: right; margin-left: 10px;">
|
|
81
|
+
<el-button icon="el-icon-circle-plus-outline" size="small" type="success" @click="addRule" title="查找服务端"> 添加组件脚本 </el-button>
|
|
82
|
+
</div>
|
|
83
|
+
</div>
|
|
84
|
+
|
|
85
|
+
<el-tabs v-model="activeName" tab-position="left" @tab-click="handleClickTabs" style="height: 600px;">
|
|
86
|
+
<el-tab-pane name="request">
|
|
87
|
+
<span slot="label"><i class="el-icon-position" style="color:#409EFF;"></i> REQUEST</span>
|
|
88
|
+
<!-- 父组件传参与子组件方法监听 -->
|
|
89
|
+
<groovyScriptTableComponent ref="groovyScriptTable"
|
|
90
|
+
:tableData="requestTableData"
|
|
91
|
+
@queryCode="queryCode"
|
|
92
|
+
@handleCommandRegServer="handleCommandRegServer"/>
|
|
93
|
+
</el-tab-pane>
|
|
94
|
+
<el-tab-pane name="response">
|
|
95
|
+
<span slot="label"><i class="el-icon-s-promotion" style="color:#67C23A;"></i> RESPONSE</span>
|
|
96
|
+
<!-- 父组件传参与子组件方法监听 -->
|
|
97
|
+
<groovyScriptTableComponent ref="groovyScriptTable"
|
|
98
|
+
:tableData="responseTableData"
|
|
99
|
+
@queryCode="queryCode"
|
|
100
|
+
@handleCommandRegServer="handleCommandRegServer"/>
|
|
101
|
+
</el-tab-pane>
|
|
102
|
+
</el-tabs>
|
|
103
|
+
|
|
104
|
+
</el-card>
|
|
105
|
+
</el-col>
|
|
106
|
+
</el-row>
|
|
107
|
+
|
|
108
|
+
</div>
|
|
109
|
+
</template>
|
|
110
|
+
|
|
111
|
+
<script>
|
|
112
|
+
|
|
113
|
+
import groovyScriptTableComponent from '../component/GroovyScriptTable.vue'
|
|
114
|
+
import {deleteGroovyScript,stopGroovyScript,startGroovyScript,upGroovyScript,downGroovyScript,groovyScriptList,groovyScriptCode} from '../api/groovyscript_api'
|
|
115
|
+
|
|
116
|
+
export default {
|
|
117
|
+
data() {
|
|
118
|
+
return {
|
|
119
|
+
innerVisible: false,
|
|
120
|
+
dialogCodeVisible: false,
|
|
121
|
+
dialogFormVisible: false,
|
|
122
|
+
formLabelWidth: '100px',
|
|
123
|
+
handleType: null,
|
|
124
|
+
routeForm:{},
|
|
125
|
+
groovyForm:{
|
|
126
|
+
name: '',
|
|
127
|
+
extendInfo: '',
|
|
128
|
+
event: 'request',
|
|
129
|
+
content: '',
|
|
130
|
+
remarks: ''
|
|
131
|
+
},
|
|
132
|
+
rules:{
|
|
133
|
+
name: [
|
|
134
|
+
{ required: true, message: '请输入组件名称', trigger: 'blur' },
|
|
135
|
+
{ min: 3, max: 40, message: '长度在 3 到 40 个字符', trigger: 'blur' }
|
|
136
|
+
],
|
|
137
|
+
content: [
|
|
138
|
+
{ required: true, message: '请输入组件代码', trigger: 'blur' }
|
|
139
|
+
],
|
|
140
|
+
},
|
|
141
|
+
tableData: [],
|
|
142
|
+
requestTableData: [],
|
|
143
|
+
responseTableData: [],
|
|
144
|
+
submitVisible: false,
|
|
145
|
+
successVisible: false,
|
|
146
|
+
failVisible: false,
|
|
147
|
+
groovScriptCode: '',
|
|
148
|
+
codeErrorMsg: '',
|
|
149
|
+
activeName: 'request'
|
|
150
|
+
};
|
|
151
|
+
},
|
|
152
|
+
components:{
|
|
153
|
+
groovyScriptTableComponent
|
|
154
|
+
},
|
|
155
|
+
created: function() {
|
|
156
|
+
//在组件创建完毕后加载
|
|
157
|
+
let query = this.$route.query;
|
|
158
|
+
if (query){
|
|
159
|
+
let route = query.route;
|
|
160
|
+
console.log('route', route);
|
|
161
|
+
this.init(route);
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
mounted: function() {
|
|
165
|
+
|
|
166
|
+
},
|
|
167
|
+
beforeDestroy: function() {
|
|
168
|
+
|
|
169
|
+
},
|
|
170
|
+
methods:{
|
|
171
|
+
init(route) {
|
|
172
|
+
if (route){
|
|
173
|
+
this.routeForm = route.form;
|
|
174
|
+
this.groovyScriptList();
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
goBack() {
|
|
178
|
+
console.log('go back');
|
|
179
|
+
this.$router.push({path:'/gatewayList',query:{}});
|
|
180
|
+
},
|
|
181
|
+
handleCommandRegServer(obj){
|
|
182
|
+
console.log("command" , obj);
|
|
183
|
+
let _this = this;
|
|
184
|
+
this.handleType = obj.command;
|
|
185
|
+
if (obj.command === 'edit'){
|
|
186
|
+
this.groovyForm = JSON.parse(JSON.stringify(obj.row));
|
|
187
|
+
this.resetVisible();
|
|
188
|
+
this.dialogFormVisible = true;
|
|
189
|
+
} else if (obj.command === 'start'){
|
|
190
|
+
this.$confirm('确认开启"'+obj.row.name+'"规则引擎动态脚本组件?').then(_ => {
|
|
191
|
+
startGroovyScript({id:obj.row.id}).then(function(result){
|
|
192
|
+
_this.GLOBAL_FUN.successMsg();
|
|
193
|
+
obj.row.status='0';
|
|
194
|
+
});
|
|
195
|
+
}).catch(_ => {});
|
|
196
|
+
} else if (obj.command === 'stop'){
|
|
197
|
+
this.$confirm('确认关闭"'+obj.row.name+'"规则引擎动态脚本组件?').then(_ => {
|
|
198
|
+
stopGroovyScript({id:obj.row.id}).then(function(result){
|
|
199
|
+
_this.GLOBAL_FUN.successMsg();
|
|
200
|
+
obj.row.status='1';
|
|
201
|
+
});
|
|
202
|
+
}).catch(_ => {});
|
|
203
|
+
} else if (obj.command === 'up'){
|
|
204
|
+
let rowObj = obj.row;
|
|
205
|
+
if (rowObj && rowObj.orderNum === 1){
|
|
206
|
+
_this.GLOBAL_FUN.successMsg('已经是排序第一位');
|
|
207
|
+
return false;
|
|
208
|
+
}
|
|
209
|
+
this.$confirm('确认上移"'+rowObj.name+'"规则引擎动态脚本组件?').then(_ => {
|
|
210
|
+
upGroovyScript({id:rowObj.id}).then(function(result){
|
|
211
|
+
_this.GLOBAL_FUN.successMsg();
|
|
212
|
+
_this.groovyScriptList();
|
|
213
|
+
});
|
|
214
|
+
}).catch(_ => {});
|
|
215
|
+
} else if (obj.command === 'down'){
|
|
216
|
+
let rowObj = obj.row;
|
|
217
|
+
let maxRow = this.tableData[this.tableData.length -1]
|
|
218
|
+
if (rowObj && maxRow && rowObj.id === maxRow.id){
|
|
219
|
+
_this.GLOBAL_FUN.successMsg('已经是排序最后一位');
|
|
220
|
+
return false;
|
|
221
|
+
}
|
|
222
|
+
this.$confirm('确认下移"'+rowObj.name+'"规则引擎动态脚本组件?').then(_ => {
|
|
223
|
+
downGroovyScript({id:rowObj.id}).then(function(result){
|
|
224
|
+
_this.GLOBAL_FUN.successMsg();
|
|
225
|
+
_this.groovyScriptList();
|
|
226
|
+
});
|
|
227
|
+
}).catch(_ => {});
|
|
228
|
+
} else if (obj.command === 'delete'){
|
|
229
|
+
this.$confirm('确认删除"'+obj.row.name+'"规则引擎动态脚本组件?').then(_ => {
|
|
230
|
+
deleteGroovyScript({id:obj.row.id}).then(function(result){
|
|
231
|
+
_this.GLOBAL_FUN.successMsg();
|
|
232
|
+
_this.groovyScriptList();
|
|
233
|
+
})
|
|
234
|
+
}).catch(_ => {});
|
|
235
|
+
}
|
|
236
|
+
},
|
|
237
|
+
queryCode(row){
|
|
238
|
+
this.groovScriptCode = row.content;
|
|
239
|
+
this.dialogCodeVisible = true;
|
|
240
|
+
setTimeout(()=>Prism.highlightAll(),50);
|
|
241
|
+
},
|
|
242
|
+
addRule(){
|
|
243
|
+
this.resetVisible();
|
|
244
|
+
if (this.$refs['groovyForm']){
|
|
245
|
+
this.$refs['groovyForm'].resetFields();
|
|
246
|
+
}
|
|
247
|
+
this.handleType = 'add';
|
|
248
|
+
this.groovyForm = this.$options.data().groovyForm;
|
|
249
|
+
this.dialogFormVisible = true;
|
|
250
|
+
},
|
|
251
|
+
submitForm(){
|
|
252
|
+
console.log('handleType', this.handleType);
|
|
253
|
+
let _this = this;
|
|
254
|
+
this.$refs['groovyForm'].validate((valid) => {
|
|
255
|
+
if (valid) {
|
|
256
|
+
this.submitVisible = true;
|
|
257
|
+
this.failVisible = false;
|
|
258
|
+
this.successVisible = false;
|
|
259
|
+
this.groovyForm.routeId = this.routeForm.id;
|
|
260
|
+
let path = this.handleType == 'add' ? '/groovyScript/add' : '/groovyScript/update' ;
|
|
261
|
+
this.$ajax
|
|
262
|
+
.post(this.GLOBAL_VAR.baseURL + path, this.groovyForm)
|
|
263
|
+
.then((result) => {
|
|
264
|
+
if (result && result.data) {
|
|
265
|
+
if (result.data.code == '1') {
|
|
266
|
+
_this.successVisible = true;
|
|
267
|
+
_this.GLOBAL_FUN.successMsg();
|
|
268
|
+
_this.groovyScriptList();
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
})
|
|
272
|
+
.catch((error) => { // 请求失败处理
|
|
273
|
+
if (error && error.response) {
|
|
274
|
+
_this.failVisible = true;
|
|
275
|
+
if (error.response.data){
|
|
276
|
+
_this.codeErrorMsg = error.response.data.msg;
|
|
277
|
+
_this.GLOBAL_FUN.errorMsg("操作失败,请查看失败日志!");
|
|
278
|
+
}else {
|
|
279
|
+
_this.GLOBAL_FUN.errorMsg("操作失败!");
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
});
|
|
285
|
+
},
|
|
286
|
+
showLog(){ //显示日志
|
|
287
|
+
this.innerVisible = true;
|
|
288
|
+
setTimeout(()=>Prism.highlightAll(),50);
|
|
289
|
+
},
|
|
290
|
+
resetVisible(){ //重置弹窗标识
|
|
291
|
+
this.submitVisible = false;
|
|
292
|
+
this.successVisible = false;
|
|
293
|
+
this.failVisible = false;
|
|
294
|
+
},
|
|
295
|
+
handleClickTabs(tab, event){
|
|
296
|
+
console.log(tab, event);
|
|
297
|
+
if (tab.index === '0'){
|
|
298
|
+
this.tableData = this.requestTableData;
|
|
299
|
+
} else {
|
|
300
|
+
this.tableData = this.responseTableData;
|
|
301
|
+
}
|
|
302
|
+
},
|
|
303
|
+
showGroovyScriptCode(){//导入示例代码
|
|
304
|
+
this.groovyForm.content = groovyScriptCode();
|
|
305
|
+
},
|
|
306
|
+
groovyScriptList(){
|
|
307
|
+
let _this = this;
|
|
308
|
+
groovyScriptList({routeId: this.routeForm.id}).then((result) => {
|
|
309
|
+
if (result.data){
|
|
310
|
+
_this.requestTableData = [];
|
|
311
|
+
_this.responseTableData = [];
|
|
312
|
+
result.data.forEach((data, index)=>{
|
|
313
|
+
if (data.event == 'request'){
|
|
314
|
+
_this.requestTableData.push(data);
|
|
315
|
+
} else {
|
|
316
|
+
_this.responseTableData.push(data);
|
|
317
|
+
}
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
</script>
|
|
325
|
+
|
|
326
|
+
<style>
|
|
327
|
+
.el-icon-setting:before {
|
|
328
|
+
content: "\E6CA";
|
|
329
|
+
font-size: 12pt;
|
|
330
|
+
}
|
|
331
|
+
.el-tabs__item.is-active {
|
|
332
|
+
color: #409EFF;
|
|
333
|
+
background-color: #ecf5ff;
|
|
334
|
+
}
|
|
335
|
+
</style>
|
|
336
|
+
|
|
337
|
+
|
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="layout-padding">
|
|
3
|
+
<div class="layout-padding-auto layout-padding-view">
|
|
4
|
+
<div class="box-flex-between">
|
|
5
|
+
<el-button
|
|
6
|
+
size="small"
|
|
7
|
+
icon="el-icon-refresh"
|
|
8
|
+
style="font-size: 16px; padding: 6px 12px"
|
|
9
|
+
@click="count"
|
|
10
|
+
title="刷新统计图表"
|
|
11
|
+
></el-button>
|
|
12
|
+
</div>
|
|
13
|
+
|
|
14
|
+
<el-row :gutter="24" style="margin-top: 16px">
|
|
15
|
+
<el-col :span="12">
|
|
16
|
+
<div style="margin-left: 20px">
|
|
17
|
+
<i
|
|
18
|
+
class="iconfont icon-icon_renwujincheng"
|
|
19
|
+
style="font-size: 16pt; color: #90a0a5"
|
|
20
|
+
></i>
|
|
21
|
+
<span class="span_14">7日请求总量</span>
|
|
22
|
+
</div>
|
|
23
|
+
<el-divider style="width: 80%"></el-divider>
|
|
24
|
+
<div id="apiAccessChart" class="chart_line_1"></div>
|
|
25
|
+
</el-col>
|
|
26
|
+
<el-col :span="12">
|
|
27
|
+
<div style="margin-left: 20px">
|
|
28
|
+
<i
|
|
29
|
+
class="iconfont icon-yibiaopan"
|
|
30
|
+
style="font-size: 16pt; color: #90a0a5"
|
|
31
|
+
></i>
|
|
32
|
+
<span class="span_14">24小时请求总量</span>
|
|
33
|
+
</div>
|
|
34
|
+
<el-divider style="width: 80%"></el-divider>
|
|
35
|
+
<div id="requestAccessChart" class="chart_line_1"></div>
|
|
36
|
+
</el-col>
|
|
37
|
+
</el-row>
|
|
38
|
+
|
|
39
|
+
<el-row style="margin-top: 18px">
|
|
40
|
+
<el-col :span="10"> </el-col>
|
|
41
|
+
<el-col :span="14">
|
|
42
|
+
<div style="float: right">
|
|
43
|
+
<el-input
|
|
44
|
+
placeholder="请输入服务端名称"
|
|
45
|
+
v-model="form.name"
|
|
46
|
+
class="input-with-select"
|
|
47
|
+
style="width: 520px"
|
|
48
|
+
>
|
|
49
|
+
<template #prepend>
|
|
50
|
+
<el-select
|
|
51
|
+
v-model="form.groupCode"
|
|
52
|
+
placeholder="请选择分组"
|
|
53
|
+
style="width: 140px; margin-right: 10px"
|
|
54
|
+
>
|
|
55
|
+
<el-option label="所有" value="" />
|
|
56
|
+
<el-option
|
|
57
|
+
v-for="item in groupOptions"
|
|
58
|
+
:key="item.value"
|
|
59
|
+
:label="item.label"
|
|
60
|
+
:value="item.value"
|
|
61
|
+
/>
|
|
62
|
+
</el-select>
|
|
63
|
+
</template>
|
|
64
|
+
<template #append>
|
|
65
|
+
<el-button icon="el-icon-search" @click="search"></el-button>
|
|
66
|
+
</template>
|
|
67
|
+
</el-input>
|
|
68
|
+
</div>
|
|
69
|
+
</el-col>
|
|
70
|
+
</el-row>
|
|
71
|
+
|
|
72
|
+
<el-table size="small" :data="tableData" style="margin-top: 18px">
|
|
73
|
+
<el-table-column label="服务ID" width="300">
|
|
74
|
+
<template #default="{ row }">
|
|
75
|
+
<el-tag size="small" type="warning">{{ row.id }}</el-tag>
|
|
76
|
+
</template>
|
|
77
|
+
</el-table-column>
|
|
78
|
+
<el-table-column label="分组">
|
|
79
|
+
<template #default="{ row }">
|
|
80
|
+
<el-tag
|
|
81
|
+
v-for="group in groupOptions"
|
|
82
|
+
:key="group.value"
|
|
83
|
+
v-show="group.value === row.groupCode"
|
|
84
|
+
size="small"
|
|
85
|
+
type=""
|
|
86
|
+
>{{ group.label }}</el-tag
|
|
87
|
+
>
|
|
88
|
+
</template>
|
|
89
|
+
</el-table-column>
|
|
90
|
+
<el-table-column label="服务名称">
|
|
91
|
+
<template #default="{ row }">
|
|
92
|
+
<el-tag size="small" type="success">{{ row.name }}</el-tag>
|
|
93
|
+
</template>
|
|
94
|
+
</el-table-column>
|
|
95
|
+
<el-table-column label="服务地址" prop="uri"></el-table-column>
|
|
96
|
+
<el-table-column label="断言路径" prop="path"></el-table-column>
|
|
97
|
+
<!-- <el-table-column label="最近请求时间" prop="createTime" width="220"></el-table-column> -->
|
|
98
|
+
<el-table-column
|
|
99
|
+
label="今日请求总次数"
|
|
100
|
+
prop="count"
|
|
101
|
+
width="140"
|
|
102
|
+
style="font-weight: bold"
|
|
103
|
+
></el-table-column>
|
|
104
|
+
<el-table-column label="查看" width="80">
|
|
105
|
+
<template #default="{ row }">
|
|
106
|
+
<el-button
|
|
107
|
+
size="mini"
|
|
108
|
+
@click="handleShowRouteCount(row)"
|
|
109
|
+
circle
|
|
110
|
+
title="请点击选中查看"
|
|
111
|
+
class="el-icon-s-data"
|
|
112
|
+
>
|
|
113
|
+
</el-button>
|
|
114
|
+
</template>
|
|
115
|
+
</el-table-column>
|
|
116
|
+
</el-table>
|
|
117
|
+
<div class="block" style="margin-top: 20px">
|
|
118
|
+
<el-pagination
|
|
119
|
+
@size-change="handleSizeChange"
|
|
120
|
+
@current-change="handleCurrentChange"
|
|
121
|
+
:current-page="currentPage"
|
|
122
|
+
:page-sizes="[10, 30, 50]"
|
|
123
|
+
:page-size="pageSize"
|
|
124
|
+
layout="total, sizes, prev, pager, next, jumper"
|
|
125
|
+
:total="totalNum"
|
|
126
|
+
>
|
|
127
|
+
</el-pagination>
|
|
128
|
+
</div>
|
|
129
|
+
</div>
|
|
130
|
+
|
|
131
|
+
<routeRequestCountComponent
|
|
132
|
+
ref="routeRequestCount"
|
|
133
|
+
></routeRequestCountComponent>
|
|
134
|
+
</div>
|
|
135
|
+
</template>
|
|
136
|
+
|
|
137
|
+
<script>
|
|
138
|
+
import * as echarts from "echarts";
|
|
139
|
+
import routeRequestCountComponent from "../component/RouteRequestCount.vue";
|
|
140
|
+
import { countRoutePageList, countRequestTotal } from "../api/count_api.js";
|
|
141
|
+
|
|
142
|
+
export default {
|
|
143
|
+
data() {
|
|
144
|
+
return {
|
|
145
|
+
form: {
|
|
146
|
+
name: null,
|
|
147
|
+
groupCode: null,
|
|
148
|
+
},
|
|
149
|
+
direction: "rtl",
|
|
150
|
+
dayCounts: [],
|
|
151
|
+
hourCounts: [],
|
|
152
|
+
tableData: [],
|
|
153
|
+
currentPage: 1,
|
|
154
|
+
pageSize: 10,
|
|
155
|
+
totalNum: 0,
|
|
156
|
+
statusOptions: [
|
|
157
|
+
{ value: null, label: "所有" },
|
|
158
|
+
{ value: "0", label: "启用" },
|
|
159
|
+
{ value: "1", label: "禁用" },
|
|
160
|
+
],
|
|
161
|
+
groupOptions: this.GLOBAL_VAR.groups,
|
|
162
|
+
};
|
|
163
|
+
},
|
|
164
|
+
components: {
|
|
165
|
+
routeRequestCountComponent,
|
|
166
|
+
},
|
|
167
|
+
created: function () {
|
|
168
|
+
this.init();
|
|
169
|
+
},
|
|
170
|
+
mounted: function () {},
|
|
171
|
+
beforeDestroy: function () {},
|
|
172
|
+
methods: {
|
|
173
|
+
init() {
|
|
174
|
+
this.search();
|
|
175
|
+
this.count();
|
|
176
|
+
},
|
|
177
|
+
handleSizeChange(val) {
|
|
178
|
+
this.pageSize = val;
|
|
179
|
+
this.search();
|
|
180
|
+
},
|
|
181
|
+
handleCurrentChange(val) {
|
|
182
|
+
this.currentPage = val;
|
|
183
|
+
this.search();
|
|
184
|
+
},
|
|
185
|
+
handleShowRouteCount(row) {
|
|
186
|
+
this.$refs.routeRequestCount.dialogFormVisible = true;
|
|
187
|
+
this.$refs.routeRequestCount.count(row);
|
|
188
|
+
},
|
|
189
|
+
count() {
|
|
190
|
+
let _this = this;
|
|
191
|
+
countRequestTotal().then(function (result) {
|
|
192
|
+
console.log(result);
|
|
193
|
+
if (result.data) {
|
|
194
|
+
_this.drawLine("apiAccessChart", result.data.dayCounts);
|
|
195
|
+
_this.drawLine("requestAccessChart", result.data.hourCounts);
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
},
|
|
199
|
+
search() {
|
|
200
|
+
let _this = this;
|
|
201
|
+
countRoutePageList({
|
|
202
|
+
name: this.form.name,
|
|
203
|
+
groupCode: this.form.groupCode,
|
|
204
|
+
currentPage: this.currentPage,
|
|
205
|
+
pageSize: this.pageSize,
|
|
206
|
+
}).then(function (result) {
|
|
207
|
+
if (result.data) {
|
|
208
|
+
_this.tableData = result.data.records;
|
|
209
|
+
_this.totalNum = result.data.total;
|
|
210
|
+
}
|
|
211
|
+
});
|
|
212
|
+
},
|
|
213
|
+
drawLine(id, result) {
|
|
214
|
+
let xAxisData = [];
|
|
215
|
+
let seriesData = [];
|
|
216
|
+
if (result != undefined) {
|
|
217
|
+
xAxisData = result.dates;
|
|
218
|
+
seriesData = result.counts;
|
|
219
|
+
}
|
|
220
|
+
console.log("chart data", seriesData);
|
|
221
|
+
let _this = this;
|
|
222
|
+
// 基于准备好的dom,初始化echarts实例
|
|
223
|
+
let accessChart = echarts.init(document.getElementById(id));
|
|
224
|
+
var option = {
|
|
225
|
+
color: "#1890FF",
|
|
226
|
+
tooltip: {
|
|
227
|
+
trigger: "axis",
|
|
228
|
+
axisPointer: {
|
|
229
|
+
type: "cross",
|
|
230
|
+
label: {
|
|
231
|
+
backgroundColor: "#6a7985",
|
|
232
|
+
},
|
|
233
|
+
},
|
|
234
|
+
},
|
|
235
|
+
grid: {
|
|
236
|
+
top: "5%",
|
|
237
|
+
left: "1%",
|
|
238
|
+
right: "2%",
|
|
239
|
+
bottom: "1%",
|
|
240
|
+
containLabel: true,
|
|
241
|
+
},
|
|
242
|
+
yAxis: {
|
|
243
|
+
type: "value",
|
|
244
|
+
},
|
|
245
|
+
xAxis: {
|
|
246
|
+
type: "category",
|
|
247
|
+
//data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
|
|
248
|
+
data: xAxisData,
|
|
249
|
+
},
|
|
250
|
+
series: [
|
|
251
|
+
{
|
|
252
|
+
//data: [820, 932, 901, 934, 1290, 1330, 1320],
|
|
253
|
+
data: seriesData,
|
|
254
|
+
type: "line",
|
|
255
|
+
smooth: true,
|
|
256
|
+
},
|
|
257
|
+
],
|
|
258
|
+
};
|
|
259
|
+
// 绘制图表
|
|
260
|
+
accessChart.setOption(option, true);
|
|
261
|
+
},
|
|
262
|
+
},
|
|
263
|
+
};
|
|
264
|
+
</script>
|
|
265
|
+
|
|
266
|
+
<style lang="scss" scoped>
|
|
267
|
+
.input-with-select .el-input-group__prepend {
|
|
268
|
+
background-color: #fff;
|
|
269
|
+
}
|
|
270
|
+
.el-divider--horizontal {
|
|
271
|
+
display: block;
|
|
272
|
+
height: 1px;
|
|
273
|
+
width: 97%;
|
|
274
|
+
margin: 14px;
|
|
275
|
+
}
|
|
276
|
+
.span_1 {
|
|
277
|
+
font-size: 18pt;
|
|
278
|
+
font-weight: bold;
|
|
279
|
+
margin-bottom: 9px;
|
|
280
|
+
}
|
|
281
|
+
.span_14 {
|
|
282
|
+
font-size: 14pt;
|
|
283
|
+
color: #90a0a5;
|
|
284
|
+
font-weight: bold;
|
|
285
|
+
margin-left: 6px;
|
|
286
|
+
}
|
|
287
|
+
.chart_line_1 {
|
|
288
|
+
width: 100%;
|
|
289
|
+
height: 220px;
|
|
290
|
+
}
|
|
291
|
+
</style>
|