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

多数据调整

上级 a71b191a
...@@ -83,9 +83,9 @@ ...@@ -83,9 +83,9 @@
@Prop({default: '<#if ctrl.getMobListStyle?? && ctrl.getMobListStyle()??>${ctrl.getMobListStyle()}</#if>'}) protected controlStyle!: string | 'ICONVIEW' | 'LISTVIEW' | 'SWIPERVIEW' | 'LISTVIEW2' | 'LISTVIEW3' | 'LISTVIEW4'; @Prop({default: '<#if ctrl.getMobListStyle?? && ctrl.getMobListStyle()??>${ctrl.getMobListStyle()}</#if>'}) protected controlStyle!: string | 'ICONVIEW' | 'LISTVIEW' | 'SWIPERVIEW' | 'LISTVIEW2' | 'LISTVIEW3' | 'LISTVIEW4';
/** /**
*上级传递的选中项 * 上级传递的选中项
*@type {Array} * @type {Array}
*@memberof ${srfclassname('${ctrl.codeName}')} * @memberof ${srfclassname('${ctrl.codeName}')}
*/ */
@Prop() public selectedData?:Array<any>; @Prop() public selectedData?:Array<any>;
...@@ -114,15 +114,6 @@ ...@@ -114,15 +114,6 @@
*/ */
@Prop() public opendata?: Function; @Prop() public opendata?: Function;
/**
* 当前选中数组
*
* @type {array}
* @memberof ${srfclassname('${ctrl.codeName}')}
*/
public selectdata :any = [];
/** /**
* 加载显示状态 * 加载显示状态
* *
...@@ -259,37 +250,6 @@ ...@@ -259,37 +250,6 @@
*/ */
public radio:any = ''; public radio:any = '';
/**
* 点击多选按钮触发
*
*
* @memberof ${srfclassname('${ctrl.codeName}')}
*/
public change(){
if(this.isMutli){
let checkboxLists= this.items.filter((item,index)=>{
if(this.checkboxList.indexOf(item.srfkey)!=-1){
return true;
}else{
return false;
}
})
this.$emit('selectchange',checkboxLists);
}else{
let radioItem = this.items.filter((item,index)=>{return item.srfkey==this.radio});
this.$emit('selectchange',radioItem);
}
}
/**
* 列表键值对
*
* @type {Map}
* @memberof ${srfclassname('${ctrl.codeName}')}
*/
public listMap: any = new Map();
/** /**
* 分页大小 * 分页大小
* *
...@@ -346,7 +306,7 @@ ...@@ -346,7 +306,7 @@
* @param {Array<any>} * @param {Array<any>}
* @memberof ${srfclassname('${ctrl.codeName}')} * @memberof ${srfclassname('${ctrl.codeName}')}
*/ */
public selectedArray:Array<any> = []; public selectdata:Array<any> = [];
/** /**
* 多选计数 * 多选计数
...@@ -354,7 +314,7 @@ ...@@ -354,7 +314,7 @@
* @param {number} * @param {number}
* @memberof ${srfclassname('${ctrl.codeName}')} * @memberof ${srfclassname('${ctrl.codeName}')}
*/ */
public selectednumber:number =0; public selectednumber:number = 0;
/** /**
* 搜索行为 * 搜索行为
...@@ -652,35 +612,6 @@ ...@@ -652,35 +612,6 @@
} }
</#if> </#if>
/**
* checkbox 选中回调
*
* @param {*} data
* @returns
* @memberof ${srfclassname('${ctrl.codeName}')}
*/
public checkboxChange(data: any) {
let { detail } = data;
if (!detail) {
return;
}
let { value } = detail;
this.selectednumber = 0;
this.items.forEach((item: any, index: number) => {
if (item.value) {
this.selectednumber++;
}
if (Object.is(item.${appde.getKeyPSAppDEField().getCodeName()?lower_case}, value)) {
if (detail.checked) {
this.selectdata.push(this.items[index]);
} else {
this.selectdata.splice(this.selectdata.findIndex((i: any) => i.value === item.value), 1)
}
}
});
this.$emit('selectionchange', this.selectdata);
}
/** /**
* 下拉刷新 * 下拉刷新
* *
...@@ -705,13 +636,13 @@ ...@@ -705,13 +636,13 @@
*/ */
public item_click(item:any){ public item_click(item:any){
if(this.isChoose){ if(this.isChoose){
let count = this.selectedArray.findIndex((i) => { let count = this.selectdata.findIndex((i) => {
return i.mobentityid == item.mobentityid; return i.mobentityid == item.mobentityid;
}); });
if (count === -1) { if (count === -1) {
this.selectedArray.push(item); this.selectdata.push(item);
} else { } else {
this.selectedArray.splice(count, 1); this.selectdata.splice(count, 1);
} }
} else { } else {
this.goPage(item) this.goPage(item)
...@@ -733,7 +664,7 @@ ...@@ -733,7 +664,7 @@
* @memberof ${srfclassname('${ctrl.codeName}')} * @memberof ${srfclassname('${ctrl.codeName}')}
*/ */
public getDatas(): any[] { public getDatas(): any[] {
return this.service.handleRequestDatas(this.context,this.selectedArray); return this.service.handleRequestDatas(this.context,this.selectdata);
} }
/** /**
...@@ -742,7 +673,7 @@ ...@@ -742,7 +673,7 @@
* @memberof ${srfclassname('${ctrl.codeName}')} * @memberof ${srfclassname('${ctrl.codeName}')}
*/ */
public getData(): any { public getData(): any {
return this.selectedArray[0]; return this.selectdata[0];
} }
/** /**
...@@ -896,8 +827,8 @@ ...@@ -896,8 +827,8 @@
*/ */
public mdctrl_click($event: any, tag: any, item: any): void { public mdctrl_click($event: any, tag: any, item: any): void {
$event.stopPropagation(); $event.stopPropagation();
this.selectedArray = []; this.selectdata = [];
this.selectedArray.push(item); this.selectdata.push(item);
<#if ctrl.getPSDEUIActionGroup()?? && ctrl.getPSDEUIActionGroup().getPSUIActionGroupDetails()??> <#if ctrl.getPSDEUIActionGroup()?? && ctrl.getPSDEUIActionGroup().getPSUIActionGroupDetails()??>
<#assign details = ctrl.getPSDEUIActionGroup().getPSUIActionGroupDetails()> <#assign details = ctrl.getPSDEUIActionGroup().getPSUIActionGroupDetails()>
<#list details as detail> <#list details as detail>
...@@ -936,7 +867,7 @@ ...@@ -936,7 +867,7 @@
public onSimpleSelChange(item: any = {}) { public onSimpleSelChange(item: any = {}) {
this.$emit('selectionchange', [item]); this.$emit('selectionchange', [item]);
this.selectedValue = item.srfkey; this.selectedValue = item.srfkey;
this.selectedArray = []; this.selectdata = [];
this.goPage(item); this.goPage(item);
} }
...@@ -954,27 +885,17 @@ ...@@ -954,27 +885,17 @@
* @memberof ${srfclassname('${ctrl.name}')} * @memberof ${srfclassname('${ctrl.name}')}
*/ */
public checkboxSelect(item:any){ public checkboxSelect(item:any){
item.checked = !item.checked; item.checked = !item.checked
let count = this.selectedArray.findIndex((i) => { let count = this.selectdata.findIndex((_item:any) => {
return i.${appde.getKeyPSAppDEField().getCodeName()?lower_case} == item.${appde.getKeyPSAppDEField().getCodeName()?lower_case}; return _item.${appde.getKeyPSAppDEField().getCodeName()?lower_case} == item.${appde.getKeyPSAppDEField().getCodeName()?lower_case};
}); });
if(count == -1){ if(count == -1){
this.selectedArray.push(item); this.selectdata.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 = item.checked;
}
});
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{ }else{
this.$emit("checkBoxChange",{isSelectAll:false,isSelectSome:true}) this.selectdata.splice(count , 1);
} }
let _count = Object.is(this.items.length , this.selectdata.length)? 1 : this.selectdata.length > 0 ? 2 : 0;
this.$emit("checkBoxChange", _count)
this.$forceUpdate(); this.$forceUpdate();
} }
...@@ -989,9 +910,9 @@ ...@@ -989,9 +910,9 @@
this.items[index].checked = value; this.items[index].checked = value;
} }
if(value){ if(value){
this.selectedArray = [...this.items]; this.selectdata = [...this.items];
}else{ }else{
this.selectedArray = []; this.selectdata = [];
} }
this.$forceUpdate(); this.$forceUpdate();
} }
......
...@@ -62,9 +62,9 @@ ${P.getCtrlCode('mdctrl', 'CONTROL.html').code} ...@@ -62,9 +62,9 @@ ${P.getCtrlCode('mdctrl', 'CONTROL.html').code}
<div class="selectall" v-show="isChoose"> <div class="selectall" v-show="isChoose">
<app-mob-icon <app-mob-icon
position="start" position="start"
:name=" isSelectAll? 'checkmark-circle-outline' : isSelectSome? 'remove-circle-outline' : 'ellipse-outline' " :name=" this.selectAllStatus > 1? 'remove-circle-outline' : this.selectAllStatus < 1? 'ellipse-outline' : 'checkmark-circle-outline' "
class="selectall-icon" class="selectall-icon"
@onClick="onSelectallClick(isSelectAll)" @onClick="onSelectallClick"
></app-mob-icon> ></app-mob-icon>
<ion-label class="selectal-label">全选</ion-label> <ion-label class="selectal-label">全选</ion-label>
</div> </div>
......
...@@ -424,34 +424,20 @@ ...@@ -424,34 +424,20 @@
* *
* @memberof ${srfclassname('${view.name}')}Base * @memberof ${srfclassname('${view.name}')}Base
*/ */
public onSelectallClick(value: any) { public onSelectallClick() {
value = !value; this.selectAllStatus > 0 ? this.selectAllStatus = 0 :this.selectAllStatus = 1;
this.isSelectAll = value;
if(!this.isSelectAll){
this.isSelectSome = false;
}
setTimeout(() => {
let mdctrl: any = this.$refs.mdctrl; let mdctrl: any = this.$refs.mdctrl;
if (mdctrl && mdctrl.checkboxAll && this.$util.isFunction(mdctrl.checkboxAll)) { if (mdctrl && mdctrl.checkboxAll && this.$util.isFunction(mdctrl.checkboxAll)) {
mdctrl.checkboxAll(value); mdctrl.checkboxAll(this.selectAllStatus>0?true:false);
} }
}, 1);
this.$forceUpdate();
} }
/** /**
* 是否全选 * 全选按钮状态 0 未选中 1选中 2部分选中
*
* @memberof ${srfclassname('${view.name}')}Base
*/
public isSelectAll:boolean = false;
/**
* 是否选择一部分
* *
* @memberof ${srfclassname('${view.name}')}Base * @memberof ${srfclassname('${view.name}')}Base
*/ */
public isSelectSome:boolean = false; public selectAllStatus: 0 | 1 | 2 = 0 ;
/** /**
* 单check改变 * 单check改变
...@@ -459,9 +445,7 @@ ...@@ -459,9 +445,7 @@
* @memberof ${srfclassname('${view.name}')}Base * @memberof ${srfclassname('${view.name}')}Base
*/ */
public checkBoxChange(value: any) { public checkBoxChange(value: any) {
this.isSelectAll = value.isSelectAll; this.selectAllStatus = value;
this.isSelectSome = value.isSelectSome;
this.$forceUpdate();
} }
</#if> </#if>
</#if> </#if>
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册