4c4f7640
梁保满
路由表,路由前端文件
|
1
|
<template>
|
42056450
阿宝
权限修改
|
2
3
4
5
6
7
8
9
10
11
|
<div>
<back-box>
<template slot="title">
<span>账号管理</span>
</template>
</back-box>
<div class="answer-header">
<div class="sel-box">
<el-select
class="sel"
|
bb4c8454
阿宝
添加,修改教师
|
12
|
v-model="query.roleId"
|
42056450
阿宝
权限修改
|
13
|
placeholder="选择账号角色"
|
bb4c8454
阿宝
添加,修改教师
|
14
|
@change="(page = 1), _QueryData(1)"
|
42056450
阿宝
权限修改
|
15
16
17
18
19
20
21
22
23
24
25
26
27
|
>
<el-option
v-for="item in roleList"
:key="item.id"
:label="item.roleName"
:value="item.id"
>
</el-option>
</el-select>
<el-select
class="sel"
v-model="query.available"
placeholder="选择账号状态"
|
bb4c8454
阿宝
添加,修改教师
|
28
|
@change="(page = 1), _QueryData(1)"
|
42056450
阿宝
权限修改
|
29
|
>
|
bb4c8454
阿宝
添加,修改教师
|
30
31
|
<el-option label="正常" :value="0"></el-option>
<el-option label="禁用" :value="1"></el-option>
|
42056450
阿宝
权限修改
|
32
33
|
</el-select>
<el-input
|
42056450
阿宝
权限修改
|
34
35
36
|
placeholder="请输入老师账号"
v-model="query.loginName"
class="input-with-select"
|
bb4c8454
阿宝
添加,修改教师
|
37
|
@keyup.enter.native="(page = 1), _QueryData(2)"
|
42056450
阿宝
权限修改
|
38
39
40
41
|
>
<el-button
slot="append"
icon="el-icon-search"
|
bb4c8454
阿宝
添加,修改教师
|
42
|
@click="(page = 1), _QueryData(2)"
|
42056450
阿宝
权限修改
|
43
44
45
46
47
48
|
></el-button>
</el-input>
<el-input
placeholder="请输入老师姓名"
v-model="query.realName"
class="input-with-select"
|
bb4c8454
阿宝
添加,修改教师
|
49
|
@keyup.enter.native="(page = 1), _QueryData(3)"
|
42056450
阿宝
权限修改
|
50
51
52
53
|
>
<el-button
slot="append"
icon="el-icon-search"
|
bb4c8454
阿宝
添加,修改教师
|
54
|
@click="(page = 1), _QueryData(3)"
|
42056450
阿宝
权限修改
|
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
|
></el-button>
</el-input>
</div>
</div>
<div class="table-box">
<el-table
:data="tableData"
border
style="width: 100%"
v-loading="loading"
>
<el-table-column
prop="loginName"
label="账号"
align="center"
></el-table-column>
<el-table-column
prop="realName"
label="姓名"
align="center"
></el-table-column>
<el-table-column prop="roleList" label="角色" align="center">
<template slot-scope="scoped">
<span v-for="(item, index) in scoped.row.roleList" :key="item.id">{{
`${item.roleName}${
index != scoped.row.roleList.length - 1 ? "、" : ""
}`
}}</span>
</template>
</el-table-column>
<el-table-column prop="available" label="状态" align="center"
><template slot-scope="scoped">{{
`${scoped.row.available == 0 ? "可用" : "不可用"}`
}}</template></el-table-column
>
<el-table-column
prop="createdTime"
label="创建时间"
align="center"
></el-table-column>
<el-table-column label="操作" align="center" width="160">
<template slot-scope="scoped">
<el-tooltip content="修改账号" placement="left">
<el-button
class="set-count"
type="primary"
circle
icon="el-icon-edit-outline"
size="mini"
@click="setCount(scoped.row)"
></el-button>
</el-tooltip>
<el-dropdown
trigger="hover"
@command="handleDropdownClick($event, scoped.row)"
>
<el-button
type="info"
size="mini"
circle
icon="el-icon-more"
></el-button>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item :command="0">重置密码</el-dropdown-item>
|
bb4c8454
阿宝
添加,修改教师
|
119
120
121
|
<el-dropdown-item :command="1">{{
`${scoped.row.available == 0 ? "禁用" : "启用"}`
}}</el-dropdown-item>
|
42056450
阿宝
权限修改
|
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
|
<el-dropdown-item :command="2">删除</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</template>
</el-table-column>
</el-table>
<div class="pagination-box">
<el-pagination
small=""
layout="total,prev, pager, next"
:hide-on-single-page="true"
:total="total"
@current-change="changePage"
:current-page="page"
:page-size="size"
>
</el-pagination>
</div>
<el-empty
v-if="!loading && tableData.length == 0"
content="没有更多数据"
:image-size="100"
></el-empty>
</div>
<el-dialog title="修改年级信息" :visible.sync="diaCount" width="400">
<el-form
class="form-box"
:model="formCount"
:rules="ruleCount"
ref="formCount"
label-width="160px"
>
<el-form-item label="手机号码:" prop="loginName">
<el-col :span="12">
<el-input
placeholder="请输入联系电话"
v-model.trim="formCount.loginName"
maxlength="11"
>
</el-input>
</el-col>
</el-form-item>
<el-form-item label="姓名:" prop="realName">
<el-col :span="12">
<el-input
placeholder="请输入教师姓名"
v-model.trim="formCount.realName"
maxlength="11"
>
</el-input>
</el-col>
</el-form-item>
</el-form>
<div class="dialog-footer" slot="footer">
<el-button @click="saveCount">确 定</el-button>
<el-button @click="diaCount = false">取 消</el-button>
</div>
</el-dialog>
</div>
|
4c4f7640
梁保满
路由表,路由前端文件
|
181
182
183
184
|
</template>
<script>
export default {
|
42056450
阿宝
权限修改
|
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
|
data() {
return {
loading: false,
diaCount: false,
formCount: {
userId: "",
loginName: "",
realName: "",
},
ruleCount: {
loginName: [
{ required: true, message: "请输入联系电话", trigger: "blur" },
],
realName: [
{ required: true, message: "请输入教师姓名", trigger: "blur" },
],
},
roleList: [],
query: {
roleId: "",
available: "",
loginName: "",
realName: "",
},
tableData: [],
total: 0,
page: 1,
size: 20,
};
},
created() {
this._QueryData(4);
this._RoleList();
},
methods: {
setCount(obj) {
this.formCount.userId = obj.userId;
this.formCount.loginName = obj.loginName;
this.formCount.realName = obj.realName;
this.diaCount = true;
},
handleDropdownClick(value, item) {
//更多
|
bb4c8454
阿宝
添加,修改教师
|
228
229
230
231
232
233
234
235
236
237
238
239
|
if (value == 2) {
this.$confirm("确定要删除这条账号信息吗?", "提示", {
customClass: "del-model",
cancelButttonText: "取消",
confirmButtonText: "确定",
type: "warning",
}).then(() => {
this.updateUser(item, value);
});
} else {
this.updateUser(item, value);
}
|
42056450
阿宝
权限修改
|
240
241
242
243
244
|
},
changePage(page) {
this.page = page;
this._QueryData(4);
},
|
4c4f7640
梁保满
路由表,路由前端文件
|
245
|
|
42056450
阿宝
权限修改
|
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
|
saveCount() {
this.$refs.formCount.validate(async (valid) => {
if (valid) {
const { data, status, info } = await this.$request.updateUser({
type: 3,
...this.formCount,
});
if (status === 0) {
this.$message.success(info);
this._QueryData(4);
} else {
this.$message.error(info);
}
} else {
console.log("输入有误请检查!");
return false;
}
});
},
async updateUser(obj, type) {
let query = {
userId: obj.userId,
type: type,
};
if (type == 1) {
query.available = obj.available == 0 ? 1 : 0;
}
const { data, status, info } = await this.$request.updateUser({
...query,
});
if (status === 0) {
this.$message.success(info);
this._QueryData(4);
} else {
this.$message.error(info);
}
},
async _RoleList() {
const { data, status, info } = await this.$request.roleList();
if (status === 0) {
this.roleList = data.list || [];
} else {
this.$message.error(info);
}
},
async _QueryData(type) {
let query = {};
if (type == 1) {
query.roleId = this.query.roleId;
query.available = this.query.available;
this.query.loginName = "";
this.query.realName = "";
} else if (type == 2) {
this.query.roleId = "";
this.query.available = "";
query.loginName = this.query.loginName;
this.query.realName = "";
} else if (type == 3) {
this.query.roleId = "";
this.query.available = "";
this.query.loginName = "";
query.realName = this.query.realName;
} else {
query = { ...this.query };
}
this.loading = true;
this.tableData = [];
const { data, status, info } = await this.$request.userPage({
...query,
page: this.page,
size: this.size,
});
this.loading = false;
if (status === 0) {
this.tableData = data.list || [];
this.total = data.count;
} else {
this.$message.error(info);
}
},
},
};
|
4c4f7640
梁保满
路由表,路由前端文件
|
328
|
</script>
|
bb4c8454
阿宝
添加,修改教师
|
329
330
331
332
333
334
335
|
<style lang="scss">
.del-model {
.el-message-box__btns button:nth-child(1) {
color: #667ffd;
}
}
</style>
|
42056450
阿宝
权限修改
|
336
|
<style lang="scss" scoped>
|
bb4c8454
阿宝
添加,修改教师
|
337
338
339
|
.el-message-box .el-button--default {
color: red;
}
|
42056450
阿宝
权限修改
|
340
341
342
343
344
345
|
.set-count {
margin-right: 12px;
}
.table-box {
padding: 0 20px;
}
|
4c4f7640
梁保满
路由表,路由前端文件
|
346
|
</style>
|