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

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

This reverts commit 68a6d5df.
上级 86540b71
...@@ -43,11 +43,10 @@ ...@@ -43,11 +43,10 @@
<#--多数据视图||多数据视图(部件视图)--> <#--多数据视图||多数据视图(部件视图)-->
<template v-if="(viewType == 'DEMOBMDVIEW') && controlStyle != 'SWIPERVIEW' "> <template v-if="(viewType == 'DEMOBMDVIEW') && controlStyle != 'SWIPERVIEW' ">
<div class="selectall"> <div class="selectall">
<van-checkbox class="checkAllBtn" v-model="selectAllIschecked" v-show="showCheack" @click="checkboxAll">全选</van-checkbox> <ion-checkbox :checked="selectAllIschecked" v-show="showCheack" @ionChange="checkboxAll"></ion-checkbox>
<ion-label class="selectal-label" v-show="showCheack">全选</ion-label>
</div> </div>
<van-checkbox-group v-model="checkedResult" ref="checkboxGroup"> <ion-item-sliding :ref="item.srfkey" v-for="(item, index) in items" @click="item_click(item)" :key="index" class="app-mob-mdctrl-item">
<van-cell-group>
<van-swipe-cell v-for="(item, index) in items" :key="index" class="app-mob-mdctrl-item">
<#-- BENGIN:输出界面行为组 --> <#-- BENGIN:输出界面行为组 -->
<@outPutActionGroup ctrl /> <@outPutActionGroup ctrl />
<#-- END:输出界面行为组 --> <#-- END:输出界面行为组 -->
...@@ -56,27 +55,20 @@ ...@@ -56,27 +55,20 @@
<@outPutItemLaoutPanel ctrl /> <@outPutItemLaoutPanel ctrl />
<#-- END:输出项布局面板 --> <#-- END:输出项布局面板 -->
<#else> <#else>
<van-cell :ref="item.srfkey" @click="item_click(item)"> <ion-item>
<ion-checkbox :checked="item.checked" v-show="showCheack" @click.stop="checkboxSelect(item)"></ion-checkbox>
<#--实体列表项集合--> <#--实体列表项集合-->
<#if ctrl.getPSDEListItems()??> <#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-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-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> <#else>
<div>暂无数据</div> <div>暂无数据</div>
</#if> </#if>
</van-cell> </ion-item>
<template #right>
<van-button square type="danger" text="删除" style="height:100%" @click="remove([item])"/>
</template>
</#if> </#if>
</van-swipe-cell> </ion-item-sliding>
</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> <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>
<template v-else-if="(viewType == 'DEMOBMDVIEW9')"> <template v-else-if="(viewType == 'DEMOBMDVIEW9')">
......
...@@ -565,6 +565,26 @@ ...@@ -565,6 +565,26 @@
return response; 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)
}
}
/** /**
* 点击列表数据跳转 * 点击列表数据跳转
* *
...@@ -723,34 +743,6 @@ ...@@ -723,34 +743,6 @@
*/ */
@Prop({default:false}) showCheack?: boolean; @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)
}
}
/** /**
* 选中或取消事件 * 选中或取消事件
* *
...@@ -758,20 +750,20 @@ ...@@ -758,20 +750,20 @@
*/ */
public checkboxSelect(item:any){ public checkboxSelect(item:any){
let count = this.selectedArray.findIndex((i) => { let count = this.selectedArray.findIndex((i) => {
return i.mobentityid == item.mobentityid; return i.${appde.getKeyPSAppDEField().getCodeName()?lower_case} == item.${appde.getKeyPSAppDEField().getCodeName()?lower_case};
}); });
let re = true; let re = false;
if(count == -1){ if(count == -1){
re = false; re = true;
this.selectedArray.push(item);
}else{
this.selectedArray.splice(count,1);
} }
this.items.forEach((_item:any,index:number)=>{ this.items.forEach((_item:any,index:number)=>{
if(_item.mobentityid == item.mobentityid){ if(_item.${appde.getKeyPSAppDEField().getCodeName()?lower_case} == item.${appde.getKeyPSAppDEField().getCodeName()?lower_case}){
this.items[index].checked = re; this.items[index].checked = re;
} }
}); });
console.log(this.items);
this.$forceUpdate();
}
} }
/** /**
...@@ -779,8 +771,8 @@ ...@@ -779,8 +771,8 @@
* *
* @memberof ${srfclassname('${ctrl.name}')} * @memberof ${srfclassname('${ctrl.name}')}
*/ */
public checkboxAll() { public checkboxAll(item:any) {
this.$refs.checkboxGroup.toggleAll(); this.selectAllIschecked = item.detail.checked;
if(this.selectAllIschecked){ if(this.selectAllIschecked){
this.selectedArray = JSON.parse(JSON.stringify(this.items)); this.selectedArray = JSON.parse(JSON.stringify(this.items));
}else{ }else{
...@@ -789,27 +781,17 @@ ...@@ -789,27 +781,17 @@
this.items.forEach((item:any,index:number)=>{ this.items.forEach((item:any,index:number)=>{
this.items[index].checked = this.selectAllIschecked this.items[index].checked = this.selectAllIschecked
}); });
this.$forceUpdate();
} }
/** /**
* 监听选中数组(全选,反选) * 全选按钮选中状态
* *
* @memberof ${srfclassname('${ctrl.name}')} * @memberof ${srfclassname('${ctrl.name}')}
*/ */
@Watch('selectedArray') public selectAllIschecked = false;
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 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册