97 lines
2.9 KiB
JavaScript
97 lines
2.9 KiB
JavaScript
|
import { getSchoolLevelData } from "./leftPage.js";
|
||
|
import { getStarRating } from "./orgApi/getStarRating.js";
|
||
|
var historyList=[];
|
||
|
function showHistoricalOverview(data){
|
||
|
var list=getSchoolLevelData(JSON.parse(JSON.stringify(data)));
|
||
|
var five=0;
|
||
|
var four=0;
|
||
|
var three=0;
|
||
|
var two=0;
|
||
|
var one=0;
|
||
|
for(var i=0;i<list.length;i++){
|
||
|
var name=list[i]["name"];
|
||
|
var value=list[i]["value"];
|
||
|
switch(name){
|
||
|
case "五星":
|
||
|
five=value;
|
||
|
break;
|
||
|
case "四星":
|
||
|
four=value
|
||
|
break;
|
||
|
case "三星":
|
||
|
three=value
|
||
|
break;
|
||
|
case "二星":
|
||
|
two=value
|
||
|
break;
|
||
|
case "一星":
|
||
|
one=value
|
||
|
break;
|
||
|
default:
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
var div=`
|
||
|
<div>
|
||
|
<p><img src="./image/five.png"></p>
|
||
|
<p>
|
||
|
<span>${five}</span>
|
||
|
</p>
|
||
|
</div>
|
||
|
<div>
|
||
|
<p><img src="./image/four.png"></p>
|
||
|
<p>
|
||
|
<span>${four}</span>
|
||
|
</p>
|
||
|
</div>
|
||
|
<div>
|
||
|
<p><img src="./image/three.png"></p>
|
||
|
<p>
|
||
|
<span>${three}</span>
|
||
|
</p>
|
||
|
</div>
|
||
|
<div>
|
||
|
<p><img src="./image/two.png"></p>
|
||
|
<p>
|
||
|
<span>${two}</span>
|
||
|
</p>
|
||
|
</div>
|
||
|
<div>
|
||
|
<p><img src="./image/one.png"></p>
|
||
|
<p>
|
||
|
<span>${one}</span>
|
||
|
</p>
|
||
|
</div>
|
||
|
`
|
||
|
$(".schoolHistoricalOverview").html(div);
|
||
|
schoolHistoricalOverviewEvent();
|
||
|
}
|
||
|
|
||
|
function schoolHistoricalOverviewEvent(){
|
||
|
$(".schoolHistoricalOverviewBtn").off('click');
|
||
|
$(".schoolHistoricalOverviewBtn").on('click',function(){
|
||
|
var time=$('#schoolLevelHistory_time').find("option:selected").val();
|
||
|
getStarRating(time).then(res=>{
|
||
|
var code=res["data"]["code"];
|
||
|
|
||
|
if(code==0){
|
||
|
var data=res["data"]["data"]
|
||
|
console.log(data);
|
||
|
|
||
|
for(var i=0;i<data.length;i++){
|
||
|
data[i]["scoreBonus"]=parseFloat(data[i]["scoreBonus"]/10);
|
||
|
data[i]["scoreInsideManage"]=parseFloat(data[i]["scoreInsideManage"]/10);
|
||
|
data[i]["scoreLawEducation"]=parseFloat(data[i]["scoreLawEducation"]/10);
|
||
|
data[i]["scoreOutsideManage"]=parseFloat(data[i]["scoreOutsideManage"]/10);
|
||
|
data[i]["scoreEmcManage"]=parseFloat(data[i]["scoreEmcManage"]/10);
|
||
|
data[i]["scoreRiskManage"]=parseFloat(data[i]["scoreRiskManage"]/10);
|
||
|
data[i]["scoreTotal"]=parseFloat(data[i]["scoreTotal"]/10);
|
||
|
}
|
||
|
historyList=data;
|
||
|
showHistoricalOverview(historyList);
|
||
|
}
|
||
|
})
|
||
|
})
|
||
|
}
|
||
|
|
||
|
export {showHistoricalOverview}
|