本帖最后由 ifastudy 于 2017-10-17 03:19 编辑
当用数据库的数据写spread时,因为spread中有大量的公式,写入很慢,后来禁用了公式,写数据的速度是提升了,但是公式不自动计算了。代码如下:
var regioncode = this.getParentView().getValues().regioncode;
mdobject.getRegionMDHisData({RegionCode:regioncode,StartYM:"1612",EndYM:"1705"}).then(function(response){
var jdata= response.json();
spread.options.tabStripRatio = 0.6;
spread.suspendCalcService();
spread.suspendPaint();
var sht = spread.getSheet(0);
jdata.forEach(function(item,idx){
sht.setValue(25+idx%402,7+parseInt(idx/402),item.saleper);
sht.setValue(25+idx%402,17+parseInt(idx/402),item.profitratio);
sht.setValue(25+idx%402,27+parseInt(idx/402),item.ticketprofitratio);
sht.setValue(25+idx%402,119+parseInt(idx/402),item.salemnyperunit);
sht.setValue(25+idx%402,141+parseInt(idx/402),item.saleqtyperssd);
sht.setValue(25+idx%402,151+parseInt(idx/402),item.saledays);
sht.setValue(25+idx%402,171+parseInt(idx/402),item.salemny);
}); spread.resumePaint();
spread.resumeCalService(true);
}); |