Commit dab733d3 authored by chenyishuai@singsingenglish.com's avatar chenyishuai@singsingenglish.com

Merge branch 'dev' of http://git.singsingenglish.com/new-sing/admin into dev

parents 3fb4993c a57e31b9
<template> <template>
<div id="app"> <div id="app">
<router-view /> <router-view/>
</div> </div>
</template> </template>
<script> <script>
import menu from "./util/menuList"; import menu from "./util/menuList";
export default {
name: "App", export default {
data() { name: "App",
return {}; data() {
}, return {};
mounted() { },
// 权限验证 动态路由 mounted() {
if (window.location.href.indexOf("login") < 0) { // 权限验证 动态路由
let permission = this.$store.state.progressList; if (window.location.href.indexOf("login") < 0) {
console.log(this.$store.state); let permission = this.$store.state.progressList;
let menuList = []; console.log(this.$store.state);
this.$router.options.routes[0].children = []; let menuList = [];
let routerUserDetail = { this.$router.options.routes[0].children = [];
path: "/userDetail/:id", let routerUserDetail = {
name: "userDetail", path: "/userDetail/:id",
component: e => require(["@/components/userDetail"], e) name: "userDetail",
}; component: e => require(["@/components/userDetail"], e)
let routerTeacherDetail = { };
path: "/teacher/:id", let routerTeacherDetail = {
name: "teacherDetail", path: "/teacher/:id",
component: e => require(["@/components/teacherDetail"], e) name: "teacherDetail",
}; component: e => require(["@/components/teacherDetail"], e)
menu.forEach(i => { };
let p = false; menu.forEach(i => {
let t = []; let p = false;
i.list.forEach(j => { let t = [];
let find = permission.find(x => { i.list.forEach(j => {
return x.cover === j.cover; let find = permission.find(x => {
}); return x.cover === j.cover;
if (find) { });
j.router.meta = {}; if (find) {
j.router.meta.readonly = !!find.readonly; j.router.meta = {};
j.router.meta.delete = !!find.delete; j.router.meta.readonly = !!find.readonly;
j.router.meta.export = !!find.export; j.router.meta.delete = !!find.delete;
j.router.meta.refund = !!find.refund; j.router.meta.export = !!find.export;
j.router.meta.distribution = !!find.distribution; j.router.meta.refund = !!find.refund;
j.router.meta.classManage = !!find.classManage; j.router.meta.distribution = !!find.distribution;
j.router.meta.classManageUnlimited = !!find.classManageUnlimited; j.router.meta.classManage = !!find.classManage;
j.router.meta.classTakeUnlimited = !!find.classTakeUnlimited; j.router.meta.classManageUnlimited = !!find.classManageUnlimited;
j.router.meta.promoter = !!find.promoter; j.router.meta.classTakeUnlimited = !!find.classTakeUnlimited;
j.router.meta.import = !!find.import; j.router.meta.exportFinish = !!find.exportFinish;
t.push(j); j.router.meta.promoter = !!find.promoter;
if (find.cover === "3-1") { j.router.meta.import = !!find.import;
routerTeacherDetail.meta = {}; t.push(j);
routerTeacherDetail.meta.readonly = find.readonly; if (find.cover === "3-1") {
routerTeacherDetail.meta.delete = !!find.delete; routerTeacherDetail.meta = {};
this.$router.options.routes[0].children.push(routerTeacherDetail); routerTeacherDetail.meta.readonly = find.readonly;
} routerTeacherDetail.meta.delete = !!find.delete;
if (find.cover === "3-2") { this.$router.options.routes[0].children.push(routerTeacherDetail);
routerUserDetail.meta = {}; }
routerUserDetail.meta.readonly = find.readonly; if (find.cover === "3-2") {
routerUserDetail.meta.delete = !!find.delete; routerUserDetail.meta = {};
this.$router.options.routes[0].children.push(routerUserDetail); routerUserDetail.meta.readonly = find.readonly;
routerUserDetail.meta.delete = !!find.delete;
this.$router.options.routes[0].children.push(routerUserDetail);
}
this.$router.options.routes[0].children.push(j.router);
p = true;
} }
this.$router.options.routes[0].children.push(j.router); });
p = true; if (p) {
i.list = t;
menuList.push(i);
} }
}); });
if (p) { this.$router.addRoutes([this.$router.options.routes[0]]); //调用add;
i.list = t; this.$store.dispatch("setMenu", menuList);
menuList.push(i); }
}
});
this.$router.addRoutes([this.$router.options.routes[0]]); //调用add;
this.$store.dispatch("setMenu", menuList);
} }
} };
};
</script> </script>
<style lang="less"> <style lang="less">
#app { #app {
height: 100%; height: 100%;
} }
html, body { html, body {
height: 100%; height: 100%;
margin: 0; margin: 0;
padding: 0; padding: 0;
} }
.el-collapse-item__arrow { .el-collapse-item__arrow {
margin-left: 0; margin-left: 0;
} }
.fl { .fl {
float: left; float: left;
} }
.fr { .fr {
float: right; float: right;
} }
.clearfix { .clearfix {
*zoom: 1; *zoom: 1;
} }
.clearfix:after { .clearfix:after {
content: ""; content: "";
display: block; display: block;
height: 0; height: 0;
visibility: hidden; visibility: hidden;
clear: both; clear: both;
} }
.page-div { .page-div {
padding-top: 20px; padding-top: 20px;
} }
.cell-link { .cell-link {
/*color: #409EFF;*/ /*color: #409EFF;*/
text-decoration: underline; text-decoration: underline;
cursor: pointer; cursor: pointer;
user-select: none; user-select: none;
} }
.el-table { .el-table {
/*padding: 0 20px;*/ /*padding: 0 20px;*/
} }
@gutterSize: 10px; @gutterSize: 10px;
.admin-refresh { .admin-refresh {
.section-search { .section-search {
padding: @gutterSize; margin-bottom: 10px;
background-color: #fff; padding: @gutterSize @gutterSize 0 @gutterSize;
border-bottom: solid 1px #ebeef5; background-color: #fff;
&.search-single { border-bottom: solid 1px #ebeef5;
font-size: 0; // 去掉空隙
/*.el-form-item__content { &.search-single {
font-size: 0; // 去掉空隙 font-size: 0; // 去掉空隙
}*/ /*.el-form-item__content {
.el-form-item { font-size: 0; // 去掉空隙
margin-bottom: 0; }*/
.el-form-item {
margin-bottom: 0;
}
} }
}
.el-form--inline { .el-form--inline, &.el-form--inline {
.el-form-item { .el-form-item {
margin-right: 0; margin-right: 0;
& + .el-form-item { margin-bottom: @gutterSize;
margin-left: 10px;
& + .el-form-item {
margin-left: @gutterSize;
}
} }
} }
.search-btn-wrapper {
display: flex;
}
} }
.search-btn-wrapper {
display: flex; .page-div {
padding: 0;
} }
}
.page-div { .el-pagination {
padding: 0; padding: @gutterSize 0;
} background-color: #fff;
.el-pagination { border-bottom: solid 1px #ebeef5;
padding: @gutterSize 0; }
background-color: #fff;
border-bottom: solid 1px #ebeef5;
} }
}
// cascader 支持多行 // cascader 支持多行
.refresh-cascader-multi { .refresh-cascader-multi {
&.width-480 .el-cascader-menu { &.width-480 .el-cascader-menu {
max-width: 480px; max-width: 480px;
} }
&.width-520 .el-cascader-menu { &.width-520 .el-cascader-menu {
max-width: 520px; max-width: 520px;
} }
&.width-560 .el-cascader-menu { &.width-560 .el-cascader-menu {
max-width: 560px; max-width: 560px;
} }
...@@ -180,11 +192,13 @@ html, body { ...@@ -180,11 +192,13 @@ html, body {
.el-cascader-menu { .el-cascader-menu {
.el-cascader-menu__wrap { .el-cascader-menu__wrap {
height: 360px; height: 360px;
ul { ul {
li { li {
padding: 5px 20px 5px 20px; padding: 5px 20px 5px 20px;
height: auto; height: auto;
line-height: 24px; line-height: 24px;
.el-cascader-node__label { .el-cascader-node__label {
white-space: normal; white-space: normal;
} }
...@@ -199,24 +213,30 @@ html, body { ...@@ -199,24 +213,30 @@ html, body {
&.width-320 { &.width-320 {
max-width: 320px; max-width: 320px;
} }
&.width-360 { &.width-360 {
max-width: 360px; max-width: 360px;
} }
&.width-400 { &.width-400 {
max-width: 400px; max-width: 400px;
} }
&.width-480 { &.width-480 {
max-width: 480px; max-width: 480px;
} }
&.width-520 { &.width-520 {
max-width: 520px; max-width: 520px;
} }
&.width-560 { &.width-560 {
max-width: 560px; max-width: 560px;
} }
.el-select-dropdown__wrap { .el-select-dropdown__wrap {
max-height: 360px; max-height: 360px;
ul { ul {
li { li {
padding: 5px 20px 5px 20px; padding: 5px 20px 5px 20px;
...@@ -239,20 +259,21 @@ html, body { ...@@ -239,20 +259,21 @@ html, body {
} }
} }
.el-table { .el-table {
.f-c > div { .f-c > div {
display: flex !important; display: flex !important;
flex-flow: row; flex-flow: row;
justify-content: flex-start; justify-content: flex-start;
align-items: center; align-items: center;
} }
.avatar {
width: 50px; .avatar {
margin-right: 8px; width: 50px;
border-radius: 50%; margin-right: 8px;
height: 50px; border-radius: 50%;
height: 50px;
}
} }
}
.update-time { .update-time {
margin-top: -12px; margin-top: -12px;
......
...@@ -148,7 +148,7 @@ ...@@ -148,7 +148,7 @@
height: 50px; height: 50px;
} }
.user{ .user{
height: 100%; /*height: 100%;*/
overflow: auto; overflow: auto;
padding: 20px 0; padding: 20px 0;
.btn-content{ .btn-content{
......
<template> <template>
<div class="class admin-refresh"> <div class="class admin-refresh">
<div class="form-block section-search search-single"> <div class="form-block section-search search-single">
<el-form label-width="90px" inline> <el-form label-width="90px" inline size="small">
<el-form-item> <el-form-item>
<el-cascader <el-cascader
:popper-class="'refresh-cascader-multi width-560'" :popper-class="'refresh-cascader-multi width-560'"
...@@ -14,10 +14,9 @@ ...@@ -14,10 +14,9 @@
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-select <el-select
filterable style="width: 160px;" filterable
v-model="teacher_id" v-model="teacher_id" @change="getClassList"
placeholder="请选择老师" placeholder="请选择老师" clearable>
@change="getClassList" clearable>
<el-option <el-option
v-for="(data,index) in teacherList" v-for="(data,index) in teacherList"
:key="index" :key="index"
...@@ -30,7 +29,7 @@ ...@@ -30,7 +29,7 @@
</el-form-item> </el-form-item>
<el-form-item style="float: right"> <el-form-item style="float: right">
<div class="search-btn-wrapper"> <div class="search-btn-wrapper">
<el-button @click="onExport" type="primary" v-if="$store.state.export" plain>导出完课用户</el-button> <el-button @click="onExport" type="primary" v-if="$store.state.exportFinish" plain>导出完课用户</el-button>
<el-button @click="onAdd" type="success" v-if="!$store.state.readonly">添加班级</el-button> <el-button @click="onAdd" type="success" v-if="!$store.state.readonly">添加班级</el-button>
<el-button type="success" @click="sendMsg">发送活动通知</el-button> <el-button type="success" @click="sendMsg">发送活动通知</el-button>
</div> </div>
......
...@@ -1257,7 +1257,7 @@ ...@@ -1257,7 +1257,7 @@
height: 50px; height: 50px;
} }
.user{ .user{
height: 100%; /*height: 100%;*/
overflow: auto; overflow: auto;
padding: 20px 0; padding: 20px 0;
.btn-content{ .btn-content{
......
...@@ -131,7 +131,7 @@ ...@@ -131,7 +131,7 @@
height: 50px; height: 50px;
} }
.user{ .user{
height: 100%; /*height: 100%;*/
overflow: auto; overflow: auto;
padding: 20px 0; padding: 20px 0;
.btn-content{ .btn-content{
......
...@@ -23,26 +23,11 @@ ...@@ -23,26 +23,11 @@
<el-col :span="12"> <el-col :span="12">
<el-form-item label="商品类型" required> <el-form-item label="商品类型" required>
<el-select v-model="form.goods_type" @change="goodsChange" placeholder="请选择"> <el-select v-model="form.goods_type" @change="goodsChange" placeholder="请选择">
<el-option <el-option :label="'普通商品'" :value="1"></el-option>
:label="'普通商品'" <el-option :label="'团购商品'" :value="2"></el-option>
:value="1"> <el-option :label="'续课商品'" :value="3"></el-option>
</el-option> <el-option :label="'优惠券商品'" :value="4"></el-option>
<el-option <el-option :label="'实物商品'" :value="5"></el-option>
:label="'团购商品'"
:value="2">
</el-option>
<el-option
:label="'续课商品'"
:value="3">
</el-option>
<el-option
:label="'优惠券商品'"
:value="4">
</el-option>
<el-option
:label="'实物商品'"
:value="5">
</el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
...@@ -56,14 +41,8 @@ ...@@ -56,14 +41,8 @@
<el-col :span="12" v-if="form.goods_type === 4"> <el-col :span="12" v-if="form.goods_type === 4">
<el-form-item label="课程类型" required> <el-form-item label="课程类型" required>
<el-select v-model="form.course_type" placeholder="请选择"> <el-select v-model="form.course_type" placeholder="请选择">
<el-option <el-option :label="'日课'" :value="1"></el-option>
:label="'日课'" <el-option :label="'月课'" :value="0"></el-option>
:value="1">
</el-option>
<el-option
:label="'月课'"
:value="0">
</el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
...@@ -654,7 +633,7 @@ ...@@ -654,7 +633,7 @@
}, },
initDialog() { initDialog() {
switch (this.dialogObj.type) { switch (this.dialogObj.type) {
case 0: case 0: // 添加商品
this.loading = false; this.loading = false;
this.goOn_goods_Id.after_goods_id = ''; this.goOn_goods_Id.after_goods_id = '';
this.goodsYou = []; this.goodsYou = [];
...@@ -690,8 +669,8 @@ ...@@ -690,8 +669,8 @@
after_goods_id: 0 after_goods_id: 0
}, },
is_into_periods: '0' is_into_periods: '0'
}, };
this.getLessonList(); this.getLessonList();
console.log(this.form.course_type) console.log(this.form.course_type)
if (this.form.goods_type == 1 || this.form.goods_type == 2) { if (this.form.goods_type == 1 || this.form.goods_type == 2) {
let json = { let json = {
...@@ -713,8 +692,8 @@ ...@@ -713,8 +692,8 @@
}); });
} }
break; break;
case 1: case 1: // 编辑商品
case 2: case 2: // 查看商品
this.goOn_goods_Id.after_goods_id = ''; this.goOn_goods_Id.after_goods_id = '';
this.goOn_goods_Id.before_goods_id = ''; this.goOn_goods_Id.before_goods_id = '';
this.goodsYou = []; this.goodsYou = [];
...@@ -750,6 +729,7 @@ ...@@ -750,6 +729,7 @@
}, },
is_into_periods: '0' is_into_periods: '0'
}; };
this.getLessonList();
getGoodsDetailApi(this.dialogObj.id).then(res => { getGoodsDetailApi(this.dialogObj.id).then(res => {
this.loading = false; this.loading = false;
let share_desc = JSON.parse(res.share_desc); let share_desc = JSON.parse(res.share_desc);
......
<template> <template>
<div class="user"> <div class="admin-refresh">
<el-form ref="searchFrom" size="small" :model="searchFrom" label-width="100px" class="search-form" inline> <el-form ref="searchFrom" size="small" :model="searchFrom" label-width="100px" class="section-search" inline>
<el-form-item label="商品名称"> <el-form-item label="商品名称">
<el-input v-model="searchFrom.name"></el-input> <el-input v-model="searchFrom.name"></el-input>
</el-form-item> </el-form-item>
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
<el-tab-pane label="优惠券商品" name="4"></el-tab-pane> <el-tab-pane label="优惠券商品" name="4"></el-tab-pane>
<el-tab-pane label="实物商品" name="5"></el-tab-pane> <el-tab-pane label="实物商品" name="5"></el-tab-pane>
</el-tabs> </el-tabs>
<el-tabs v-model="searchFrom.status" type="card" style="background: white;padding-top: 10px" @tab-click="getGoods"> <el-tabs v-model="searchFrom.status" type="card" style="background: white;" @tab-click="getGoods">
<el-tab-pane label="上架" name="1"></el-tab-pane> <el-tab-pane label="上架" name="1"></el-tab-pane>
<el-tab-pane label="编辑中" name="0"></el-tab-pane> <el-tab-pane label="编辑中" name="0"></el-tab-pane>
<el-tab-pane label="下架" name="2"></el-tab-pane> <el-tab-pane label="下架" name="2"></el-tab-pane>
...@@ -520,9 +520,9 @@ ...@@ -520,9 +520,9 @@
<style scoped lang="less"> <style scoped lang="less">
@import "../../util/public"; @import "../../util/public";
.user{ .user{
height: 100%; /*height: 100%;*/
overflow: auto; /*overflow: auto;*/
padding: 20px 0; /*padding: 20px 0;*/
.btn-content{ .btn-content{
text-align: center; text-align: center;
} }
......
...@@ -3,57 +3,39 @@ ...@@ -3,57 +3,39 @@
<div class="head clear-both"> <div class="head clear-both">
<el-button @click="add" plain type="success" style="float: right" v-if="!$store.state.readonly">新增角色</el-button> <el-button @click="add" plain type="success" style="float: right" v-if="!$store.state.readonly">新增角色</el-button>
</div> </div>
<el-table <el-table :data="roleList">
:data="roleList" <el-table-column prop="id" label="角色ID"></el-table-column>
style="width: 100%"> <el-table-column label="角色名称">
<el-table-column
prop="id"
label="角色ID">
</el-table-column>
<el-table-column
label="角色名称">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="text" @click="rowClick(scope.row)"> {{scope.row.name}}</el-button> <el-button type="text" @click="rowClick(scope.row)"> {{scope.row.name}}</el-button>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column prop="created_at" label="创建时间" sortable></el-table-column>
prop="created_at" <el-table-column v-if="!$store.state.readonly" label="操作">
label="创建时间" sortable>
</el-table-column>
<el-table-column
v-if="!$store.state.readonly"
label="操作">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button size="mini" plain type="primary" v-if="!$store.state.readonly" @click="edit(scope.row)"> <el-button size="mini" plain type="primary" v-if="!$store.state.readonly" @click="edit(scope.row)">编辑</el-button>
编辑 <el-button size="mini" type="danger" plain @click="del(scope.row)" v-if="$store.state.deletePermission && !$store.state.readonly">删除</el-button>
</el-button>
<el-button size="mini" type="danger" plain @click="del(scope.row)" v-if="$store.state.deletePermission && !$store.state.readonly">
删除
</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<page :nowPage="nowPage" :total="total" :limit="limit" @pageChange="onPageChange" @sizeChange="onSizeChange"/> <page :nowPage="nowPage" :total="total" :limit="limit" @pageChange="onPageChange" @sizeChange="onSizeChange"/>
<el-dialog <el-dialog
:title="dialog.title" :title="dialog.title" center append-to-body
center :visible.sync="dialog.show" width="100vw" top="0">
append-to-body
:visible.sync="dialog.show"
width="100vw">
<el-form ref="form" :rules="dialog.rules" :model="dialog.form" label-width="100px"> <el-form ref="form" :rules="dialog.rules" :model="dialog.form" label-width="100px">
<el-form-item label="角色名称" prop="name"> <el-form-item label="角色名称" prop="name">
<el-input v-model="dialog.form.name"></el-input> <el-input v-model="dialog.form.name"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="菜单选项"> <el-form-item label="菜单选项">
<div class="custom-tree-container"> <div class="custom-tree-container">
<el-tree :data="dialog.select" <el-tree
show-checkbox :data="dialog.select"
node-key="id" show-checkbox
ref="tree" node-key="id" ref="tree"
:default-checked-keys="dialog.chooseed" :default-checked-keys="dialog.chooseed"
default-expand-all default-expand-all
:expand-on-click-node="false" :expand-on-click-node="false"
:props="{children:'children',label:'name',value:false}"> :props="{children:'children',label:'name',value:false}">
<span class="custom-tree-node" slot-scope="{ node, data }"> <span class="custom-tree-node" slot-scope="{ node, data }">
<span>{{ node.label }}</span> <span>{{ node.label }}</span>
<span v-if="data.pid !== 0"> <span v-if="data.pid !== 0">
...@@ -64,14 +46,15 @@ ...@@ -64,14 +46,15 @@
<el-checkbox v-model="data.classManage" v-if="data.cover ==='2-3'|| data.cover=== '3-1'|| data.cover=== '3-2' ">添加带班班用户</el-checkbox> <el-checkbox v-model="data.classManage" v-if="data.cover ==='2-3'|| data.cover=== '3-1'|| data.cover=== '3-2' ">添加带班班用户</el-checkbox>
<el-checkbox v-model="data.classManageUnlimited" v-if="data.cover ==='2-3'|| data.cover=== '3-1'|| data.cover=== '3-2' ">添加观摩班(无限制)</el-checkbox> <el-checkbox v-model="data.classManageUnlimited" v-if="data.cover ==='2-3'|| data.cover=== '3-1'|| data.cover=== '3-2' ">添加观摩班(无限制)</el-checkbox>
<el-checkbox v-model="data.classTakeUnlimited" v-if="data.cover ==='2-3'|| data.cover=== '3-1'|| data.cover=== '3-2' ">添加带班班(无限制)</el-checkbox> <el-checkbox v-model="data.classTakeUnlimited" v-if="data.cover ==='2-3'|| data.cover=== '3-1'|| data.cover=== '3-2' ">添加带班班(无限制)</el-checkbox>
<el-checkbox v-model="data.distribution" v-if="data.cover ==='5-9'||data.cover ==='7-9'" @change="distribution" >批量分配</el-checkbox> <el-checkbox v-model="data.distribution" v-if="data.cover ==='5-9'||data.cover ==='7-9'" @change="distribution">批量分配</el-checkbox>
<el-checkbox v-model="data.import" v-if="data.cover ==='6-3'||data.cover ==='5-3'||data.cover ==='5-9'" >导入</el-checkbox> <el-checkbox v-model="data.exportFinish" v-if="data.cover === '2-3'">导出完课用户</el-checkbox>
<el-checkbox v-model="data.export" v-if="exportMenuList.indexOf(data.cover) >-1" >导出</el-checkbox> <el-checkbox v-model="data.import" v-if="data.cover ==='6-3'||data.cover ==='5-3'||data.cover ==='5-9'">导入</el-checkbox>
<el-checkbox v-model="data.export" v-if="exportMenuList.indexOf(data.cover) >-1">导出</el-checkbox>
<el-checkbox v-model="data.readonly">只读</el-checkbox> <el-checkbox v-model="data.readonly">只读</el-checkbox>
<el-checkbox v-model="data.delete">删除</el-checkbox> <el-checkbox v-model="data.delete">删除</el-checkbox>
</span> </span>
</span> </span>
</el-tree> </el-tree>
</div> </div>
</el-form-item> </el-form-item>
</el-form> </el-form>
...@@ -84,67 +67,76 @@ ...@@ -84,67 +67,76 @@
</template> </template>
<script> <script>
import {getMenuListApi,getRoleListApi,getRoleDetailApi,delRoleApi,updateRoleApi,saveRoleApi} from "../../service/api"; import {
getMenuListApi,
getRoleListApi,
getRoleDetailApi,
delRoleApi,
updateRoleApi,
saveRoleApi
} from "../../service/api";
import page from '../framework/page' import page from '../framework/page'
export default { export default {
components:{ components: {
page page
}, },
data(){ data() {
return { return {
nowPage:1, nowPage: 1,
total:0, total: 0,
limit: 10, limit: 10,
roleList:[], roleList: [],
exportMenuList:[ // 导出权限 exportMenuList: [ // 导出权限
'2-3','5-10','5-2','5-1','5-3','5-8','5-9','3-1','7-9','6-3', '10-8' '2-3', '5-10', '5-2', '5-1', '5-3', '5-8', '5-9', '3-1', '7-9', '6-3', '10-8'
], ],
dialog:{ dialog: {
title:'新增角色', title: '新增角色',
show:false, show: false,
select:[], select: [],
chooseed:[], chooseed: [],
rules: { rules: {
name: [ name: [
{required: true, message: '请填写角色名称', trigger: 'change'}, {required: true, message: '请填写角色名称', trigger: 'change'},
], ],
}, },
form:{ form: {
name:'', name: '',
menu_ids:[], menu_ids: [],
id: '' id: ''
} }
}, },
} }
}, },
created(){ created() {
this.getList(); this.getList();
this.getMenuList(); this.getMenuList();
}, },
methods:{ methods: {
distribution(val){ distribution(val) {
}, },
rowClick(data){ rowClick(data) {
this.$router.push({name:'admin',query:{roleId:data.id}}) this.$router.push({name: 'admin', query: {roleId: data.id}})
}, },
getMenuList(){ getMenuList() {
getMenuListApi().then(res=>{ getMenuListApi().then(res => {
if (res) { if (res) {
res.forEach(i=>{ res.forEach(i => {
if(i.children){ if (i.children) {
i.children.forEach(j=>{ i.children.forEach(j => {
j.readonly= false; j.readonly = false;
j.delete = false; j.delete = false;
if(this.exportMenuList.indexOf(j.cover)>-1)j.export = false; if (this.exportMenuList.indexOf(j.cover) > -1) j.export = false;
if(j.cover==="5-9"||j.cover==="7-9" )j.distribution = false; if (j.cover === "5-9" || j.cover === "7-9") j.distribution = false;
if(j.cover==="6-3"||j.cover==="5-3"||j.cover==="5-9" )j.import = false; if (j.cover === "6-3" || j.cover === "5-3" || j.cover === "5-9") j.import = false;
if(j.name==='月课订单列表' || j.name==='日课订单列表' || j.name==="来源码管理"|| j.cover==="5-9" || j.cover==="2-3" || j.cover==="3-1"|| j.cover=== '3-2')j.refund = false; if (j.name === '月课订单列表' || j.name === '日课订单列表' || j.name === "来源码管理" || j.cover === "5-9" || j.cover === "2-3" || j.cover === "3-1" || j.cover === '3-2') j.refund = false;
if(j.cover==="2-3"||j.cover==="3-1"|| j.cover=== '3-2' ){ if (j.cover === "2-3" || j.cover === "3-1" || j.cover === '3-2') {
j.classManageUnlimited= false; j.classManageUnlimited = false;
j.classManage = false; j.classManage = false;
j.classTakeUnlimited = false; j.classTakeUnlimited = false;
} }
if(j.cover==="5-1")j.promoter = false; if (j.cover === "2-3") j.exportFinish = false;
if (j.cover === "5-1") j.promoter = false;
}) })
} }
}); });
...@@ -152,84 +144,88 @@ ...@@ -152,84 +144,88 @@
} }
}) })
}, },
onPageChange(val){ onPageChange(val) {
this.nowPage = val; this.nowPage = val;
this.getList(); this.getList();
}, },
onSizeChange(val){ onSizeChange(val) {
this.nowPage = 1; this.nowPage = 1;
this.limit = val; this.limit = val;
this.getList(); this.getList();
}, },
getList(){ getList() {
let json = { let json = {
limit: this.limit, limit: this.limit,
page: this.nowPage page: this.nowPage
}; };
getRoleListApi(json).then(res=>{ getRoleListApi(json).then(res => {
if (res) { if (res) {
this.roleList = res.list; this.roleList = res.list;
this.total = res.total; this.total = res.total;
} }
}) })
}, },
edit(data){ edit(data) {
this.dialog.form.id = data.id; this.dialog.form.id = data.id;
this.dialog.title = '编辑角色'; this.dialog.title = '编辑角色';
// 初始化 // 初始化
getMenuListApi().then(res=>{ getMenuListApi().then(res => {
if (res) { if (res) {
res.forEach(i=>{ res.forEach(i => {
if(i.children){ if (i.children) {
i.children.forEach(j=>{ i.children.forEach(j => {
j.readonly= false; j.readonly = false;
j.delete = false; j.delete = false;
if(this.exportMenuList.indexOf(j.cover)>-1)j.export = false; if (this.exportMenuList.indexOf(j.cover) > -1) j.export = false;
if(j.cover==="5-9"||j.cover==="7-9" )j.distribution = false; if (j.cover === "5-9" || j.cover === "7-9") j.distribution = false;
if(j.cover==="6-3"||j.cover==="5-3"||j.cover==="5-9" )j.import = false; if (j.cover === "6-3" || j.cover === "5-3" || j.cover === "5-9") j.import = false;
if(j.name==='月课订单列表' || j.name==='日课订单列表' || j.name==="来源码管理"|| j.cover==="5-9" || j.cover==="2-3" || j.cover==="3-1"|| j.cover=== '3-2')j.refund = false; if (j.name === '月课订单列表' || j.name === '日课订单列表' || j.name === "来源码管理" || j.cover === "5-9" || j.cover === "2-3" || j.cover === "3-1" || j.cover === '3-2') j.refund = false;
if(j.cover==="2-3"||j.cover==="3-1"|| j.cover=== '3-2' ){ if (j.cover === "2-3" || j.cover === "3-1" || j.cover === '3-2') {
j.classManageUnlimited= false; j.classManageUnlimited = false;
j.classManage = false; j.classManage = false;
j.classTakeUnlimited = false; j.classTakeUnlimited = false;
} }
if(j.cover==="5-1")j.promoter = false; if (j.cover === "2-3") j.exportFinish = false;
if (j.cover === "5-1") j.promoter = false;
}) })
} }
}); });
this.dialog.select = res; this.dialog.select = res;
// 回显 // 回显
getRoleDetailApi(data.id).then((res)=>{ getRoleDetailApi(data.id).then((res) => {
this.dialog.form.name = res.name; this.dialog.form.name = res.name;
this.dialog.form.menu_ids = JSON.parse(res.menu_ids); this.dialog.form.menu_ids = JSON.parse(res.menu_ids);
console.log(this.dialog.form.menu_ids) console.log(this.dialog.form.menu_ids)
this.dialog.chooseed = []; this.dialog.chooseed = [];
this.dialog.form.menu_ids.forEach(i=>{ this.dialog.form.menu_ids.forEach(i => {
this.dialog.chooseed.push(i.id); this.dialog.chooseed.push(i.id);
this.dialog.select.forEach(j=>{ this.dialog.select.forEach(j => {
if(j.children){ if (j.children) {
// 选中的子项赋值权限 // 选中的子项赋值权限
j.children.forEach(x=>{ j.children.forEach(x => {
if(x.id===i.id){ if (x.id === i.id) {
x.readonly = !!i.readonly; x.readonly = !!i.readonly;
x.delete = !!i.delete; x.delete = !!i.delete;
if(this.exportMenuList.indexOf(i.cover)>-1)x.export = !!i.export; if (this.exportMenuList.indexOf(i.cover) > -1) x.export = !!i.export;
if(i.cover==='5-1' || i.cover==='5-10' || i.cover === "10-1"|| i.cover==="5-9" || i.cover==="2-3" || i.cover==="3-1"|| i.cover=== '3-2'){ if (i.cover === '5-1' || i.cover === '5-10' || i.cover === "10-1" || i.cover === "5-9" || i.cover === "2-3" || i.cover === "3-1" || i.cover === '3-2') {
x.refund = !!i.refund; x.refund = !!i.refund;
} }
if(i.cover==="2-3"||i.cover==="3-1"|| i.cover==='3-2'){ if (i.cover === "2-3" || i.cover === "3-1" || i.cover === '3-2') {
x.classManage = !!i.classManage; x.classManage = !!i.classManage;
x.classManageUnlimited = !!i.classManageUnlimited; x.classManageUnlimited = !!i.classManageUnlimited;
x.classTakeUnlimited = !!i.classTakeUnlimited; x.classTakeUnlimited = !!i.classTakeUnlimited;
} }
if(i.cover==="6-3"||i.cover==="5-3"||i.cover==="5-9" ){ if (i.cover === "6-3" || i.cover === "5-3" || i.cover === "5-9") {
x.import = !!i.import; x.import = !!i.import;
} }
if(i.cover==="5-9"||i.cover==="7-9"){ if (i.cover === "5-9" || i.cover === "7-9") {
x.distribution = !!i.distribution; x.distribution = !!i.distribution;
} }
if(i.cover==="5-1"){ if (i.cover === "2-3") {
x.exportFinish = !!i.exportFinish;
}
if (i.cover === "5-1") {
x.promoter = !!i.promoter; x.promoter = !!i.promoter;
} }
} }
...@@ -245,7 +241,7 @@ ...@@ -245,7 +241,7 @@
} }
}); });
}, },
add(){ add() {
this.dialog.show = true; this.dialog.show = true;
this.dialog.form.id = ''; this.dialog.form.id = '';
this.dialog.title = '新增菜单'; this.dialog.title = '新增菜单';
...@@ -253,13 +249,13 @@ ...@@ -253,13 +249,13 @@
this.dialog.form.menu_ids = []; this.dialog.form.menu_ids = [];
this.getMenuList(); this.getMenuList();
}, },
del(data){ del(data) {
this.$confirm('此操作将删除该角色?', '提示', { this.$confirm('此操作将删除该角色?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
delRoleApi(data.id).then(res=>{ delRoleApi(data.id).then(res => {
this.$message({ this.$message({
type: 'success', type: 'success',
message: '删除成功!' message: '删除成功!'
...@@ -268,59 +264,62 @@ ...@@ -268,59 +264,62 @@
}); });
}); });
}, },
sub(){ sub() {
this.$refs['form'].validate((valid) => { this.$refs['form'].validate((valid) => {
if(valid){ if (valid) {
let checked = this.$refs.tree.getCheckedNodes(); let checked = this.$refs.tree.getCheckedNodes();
let menu_ids = []; let menu_ids = [];
checked.forEach(i=>{ checked.forEach(i => {
let json; let json;
if(i.readonly === false || i.readonly === true){ if (i.readonly === false || i.readonly === true) {
json = {id:i.id,cover:i.cover,readonly:i.readonly} json = {id: i.id, cover: i.cover, readonly: i.readonly}
} }
if(i.delete === false || i.delete === true){ if (i.delete === false || i.delete === true) {
json.delete = i.delete json.delete = i.delete
} }
if(i.refund === false || i.refund === true){ if (i.refund === false || i.refund === true) {
json.refund = i.refund json.refund = i.refund
} }
if(i.classManage === false || i.classManage === true){ if (i.classManage === false || i.classManage === true) {
json.classManage = i.classManage json.classManage = i.classManage
} }
if(i.classManageUnlimited === false || i.classManageUnlimited === true){ if (i.classManageUnlimited === false || i.classManageUnlimited === true) {
json.classManageUnlimited = i.classManageUnlimited json.classManageUnlimited = i.classManageUnlimited
} }
if(i.classTakeUnlimited === false || i.classTakeUnlimited === true){ if (i.classTakeUnlimited === false || i.classTakeUnlimited === true) {
json.classTakeUnlimited = i.classTakeUnlimited json.classTakeUnlimited = i.classTakeUnlimited
} }
if(i.promoter === false || i.promoter === true){ if (i.exportFinish === false || i.exportFinish === true) {
json.exportFinish = i.exportFinish
}
if (i.promoter === false || i.promoter === true) {
json.promoter = i.promoter json.promoter = i.promoter
} }
if(i.export === false || i.export === true){ if (i.export === false || i.export === true) {
json.export = i.export json.export = i.export
} }
if(i.import === false || i.import === true){ if (i.import === false || i.import === true) {
json.import = i.import json.import = i.import
} }
if(i.distribution === false || i.distribution === true){ if (i.distribution === false || i.distribution === true) {
json.distribution = i.distribution json.distribution = i.distribution
} }
if(json){ if (json) {
menu_ids.push(json) menu_ids.push(json)
} }
}); });
let dia = this.dialog; let dia = this.dialog;
if(dia.form.id){ if (dia.form.id) {
let json = { let json = {
name:dia.form.name, name: dia.form.name,
menu_ids:JSON.stringify(menu_ids) menu_ids: JSON.stringify(menu_ids)
}; };
this.$confirm('此操作将修改该角色?', '提示', { this.$confirm('此操作将修改该角色?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
updateRoleApi(dia.form.id,json).then(()=>{ updateRoleApi(dia.form.id, json).then(() => {
this.$message({ this.$message({
type: 'success', type: 'success',
message: '修改成功!' message: '修改成功!'
...@@ -329,17 +328,17 @@ ...@@ -329,17 +328,17 @@
this.getList() this.getList()
}) })
}) })
}else{ } else {
let json = { let json = {
name:dia.form.name, name: dia.form.name,
menu_ids:JSON.stringify(menu_ids) menu_ids: JSON.stringify(menu_ids)
}; };
this.$confirm('此操作将添加新角色?', '提示', { this.$confirm('此操作将添加新角色?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
saveRoleApi(json).then(()=>{ saveRoleApi(json).then(() => {
this.$message({ this.$message({
type: 'success', type: 'success',
message: '添加成功!' message: '添加成功!'
...@@ -365,22 +364,26 @@ ...@@ -365,22 +364,26 @@
font-size: 14px; font-size: 14px;
padding-right: 8px; padding-right: 8px;
} }
.role{
.head{ .role {
margin-bottom: 10px; .head {
} margin-bottom: 10px;
width: 100%; }
padding: 20px 0;
.page-div{ width: 100%;
text-align: center; padding: 20px 0;
padding-top: 20px
} .page-div {
text-align: center;
padding-top: 20px
}
} }
.clear-both{
&:after{ .clear-both {
content: ''; &:after {
display: block; content: '';
clear: both; display: block;
} clear: both;
}
} }
</style> </style>
...@@ -100,6 +100,7 @@ router.beforeEach((to,from,next)=> { ...@@ -100,6 +100,7 @@ router.beforeEach((to,from,next)=> {
store.dispatch('promoter',to.meta.promoter) store.dispatch('promoter',to.meta.promoter)
store.dispatch('classManageUnlimited',to.meta.classManageUnlimited) store.dispatch('classManageUnlimited',to.meta.classManageUnlimited)
store.dispatch('classTakeUnlimited',to.meta.classTakeUnlimited) store.dispatch('classTakeUnlimited',to.meta.classTakeUnlimited)
store.dispatch('exportFinish',to.meta.exportFinish)
console.log(to.meta) console.log(to.meta)
if(to.name==='userDetail'){ if(to.name==='userDetail'){
let list = JSON.parse(localStorage.getItem('permission')) let list = JSON.parse(localStorage.getItem('permission'))
......
...@@ -35,6 +35,9 @@ export default{ ...@@ -35,6 +35,9 @@ export default{
classTakeUnlimited({commit},data){ classTakeUnlimited({commit},data){
commit('classTakeUnlimited',data) commit('classTakeUnlimited',data)
}, },
exportFinish({commit},data){
commit('exportFinish',data)
},
promoter({commit},data){ promoter({commit},data){
commit('promoter',data) commit('promoter',data)
} }
......
...@@ -17,6 +17,7 @@ export default new vuex.Store({ ...@@ -17,6 +17,7 @@ export default new vuex.Store({
classManage:false, classManage:false,
classManageUnlimited:false, classManageUnlimited:false,
classTakeUnlimited:false, classTakeUnlimited:false,
exportFinish:false,
import:false, import:false,
promoter:false, promoter:false,
mainLoad:true, mainLoad:true,
......
...@@ -33,6 +33,9 @@ const mutations={ ...@@ -33,6 +33,9 @@ const mutations={
classManageUnlimited(state,data){ classManageUnlimited(state,data){
state.classManageUnlimited=data; state.classManageUnlimited=data;
}, },
exportFinish(state,data){
state.exportFinish=data;
},
classTakeUnlimited(state,data){ classTakeUnlimited(state,data){
state.classTakeUnlimited=data; state.classTakeUnlimited=data;
}, },
......
...@@ -425,7 +425,7 @@ export default [{ ...@@ -425,7 +425,7 @@ export default [{
component: e => require(['@/components/conversionList/channelTransList'], e), component: e => require(['@/components/conversionList/channelTransList'], e),
} }
}, },
] ]
}, },
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment