leisure-core 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +145 -0
- package/le-button/index.js +7 -0
- package/le-button/src/main.vue +48 -0
- package/le-button-msg/index.js +7 -0
- package/le-button-msg/src/main.vue +61 -0
- package/le-button-select-media/index.js +7 -0
- package/le-button-select-media/src/main.vue +64 -0
- package/le-button-upload/index.js +7 -0
- package/le-button-upload/src/main.vue +50 -0
- package/le-company/index.js +7 -0
- package/le-company/src/main.vue +101 -0
- package/le-company/src/sub.vue +111 -0
- package/le-coupon-give/index.js +7 -0
- package/le-coupon-give/src/main.vue +94 -0
- package/le-depart/index.js +7 -0
- package/le-depart/src/main.vue +162 -0
- package/le-dialog-container/index.js +7 -0
- package/le-dialog-container/src/main.vue +74 -0
- package/le-home/index.js +7 -0
- package/le-home/src/main.vue +570 -0
- package/le-image/index.js +7 -0
- package/le-image/src/main.vue +145 -0
- package/le-integral/index.js +7 -0
- package/le-integral/src/main.vue +198 -0
- package/le-libs/mixins/main.js +37 -0
- package/le-login/index.js +7 -0
- package/le-login/src/main.vue +181 -0
- package/le-media/index.js +7 -0
- package/le-media/src/main.vue +267 -0
- package/le-media-list/index.js +7 -0
- package/le-media-list/src/main.vue +177 -0
- package/le-media-upload/index.js +7 -0
- package/le-media-upload/src/main.vue +308 -0
- package/le-member/index.js +7 -0
- package/le-member/src/main.vue +445 -0
- package/le-member-level/index.js +7 -0
- package/le-member-level/src/main.vue +93 -0
- package/le-member-level/src/sub.vue +86 -0
- package/le-menu/index.js +7 -0
- package/le-menu/src/main.vue +248 -0
- package/le-rich-text/index.js +7 -0
- package/le-rich-text/src/main.vue +136 -0
- package/le-role/index.js +7 -0
- package/le-role/src/main.vue +169 -0
- package/le-role/src/sub.vue +79 -0
- package/le-role-user/index.js +7 -0
- package/le-role-user/src/main.vue +158 -0
- package/le-role-user/src/sub.vue +90 -0
- package/le-theme/common/var.scss +17 -0
- package/le-theme/iconfont/iconfont.css +125 -0
- package/le-theme/iconfont/iconfont.ttf +0 -0
- package/le-theme/iconfont/iconfont.woff +0 -0
- package/le-theme/iconfont/iconfont.woff2 +0 -0
- package/le-theme/pages/index.css +15 -0
- package/le-user/index.js +7 -0
- package/le-user/src/add.vue +118 -0
- package/le-user/src/main.vue +423 -0
- package/le-user/src/sub.vue +214 -0
- package/le-user-type/index.js +7 -0
- package/le-user-type/src/main.vue +39 -0
- package/package.json +51 -0
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="le-menu-mainClass">
|
|
3
|
+
<div class="titleClass">角色:{{ roleInfo.roleName }}的功能菜单</div>
|
|
4
|
+
<el-tree
|
|
5
|
+
:data="menus"
|
|
6
|
+
ref="elTree"
|
|
7
|
+
show-checkbox
|
|
8
|
+
node-key="id"
|
|
9
|
+
:props="props"
|
|
10
|
+
>
|
|
11
|
+
<span class="custom-tree-node" slot-scope="{ node, data }">
|
|
12
|
+
<span>{{ node.label }}</span>
|
|
13
|
+
<span v-if="!data.children && data.btns && data.btns.length > 0">
|
|
14
|
+
<el-button
|
|
15
|
+
type="text"
|
|
16
|
+
size="mini"
|
|
17
|
+
@click="() => buttonPermission(data)"
|
|
18
|
+
>
|
|
19
|
+
页面按钮
|
|
20
|
+
</el-button>
|
|
21
|
+
</span>
|
|
22
|
+
</span>
|
|
23
|
+
</el-tree>
|
|
24
|
+
<div class="footerClass">
|
|
25
|
+
<el-button @click="cancel()">取 消</el-button>
|
|
26
|
+
<el-button type="primary" @click="saveAll">保 存</el-button>
|
|
27
|
+
</div>
|
|
28
|
+
<div>
|
|
29
|
+
<el-dialog
|
|
30
|
+
width="50%"
|
|
31
|
+
title="页面按钮"
|
|
32
|
+
append-to-body
|
|
33
|
+
:visible.sync="showDialog"
|
|
34
|
+
:close-on-click-modal="true"
|
|
35
|
+
>
|
|
36
|
+
<el-form>
|
|
37
|
+
<el-checkbox-group v-model="checkBtnList">
|
|
38
|
+
<el-checkbox
|
|
39
|
+
v-for="item in btnsList"
|
|
40
|
+
:label="item.id"
|
|
41
|
+
:key="item.id"
|
|
42
|
+
>{{ item.name }}</el-checkbox
|
|
43
|
+
>
|
|
44
|
+
</el-checkbox-group>
|
|
45
|
+
</el-form>
|
|
46
|
+
<span slot="footer" class="dialog-footer">
|
|
47
|
+
<el-button @click="closePageButton()">关 闭</el-button>
|
|
48
|
+
<el-button type="primary" @click="savePageBtn()">保 存</el-button>
|
|
49
|
+
</span>
|
|
50
|
+
</el-dialog>
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|
|
53
|
+
</template>
|
|
54
|
+
<script>
|
|
55
|
+
import { menuRoleList } from "@/api/menu";
|
|
56
|
+
import { batchAddRoleMenu, listRoleMenu } from "@/api/role";
|
|
57
|
+
export default {
|
|
58
|
+
name: "le-menu",
|
|
59
|
+
props: {
|
|
60
|
+
roleInfo: {
|
|
61
|
+
type: Object,
|
|
62
|
+
default: () => {},
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
data() {
|
|
66
|
+
return {
|
|
67
|
+
props: {
|
|
68
|
+
label: "title",
|
|
69
|
+
btns: "btns",
|
|
70
|
+
children: "children",
|
|
71
|
+
},
|
|
72
|
+
menus: [],
|
|
73
|
+
showDialog: false,
|
|
74
|
+
checkBtnList: [], //当前选择的按钮
|
|
75
|
+
btnsList: [], //按钮列表
|
|
76
|
+
};
|
|
77
|
+
},
|
|
78
|
+
mounted() {
|
|
79
|
+
this.getMenus();
|
|
80
|
+
},
|
|
81
|
+
methods: {
|
|
82
|
+
fillCheckboxStatus() {
|
|
83
|
+
this.userRoleList = [];
|
|
84
|
+
let param = {};
|
|
85
|
+
param.rid = this.roleInfo.roleId;
|
|
86
|
+
listRoleMenu(param).then((res) => {
|
|
87
|
+
let roleMenus = res.data.data;
|
|
88
|
+
if (roleMenus != undefined && roleMenus.length > 0) {
|
|
89
|
+
let selectKeys = roleMenus.map(function (item) {
|
|
90
|
+
return item.mid;
|
|
91
|
+
});
|
|
92
|
+
this.$refs.elTree.setCheckedKeys(selectKeys, false);
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
},
|
|
96
|
+
cancel() {
|
|
97
|
+
this.$emit("close");
|
|
98
|
+
},
|
|
99
|
+
buttonPermission(data) {
|
|
100
|
+
this.btnsList = [];
|
|
101
|
+
this.checkBtnList = [];
|
|
102
|
+
let btns = data.btns;
|
|
103
|
+
if (btns && btns.length > 0) {
|
|
104
|
+
let json = JSON.parse(btns);
|
|
105
|
+
json.forEach((btn) => {
|
|
106
|
+
if (btn && btn.permission && btn.permission == "ok") {
|
|
107
|
+
if (btn.id && btn.id.length > 0) {
|
|
108
|
+
if (!this.checkBtnList.includes(btn.id)) {
|
|
109
|
+
this.checkBtnList.push(btn.id);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
this.btnsList = json;
|
|
115
|
+
this.showDialog = true;
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
handleMenuCheckChange(data, checked, indeterminate) {
|
|
119
|
+
// if (checked) {
|
|
120
|
+
// const childes = data.children ?? [];
|
|
121
|
+
// if (childes.length == 0) {
|
|
122
|
+
// let btns = data.btns;
|
|
123
|
+
// if (btns && btns.length > 0) {
|
|
124
|
+
// let json = JSON.parse(btns);
|
|
125
|
+
// json.forEach((btn) => {
|
|
126
|
+
// if (btn && btn.effect && btn.effect == "ok") {
|
|
127
|
+
// this.checkBtnList.push(btn.name);
|
|
128
|
+
// }
|
|
129
|
+
// });
|
|
130
|
+
// this.btnsList = json;
|
|
131
|
+
// this.showDialog = true;
|
|
132
|
+
// }
|
|
133
|
+
// }
|
|
134
|
+
// }
|
|
135
|
+
},
|
|
136
|
+
closePageButton() {
|
|
137
|
+
this.showDialog = false;
|
|
138
|
+
},
|
|
139
|
+
savePageBtn() {
|
|
140
|
+
let btns = this.btnsList;
|
|
141
|
+
if (btns && btns.length > 0) {
|
|
142
|
+
btns.forEach((btn) => {
|
|
143
|
+
if (this.checkBtnList.includes(btn.id)) {
|
|
144
|
+
btn.permission = "ok"; //标识有权限
|
|
145
|
+
} else {
|
|
146
|
+
btn.permission = "no";
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
this.$refs.elTree.getCurrentNode().btns = JSON.stringify(btns);
|
|
151
|
+
this.save();
|
|
152
|
+
this.closePageButton();
|
|
153
|
+
},
|
|
154
|
+
save() {
|
|
155
|
+
return new Promise((reslove, reject) => {
|
|
156
|
+
let nodes = this.$refs.elTree.getCheckedNodes(false);
|
|
157
|
+
let tops = this.$refs.elTree.getHalfCheckedNodes();
|
|
158
|
+
let params = new Array();
|
|
159
|
+
if (nodes != undefined && nodes.length > 0) {
|
|
160
|
+
nodes.forEach((node) => {
|
|
161
|
+
let param = {};
|
|
162
|
+
param.mid = node.id;
|
|
163
|
+
param.rid = this.roleInfo.roleId;
|
|
164
|
+
param.isTop = 0;
|
|
165
|
+
param.btns = node.btns;
|
|
166
|
+
param.control = node.control;
|
|
167
|
+
params.push(param);
|
|
168
|
+
});
|
|
169
|
+
if (tops != undefined && tops.length > 0) {
|
|
170
|
+
tops.forEach((top) => {
|
|
171
|
+
let param = {};
|
|
172
|
+
param.mid = top.id;
|
|
173
|
+
param.rid = this.roleInfo.roleId;
|
|
174
|
+
param.isTop = 1;
|
|
175
|
+
param.btns = top.btns;
|
|
176
|
+
param.control = top.control;
|
|
177
|
+
params.push(param);
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
batchAddRoleMenu(params).then(() => {
|
|
181
|
+
this.$message.success("功能菜单定义成功");
|
|
182
|
+
reslove();
|
|
183
|
+
});
|
|
184
|
+
} else {
|
|
185
|
+
let param = {};
|
|
186
|
+
param.rid = this.roleInfo.roleId;
|
|
187
|
+
params.push(param);
|
|
188
|
+
batchAddRoleMenu(params).then(() => {
|
|
189
|
+
this.$message.success("功能菜单定义成功");
|
|
190
|
+
reslove();
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
});
|
|
194
|
+
},
|
|
195
|
+
saveAll() {
|
|
196
|
+
this.save().then(() => {});
|
|
197
|
+
},
|
|
198
|
+
getMenus() {
|
|
199
|
+
let param = {};
|
|
200
|
+
param.rid = this.roleInfo.roleId;
|
|
201
|
+
menuRoleList(param).then((res) => {
|
|
202
|
+
let menus = res.data.data;
|
|
203
|
+
menus = menus.filter((item) => {
|
|
204
|
+
// if (item.children) {
|
|
205
|
+
// item.children = item.children.filter((child) => {
|
|
206
|
+
// return child.isHide == 0;
|
|
207
|
+
// });
|
|
208
|
+
// }
|
|
209
|
+
return item;
|
|
210
|
+
});
|
|
211
|
+
this.menus = menus;
|
|
212
|
+
this.fillCheckboxStatus();
|
|
213
|
+
});
|
|
214
|
+
},
|
|
215
|
+
},
|
|
216
|
+
};
|
|
217
|
+
</script>
|
|
218
|
+
<style lang="scss" scoped>
|
|
219
|
+
.le-menu-mainClass {
|
|
220
|
+
display: flex;
|
|
221
|
+
display: -webkit-flex;
|
|
222
|
+
flex-direction: column;
|
|
223
|
+
height: calc(100vh - 100px);
|
|
224
|
+
overflow: auto;
|
|
225
|
+
|
|
226
|
+
.titleClass {
|
|
227
|
+
text-align: center;
|
|
228
|
+
font-size: 16px;
|
|
229
|
+
font-weight: bold;
|
|
230
|
+
margin-bottom: 5px;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
.custom-tree-node {
|
|
234
|
+
flex: 1;
|
|
235
|
+
display: flex;
|
|
236
|
+
align-items: center;
|
|
237
|
+
justify-content: space-between;
|
|
238
|
+
font-size: 14px;
|
|
239
|
+
padding-right: 8px;
|
|
240
|
+
text-align: center;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
.footerClass {
|
|
244
|
+
text-align: center;
|
|
245
|
+
margin-top: 5px;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
</style>
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="le-rich-text">
|
|
3
|
+
<div class="header" v-if="showBtn">
|
|
4
|
+
<le-button-select-media
|
|
5
|
+
title="选择素材"
|
|
6
|
+
@selectContent="selectContent"
|
|
7
|
+
></le-button-select-media>
|
|
8
|
+
<el-button type="primary" @click="onSave">保存</el-button>
|
|
9
|
+
</div>
|
|
10
|
+
<le-editor
|
|
11
|
+
style="height: 500px"
|
|
12
|
+
v-model="content"
|
|
13
|
+
ref="vueeditor"
|
|
14
|
+
useCustomImageHandler
|
|
15
|
+
@image-added="vueEditorHandleImageAdded"
|
|
16
|
+
></le-editor>
|
|
17
|
+
<div class="footer">
|
|
18
|
+
<span style="float: left; font-size: 12px; margin-left: 20px">
|
|
19
|
+
图片大小不能超过2M</span
|
|
20
|
+
>
|
|
21
|
+
<span style="float: right; margin-right: 20px">
|
|
22
|
+
{{ innerLength }}/200
|
|
23
|
+
</span>
|
|
24
|
+
</div>
|
|
25
|
+
</div>
|
|
26
|
+
</template>
|
|
27
|
+
<script>
|
|
28
|
+
import { LeEditor } from "leisure-editor";
|
|
29
|
+
import { uploadFile } from "@/api/upload";
|
|
30
|
+
import { Base64 } from "js-base64";
|
|
31
|
+
export default {
|
|
32
|
+
name: "le-rich-text",
|
|
33
|
+
components: {
|
|
34
|
+
LeEditor,
|
|
35
|
+
},
|
|
36
|
+
props: {
|
|
37
|
+
id: {
|
|
38
|
+
type: String,
|
|
39
|
+
default: "btnEditor",
|
|
40
|
+
},
|
|
41
|
+
isBase64: {
|
|
42
|
+
type: Boolean,
|
|
43
|
+
default: true,
|
|
44
|
+
},
|
|
45
|
+
showBtn: {
|
|
46
|
+
type: Boolean,
|
|
47
|
+
default: false,
|
|
48
|
+
},
|
|
49
|
+
initValue: {
|
|
50
|
+
type: String,
|
|
51
|
+
default: () => {},
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
data() {
|
|
55
|
+
return {
|
|
56
|
+
content: "",
|
|
57
|
+
innerLength: 0,
|
|
58
|
+
};
|
|
59
|
+
},
|
|
60
|
+
watch: {
|
|
61
|
+
initValue: {
|
|
62
|
+
handler(newValue) {
|
|
63
|
+
if (this.isBase64 && newValue && newValue.length > 0) {
|
|
64
|
+
this.content = Base64.decode(newValue);
|
|
65
|
+
} else this.content = newValue;
|
|
66
|
+
},
|
|
67
|
+
immediate: true,
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
methods: {
|
|
71
|
+
onSave() {
|
|
72
|
+
let comments = this.content;
|
|
73
|
+
if (this.isBase64) {
|
|
74
|
+
comments = Base64.encode(comments);
|
|
75
|
+
}
|
|
76
|
+
this.$emit("onSubmit", comments);
|
|
77
|
+
},
|
|
78
|
+
selectContent(value) {
|
|
79
|
+
let quill = this.$refs.vueeditor.quill;
|
|
80
|
+
let cursorLocation = quill.selection.savedRange.index;
|
|
81
|
+
if (value && value.length > 0) {
|
|
82
|
+
if (Array.isArray(value)) {
|
|
83
|
+
value.forEach((item) => {
|
|
84
|
+
quill.insertEmbed(cursorLocation, "image", item);
|
|
85
|
+
});
|
|
86
|
+
} else {
|
|
87
|
+
quill.insertEmbed(cursorLocation, "image", value);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
async vueEditorHandleImageAdded(
|
|
92
|
+
file,
|
|
93
|
+
Editor,
|
|
94
|
+
cursorLocation,
|
|
95
|
+
resetUploader
|
|
96
|
+
) {
|
|
97
|
+
// if (file.size > 1048576 * 2) {
|
|
98
|
+
// info("图片不能超过2M,请压缩后再上传", this);
|
|
99
|
+
// return;
|
|
100
|
+
// }
|
|
101
|
+
|
|
102
|
+
var formData = new FormData();
|
|
103
|
+
formData.append("files", file);
|
|
104
|
+
uploadFile(formData).then((res) => {
|
|
105
|
+
let address = res.data.data;
|
|
106
|
+
console.log(address);
|
|
107
|
+
if (address && address.length > 0) {
|
|
108
|
+
address.forEach((item) => {
|
|
109
|
+
// const reader = new FileReader();
|
|
110
|
+
// reader.readAsDataURL(file);
|
|
111
|
+
// reader.onload = (e) => {
|
|
112
|
+
// Editor.insertEmbed(cursorLocation, "image", e.target.result);
|
|
113
|
+
// };
|
|
114
|
+
Editor.insertEmbed(cursorLocation, "image", item);
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
resetUploader();
|
|
118
|
+
});
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
};
|
|
122
|
+
</script>
|
|
123
|
+
<style lang="scss" scoped>
|
|
124
|
+
.le-rich-text {
|
|
125
|
+
.header {
|
|
126
|
+
display: flex;
|
|
127
|
+
display: -webkit-flex;
|
|
128
|
+
justify-content: right;
|
|
129
|
+
margin-bottom: 4px;
|
|
130
|
+
margin-right: 10px;
|
|
131
|
+
}
|
|
132
|
+
.footer {
|
|
133
|
+
margin-top: 60px;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
</style>
|
package/le-role/index.js
ADDED
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="le-role-container">
|
|
3
|
+
<el-form :inline="true" class="demo-form-inline">
|
|
4
|
+
<el-form-item>
|
|
5
|
+
<el-button type="primary" @click="addRole()">新建角色</el-button>
|
|
6
|
+
</el-form-item>
|
|
7
|
+
</el-form>
|
|
8
|
+
<el-table
|
|
9
|
+
:data="tableData"
|
|
10
|
+
ref="eltablemain"
|
|
11
|
+
border
|
|
12
|
+
row-key="id"
|
|
13
|
+
stripe
|
|
14
|
+
:max-height="elTableMaxHeight"
|
|
15
|
+
style="width: 100%"
|
|
16
|
+
>
|
|
17
|
+
<el-table-column prop="name" label="名称" width="260"> </el-table-column>
|
|
18
|
+
<el-table-column prop="note" label="备注"> </el-table-column>
|
|
19
|
+
<el-table-column label="操作" align="center" width="360" row>
|
|
20
|
+
<template slot-scope="scope">
|
|
21
|
+
<le-button text="编辑" @click="openEditWindow(scope.row)"></le-button>
|
|
22
|
+
<le-button-msg @click="del(scope.row.id)"></le-button-msg>
|
|
23
|
+
<le-button
|
|
24
|
+
text="菜单"
|
|
25
|
+
@click="openMenuWindow(scope.row)"
|
|
26
|
+
style="margin-left: 10px"
|
|
27
|
+
></le-button>
|
|
28
|
+
<le-button
|
|
29
|
+
text="用户列表"
|
|
30
|
+
@click="openUserWindow(scope.row)"
|
|
31
|
+
style="margin-left: 10px"
|
|
32
|
+
></le-button>
|
|
33
|
+
</template>
|
|
34
|
+
</el-table-column>
|
|
35
|
+
</el-table>
|
|
36
|
+
<le-dialog-container
|
|
37
|
+
:showDialog="showMenu"
|
|
38
|
+
width="60%"
|
|
39
|
+
title="功能菜单"
|
|
40
|
+
@close="closeMenuDialog"
|
|
41
|
+
>
|
|
42
|
+
<le-menu @close="closeMenuDialog" :roleInfo="roleInfo"></le-menu>
|
|
43
|
+
</le-dialog-container>
|
|
44
|
+
<le-dialog-container
|
|
45
|
+
title="角色"
|
|
46
|
+
width="60%"
|
|
47
|
+
:showDialog="showEdit"
|
|
48
|
+
@close="closeEditDialog"
|
|
49
|
+
>
|
|
50
|
+
<le-role-sub
|
|
51
|
+
@close="closeEditDialog"
|
|
52
|
+
@rowRefresh="list"
|
|
53
|
+
:rowitem="currentRow"
|
|
54
|
+
></le-role-sub>
|
|
55
|
+
</le-dialog-container>
|
|
56
|
+
<le-dialog-container
|
|
57
|
+
:title="curRoleName"
|
|
58
|
+
:showDialog="showUsers"
|
|
59
|
+
@close="closeUserDialog"
|
|
60
|
+
>
|
|
61
|
+
<el-table
|
|
62
|
+
:data="userlist"
|
|
63
|
+
border
|
|
64
|
+
row-key="id"
|
|
65
|
+
tooltip-effect="dark"
|
|
66
|
+
style="width: 100%"
|
|
67
|
+
>
|
|
68
|
+
<el-table-column prop="account" label="账号" align="center">
|
|
69
|
+
</el-table-column>
|
|
70
|
+
<el-table-column prop="account" label="昵称" align="center">
|
|
71
|
+
</el-table-column>
|
|
72
|
+
</el-table>
|
|
73
|
+
</le-dialog-container>
|
|
74
|
+
</div>
|
|
75
|
+
</template>
|
|
76
|
+
<script>
|
|
77
|
+
import { roleDel, roleList, listUserOfRole } from "@/api/role";
|
|
78
|
+
import LeButton from "leisure-ui/le-button/index";
|
|
79
|
+
import LeButtonMsg from "leisure-ui/le-button-msg/index";
|
|
80
|
+
import LeDialogContainer from "leisure-ui/le-dialog-container/index";
|
|
81
|
+
import LeMenu from "leisure-ui/le-menu/index";
|
|
82
|
+
import leMixins from "leisure-ui/le-libs/mixins/main";
|
|
83
|
+
import LeRoleSub from "./sub.vue";
|
|
84
|
+
export default {
|
|
85
|
+
name: "le-role",
|
|
86
|
+
mixins: [leMixins],
|
|
87
|
+
components: {
|
|
88
|
+
LeButton,
|
|
89
|
+
LeButtonMsg,
|
|
90
|
+
LeDialogContainer,
|
|
91
|
+
LeRoleSub,
|
|
92
|
+
LeMenu,
|
|
93
|
+
},
|
|
94
|
+
data() {
|
|
95
|
+
return {
|
|
96
|
+
tableData: [],
|
|
97
|
+
showUsers: false,
|
|
98
|
+
userlist: [],
|
|
99
|
+
curRoleName: "",
|
|
100
|
+
currentRow: {},
|
|
101
|
+
showEdit: false,
|
|
102
|
+
showMenu: false,
|
|
103
|
+
roleInfo: {},
|
|
104
|
+
};
|
|
105
|
+
},
|
|
106
|
+
mounted() {
|
|
107
|
+
this.list();
|
|
108
|
+
},
|
|
109
|
+
computed: {},
|
|
110
|
+
methods: {
|
|
111
|
+
list() {
|
|
112
|
+
let param = {};
|
|
113
|
+
roleList(param).then((res) => {
|
|
114
|
+
this.tableData = res.data.data;
|
|
115
|
+
});
|
|
116
|
+
},
|
|
117
|
+
del(id) {
|
|
118
|
+
let param = { id: id };
|
|
119
|
+
roleDel(param).then((response) => {
|
|
120
|
+
this.list();
|
|
121
|
+
this.$message.success(response.data.info, this);
|
|
122
|
+
});
|
|
123
|
+
},
|
|
124
|
+
addRole() {
|
|
125
|
+
this.showEdit = true;
|
|
126
|
+
},
|
|
127
|
+
openEditWindow(item) {
|
|
128
|
+
// let routeData = {
|
|
129
|
+
this.currentRow = item;
|
|
130
|
+
this.showEdit = true;
|
|
131
|
+
},
|
|
132
|
+
closeEditDialog() {
|
|
133
|
+
this.showEdit = false;
|
|
134
|
+
this.list();
|
|
135
|
+
},
|
|
136
|
+
openMenuWindow(item) {
|
|
137
|
+
// this.roleInfo = JSON.parse(JSON.stringify(item));
|
|
138
|
+
this.roleInfo.roleId = item.id;
|
|
139
|
+
this.roleInfo.roleName = item.name;
|
|
140
|
+
this.showMenu = true;
|
|
141
|
+
// let routeData = {
|
|
142
|
+
// name: "rolemenu",
|
|
143
|
+
// params: JSON.parse(JSON.stringify(item)),
|
|
144
|
+
// };
|
|
145
|
+
// this.$router.push(routeData);
|
|
146
|
+
},
|
|
147
|
+
closeMenuDialog() {
|
|
148
|
+
this.showMenu = false;
|
|
149
|
+
},
|
|
150
|
+
openUserWindow(item) {
|
|
151
|
+
let param = {};
|
|
152
|
+
param.rid = item.id;
|
|
153
|
+
param.pageNo = 1;
|
|
154
|
+
listUserOfRole(param).then((res) => {
|
|
155
|
+
this.userlist = res.data.data;
|
|
156
|
+
this.curRoleName = item.name;
|
|
157
|
+
this.showUsers = true;
|
|
158
|
+
});
|
|
159
|
+
},
|
|
160
|
+
closeUserDialog() {
|
|
161
|
+
this.showUsers = false;
|
|
162
|
+
},
|
|
163
|
+
},
|
|
164
|
+
};
|
|
165
|
+
</script>
|
|
166
|
+
<style lang="scss" scoped>
|
|
167
|
+
.le-role-container {
|
|
168
|
+
}
|
|
169
|
+
</style>
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<el-form id="form" ref="form" :model="form" :rules="rules" label-width="80px">
|
|
3
|
+
<el-form-item label="名称" prop="name">
|
|
4
|
+
<el-input v-model="form.name"></el-input>
|
|
5
|
+
</el-form-item>
|
|
6
|
+
<el-form-item label="备注" prop="note">
|
|
7
|
+
<el-input v-model="form.note"></el-input>
|
|
8
|
+
</el-form-item>
|
|
9
|
+
<el-form-item>
|
|
10
|
+
<el-button type="primary" @click="onSubmit()">保存</el-button>
|
|
11
|
+
<el-button @click="close()">取消</el-button>
|
|
12
|
+
</el-form-item>
|
|
13
|
+
</el-form>
|
|
14
|
+
</template>
|
|
15
|
+
<script>
|
|
16
|
+
import { roleCreate, roleEdit } from "@/api/role";
|
|
17
|
+
export default {
|
|
18
|
+
name: "le-roles-sub",
|
|
19
|
+
props: {
|
|
20
|
+
rowitem: {},
|
|
21
|
+
},
|
|
22
|
+
data() {
|
|
23
|
+
return {
|
|
24
|
+
form: {
|
|
25
|
+
id: "",
|
|
26
|
+
name: "",
|
|
27
|
+
note: "",
|
|
28
|
+
},
|
|
29
|
+
rules: {
|
|
30
|
+
name: [
|
|
31
|
+
{ required: true, message: "请输入角色名称", trigger: "blur" },
|
|
32
|
+
{
|
|
33
|
+
min: 1,
|
|
34
|
+
max: 30,
|
|
35
|
+
message: "长度在 1 到 30 个字符",
|
|
36
|
+
trigger: "blur",
|
|
37
|
+
},
|
|
38
|
+
],
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
},
|
|
42
|
+
watch: {
|
|
43
|
+
rowitem: {
|
|
44
|
+
handler(newValue) {
|
|
45
|
+
this.form = newValue;
|
|
46
|
+
},
|
|
47
|
+
immediate: true,
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
mounted() {},
|
|
51
|
+
methods: {
|
|
52
|
+
onSubmit() {
|
|
53
|
+
this.$refs["form"].validate((valid) => {
|
|
54
|
+
if (valid) {
|
|
55
|
+
let param = JSON.parse(JSON.stringify(this.form));
|
|
56
|
+
if (param.id && param.id.length > 0) {
|
|
57
|
+
roleEdit(param).then((res) => {
|
|
58
|
+
this.close();
|
|
59
|
+
this.$message.success(res.data.info);
|
|
60
|
+
this.$refs["form"].resetFields();
|
|
61
|
+
});
|
|
62
|
+
} else {
|
|
63
|
+
roleCreate(param).then((response) => {
|
|
64
|
+
this.close();
|
|
65
|
+
this.$message.success(response.data.info);
|
|
66
|
+
this.$refs["form"].resetFields();
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
} else {
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
},
|
|
74
|
+
close() {
|
|
75
|
+
this.$emit("close");
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
</script>
|