提交 e260161a 编写于 作者: tony001's avatar tony001

Merge branch 'dev'

.dropdown-list{
}
.app-switch{
.el-switch__core{
margin-right: 8px;
}
}
\ No newline at end of file
<template>
<el-switch v-model="curValue" :disabled ="disabled"></el-switch>
<div class="app-switch">
<el-switch v-model="curValue" :disabled ="disabled"></el-switch><span v-if="isShowText">{{text}}</span>
</div>
</template>
<script lang="ts">
......@@ -8,13 +11,29 @@ import { Vue, Component, Prop, Model } from 'vue-property-decorator';
@Component({})
export default class AppSwitch extends Vue {
/**
/**
* checked选中状态
*
* @type {boolean}
* @memberof Appswitch
*/
@Prop() public value?: any;
/**
* checked显示文本
*
* @type {boolean}
* @memberof Appswitch
*/
public text:string = "";
/**
* 是否显示文本
*
* @type {boolean}
* @memberof Appswitch
*/
@Prop() public isShowText?: boolean;
get curValue(){
return this.value == 1 ? true:false;
......@@ -23,17 +42,38 @@ export default class AppSwitch extends Vue {
set curValue(value:any){
let emitValue = value == true ? 1:0;
this.$emit('change',emitValue);
this.valueChange(value);
}
/**
* 禁用
*
* @type {boolean}
* @memberof Appswitch
*/
@Prop() public disabled?: boolean;
@Prop() public disabled?: boolean;
/**
* 生命周期
*
* @memberof Appswitch
*/
mounted(){
this.valueChange(this.curValue);
}
/**
* 文本更新
*
* @memberof Appswitch
*/
public valueChange(value:boolean) {
if(value){
this.text="是"
}else{
this.text="否"
}
}
}
</script>
......
import { CtrlBase } from './CtrlBase';
import { Emit } from 'vue-property-decorator';
import { Environment } from '@/environments/environment';
/**
* 应用菜单基类
......@@ -137,9 +138,29 @@ export class AppMenusCtrlBase extends CtrlBase {
*/
public load(data: any) {
this.menus = this.menuModel.getAppMenuItems();
if(Environment.enablePermissionValid){
this.computedEffectiveMenus(this.menus);
}
this.menusChange();
}
/**
* 计算有效菜单项
*
* @param {*} inputMenus
* @memberof Index
*/
public computedEffectiveMenus(inputMenus:Array<any>){
inputMenus.forEach((_item:any) =>{
if(!this.$store.getters['authresource/getAuthMenu'](_item)){
_item.hidden = true;
if (_item.items && _item.items.length > 0) {
this.computedEffectiveMenus(_item.items);
}
}
})
}
/**
* 菜单变更
*
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册