PortalServiceChoreographyManager.vue
5.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
<template>
<div class="fullheight">
<ht-table
@load="loadData"
:data="rows"
:pageResult="pageResult"
:selection="true"
quick-search-props="name,alias"
:show-export="false"
:show-custom-column="false"
ref="htTable"
@selection-change="handleSelectionChange"
>
<template v-slot:toolbar>
<!-- <el-button-group> -->
<el-button size="small" @click="showDialog()" icon="el-icon-plus" type="primary"
>添加</el-button
>
<!-- <el-button
size="small"
@click="handleImport()"
icon="el-icon-back"
>导入</el-button
>
<el-button size="small" @click="handExport()" icon="el-icon-right"
>导出</el-button
> -->
<ht-delete-button
url="${portal}/portal/portalServiceChoreography/v1/remove"
:htTable="$refs.htTable"
:disabled="isDisabled"
>删除</ht-delete-button
>
<!-- </el-button-group> -->
</template>
<template>
<ht-table-column type="index" width="50" align="center" label="序号" />
<ht-table-column
prop="name"
label="名称"
:sortable="true"
:show-overflow-tooltip="true"
>
<template v-slot="{row}">
<el-link
type="primary"
@click="showDialog(row.id)"
title="查看详情"
>{{ row.name }}</el-link
>
</template>
</ht-table-column>
<ht-table-column
prop="alias"
label="别名"
:sortable="true"
:show-overflow-tooltip="true"
>
</ht-table-column>
<ht-table-column width="200" label="操作" align="left">
<template v-slot="{row}">
<el-button type="text" @click="handleCommand({row: row, command: 'log'})">调用日志</el-button>
<el-button type="text" @click="handleCommand({row: row, command: 'testConnect'})">测试连接</el-button>
<!-- <el-dropdown
size="mini"
split-button
@command="handleCommand"
@click="handleCommand({row: row, command: 'log'})"
>
<span> <i class="el-icon-tickets"></i>调用服务 </span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item
icon="el-icon-menu"
:command="{row: row, command: 'testConnect'}"
>测试连接</el-dropdown-item
>
</el-dropdown-menu>
</el-dropdown> -->
</template>
</ht-table-column>
</template>
</ht-table>
<PortalServiceChoreography-manager-edit
ref="PortalServiceChoreographyManagerEdit"
@reloadList="reloadList"
></PortalServiceChoreography-manager-edit>
<el-dialog
title="调用日志"
class="form-version__dialog"
width="60%"
destroy-on-close
:visible.sync="serviceLogVisible"
:before-close="handleCloseServiceLog"
top="8vh"
>
<portal-service-log-manager
v-if="serviceLogVisible"
:visible.sync="serviceLogVisible"
:type="type"
:alias="alias"
/>
</el-dialog>
</div>
</template>
<script>
import PortalServiceChoreographyManagerEdit from './PortalServiceChoreographyManagerEdit.vue'
import PortalServiceLogManager from '../log/PortalServiceLogManager.vue'
import portal from '@/api/portal.js'
export default {
components: {PortalServiceChoreographyManagerEdit, PortalServiceLogManager},
data() {
return {
dialogVisible: false,
serviceLogVisible: false,
type: 'service',
alias: '',
rows: [],
pageResult: {
page: 1,
pageSize: 50,
total: 0
},
PortalServiceChoreography: {},
formRow: {},
saveMethod: 'POST',
isDisabled:true, //按钮的禁用
selectedList:[]
}
},
mounted() {
this.$validator = this.$root.$validator
},
watch: {
// 监听选中下
selectedList:{
handler(val){
this.isDisabled = val.length < 1 ? true : false
},
deep:true
}
},
methods: {
handleSelectionChange(selection){
this.selectedList = selection
},
showDialog(id) {
this.$refs.PortalServiceChoreographyManagerEdit.showDialog(id)
},
loadData(param, cb) {
portal
.getChoreographyManageList(param || {})
.then(resp => {
let response = resp.data
this.rows = response.rows
this.pageResult = {
page: response.page,
pageSize: response.pageSize,
total: response.total
}
// this.$loading().close()
})
.finally(() => cb && cb())
},
handleCommand(params) {
this.formRow = params.row
switch (params.command) {
case 'edit':
this.$refs.PortalServiceChoreographyManagerEdit.showDialog(params.row.id)
break
case 'log':
this.alias = params.row.alias
this.serviceLogVisible = true
break;
case 'testConnect':
portal.executeServiceChoreography(params.row.alias).then(resp => {
if (resp) {
let result = JSON.stringify(resp)
this.$message({
type: 'success',
message: "调用服务成功, 返回结果" + result
})
} else {
this.$message.$error("调用服务失败")
}
})
break
default:
break
}
},
reloadList() {
this.$refs.htTable.load()
},
handleCloseServiceLog() {
this.serviceLogVisible = false
}
}
}
</script>
<style lang="scss" scoped>
.sp-manager__dialog /deep/ .el-dialog > .el-dialog__body {
height: calc(100% - 170px);
}
.form-version__dialog /deep/ .el-dialog > .el-dialog__body {
padding: 0 10px;
}
</style>