Commit 9689f7ff authored by 罗超's avatar 罗超

Merge branch 'master' of http://gitlab.oytour.com/luochao/confucius into master

# Conflicts:
#	src/router/routes.js
parents a6b39a2b f5f5c690
......@@ -142,7 +142,8 @@ module.exports = function(ctx) {
'QTr',
'QTd',
'QCard',
'QCheckbox'
'QCheckbox',
'QTree',
],
// directives: [],
......
import request from '../../utils/request'
/**
* 获取课程分页列表
* @param {JSON参数} data
*/
export function queryCourseCategoryPage(data) {
return request({
url: '/Course/GetCourseCategoryPageList',
method: 'post',
data
})
}
/**
* 获取课程分类树形列表
*/
export function queryCourseCategoryTree(data) {
return request({
url: '/Course/GetCourseCategoryTree',
method: 'post',
data
})
}
/**
* 根据编号获取课程分类信息
*/
export function queryCourseCategoryInfo(data)
{
return request({
url: '/Course/GetCourseCategory',
method: 'post',
data
})
}
/**
* 保存课程分类
* @param {JSON参数} data
*/
export function saveCourseCategoryInfo(data)
{
return request({
url: '/Course/SetCourseCategory',
method: 'post',
data
})
}
<template>
<q-dialog v-model="persistent" content-class="bg-grey-1" persistent transition-show="scale" transition-hide="scale">
<q-card style="width: 800px;max-width:900px;">
<q-card-section>
<div class="text-h6">{{objOption.MenuId==0?'新增课程分类信息':'修改课程分类信息'}}</div>
</q-card-section>
<q-card-section class="q-pt-none scroll" style="max-height: 70vh">
<div class="text-caption q-mb-lg q-px-md text-grey-6">课程分类信息</div>
<div class="row wrap">
<q-input filled stack-label maxlength="50" :dense="false" v-model="objOption.CateName" ref="CateName"
class="col-6 q-pr-lg q-pb-lg" label="分类名称" :rules="[val => !!val || '请填写分类名称']" />
<q-input filled stack-label maxlength="100" :dense="false" v-model="objOption.SortNum" ref="SortNum"
class="col-6 q-pr-lg q-pb-lg" label="排序" />
<div class="col-12 q-pr-lg q-pb-lg q-pt-lg">
<q-toggle size="md" label="状态" color="primary" :false-value="1" :true-value="0" v-model="objOption.Status"
title="注意:关闭后,分类将无法正常使用." />
</div>
<div class="col-12 q-pr-lg q-pb-lg q-pt-lg">
上级分类:
<div class="q-pa-md q-gutter-sm">
<q-tree v-if="isShow" style="max-width:300px;" :nodes="TreeCategoryList" node-key="CateId"
label-key="CateName" children-key="ChildList" tick-strategy="strict" :default-expand-all="true"
no-connectors :ticked.sync="chooseCategroyArray">
</q-tree>
</div>
</div>
</div>
</q-card-section>
<q-separator />
<q-card-actions align="right" class="bg-white">
<q-btn label="取消" color="dark" style="font-weight:400 !important" @click="closeSaveForm" />
<q-btn label="立即提交" color="accent q-px-md" style="font-weight:400 !important" :loading="saveLoading"
@click="saveCategory" />
</q-card-actions>
</q-card>
</q-dialog>
</template>
<script>
import {
queryCourseCategoryTree,
queryCourseCategoryInfo,
saveCourseCategoryInfo
} from '../../api/course/index'
export default {
props: {
saveObj: {
type: Object,
default: null
}
},
data() {
return {
isShow: false,
persistent: true,
objOption: {
CateId: 0, //分类编号
ParentId: 0, //父级编号
CateName: "", //分类名称
SortNum: 0, //排序
Status: 0, //状态(0-正常,1-禁用)},
},
optionTitle: "",
//树形课程分类列表
TreeCategoryList: [],
saveLoading: false,
chooseCategroyArray: [],
}
},
mounted() {
this.getCategoryTreeList();
this.initObj()
},
methods: {
//获取树形课程分类列表
getCategoryTreeList() {
this.TreeCategoryList = [];
var qMsg = {}
queryCourseCategoryTree(qMsg).then(res => {
this.TreeCategoryList = res.Data;
this.isShow = true;
})
},
//初始化表单
initObj() {
if (this.saveObj && this.saveObj.CateId > 0) {
queryCourseCategoryInfo({
CateId: this.saveObj.CateId
}).then(res => {
this.objOption.CateId = res.Data.CateId;
this.objOption.ParentId = res.Data.ParentId;
this.objOption.CateName = res.Data.CateName;
this.objOption.SortNum = res.Data.SortNum;
this.objOption.Status = res.Data.Status;
if (res.Data.ParentId && res.Data.ParentId > 0) {
this.chooseCategroyArray.push(res.Data.ParentId);
}
})
this.optionTitle = "修改课程分类信息"
} else {
this.optionTitle = "新增课程分类"
this.objOption.CateId = 0;
this.objOption.ParentId = 0;
this.objOption.CateName = "";
this.objOption.SortNum = 0;
this.objOption.Status = 0;
}
},
//关闭弹窗
closeSaveForm() {
this.$emit('close')
this.persistent = false
},
//保存菜单
saveCategory() {
var tempKeys = "";
if (this.chooseCategroyArray && this.chooseCategroyArray.length > 0) {
this.chooseCategroyArray.forEach(item => {
this.objOption.ParentId = item;
})
}
this.saveLoading = true
saveCourseCategoryInfo(this.objOption).then(res => {
this.saveLoading = false
this.$q.notify({
icon: 'iconfont icon-chenggong',
color: 'accent',
timeout: 2000,
message: '数据保存成功!',
position: 'top'
})
this.$emit("success")
this.closeSaveForm()
}).catch(() => {
this.saveLoading = false
})
}
},
watch: {
chooseCategroyArray: function (val, oldval) {
if (this.chooseCategroyArray.length > 1) {
var end = this.chooseCategroyArray[this.chooseCategroyArray.length - 1];
var tempArray = [];
tempArray.push(end);
this.chooseCategroyArray = tempArray;
}
}
}
}
</script>
......@@ -11,10 +11,17 @@
class="col-6 q-pr-lg q-pb-lg" label="角色名称" :rules="[val => !!val || '请填写角色名称']" />
<q-input filled stack-label maxlength="100" :dense="false" v-model="objOption.RoleIntro" ref="RoleIntro"
class="col-6 q-pr-lg q-pb-lg" label="角色介绍" />
<div class="col-6 q-pr-lg q-pb-lg q-pt-lg">
<div class="col-12 q-pr-lg q-pb-lg q-pt-lg">
<q-toggle size="md" label="状态" color="primary" :false-value="1" :true-value="0"
v-model="objOption.Status" />
<div class="text-grey-6 text-caption">注意:关闭后,角色将无法正常使用.</div>
v-model="objOption.Status" title="注意:关闭后,角色将无法正常使用." />
</div>
</div>
<div class="text-caption q-mb-lg q-px-md text-grey-6">权限设置</div>
<div class="row wrap">
<div class="q-pa-md q-gutter-sm">
<q-tree :nodes="TreeMenuList" node-key="MenuId" label-key="MenuName" children-key="SubList"
tick-strategy="leaf-filtered" default-expand-all :ticked.sync="checkMenuArray" no-connectors>
</q-tree>
</div>
</div>
</q-card-section>
......@@ -53,8 +60,10 @@
},
optionTitle: "",
//菜单列表
MenuList: [],
TreeMenuList: [],
saveLoading: false,
//选中的节点
checkMenuArray: [],
}
},
mounted() {
......@@ -62,17 +71,15 @@
this.initObj()
},
methods: {
//获取菜单列表
queryMenuList() {
this.MenuList = [];
var qMsg = {
}
this.TreeMenuList = [];
var qMsg = {}
queryTreeMenu(qMsg).then(res => {
console.log("res", res);
this.TreeMenuList = res.Data;
})
},
//初始化表单
initObj() {
if (this.saveObj && this.saveObj.RoleId > 0) {
......@@ -84,6 +91,7 @@
this.objOption.RoleIntro = res.Data.RoleIntro;
this.objOption.RoleAuth = res.Data.RoleAuth;
this.objOption.Status = res.Data.Status;
this.checkMenuArray = res.Data.CheckMenuList;
})
this.optionTitle = "修改角色信息"
} else {
......@@ -102,6 +110,16 @@
},
//保存菜单
saveRole() {
var tempKeys = "";
if (this.checkMenuArray && this.checkMenuArray.length > 0) {
this.checkMenuArray.forEach(item => {
tempKeys += "," + item;
})
}
if (tempKeys && tempKeys != '') {
tempKeys = tempKeys.substring(1, tempKeys.length);
}
this.objOption.RoleAuth = tempKeys;
this.saveLoading = true
saveRoleInfo(this.objOption).then(res => {
this.saveLoading = false
......
<template>
<div class="page-body">
<div class="page-search row items-center">
<div class="col row wrap q-mr-lg q-col-gutter-md">
<div class="col-3">
<q-input ref="filter" filled v-model="keyWords" label="分类名称">
<template v-slot:append>
<q-icon v-if="keyWords !== ''" name="clear" class="cursor-pointer" @click="resetFilter" />
</template>
</q-input>
</div>
</div>
<div class="page-option">
<q-btn color="accent" class="q-mr-md" icon="add" label="新增分类" @click="EditMenu(null)" />
</div>
</div>
<div class="page-content">
<div class="q-pa-md q-gutter-sm">
<q-tree v-if="isShow" :nodes="data" node-key="CateId" label-key="CateName" children-key="ChildList"
:filter="keyWords" :filter-method="myFilterMethod" default-expand-all no-results-label="暂无相关数据">
<template v-slot:default-header="prop">
<div class="row items-center">
<div class="text-weight-bold text-primary">{{ prop.node.CateName }}</div>
<template v-if="prop.node.ChildList && prop.node.ChildList.length>0">
&nbsp;
<q-btn round icon="add" size="xs" @click="EditMenu(null)" />
</template>
&nbsp;
<q-btn round icon="edit" size="xs" @click="EditMenu(prop.node)" />
</div>
</template>
</q-tree>
</div>
<category-form v-if="isShowCategory" :save-obj="categoryObj" @close="closeCagegoryForm" @success="refreshPage">
</category-form>
</div>
</div>
</template>
<script>
import {
queryCourseCategoryTree
} from '../../api/course/index'
import categoryForm from '../../components/course/category-form'
export default {
meta: {
title: "课程分类"
},
components: {
categoryForm,
},
data() {
return {
currentUrl: "",
data: [],
keyWords: '',
isShowCategory: false,
isShow: false,
categoryObj: {},
}
},
mounted() {
this.currentUrl = this.$route.path
this.getcoursecategorytree()
},
methods: {
//搜索分类
myFilterMethod(node, filter) {
return node.CateName && node.CateName.indexOf(filter) > -1;
},
//重置搜索关键词
resetFilter() {
this.keyWords = ''
this.$refs.filter.focus()
},
//刷新页面
refreshPage() {
this.getcoursecategorytree();
},
//获取课程分类树形结构
getcoursecategorytree() {
this.isShow = false;
queryCourseCategoryTree({}).then(res => {
this.isShow = true;
this.data = res.Data;
})
},
//新增修改角色
EditMenu(obj) {
if (obj) {
this.categoryObj = obj
} else {
this.categoryObj = null
}
this.isShowCategory = true;
},
//关闭弹窗
closeCagegoryForm() {
this.isShowCategory = false
}
}
}
</script>
<style lang="sass">
@import url('~assets/css/table.sass');
</style>
......@@ -46,7 +46,7 @@
</q-td>
</template>
</q-table>
<menu-form v-if="persistent_menu" :save-obj="menuObjOption" @close="closeMenuSaveForm" @success="refreshPage">
<menu-form v-if="isShowMenuForm" :save-obj="menuObjOption" @close="closeMenuSaveForm" @success="refreshPage">
</menu-form>
</div>
</div>
......@@ -160,9 +160,8 @@
Status: "-1",
},
pageCount: 0,
persistent_menu: false,
isShowMenuForm: false,
menuObjOption: null,
persistentExamine_menu: false
}
},
mounted() {
......@@ -216,12 +215,11 @@
} else {
this.menuObjOption = null
}
this.persistent_menu = true
this.isShowMenuForm = true
},
//关闭弹窗
closeMenuSaveForm() {
this.persistent_menu = false
this.persistentExamine_menu = false
this.isShowMenuForm = false
}
}
}
......
......@@ -34,7 +34,7 @@
</q-td>
</template>
</q-table>
<role-form v-if="persistent_role" :save-obj="roleObjOption" @close="closeroleSaveForm" @success="refreshPage">
<role-form v-if="isShowRoleForm" :save-obj="roleObjOption" @close="closeroleSaveForm" @success="refreshPage">
</role-form>
</div>
</div>
......@@ -121,9 +121,8 @@
Status: "-1",
},
pageCount: 0,
persistent_role: false,
isShowRoleForm: false,
roleObjOption: null,
persistentExamine_role: false
}
},
mounted() {
......@@ -168,12 +167,11 @@
} else {
this.roleObjOption = null
}
this.persistent_role = true
this.isShowRoleForm = true
},
//关闭弹窗
closeroleSaveForm() {
this.persistent_role = false
this.persistentExamine_role = false
this.isShowRoleForm = false
}
}
}
......
......@@ -33,17 +33,22 @@ const routes = [{
import ("pages/school/assistant.vue")
},
{
path: "/system/menu",
path: "/system/menu", //菜单管理
component: () =>
import ("pages/system/menu.vue")
},
{
path: "/system/role",
path: "/system/role", //角色管理
component: () =>
import ("pages/system/role.vue")
},
{
path: "/test",
path: "/course/catagory", //课程分类
component: () =>
import ("pages/course/catagory.vue")
},
{
path: "/test", //API测试
component: () =>
import ("pages/test.vue")
},
......
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