You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

241 lines
6.8 KiB
JavaScript

1 year ago

$(function () {
GetNotice();
ClassScheduleList();
waitHandle();
Statistics();
effectiveTime();
})
//课时安排列表
function ClassScheduleList() {
pageResourceHelper.Init({
url: "/Student/Home/GetMessageList",
type: "POST",
pageDiv: "#stuClassSchedulePages",
async: false,
data:
{
messageType: EnumList.MessageType.ClassSchedule,
},
bind: function (data) {
var html = "";
if (data.Data.length > 0) {
$(data.Data).each(function (index, dom) {
//每行html
var trHtml = "";
trHtml += "<li>";
trHtml += "<span class=\"text\" title=\"{0}\">{0}</span>";
trHtml += "<span class=\"time\" title=\"{1}\">{1}</span>";
trHtml += "</li>";
html += StringHelper.FormatStr(trHtml, dom.Context, dom.Period)
});
$("#liclassSchedule").html(html);
}
else {
$("#liclassSchedule").html("<h5>暂无相关信息!</h5>");
}
}
});
}
//获取最新通知
function GetNotice()
{
$.ajax({
url: "/Student/Home/GetNotice",
type: "POST",
async: false,
data:
{
},
success: function (data) {
data.Context != null ? $("#txtNotice").val(data.Context) : $("#txtNotice").val("暂无相关信息!");
}
});
}
//待办事项
function waitHandle() {
$.ajax({
url: "/Student/Home/WaitHandle",
type: "POST",
async: false,
data:
{
},
success: function (data) {
var length = data.list.length;//待领取
if(length>=100){
$("#Changes").html("99+");
} else {
$("#Changes").html(length);
}
var length2 = data.list2.length;//待实训考核
if (length2 >= 100) {
$("#practiceExamine").html("99+");
} else {
$("#practiceExamine").html(length2);
}
var length3 = data.list3;//待理论考核
if (length3 >= 100) {
$("#theoryExamine").html("99+");
} else {
$("#theoryExamine").html(length3);
}
}
});
}
//统计
function Statistics() {
$.ajax({
url: "/Student/Home/Statistics",
type: "POST",
async: false,
data:
{
},
success: function (data) {
var count1 = data.listcount1;//全部已发布的销售机会
var already1 =Number( data.listcountAlready1.toMyFixed(0));//已完成得已发布的销售机会
var count2 = data.listcount2;//全部已发布的考核实训
var already2 =Number( data.listcountAlready2.toMyFixed(0));//已完成得已发布的考核实训
var count3 = data.listcount3;//全部已发布的理论考核
var already3 =Number( data.listcountAlready3.toMyFixed(0));//已完成得已发布的理论考核
var a = (already1 / count1) * 100;
if (count1==0) {
a = 0;
}
$("#xiaoshou").html(a.toMyFixed(0) + "%");
$("#xiaoshou").css("width", a + "%")
var b = (already2 / count2) * 100;
if (count2 == 0) {
b = 0;
}
$("#kaohe").html(b.toMyFixed(0) + "%");
$("#kaohe").css("width",b+"%")
var c = (already3 / count3) * 100;
if (count3 == 0) {
c = 0;
}
$("#lilun").html(c.toMyFixed(0) + "%");
$("#lilun").css("width", c + "%")
var count = 0;
if (count1 == 0 && count2 == 0 && count3 == 0) {
count = 0;
}
else {
count = (already1 + already2 + already3) / (count1 + count2 + count3) * 100
}
// var count = (Number(a) +Number(b) + Number(c)) / 3;
var allcout = count;
$("#wancheng").html(allcout.toMyFixed(0) + "%");
}
});
}
//有效时间
function effectiveTime() {
$.ajax({
url: "/Student/Home/TimeStatistics",
type: "POST",
async: false,
data:
{
},
success: function (data) {
//子系统时间
var systime = (data.systemTime / 60).toFixed(0);
$("#systemTime").html(systime+"H");
//课程资源时间
var resource = (data.resource / 60).toFixed(0);
$("#resource").html(resource + "H");
//认证时间
var authentication = (data.authentication / 60).toFixed(0);
$("#authentication").html(authentication + "H");
//有效时间
var allTime =Number(systime) + Number(resource) + Number(authentication);
$("#allTime").html(allTime);
if (Number(systime) == 0 && Number(resource) == 0 && Number(authentication)==0) {
//饼图
//$("#pieChar").css("background-image", "D:\SVN\2.FPBT V1.0\1.Engineering\13.Code Management\Trunk\FPBT1.0\Web\Web.Main\Content/images/HomeImage.png");
// var imgHtml = " <img src='~/Content/images/HomeImage.png' width='150' height='150' />"
// $("#pieChar").html(imgHtml);
// ShowPieInfo(0, 0, 0, '#aea8a8');
} else {
//饼图
ShowPieInfo(Number(systime), Number(resource), Number(authentication), '#63b2f4');
}
}
});
}
//饼图
function ShowPieInfo(Currency, Bond, Stock,Color) {
var chart;
$("#pieChar").highcharts({
chart: {
plotBackgroundColor: null,
plotBorderWidth: null,
plotShadow: false
},
title: {
text: '',
align: 'left'
},
tooltip: {
pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
},
colors: [Color, '#2a91e6', '#086cc1'],
plotOptions: {
pie: {
allowPointSelect: true,
cursor: 'pointer',
dataLabels: {
enabled: false
},
showInLegend: false
}
},
series: [{
type: 'pie',
name: '所占比例',
data: [
['实训模块', Currency],
{
name: '资源模块',
y: Bond,
sliced: true,
selected: true
},
['认证模块', Stock],
]
}]
});
}