提交 49c0941c 编写于 作者: KK's avatar KK

卡片多选

上级 b0706344
......@@ -699,7 +699,7 @@
this.selectedArray.splice(count,1);
}
this.items.forEach((_item:any,index:number)=>{
if(_item.mobile_entity1id == item.mobile_entity1id){
if(_item.${appde.getKeyPSAppDEField().getCodeName()?lower_case} == item.${appde.getKeyPSAppDEField().getCodeName()?lower_case}){
this.items[index].checked = re;
}
});
......
......@@ -2,8 +2,14 @@
<div class = "card-view ">
<#if view.getViewType?? && view.getViewType()?? && view.getViewType() == 'DEMOBDATAVIEW'>
<ion-row >
<ion-col size="12" v-show="showCheack">
<div class="selectall">
<ion-checkbox :checked="selectAllIschecked" v-show="showCheack" @ionChange="checkboxAll"></ion-checkbox>
<ion-label class="selectal-label" v-show="showCheack">全选</ion-label>
</div>
</ion-col>
<ion-col :size="size" v-for="(item,index) in items" :key="index" @touchstart="start" @touchend="end">
<ion-checkbox v-show="showcheack" class="ionic-checkbox" @click.stop="checkboxSelect(item)"></ion-checkbox>
<ion-checkbox v-show="showCheack" class="ionic-checkbox" @click.stop="checkboxSelect(item)"></ion-checkbox>
<ion-card :class="[size == '12'? 'ios hydrated ibz-card-12':' ios hydrated ibz-card-6']">
<div :class="{'line':size == '12'}">
<img class="cardimg" :style="{width :size == '6' ?'':'30%'}" src="assets/images/card.jpg" />
......@@ -20,7 +26,7 @@
</#if>
</div>
</div>
<ion-icon v-show="!showcheack" :style="{color :size == '6' ?'#fff':'#333'}" @click="remove([item])" class="card-delete" name="close-outline"></ion-icon>
<ion-icon v-show="!showCheack" :style="{color :size == '6' ?'#fff':'#333'}" @click="remove([item])" class="card-delete" name="close-outline"></ion-icon>
</ion-card>
</ion-col>
</ion-row>
......
......@@ -647,7 +647,8 @@
*
* @memberof ${srfclassname('${ctrl.name}')}
*/
public showcheack = false;
@Prop({default:false}) showCheack?: boolean;
/**
* 选中或取消事件
......@@ -656,13 +657,20 @@
*/
public checkboxSelect(item:any){
let count = this.selectedArray.findIndex((i) => {
return i.mobile_entity1id == item.mobile_entity1id;
return i.${appde.getKeyPSAppDEField().getCodeName()?lower_case} == item.${appde.getKeyPSAppDEField().getCodeName()?lower_case};
});
let re = false;
if(count == -1){
re = true;
this.selectedArray.push(item);
}else{
this.selectedArray.splice(count,1);
}
this.items.forEach((_item: any, index: number) => {
if (_item.${appde.getKeyPSAppDEField().getCodeName()?lower_case} == ${appde.getKeyPSAppDEField().getCodeName()?lower_case}) {
this.items[index].checked = re;
}
});
}
/**
......@@ -680,7 +688,7 @@
public start () {
      clearTimeout(this.loop); //再次清空定时器,防止重复注册定时器
      this.loop = setTimeout(() => {
this.showcheack = ! this.showcheack;
this.$emit("showCheackChange", !this.showCheack);
      }, 1000);
    }
......@@ -693,6 +701,32 @@
clearTimeout(this.loop); //清空定时器,防止重复注册定时器
}
/**
* 全选事件
*
* @memberof ${srfclassname('${ctrl.name}')}
*/
public checkboxAll(item:any) {
this.selectAllIschecked = item.detail.checked;
if(this.selectAllIschecked){
this.selectedArray = JSON.parse(JSON.stringify(this.items));
}else{
this.selectedArray = [];
}
this.items.forEach((item:any,index:number)=>{
this.items[index].checked = this.selectAllIschecked
});
this.$forceUpdate();
}
/**
* 全选按钮选中状态
*
* @memberof ${srfclassname('${ctrl.name}')}
*/
public selectAllIschecked = false;
<#ibizinclude>
../@MACRO/CONTROL/CONTROL_BOTTOM-BASE.vue.ftl
</#ibizinclude>
......
......@@ -7,6 +7,8 @@
loadAction="<#if ctrl.getGetPSControlAction?? && ctrl.getGetPSControlAction()?? && ctrl.getGetPSControlAction().getPSAppDEMethod()??>${ctrl.getGetPSControlAction().getPSAppDEMethod().getCodeName()}</#if>"
createAction="<#if ctrl.getCreatePSControlAction?? && ctrl.getCreatePSControlAction()?? && ctrl.getCreatePSControlAction().getPSAppDEMethod()??>${ctrl.getCreatePSControlAction().getPSAppDEMethod().getCodeName()}</#if>"
fetchAction="<#if ctrl.getFetchPSControlAction?? && ctrl.getFetchPSControlAction()?? && ctrl.getFetchPSControlAction().getPSAppDEMethod()??>${ctrl.getFetchPSControlAction().getPSAppDEMethod().getCodeName()}</#if>"
:showCheack="showCheack"
@showCheackChange="showCheackChange"
</#assign>
<#ibizinclude>
../@MACRO/HTML/DEFAULT.html.ftl
......
......@@ -42,4 +42,11 @@
position: absolute;
top: calc(50% - 13px);
}
.selectall{
padding: 0;
display: flex;
}
.selectal-label{
padding-left: 15px;
}
}
\ No newline at end of file
......@@ -98,6 +98,30 @@
}
}
/**
* 多选状态改变事件
*
* @memberof ${srfclassname('${view.name}')}Base
*/
public showCheackChange(value:any){
this.showCheack = value;
}
/**
* 多选状态
*
* @memberof ${srfclassname('${view.name}')}Base
*/
public showCheack = false;
/**
* 取消选择状态
* @memberof ${srfclassname('${view.name}')}Base
*/
public cancelSelect() {
this.showCheackChange(false);
}
<#ibizinclude>
../@MACRO/VIEW_BOTTOM-BASE.vue.ftl
</#ibizinclude>
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册