提交 68a6d5df 编写于 作者: Neuromancer255's avatar Neuromancer255

多数据部件全选ui逻辑调整

上级 bb96071a
......@@ -43,10 +43,11 @@
<#--多数据视图||多数据视图(部件视图)-->
<template v-if="(viewType == 'DEMOBMDVIEW') && controlStyle != 'SWIPERVIEW' ">
<div class="selectall">
<ion-checkbox :checked="selectAllIschecked" v-show="showCheack" @ionChange="checkboxAll"></ion-checkbox>
<ion-label class="selectal-label" v-show="showCheack">全选</ion-label>
<van-checkbox class="checkAllBtn" v-model="selectAllIschecked" v-show="showCheack" @click="checkboxAll">全选</van-checkbox>
</div>
<ion-item-sliding :ref="item.srfkey" v-for="(item, index) in items" @click="item_click(item)" :key="index" class="app-mob-mdctrl-item">
<van-checkbox-group v-model="checkedResult" ref="checkboxGroup">
<van-cell-group>
<van-swipe-cell v-for="(item, index) in items" :key="index" class="app-mob-mdctrl-item">
<#-- BENGIN:输出界面行为组 -->
<@outPutActionGroup ctrl />
<#-- END:输出界面行为组 -->
......@@ -55,20 +56,27 @@
<@outPutItemLaoutPanel ctrl />
<#-- END:输出项布局面板 -->
<#else>
<ion-item>
<ion-checkbox :checked="item.checked" v-show="showCheack" @click.stop="checkboxSelect(item)"></ion-checkbox>
<van-cell :ref="item.srfkey" @click="item_click(item)">
<#--实体列表项集合-->
<#if ctrl.getPSDEListItems()??>
<!-- 列表视图样式 -->
<app-list-default <#if ctrl.getPSDEListItems()??>:dataItemNames = "[<#list ctrl.getPSDEListItems() as item><#if item.getDataItemName()??>'${item.getDataItemName()}',</#if></#list>]"</#if> :item="item" major="<#if appde.getMajorPSAppDEField()??>${appde.getMajorPSAppDEField().getCodeName()?lower_case}<#else>srfmajortext</#if>" v-if="controlStyle.substring(0,8) === 'LISTVIEW'"></app-list-default>
<!-- 图标视图样式 -->
<app-icon-list :item="item" v-if="controlStyle === 'ICONVIEW'"></app-icon-list>
<!-- 列表视图样式 -->
<app-list-default <#if ctrl.getPSDEListItems()??>:dataItemNames = "[<#list ctrl.getPSDEListItems() as item><#if item.getDataItemName()??>'${item.getDataItemName()}',</#if></#list>]"</#if> :item="item" major="<#if appde.getMajorPSAppDEField()??>${appde.getMajorPSAppDEField().getCodeName()?lower_case}<#else>srfmajortext</#if>" v-if="controlStyle.substring(0,8) === 'LISTVIEW'"></app-list-default>
<!-- 图标视图样式 -->
<app-icon-list :item="item" v-if="controlStyle === 'ICONVIEW'"></app-icon-list>
<template #right-icon>
<van-checkbox :checked="item.checked" v-show="showCheack" :name="item.mobentityname"/>
</template>
<#else>
<div>暂无数据</div>
<div>暂无数据</div>
</#if>
</ion-item>
</van-cell>
<template #right>
<van-button square type="danger" text="删除" style="height:100%" @click="remove([item])"/>
</template>
</#if>
</ion-item-sliding>
</van-swipe-cell>
</van-cell-group>
</van-checkbox-group>
<ion-button size="small" color="secondary" v-if="!isTempMode && !allLoaded" style ="position: relative;left: calc( 50% - 44px);" @click="loadBottom">{{$t('app.button.loadmore')}}</ion-button>
</template>
<template v-else-if="(viewType == 'DEMOBMDVIEW9')">
......
......@@ -565,26 +565,6 @@
return response;
}
/**
* 点击回调事件
*
* @memberof ${srfclassname('${ctrl.codeName}')}
*/
public item_click(item:any){
if(this.showCheack){
let count = this.selectedArray.findIndex((i) => {
return i.mobentityid == item.mobentityid;
});
if (count === -1) {
this.selectedArray.push(item);
} else {
this.selectedArray.splice(count, 1);
}
} else {
this.goPage(item)
}
}
/**
* 点击列表数据跳转
*
......@@ -743,6 +723,34 @@
*/
@Prop({default:false}) showCheack?: boolean;
/**
* 全选按钮选中状态
*
* @memberof ${srfclassname('${ctrl.name}')}
*/
public selectAllIschecked = false;
/**
* 列表项点击回调事件
*
* @memberof ${srfclassname('${ctrl.codeName}')}
*/
public item_click(item:any){
if(this.showCheack){
let count = this.selectedArray.findIndex((i) => {
return i.mobentityid == item.mobentityid;
});
if (count === -1) {
this.selectedArray.push(item);
} else {
this.selectedArray.splice(count, 1);
}
this.checkboxSelect(item)
} else {
this.goPage(item)
}
}
/**
* 选中或取消事件
*
......@@ -750,20 +758,20 @@
*/
public checkboxSelect(item:any){
let count = this.selectedArray.findIndex((i) => {
return i.${appde.getKeyPSAppDEField().getCodeName()?lower_case} == item.${appde.getKeyPSAppDEField().getCodeName()?lower_case};
return i.mobentityid == item.mobentityid;
});
let re = false;
let re = true;
if(count == -1){
re = true;
this.selectedArray.push(item);
}else{
this.selectedArray.splice(count,1);
re = false;
}
this.items.forEach((_item:any,index:number)=>{
if(_item.${appde.getKeyPSAppDEField().getCodeName()?lower_case} == item.${appde.getKeyPSAppDEField().getCodeName()?lower_case}){
if(_item.mobentityid == item.mobentityid){
this.items[index].checked = re;
}
});
console.log(this.items);
this.$forceUpdate();
}
}
/**
......@@ -771,8 +779,8 @@
*
* @memberof ${srfclassname('${ctrl.name}')}
*/
public checkboxAll(item:any) {
this.selectAllIschecked = item.detail.checked;
public checkboxAll() {
this.$refs.checkboxGroup.toggleAll();
if(this.selectAllIschecked){
this.selectedArray = JSON.parse(JSON.stringify(this.items));
}else{
......@@ -781,17 +789,27 @@
this.items.forEach((item:any,index:number)=>{
this.items[index].checked = this.selectAllIschecked
});
this.$forceUpdate();
}
/**
* 全选按钮选中状态
* 监听选中数组(全选,反选)
*
* @memberof ${srfclassname('${ctrl.name}')}
*/
public selectAllIschecked = false;
@Watch('selectedArray')
onItemSelectChange(newVal: any, oldVal: any) {
if (!newVal) {
return;
}
let flag = this.items.every((currVal: any)=>{
return currVal.checked === true
})
if(flag){
this.selectAllIschecked = true
} else {
this.selectAllIschecked = false
}
}
/**
* 关闭滑动项
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册