index.vue
8.05 KB
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
<template>
<anji-crud ref="listPage" :option="crudOption">
<template v-slot:buttonLeftOnTable> </template>
<!--
<template slot="rowButton" slot-scope="props">
<el-button type="primary" @click="customButtom(props)">行按钮</el-button>
</template>
-->
<!--自定义的卡片插槽,将在编辑详情页面,出现在底部新卡片-->
<!--这里可以将自定义的弹出框代码,放入到page中
<template v-slot:pageSection>
<div>插入底部html片段</div>
</template>
-->
</anji-crud>
</template>
<script>
import {
accessAuthorityList,
accessAuthorityAdd,
accessAuthorityDeleteBatch,
accessAuthorityUpdate,
accessAuthorityDetail
} from "@/api/accessAuthority";
export default {
name: "AccessAuthority",
data() {
return {
crudOption: {
// 使用菜单做为页面标题
title: "权限管理",
// 详情页中输入框左边文字宽度
labelWidth: "120px",
// 查询表单条件
queryFormFields: [
{
inputType: "anji-tree", // 该类型将内容区一分为二,左侧20%显示树
anjiTreeOption: {
url: "/accessAuthority/menuTree", // 请求接口,将响应中id字段做为tree的id,将label字段做为tree的label
enableFilter: true, // tree 是否有input 过滤
isOpen: true // true tree 展开 false 关闭
},
label: "所属菜单",
field: "target"
},
{
inputType: "anji-select", //form表单类型 input|input-number|anji-select(传递url或者dictCode)|anji-tree(左侧树)|date|datetime|datetimerange
anjiSelectOption: {
dictCode: "ENABLE_FLAG"
},
label: "启用状态",
field: "enableFlag"
},
{
inputType: "input",
label: "菜单代码",
field: "target"
},
{
inputType: "input",
label: "菜单名称",
field: "targetName"
},
{
inputType: "input",
label: "按钮代码",
field: "action"
},
{
inputType: "input",
label: "按钮名称",
field: "actionName"
}
],
// 操作按钮
buttons: {
query: {
api: accessAuthorityList,
permission: "authorityManage:query"
},
queryByPrimarykey: {
api: accessAuthorityDetail,
permission: "authorityManage:query"
},
add: {
api: accessAuthorityAdd,
permission: "authorityManage:insert"
},
delete: {
api: accessAuthorityDeleteBatch,
permission: "authorityManage:delete"
},
edit: {
api: accessAuthorityUpdate,
permission: "authorityManage:update"
},
customButton: {
operationWidth: "150px"
}
},
// 表格列
columns: [
{
label: "",
field: "id",
primaryKey: true, // 根据主键查询详情或者根据主键删除时, 主键的
tableHide: true, // 表格中不显示
editHide: true // 编辑弹框中不显示
},
{
label: "菜单代码", //目标菜单
placeholder: "",
field: "target",
editField: "target",
tableHide: true, // 表格中不显示
inputType: "input",
rules: [
{ required: true, message: "目标菜单必填", trigger: "blur" },
{ min: 1, max: 64, message: "不超过64个字符", trigger: "blur" }
],
disabled: false
},
{
label: "菜单名称", //目标菜单名称
placeholder: "",
field: "targetName",
sortable: true,
fieldTableRowRenderer: row => {
return `${row["targetName"]}[${row["target"]}]`;
},
editField: "targetName",
inputType: "input",
rules: [
{ required: true, message: "目标菜单名称必填", trigger: "blur" },
{ min: 1, max: 128, message: "不超过128个字符", trigger: "blur" }
],
disabled: false
},
{
label: "按钮代码", //目标按钮
placeholder: "",
field: "action",
tableHide: true, // 表格中不显示
editField: "action",
inputType: "input",
rules: [
{ required: true, message: "目标必填", trigger: "blur" },
{ min: 1, max: 64, message: "不超过64个字符", trigger: "blur" }
],
disabled: false
},
{
label: "按钮名称", //目标按钮名称
placeholder: "",
field: "actionName",
fieldTableRowRenderer: row => {
return `${row["actionName"]}[${row["action"]}]`;
},
sortable: true,
editField: "actionName",
inputType: "input",
rules: [
{ required: true, message: "目标按钮名称必填", trigger: "blur" },
{ min: 1, max: 128, message: "不超过128个字符", trigger: "blur" }
],
disabled: false
},
{
label: "启用状态", //0--已禁用 1--已启用 DIC_NAME=ENABLE_FLAG
placeholder: "",
field: "enableFlag",
fieldTableRowRenderer: row => {
return this.getDictLabelByCode("ENABLE_FLAG", row["enableFlag"]);
},
editField: "enableFlag",
inputType: "anji-select",
anjiSelectOption: {
dictCode: "ENABLE_FLAG" //指定数据字典
},
colorStyle: {
0: "table-danger", //key为editField渲染的值(字典的提交值)'红色': 'danger','蓝色': 'primary','绿色': 'success','黄色': 'warning','灰色': 'info','白色':''
1: "table-success"
},
rules: [
{ required: true, message: "启用状态必填", trigger: "blur" }
],
disabled: false
},
{
label: "排序", //
placeholder: "",
field: "sort",
editField: "sort",
inputType: "input",
rules: [],
disabled: false
},
{
label: "创建人",
placeholder: "",
field: "createBy",
columnType: "expand",
editField: "createBy",
inputType: "input",
editHide: "hideOnAdd", // 编辑弹框中不显示 true/false/'hideOnAdd hideOnView hideOnEdit'
disabled: true
},
{
label: "创建时间",
placeholder: "",
field: "createTime",
columnType: "expand",
editField: "createTime",
inputType: "input",
editHide: "hideOnAdd", // 编辑弹框中不显示 true/false/'hideOnAdd hideOnView hideOnEdit'
disabled: true
},
{
label: "修改人",
placeholder: "",
field: "updateBy",
columnType: "expand",
editField: "updateBy",
inputType: "input",
editHide: "hideOnAdd", // 编辑弹框中不显示 true/false/'hideOnAdd hideOnView hideOnEdit'
disabled: true
},
{
label: "修改时间",
placeholder: "",
field: "updateTime",
columnType: "expand",
editField: "updateTime",
inputType: "input",
editHide: "hideOnAdd", // 编辑弹框中不显示 true/false/'hideOnAdd hideOnView hideOnEdit'
disabled: true
}
]
}
};
},
created() {},
methods: {}
};
</script>