|
@@ -14,15 +14,14 @@ |
|
@@ -14,15 +14,14 @@ |
14
|
placeholder="服务器名称" clearable></el-input>
|
14
|
placeholder="服务器名称" clearable></el-input>
|
15
|
</el-col>
|
15
|
</el-col>
|
16
|
<el-col :span="4">
|
16
|
<el-col :span="4">
|
17
|
- <el-input v-model="user_queryInfo.virtualHostName" prefix-icon="el-icon-search"
|
|
|
18
|
- size="medium"
|
17
|
+ <el-input v-model="user_queryInfo.virtualHostName" prefix-icon="el-icon-search" size="medium"
|
19
|
placeholder="虚拟主机名称" clearable></el-input>
|
18
|
placeholder="虚拟主机名称" clearable></el-input>
|
20
|
</el-col>
|
19
|
</el-col>
|
21
|
<el-col :span="8">
|
20
|
<el-col :span="8">
|
22
|
<el-button type="success" style="width:150px" size="medium" @click="user_getList">
|
21
|
<el-button type="success" style="width:150px" size="medium" @click="user_getList">
|
23
|
查询用户信息
|
22
|
查询用户信息
|
24
|
</el-button>
|
23
|
</el-button>
|
25
|
- <el-button type="primary" style="width:150px" size="medium" @click="user_toAddDialog">
|
24
|
+ <el-button type="primary" style="width:150px" :loading="user_loading.listLoading" size="medium" @click="user_toAddDialog">
|
26
|
添加用户信息
|
25
|
添加用户信息
|
27
|
</el-button>
|
26
|
</el-button>
|
28
|
</el-col>
|
27
|
</el-col>
|
|
@@ -35,42 +34,49 @@ |
|
@@ -35,42 +34,49 @@ |
35
|
element-loading-text="获取用户信息列表,拼命加载中">
|
34
|
element-loading-text="获取用户信息列表,拼命加载中">
|
36
|
<el-table-column type="selection" width="55" align="center"></el-table-column>
|
35
|
<el-table-column type="selection" width="55" align="center"></el-table-column>
|
37
|
<el-table-column type="index" align="center"></el-table-column>
|
36
|
<el-table-column type="index" align="center"></el-table-column>
|
38
|
- <el-table-column label="用户名称" prop="username" align="center" width="190"></el-table-column>
|
|
|
39
|
- <el-table-column label="服务器名称" prop="serverName" align="center" width="190"></el-table-column>
|
37
|
+ <el-table-column label="用户名称" prop="username" align="center" width="170"></el-table-column>
|
|
|
38
|
+ <el-table-column label="真实姓名" prop="realName" align="center" width="170"></el-table-column>
|
|
|
39
|
+ <el-table-column label="服务器名称" prop="serverName" align="center" width="180"></el-table-column>
|
40
|
<el-table-column label="虚拟主机名称" prop="virtualHostName" align="center" width="300"></el-table-column>
|
40
|
<el-table-column label="虚拟主机名称" prop="virtualHostName" align="center" width="300"></el-table-column>
|
41
|
- <el-table-column label="操作" width="340px" align="center">
|
|
|
42
|
- <!-- 删除用户 -->
|
|
|
43
|
- <el-tooltip effect="dark" content="删除用户" placement="top-start" :enterable="false">
|
|
|
44
|
- <el-button type="danger" icon="el-icon-delete" size="small"
|
|
|
45
|
- :loading="user_loading.delLoading"
|
|
|
46
|
- @click="user_remove(scope.$index,scope.row)">删除用户
|
|
|
47
|
- </el-button>
|
|
|
48
|
- </el-tooltip>
|
|
|
49
|
- <!-- 编辑关系 -->
|
|
|
50
|
- <el-tooltip effect="dark" content="编辑关系" placement="top-start" :enterable="false">
|
|
|
51
|
- <el-button type="primary" icon="el-icon-edit" size="small"
|
|
|
52
|
- @click="user_toEditDialog(scope.$index,scope.row)">编辑关系
|
|
|
53
|
- </el-button>
|
|
|
54
|
- </el-tooltip>
|
|
|
55
|
- <!-- 删除关系 -->
|
|
|
56
|
- <el-tooltip effect="dark" content="删除关系" placement="top-start" :enterable="false">
|
|
|
57
|
- <el-button type="danger" icon="el-icon-edit" size="small"
|
|
|
58
|
- @click="user_removeRelation(scope.$index,scope.row)">删除关系
|
|
|
59
|
- </el-button>
|
|
|
60
|
- </el-tooltip>
|
|
|
61
|
- <!-- 修改密码 -->
|
|
|
62
|
-
|
41
|
+ <el-table-column label="操作" width="340px" align="center" fixed="right">
|
|
|
42
|
+ <template slot-scope="scope">
|
|
|
43
|
+ <!-- 删除用户 -->
|
|
|
44
|
+ <el-tooltip effect="dark" content="删除用户" placement="top-start" :enterable="false">
|
|
|
45
|
+ <el-button type="danger" icon="el-icon-delete" size="small"
|
|
|
46
|
+ :loading="user_loading.delLoading"
|
|
|
47
|
+ @click="user_remove(scope.$index,scope.row)">删除用户
|
|
|
48
|
+ </el-button>
|
|
|
49
|
+ </el-tooltip>
|
|
|
50
|
+ <!-- 编辑关系 -->
|
|
|
51
|
+ <!-- <el-tooltip effect="dark" content="编辑关系" placement="top-start" :enterable="false">-->
|
|
|
52
|
+ <!-- <el-button type="primary" icon="el-icon-edit" size="small"-->
|
|
|
53
|
+ <!-- @click="user_toEditDialog(scope.$index,scope.row)">编辑关系-->
|
|
|
54
|
+ <!-- </el-button>-->
|
|
|
55
|
+ <!-- </el-tooltip>-->
|
|
|
56
|
+ <!-- 删除关系 -->
|
|
|
57
|
+ <el-tooltip effect="dark" content="删除关系" placement="top-start" :enterable="false">
|
|
|
58
|
+ <el-button type="danger" icon="el-icon-edit" size="small"
|
|
|
59
|
+ @click="user_removeRelation(scope.$index,scope.row)">删除关系
|
|
|
60
|
+ </el-button>
|
|
|
61
|
+ </el-tooltip>
|
|
|
62
|
+ <!-- 修改密码 -->
|
|
|
63
|
+ </template>
|
63
|
</el-table-column>
|
64
|
</el-table-column>
|
64
|
</el-table>
|
65
|
</el-table>
|
65
|
</div>
|
66
|
</div>
|
66
|
<!-- 分页区域 -->
|
67
|
<!-- 分页区域 -->
|
67
|
<div style="margin-top: 10px">
|
68
|
<div style="margin-top: 10px">
|
68
|
<el-row :gutter="24">
|
69
|
<el-row :gutter="24">
|
69
|
- <el-col :span="5">
|
70
|
+ <el-col :span="8">
|
|
|
71
|
+ <el-button type="danger" icon="el-icon-delete"
|
|
|
72
|
+ :loading="user_loading.batchDelLoading"
|
|
|
73
|
+ :disabled="this.user_page.selectList.length===0"
|
|
|
74
|
+ @click="user_batchRemove">批量删除用户
|
|
|
75
|
+ </el-button>
|
70
|
<el-button type="danger" icon="el-icon-delete"
|
76
|
<el-button type="danger" icon="el-icon-delete"
|
71
|
:loading="user_loading.batchDelLoading"
|
77
|
:loading="user_loading.batchDelLoading"
|
72
|
:disabled="this.user_page.selectList.length===0"
|
78
|
:disabled="this.user_page.selectList.length===0"
|
73
|
- @click="user_batchRemove">批量删除
|
79
|
+ @click="user_batchRemoveRelation">批量删除用户关系
|
74
|
</el-button>
|
80
|
</el-button>
|
75
|
</el-col>
|
81
|
</el-col>
|
76
|
<el-col :span="10" style="margin-top: 5px">
|
82
|
<el-col :span="10" style="margin-top: 5px">
|
|
@@ -92,25 +98,33 @@ |
|
@@ -92,25 +98,33 @@ |
92
|
<div>
|
98
|
<div>
|
93
|
<el-dialog title="添加MQ用户信息"
|
99
|
<el-dialog title="添加MQ用户信息"
|
94
|
:visible.sync="user_dialog.addDialog"
|
100
|
:visible.sync="user_dialog.addDialog"
|
|
|
101
|
+ v-loading="user_loading.addLoading" element-loading-text="正在添加MQ用户,拼命加载中"
|
95
|
style="margin-top: -20px"
|
102
|
style="margin-top: -20px"
|
96
|
width="50%" text-align="center" @close="user_addDialogClosed">
|
103
|
width="50%" text-align="center" @close="user_addDialogClosed">
|
97
|
<el-form :inline="true" label-width="145px" status-icon style="margin-top: -10px"
|
104
|
<el-form :inline="true" label-width="145px" status-icon style="margin-top: -10px"
|
98
|
:model="user_addForm" :rules="user_addFormRules" ref="user_addFormRef" align="center">
|
105
|
:model="user_addForm" :rules="user_addFormRules" ref="user_addFormRef" align="center">
|
99
|
- <el-form-item label="用户名称:" prop="exchangeName">
|
106
|
+ <el-form-item label="用户名称:" prop="username">
|
100
|
<el-input v-model="user_addForm.username" style="width:270px" size="small" clearable
|
107
|
<el-input v-model="user_addForm.username" style="width:270px" size="small" clearable
|
101
|
placeholder="请输入用户名称">
|
108
|
placeholder="请输入用户名称">
|
102
|
</el-input>
|
109
|
</el-input>
|
103
|
</el-form-item>
|
110
|
</el-form-item>
|
|
|
111
|
+
|
104
|
<el-form-item label="用户密码:" prop="firstPassword">
|
112
|
<el-form-item label="用户密码:" prop="firstPassword">
|
105
|
<el-input type="password" v-model="user_addForm.firstPassword" style="width:270px"
|
113
|
<el-input type="password" v-model="user_addForm.firstPassword" style="width:270px"
|
106
|
size="small" clearable show-password placeholder="请输入用户密码"></el-input>
|
114
|
size="small" clearable show-password placeholder="请输入用户密码"></el-input>
|
107
|
</el-form-item>
|
115
|
</el-form-item>
|
|
|
116
|
+
|
108
|
<el-form-item label="重新输入密码:" prop="password">
|
117
|
<el-form-item label="重新输入密码:" prop="password">
|
109
|
<el-input type="password" v-model="user_addForm.password" style="width:270px"
|
118
|
<el-input type="password" v-model="user_addForm.password" style="width:270px"
|
110
|
size="small" clearable show-password placeholder="请重新输入密码"></el-input>
|
119
|
size="small" clearable show-password placeholder="请重新输入密码"></el-input>
|
111
|
</el-form-item>
|
120
|
</el-form-item>
|
|
|
121
|
+ <el-form-item label="真实姓名:" prop="realName">
|
|
|
122
|
+ <el-input v-model="user_addForm.realName" style="width:270px" size="small" clearable
|
|
|
123
|
+ placeholder="请输入真实姓名">
|
|
|
124
|
+ </el-input>
|
|
|
125
|
+ </el-form-item>
|
112
|
<br/>
|
126
|
<br/>
|
113
|
- <el-form-item label="选择关系:">
|
127
|
+ <el-form-item label="选择用户关系:">
|
114
|
<br/>
|
128
|
<br/>
|
115
|
<el-tree style="width:270px"
|
129
|
<el-tree style="width:270px"
|
116
|
:data="user_config.tree.server_hostList"
|
130
|
:data="user_config.tree.server_hostList"
|
|
@@ -131,26 +145,113 @@ |
|
@@ -131,26 +145,113 @@ |
131
|
</div>
|
145
|
</div>
|
132
|
</el-dialog>
|
146
|
</el-dialog>
|
133
|
</div>
|
147
|
</div>
|
|
|
148
|
+
|
|
|
149
|
+ <!-- 编辑,对话框区域 -->
|
|
|
150
|
+ <div>
|
|
|
151
|
+ <el-dialog title="编辑MQ用户关系"
|
|
|
152
|
+ :visible.sync="user_dialog.editDialog"
|
|
|
153
|
+ style="margin-top: -20px"
|
|
|
154
|
+ width="50%" text-align="center" @close="user_editDialogClosed">
|
|
|
155
|
+ <el-form :inline="true" label-width="145px" status-icon style="margin-top: -10px"
|
|
|
156
|
+ :model="user_editForm" :rules="user_editFormRules" ref="user_editFormRef" align="center">
|
|
|
157
|
+ <el-form-item label="用户名称:" prop="username">
|
|
|
158
|
+ <el-input v-model="user_editForm.username" style="width:300px" size="small" clearable readonly
|
|
|
159
|
+ placeholder="请输入用户名称"></el-input>
|
|
|
160
|
+ </el-form-item>
|
|
|
161
|
+ <el-form-item label="服务器名称:" prop="serverName">
|
|
|
162
|
+ <el-input v-model="user_editForm.serverName" style="width:300px" size="small" clearable readonly
|
|
|
163
|
+ placeholder="请输入服务器名称"></el-input>
|
|
|
164
|
+ </el-form-item>
|
|
|
165
|
+ <br/>
|
|
|
166
|
+ <el-form-item label="现有用户关系:" prop="virtualHostIds">
|
|
|
167
|
+ <el-select v-model="user_editForm.virtualHostIds" prefix-icon="el-icon-search" clearable
|
|
|
168
|
+ style="width:300px" size="small" filterable multiple disabled
|
|
|
169
|
+ @change="user_editChange"
|
|
|
170
|
+ placeholder="选择用户关系">
|
|
|
171
|
+ <el-option
|
|
|
172
|
+ v-for="item in (user_config.virtualHostList)"
|
|
|
173
|
+ :key="item.id"
|
|
|
174
|
+ :label="item.virtualHostName"
|
|
|
175
|
+ :value="item.id">
|
|
|
176
|
+ </el-option>
|
|
|
177
|
+ </el-select>
|
|
|
178
|
+ </el-form-item>
|
|
|
179
|
+ <br/>
|
|
|
180
|
+ <el-form-item label="选择用户关系:" prop="virtualHostId">
|
|
|
181
|
+ <el-select v-model="user_editForm.virtualHostId" prefix-icon="el-icon-search" clearable
|
|
|
182
|
+ style="width:300px" size="small" filterable multiple
|
|
|
183
|
+ @change="user_editChange"
|
|
|
184
|
+ placeholder="选择用户关系">
|
|
|
185
|
+ <el-option
|
|
|
186
|
+ v-for="item in (user_config.virtualHostList)"
|
|
|
187
|
+ :key="item.id"
|
|
|
188
|
+ :label="item.virtualHostName"
|
|
|
189
|
+ :value="item.id">
|
|
|
190
|
+ </el-option>
|
|
|
191
|
+ </el-select>
|
|
|
192
|
+ </el-form-item>
|
|
|
193
|
+
|
|
|
194
|
+ <br/>
|
|
|
195
|
+ <el-form-item label="选择用户关系:">
|
|
|
196
|
+ <br/>
|
|
|
197
|
+ <el-tree style="width:270px"
|
|
|
198
|
+ @check-change="user_editTreeChange"
|
|
|
199
|
+ :data="user_config.tree.edit_serverHostList"
|
|
|
200
|
+ :props="user_config.tree.defaultParams"
|
|
|
201
|
+ ref="tree_edit"
|
|
|
202
|
+ node-key="id"
|
|
|
203
|
+ :default-checked-keys='user_editForm.aliasName'
|
|
|
204
|
+ show-checkbox highlight-current default-expand-all>
|
|
|
205
|
+ </el-tree>
|
|
|
206
|
+ </el-form-item>
|
|
|
207
|
+ </el-form>
|
|
|
208
|
+
|
|
|
209
|
+ <div slot="footer" class="dialog-footer" style="text-align: center;margin-top: -20px">
|
|
|
210
|
+ <el-button type="info" @click="user_dialog.editDialog = false" size="medium"
|
|
|
211
|
+ style="width: 100px">取消
|
|
|
212
|
+ </el-button>
|
|
|
213
|
+ <el-button type="primary" @click="user_edit" :loading="user_loading.editLoading"
|
|
|
214
|
+ size="medium" style="width: 100px">编辑关系
|
|
|
215
|
+ </el-button>
|
|
|
216
|
+ </div>
|
|
|
217
|
+
|
|
|
218
|
+ </el-dialog>
|
|
|
219
|
+ </div>
|
134
|
</el-container>
|
220
|
</el-container>
|
135
|
</template>
|
221
|
</template>
|
136
|
|
222
|
|
137
|
<script>
|
223
|
<script>
|
138
|
import {
|
224
|
import {
|
139
|
getServerAndHostList,
|
225
|
getServerAndHostList,
|
140
|
- selectUserInfoList
|
226
|
+ selectUserInfoList,
|
|
|
227
|
+ insertUserInfo,
|
|
|
228
|
+ deleteUserInfo,
|
|
|
229
|
+ deleteUserRelation,
|
|
|
230
|
+ getHostList,
|
|
|
231
|
+ batchDeleteUser,
|
|
|
232
|
+ batchDeleteUserRelation
|
141
|
} from "../../api/message_bus";
|
233
|
} from "../../api/message_bus";
|
142
|
|
234
|
|
143
|
export default {
|
235
|
export default {
|
144
|
name: "UserInfo",
|
236
|
name: "UserInfo",
|
145
|
data() {
|
237
|
data() {
|
|
|
238
|
+ const validatePassword = (rule, value, callback) => {
|
|
|
239
|
+ if (value === '') {
|
|
|
240
|
+ callback(new Error('请重新输入密码'));
|
|
|
241
|
+ } else if (value !== this.user_addForm.firstPassword) {
|
|
|
242
|
+ callback(new Error('两次输入密码不一致!'));
|
|
|
243
|
+ } else {
|
|
|
244
|
+ callback();
|
|
|
245
|
+ }
|
|
|
246
|
+ };
|
146
|
return {
|
247
|
return {
|
147
|
-
|
|
|
148
|
/**
|
248
|
/**
|
149
|
* user,配置与参数
|
249
|
* user,配置与参数
|
150
|
*/
|
250
|
*/
|
151
|
user_config: {
|
251
|
user_config: {
|
|
|
252
|
+ virtualHostList: [],
|
152
|
tree: {
|
253
|
tree: {
|
153
|
- treeList: [],
|
254
|
+ edit_serverHostList: [],
|
154
|
// 服务器及虚拟主机列表
|
255
|
// 服务器及虚拟主机列表
|
155
|
server_hostList: [],
|
256
|
server_hostList: [],
|
156
|
defaultParams: {
|
257
|
defaultParams: {
|
|
@@ -191,7 +292,13 @@ |
|
@@ -191,7 +292,13 @@ |
191
|
/**
|
292
|
/**
|
192
|
* user,新增表单
|
293
|
* user,新增表单
|
193
|
*/
|
294
|
*/
|
194
|
- user_addForm: {},
|
295
|
+ user_addForm: {
|
|
|
296
|
+ username: '',
|
|
|
297
|
+ realName: '',
|
|
|
298
|
+ firstPassword: '',
|
|
|
299
|
+ password: '',
|
|
|
300
|
+ virtualHostId: '',
|
|
|
301
|
+ },
|
195
|
|
302
|
|
196
|
/**
|
303
|
/**
|
197
|
* user,编辑表单
|
304
|
* user,编辑表单
|
|
@@ -211,7 +318,21 @@ |
|
@@ -211,7 +318,21 @@ |
211
|
/**
|
318
|
/**
|
212
|
* user,添加表单,验证规则
|
319
|
* user,添加表单,验证规则
|
213
|
*/
|
320
|
*/
|
214
|
- user_addFormRules: {},
|
321
|
+ user_addFormRules: {
|
|
|
322
|
+ realName: [
|
|
|
323
|
+ {required: true, message: '请输入真实姓名', trigger: ['blur', 'change']},
|
|
|
324
|
+ ],
|
|
|
325
|
+ username: [
|
|
|
326
|
+ {required: true, message: '请输入用户名称', trigger: ['blur', 'change']},
|
|
|
327
|
+ ],
|
|
|
328
|
+ firstPassword: [
|
|
|
329
|
+ {required: true, message: '请输入用户密码', trigger: ['blur', 'change']},
|
|
|
330
|
+ ],
|
|
|
331
|
+ password: [
|
|
|
332
|
+ {required: true, message: '请再次输入密码', trigger: ['blur', 'change']},
|
|
|
333
|
+ {validator: validatePassword, trigger: ['blur', 'change']}
|
|
|
334
|
+ ],
|
|
|
335
|
+ },
|
215
|
/**
|
336
|
/**
|
216
|
* user,编辑表单,验证规则
|
337
|
* user,编辑表单,验证规则
|
217
|
*/
|
338
|
*/
|
|
@@ -281,7 +402,7 @@ |
|
@@ -281,7 +402,7 @@ |
281
|
* user,添加对话框,打开事件
|
402
|
* user,添加对话框,打开事件
|
282
|
*/
|
403
|
*/
|
283
|
user_toAddDialog() {
|
404
|
user_toAddDialog() {
|
284
|
- this.selectServerAndHostList();
|
405
|
+ // this.selectServerAndHostList();
|
285
|
this.user_dialog.addDialog = true;
|
406
|
this.user_dialog.addDialog = true;
|
286
|
},
|
407
|
},
|
287
|
/**
|
408
|
/**
|
|
@@ -296,15 +417,67 @@ |
|
@@ -296,15 +417,67 @@ |
296
|
* user,添加功能
|
417
|
* user,添加功能
|
297
|
*/
|
418
|
*/
|
298
|
user_add() {
|
419
|
user_add() {
|
299
|
- console.log(this.$refs.tree.getCheckedKeys());
|
420
|
+ this.user_addForm.virtualHostId = this.$refs.tree.getCheckedKeys().join();
|
|
|
421
|
+ if (this.user_addForm.virtualHostId === '') {
|
|
|
422
|
+ return this.$confirm('用户关系不能为空,请务必选择用户关系', '警告', {
|
|
|
423
|
+ confirmButtonText: '确定',
|
|
|
424
|
+ cancelButtonText: '取消',
|
|
|
425
|
+ type: 'warning'
|
|
|
426
|
+ }
|
|
|
427
|
+ )
|
|
|
428
|
+ }
|
|
|
429
|
+ this.$refs.user_addFormRef.validate(valid => {
|
|
|
430
|
+ // 未通过,表单预校验
|
|
|
431
|
+ if (!valid) return;
|
|
|
432
|
+ this.user_loading.addLoading = true;
|
|
|
433
|
+ insertUserInfo(this.user_addForm).then((response) => {
|
|
|
434
|
+ let res = response.data;
|
|
|
435
|
+ // 添加失败
|
|
|
436
|
+ if (res.code !== '200') {
|
|
|
437
|
+ if (res.code === '201') {
|
|
|
438
|
+ this.user_loading.addLoading = false;
|
|
|
439
|
+ return this.$confirm(res.msg, '提示', {
|
|
|
440
|
+ confirmButtonText: '确定',
|
|
|
441
|
+ cancelButtonText: '取消',
|
|
|
442
|
+ type: 'warning'
|
|
|
443
|
+ }
|
|
|
444
|
+ )
|
|
|
445
|
+ }
|
|
|
446
|
+ // 关闭加载
|
|
|
447
|
+ this.user_loading.addLoading = false;
|
|
|
448
|
+ this.$message.error(res.msg);
|
|
|
449
|
+ }
|
|
|
450
|
+ // 添加,成功
|
|
|
451
|
+ this.$message.success(res.msg);
|
|
|
452
|
+ // 关闭加载
|
|
|
453
|
+ this.user_loading.addLoading = false;
|
|
|
454
|
+ // 隐藏对话框
|
|
|
455
|
+ this.user_dialog.addDialog = false;
|
|
|
456
|
+ // 刷新列表
|
|
|
457
|
+ this.user_getList();
|
|
|
458
|
+ }).catch(error => {
|
|
|
459
|
+ this.user_loading.addLoading = false;
|
|
|
460
|
+ this.$message.error(error.toString());
|
|
|
461
|
+ });
|
|
|
462
|
+ })
|
300
|
},
|
463
|
},
|
301
|
|
464
|
|
302
|
/**
|
465
|
/**
|
303
|
* user,编辑对话框,打开事件
|
466
|
* user,编辑对话框,打开事件
|
304
|
*/
|
467
|
*/
|
305
|
user_toEditDialog(index, row) {
|
468
|
user_toEditDialog(index, row) {
|
306
|
- this.user_dialog.editDialog = true;
|
469
|
+ this.selectHostList(row.serverId);
|
|
|
470
|
+ this.selectEditServerAndHostList(row.serverName)
|
307
|
this.user_editForm = Object.assign({}, row);
|
471
|
this.user_editForm = Object.assign({}, row);
|
|
|
472
|
+
|
|
|
473
|
+ this.user_editForm.virtualHostIds = [];
|
|
|
474
|
+ if (this.user_editForm.virtualHostId.indexOf(",") === -1) {
|
|
|
475
|
+ // 队列id中不包含","
|
|
|
476
|
+ this.user_editForm.virtualHostIds[0] = this.user_editForm.virtualHostId;
|
|
|
477
|
+ } else {
|
|
|
478
|
+ this.user_editForm.virtualHostIds = this.user_editForm.virtualHostId.split(",")
|
|
|
479
|
+ }
|
|
|
480
|
+ this.user_dialog.editDialog = true;
|
308
|
},
|
481
|
},
|
309
|
|
482
|
|
310
|
/**
|
483
|
/**
|
|
@@ -316,24 +489,93 @@ |
|
@@ -316,24 +489,93 @@ |
316
|
},
|
489
|
},
|
317
|
|
490
|
|
318
|
/**
|
491
|
/**
|
|
|
492
|
+ * user,编辑对话框,改变
|
|
|
493
|
+ */
|
|
|
494
|
+ user_editChange(value) {
|
|
|
495
|
+
|
|
|
496
|
+ },
|
|
|
497
|
+
|
|
|
498
|
+ /**
|
|
|
499
|
+ * user,编辑对话框中的tree组件,改变
|
|
|
500
|
+ */
|
|
|
501
|
+ user_editTreeChange(value) {
|
|
|
502
|
+ this.user_editForm.virtualHostId = this.$refs.tree_edit.getCheckedKeys().join();
|
|
|
503
|
+ console.log(this.user_editForm.virtualHostId)
|
|
|
504
|
+ },
|
|
|
505
|
+
|
|
|
506
|
+ /**
|
319
|
* user,编辑功能
|
507
|
* user,编辑功能
|
320
|
*/
|
508
|
*/
|
321
|
user_edit() {
|
509
|
user_edit() {
|
322
|
-
|
510
|
+ this.user_addForm.virtualHostId = this.$refs.tree.getCheckedKeys().join();
|
323
|
},
|
511
|
},
|
324
|
|
512
|
|
325
|
/**
|
513
|
/**
|
326
|
* user,删除功能
|
514
|
* user,删除功能
|
327
|
*/
|
515
|
*/
|
328
|
user_remove(index, row) {
|
516
|
user_remove(index, row) {
|
329
|
-
|
517
|
+ // 弹框询问是否删除?
|
|
|
518
|
+ this.$confirm('此操作永久删除该用户信息, 是否继续?', '警告', {
|
|
|
519
|
+ confirmButtonText: '确定删除',
|
|
|
520
|
+ cancelButtonText: '取消',
|
|
|
521
|
+ type: 'warning'
|
|
|
522
|
+ }
|
|
|
523
|
+ ).then(() => {
|
|
|
524
|
+ // 开启加载
|
|
|
525
|
+ this.user_loading.delLoading = true;
|
|
|
526
|
+ deleteUserInfo(row).then((response) => {
|
|
|
527
|
+ let res = response.data;
|
|
|
528
|
+ if (res.code !== '200') {
|
|
|
529
|
+ // 关闭加载
|
|
|
530
|
+ this.user_loading.delLoading = false;
|
|
|
531
|
+ return this.$message.error(res.msg);
|
|
|
532
|
+ }
|
|
|
533
|
+ // 关闭加载
|
|
|
534
|
+ this.user_loading.delLoading = false;
|
|
|
535
|
+ this.$message.success(res.msg);
|
|
|
536
|
+ // 刷新列表
|
|
|
537
|
+ this.user_getList();
|
|
|
538
|
+ }).catch(error => {
|
|
|
539
|
+ // 关闭加载
|
|
|
540
|
+ this.user_loading.delLoading = false;
|
|
|
541
|
+ this.$message.error(error.toString());
|
|
|
542
|
+ });
|
|
|
543
|
+ }).catch(() => {
|
|
|
544
|
+ });
|
330
|
},
|
545
|
},
|
331
|
|
546
|
|
332
|
/**
|
547
|
/**
|
333
|
* user,删除用户关系
|
548
|
* user,删除用户关系
|
334
|
*/
|
549
|
*/
|
335
|
user_removeRelation(index, row) {
|
550
|
user_removeRelation(index, row) {
|
336
|
-
|
551
|
+ // 弹框询问是否删除?
|
|
|
552
|
+ this.$confirm('此操作永久删除该用户信息, 是否继续?', '警告', {
|
|
|
553
|
+ confirmButtonText: '确定删除',
|
|
|
554
|
+ cancelButtonText: '取消',
|
|
|
555
|
+ type: 'warning'
|
|
|
556
|
+ }
|
|
|
557
|
+ ).then(() => {
|
|
|
558
|
+ // 开启加载
|
|
|
559
|
+ this.user_loading.delLoading = true;
|
|
|
560
|
+ deleteUserRelation(row).then((response) => {
|
|
|
561
|
+ let res = response.data;
|
|
|
562
|
+ if (res.code !== '200') {
|
|
|
563
|
+ // 关闭加载
|
|
|
564
|
+ this.user_loading.delLoading = false;
|
|
|
565
|
+ return this.$message.error(res.msg);
|
|
|
566
|
+ }
|
|
|
567
|
+ // 关闭加载
|
|
|
568
|
+ this.user_loading.delLoading = false;
|
|
|
569
|
+ this.$message.success(res.msg);
|
|
|
570
|
+ // 刷新列表
|
|
|
571
|
+ this.user_getList();
|
|
|
572
|
+ }).catch(error => {
|
|
|
573
|
+ // 关闭加载
|
|
|
574
|
+ this.user_loading.delLoading = false;
|
|
|
575
|
+ this.$message.error(error.toString());
|
|
|
576
|
+ });
|
|
|
577
|
+ }).catch(() => {
|
|
|
578
|
+ });
|
337
|
},
|
579
|
},
|
338
|
|
580
|
|
339
|
/**
|
581
|
/**
|
|
@@ -344,15 +586,94 @@ |
|
@@ -344,15 +586,94 @@ |
344
|
},
|
586
|
},
|
345
|
|
587
|
|
346
|
/**
|
588
|
/**
|
347
|
- * user,批量删除功能
|
589
|
+ * user,批量删除用户
|
348
|
*/
|
590
|
*/
|
349
|
user_batchRemove() {
|
591
|
user_batchRemove() {
|
|
|
592
|
+ const usernames = this.user_page.selectList.map(item => item.username).toString().split(",");
|
|
|
593
|
+ const serverNames = this.user_page.selectList.map(item => item.serverName).toString().split(",");
|
|
|
594
|
+ const params = [];
|
|
|
595
|
+ if (usernames.length === serverNames.length) {
|
|
|
596
|
+ for (let i = 0; i < usernames.length; i++) {
|
|
|
597
|
+ let param = {
|
|
|
598
|
+ username: usernames[i],
|
|
|
599
|
+ serverName: serverNames[i],
|
|
|
600
|
+ }
|
|
|
601
|
+ console.log(param)
|
|
|
602
|
+ params.push(param)
|
|
|
603
|
+ }
|
|
|
604
|
+ } else {
|
|
|
605
|
+ return this.$message.error("批量删除用户失败,请仔细检查");
|
|
|
606
|
+ }
|
|
|
607
|
+ console.log(params)
|
|
|
608
|
+ this.$confirm('此操作永久删除该用户, 是否继续?', '警告', {
|
|
|
609
|
+ confirmButtonText: '确定删除',
|
|
|
610
|
+ cancelButtonText: '取消',
|
|
|
611
|
+ type: 'warning'
|
|
|
612
|
+ }
|
|
|
613
|
+ ).then(() => {
|
|
|
614
|
+ // 开启加载
|
|
|
615
|
+ this.user_loading.listLoading = true;
|
|
|
616
|
+ batchDeleteUser(params).then((response) => {
|
|
|
617
|
+ let res = response.data;
|
|
|
618
|
+ if (res.code !== '200') {
|
|
|
619
|
+ // 关闭加载
|
|
|
620
|
+ this.user_loading.listLoading = false;
|
|
|
621
|
+ return this.$message.error(res.msg);
|
|
|
622
|
+ }
|
|
|
623
|
+ // 关闭加载
|
|
|
624
|
+ this.user_loading.listLoading = false;
|
|
|
625
|
+ this.$message.success(res.msg);
|
|
|
626
|
+ // 刷新列表
|
|
|
627
|
+ this.user_getList();
|
|
|
628
|
+ }).catch(error => {
|
|
|
629
|
+ // 关闭加载
|
|
|
630
|
+ this.user_loading.listLoading = false;
|
|
|
631
|
+ this.$message.error(error.toString());
|
|
|
632
|
+ });
|
|
|
633
|
+ }).catch(() => {
|
|
|
634
|
+ });
|
|
|
635
|
+ },
|
|
|
636
|
+
|
|
|
637
|
+ /**
|
|
|
638
|
+ * user,批量删除用户关系功能
|
|
|
639
|
+ */
|
|
|
640
|
+ user_batchRemoveRelation() {
|
350
|
const ids = this.user_page.selectList.map(item => item.id).toString();
|
641
|
const ids = this.user_page.selectList.map(item => item.id).toString();
|
|
|
642
|
+ console.log(ids)
|
|
|
643
|
+ const param = {
|
|
|
644
|
+ id: ids,
|
|
|
645
|
+ }
|
|
|
646
|
+ this.$confirm('此操作永久删除该用户关系, 是否继续?', '警告', {
|
|
|
647
|
+ confirmButtonText: '确定删除',
|
|
|
648
|
+ cancelButtonText: '取消',
|
|
|
649
|
+ type: 'warning'
|
|
|
650
|
+ }
|
|
|
651
|
+ ).then(() => {
|
|
|
652
|
+ // 开启加载
|
|
|
653
|
+ this.user_loading.listLoading = true;
|
|
|
654
|
+ batchDeleteUserRelation(param).then((response) => {
|
|
|
655
|
+ let res = response.data;
|
|
|
656
|
+ if (res.code !== '200') {
|
|
|
657
|
+ // 关闭加载
|
|
|
658
|
+ this.user_loading.listLoading = false;
|
|
|
659
|
+ return this.$message.error(res.msg);
|
|
|
660
|
+ }
|
|
|
661
|
+ // 关闭加载
|
|
|
662
|
+ this.user_loading.listLoading = false;
|
|
|
663
|
+ this.$message.success(res.msg);
|
|
|
664
|
+ // 刷新列表
|
|
|
665
|
+ this.user_getList();
|
|
|
666
|
+ }).catch(error => {
|
|
|
667
|
+ // 关闭加载
|
|
|
668
|
+ this.user_loading.listLoading = false;
|
|
|
669
|
+ this.$message.error(error.toString());
|
|
|
670
|
+ });
|
|
|
671
|
+ }).catch(() => {
|
|
|
672
|
+ });
|
351
|
},
|
673
|
},
|
352
|
|
674
|
|
353
|
/**
|
675
|
/**
|
354
|
- * 服务器与虚拟主机 1:n
|
|
|
355
|
- * 获取列表
|
676
|
+ * MQ服务器与虚拟主机(1:n)的列表
|
356
|
*/
|
677
|
*/
|
357
|
selectServerAndHostList() {
|
678
|
selectServerAndHostList() {
|
358
|
getServerAndHostList().then((response) => {
|
679
|
getServerAndHostList().then((response) => {
|
|
@@ -366,10 +687,44 @@ |
|
@@ -366,10 +687,44 @@ |
366
|
this.$message.error(error.toString());
|
687
|
this.$message.error(error.toString());
|
367
|
});
|
688
|
});
|
368
|
},
|
689
|
},
|
|
|
690
|
+
|
|
|
691
|
+ /**
|
|
|
692
|
+ * 编辑列表的MQ服务器与虚拟主机(1:n)的列表
|
|
|
693
|
+ */
|
|
|
694
|
+ selectEditServerAndHostList(serverName) {
|
|
|
695
|
+ const param = {serverName: serverName};
|
|
|
696
|
+ getServerAndHostList(param).then((response) => {
|
|
|
697
|
+ let res = response.data;
|
|
|
698
|
+ if (res.code !== '200') {
|
|
|
699
|
+ return this.$message.error('获取服务器与虚拟主机信息,失败!');
|
|
|
700
|
+ }
|
|
|
701
|
+ // 获取列表数据
|
|
|
702
|
+ this.user_config.tree.edit_serverHostList = res.data;
|
|
|
703
|
+ }).catch(error => {
|
|
|
704
|
+ this.$message.error(error.toString());
|
|
|
705
|
+ });
|
|
|
706
|
+ },
|
|
|
707
|
+
|
|
|
708
|
+ /**
|
|
|
709
|
+ * 获取虚拟主机列表
|
|
|
710
|
+ */
|
|
|
711
|
+ selectHostList(serverId) {
|
|
|
712
|
+ let params = {serverId: serverId};
|
|
|
713
|
+ getHostList(params).then((response) => {
|
|
|
714
|
+ let res = response.data;
|
|
|
715
|
+ if (res.code !== '200') {
|
|
|
716
|
+ return this.$message.error('获取虚拟主机列表,失败!');
|
|
|
717
|
+ }
|
|
|
718
|
+ this.user_config.virtualHostList = res.data;
|
|
|
719
|
+ }).catch(error => {
|
|
|
720
|
+ this.$message.error(error.toString());
|
|
|
721
|
+ });
|
|
|
722
|
+ },
|
369
|
},
|
723
|
},
|
370
|
created() {
|
724
|
created() {
|
371
|
},
|
725
|
},
|
372
|
mounted() {
|
726
|
mounted() {
|
|
|
727
|
+ this.selectServerAndHostList();
|
373
|
},
|
728
|
},
|
374
|
computed: {},
|
729
|
computed: {},
|
375
|
}
|
730
|
}
|