提交 e738cc93 编写于 作者: tony001's avatar tony001

调整状态向导面板 --- fix3

上级 a1fff56d
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
<#list ctrl.getPSDEWizard().getPSDEWizardSteps() as step> <#list ctrl.getPSDEWizard().getPSDEWizardSteps() as step>
<el-step> <el-step>
<template v-slot:title> <template v-slot:title>
<div v-popover:<@getStepForm ctrlmodel=ctrl step=step />_popover>${step.getTitle()}</div> <div v-popover:<@getStepForm ctrlmodel=ctrl step=step />_popover @click="hanleClick('<@getStepForm ctrlmodel=ctrl step=step />')">${step.getTitle()}</div>
</template> </template>
</el-step> </el-step>
</#list> </#list>
...@@ -27,12 +27,12 @@ ...@@ -27,12 +27,12 @@
<#if ctrl.getPSDEEditForms()??> <#if ctrl.getPSDEEditForms()??>
<#list ctrl.getPSDEEditForms() as form> <#list ctrl.getPSDEEditForms() as form>
<#assign handler = form.getPSAjaxControlHandler() /> <#assign handler = form.getPSAjaxControlHandler() />
<el-popover v-if="activeForm === '${form.getName()}'" ref="${form.getName()}_popover" popper-class="app-wizard-popover-container" placement="bottom-start" trigger="click"> <el-popover ref="${form.getName()}_popover" popper-class="app-wizard-popover-container" placement="bottom-start" trigger="click">
<div class="app-wizard-container"> <div class="app-wizard-container">
<div class="app-wizard-header"> <div class="app-wizard-header">
<div class="app-wizard-header-extra"> <div class="app-wizard-header-extra">
<Icon type="md-open" size="18" @click="handleOPen"/> <Icon type="md-open" size="18" @click="handleOPen"/>
<Icon type="md-close" size="18" @click="handleClose"/> <Icon type="md-close" size="18" @click="handleClose('${form.getName()}')"/>
</div> </div>
</div> </div>
<div class="app-wizard-content"> <div class="app-wizard-content">
...@@ -54,9 +54,9 @@ ...@@ -54,9 +54,9 @@
</view_${form.getName()}> </view_${form.getName()}>
</div> </div>
<div class="app-wizard-footer"> <div class="app-wizard-footer">
<i-button size="small" :disabled="isDisabled('PREV')" @click="onClickPrev()" type="primary">上一步</i-button> <i-button size="small" v-if="isVisiable('${form.name}','PREV')" @click="onClickPrev()" type="primary">上一步</i-button>
<i-button size="small" :disabled="isDisabled('NEXT')" @click="onClickNext()" type="primary">下一步</i-button> <i-button size="small" v-if="isVisiable('${form.name}','NEXT')" @click="onClickNext()" type="primary">下一步</i-button>
<i-button size="small" :disabled="isDisabled('FINISH')" @click="onClickFinish()" type="primary">完成</i-button> <i-button size="small" v-if="isVisiable('${form.name}','FINISH')" @click="onClickFinish()" type="primary">完成</i-button>
</div> </div>
</div> </div>
</el-popover> </el-popover>
...@@ -179,6 +179,14 @@ ...@@ -179,6 +179,14 @@
*/ */
public stepTags: any = {}; public stepTags: any = {};
/**
* 步骤是否显示集合
*
* @type {*}
* @memberof ${srfclassname('${ctrl.codeName}')}Base
*/
public stepVisiable:any = {};
/** /**
* 向导表单集合 * 向导表单集合
* *
...@@ -248,6 +256,7 @@ ...@@ -248,6 +256,7 @@
public regFormAction(name: string, actions: Array<string>,stepTag:any) { public regFormAction(name: string, actions: Array<string>,stepTag:any) {
this.stepActions[name] = actions; this.stepActions[name] = actions;
this.stepTags[name] = stepTag; this.stepTags[name] = stepTag;
this.stepVisiable[name] = false;
this.wizardForms.push(name); this.wizardForms.push(name);
} }
...@@ -258,10 +267,26 @@ ...@@ -258,10 +267,26 @@
*/ */
public computedActiveForm(data:any){ public computedActiveForm(data:any){
if(data[this.stateField]){ if(data[this.stateField]){
if(Object.keys(this.stepTags).length >0){
Object.keys(this.stepTags).forEach((name:string) =>{
if(this.stepTags[name] === data[this.stateField]){
this.activeForm = name;
}
})
}
if(!this.activeForm){
this.activeForm = this.firstForm;
}
}else{
this.activeForm = this.firstForm;
} }
if(this.activeForm) { if(this.activeForm) {
this.historyForms.push(this.activeForm); let index = this.wizardForms.indexOf(this.activeForm);
this.wizardForms.forEach((item:any,inx:number) =>{
if(inx <= index){
this.historyForms.push(item);
}
})
} }
} }
...@@ -282,7 +307,7 @@ ...@@ -282,7 +307,7 @@
if(response.data.${ctrl.getPSAppDataEntity().getCodeName()?lower_case}){ if(response.data.${ctrl.getPSAppDataEntity().getCodeName()?lower_case}){
Object.assign(this.context,{${ctrl.getPSAppDataEntity().getCodeName()?lower_case}:response.data.${ctrl.getPSAppDataEntity().getCodeName()?lower_case}}) Object.assign(this.context,{${ctrl.getPSAppDataEntity().getCodeName()?lower_case}:response.data.${ctrl.getPSAppDataEntity().getCodeName()?lower_case}})
} }
this.formLoad(); this.computedActiveForm(response.data);
} }
}).catch((response: any) => { }).catch((response: any) => {
if (response && response.status === 401) { if (response && response.status === 401) {
...@@ -381,8 +406,25 @@ ...@@ -381,8 +406,25 @@
* *
* @memberof ${srfclassname('${ctrl.codeName}')}Base * @memberof ${srfclassname('${ctrl.codeName}')}Base
*/ */
public handleClose(){ public handleClose(name:string){
this.activeForm = ""; this.stepVisiable[name] = false;
}
/**
* 导航条点击事件
*
* @memberof ${srfclassname('${ctrl.codeName}')}Base
*/
public hanleClick(name:string){
let activeIndex:number = this.wizardForms.indexOf(this.activeForm);
let curIndex:number = this.wizardForms.indexOf(name);
if(curIndex > activeIndex){
return;
}
this.stepVisiable[name] = !this.stepVisiable[name];
if(this.stepVisiable[name]){
this.formLoad();
}
} }
/** /**
...@@ -457,19 +499,18 @@ ...@@ -457,19 +499,18 @@
} }
/** /**
* 是否禁用 * 是否显示
* *
* @param {string} type
* @memberof ${srfclassname('${ctrl.codeName}')}Base * @memberof ${srfclassname('${ctrl.codeName}')}Base
*/ */
public isDisabled(type: string) { public isVisiable(name:string,type: string) {
const actions: Array<string> = this.stepActions[this.activeForm] const actions: Array<string> = this.stepActions[name];
if(actions && actions.indexOf(type) < 0) { if(actions && actions.indexOf(type) !== -1) {
return true; return true;
}else{
return false;
} }
return false;
} }
<#ibizinclude> <#ibizinclude>
../@MACRO/CONTROL/CONTROL_BOTTOM-BASE.vue.ftl ../@MACRO/CONTROL/CONTROL_BOTTOM-BASE.vue.ftl
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册