提交 | 用户 | 时间
|
850106
|
1 |
<template> |
H |
2 |
<el-card shadow="never" class="aui-card--fill"> |
|
3 |
<div class="mod-httpApi"> |
|
4 |
<el-form |
|
5 |
:inline="true" |
|
6 |
:model="dataForm" |
|
7 |
@keyup.enter.native="getDataList()" |
|
8 |
> |
|
9 |
<el-form-item> |
|
10 |
<el-input |
|
11 |
v-model="dataForm.clientId" |
|
12 |
placeholder="ClientId" |
|
13 |
clearable |
|
14 |
></el-input> |
|
15 |
</el-form-item> |
|
16 |
<el-form-item> |
|
17 |
<el-button @click="getDataList()">{{ $t("query") }}</el-button> |
|
18 |
</el-form-item> |
|
19 |
<el-form-item> |
|
20 |
<el-button |
|
21 |
type="primary" |
|
22 |
@click="addOrUpdateHandle()" |
|
23 |
>新增 |
|
24 |
</el-button> |
|
25 |
</el-form-item> |
|
26 |
</el-form> |
|
27 |
<el-table |
|
28 |
v-loading="dataListLoading" |
|
29 |
:data="dataList" |
|
30 |
border |
|
31 |
style="width: 100%" |
|
32 |
> |
|
33 |
<el-table-column |
|
34 |
prop="loginUrl" |
|
35 |
label="URL" |
|
36 |
header-align="center" |
|
37 |
align="left" |
|
38 |
min-width="100" |
|
39 |
> |
|
40 |
</el-table-column> |
|
41 |
<el-table-column |
|
42 |
prop="clientId" |
|
43 |
label="ClientId" |
|
44 |
header-align="center" |
|
45 |
align="left" |
|
46 |
min-width="100" |
|
47 |
></el-table-column> |
|
48 |
<el-table-column |
|
49 |
prop="clientSecret" |
|
50 |
label="ClientSecret" |
|
51 |
header-align="center" |
|
52 |
align="left" |
|
53 |
min-width="240" |
|
54 |
></el-table-column> |
|
55 |
<el-table-column |
|
56 |
prop="token" |
|
57 |
label="TOKEN" |
|
58 |
header-align="center" |
|
59 |
align="left" |
|
60 |
min-width="100" |
|
61 |
></el-table-column> |
|
62 |
<el-table-column |
|
63 |
prop="updateTime" |
|
64 |
label="更新时间" |
|
65 |
header-align="center" |
|
66 |
align="left" |
|
67 |
min-width="100" |
|
68 |
></el-table-column> |
|
69 |
<el-table-column |
|
70 |
:label="$t('handle')" |
|
71 |
fixed="right" |
|
72 |
header-align="center" |
|
73 |
align="center" |
|
74 |
width="160" |
|
75 |
> |
|
76 |
<template slot-scope="scope"> |
|
77 |
<el-button |
|
78 |
type="text" |
|
79 |
size="small" |
|
80 |
@click="addOrUpdateHandle(scope.row.id)" |
|
81 |
>{{ $t("update") }} |
|
82 |
</el-button> |
|
83 |
<el-button |
|
84 |
type="text" |
|
85 |
size="small" |
|
86 |
@click="deleteHandle(scope.row.id)" |
|
87 |
>{{ $t("delete") }} |
|
88 |
</el-button> |
|
89 |
</template> |
|
90 |
</el-table-column> |
|
91 |
</el-table> |
|
92 |
<el-pagination |
|
93 |
@size-change="sizeChangeHandle" |
|
94 |
@current-change="currentChangeHandle" |
|
95 |
:current-page="pageIndex" |
|
96 |
:page-sizes="[10, 20, 50, 100]" |
|
97 |
:page-size="pageSize" |
|
98 |
:total="totalPage" |
|
99 |
layout="total, sizes, prev, pager, next, jumper" |
|
100 |
> |
|
101 |
</el-pagination> |
|
102 |
<!-- 弹窗, 新增 / 修改 --> |
|
103 |
<add-or-update |
|
104 |
v-if="addOrUpdateVisible" |
|
105 |
ref="addOrUpdate" |
|
106 |
@refreshDataList="getDataList" |
|
107 |
></add-or-update> |
|
108 |
</div> |
|
109 |
</el-card> |
|
110 |
</template> |
|
111 |
<script> |
|
112 |
import AddOrUpdate from "./token-add-or-update"; |
|
113 |
|
|
114 |
export default { |
|
115 |
data() { |
|
116 |
return { |
|
117 |
dataForm: { |
|
118 |
clientId: "" |
|
119 |
}, |
|
120 |
tagItemVisibleXst: false, |
|
121 |
tagItemVisibleEleLow: false, |
|
122 |
dataList: [], |
|
123 |
pageIndex: 1, |
|
124 |
pageSize: 10, |
|
125 |
totalPage: 0, |
|
126 |
dataListLoading: false, |
|
127 |
dataListSelections: [], |
|
128 |
addOrUpdateVisible: false, |
|
129 |
}; |
|
130 |
}, |
|
131 |
|
|
132 |
components: { |
|
133 |
AddOrUpdate |
|
134 |
}, |
|
135 |
mounted() { |
|
136 |
this.getDataList(); |
|
137 |
}, |
|
138 |
methods: { |
|
139 |
// 获取数据列表 |
|
140 |
getDataList() { |
|
141 |
this.dataListLoading = true; |
|
142 |
this.$http({ |
|
143 |
url: "/data/http/token/page", |
|
144 |
method: "get", |
|
145 |
params: this.$http.adornParams({ |
|
146 |
page: this.pageIndex, |
|
147 |
limit: this.pageSize, |
|
148 |
clientId: this.dataForm.clientId, |
|
149 |
}), |
|
150 |
}).then(({data}) => { |
|
151 |
if (data && data.code === 0) { |
|
152 |
this.dataList = data.data.list; |
|
153 |
this.totalPage = data.data.totalCount; |
|
154 |
} else { |
|
155 |
this.dataList = []; |
|
156 |
this.totalPage = 0; |
|
157 |
} |
|
158 |
this.dataListLoading = false; |
|
159 |
}); |
|
160 |
}, |
|
161 |
// 每页数 |
|
162 |
sizeChangeHandle(val) { |
|
163 |
this.pageSize = val; |
|
164 |
this.pageIndex = 1; |
|
165 |
this.getDataList(); |
|
166 |
}, |
|
167 |
// 当前页 |
|
168 |
currentChangeHandle(val) { |
|
169 |
this.pageIndex = val; |
|
170 |
this.getDataList(); |
|
171 |
}, |
|
172 |
// 新增 / 修改 |
|
173 |
addOrUpdateHandle(id) { |
|
174 |
this.addOrUpdateVisible = true; |
|
175 |
this.$nextTick(() => { |
|
176 |
this.$refs.addOrUpdate.init(id); |
|
177 |
}); |
|
178 |
}, |
|
179 |
// tag方法 |
|
180 |
tagItemHandle(name, code) { |
|
181 |
if ('xstHttpTag' === code) { |
|
182 |
this.tagItemVisibleXst = true; |
|
183 |
this.$nextTick(() => { |
|
184 |
this.$refs.tagItemXst.init(name); |
|
185 |
}); |
|
186 |
} else if ('eleLowHttpTag' === code) { |
|
187 |
this.tagItemVisibleEleLow = true; |
|
188 |
this.$nextTick(() => { |
|
189 |
this.$refs.tagItemEleLow.init(name, code); |
|
190 |
}); |
|
191 |
} |
|
192 |
}, |
|
193 |
|
|
194 |
// 删除 |
|
195 |
deleteHandle(id) { |
|
196 |
this.$confirm(`确定对选中项进行删除操作?`, "提示", { |
|
197 |
confirmButtonText: "确定", |
|
198 |
cancelButtonText: "取消", |
|
199 |
type: "warning", |
|
200 |
}) |
|
201 |
.then(() => { |
|
202 |
this.$http({ |
|
203 |
headers: { |
|
204 |
"Content-Type": "application/json", |
|
205 |
}, |
|
206 |
url: `/data/http/token/delete`, |
|
207 |
method: "post", |
|
208 |
data: this.$http.adornData({ |
|
209 |
id: id, |
|
210 |
}), |
|
211 |
}).then(({data}) => { |
|
212 |
if (data && data.code === 0) { |
|
213 |
this.$message({ |
|
214 |
message: "操作成功", |
|
215 |
type: "success", |
|
216 |
duration: 1500, |
|
217 |
onClose: () => { |
|
218 |
this.getDataList(); |
|
219 |
}, |
|
220 |
}); |
|
221 |
} else { |
|
222 |
this.$message.error(data.msg); |
|
223 |
} |
|
224 |
}); |
|
225 |
}) |
|
226 |
.catch(() => { |
|
227 |
}); |
|
228 |
} |
|
229 |
}, |
|
230 |
}; |
|
231 |
</script> |