#
Junjie
1 天以前 8636ff97bffec9f2130628bf09c9d0fbb371e2bc
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
<!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.94);
            --card-border: rgba(216, 226, 238, 0.95);
            --text-main: #243447;
        }
 
        [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(1000px 420px at 0% -10%, rgba(44, 107, 193, 0.12), transparent 56%),
                radial-gradient(900px 400px at 100% 0%, rgba(28, 150, 126, 0.10), transparent 58%),
                linear-gradient(180deg, #f2f6fb 0%, #f8fafc 100%);
        }
 
        .page-shell {
            max-width: 1700px;
            margin: 0 auto;
            padding: 14px;
            box-sizing: border-box;
        }
 
        .card-shell {
            border-radius: 24px;
            border: 1px solid var(--card-border);
            background:
                radial-gradient(760px 220px at -8% 0%, rgba(43, 117, 196, 0.05), transparent 55%),
                radial-gradient(680px 200px at 108% 10%, rgba(24, 150, 129, 0.05), transparent 58%),
                var(--card-bg);
            box-shadow: 0 16px 32px rgba(44, 67, 96, 0.08);
            overflow: hidden;
        }
 
        .toolbar-bar {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 10px;
            flex-wrap: wrap;
            padding: 12px 16px 10px;
            border-bottom: 1px solid rgba(222, 230, 239, 0.92);
        }
 
        .toolbar-left,
        .toolbar-right {
            display: flex;
            align-items: center;
            gap: 8px;
            flex-wrap: wrap;
        }
 
        .toolbar-bar .el-button {
            padding: 8px 12px;
            border-radius: 8px;
        }
 
        .toolbar-title {
            font-size: 13px;
            color: #7a8a9f;
        }
 
        .toolbar-title strong {
            color: var(--text-main);
            font-size: 15px;
            margin-right: 8px;
        }
 
        .table-wrap {
            padding: 10px 16px 16px;
        }
 
        .table-shell {
            border-radius: 20px;
            overflow: hidden;
            border: 1px solid rgba(217, 227, 238, 0.98);
            background: rgba(255, 255, 255, 0.95);
        }
 
        .table-shell .el-table {
            border-radius: 20px;
            overflow: hidden;
        }
 
        .table-shell .el-table th {
            background: #f7fafc;
            color: #53677d;
            font-weight: 700;
        }
 
        .menu-name {
            display: inline-flex;
            align-items: center;
            gap: 8px;
        }
 
        .status-tag,
        .level-tag {
            min-width: 54px;
            text-align: center;
        }
 
        .dialog-panel .el-dialog {
            border-radius: 24px;
            overflow: hidden;
        }
 
        .dialog-panel .el-dialog__header {
            padding: 22px 24px 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: 18px 24px 8px;
        }
 
        .dialog-footer {
            display: flex;
            justify-content: flex-end;
            gap: 10px;
        }
 
        .empty-wrap {
            padding: 54px 0 72px;
        }
 
        @media (max-width: 900px) {
            .page-shell {
                padding: 10px;
            }
 
            .toolbar-bar,
            .table-wrap {
                padding-left: 12px;
                padding-right: 12px;
            }
        }
    </style>
</head>
<body>
<div id="app" class="page-shell" v-cloak>
    <section class="card-shell">
        <div class="toolbar-bar">
            <div class="toolbar-left">
                <div class="toolbar-title"><strong>菜单列表</strong></div>
            </div>
            <div class="toolbar-right">
                <el-button size="small" type="primary" plain icon="el-icon-plus" @click="openCreateDialog">新增</el-button>
                <el-button size="small" type="danger" plain icon="el-icon-delete" :disabled="selection.length === 0" @click="removeSelection">删除</el-button>
                <el-button size="small" plain :icon="expandAll ? 'el-icon-folder-opened' : 'el-icon-folder'" @click="toggleExpandAll">
                    {{ expandAll ? '收起全部' : '展开全部' }}
                </el-button>
                <el-button size="small" plain icon="el-icon-refresh" :loading="loading" @click="loadTree">刷新</el-button>
            </div>
        </div>
 
        <div class="table-wrap">
            <div class="table-shell">
                <el-table
                    ref="treeTable"
                    v-loading="loading"
                    :key="'resource-tree-' + tableKey"
                    :data="tableData"
                    row-key="id"
                    border
                    stripe
                    :default-expand-all="expandAll"
                    :tree-props="{ children: 'children' }"
                    :height="tableHeight"
                    @selection-change="handleSelectionChange">
                    <el-table-column type="selection" width="52" align="center"></el-table-column>
                    <el-table-column label="菜单名称" min-width="260">
                        <template slot-scope="scope">
                            <div class="menu-name">
                                <span>{{ scope.row.name }}</span>
                            </div>
                        </template>
                    </el-table-column>
                    <el-table-column prop="code" label="菜单编码" min-width="220" show-overflow-tooltip></el-table-column>
                    <el-table-column label="上级菜单" min-width="180" show-overflow-tooltip>
                        <template slot-scope="scope">
                            {{ parentName(scope.row.resourceId) || '--' }}
                        </template>
                    </el-table-column>
                    <el-table-column label="类型" width="120" align="center">
                        <template slot-scope="scope">
                            <el-tag class="level-tag" size="mini" :type="levelTagType(scope.row.level)">
                                {{ levelText(scope.row.level) }}
                            </el-tag>
                        </template>
                    </el-table-column>
                    <el-table-column prop="sort" label="排序" width="90" align="center"></el-table-column>
                    <el-table-column label="状态" width="100" align="center">
                        <template slot-scope="scope">
                            <el-tag class="status-tag" size="mini" :type="Number(scope.row.status) === 1 ? 'success' : 'info'">
                                {{ Number(scope.row.status) === 1 ? '正常' : '禁用' }}
                            </el-tag>
                        </template>
                    </el-table-column>
                    <el-table-column label="操作" width="150" fixed="right" align="center">
                        <template slot-scope="scope">
                            <el-button type="text" @click="openEditDialog(scope.row)">修改</el-button>
                            <el-button type="text" style="color:#f56c6c;" @click="removeRows([scope.row.id])">删除</el-button>
                        </template>
                    </el-table-column>
                </el-table>
                <div v-if="!loading && tableData.length === 0" class="empty-wrap">
                    <el-empty description="暂无菜单数据"></el-empty>
                </div>
            </div>
        </div>
    </section>
 
    <el-dialog
        class="dialog-panel"
        :title="dialog.mode === 'create' ? '新增菜单' : '修改菜单'"
        :visible.sync="dialog.visible"
        width="680px"
        :close-on-click-modal="false">
        <el-form
            ref="dialogForm"
            :model="dialogForm"
            :rules="dialogRules"
            label-width="100px"
            size="small">
            <el-row :gutter="16">
                <el-col :span="12">
                    <el-form-item label="上级菜单" prop="resourceId">
                        <el-cascader
                            v-model="dialogForm.resourceId"
                            :options="parentOptions"
                            :props="parentCascaderProps"
                            clearable
                            filterable
                            style="width: 100%;"
                            placeholder="请选择上级菜单">
                        </el-cascader>
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label="菜单编码" prop="code">
                        <el-input v-model.trim="dialogForm.code" placeholder="请输入菜单编码"></el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label="类型" prop="level">
                        <el-select v-model="dialogForm.level" placeholder="请选择类型" style="width: 100%;">
                            <el-option label="一级菜单" :value="1"></el-option>
                            <el-option label="二级菜单" :value="2"></el-option>
                            <el-option label="按钮" :value="3"></el-option>
                        </el-select>
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label="菜单名称" prop="name">
                        <el-input v-model.trim="dialogForm.name" placeholder="请输入菜单名称"></el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label="排序" prop="sort">
                        <el-input v-model.number="dialogForm.sort" placeholder="请输入排序"></el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label="状态" prop="status">
                        <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-row>
        </el-form>
        <div slot="footer" class="dialog-footer">
            <el-button @click="dialog.visible = false">取消</el-button>
            <el-button type="primary" :loading="dialog.submitting" @click="submitDialog">保存</el-button>
        </div>
    </el-dialog>
</div>
 
<script type="text/javascript" src="../../static/js/jquery/jquery-3.3.1.min.js"></script>
<script type="text/javascript" src="../../static/js/common.js" charset="utf-8"></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/resource/resource.js?v=20260310_resource_vue" charset="utf-8"></script>
</body>
</html>