提交 2f76740a 编写于 作者: zcdtk's avatar zcdtk

表单,列表----代码格式整理

上级 3347c6aa
......@@ -83,36 +83,36 @@
@Prop() protected createAction!: string;
/**
* 列表数组
*
* @param {Array<any>}
* @memberof ${srfclassname('${ctrl.codeName}')}
*/
public items:Array<any> =[];
/**
* 分页大小
*
* @type {number}
* @memberof ${srfclassname('${ctrl.codeName}')}
*/
public pageSize: number = ${ctrl.getPagingSize()?c};
/**
* 总页数
*
* @type {number}
* @memberof ${srfclassname('${ctrl.codeName}')}
*/
public pageTotal: number = 0;
/**
* 当前页数
*
* @type {number}
* @memberof ${srfclassname('${ctrl.codeName}')}
*/
public pageNumber: number = 1;
* 列表数组
*
* @type {Array<any>}
* @memberof ${srfclassname('${ctrl.codeName}')}
*/
public items: Array<any> = [];
/**
* 分页大小
*
* @type {number}
* @memberof ${srfclassname('${ctrl.codeName}')}
*/
public pageSize: number = ${ ctrl.getPagingSize()?c};
/**
* 总页数
*
* @type {number}
* @memberof ${srfclassname('${ctrl.codeName}')}
*/
public pageTotal: number = 0;
/**
* 当前页数
*
* @type {number}
* @memberof ${srfclassname('${ctrl.codeName}')}
*/
public pageNumber: number = 1;
/**
* 部件样式
......@@ -122,69 +122,82 @@
*/
@Prop({default: '<#if ctrl.getMobListStyle?? && ctrl.getMobListStyle()??>${ctrl.getMobListStyle()}</#if>'}) protected controlStyle!: string;
/**
* 格式化数据
*
* @type {boolean}
* @memberof ${srfclassname('${ctrl.codeName}')}
*/
public formatdate(datelist : any){
this.items = datelist;
/**
* 格式化数据
*
* @param {*} datelist
* @memberof IBizChartViewController
*/
public formatdate(datelist: any) {
this.items = datelist;
}
/**
* 多项数据加载
*
* @private
* @param {*} [arg={}]
* @memberof ${srfclassname('${ctrl.codeName}')}
*/
private load(data:any,type:any):void {
const post: Promise<any> = this.service.search(this.fetchAction,this.context, data, this.showBusyIndicator);
post.then((response: any) => {
if (!response || response.status !== 200) {
// this.$notifyMessage.danger('错误,' + response.info);
}
* 数据加载
*
* @protected
* @param {*} data
* @param {*} type
* @returns {Promise<any>}
* @memberof ${srfclassname('${ctrl.codeName}')}
*/
protected async load(data: any, type: any): Promise<any> {
const response: any = await this.service.search(this.fetchAction, this.context, data, this.showBusyIndicator);
if (response && response.status === 200) {
let datelist = response.data.records;
this.formatdate(datelist);
}).catch((response : any)=>{
if (response && response.status === 401) {
return;
}
if (!response || !response.status || !response.data) {
// this.$notifyMessage.danger('错误,系统异常!');
return;
}
} else if (response && response.status !== 401) {
const { data: _data } = response;
console.error(_data.title + _data.message);
});
this.$notice.error(_data.message)
}
}
/**
* vue生命周期created
*
* @memberof ${srfclassname('${ctrl.codeName}')}
*/
created() {
this.handleCreated();
* vue生命周期created
*
* @memberof ${srfclassname('${ctrl.codeName}')}
*/
public created() {
this.handleCreated();
}
/**
* 执行created后的逻辑
*
* @memberof ${srfclassname('${ctrl.codeName}')}
*/
public handleCreated(){
if (this.viewState) {
this.viewStateEvent = this.viewState.subscribe(
({ tag, action, data }) => {
* 执行created后的逻辑
*
* @memberof ${srfclassname('${ctrl.codeName}')}
*/
public handleCreated() {
if (this.viewState) {
this.viewStateEvent = this.viewState.subscribe(({ tag, action, data }) => {
if (!Object.is(tag, this.name)) {
return;
}
this.load(Object.assign(data, { page: this.pageNumber, size: this.pageSize }),"");
}
);
}
this.load(Object.assign(data, { page: this.pageNumber, size: this.pageSize }), "");
});
}
}
/**
* vue 生命周期
*
* @memberof ${srfclassname('${ctrl.codeName}')}
*/
protected destroyed() {
this.afterDestroy();
}
/**
* 执行destroyed后的逻辑
*
* @memberof ${srfclassname('${ctrl.codeName}')}
*/
protected afterDestroy() {
if (this.viewStateEvent) {
this.viewStateEvent.unsubscribe();
}
<#if destroyed_block??>
${destroyed_block}
</#if>
}
<#ibizinclude>
......
......@@ -1060,24 +1060,25 @@ import { toastController, alertController } from '@ionic/core';
*
* @protected
* @param {*} data
* @param {*} linkItem
* @param {*} datas
* @returns {Promise<any>}
* @memberof ${srfclassname('${ctrl.codeName}')}
*/
protected async wfsubmit(data: any, linkItem: any,datas: any): Promise<any> {
const _this: any = this;
const arg: any = { ...data };
Object.assign(arg, this.viewparams,linkItem);
// 强制补充srfwfmemo
if(this.srfwfmemo){
Object.assign(datas,{srfwfmemo:this.srfwfmemo});
}
const response: any = await this.service.wfsubmit(this.currentAction,JSON.parse(JSON.stringify(this.context)), datas,this.showBusyIndicator, arg);
if (response && response.status === 200) {
this.$notice.success('工作流提交成功');
} else if (response && response.status !== 401) {
this.$notice.error('工作流提交失败, ' + response.error.message);
return response;
}
protected async wfsubmit(data: any, linkItem: any, datas: any): Promise<any> {
const arg: any = { ...data };
Object.assign(arg, this.viewparams, linkItem);
// 强制补充srfwfmemo
if (this.srfwfmemo) {
Object.assign(datas, { srfwfmemo: this.srfwfmemo });
}
const response: any = await this.service.wfsubmit(this.currentAction, { ...this.context }, datas, this.showBusyIndicator, arg);
if (response && response.status === 200) {
this.$notice.success('工作流提交成功');
} else if (response && response.status !== 401) {
this.$notice.error('工作流提交失败, ' + response.error.message);
return response;
}
}
</#if>
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册