提交 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> <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> </template>
<script lang="ts"> <script lang="ts">
...@@ -16,6 +19,22 @@ export default class AppSwitch extends Vue { ...@@ -16,6 +19,22 @@ export default class AppSwitch extends Vue {
*/ */
@Prop() public value?: any; @Prop() public value?: any;
/**
* checked显示文本
*
* @type {boolean}
* @memberof Appswitch
*/
public text:string = "";
/**
* 是否显示文本
*
* @type {boolean}
* @memberof Appswitch
*/
@Prop() public isShowText?: boolean;
get curValue(){ get curValue(){
return this.value == 1 ? true:false; return this.value == 1 ? true:false;
} }
...@@ -23,6 +42,7 @@ export default class AppSwitch extends Vue { ...@@ -23,6 +42,7 @@ export default class AppSwitch extends Vue {
set curValue(value:any){ set curValue(value:any){
let emitValue = value == true ? 1:0; let emitValue = value == true ? 1:0;
this.$emit('change',emitValue); this.$emit('change',emitValue);
this.valueChange(value);
} }
/** /**
...@@ -33,7 +53,27 @@ export default class AppSwitch extends Vue { ...@@ -33,7 +53,27 @@ export default class AppSwitch extends Vue {
*/ */
@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> </script>
......
import { CtrlBase } from './CtrlBase'; import { CtrlBase } from './CtrlBase';
import { Emit } from 'vue-property-decorator'; import { Emit } from 'vue-property-decorator';
import { Environment } from '@/environments/environment';
/** /**
* 应用菜单基类 * 应用菜单基类
...@@ -137,9 +138,29 @@ export class AppMenusCtrlBase extends CtrlBase { ...@@ -137,9 +138,29 @@ export class AppMenusCtrlBase extends CtrlBase {
*/ */
public load(data: any) { public load(data: any) {
this.menus = this.menuModel.getAppMenuItems(); this.menus = this.menuModel.getAppMenuItems();
if(Environment.enablePermissionValid){
this.computedEffectiveMenus(this.menus);
}
this.menusChange(); 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 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册