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

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

上级 3347c6aa
...@@ -85,10 +85,10 @@ ...@@ -85,10 +85,10 @@
/** /**
* 列表数组 * 列表数组
* *
* @param {Array<any>} * @type {Array<any>}
* @memberof ${srfclassname('${ctrl.codeName}')} * @memberof ${srfclassname('${ctrl.codeName}')}
*/ */
public items:Array<any> =[]; public items: Array<any> = [];
/** /**
* 分页大小 * 分页大小
...@@ -96,7 +96,7 @@ ...@@ -96,7 +96,7 @@
* @type {number} * @type {number}
* @memberof ${srfclassname('${ctrl.codeName}')} * @memberof ${srfclassname('${ctrl.codeName}')}
*/ */
public pageSize: number = ${ctrl.getPagingSize()?c}; public pageSize: number = ${ ctrl.getPagingSize()?c};
/** /**
* 总页数 * 总页数
...@@ -125,39 +125,31 @@ ...@@ -125,39 +125,31 @@
/** /**
* 格式化数据 * 格式化数据
* *
* @type {boolean} * @param {*} datelist
* @memberof ${srfclassname('${ctrl.codeName}')} * @memberof IBizChartViewController
*/ */
public formatdate(datelist : any){ public formatdate(datelist: any) {
this.items = datelist; this.items = datelist;
} }
/** /**
* 多项数据加载 * 数据加载
* *
* @private * @protected
* @param {*} [arg={}] * @param {*} data
* @param {*} type
* @returns {Promise<any>}
* @memberof ${srfclassname('${ctrl.codeName}')} * @memberof ${srfclassname('${ctrl.codeName}')}
*/ */
private load(data:any,type:any):void { protected async load(data: any, type: any): Promise<any> {
const post: Promise<any> = this.service.search(this.fetchAction,this.context, data, this.showBusyIndicator); const response: any = await this.service.search(this.fetchAction, this.context, data, this.showBusyIndicator);
post.then((response: any) => { if (response && response.status === 200) {
if (!response || response.status !== 200) {
// this.$notifyMessage.danger('错误,' + response.info);
}
let datelist = response.data.records; let datelist = response.data.records;
this.formatdate(datelist); this.formatdate(datelist);
}).catch((response : any)=>{ } else if (response && response.status !== 401) {
if (response && response.status === 401) {
return;
}
if (!response || !response.status || !response.data) {
// this.$notifyMessage.danger('错误,系统异常!');
return;
}
const { data: _data } = response; const { data: _data } = response;
console.error(_data.title + _data.message); this.$notice.error(_data.message)
}); }
} }
/** /**
...@@ -165,7 +157,7 @@ ...@@ -165,7 +157,7 @@
* *
* @memberof ${srfclassname('${ctrl.codeName}')} * @memberof ${srfclassname('${ctrl.codeName}')}
*/ */
created() { public created() {
this.handleCreated(); this.handleCreated();
} }
...@@ -174,17 +166,38 @@ ...@@ -174,17 +166,38 @@
* *
* @memberof ${srfclassname('${ctrl.codeName}')} * @memberof ${srfclassname('${ctrl.codeName}')}
*/ */
public handleCreated(){ public handleCreated() {
if (this.viewState) { if (this.viewState) {
this.viewStateEvent = this.viewState.subscribe( this.viewStateEvent = this.viewState.subscribe(({ tag, action, data }) => {
({ tag, action, data }) => {
if (!Object.is(tag, this.name)) { if (!Object.is(tag, this.name)) {
return; 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> <#ibizinclude>
......
...@@ -1060,18 +1060,19 @@ import { toastController, alertController } from '@ionic/core'; ...@@ -1060,18 +1060,19 @@ import { toastController, alertController } from '@ionic/core';
* *
* @protected * @protected
* @param {*} data * @param {*} data
* @param {*} linkItem
* @param {*} datas
* @returns {Promise<any>} * @returns {Promise<any>}
* @memberof ${srfclassname('${ctrl.codeName}')} * @memberof ${srfclassname('${ctrl.codeName}')}
*/ */
protected async wfsubmit(data: any, linkItem: any,datas: any): Promise<any> { protected async wfsubmit(data: any, linkItem: any, datas: any): Promise<any> {
const _this: any = this;
const arg: any = { ...data }; const arg: any = { ...data };
Object.assign(arg, this.viewparams,linkItem); Object.assign(arg, this.viewparams, linkItem);
// 强制补充srfwfmemo // 强制补充srfwfmemo
if(this.srfwfmemo){ if (this.srfwfmemo) {
Object.assign(datas,{srfwfmemo: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) { if (response && response.status === 200) {
this.$notice.success('工作流提交成功'); this.$notice.success('工作流提交成功');
} else if (response && response.status !== 401) { } else if (response && response.status !== 401) {
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册