Commit fe366347 authored by 黄奎's avatar 黄奎

页面修改

parent c654fdbc
<template> <template>
<q-card style="width: 360px;"> <q-card style="width: 360px;">
<q-input ref="selectTree" standout="bg-primary text-white" v-model="showMsg" :label="tipText" <q-input ref="selectTree" standout="bg-primary text-white" v-model="showMsg" :label="tipText"
@click.native="isShowSelect = !isShowSelect" /> @click.native="isShowSelect = !isShowSelect">
<q-tree v-if="isShowSelect" <template v-slot:append>
style="width:100%;height:250px;overflow-y: scroll;position:absolute;z-index:99999;background:#fff;border:1px solid rgba(0, 0, 0, 0.12);" <q-btn round dense flat icon="search" />
:nodes="treeData" :node-key="nodeKey" :label-key="labelKey" :children-key="childrenKey" tick-strategy="strict" </template>
:default-expand-all="defaultExpandAll" no-connectors :ticked.sync="chooseArray"> </q-input>
<q-card style="width:100%;position:absolute;z-index:99999;background:#fff;border:1px solid rgba(0, 0, 0, 0.12);">
<q-btn-group push v-if="isShowSelect" :spread="true">
<q-btn push label="全选" @click="checkAll()" />
<q-btn push label="清空" @click="clearMsg()" />
<q-btn push label="确认" @click="getCheckValue()" />
<q-btn push label="关闭" @click="isShowSelect=false" />
</q-btn-group>
<q-tree style="height:250px;overflow-y: scroll;" v-if="isShowSelect" :nodes="treeData" :node-key="nodeKey"
:label-key="labelKey" :children-key="childrenKey" tick-strategy="strict" :default-expand-all="defaultExpandAll"
no-connectors :ticked.sync="chooseArray">
</q-tree> </q-tree>
</q-card> </q-card>
</q-card>
</template> </template>
<script> <script>
export default { export default {
...@@ -61,7 +72,7 @@ ...@@ -61,7 +72,7 @@
}, },
showMsg: "", showMsg: "",
chooseArray: [], chooseArray: [],
resultObj: {}, resultObj: "",
} }
}, },
watch: { watch: {
...@@ -95,6 +106,26 @@ ...@@ -95,6 +106,26 @@
this.setTreeCheckNode(); this.setTreeCheckNode();
}, },
methods: { methods: {
//全选
checkAll() {
var tempArray = [];
var nodes = this.findTreeNode(this.treeData);
if (nodes && nodes.length > 0) {
nodes.forEach(item => {
tempArray.push(item.value)
});
}
this.chooseArray = tempArray;
},
//清空选中
clearMsg() {
this.chooseArray = [];
},
//返回选中的值
getCheckValue() {
this.isShowSelect = false;
this.$emit('getChild', this.resultObj);
},
//设置下拉框选择 //设置下拉框选择
setTreeCheckNode() { setTreeCheckNode() {
var that = this; var that = this;
...@@ -128,7 +159,6 @@ ...@@ -128,7 +159,6 @@
this.showMsg = tempStr.substring(1, tempStr.length); this.showMsg = tempStr.substring(1, tempStr.length);
} }
} }
that.$emit('getChild', this.resultObj);
}, },
//获取所有节点 //获取所有节点
findTreeNode(tree) { findTreeNode(tree) {
......
...@@ -12,17 +12,20 @@ ...@@ -12,17 +12,20 @@
<q-input filled stack-label maxlength="100" :dense="false" v-model="objOption.RoleIntro" ref="RoleIntro" <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="角色介绍" /> class="col-6 q-pr-lg q-pb-lg" label="角色介绍" />
<div class="col-12 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" <q-toggle size="md" label="状态" color="primary" :false-value="1" :true-value="0" v-model="objOption.Status"
v-model="objOption.Status" title="注意:关闭后,角色将无法正常使用." /> title="注意:关闭后,角色将无法正常使用." />
</div> </div>
</div> </div>
<div class="text-caption q-mb-lg q-px-md text-grey-6">权限设置</div> <div class="text-caption q-mb-lg q-px-md text-grey-6">权限设置</div>
<div class="row wrap"> <div class="row wrap">
<div class="q-pa-md q-gutter-sm"> <!-- <div class="q-pa-md q-gutter-sm">
<q-tree :nodes="TreeMenuList" node-key="MenuId" label-key="MenuName" children-key="SubList" <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> tick-strategy="leaf-filtered" default-expand-all :ticked.sync="checkMenuArray" no-connectors>
</q-tree> </q-tree>
</div> </div> -->
<select-tree v-if="TreeMenuList&&TreeMenuList.length>0" :treeData='TreeMenuList' :id.sync="returnString"
nodeKey="MenuId" :multiple="true" labelKey="MenuName" childrenKey="SubList" tipText="课程分类"
@getChild="getChild"></select-tree>
</div> </div>
</q-card-section> </q-card-section>
<q-separator /> <q-separator />
...@@ -41,6 +44,7 @@ ...@@ -41,6 +44,7 @@
queryRoleInfo, queryRoleInfo,
saveRoleInfo, saveRoleInfo,
} from '../../api/system/index' } from '../../api/system/index'
import selectTree from '../common/select-tree'
export default { export default {
props: { props: {
saveObj: { saveObj: {
...@@ -48,6 +52,9 @@ ...@@ -48,6 +52,9 @@
default: null default: null
} }
}, },
components: {
selectTree
},
data() { data() {
return { return {
persistent: true, persistent: true,
...@@ -58,6 +65,7 @@ ...@@ -58,6 +65,7 @@
RoleAuth: "", //角色权限 RoleAuth: "", //角色权限
Status: 0, //状态(0-正常,1-禁用)}, Status: 0, //状态(0-正常,1-禁用)},
}, },
returnString: "",
optionTitle: "", optionTitle: "",
//菜单列表 //菜单列表
TreeMenuList: [], TreeMenuList: [],
...@@ -71,7 +79,9 @@ ...@@ -71,7 +79,9 @@
this.initObj() this.initObj()
}, },
methods: { methods: {
getChild(obj) {
console.log("obj", obj);
},
//获取菜单列表 //获取菜单列表
queryMenuList() { queryMenuList() {
this.TreeMenuList = []; this.TreeMenuList = [];
......
...@@ -58,7 +58,7 @@ ...@@ -58,7 +58,7 @@
queryCourseCategoryTree, queryCourseCategoryTree,
} from '../../api/course/index' } from '../../api/course/index'
import courseForm from '../../components/course/course-form' import courseForm from '../../components/course/course-form'
import selectTree from '../../components/common/tree' import selectTree from '../../components/common/select-tree'
export default { export default {
meta: { meta: {
title: "课程管理" title: "课程管理"
......
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