element的多级选中_element-ui实现多级checkbox关联选择(权限管理)
示例:
vue-多选择框-3层联动
**适用场景:**开发过程中实现权限分配时,使用多选框进行操作。这样,在用户进行操作时,根据直观,方便,相比使用element-ui的树形组件更加清楚,清楚,所占用的空间也比较小,便于页面布局。
html代码:
<template>
<div class="container">
<h2 class="handle-title">系统管理 > 权限分配</h2>
<!-- 多选择框-->
<div v-for="nData in navData">
<el-checkbox-group v-model="checkedKeys" @change="handleCheckedCitiesChange(1,checkedKeys,nData)">
<!-- 子菜单-->
<el-checkbox
:label="nData.id" :key="nData.id"
><b> H1 {{nData.label}}</b>
</el-checkbox>
</el-checkbox-group>
<div style="padding: 5px 15px;" v-for="nD in nData.children">
<!--菜单栏-->
<el-checkbox-group v-model="checkedKeys" @change="handleCheckedCitiesChange
(2,checkedKeys,navData,nData,nD.id)">
<el-checkbox :label="nD.id" :key="nD.id">H2 {{nD.label}}</el-checkbox>
</el-checkbox-group>
<div style="padding: 5px 15px;">
<el-checkbox-group
v-model="checkedKeys">
<!--路由导航 -->
<el-checkbox
@change="handleCheckedCitiesChange(3,checkedKeys,nData.children,nD.children,nD.id,nData.id,n.id)"
v-for="n in nD.children" :label="n.id" :key="n.id">
<i>H3 {{n.label}}</i>
</el-checkbox>
</el-checkbox-group>
</div>
</div>
</div>
<el-button class="query_btn" type="primary" @click="goSubmit" :disabled="disabled">提交</el-button>
<el-button class="query_btn" type="primary" @click="goBack">取消</el-button>
</div>
</template>
js代码:
<script>
import {getRight} from "../../api/public/api";
import {saveRight} from "../../api/public/api";
const cityOptions = [];
export default {
name: '',
data() {
return {
navData: [], //获取的数据
defaultProps: {
children: 'children',
label: 'label'
},
expandedKeys: [], //默认打开的项
checkedKeys: [], //默认选中的项
submitData: [], //需要提交的数据
roleid: "",//保存用户id
disabled: true,//初始修改状态
// 多选择框
checkAll: false,
checkedCities: [], //默认选中的项
cities: cityOptions,
isIndeterminate: true
}
},
mounted() {
let that = this;
let id = this.$route.query.id;
this.roleid = id;
//根据ID初始化角色权限分配
getRight(id).then((res) => {
let navData = res.data.datalist;
//console.log(navData)
//处理数据格式
let arr = []; //子系统 级的数据
for (let i = 0; i < navData.length; i++) {
if (navData[i].funpid == -1) {
arr.push({
id: navData[i].funid,
label: navData[i].funname,
children: []
})
}
this.expandedKeys.push(navData[i].funid);
if (navData[i].rrid != null) {
console.log(navData[i])
// 选中的数据
this.checkedKeys.push(navData[i].funid)
}
}
for (let j = 0; j < navData.length; j++) {
for (let a = 0; a < arr.length; a++) {
// 判断 功能id==等于菜单id时
if (arr[a].id === navData[j].funpid) {
// 为每一个 子系统添加 菜单
arr[a].children.push({
id: navData[j].funid,
label: navData[j].funname,
children: []
})
}
}
}
for (let b = 0; b < navData.length; b++) {
for (let c = 0; c < arr.length; c++) {
for (let d = 0; d < arr[c].children.length; d++) {
// 为每一个 菜单添加 路由导航
if (arr[c].children[d].id === navData[b].funpid) {
arr[c].children[d].children.push({
id: navData[b].funid,
label: navData[b].funname,
})
}
}
}
}
this.navData = arr;
this.submitData = this.checkedKeys;
/*
console.log("初始化数据", res);
console.log("处理完成的数据", this.navData);
console.log("选中的数据", this.checkedKeys);*/
})
},
methods: {
// 多选择框
handleCheckAllChange(val) {
console.log("val", val);
// this.checkedCities = val ? cityOptions : [];
// this.isIndeterminate = false;
},
// 多选框进行改变时
handleCheckedCitiesChange(type, checkedKeys, data, childrenData, nDid, Did, nid) {
this.submitData = [];//第一步需要提交的数据清空
// 第二步 进行判断是否全选中
console.log("选中的数据", checkedKeys);
console.log("type", type);
if (type === 3) {
this.handleNavigation(checkedKeys, data, childrenData, nDid, Did, nid)
} else if (type === 2) {
this.handleNavigationTwo(checkedKeys, childrenData, nDid)
} else if (type === 1) {
this.handleNavigationOne(checkedKeys, data)
}
this.submitData = this.checkedKeys;
// 按钮是否禁用
this.disabled = checkedKeys.length <= 0;
},
//选中子系统时
handleNavigationOne(checkedKeys, data) {
console.log("选中子系统时 ", checkedKeys, data);
let result = checkedKeys.includes(data.id);
// 如果有选中子系统 则进行全选
if (result) {
console.log("选中子系统时 ", result);
data.children.forEach(d => {
// 存在选择中菜单的数据 不进行添加, 反之 进行添加到选中的数据中
let results = checkedKeys.includes(d.id);
console.log("选中菜单时 ", results);
if (!results) {
this.checkedKeys.push(d.id);
}
// 存在选择中路由导航的数据 不进行添加, 反之 进行添加到选中的数据中
d.children.forEach(da => {
let resultNavigation = checkedKeys.includes(da.id);
if (!resultNavigation) {
this.checkedKeys.push(da.id);
}
});
});
} else {
console.log("取消选中子系统时 ", result);
// 进行数据源的菜单的数据 遍历
for (let i = 0, len = data.children.length; i < len; i++) {
// 存在选择中菜单的数据 进行删除, 反之 不进行操作
for (let j = 0, lens = this.checkedKeys.length; j < lens; j++) {
// 进行是否存在的判断
let results = this.checkedKeys[j] === (data.children[i].id);
console.log("是否存在 ", results);
if (results) {
this.checkedKeys.splice(j, 1)
}
}
}
// 进行数据源的路由的数据 遍历
for (let i = 0, len = data.children.length; i < len; i++) {
for (let k = 0, len = data.children[i].children.length; k < len; k++) {
// 存在选择中路由的数据 进行删除, 反之 不进行操作
for (let j = 0, lens = this.checkedKeys.length; j < lens; j++) {
// 进行是否存在的判断
let results = this.checkedKeys[j] === (data.children[i].children[k].id);
console.log("是否存在 ", results);
if (results) {
this.checkedKeys.splice(j, 1)
}
}
}
}
}
console.log("选中的所有菜单 ", this.checkedKeys);
},
// 选中菜单时
handleNavigationTwo(checkedKeys, childrenData, nDid) {
let result = checkedKeys.includes(nDid);
// 如果有选中菜单 则进行菜单中全选
if (result) {
console.log("选中菜单时 h2", result);
//判断是否存在选中子系统
let results = checkedKeys.includes(childrenData.id);
if (!results) {
// 存在选中子系统不进行添加 反之进行添加
this.checkedKeys.push(childrenData.id);
}
// 存在选择中路由导航的数据 不进行添加, 反之 进行添加到选中的数据中
childrenData.children.forEach(da => {
// 判断是选中的是哪一行
if (da.id === nDid) {
let result = checkedKeys.includes(da.id);
if (result) {
// 存在选择中路由导航的数据 不进行添加, 反之 进行添加到选中的数据中
da.children.forEach(d => {
let resultNavigation = checkedKeys.includes(d.id);
if (!resultNavigation) {
this.checkedKeys.push(d.id);
}
});
}
}
});
} else {
console.log("取消选中菜单时 h2", nDid);
// 第一中情况 在改选中的子系统中选中了多个菜单h2 进行数据源的菜单的数据 遍历
for (let i = 0, len = childrenData.children.length; i < len; i++) {
// 对取消的菜单h2 进行判断其导航h3是否存在在本菜单中 存在才进行遍历
if (childrenData.children[i].id === nDid) {
// 存在选择中导航的数据 进行删除, 反之 不进行操作 nDid
for (let k = 0, len = childrenData.children[i].children.length; k < len; k++) {
for (let j = 0, lens = this.checkedKeys.length; j < lens; j++) {
// 进行是否存在的判断
let results = this.checkedKeys[j] === (childrenData.children[i].children[k].id);
console.log("是否存在 ", results);
if (results) {
this.checkedKeys.splice(j, 1)
}
}
}
}
}
// 对子系统是否选中进行判断
let r = 0;
// 进行数据源的路由的数据 遍历
for (let i = 0, len = childrenData.children.length; i < len; i++) {
console.log("遍历--->", i, childrenData.children[i]);
// 存在选择中路由的数据 进行删除, 反之 不进行操作
for (let j = 0, lens = this.checkedKeys.length; j < lens; j++) {
// 进行是否存在的判断
let results = this.checkedKeys[j] === (childrenData.children[i].id);
console.log("是否存在 ", results);
if (results) {
r++;
}
}
}
console.log("是否存在菜单的数量", r);
// 不存在菜单 删除子系统id
if (r === 0) {
//pop() 方法从数组中删除最后一个元素
// this.checkedKeys.pop();
for (let j = 0, lens = this.checkedKeys.length; j < lens; j++) {
// 进行是否存在的判断
let results = this.checkedKeys[j] === childrenData.id;
console.log("是否存在 ", results);
if (results) {
this.checkedKeys.splice(j, 1)
}
}
}
}
// console.log("checkedKeys", checkedKeys);
// console.log("childrenData", childrenData);
// console.log("nDid", nDid);
console.log("checkedKeys", this.checkedKeys);
},
// 进行处理导航是否选中后 对上一级进行判断
handleNavigation(checkedKeys, data, childrenData, nDid, Did, nid) {
// checkedKeys 选中的数据, data 为菜单数据 , childrenData 导航数据
// 提交的数据 进行比对数
/* console.log("导航数据长度", childrenData.length);
console.log("checkedKeys", checkedKeys);
console.log("data", data);
console.log("childrenData", childrenData);
console.log("nDid", nDid);
console.log("Did", Did);
console.log("nid", nid);*/
let re = checkedKeys.includes(nid);
if (re) {
console.log("确认按钮");
// 判断一个数组是否包含一个指定的值,如果存在返回 true,否则返回false。
let result = checkedKeys.includes(nDid);
let results = checkedKeys.includes(Did);
// console.log("提交的数据是否包含上级菜单", result);
// 提交的数据没有包含上级菜单 进行添加
// 菜单id
if (!result) {
this.checkedKeys.push(nDid);
}
// 子系统 id
if (!results) {
this.checkedKeys.push(Did);
}
} else {
console.log("childrenData", childrenData);
console.log("取消按钮");
//---------判断 根据路由的计数 判断是否进行删除上一级菜单 开始------------
let number = 0;
for (let i = 0, len = childrenData.length; i < len; i++) {
// 进行统一路径下的路由 是否存在的判断
let results = this.checkedKeys.includes(childrenData[i].id);
console.log("是否存在", results);
if (results) {
number++;
}
}
//统一路径下的路由的计数为0时 则进行删除上一级菜单
if (number === 0) {
for (let j = 0, lens = this.checkedKeys.length; j < lens; j++) {
// 进行是否存在的判断
let results = this.checkedKeys[j] === nDid;
console.log("是否存在 ", results);
if (results) {
this.checkedKeys.splice(j, 1)
}
}
}
// console.log("number", number);
//-------------- 判断 根据路由的计数 判断是否进行删除上一级菜单 结束-----------
//---------判断 根据菜单的计数 判断是否进行删除上一级子系统 开始-------
// / 进行数据源的路由的数据 遍历
console.log("data ", data);
let numbers = 0;
for (let i = 0, len = data.length; i < len; i++) {
console.log("遍历--->", i, data[i]);
// 存在选择中路由的数据 进行删除, 反之 不进行操作
for (let j = 0, lens = this.checkedKeys.length; j < lens; j++) {
// 进行是否存在的判断
let results = this.checkedKeys[j] === (data[i].id);
console.log("是否存在 ", results);
if (results) {
numbers++;
}
}
}
//统一路径下的路由的计数为0时 则进行删除上一级子系统
if (numbers === 0) {
for (let j = 0, lens = this.checkedKeys.length; j < lens; j++) {
// 进行是否存在的判断
let results = this.checkedKeys[j] === Did;
console.log("是否存在 ", results);
if (results) {
this.checkedKeys.splice(j, 1)
}
}
}
//---------判断 根据菜单的计数 判断是否进行删除上一级子系统 结束-------
// console.log("number", number);
}
console.log("checkedKeys", checkedKeys);
console.log("this.checkedKeys", this.checkedKeys);
},
//返回上一级
goBack() {
this.$router.go(-1);
},
//数据提交
goSubmit() {
//console.log("提交")
let that = this;
//构建提交数据
let params = {
roleid: this.roleid,
funids: this.submitData.join()
};
console.log(params);
//调用提交接口
saveRight(params).then((res) => {
//console.log(res.data.code)
if (res.data.code == 1) {
that.$message({
message: "保存成功",
type: "success",
});
that.$router.push("/role")
} else {
this.$message({
message: "保存失败",
type: "info"
});
}
})
}
},
}
</script>
css代码:
<style scoped>
.query_btn {
margin-top: 20px;
}
</style>
数据源:
"datalist": [
{
"funid": 1,
"funname": "系统管理子系统",
"funtype": 0,
"funurl": null,
"fundesc": null,
"funpid": -1,
"funsort": null,
"funicon": null,
"funstate": null,
"funneedlogin": null,
"rrid": null
},
{
"funid": 2,
"funname": "系统管理",
"funtype": 1,
"funurl": null,
"fundesc": null,
"funpid": 1,
"funsort": null,
"funicon": null,
"funstate": null,
"funneedlogin": null,
"rrid": null
},
{
"funid": 3,
"funname": "角色管理",
"funtype": 2,
"funurl": null,
"fundesc": null,
"funpid": 2,
"funsort": null,
"funicon": null,
"funstate": null,
"funneedlogin": null,
"rrid": null
},
{
"funid": 4,
"funname": "用户管理",
"funtype": 2,
"funurl": null,
"fundesc": null,
"funpid": 2,
"funsort": null,
"funicon": null,
"funstate": null,
"funneedlogin": null,
"rrid": null
},
{
"funid": 10,
"funname": "课程管理子系统",
"funtype": 0,
"funurl": null,
"fundesc": null,
"funpid": -1,
"funsort": null,
"funicon": null,
"funstate": null,
"funneedlogin": null,
"rrid": null
},
{
"funid": 11,
"funname": "课程类型管理",
"funtype": 2,
"funurl": null,
"fundesc": null,
"funpid": 12,
"funsort": null,
"funicon": null,
"funstate": null,
"funneedlogin": null,
"rrid": null
},
{
"funid": 12,
"funname": "课程管理",
"funtype": 1,
"funurl": null,
"fundesc": null,
"funpid": 10,
"funsort": null,
"funicon": null,
"funstate": null,
"funneedlogin": null,
"rrid": null
},
{
"funid": 48,
"funname": "课程管理(教师)",
"funtype": 2,
"funurl": null,
"fundesc": null,
"funpid": 12,
"funsort": null,
"funicon": null,
"funstate": null,
"funneedlogin": null,
"rrid": null
},
{
"funid": 55,
"funname": "功能管理",
"funtype": 2,
"funurl": null,
"fundesc": null,
"funpid": 2,
"funsort": null,
"funicon": null,
"funstate": null,
"funneedlogin": null,
"rrid": null
},
{
"funid": 67,
"funname": "机构管理",
"funtype": 1,
"funurl": null,
"fundesc": null,
"funpid": 1,
"funsort": null,
"funicon": null,
"funstate": null,
"funneedlogin": null,
"rrid": null
},
{
"funid": 68,
"funname": "我的机构管理",
"funtype": 2,
"funurl": null,
"fundesc": null,
"funpid": 67,
"funsort": null,
"funicon": null,
"funstate": null,
"funneedlogin": null,
"rrid": null
},
{
"funid": 69,
"funname": "机构教师管理",
"funtype": 2,
"funurl": null,
"fundesc": null,
"funpid": 67,
"funsort": null,
"funicon": null,
"funstate": null,
"funneedlogin": null,
"rrid": null
},
{
"funid": 70,
"funname": "课程管理(机构)",
"funtype": 2,
"funurl": null,
"fundesc": null,
"funpid": 12,
"funsort": null,
"funicon": null,
"funstate": null,
"funneedlogin": null,
"rrid": null
},
{
"funid": 71,
"funname": "课程管理(系统)",
"funtype": 2,
"funurl": null,
"fundesc": null,
"funpid": 12,
"funsort": null,
"funicon": null,
"funstate": null,
"funneedlogin": null,
"rrid": null
},
{
"funid": 72,
"funname": "banner管理",
"funtype": 2,
"funurl": null,
"fundesc": null,
"funpid": 2,
"funsort": null,
"funicon": null,
"funstate": null,
"funneedlogin": null,
"rrid": null
},
{
"funid": 88,
"funname": "课程审核",
"funtype": 2,
"funurl": null,
"fundesc": null,
"funpid": 71,
"funsort": null,
"funicon": null,
"funstate": null,
"funneedlogin": null,
"rrid": null
},
{
"funid": 108,
"funname": "运营管理子系统",
"funtype": 0,
"funurl": null,
"fundesc": null,
"funpid": -1,
"funsort": null,
"funicon": null,
"funstate": null,
"funneedlogin": null,
"rrid": null
},
{
"funid": 111,
"funname": "订单管理",
"funtype": 1,
"funurl": null,
"fundesc": null,
"funpid": 108,
"funsort": null,
"funicon": null,
"funstate": null,
"funneedlogin": null,
"rrid": null
},
{
"funid": 112,
"funname": "订单管理",
"funtype": 2,
"funurl": null,
"fundesc": null,
"funpid": 111,
"funsort": null,
"funicon": null,
"funstate": null,
"funneedlogin": null,
"rrid": null
},
{
"funid": 113,
"funname": "课程评论",
"funtype": 2,
"funurl": null,
"fundesc": null,
"funpid": 12,
"funsort": null,
"funicon": null,
"funstate": null,
"funneedlogin": null,
"rrid": null
},
{
"funid": 114,
"funname": "优惠劵管理",
"funtype": 1,
"funurl": null,
"fundesc": null,
"funpid": 108,
"funsort": null,
"funicon": null,
"funstate": null,
"funneedlogin": null,
"rrid": null
},
{
"funid": 115,
"funname": "优惠劵",
"funtype": 2,
"funurl": null,
"fundesc": null,
"funpid": 114,
"funsort": null,
"funicon": null,
"funstate": null,
"funneedlogin": null,
"rrid": null
},
{
"funid": 117,
"funname": "课程包管理",
"funtype": 2,
"funurl": null,
"fundesc": null,
"funpid": 114,
"funsort": null,
"funicon": null,
"funstate": null,
"funneedlogin": null,
"rrid": null
},
{
"funid": 118,
"funname": "活动管理",
"funtype": 2,
"funurl": null,
"fundesc": null,
"funpid": 114,
"funsort": null,
"funicon": null,
"funstate": null,
"funneedlogin": null,
"rrid": null
},
{
"funid": 119,
"funname": "销售团队管理",
"funtype": 1,
"funurl": null,
"fundesc": null,
"funpid": 1,
"funsort": null,
"funicon": null,
"funstate": null,
"funneedlogin": null,
"rrid": null
},
{
"funid": 120,
"funname": "销售团队",
"funtype": 2,
"funurl": null,
"fundesc": null,
"funpid": 119,
"funsort": null,
"funicon": null,
"funstate": null,
"funneedlogin": null,
"rrid": null
},
{
"funid": 121,
"funname": "销售人员",
"funtype": 2,
"funurl": null,
"fundesc": null,
"funpid": 119,
"funsort": null,
"funicon": null,
"funstate": null,
"funneedlogin": null,
"rrid": null
},
{
"funid": 122,
"funname": "优惠劵使用日志",
"funtype": 2,
"funurl": null,
"fundesc": null,
"funpid": 114,
"funsort": null,
"funicon": null,
"funstate": null,
"funneedlogin": null,
"rrid": null
},
{
"funid": 123,
"funname": "优惠劵领取日志",
"funtype": 2,
"funurl": null,
"fundesc": null,
"funpid": 114,
"funsort": null,
"funicon": null,
"funstate": null,
"funneedlogin": null,
"rrid": null
},
{
"funid": 124,
"funname": "活动参与日志",
"funtype": 2,
"funurl": null,
"fundesc": null,
"funpid": 114,
"funsort": null,
"funicon": null,
"funstate": null,
"funneedlogin": null,
"rrid": null
},
{
"funid": 126,
"funname": "学习记录",
"funtype": 1,
"funurl": null,
"fundesc": null,
"funpid": 10,
"funsort": null,
"funicon": null,
"funstate": null,
"funneedlogin": null,
"rrid": null
},
{
"funid": 127,
"funname": "直播记录",
"funtype": 2,
"funurl": null,
"fundesc": null,
"funpid": 126,
"funsort": null,
"funicon": null,
"funstate": null,
"funneedlogin": null,
"rrid": null
},
{
"funid": 128,
"funname": "机构列表",
"funtype": 2,
"funurl": null,
"fundesc": null,
"funpid": 2,
"funsort": null,
"funicon": null,
"funstate": null,
"funneedlogin": null,
"rrid": null
},
{
"funid": 129,
"funname": "教师管理",
"funtype": 2,
"funurl": null,
"fundesc": null,
"funpid": 2,
"funsort": null,
"funicon": null,
"funstate": null,
"funneedlogin": null,
"rrid": null
},
{
"funid": 130,
"funname": "菜单管理",
"funtype": 2,
"funurl": null,
"fundesc": null,
"funpid": 2,
"funsort": null,
"funicon": null,
"funstate": null,
"funneedlogin": null,
"rrid": null
},
{
"funid": 131,
"funname": "接口管理",
"funtype": 2,
"funurl": null,
"fundesc": null,
"funpid": 2,
"funsort": null,
"funicon": null,
"funstate": null,
"funneedlogin": null,
"rrid": null
},
{
"funid": 139,
"funname": "咨询管理",
"funtype": 1,
"funurl": null,
"fundesc": null,
"funpid": 108,
"funsort": null,
"funicon": null,
"funstate": null,
"funneedlogin": null,
"rrid": null
},
{
"funid": 140,
"funname": "咨询记录",
"funtype": 2,
"funurl": null,
"fundesc": null,
"funpid": 139,
"funsort": null,
"funicon": null,
"funstate": null,
"funneedlogin": null,
"rrid": null
},
{
"funid": 141,
"funname": "课程咨询",
"funtype": 2,
"funurl": null,
"fundesc": null,
"funpid": 67,
"funsort": null,
"funicon": null,
"funstate": null,
"funneedlogin": null,
"rrid": null
},
{
"funid": 142,
"funname": "课程咨询统计",
"funtype": 2,
"funurl": null,
"fundesc": null,
"funpid": 139,
"funsort": null,
"funicon": null,
"funstate": null,
"funneedlogin": null,
"rrid": null
},
{
"funid": 143,
"funname": "机构咨询统计",
"funtype": 2,
"funurl": null,
"fundesc": null,
"funpid": 139,
"funsort": null,
"funicon": null,
"funstate": null,
"funneedlogin": null,
"rrid": null
}
]
为了大家方便, 我把数据库也放在这里!
/*
SQLyog Community v13.1.6 (64 bit)
MySQL - 5.7.34 : Database - etimeshy
*********************************************************************
*/
/*!40101 SET NAMES utf8 */;
/*!40101 SET SQL_MODE=''*/;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
CREATE DATABASE /*!32312 IF NOT EXISTS*/`etimeshy` /*!40100 DEFAULT CHARACTER SET utf8 */;
USE `etimeshy`;
/*Table structure for table `sysfunction` */
DROP TABLE IF EXISTS `sysfunction`;
CREATE TABLE `sysfunction` (
`funid` int(11) NOT NULL AUTO_INCREMENT,
`funname` varchar(30) DEFAULT NULL,
`funtype` int(11) DEFAULT NULL COMMENT '0-子系统\r\n 1--目录\r\n 2--菜单(链接)\r\n 3--数据接口',
`funurl` varchar(200) DEFAULT NULL,
`fundesc` varchar(500) DEFAULT NULL,
`funpid` int(11) DEFAULT NULL,
`funsort` int(11) DEFAULT NULL,
`funicon` varchar(200) DEFAULT NULL,
`funstate` int(11) DEFAULT NULL,
`funneedlogin` int(11) DEFAULT '1',
PRIMARY KEY (`funid`)
) ENGINE=InnoDB AUTO_INCREMENT=144 DEFAULT CHARSET=utf8;
/*Data for the table `sysfunction` */
insert into `sysfunction`(`funid`,`funname`,`funtype`,`funurl`,`fundesc`,`funpid`,`funsort`,`funicon`,`funstate`,`funneedlogin`) values
(1,'系统管理子系统',0,'/home',NULL,-1,1,NULL,1,1),
(2,'系统管理',1,'null',NULL,1,1,'el-icon-s-grid',1,1),
(3,'角色管理',2,'/role',NULL,2,1,'el-icon-user',1,1),
(4,'用户管理',2,'/user','null',2,2,'el-icon-s-custom',1,1),
(5,'增加角色',3,'/shy-auth/sys/role/insert','角色实体,不用传递roleid',3,1,'null',1,1),
(6,'修改角色',3,'/shy-auth/sys/role/update','必须传递roleid',3,1,'null',1,1),
(7,'查询角色列表',3,'/shy-auth/sys/role/list','可接收参数:rolename,rolestate',3,1,'null',1,1),
(8,'根据id查询角色',3,'/shy-auth/sys/role/get','角色id',3,1,'null',1,1),
(9,'分页查询角色',3,'/shy-auth/sys/role/page','查询条件,可接收参数:rolename,rolestate',3,1,'null',1,1),
(10,'课程管理子系统',0,'/course','null',-1,2,'null',1,1),
(11,'课程类型管理',2,'/courseType','null',12,1,'el-icon-document-copy',1,1),
(12,'课程管理',1,'','',10,1,'el-icon-school',1,1),
(13,'添加课程大类型',3,'/shy-course/sys/courseType/insert/one','添加课程大类时 可不传 courseptypeid 默认-1',11,1,'null',1,1),
(14,'查询课程类型列表',3,'/shy-course/sys/courseType/list','查询所有课程类型',11,1,'null',1,1),
(15,'根据id查询',3,'/shy-course/sys/courseType/get','根据课程id,查询课程一条类型',11,1,'null',1,1),
(33,'增加用户',3,'/shy-auth/sys/user/insert','1、从后台添加的用户,只需要添加用户的用户名(username),密码(userpwd),用户姓名(usertruename);联系电话(userphone)\n2、从小程序注册,需要添加属性:nickname,openid,unionid,code,从属销售人员id:saleuserid',4,1,'',1,1),
(34,'功能管理',1,'','管理功能',1,1,'el-icon-platform-eleme',0,1),
(35,'修改用户',3,'/shy-auth/sys/user/update','更新条件:userid;调用方法时,只需要给需要更新的属性进行赋值。',4,2,'el-icon-user-solid',1,1),
(36,'查询用户列表(分页)',3,'/shy-auth/sys/user/page','支持查询条件:用户名:username,用户状态:userstate(0:不可用;1:可用),电话:userphone,是否教师:isteacher(0:否;1:是),是否销售:issaler(0:否;1:是)',4,1,'el-icon-info',1,1),
(37,'判断用户名是否存在',3,'/shy-auth/sys/user/check','判断用户名是否存在',34,5,'啊实打实',1,0),
(43,'登录',3,'/shy-auth/login/byuser','asddas',34,1,'asdas',1,0),
(47,'功能管理',2,'/fun','undefined',34,1,'el-icon-s-tools',0,1),
(48,'课程管理(教师)',2,'/tecCourseMag','undefined',12,2,'el-icon-document-copy',1,1),
(55,'功能管理',2,'/fun','功能管理',2,1,'el-icon-s-tools',1,1),
(56,'根据id查询',3,'/shy-auth/sys/fun/get','系统功能id,必须为int类型数据',55,1,'undefined',1,1),
(57,'增加系统功能',3,'/shy-auth/sys/fun/insert','funid自增长;子系统的funpid=-1;',55,1,'undefined',1,1),
(58,'根据条件查询',3,'/shy-auth/sys/fun/list','可用条件:funtype(功能类型);funstate(功能状态);funpid(父功能id)以上条件为null或者=-1则不使用此条件;funpid=0不使用此条件',55,1,'undefined',1,1),
(59,'根据id修改',3,'/shy-auth/sys/fun/update','需要所有属性进行赋值,未赋值的属性将被修改为null',55,1,'undefined',1,1),
(60,'验证用户名',3,'/shy-auth/sys/user/check/','code=0:不存在;code=1:存在',4,1,'undefined',1,1),
(61,'根据id查询',3,'/shy-auth/sys/user/get/','无',4,1,'undefined',1,1),
(62,'根据用户id获取具有的角色列表',3,'/shy-auth/sys/user/getrole/','全部角色都查询出来,本功能主要用于用户角色分配的页面初始化',4,1,'undefined',1,1),
(63,'用户角色分配',3,'/shy-auth/sys/user/saverole/','用户所具有的角色id列表(数组)',4,1,'undefined',1,1),
(64,'角色权限分配(初始化)',3,'/shy-auth/sys/right/get/','初始化角色权限分配的数据接口',3,1,'undefined',1,1),
(65,'角色权限分配(保存)',3,'/shy-auth/sys/right/save/','角色所能使用的功能id数组',3,1,'undefined',1,1),
(67,'机构管理',1,'undefined','undefined',1,1,'el-icon-s-platform',1,1),
(68,'我的机构管理',2,'/org','undefined',67,1,'el-icon-s-ticket',1,1),
(69,'机构教师管理',2,'/teacher','教师管理',67,1,'el-icon-s-custom',1,1),
(70,'课程管理(机构)',2,'/courOrgMagList','undefined',12,3,'el-icon-coordinate',1,1),
(71,'课程管理(系统)',2,'/courAuditList','undefined',12,1,'el-icon-coordinate',1,1),
(72,'banner管理',2,'/banner','轮播图',2,1,'el-icon-picture-outline',1,1),
(73,'修改机构',3,'/shy-course/sys/org/update','机构负责人根据机构id对机构详细信息进行修改,机构实体',68,1,'el-icon-plus',1,1),
(74,'根据id查找机构',3,'/shy-course/shy-course/sys/org/get','根据机构负责人(用户id)查询一条机构详细信息',68,1,'undefined',1,1),
(75,'添加机构教师',3,'/shy-course/sys/org/teacher/insert','添加机构教师: 1、sysusr实体中 用户名 username, 姓名 usertruename,密码 userpwd,专业 usermajor,联系电话 userphone,Email useremail,照片 showpic,默认:用户状态=1;是否教师=1;是否销售人员=0;\nTeacher实体中:教师 Title,tecdesc 教师简介 ,tecorgid 教师所属机构=登录用户所属机构 ,技术标签 teclabel, userid 用户id,',69,1,'undefined',1,1),
(77,'查询机构教师分页',3,'/shy-course/sys/org/teacher/page','1、机构教师分页查询列表 2、可使用用户名查找(username)',69,1,'undefined',1,1),
(78,'根据机构id查询同机构的所有的教师',3,'/shy-course/sys/org/teacher/list','根据机构id (tecOrgId)询本机构所有在职老师',69,1,'undefined',1,1),
(79,'教师离职',3,'/shy-course/sys/org/teacher/delete','删除教师本质是:根据教师id(tecid),修改教师表->教师所属机构id=-2,变更为独立教师身份。',69,1,'undefined',1,1),
(80,'根据课程id修改教师的课程',3,'/shy-course/sys/org/teacher/up','教师离职管理可用 修改课表中的:课程教师id和课程教师姓名两个字段',69,1,'undefined',1,1),
(81,'根据id查询',3,'/shy-course/sys/org/teacher/upGet/','根据特trcid查询一条 用户详细信息',69,1,'undefined',1,1),
(82,'修改教师',3,'/shy-course/sys/org/teacher/updateOrgUsTe','根据用户id和教师id 更新用户、教师信息',69,1,'undefined',1,1),
(83,'删除banner',3,'/shy-course/sys/banner/delete/','根据bannerid删除banner成功',72,1,'undefined',1,1),
(84,'增加、修改 banner',3,'/shy-course/sys/banner/insert','1、增加banner 2、修改 Sysbanner必须传 bannerid',72,1,'undefined',1,1),
(85,'banner查询列表(分页)',3,'/shy-course/sys/banner/page','banner分页查询列表 可使bannerId查找',72,1,'undefined',1,1),
(86,'增加、修改课程类型',3,'/shy-course/sys/courseType/insert/two','1、修改课程类型父类、子类时 必传:coursetypeid ,2、添加子类时(父类型名称=类型名称;父类型id=类型id)',11,1,'undefined',1,1),
(87,'增加课程',3,'/shy-course/sys/course/insert','创建课程,根据课程实体类传值',48,1,'undefined',1,1),
(88,'课程审核',2,'/shy-course/sys/course/update/Review','课程审核-系统管理员(修改课程发布)',71,1,'undefined',1,1),
(89,'修改课程信息',3,'/shy-course/sys/course/update','完善课程信息,传入实体类(必传课程id)',70,1,'undefined',1,1),
(90,'课程列表(分页)',3,'/shy-course/sys/course/page','课程分页查询列表',48,1,'undefined',1,1),
(91,'查询教师的课程',3,'/shy-course/sys/course/list/','根据教师teacherId,查询离职拥有的课程列表信息 教师离职管理可以用',69,1,'undefined',1,1),
(92,'查询课程+课程类',3,'/shy-course/sys/course/gets/','根据课程id(courseid) 查询一条课程+课程类型数据(详细)',71,1,'undefined',1,1),
(93,'根据课程id查询',3,'/shy-course/sys/course/get/','根据 课程id(courseid)查询出一条数据',48,1,'undefined',1,1),
(94,'章节管理',2,'undefined','undefined',12,1,'undefined',0,1),
(95,'增加课程章',3,'/shy-course/sys/chapter/insert/one','增加一个章',94,1,'undefined',1,1),
(96,'增加、修改课程节功能',3,'/shy-course/sys/chapter/insert/two','增加、修改课程节功能, \n1、创建一个节;2、修改章、节时,必传值:chapterid;3、lessons[0].*都不传',94,1,'undefined',1,1),
(97,'查询课程的章节',3,'/shy-course/sys/chapter/list/','根据课程id查询课程所有的章节(courseid)',94,1,'undefined',1,1),
(98,'课时管理',2,'undefined','课时管理数据',12,1,'undefined',0,1),
(99,'根据id查询课时',3,'/shy-course/sys/lesson/get/','根据课时id查询课时-查询一条文本+视频,课时预览(文本、视频)-数据接口',98,1,'undefined',1,1),
(100,'根据课程id查询章节、课时',3,'/shy-course/sys/lesson/gets/','根据课程id查询 章节和课时的详细信息',98,1,'undefined',1,1),
(101,'根据课程id 查询课时文本+视频',3,'/shy-course/sys/lesson/list/','根据课程id 查询所有其课程中所的课时(List) 文本+视频',98,1,'undefined',1,1),
(102,'增加课时-文本',3,'/shy-course/sys/lesson/insert','增加课时功能 -文本',98,1,'undefined',1,1),
(103,'增加课时 -视频',3,'/shy-course/sys/lesson/inserts','增加课时功能 -视频',98,1,'undefined',1,1),
(104,'修改、添加课时',3,'/shy-course/sys/lesson/MediaBank/updateOrInsert','插入 完善(修改)多媒体文件信息:1、修改 必传值 mediaid其他的字段,根据前端的需要传值; 2、没有传入mediaid 便插入一填数据 返回其id',98,1,'undefined',1,1),
(105,'修改课时-文本',3,'/shy-course/sys/lesson/update','完善(修改)课时信息接口 -文本 (必传值 课时的id)其他的字段,根据前端的需要传值',98,1,'undefined',1,1),
(106,'修改课时文本+多媒体信息1',3,'/shy-course/sys/lesson/updates','完善(修改)课时信息接口 -修改课时文本信息+多媒体文件信息 (必传值 课时的id)其他的字段,根据前端的需要传值',98,1,'undefined',1,1),
(108,'运营管理子系统',0,'/order','订单',-1,1,'el-icon-document-checked',1,1),
(111,'订单管理',1,'/orderHome','订单管理',108,1,'el-icon-tickets',1,1),
(112,'订单管理',2,'/orderHome','订单管理',111,1,'el-icon-user',1,1),
(113,'课程评论',2,'/commentList','undefined',12,1,'el-icon-s-help',1,1),
(114,'优惠劵管理',1,'/couponManage','优惠劵管理',108,1,'el-icon-s-shop',1,1),
(115,'优惠劵',2,'/couponManage','优惠劵',114,1,'el-icon-s-claim',1,1),
(117,'课程包管理',2,'/coursepackage','undefined',114,1,'el-icon-receiving',1,1),
(118,'活动管理',2,'/activityAll','undefined',114,1,'el-icon-collection-tag',1,1),
(119,'销售团队管理',1,'/department','undefined',1,1,'el-icon-news',1,1),
(120,'销售团队',2,'/department','undefined',119,1,'el-icon-connection',1,1),
(121,'销售人员',2,'/SalerAll','undefined',119,1,'el-icon-trophy-1',1,1),
(122,'优惠劵使用日志',2,'/couponlog','undefined',114,1,'el-icon-document-copy',1,1),
(123,'优惠劵领取日志',2,'/couponrecivelog','undefined',114,1,'el-icon-document-checked',1,1),
(124,'活动参与日志',2,'/activeLog','相关-测试-活动参与日志',114,1,'el-icon-files',1,1),
(126,'学习记录',1,'undefined','undefined',10,1,'el-icon-data-board',1,1),
(127,'直播记录',2,'/liveRecord','undefined',126,1,'el-icon-service',1,1),
(128,'机构列表',2,'/orgPage','undefined',2,1,'el-icon-menu',1,1),
(129,'教师管理',2,'/teacherList','undefined',2,1,'el-icon-thumb',1,1),
(130,'菜单管理',2,'/funMenu','undefined',2,1,'el-icon-s-promotion',1,1),
(131,'接口管理',2,'/funInterface','用于系统的接口管理',2,1,'el-icon-set-up',1,1),
(132,'测试1',3,'测试','测试',111,1,'',1,1),
(133,'测试2',3,'测试','测试',111,1,'',1,1),
(135,'测试2-1',3,'测试2','测试2',114,1,NULL,1,1),
(136,'测试2-2',3,'测试2-2','测试2-2',114,1,NULL,1,1),
(137,'测试2-3',3,'测试2-3','测试2-3',114,1,NULL,1,1),
(138,'测试2-4-',3,'测试2-4-','测试2-4',114,1,'null',1,2),
(139,'咨询管理',1,'undefined','咨询管理',108,1,'el-icon-phone',1,1),
(140,'咨询记录',2,'/courseAdviceLog','课程咨询记录',139,1,'el-icon-s-opportunity',1,1),
(141,'课程咨询',2,'/organiztionCourseAdviceLog','课程咨询',67,1,'el-icon-phone-outline',1,1),
(142,'课程咨询统计',2,'/CourseAdviceCountLog','咨询统计',139,1,'el-icon-s-marketing',1,1),
(143,'机构咨询统计',2,'/organiztionCourseAdviceLogCount','机构咨询统计',139,1,'el-icon-s-data',1,1);
/*Table structure for table `sysroleright` */
DROP TABLE IF EXISTS `sysroleright`;
CREATE TABLE `sysroleright` (
`rrid` int(11) NOT NULL AUTO_INCREMENT,
`funid` int(11) DEFAULT NULL,
`roleid` int(11) DEFAULT NULL,
PRIMARY KEY (`rrid`),
KEY `FK_Relationship_4` (`roleid`),
KEY `FK_Relationship_5` (`funid`),
CONSTRAINT `FK_Relationship_4` FOREIGN KEY (`roleid`) REFERENCES `sysrole` (`roleid`),
CONSTRAINT `FK_Relationship_5` FOREIGN KEY (`funid`) REFERENCES `sysfunction` (`funid`)
) ENGINE=InnoDB AUTO_INCREMENT=1339 DEFAULT CHARSET=utf8;
/*Data for the table `sysroleright` */
insert into `sysroleright`(`rrid`,`funid`,`roleid`) values
(1267,11,27),
(1268,13,27),
(1269,14,27),
(1270,15,27),
(1271,86,27),
(1272,48,27),
(1273,87,27),
(1289,10,27),
(1290,12,27),
(1336,108,28),
(1337,111,28),
(1338,112,28);