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

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

上级 3347c6aa
...@@ -83,36 +83,36 @@ ...@@ -83,36 +83,36 @@
@Prop() protected createAction!: string; @Prop() protected createAction!: string;
/** /**
* 列表数组 * 列表数组
* *
* @param {Array<any>} * @type {Array<any>}
* @memberof ${srfclassname('${ctrl.codeName}')} * @memberof ${srfclassname('${ctrl.codeName}')}
*/ */
public items:Array<any> =[]; public items: Array<any> = [];
/** /**
* 分页大小 * 分页大小
* *
* @type {number} * @type {number}
* @memberof ${srfclassname('${ctrl.codeName}')} * @memberof ${srfclassname('${ctrl.codeName}')}
*/ */
public pageSize: number = ${ctrl.getPagingSize()?c}; public pageSize: number = ${ ctrl.getPagingSize()?c};
/** /**
* 总页数 * 总页数
* *
* @type {number} * @type {number}
* @memberof ${srfclassname('${ctrl.codeName}')} * @memberof ${srfclassname('${ctrl.codeName}')}
*/ */
public pageTotal: number = 0; public pageTotal: number = 0;
/** /**
* 当前页数 * 当前页数
* *
* @type {number} * @type {number}
* @memberof ${srfclassname('${ctrl.codeName}')} * @memberof ${srfclassname('${ctrl.codeName}')}
*/ */
public pageNumber: number = 1; public pageNumber: number = 1;
/** /**
* 部件样式 * 部件样式
...@@ -122,69 +122,82 @@ ...@@ -122,69 +122,82 @@
*/ */
@Prop({default: '<#if ctrl.getMobListStyle?? && ctrl.getMobListStyle()??>${ctrl.getMobListStyle()}</#if>'}) protected controlStyle!: string; @Prop({default: '<#if ctrl.getMobListStyle?? && ctrl.getMobListStyle()??>${ctrl.getMobListStyle()}</#if>'}) protected controlStyle!: string;
/** /**
* 格式化数据 * 格式化数据
* *
* @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
* @memberof ${srfclassname('${ctrl.codeName}')} * @param {*} type
*/ * @returns {Promise<any>}
private load(data:any,type:any):void { * @memberof ${srfclassname('${ctrl.codeName}')}
const post: Promise<any> = this.service.search(this.fetchAction,this.context, data, this.showBusyIndicator); */
post.then((response: any) => { protected async load(data: any, type: any): Promise<any> {
if (!response || response.status !== 200) { const response: any = await this.service.search(this.fetchAction, this.context, data, this.showBusyIndicator);
// this.$notifyMessage.danger('错误,' + response.info); if (response && response.status === 200) {
}
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)
}); }
} }
/** /**
* vue生命周期created * vue生命周期created
* *
* @memberof ${srfclassname('${ctrl.codeName}')} * @memberof ${srfclassname('${ctrl.codeName}')}
*/ */
created() { public created() {
this.handleCreated(); this.handleCreated();
} }
/** /**
* 执行created后的逻辑 * 执行created后的逻辑
* *
* @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,24 +1060,25 @@ import { toastController, alertController } from '@ionic/core'; ...@@ -1060,24 +1060,25 @@ 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, { ...this.context }, datas, this.showBusyIndicator, arg);
const response: any = await this.service.wfsubmit(this.currentAction,JSON.parse(JSON.stringify(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) { this.$notice.error('工作流提交失败, ' + response.error.message);
this.$notice.error('工作流提交失败, ' + response.error.message); return response;
return response; }
}
} }
</#if> </#if>
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册