提交 1effe25d 编写于 作者: hudan's avatar hudan

多选逻辑调整

上级 b5682af3
......@@ -11,7 +11,13 @@
<ion-list class="items" ref="ionlist" <#if ctrl.getBatchPSDEToolbar?? && ctrl.getBatchPSDEToolbar()??>@touchmove="gotouchmove" @touchstart="gotouchstart" @touchend="gotouchend"</#if>>
<template v-if="(viewType == 'DEMOBMDVIEW9') && controlStyle != 'SWIPERVIEW' ">
<#if ctrl.getBatchPSDEToolbar?? && ctrl.getBatchPSDEToolbar()??>
<ion-checkbox slot="start" :checked="item.checked" v-show="isChoose" @click.stop="checkboxSelect(item)"></ion-checkbox>
<app-mob-icon
v-show="isChoose"
position="start"
:name=" item.checked ? 'checkmark-circle-outline' : 'ellipse-outline' "
class="select-icon"
@onClick="checkboxSelect(item)"
></app-mob-icon>
</#if>
${ctrl.render.code}
<app-mob-button
......@@ -29,13 +35,25 @@
<#--多数据视图||多数据视图(部件视图)-->
<template v-if="(viewType == 'DEMOBMDVIEW') && controlStyle != 'SWIPERVIEW' ">
<#if ctrl.getBatchPSDEToolbar?? && ctrl.getBatchPSDEToolbar()??>
<ion-checkbox slot="start" :checked="item.checked" v-show="isChoose" @click.stop="checkboxSelect(item)"></ion-checkbox>
<app-mob-icon
v-show="isChoose"
position="start"
:name=" item.checked ? 'checkmark-circle-outline' : 'ellipse-outline' "
class="select-icon"
@onClick="checkboxSelect(item)"
></app-mob-icon>
</#if>
${ctrl.render.code}
</template>
<template v-else-if="(viewType == 'DEMOBMDVIEW9')">
<#if ctrl.getBatchPSDEToolbar?? && ctrl.getBatchPSDEToolbar()??>
<ion-checkbox slot="start" :checked="item.checked" v-show="isChoose" @click.stop="checkboxSelect(item)"></ion-checkbox>
<app-mob-icon
v-show="isChoose"
position="start"
:name=" item.checked ? 'checkmark-circle-outline' : 'ellipse-outline' "
class="select-icon"
@onClick="checkboxSelect(item)"
></app-mob-icon>
</#if>
${ctrl.render.code}
</template>
......
......@@ -954,26 +954,28 @@
* @memberof ${srfclassname('${ctrl.name}')}
*/
public checkboxSelect(item:any){
item.checked = !item.checked;
let count = this.selectedArray.findIndex((i) => {
return i.${appde.getKeyPSAppDEField().getCodeName()?lower_case} == item.${appde.getKeyPSAppDEField().getCodeName()?lower_case};
});
let tempFalg = false;
if(count == -1){
tempFalg = 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} == item.${appde.getKeyPSAppDEField().getCodeName()?lower_case}){
this.items[index].checked = tempFalg;
this.items[index].checked = item.checked;
}
});
if(!item.checked){
this.$emit("checkBoxChange",false)
}else if(this.selectedArray.length == this.items.length){
this.$emit("checkBoxChange",true)
if(this.selectedArray.length == this.items.length){
this.$emit("checkBoxChange",{isSelectAll:true,isSelectSome:true})
}else if(this.selectedArray.length == 0){
this.$emit("checkBoxChange",{isSelectAll:false,isSelectSome:false})
}else{
this.$emit("checkBoxChange",{isSelectAll:false,isSelectSome:true})
}
this.$forceUpdate();
}
/**
......
......@@ -66,6 +66,9 @@
padding: 0;
background-color: transparent;
}
.select-icon{
font-size: 32px;
}
}
.no-data{
position: absolute;
......
......@@ -60,7 +60,12 @@ ${P.getCtrlCode('mdctrl', 'CONTROL.html').code}
<#assign batchToolbar = mdctrl.getBatchPSDEToolbar()>
<div v-show="isChoose" class="batch_btn">
<div class="selectall" v-show="isChoose">
<ion-checkbox ref="selectAll" :checked="isSelectAll" @click="onSelectallClick(!isSelectAll)" ></ion-checkbox>
<app-mob-icon
position="start"
:name=" isSelectAll? 'checkmark-circle-outline' : isSelectSome? 'remove-circle-outline' : 'ellipse-outline' "
class="selectall-icon"
@onClick="onSelectallClick(isSelectAll)"
></app-mob-icon>
<ion-label class="selectal-label">全选</ion-label>
</div>
<div class="batch_btn_content">
......
......@@ -26,6 +26,9 @@
font-size: 13px;
color: @color-main-color;
}
.selectall-icon{
font-size: 32px;
}
}
.mdview-tools-select{
display: flex;
......
......@@ -425,13 +425,12 @@
* @memberof ${srfclassname('${view.name}')}Base
*/
public onSelectallClick(value: any) {
value = !value;
this.isSelectAll = value;
if(!this.isSelectAll){
this.isSelectSome = false;
}
setTimeout(() => {
this.isSelectAll = value;
let selectAlls: any = this.$refs.selectAll;
if (selectAlls) {
selectAlls.checked = value;
selectAlls.ariaChecked = value;
}
let mdctrl: any = this.$refs.mdctrl;
if (mdctrl && mdctrl.checkboxAll && this.$util.isFunction(mdctrl.checkboxAll)) {
mdctrl.checkboxAll(value);
......@@ -447,18 +446,21 @@
*/
public isSelectAll:boolean = false;
/**
* 是否选择一部分
*
* @memberof ${srfclassname('${view.name}')}Base
*/
public isSelectSome:boolean = false;
/**
* 单check改变
*
* @memberof ${srfclassname('${view.name}')}Base
*/
public checkBoxChange(value: any) {
let selectAll: any = this.$refs.selectAll;
if (selectAll) {
selectAll.checked = value;
selectAll.ariaChecked = value;
}
this.isSelectAll = value;
this.isSelectAll = value.isSelectAll;
this.isSelectSome = value.isSelectSome;
this.$forceUpdate();
}
</#if>
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册