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

zpc --- 快速分组计数器支持

上级 7dc2b05b
...@@ -5,14 +5,14 @@ ...@@ -5,14 +5,14 @@
<i v-if=" item.iconcls && !Object.is(item.iconcls, '')" :class="item.iconcls"></i> <i v-if=" item.iconcls && !Object.is(item.iconcls, '')" :class="item.iconcls"></i>
<img v-else-if="item.icon && !Object.is(item.icon, '')" :src="item.icon" /> <img v-else-if="item.icon && !Object.is(item.icon, '')" :src="item.icon" />
<span class="app-quick-item-label">{{item.label}}</span> <span class="app-quick-item-label">{{item.label}}</span>
<span v-show="isSelectedItem(item)" class="app-quick-item-counter">0</span> <span v-show="isSelectedItem(item) && counterService && counterService.counterData && counterService.counterData[item.codename]" class="app-quick-item-counter">{{itemTag(item)}}</span>
</span> </span>
<el-dropdown v-if="item.children" style="outline: none !important;" trigger="click" @command="handleCommand($event,item)"> <el-dropdown v-if="item.children" style="outline: none !important;" trigger="click" @command="handleCommand($event,item)">
<span :style="{color:item.color}" :class="{'app-seleted-item':isSelectedItem(item)}"> <span :style="{color:item.color}" :class="{'app-seleted-item':isSelectedItem(item)}">
<i v-if=" item.iconcls && !Object.is(item.iconcls, '')" :class="item.iconcls"></i> <i v-if=" item.iconcls && !Object.is(item.iconcls, '')" :class="item.iconcls"></i>
<img v-else-if="item.icon && !Object.is(item.icon, '')" :src="item.icon" /> <img v-else-if="item.icon && !Object.is(item.icon, '')" :src="item.icon" />
<span class="app-quick-item-label">{{item.label}}</span> <span class="app-quick-item-label">{{item.label}}</span>
<span v-show="isSelectedItem(item)" class="app-quick-item-counter">0</span> <span v-show="isSelectedItem(item) && counterService && counterService.counterData && counterService.counterData[item.codename]" class="app-quick-item-counter">{{itemTag(item)}}</span>
</span> </span>
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown">
<el-dropdown-item v-for="childitem in item.children" :command="childitem" :key="childitem.id"> <el-dropdown-item v-for="childitem in item.children" :command="childitem" :key="childitem.id">
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
<script lang="ts"> <script lang="ts">
import { Vue, Component, Prop, Model, Emit } from "vue-property-decorator"; import { Vue, Component, Prop, Model, Emit } from "vue-property-decorator";
import CounterService from "@/counter/counter-service";
@Component({}) @Component({})
export default class AppQuickGroup extends Vue { export default class AppQuickGroup extends Vue {
...@@ -48,23 +47,7 @@ export default class AppQuickGroup extends Vue { ...@@ -48,23 +47,7 @@ export default class AppQuickGroup extends Vue {
* @type {string} * @type {string}
* @memberof AppQuickGroup * @memberof AppQuickGroup
*/ */
@Prop() public counterName?:string; @Prop() public counterService?:any;
/**
* 计数器服务基类
*
* @type {any}
* @memberof AppQuickGroup
*/
public counterService:any = new CounterService();
/**
* 当前计数器服务
*
* @type {any}
* @memberof AppQuickGroup
*/
public curCounterService:any;
/** /**
* UI选中项 * UI选中项
...@@ -90,6 +73,14 @@ export default class AppQuickGroup extends Vue { ...@@ -90,6 +73,14 @@ export default class AppQuickGroup extends Vue {
} }
} }
public itemTag(item:any){
if(this.counterService && this.counterService.counterData && item.codename){
return this.counterService.counterData[item.codename];
}else{
return "";
}
}
/** /**
* 是否选中当前项 * 是否选中当前项
* *
...@@ -170,6 +161,7 @@ export default class AppQuickGroup extends Vue { ...@@ -170,6 +161,7 @@ export default class AppQuickGroup extends Vue {
*/ */
public handleCommand($event:any,item:any){ public handleCommand($event:any,item:any){
item.label = $event.label; item.label = $event.label;
item.codename = $event.codename;
this.handleClick($event,false); this.handleClick($event,false);
} }
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册