<nz-spin[nzSpinning]="isScaleStatistics"><nz-table*ngIf="!isScaleStatistics"#columnTable[nzData]="listOfStatistics"[nzScroll]="{ x: '300px' }"><thead><tr><thnzWidth="100px"nzLeft="0px">值</th><thnzWidth="100px"nzLeft="100px">描述</th><th*ngFor="let data of columnTable.data[0].header">{{data}}</th></tr></thead><tbody><tr*ngFor="let data of columnTable.data[0].body"><tdnzLeft="0px">{{ data.value }}</td><tdnzLeft="100px">{{ data.text }}</td><td*ngFor="let data of data.province">{{data}}</td></tr></tbody></nz-table></nz-spin>
handleOk():void{this.isAreaVisible =false;this.listOfStatistics =[{header:[],body:[]}];this.isScaleStatistics =true;this.typeChange.emit(true)this.gisService.statisticByLevel(this.levels,this.where,this.levelParams.img).subscribe((data)=>{letareaData: Array<any>=[];//翻译表格header 区域for(let j in data){if(j =="province")continue;//选择区域为省 删去重复列this.listOfStatistics[0].header.push(this.cCodeToProvName((j).length ==6?Number(j):this.selArea.cCode))}//特殊区域放在前列let key =this.listOfStatistics[0].header[this.listOfStatistics[0].header.length -1]this.listOfStatistics[0].header.splice(this.listOfStatistics[0].header.length -1,1);this.listOfStatistics[0].header.unshift(key)//拼接表格body数组this.scaleData.forEach(item=>{for(let j in data){for(let k in data[j]){if(j =="province")continue;//选择区域为省 删去重复列if(k.split(',')[0]== item.value){
areaData.push(data[j]["total"]==0|| data[j][k]==0?0:((data[j][k]/ data[j]["total"])*100).toFixed(3)+"%");continue;}}}let b = areaData[areaData.length -1]
areaData.splice(areaData.length -1,1);
areaData.unshift(b)this.listOfStatistics[0].body.push({value: item.value,text: item.text,province: areaData })
areaData =[]})this.isScaleStatistics =false;},e=>{this.isScaleStatistics =false;this.message.error("等级比例面积统计数据获取失败")})}