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

多数据批操作事件 & 删除冗余

上级 9bc792b9
......@@ -114,13 +114,6 @@
*/
@Prop() public opendata?: Function;
/**
* 是否能长按
*
* @type {Function}
* @memberof Mob
*/
@Prop({ default: true }) public isEnableChoose?: Boolean;
/**
* 当前选中数组
......@@ -532,19 +525,6 @@
${P.getCtrlCode(quickToolbar, 'CONTROL.vue').code}
</#if>
/**
* 长按
*
* @memberof ${srfclassname('${ctrl.codeName}')}
*/
public onPress(){
let _this = this;
// window.addEventListener('contextmenu',(e:any)=>{
// _this.onCheackChange();
// e.preventDefault();
// });
}
/**
* 长按状态改变事件
*
......@@ -804,9 +784,6 @@
* @memberof ${srfclassname('${ctrl.codeName}')}
*/
public created() {
if (this.isEnableChoose) {
this.onPress();
}
this.afterCreated();
}
......@@ -1025,46 +1002,43 @@
let count = this.selectedArray.findIndex((i) => {
return i.${appde.getKeyPSAppDEField().getCodeName()?lower_case} == item.${appde.getKeyPSAppDEField().getCodeName()?lower_case};
});
let re = false;
let tempFalg = false;
if(count == -1){
re = true;
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 = re;
this.items[index].checked = tempFalg;
}
});
if(!item.checked){
this.$emit("checkBoxChange",false)
}else if(this.selectedArray.length == this.items.length){
this.$emit("checkBoxChange",true)
}
}
/**
* 全选事件
*
* @memberof ${srfclassname('${ctrl.name}')}
*/
public checkboxAll(item:any) {
this.selectAllIschecked = item.detail.checked;
if(this.selectAllIschecked){
this.selectedArray = JSON.parse(JSON.stringify(this.items));
for (let index = 0; index < this.items.length; index++) {
const item = this.items[index];
this.items[index].checked = value;
}
if(value){
this.selectedArray = [...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;
<#macro getAction item actionName>
<#t>
<#if item.getPSDEUIActionGroup2()?? && item.getPSDEUIActionGroup2()??><#if item.getPSDEUIActionGroup2().getPSUIActionGroupDetails?? && item.getPSDEUIActionGroup2().getPSUIActionGroupDetails()??><#list item.getPSDEUIActionGroup2().getPSUIActionGroupDetails() as action><#if action.getPSUIAction().getCodeName()== actionName>isShowCaption:${action.isShowCaption()?c},isShowIcon:${action.isShowIcon()?c}</#if></#list></#if></#if><#t>
......
<#-- content -->
<#assign content>
:showBusyIndicator="${ctrl.isShowBusyIndicator()?c}"
viewType="${view.getViewType()}"
controlStyle="<#if ctrl.getControlStyle?? && ctrl.getControlStyle()??>${ctrl.getControlStyle()}</#if>"
updateAction="<#if ctrl.getUpdatePSControlAction?? && ctrl.getUpdatePSControlAction()?? && ctrl.getUpdatePSControlAction().getPSAppDEMethod()??>${ctrl.getUpdatePSControlAction().getPSAppDEMethod().getCodeName()}</#if>"
......@@ -10,8 +9,12 @@
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>"
:isMutli="!isSingleSelect"
:showBusyIndicator="${ctrl.isShowBusyIndicator()?c}"
:isTempMode="<#if ctrl.isTempMode?? && ctrl.isTempMode()??>${ctrl.isTempMode()?c}</#if>"
<#if view.getViewType?? && view.getViewType()?? && view.getViewType() == 'DEMOBMDVIEW9'>
:needLoadMore="false"
</#if>
<#if view.getViewType?? && view.getViewType()?? && view.getViewType() == 'DEMOBMDVIEW' || view.getViewType() == 'DEMOBMDVIEW9'>
:isChoose="isChoose"
<#if view.getPSAppViewLogics?? && view.getPSAppViewLogics()??>
<#list view.getPSAppViewLogics() as logic>
<#if logic.getPFLogicCodeType() == 'APP_NEWDATA'>
......@@ -22,16 +25,18 @@
</#if>
</#list>
</#if>
<#if view.hasPSControl('mdctrl')>
<#assign mdctrl = view.getPSControl('mdctrl')>
<#if mdctrl.getBatchPSDEToolbar?? && mdctrl.getBatchPSDEToolbar()??>
:isChoose="isChoose"
@isChooseChange="isChooseChange"
@checkBoxChange="checkBoxChange"
</#if>
</#if>
</#if>
<#if view.isEnableQuickGroup?? && view.isEnableQuickGroup()?? && view.isEnableQuickGroup() == true>
@pageTotalChange="pageTotalChange($event)"
</#if>
:isTempMode="<#if ctrl.isTempMode?? && ctrl.isTempMode()??>${ctrl.isTempMode()?c}</#if>"
:isEnableChoose="false"
<#if view.getViewType?? && view.getViewType()?? && view.getViewType() == 'DEMOBMDVIEW9'>
:needLoadMore="false"
</#if>
</#assign>
<#ibizinclude>
../@MACRO/HTML/DEFAULT.html.ftl
......
......@@ -28,6 +28,7 @@
.app-mob-mdctrl-${ctrl.name}{
overflow: auto;
height:100%;
position: relative;
.items{
background: transparent;
.loadmore_btn{
......@@ -71,7 +72,7 @@
position: absolute;
font-size: 16px;
color: #e8e8e8;
top: 50%;
top: calc(50% - 11px);
left: 50%;
transform: translate(-50%);
display: flex;
......
......@@ -65,7 +65,7 @@ ${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 ></ion-checkbox>
<ion-checkbox ref="selectAll" :checked="isSelectAll" @click="onSelectallClick(!isSelectAll)" ></ion-checkbox>
<ion-label class="selectal-label">全选</ion-label>
</div>
<div class="batch_btn_content">
......
......@@ -406,6 +406,53 @@
}
</#if>
<#if view.hasPSControl('mdctrl')>
<#assign mdctrl = view.getPSControl('mdctrl')>
<#if mdctrl.getBatchPSDEToolbar?? && mdctrl.getBatchPSDEToolbar()??>
/**
* 全选check点击
*
* @memberof ${srfclassname('${view.name}')}Base
*/
public onSelectallClick(value: any) {
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);
}
}, 1);
this.$forceUpdate();
}
/**
* 是否全选
*
* @memberof ${srfclassname('${view.name}')}Base
*/
public isSelectAll: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.$forceUpdate();
}
</#if>
</#if>
<#ibizinclude>
../@MACRO/VIEW_BOTTOM-BASE.vue.ftl
</#ibizinclude>
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册