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

重命名功能

上级 7dd09e28
......@@ -10,7 +10,7 @@
</#list>
<template v-for="item in customizeModel">
<ion-card class="dashboard-item ios hydrated" :class="item.componentName + 'dashboard'" :key="item.id" v-if="isEnableCustomized">
<component :is="item.componentName" :isCustomize="true" :viewState="viewState" :name="item.portletCodeName" :context="context" :isChildView="true" :viewparams="viewparams"></component>
<component :is="item.componentName" :item="item" :isCustomize="true" :customizeTitle="item.customizeTitle" :viewState="viewState" :name="item.portletCodeName" :context="context" :isChildView="true" :viewparams="viewparams" @customizeRename="customizeRename"></component>
</ion-card>
</template>
</ion-grid>
......
......@@ -56,7 +56,7 @@ import UtilService from '@/utilservice/util-service';
protected utilService: UtilService = new UtilService();
/**
* 加载数据模型
* 加载定制数据模型
*
* @param {string} serviceName
* @param {*} context
......@@ -82,7 +82,36 @@ import UtilService from '@/utilservice/util-service';
});
}
/**
* 保存定制数据模型
*
* @param {string} serviceName
* @param {*} context
* @param {*} viewparams
* @memberof ${srfclassname('${ctrl.codeName}')}
*/
public saveModel(serviceName: string, context: any, viewparams: any) {
return new Promise((resolve: any, reject: any) => {
this.utilService.getService(serviceName).then((service: any) => {
service.saveModelData(JSON.stringify(context), "", viewparams)
.then((response: any) => {
resolve(response);
})
.catch((response: any) => {
reject(response);
});
})
.catch((response: any) => {
reject(response);
});
});
}
/**
* 定制数据模型
*
* @memberof ${srfclassname('${ctrl.codeName}')}
*/
public customizeModel :any = [];
/**
......@@ -172,6 +201,25 @@ import UtilService from '@/utilservice/util-service';
}
}
/**
* 重命名
*
* @type {string}
* @memberof AppRichTextEditor
*/
public customizeRename(customizeModelItem:any,title:string) {
let index = this.customizeModel.findIndex((item:any)=>{
return item.id === customizeModelItem.id;
})
this.customizeModel.splice(index,1,(customizeModelItem as never));
this.saveModel(this.utilServiceName,{},
{
utilServiceName: this.utilServiceName,
modelid: this.modelId,
model: this.customizeModel,
});
}
<#ibizinclude>
../@MACRO/CONTROL/CONTROL_BOTTOM-BASE.vue.ftl
</#ibizinclude>
......
......@@ -2,8 +2,14 @@
<ion-row>
<ion-list class='app-mob-portlet <#if appde??>${appde.getCodeName()?lower_case}-${ctrl.name}</#if> <#if ctrl.getPSSysCss()??><#assign singleCss = ctrl.getPSSysCss()> ${singleCss.getCssName()}</#if>'>
<#if ctrl.isShowTitleBar()>
<ion-list-header class='app-mob-portlet__header'><ion-input v-if="isEditTitle" value="${ctrl.getTitle()}"></ion-input>${ctrl.getTitle()} <div class="portlet__header_right"><ion-icon v-if="!isEditTitle" name="ellipsis-horizontal-outline" @click="open"></ion-icon></div></ion-list-header>
<div class="edit_title_btn" v-if="isEditTitle"><ion-button>确认</ion-button><ion-button>取消</ion-button></div>
<ion-list-header class='app-mob-portlet__header'>
<ion-input v-if="isEditTitle" value="${ctrl.getTitle()}"></ion-input>
<span v-if="!isEditTitle"><span v-if="customizeTitle">{{customizeTitle}}</span><span v-else>${ctrl.getTitle()}</span></span>
<div class="portlet__header_right">
<ion-icon v-if="!isEditTitle" name="ellipsis-horizontal-outline" @click="open"></ion-icon>
</div>
</ion-list-header>
<div class="edit_title_btn" v-if="isEditTitle"><ion-button @click="onConfirmClick(false)">取消</ion-button><ion-button @click="onConfirmClick(true)">确认</ion-button></div>
</#if><#t>
<#if ctrl.getPortletType?? && ctrl.getPortletType()??>
<#if ctrl.getPortletType() == 'VIEW' && ctrl.getPortletPSAppView?? && ctrl.getPortletPSAppView()??><#t>
......
......@@ -53,6 +53,14 @@ import ${srfclassname('${appCounter.getCodeName()}')}CounterService from '@/ap
*/
@Prop({default:false}) protected isCustomize?: boolean;
/**
* 定制标题
*
* @type {string}
* @memberof MOBMyFavoriteStory
*/
@Prop() protected customizeTitle?: string;
/**
* 操作栏模型数据
*
......@@ -222,12 +230,70 @@ import ${srfclassname('${appCounter.getCodeName()}')}CounterService from '@/ap
}, 1);
}
/**
* 生命周期
*
* @type {string}
* @memberof ${srfclassname('${ctrl.codeName}')}
*/
public mounted() {
if(this.isCustomize){
this.actionBarModelData.push(...this.builtinItemS);
}
}
/**
* 定制项数据
*
* @type {string}
* @memberof ${srfclassname('${ctrl.codeName}')}
*/
@Prop() protected item: any;
/**
* 定制标题
*
* @type {string}
* @memberof ${srfclassname('${ctrl.codeName}')}
*/
get editTitle(){
if(this.customizeTitle){
return this.customizeTitle
}
return '${ctrl.getTitle()}'
}
/**
* 定制标题
*
* @type {string}
* @memberof ${srfclassname('${ctrl.codeName}')}
*/
public reTitleValue = "";
/**
* 标题变更
*
* @type {string}
* @memberof ${srfclassname('${ctrl.codeName}')}
*/
titleChange(value:any){
this.reTitleValue = value.detail.value;
}
/**
* 重命名确认按钮
*
* @type {string}
* @memberof ${srfclassname('${ctrl.codeName}')}
*/
public onConfirmClick(val:boolean) {
if(val){
this.$emit("customizeRename",Object.assign(this.item,{customizeTitle:this.reTitleValue?this.reTitleValue:this.editTitle}),this.reTitleValue?this.reTitleValue:this.editTitle)
}
this.isEditTitle = false;
}
<#ibizinclude>
../@MACRO/CONTROL/CONTROL_BOTTOM-BASE.vue.ftl
</#ibizinclude>
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册