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

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

上级 3347c6aa
......@@ -85,10 +85,10 @@
/**
* 列表数组
*
* @param {Array<any>}
* @type {Array<any>}
* @memberof ${srfclassname('${ctrl.codeName}')}
*/
public items:Array<any> =[];
public items: Array<any> = [];
/**
* 分页大小
......@@ -96,7 +96,7 @@
* @type {number}
* @memberof ${srfclassname('${ctrl.codeName}')}
*/
public pageSize: number = ${ctrl.getPagingSize()?c};
public pageSize: number = ${ ctrl.getPagingSize()?c};
/**
* 总页数
......@@ -125,39 +125,31 @@
/**
* 格式化数据
*
* @type {boolean}
* @memberof ${srfclassname('${ctrl.codeName}')}
* @param {*} datelist
* @memberof IBizChartViewController
*/
public formatdate(datelist : any){
public formatdate(datelist: any) {
this.items = datelist;
}
/**
* 多项数据加载
* 数据加载
*
* @private
* @param {*} [arg={}]
* @protected
* @param {*} data
* @param {*} type
* @returns {Promise<any>}
* @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 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)
}
}
/**
......@@ -165,7 +157,7 @@
*
* @memberof ${srfclassname('${ctrl.codeName}')}
*/
created() {
public created() {
this.handleCreated();
}
......@@ -174,17 +166,38 @@
*
* @memberof ${srfclassname('${ctrl.codeName}')}
*/
public handleCreated(){
public handleCreated() {
if (this.viewState) {
this.viewStateEvent = this.viewState.subscribe(
({ tag, action, data }) => {
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,18 +1060,19 @@ 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;
protected async wfsubmit(data: any, linkItem: any, datas: any): Promise<any> {
const arg: any = { ...data };
Object.assign(arg, this.viewparams,linkItem);
Object.assign(arg, this.viewparams, linkItem);
// 强制补充srfwfmemo
if(this.srfwfmemo){
Object.assign(datas,{srfwfmemo:this.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);
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) {
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册