#
Junjie
1 天以前 d9411a6692197efabcf132d61c051e51cb85e219
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
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
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
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>系统用户</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="../../static/vue/element/element.css">
    <link rel="stylesheet" href="../../static/css/cool.css">
    <style>
        :root {
            --card-bg: rgba(255, 255, 255, 0.96);
            --card-border: rgba(217, 227, 238, 0.96);
            --text-main: #243447;
            --text-sub: #6d7f90;
        }
 
        [v-cloak] {
            display: none;
        }
 
        html,
        body {
            margin: 0;
            min-height: 100%;
            color: var(--text-main);
            font-family: "Avenir Next", "PingFang SC", "Microsoft YaHei", sans-serif;
            background:
                radial-gradient(920px 360px at 0% 0%, rgba(48, 112, 196, 0.10), transparent 58%),
                radial-gradient(760px 280px at 100% 10%, rgba(25, 160, 138, 0.08), transparent 60%),
                linear-gradient(180deg, #f3f7fb 0%, #f8fafc 100%);
        }
 
        .page-shell {
            padding: 14px;
            box-sizing: border-box;
        }
 
        .card-shell {
            max-width: 1600px;
            margin: 0 auto;
            border-radius: 22px;
            border: 1px solid var(--card-border);
            background:
                radial-gradient(780px 220px at -8% 0%, rgba(45, 118, 196, 0.05), transparent 58%),
                radial-gradient(640px 180px at 106% 16%, rgba(24, 150, 129, 0.05), transparent 56%),
                var(--card-bg);
            box-shadow: 0 16px 32px rgba(44, 67, 96, 0.08);
            overflow: hidden;
        }
 
        .card-head {
            padding: 16px 18px 14px;
            border-bottom: 1px solid rgba(223, 231, 240, 0.92);
        }
 
        .head-top {
            display: flex;
            align-items: flex-start;
            justify-content: space-between;
            gap: 16px;
            flex-wrap: wrap;
            margin-bottom: 12px;
        }
 
        .head-title {
            display: flex;
            flex-direction: column;
            gap: 6px;
        }
 
        .head-title h1 {
            margin: 0;
            font-size: 20px;
            line-height: 1.2;
        }
 
        .head-title p {
            margin: 0;
            font-size: 13px;
            line-height: 1.6;
            color: var(--text-sub);
        }
 
        .head-actions {
            display: flex;
            gap: 10px;
            flex-wrap: wrap;
        }
 
        .head-actions .el-button {
            min-width: 96px;
        }
 
        .search-form {
            display: flex;
            align-items: center;
            gap: 8px 12px;
            flex-wrap: wrap;
        }
 
        .search-form .el-form-item {
            margin-bottom: 0;
        }
 
        .search-form .el-form-item__label {
            font-weight: 600;
            color: #55697d;
        }
 
        .search-form .el-input__inner,
        .search-form .el-button {
            height: 34px;
            line-height: 34px;
        }
 
        .table-wrap {
            padding: 12px 18px 16px;
        }
 
        .table-shell {
            border-radius: 18px;
            overflow: hidden;
            border: 1px solid rgba(217, 227, 238, 0.98);
            background: rgba(255, 255, 255, 0.95);
        }
 
        .table-shell .el-table th {
            background: #f7fafc;
            color: #53677d;
            font-weight: 700;
        }
 
        .table-shell .el-table td,
        .table-shell .el-table th {
            padding: 10px 0;
        }
 
        .status-switch {
            display: inline-flex;
            align-items: center;
        }
 
        .pager-bar {
            padding: 16px 0 0;
            display: flex;
            justify-content: flex-end;
        }
 
        .dialog-panel .el-dialog {
            border-radius: 22px;
            overflow: hidden;
        }
 
        .dialog-panel .el-dialog__header {
            padding: 20px 22px 12px;
            background: linear-gradient(180deg, #f8fbff 0%, #f3f7fb 100%);
            border-bottom: 1px solid rgba(224, 232, 241, 0.92);
        }
 
        .dialog-panel .el-dialog__title {
            font-weight: 700;
            color: var(--text-main);
        }
 
        .dialog-panel .el-dialog__body {
            padding: 20px 22px 8px;
        }
 
        .dialog-form .el-form-item {
            margin-bottom: 16px;
        }
 
        .dialog-form .el-form-item__label {
            font-weight: 600;
            color: #5b6f83;
        }
 
        .dialog-form .el-input__inner,
        .dialog-form .el-select .el-input__inner {
            height: 36px;
            line-height: 36px;
        }
 
        .dialog-tip {
            margin: 4px 0 2px;
            padding: 10px 12px;
            border-radius: 12px;
            font-size: 12px;
            line-height: 1.6;
            color: #748497;
            background: rgba(248, 251, 255, 0.92);
            border: 1px solid rgba(226, 233, 242, 0.96);
        }
 
        .dialog-footer {
            display: flex;
            justify-content: flex-end;
            gap: 10px;
        }
 
        .reset-user {
            margin-bottom: 16px;
            padding: 12px 14px;
            border-radius: 12px;
            background: rgba(248, 251, 255, 0.92);
            border: 1px solid rgba(226, 233, 242, 0.96);
            color: var(--text-sub);
            font-size: 13px;
        }
 
        .table-action-danger {
            color: #f56c6c;
        }
 
        @media (max-width: 768px) {
            .page-shell {
                padding: 10px;
            }
 
            .card-head,
            .table-wrap {
                padding-left: 12px;
                padding-right: 12px;
            }
 
            .dialog-panel .el-dialog {
                width: calc(100% - 24px) !important;
            }
        }
    </style>
</head>
<body>
<div id="app" v-cloak class="page-shell">
    <div class="card-shell">
        <div class="card-head">
            <div class="head-top">
                <div class="head-title">
                    <h1>系统用户</h1>
                    <p>修改界面不再显示密码,密码调整统一通过“重置密码”完成;角色、状态等字段恢复为选择控件。</p>
                </div>
                <div class="head-actions">
                    <el-button type="primary" icon="el-icon-plus" @click="openCreateDialog">新增用户</el-button>
                    <el-button type="danger" icon="el-icon-delete" :disabled="selection.length === 0" @click="removeSelection">删除所选</el-button>
                </div>
            </div>
            <el-form :inline="true" :model="searchForm" class="search-form" @submit.native.prevent>
                <el-form-item label="登录账户">
                    <el-input v-model.trim="searchForm.username" clearable placeholder="请输入登录账户" @keyup.enter.native="handleSearch"></el-input>
                </el-form-item>
                <el-form-item label="账号">
                    <el-input v-model.trim="searchForm.mobile" clearable placeholder="请输入账号" @keyup.enter.native="handleSearch"></el-input>
                </el-form-item>
                <el-form-item>
                    <el-button type="primary" icon="el-icon-search" @click="handleSearch">查询</el-button>
                    <el-button icon="el-icon-refresh-left" @click="handleResetSearch">重置</el-button>
                </el-form-item>
            </el-form>
        </div>
 
        <div class="table-wrap">
            <div class="table-shell" v-loading="loading">
                <el-table
                    :data="tableData"
                    border
                    stripe
                    height="calc(100vh - 245px)"
                    @selection-change="handleSelectionChange">
                    <el-table-column type="selection" width="48" align="center"></el-table-column>
                    <el-table-column prop="username" label="登录账户" min-width="150" show-overflow-tooltip></el-table-column>
                    <el-table-column prop="mobile" label="账号" min-width="150" show-overflow-tooltip></el-table-column>
                    <el-table-column prop="roleName" label="角色" min-width="150" show-overflow-tooltip></el-table-column>
                    <el-table-column label="MFA授权" width="110" align="center">
                        <template slot-scope="scope">
                            <el-tag size="mini" :type="Number(scope.row.mfaAllow) === 1 ? 'success' : 'info'">
                                {{ Number(scope.row.mfaAllow) === 1 ? '已授权' : '未授权' }}
                            </el-tag>
                        </template>
                    </el-table-column>
                    <el-table-column label="MFA状态" width="110" align="center">
                        <template slot-scope="scope">
                            <el-tag size="mini" :type="Number(scope.row.mfaEnabled) === 1 ? 'success' : 'warning'">
                                {{ Number(scope.row.mfaEnabled) === 1 ? '已启用' : '未启用' }}
                            </el-tag>
                        </template>
                    </el-table-column>
                    <el-table-column label="状态" width="130" align="center">
                        <template slot-scope="scope">
                            <div class="status-switch">
                                <el-switch
                                    v-model="scope.row.status"
                                    :active-value="1"
                                    :inactive-value="0"
                                    active-text="正常"
                                    inactive-text="禁用"
                                    @change="toggleStatus(scope.row)">
                                </el-switch>
                            </div>
                        </template>
                    </el-table-column>
                    <el-table-column label="操作" width="220" fixed="right" align="center">
                        <template slot-scope="scope">
                            <el-button type="text" @click="openEditDialog(scope.row)">编辑</el-button>
                            <el-button type="text" @click="openResetPasswordDialog(scope.row)">重置密码</el-button>
                            <el-button type="text" class="table-action-danger" @click="removeRows([scope.row.id])">删除</el-button>
                        </template>
                    </el-table-column>
                </el-table>
            </div>
 
            <div class="pager-bar">
                <el-pagination
                    background
                    layout="total, sizes, prev, pager, next, jumper"
                    :current-page="page.curr"
                    :page-size="page.limit"
                    :page-sizes="[15, 30, 50, 100, 200, 500]"
                    :total="page.total"
                    @size-change="handleSizeChange"
                    @current-change="handleCurrentChange">
                </el-pagination>
            </div>
        </div>
    </div>
 
    <el-dialog
        class="dialog-panel"
        :title="dialog.mode === 'create' ? '新增用户' : '修改用户'"
        :visible.sync="dialog.visible"
        width="620px"
        :close-on-click-modal="false"
        append-to-body>
        <el-form
            ref="dialogForm"
            :model="dialogForm"
            :rules="dialogRules"
            label-width="88px"
            class="dialog-form"
            @submit.native.prevent>
            <el-row :gutter="18">
                <el-col :xs="24" :sm="12">
                    <el-form-item label="登录账户" prop="username">
                        <el-input v-model.trim="dialogForm.username" maxlength="32" placeholder="请输入登录账户"></el-input>
                    </el-form-item>
                </el-col>
                <el-col :xs="24" :sm="12">
                    <el-form-item label="账号" prop="mobile">
                        <el-input v-model.trim="dialogForm.mobile" maxlength="32" placeholder="请输入账号"></el-input>
                    </el-form-item>
                </el-col>
                <el-col :xs="24" :sm="12">
                    <el-form-item label="角色" prop="roleId">
                        <el-select v-model="dialogForm.roleId" placeholder="请选择角色" style="width: 100%;">
                            <el-option
                                v-for="role in roles"
                                :key="role.id"
                                :label="role.name"
                                :value="Number(role.id)">
                            </el-option>
                        </el-select>
                    </el-form-item>
                </el-col>
                <el-col :xs="24" :sm="12">
                    <el-form-item label="状态">
                        <el-select v-model="dialogForm.status" placeholder="请选择状态" style="width: 100%;">
                            <el-option label="正常" :value="1"></el-option>
                            <el-option label="禁用" :value="0"></el-option>
                        </el-select>
                    </el-form-item>
                </el-col>
                <el-col :xs="24" :sm="12">
                    <el-form-item label="MFA授权">
                        <el-select v-model="dialogForm.mfaAllow" placeholder="请选择" style="width: 100%;">
                            <el-option label="不允许" :value="0"></el-option>
                            <el-option label="允许" :value="1"></el-option>
                        </el-select>
                    </el-form-item>
                </el-col>
                <el-col v-if="dialog.mode === 'create'" :xs="24" :sm="12">
                    <el-form-item label="初始密码" prop="password">
                        <el-input v-model.trim="dialogForm.password" show-password maxlength="32" placeholder="请输入初始密码"></el-input>
                    </el-form-item>
                </el-col>
            </el-row>
            <div v-if="dialog.mode === 'edit'" class="dialog-tip">
                修改界面不显示密码。如需调整密码,请关闭当前窗口后使用列表里的“重置密码”。
            </div>
        </el-form>
        <span slot="footer" class="dialog-footer">
            <el-button @click="closeDialog">取消</el-button>
            <el-button type="primary" :loading="dialogSubmitting" @click="submitDialog">保存</el-button>
        </span>
    </el-dialog>
 
    <el-dialog
        class="dialog-panel"
        title="重置密码"
        :visible.sync="resetDialog.visible"
        width="420px"
        :close-on-click-modal="false"
        append-to-body>
        <div class="reset-user">当前用户:{{ resetDialog.username || '--' }}</div>
        <el-form
            ref="resetForm"
            :model="resetDialog"
            :rules="resetRules"
            label-width="72px"
            class="dialog-form"
            @submit.native.prevent>
            <el-form-item label="新密码" prop="password">
                <el-input v-model.trim="resetDialog.password" show-password maxlength="32" placeholder="请输入新密码"></el-input>
            </el-form-item>
        </el-form>
        <span slot="footer" class="dialog-footer">
            <el-button @click="closeResetDialog">取消</el-button>
            <el-button type="primary" :loading="resetSubmitting" @click="submitResetPassword">确定</el-button>
        </span>
    </el-dialog>
</div>
 
<script type="text/javascript" src="../../static/js/jquery/jquery-3.3.1.min.js"></script>
<script type="text/javascript" src="../../static/vue/js/vue.min.js"></script>
<script type="text/javascript" src="../../static/vue/element/element.js"></script>
<script type="text/javascript" src="../../static/js/common.js?v=20260309_i18n_fix1" charset="utf-8"></script>
<script type="text/javascript" src="../../static/js/tools/md5.js"></script>
<script type="text/javascript" src="../../static/js/user/user.js?v=20260311_user_restore1" charset="utf-8"></script>
</body>
</html>