提交 1678dd19 编写于 作者: tony001's avatar tony001

调整计数器服务

上级 3721ed56
import CounterService from '../counter-service';
<#ibiztemplate>
TARGET=PSAPPCOUNTER
</#ibiztemplate>
import { CounterServiceBase } from '@/ibiz-core';
/**
/**
* ${item.getName()}计数器服务对象基类
*
* @export
* @class ${item.getCodeName()}CounterServiceBase
* @extends {CounterServiceBase}
*/
export class ${srfclassname('${item.getCodeName()}')}CounterServiceBase extends CounterServiceBase { }
\ No newline at end of file
export default class ${srfclassname('${item.getCodeName()}')}CounterServiceBase extends CounterService {
/**
* 当前计数器数据对象
*
* @param {*} [opts={}]
* @memberof ${srfclassname('${item.getCodeName()}')}CounterServiceBase
*/
public counterData:any ={};
/**
* Creates an instance of ${srfclassname('${item.getCodeName()}')}CounterServiceBase.
*
* @param {*} [opts={}]
* @memberof ${srfclassname('${item.getCodeName()}')}CounterServiceBase
*/
constructor(opts: any = {}) {
super(opts);
this.initCounterData();
setInterval(() => {
this.fetchCounterData();
}, <#if item.getTimer()??>${item.getTimer()?c}<#else>6000</#if>);
}
/**
* 初始化当前计数器数据对象
*
* @param {*} [opts={}]
* @memberof ${srfclassname('${item.getCodeName()}')}CounterServiceBase
*/
public initCounterData(){
this.fetchCounterData();
}
/**
* 查询数据
*
* @param {*} [opts={}]
* @memberof ${srfclassname('${item.getCodeName()}')}CounterServiceBase
*/
public async fetchCounterData(){
this.counterData = {
item1:parseInt((Math.random()*10)+''),
item2:parseInt((Math.random()*100)+''),
item3:parseInt((Math.random()*100)+''),
item4:parseInt((Math.random()*100)+''),
item5:parseInt((Math.random()*100)+''),
item6:parseInt((Math.random()*100)+''),
item7:parseInt((Math.random()*100)+''),
item8:parseInt((Math.random()*100)+''),
item9:parseInt((Math.random()*100)+''),
item10:parseInt((Math.random()*100)+'')
}
}
/**
* 刷新数据
*
* @memberof ${srfclassname('${item.getCodeName()}')}CounterServiceBase
*/
public async refreshData(){
const res = await this.fetchCounterData();
return res;
}
}
\ No newline at end of file
<#ibiztemplate>
TARGET=PSAPPCOUNTER
</#ibiztemplate>
import { ${srfclassname('${item.getCodeName()}')}CounterServiceBase } from './${srffilepath2(item.getCodeName())}-counter-base';
import ${srfclassname('${item.getCodeName()}')}CounterServiceBase from './${srffilepath2(item.getCodeName())}-counter-base';
/**
* ${item.getName()}计数器服务对象
*
* @export
* @class ${item.getCodeName()}CounterService
* @extends {${srfclassname('${item.getCodeName()}')}CounterServiceBase}
*/
export class ${srfclassname('${item.getCodeName()}')}CounterService extends ${srfclassname('${item.getCodeName()}')}CounterServiceBase { }
// 默认导出
export default ${srfclassname('${item.getCodeName()}')}CounterService;
\ No newline at end of file
export default class ${srfclassname('${item.getCodeName()}')}CounterService extends ${srfclassname('${item.getCodeName()}')}CounterServiceBase {
/**
* Creates an instance of ${srfclassname('${item.getCodeName()}')}CounterService.
*
* @param {*} [opts={}]
* @memberof ${srfclassname('${item.getCodeName()}')}CounterService
*/
constructor(opts: any = {}) {
super(opts);
}
}
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册