//生成卡片
// 头部导航
function initTopNav() {
var html = '';
html += '
'
+ '
城市'
+ '
[ '+ curCityInfo.name +' ] ';
html += '';
html += '';
html += '';
// html += '';
// html += '';
html += '
';
// 选择城市
html += '';
cityData.length && cityData.map(function(e){
html += "
- ";
// 地市级
html += ""+ e.name +"";
e.sub && e.sub.length && e.sub.map(function(el){
// 县区
html += ""+ el.name +"";
})
html += "
";
});
html += '
';
$("body #position_top").append(html);
}
// 数据统计
function initStatistics() {
// 计算登记宠物数
var petsNum = 0;
var waitRenewalNum = 0;
petData.wait_renewal && (waitRenewalNum = petData.wait_renewal.length) && (petsNum += waitRenewalNum);
petData.normal && (petsNum += petData.normal.length);
var zhzb =
'' +
'- 宠物医院(所)' + hospitalData.length + '
' +
'- 登记犬只数(只)'+ petsNum +'
' +
'- 待续期犬证(张)'+ waitRenewalNum +'
'
// '- 疫苗注射点(个)4213
' +
// '- 上牌服务点(个)108
' +
'
';
var zzb = new CreateTip({
parentId: "position_left",
id:"zongzhibiao",
titleName:"数据统计",
icon:"icon/statistics.png",
width: "100%",
// html:zhzb
});
zzb.setData(zhzb);
}
// 上牌排行
function initRecordRank() {
// 计算上牌数
var petsNum = 0;
petData.wait_renewal && (petsNum += petData.wait_renewal.length);
petData.normal && (petsNum += petData.normal.length);
//详细指标
var xxzb = '';
if (petsNum == 0) {
xxzb += '
暂无数据
';
}
xxzb += '
';
var xzb = new CreateTip({
parentId: "position_right",
id:"xxzb",
titleName:"上牌排行榜",
icon:"icon/statistics.png",
width:"100%",
// html:xxzb
});
xzb.setData(xxzb);
var qybxspm = new CreateSpeed({
id:"qybxspm",
icon:"icon/fix.png",
// title:"上牌排行",
max: petsNum
});
qybxspm.setData(recordRankingData);
}
// 寻宠轮播
function initSearchPets() {
var search_pets = "";
if (searchPetsData.length == 0) {
search_pets += '暂无数据
';
} else {
searchPetsData.forEach(function(item, index){
let text = item.Description || '';
if (text.length > 96) {
text = text.slice(0,96) + '...';
}
search_pets += "";
search_pets += "
";
search_pets += "

";
search_pets += "
"
+ "宠物昵称:" +(item.PetName || '') + ""
+ "狗牌编号:" +(item.DeviceNumber || '') + ""
+ "发布人:" +item.UserName + ""
+ "联系电话:" +item.Mobile+ ""
+ "丢失地点:" +(item.Address || '')+ "
";
search_pets += "
";
search_pets += "
"+text+"
";
search_pets += "
";
});
}
var xcObj = new CreateTip({
parentId: "position_right",
id: "search_pets",
titleName: "寻宠信息",
icon: "icon/alarm.png",
width: "100%"
});
xcObj.setData(search_pets);
}
// 犬种统计图
function initRecordPetsPie() {
var species = '';
var specieObj = new CreateTip({
parentId: "position_left",
id: "species",
titleName: "已备案品种统计",
icon: "icon/pie.png",
width: "100%",
});
specieObj.setData(species);
var specie_pie = echarts.init(document.getElementById('specie_pie'));
var specie_pie_option = {
textStyle: {
color: "#fff",
},
title: {
// text: '标题',
// subtext: '子标题',
left: 'center'
},
tooltip: {
trigger: 'item',
formatter: '{a}
{b} : {c} ({d}%)'
},
legend: {
// orient: 'vertical',
left: 'left',
data: recordPetsPieData.map(function(e){return e.name}),
textStyle: {
color: "#fff",
}
},
series: [
{
name: '宠物品种',
type: 'pie',
radius: '55%',
center: ['45%', '60%'],
data: recordPetsPieData.map(function(e){
//e.name = e.name + '(' + e.value +')';
return e;
}),
emphasis: {
itemStyle: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)'
}
}
}
]
};
specie_pie.setOption(specie_pie_option);
}