@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,322 @@
|
|
|
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 icon="el-icon-folder-add" style="margin-left:5px" type="primary" @click="handleCreateGateway" title="创建网关服务"></el-button>
|
|
6
|
+
|
|
7
|
+
<el-input placeholder="请输入网关服务名称" v-model="form.name" class="input-with-select" style="width: 620px;" clearable>
|
|
8
|
+
<template #prepend>
|
|
9
|
+
<el-select v-model="form.groupCode" placeholder="请选择分组" style="width: 140px; margin-right: 10px;">
|
|
10
|
+
<el-option label="所有" value=""/>
|
|
11
|
+
<el-option v-for="item in groupOptions" :key="item.value" :label="item.label" :value="item.value"/>
|
|
12
|
+
</el-select>
|
|
13
|
+
<el-popover placement="bottom" trigger="click">
|
|
14
|
+
<el-radio v-model="form.status" v-for="item in statusOptions" :key="item.value" :label="item.value">{{item.label}}</el-radio>
|
|
15
|
+
<template #reference>
|
|
16
|
+
<el-button>
|
|
17
|
+
服务状态:{{form.status === '0' ? '启用': form.status === '1' ? '禁用' : '所有'}}<i class="el-icon-caret-bottom el-icon--right"></i>
|
|
18
|
+
</el-button>
|
|
19
|
+
</template>
|
|
20
|
+
</el-popover>
|
|
21
|
+
</template>
|
|
22
|
+
<template #append>
|
|
23
|
+
<el-button icon="el-icon-search" @click="search" title="查询网关服务"></el-button>
|
|
24
|
+
</template>
|
|
25
|
+
</el-input>
|
|
26
|
+
</div>
|
|
27
|
+
|
|
28
|
+
<el-table size="small" :data="tableData" height="100%" style="width: 100%">
|
|
29
|
+
<el-table-column label="服务ID" width="180">
|
|
30
|
+
<template #default="{ row }">
|
|
31
|
+
<el-tag size="small" type="warning" style="font-weight: bold;">{{row.id}}</el-tag>
|
|
32
|
+
</template>
|
|
33
|
+
</el-table-column>
|
|
34
|
+
<el-table-column label="分组" width="100">
|
|
35
|
+
<template #default="{ row }">
|
|
36
|
+
<el-tag v-for="group in groupOptions" :key="group.value" v-show="(group.value === row.groupCode)" size="small" type="">{{group.label}}</el-tag>
|
|
37
|
+
</template>
|
|
38
|
+
</el-table-column>
|
|
39
|
+
<el-table-column label="系统代号>服务名称">
|
|
40
|
+
<template #default="{ row }">
|
|
41
|
+
<span style="font-weight: bold;" v-if="row.systemCode != undefined && row.systemCode != ''">{{row.systemCode}} ></span> {{row.name}}
|
|
42
|
+
</template>
|
|
43
|
+
</el-table-column>
|
|
44
|
+
<el-table-column label="服务地址" :show-overflow-tooltip="true">
|
|
45
|
+
<template #default="{ row }">
|
|
46
|
+
<el-tag size="small" type="success" style="font-weight: bold;">{{row.uri}}</el-tag>
|
|
47
|
+
</template>
|
|
48
|
+
</el-table-column>
|
|
49
|
+
<el-table-column label="断言路径">
|
|
50
|
+
<template #default="{ row }">
|
|
51
|
+
{{row.path}}
|
|
52
|
+
<el-popover
|
|
53
|
+
placement="bottom"
|
|
54
|
+
:width="250"
|
|
55
|
+
trigger="click"
|
|
56
|
+
>
|
|
57
|
+
<template #reference>
|
|
58
|
+
<el-icon color="#409eff"><DataAnalysis /></el-icon>
|
|
59
|
+
</template>
|
|
60
|
+
<template #default>
|
|
61
|
+
<div style="margin-bottom: 8px;">
|
|
62
|
+
<i class="el-icon-dataAnalysis" style="font-size: 16pt; color: #90A0A5;"></i>
|
|
63
|
+
<span class="route-title">网关代理地址</span>
|
|
64
|
+
</div>
|
|
65
|
+
<div style="display:flex;align-items: center;">
|
|
66
|
+
<el-tag size="small" type="success" style="font-weight: bold;">{{GLOBAL_VAR.gatewayRoutesURL}}{{row.path}}</el-tag>
|
|
67
|
+
<el-button icon="el-icon-document-copy" type="text" @click="handleCopy(row.path)" title="复制"></el-button>
|
|
68
|
+
</div>
|
|
69
|
+
<br/>
|
|
70
|
+
<el-button style="padding: 3px 0; " type="text" title="网关代理地址"></el-button>
|
|
71
|
+
</template>
|
|
72
|
+
</el-popover>
|
|
73
|
+
</template>
|
|
74
|
+
</el-table-column>
|
|
75
|
+
<el-table-column label="请求模式" prop="method" width="80">
|
|
76
|
+
<template #default="{ row }">
|
|
77
|
+
<el-tag effect="plain" size="small" v-if="row.method !== ''" type="success">{{ row.method }}</el-tag>
|
|
78
|
+
</template>
|
|
79
|
+
</el-table-column>
|
|
80
|
+
<el-table-column label="熔断器" prop="degradeRuleName" width="75">
|
|
81
|
+
<template #default="{ row }">
|
|
82
|
+
<el-tag effect="plain" size="small" v-if="row.degradeRuleName === 'default'" type="">启用</el-tag>
|
|
83
|
+
</template>
|
|
84
|
+
</el-table-column>
|
|
85
|
+
<el-table-column label="限流器" prop="flowRuleName" width="90">
|
|
86
|
+
<template #default="{ row }">
|
|
87
|
+
<el-tag effect="plain" size="small" v-if="row.flowRuleName === 'default'" type="">直接拒绝</el-tag>
|
|
88
|
+
<el-tag effect="plain" size="small" v-if="row.flowRuleName === 'warmUp'" type="">冷启动</el-tag>
|
|
89
|
+
<el-tag effect="plain" size="small" v-if="row.flowRuleName === 'rateLimiter'" type="">匀速器</el-tag>
|
|
90
|
+
</template>
|
|
91
|
+
</el-table-column>
|
|
92
|
+
<el-table-column label="缓存时长" prop="cacheTtl" width="75">
|
|
93
|
+
<template #default="{ row }">
|
|
94
|
+
<el-tag effect="plain" size="small" v-if="row.cacheTtl > 0" type="success">{{ row.cacheTtl }}s</el-tag>
|
|
95
|
+
</template>
|
|
96
|
+
</el-table-column>
|
|
97
|
+
<el-table-column label="规则组件" prop="useScript" width="75">
|
|
98
|
+
<template #default="{ row }">
|
|
99
|
+
<el-tag effect="plain" size="small" v-if="row.useScript > 0" type="">启用</el-tag>
|
|
100
|
+
</template>
|
|
101
|
+
</el-table-column>
|
|
102
|
+
<el-table-column label="创建时间" width="140" prop="createTime"></el-table-column>
|
|
103
|
+
<el-table-column label="状态" width="80" prop="status" :formatter="formatterStatus">
|
|
104
|
+
<template #default="{ row }">
|
|
105
|
+
<el-tag effect="dark" size="small" v-if="row.status === '0'" type="">启用</el-tag>
|
|
106
|
+
<el-tag effect="dark" size="small" v-if="row.status === '1'" type="danger">禁用</el-tag>
|
|
107
|
+
</template>
|
|
108
|
+
</el-table-column>
|
|
109
|
+
<el-table-column label="操作" width="100">
|
|
110
|
+
<template #default="{ row }">
|
|
111
|
+
<el-dropdown trigger="click" @command="handleCommandGateway">
|
|
112
|
+
<el-button size="small" type="warning">
|
|
113
|
+
管理
|
|
114
|
+
<el-icon><ArrowDown /></el-icon>
|
|
115
|
+
</el-button>
|
|
116
|
+
<template #dropdown>
|
|
117
|
+
<el-dropdown-menu>
|
|
118
|
+
<el-dropdown-item icon="el-icon-user" :command="{command:'addClient', row: row}">注册客户端</el-dropdown-item>
|
|
119
|
+
<el-dropdown-item icon="el-icon-tickets" :command="{command:'info', row: row}">详情</el-dropdown-item>
|
|
120
|
+
<el-dropdown-item icon="el-icon-orange" :command="{command:'topology', row: row}">拓扑</el-dropdown-item>
|
|
121
|
+
<el-dropdown-item icon="el-icon-edit" :command="{command:'edit', row: row}">编辑</el-dropdown-item>
|
|
122
|
+
<el-dropdown-item icon="el-icon-eleme" :command="{command:'rule', row: row}">规则组件</el-dropdown-item>
|
|
123
|
+
<el-dropdown-item :command="{command:'start', row: row}" divided><el-icon color="#409EFF"><CircleCheckFilled /></el-icon>启用</el-dropdown-item>
|
|
124
|
+
<el-dropdown-item :command="{command:'stop', row: row}"><el-icon color="#ff0000"><CircleCloseFilled /></el-icon>禁用</el-dropdown-item>
|
|
125
|
+
<el-dropdown-item icon="el-icon-delete" :command="{command:'delete', row: row}" divided>删除</el-dropdown-item>
|
|
126
|
+
</el-dropdown-menu>
|
|
127
|
+
</template>
|
|
128
|
+
</el-dropdown>
|
|
129
|
+
</template>
|
|
130
|
+
</el-table-column>
|
|
131
|
+
</el-table>
|
|
132
|
+
|
|
133
|
+
<div class="block">
|
|
134
|
+
<el-pagination
|
|
135
|
+
@size-change="handleSizeChange"
|
|
136
|
+
@current-change="handleCurrentChange"
|
|
137
|
+
:current-page="currentPage"
|
|
138
|
+
:page-sizes="[10, 30, 50]"
|
|
139
|
+
:page-size="pageSize"
|
|
140
|
+
layout="total, sizes, prev, pager, next, jumper"
|
|
141
|
+
:total="totalNum"
|
|
142
|
+
></el-pagination>
|
|
143
|
+
</div>
|
|
144
|
+
</div>
|
|
145
|
+
<el-drawer v-model="drawer" :direction="direction" :before-close="handleClose" :with-header="false" size="24%">
|
|
146
|
+
<!-- 父组件传参与子组件方法监听 -->
|
|
147
|
+
<routeInfoComponent ref="routeInfo" :infoForm="infoForm"></routeInfoComponent>
|
|
148
|
+
</el-drawer>
|
|
149
|
+
</div>
|
|
150
|
+
</template>
|
|
151
|
+
|
|
152
|
+
<script setup>
|
|
153
|
+
import { ArrowDown, DataAnalysis, CircleCheckFilled, CircleCloseFilled } from '@element-plus/icons-vue'
|
|
154
|
+
</script>
|
|
155
|
+
|
|
156
|
+
<script>
|
|
157
|
+
import routeInfoComponent from '../component/RouteInfo.vue'
|
|
158
|
+
import {routePageList,startRoute,stopRoute,deleteRoute} from '../api/gateway_api.js'
|
|
159
|
+
export default {
|
|
160
|
+
data() {
|
|
161
|
+
return {
|
|
162
|
+
form:{
|
|
163
|
+
name:null,
|
|
164
|
+
groupCode: null,
|
|
165
|
+
status: null
|
|
166
|
+
},
|
|
167
|
+
drawer: false,
|
|
168
|
+
direction: 'rtl',
|
|
169
|
+
formLabelWidth: '140px',
|
|
170
|
+
infoForm:{},
|
|
171
|
+
gatewayServer:'',
|
|
172
|
+
alarmDate:'',
|
|
173
|
+
alarmStatus:[],
|
|
174
|
+
tableData: [],
|
|
175
|
+
currentPage: 1,
|
|
176
|
+
pageSize: 10,
|
|
177
|
+
totalNum: 1,
|
|
178
|
+
pickerOptions: {
|
|
179
|
+
disabledDate(time) {
|
|
180
|
+
return time.getTime() > Date.now();
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
statusOptions: [
|
|
184
|
+
{value: null, label: '所有'},
|
|
185
|
+
{value: '0',label: '启用'},
|
|
186
|
+
{value: '1',label: '禁用'},
|
|
187
|
+
],
|
|
188
|
+
groupOptions: this.GLOBAL_VAR.groups
|
|
189
|
+
};
|
|
190
|
+
},
|
|
191
|
+
components:{
|
|
192
|
+
routeInfoComponent
|
|
193
|
+
},
|
|
194
|
+
created: function() {
|
|
195
|
+
this.init();
|
|
196
|
+
},
|
|
197
|
+
mounted: function() {
|
|
198
|
+
|
|
199
|
+
},
|
|
200
|
+
beforeDestroy: function() {
|
|
201
|
+
|
|
202
|
+
},
|
|
203
|
+
methods:{
|
|
204
|
+
init() {
|
|
205
|
+
this.search();
|
|
206
|
+
},
|
|
207
|
+
handleSizeChange(val) {
|
|
208
|
+
this.pageSize = val;
|
|
209
|
+
this.search();
|
|
210
|
+
},
|
|
211
|
+
handleCurrentChange(val) {
|
|
212
|
+
this.currentPage = val;
|
|
213
|
+
this.search();
|
|
214
|
+
},
|
|
215
|
+
handleShowInfo(row, index){
|
|
216
|
+
this.infoForm = row;
|
|
217
|
+
},
|
|
218
|
+
formatterStatus(row, index){
|
|
219
|
+
return row.status === '0'?'启用':'禁用';
|
|
220
|
+
},
|
|
221
|
+
handleCreateGateway(){
|
|
222
|
+
this.$router.push({path:'/createGateway',query:{handleType:'add'}});
|
|
223
|
+
},
|
|
224
|
+
handleCommandGateway(obj){
|
|
225
|
+
console.log("command" , obj);
|
|
226
|
+
let _this = this;
|
|
227
|
+
if (obj.command === 'addClient'){
|
|
228
|
+
this.$router.push({path:'/addGatewayClient',query:{ route: JSON.stringify(this.newRoute(obj.row)) } });
|
|
229
|
+
} else if (obj.command === 'info'){
|
|
230
|
+
this.drawer = true;
|
|
231
|
+
this.infoForm = obj.row;
|
|
232
|
+
} else if (obj.command === 'edit'){
|
|
233
|
+
this.infoForm = obj.row;
|
|
234
|
+
this.$router.push({path:'/createGateway',query:{handleType:'edit',route:this.newRoute(obj.row)}});
|
|
235
|
+
} else if (obj.command === 'rule'){
|
|
236
|
+
this.$router.push({path:'/addGroovyScript',query:{route:this.newRoute(obj.row)}});
|
|
237
|
+
} else if (obj.command === 'start'){
|
|
238
|
+
startRoute({id:obj.row.id}).then(function(result){
|
|
239
|
+
_this.GLOBAL_FUN.successMsg();
|
|
240
|
+
_this.search();
|
|
241
|
+
});
|
|
242
|
+
} else if (obj.command === 'stop'){
|
|
243
|
+
stopRoute({id:obj.row.id}).then(function(result){
|
|
244
|
+
_this.GLOBAL_FUN.successMsg();
|
|
245
|
+
_this.search();
|
|
246
|
+
});
|
|
247
|
+
} else if (obj.command === 'delete'){
|
|
248
|
+
this.$confirm('确认删除"'+obj.row.name+'"网关路由?').then(_ => {
|
|
249
|
+
deleteRoute({id:obj.row.id}).then(function(result){
|
|
250
|
+
_this.GLOBAL_FUN.successMsg();
|
|
251
|
+
_this.search();
|
|
252
|
+
})
|
|
253
|
+
}).catch(_ => {});
|
|
254
|
+
} else if (obj.command === 'topology'){
|
|
255
|
+
this.$router.push({path:'/gatewayTopology',query:{route:this.newRoute(obj.row)}});
|
|
256
|
+
}
|
|
257
|
+
},
|
|
258
|
+
handleClose(done) {
|
|
259
|
+
// this.$confirm('确认关闭?').then(_ => {
|
|
260
|
+
done();
|
|
261
|
+
// }).catch(_ => {});
|
|
262
|
+
},
|
|
263
|
+
handleCopy(val){
|
|
264
|
+
let value = this.GLOBAL_VAR.gatewayRoutesURL + val;
|
|
265
|
+
this.GLOBAL_FUN.copy(value);
|
|
266
|
+
},
|
|
267
|
+
search(){
|
|
268
|
+
let _this = this;
|
|
269
|
+
routePageList({form : this.form, currentPage: this.currentPage, pageSize: this.pageSize}).then(function(result){
|
|
270
|
+
console.log('result:', result);
|
|
271
|
+
if (result.data && result.data.records){
|
|
272
|
+
_this.tableData = result.data.records;
|
|
273
|
+
_this.totalNum = result.data.total;
|
|
274
|
+
}
|
|
275
|
+
});
|
|
276
|
+
},
|
|
277
|
+
newRoute(row){
|
|
278
|
+
let route = {
|
|
279
|
+
form: row,
|
|
280
|
+
filter: {
|
|
281
|
+
ipChecked: row.filterGatewayName!=null && row.filterGatewayName.indexOf('ip')!=-1,
|
|
282
|
+
tokenChecked: row.filterGatewayName!=null && row.filterGatewayName.indexOf('token')!=-1,
|
|
283
|
+
idChecked: row.filterGatewayName!=null && row.filterGatewayName.indexOf('id')!=-1
|
|
284
|
+
},
|
|
285
|
+
access:{
|
|
286
|
+
headerChecked: row.filterAuthorizeName!=null && row.filterAuthorizeName.indexOf('header')!=-1,
|
|
287
|
+
ipChecked: row.filterAuthorizeName!=null && row.filterAuthorizeName.indexOf('ip')!=-1,
|
|
288
|
+
parameterChecked: row.filterAuthorizeName!=null && row.filterAuthorizeName.indexOf('parameter')!=-1,
|
|
289
|
+
timeChecked: row.filterAuthorizeName!=null && row.filterAuthorizeName.indexOf('time')!=-1,
|
|
290
|
+
cookieChecked: row.filterAuthorizeName!=null && row.filterAuthorizeName.indexOf('cookie')!=-1
|
|
291
|
+
},
|
|
292
|
+
monitor:{
|
|
293
|
+
checked: row.monitor != null && row.monitor.status != '1'
|
|
294
|
+
},
|
|
295
|
+
degradeRule:{
|
|
296
|
+
checked: row.degradeRuleName != null && row.degradeRuleName.length > 0
|
|
297
|
+
},
|
|
298
|
+
flowRule:{
|
|
299
|
+
defaultChecked: row.flowRuleName!=null && row.flowRuleName.indexOf('default')!=-1,
|
|
300
|
+
warmUpChecked: row.flowRuleName!=null && row.flowRuleName.indexOf('warmUp')!=-1,
|
|
301
|
+
rateLimiterChecked: row.flowRuleName!=null && row.flowRuleName.indexOf('rateLimiter')!=-1,
|
|
302
|
+
},
|
|
303
|
+
cacheResult:{
|
|
304
|
+
checked: row.cacheTtl != null && row.cacheTtl > 0
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
return route;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
}
|
|
311
|
+
};
|
|
312
|
+
</script>
|
|
313
|
+
|
|
314
|
+
<style lang="scss" scoped>
|
|
315
|
+
.box-flex-between {
|
|
316
|
+
padding-bottom: 18px;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
.block {
|
|
320
|
+
padding: 0 20px;
|
|
321
|
+
}
|
|
322
|
+
</style>
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<el-page-header @back="goBack" content="服务管理"></el-page-header>
|
|
4
|
+
<el-row :gutter="24" style="margin-top: 20px;">
|
|
5
|
+
<el-col :span="16">
|
|
6
|
+
<el-card shadow="always">
|
|
7
|
+
<div slot="header" class="clearfix">
|
|
8
|
+
<i class="el-icon-orange" style="font-size: 10pt;"></i> <span style="font-size: 12pt;">注册网关-客户端拓扑结构</span>
|
|
9
|
+
</div>
|
|
10
|
+
<div id="topologyChart" :style="{ width: '100%', height: '750px', padding: '0px', margin: '0px', border: '0px #0298F9 solid' }"></div>
|
|
11
|
+
</el-card>
|
|
12
|
+
</el-col>
|
|
13
|
+
<el-col :span="8" style="border: 0px solid red;">
|
|
14
|
+
<el-card shadow="always">
|
|
15
|
+
<div slot="header" class="clearfix">
|
|
16
|
+
<i class="el-icon-s-custom" style="font-size: 10pt;"></i> <span style="font-size: 12pt;">注册客户端列表</span>
|
|
17
|
+
</div>
|
|
18
|
+
<el-card shadow="hover" class="paper-card__body" v-for="(item,index) in clientList" :key="index" style="margin-bottom: 10px; font-size: 10pt;">
|
|
19
|
+
<el-row :gutter="24">
|
|
20
|
+
<el-col :span="20" style="border: 0px solid red;">
|
|
21
|
+
<i class="el-icon-s-platform" style="font-size: 10pt;"></i> <el-tag size="small" style="font-weight: bold;">{{item.name}}</el-tag>
|
|
22
|
+
<i class="el-icon-caret-right" style="font-size: 10pt;"></i> <el-tag size="small" type="warning" style="font-weight: bold;">{{item.id}}</el-tag>
|
|
23
|
+
</el-col>
|
|
24
|
+
<el-col :span="4" style="border: 0px solid red;">
|
|
25
|
+
<el-switch v-model="item.regServerStatus" @change="handleSwitchChange(item,index)" active-color="#13ce66" inactive-color="#ff4949" active-value="0" inactive-value="1" style="float: right;"></el-switch>
|
|
26
|
+
</el-col>
|
|
27
|
+
</el-row>
|
|
28
|
+
</el-card>
|
|
29
|
+
</el-card>
|
|
30
|
+
</el-col>
|
|
31
|
+
</el-row>
|
|
32
|
+
</div>
|
|
33
|
+
</template>
|
|
34
|
+
|
|
35
|
+
<script>
|
|
36
|
+
import * as echarts from 'echarts'
|
|
37
|
+
import {regClientList,stopRegClient,startRegClient} from '../api/regserver_api.js'
|
|
38
|
+
|
|
39
|
+
export default {
|
|
40
|
+
data() {
|
|
41
|
+
return {
|
|
42
|
+
form: {},
|
|
43
|
+
clientList:[]
|
|
44
|
+
};
|
|
45
|
+
},
|
|
46
|
+
created: function() {
|
|
47
|
+
//在组件创建完毕后加载
|
|
48
|
+
let query = this.$route.query;
|
|
49
|
+
if (query){
|
|
50
|
+
let route = query.route;
|
|
51
|
+
console.log('route', route);
|
|
52
|
+
this.form = route.form;
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
mounted: function() {
|
|
56
|
+
this.init();
|
|
57
|
+
},
|
|
58
|
+
beforeDestroy: function() {
|
|
59
|
+
|
|
60
|
+
},
|
|
61
|
+
methods: {
|
|
62
|
+
init() {
|
|
63
|
+
this.regClientList();
|
|
64
|
+
},
|
|
65
|
+
regClientList(){
|
|
66
|
+
let _this = this;
|
|
67
|
+
regClientList({routeId: this.form.id}).then(function(result){
|
|
68
|
+
if (result.data){
|
|
69
|
+
_this.clientList = result.data;
|
|
70
|
+
_this.drawLine();
|
|
71
|
+
}
|
|
72
|
+
})
|
|
73
|
+
},
|
|
74
|
+
handleSwitchChange(item, index){
|
|
75
|
+
let _this = this;
|
|
76
|
+
if (item && item.regServerStatus === '0'){
|
|
77
|
+
startRegClient({id:item.regServerId}).then(function(result){
|
|
78
|
+
_this.GLOBAL_FUN.successMsg();
|
|
79
|
+
});
|
|
80
|
+
}else {
|
|
81
|
+
stopRegClient({id:item.regServerId}).then(function(result){
|
|
82
|
+
_this.GLOBAL_FUN.successMsg();
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
goBack() {
|
|
87
|
+
this.$router.push({path:'/gatewayList',query:{}});
|
|
88
|
+
},
|
|
89
|
+
drawLine() {
|
|
90
|
+
let _this = this;
|
|
91
|
+
// 基于准备好的dom,初始化echarts实例
|
|
92
|
+
let topologyChart = echarts.init(document.getElementById('topologyChart'));
|
|
93
|
+
var colors = ['#00ADD0', '#FFA12F', '#B62AFF', '#727CF5', '#1890FF', '#00f6ff', '#20C0F4', '#95F300', '#04FDB8', '#AF5AFF'];
|
|
94
|
+
var getdata = function getData() {
|
|
95
|
+
let data = {
|
|
96
|
+
name: _this.form.name,
|
|
97
|
+
value: 0,
|
|
98
|
+
children: []
|
|
99
|
+
};
|
|
100
|
+
if (_this.clientList != null){
|
|
101
|
+
let legnth = _this.clientList.length;
|
|
102
|
+
for (let i = 0; i < legnth; i++) {
|
|
103
|
+
let client = _this.clientList[i];
|
|
104
|
+
let obj = {
|
|
105
|
+
name: client.name ,
|
|
106
|
+
value: i,
|
|
107
|
+
children: []
|
|
108
|
+
};
|
|
109
|
+
data.children.push(obj);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
let arr = [];
|
|
113
|
+
arr.push(data);
|
|
114
|
+
//
|
|
115
|
+
arr = handle(arr, 0);
|
|
116
|
+
console.log(arr);
|
|
117
|
+
return arr;
|
|
118
|
+
};
|
|
119
|
+
var handle = function handleData(data, index, color = '#00f6ff') {
|
|
120
|
+
//index标识第几层
|
|
121
|
+
return data.map((item, index2) => {
|
|
122
|
+
//计算出颜色
|
|
123
|
+
if (index == 1) {
|
|
124
|
+
color = colors.find((item, eq) => eq == index2 % 10);
|
|
125
|
+
}
|
|
126
|
+
// 设置节点大小
|
|
127
|
+
if (index === 0 || index === 1) {
|
|
128
|
+
item.label = {
|
|
129
|
+
position: 'inside'
|
|
130
|
+
// rotate: 0,
|
|
131
|
+
// borderRadius: "50%",
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
// 设置label大小
|
|
135
|
+
switch (index) {
|
|
136
|
+
case 0:
|
|
137
|
+
item.symbolSize = 90;
|
|
138
|
+
break;
|
|
139
|
+
case 1:
|
|
140
|
+
item.symbolSize = 60;
|
|
141
|
+
break;
|
|
142
|
+
default:
|
|
143
|
+
item.symbolSize = 20;
|
|
144
|
+
break;
|
|
145
|
+
}
|
|
146
|
+
// 设置线条颜色
|
|
147
|
+
item.lineStyle = { color: color };
|
|
148
|
+
|
|
149
|
+
if (item.children) {
|
|
150
|
+
//存在子节点
|
|
151
|
+
item.itemStyle = {
|
|
152
|
+
borderColor: color,
|
|
153
|
+
color: color
|
|
154
|
+
};
|
|
155
|
+
item.children = handle(item.children, index + 1, color);
|
|
156
|
+
} else {
|
|
157
|
+
//不存在
|
|
158
|
+
item.itemStyle = {
|
|
159
|
+
color: 'transparent',
|
|
160
|
+
borderColor: color
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
return item;
|
|
164
|
+
});
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
var option = {
|
|
168
|
+
type: 'tree',
|
|
169
|
+
// backgroundColor: '#000',
|
|
170
|
+
toolbox: {
|
|
171
|
+
//工具栏
|
|
172
|
+
show: true,
|
|
173
|
+
iconStyle: {
|
|
174
|
+
borderColor: '#03ceda'
|
|
175
|
+
},
|
|
176
|
+
feature: {
|
|
177
|
+
restore: {}
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
tooltip: {
|
|
181
|
+
//提示框
|
|
182
|
+
trigger: 'item',
|
|
183
|
+
triggerOn: 'mousemove',
|
|
184
|
+
backgroundColor: 'rgba(1,70,86,1)',
|
|
185
|
+
borderColor: 'rgba(0,246,255,1)',
|
|
186
|
+
borderWidth: 0.5,
|
|
187
|
+
textStyle: {
|
|
188
|
+
fontSize: 10
|
|
189
|
+
},
|
|
190
|
+
formatter: '{b}'
|
|
191
|
+
},
|
|
192
|
+
series: [
|
|
193
|
+
{
|
|
194
|
+
type: 'tree',
|
|
195
|
+
hoverAnimation: true, //hover样式
|
|
196
|
+
data: getdata(),
|
|
197
|
+
top: 0,
|
|
198
|
+
bottom: 0,
|
|
199
|
+
left: 0,
|
|
200
|
+
right: 0,
|
|
201
|
+
layout: 'radial',
|
|
202
|
+
symbol: 'circle',
|
|
203
|
+
symbolSize: 10,
|
|
204
|
+
nodePadding: 20,
|
|
205
|
+
animationDurationUpdate: 750,
|
|
206
|
+
expandAndCollapse: true, //子树折叠和展开的交互,默认打开
|
|
207
|
+
initialTreeDepth: 2,
|
|
208
|
+
roam: true, //是否开启鼠标缩放和平移漫游。scale/move/true
|
|
209
|
+
focusNodeAdjacency: true,
|
|
210
|
+
itemStyle: {
|
|
211
|
+
borderWidth: 1
|
|
212
|
+
},
|
|
213
|
+
label: {
|
|
214
|
+
//标签样式
|
|
215
|
+
// color: '#fff',
|
|
216
|
+
fontSize: 10,
|
|
217
|
+
fontWeight: 'bold',
|
|
218
|
+
fontFamily: 'SourceHanSansCN',
|
|
219
|
+
position: 'inside',
|
|
220
|
+
rotate: 0
|
|
221
|
+
},
|
|
222
|
+
lineStyle: {
|
|
223
|
+
width: 1,
|
|
224
|
+
curveness: 0.5
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
]
|
|
228
|
+
};
|
|
229
|
+
// 绘制图表
|
|
230
|
+
topologyChart.setOption(option);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
};
|
|
234
|
+
</script>
|
|
235
|
+
|
|
236
|
+
<style scoped>
|
|
237
|
+
.paper-card__body >>> .el-card__body{
|
|
238
|
+
padding: 12px;
|
|
239
|
+
}
|
|
240
|
+
.paper-card__body >>> .el-card__header {
|
|
241
|
+
padding: 10px 20px;
|
|
242
|
+
border-bottom: 1px solid #EBEEF5;
|
|
243
|
+
box-sizing: border-box;
|
|
244
|
+
}
|
|
245
|
+
</style>
|