$(function () { //列表 GetList(""); //搜索 $("#btnSearch").unbind("click").click(function () { //获取查询条件 var KeyWord = ""; var type = $("#selectFinancialType").val(); var key = $.trim($("#txtKeyWord").val()); if (key != null && key != "" && key.length > 0) { KeyWord = key; } if (KeyWord == "试卷名称") { KeyWord = ""; } GetList(KeyWord); }); $("#txtKeyWord").unbind("focus").focus(function () { $(this).val("").css("color", "black") }); }) /** * @name 获取试卷列表 */ function GetList(KeyWord) { pageHelper.Init({ url: "/Teacher/TheoryQuestion/TestPapersList", type: "POST", pageDiv: "#PapersPage", data: { Keyword: KeyWord, rId: Math.random() }, bind: function (data) { var html = ""; if (data.Data.length > 0) { $(data.Data).each(function (index, dom) { //每行html var trHtml = ""; trHtml += ""; trHtml += "
{0}
"; trHtml += "{1}"; trHtml += "{2}"; trHtml += "
{3}
"; trHtml += "{4}"; trHtml += ""; if (dom.StatusName != "已开始") { if (dom.Status == EnumList.ExamPaperStatus.UnPublish)//未发布 { trHtml += ""; trHtml += ""; } if (dom.StatusName == "已结束" || dom.Status == EnumList.ExamPaperStatus.UnPublish) { trHtml += ""; } if (dom.StatusName == "未开始")//已发布 { trHtml += ""; trHtml += ""; } } trHtml += ""; trHtml += ""; //拼接tbody html += StringHelper.FormatStr(trHtml, dom.ExamPaperName, //1 试卷名称 dom.strStartDate, //2 开始时间 dom.strEndDate, //3 截止时间 dom.ClassName, //4 班级 dom.StatusName, //5 发布状态 dom.Id, //6 Id dom.Status //7试卷状态 ); }); } else { html = "无相关记录!"; } $("#TestPaperList").html(html); } }); } //发布 function PublishPapers(PapersId,Status) { if (Status != EnumList.ExamPaperStatus.UnPublish) { dialogHelper.Error({ content: "发布失败!只能对未发布的试卷做发布。", success: function () { location.href = location.href; } }); return; } dialogHelper.Confirm({ content: "确认是否发布?", success: function () { $.ajax({ url: "/Teacher/TheoryQuestion/ReleasePaper", async: false, type: "POST", data: { PaperID: PapersId, }, success: function (data) { dialogHelper.Success({ content: "发布成功!", success: function () { location.href = location.href; } }); } }); } }); } //撤回 function CancelPapers(PapersId, Status) { if (Status != EnumList.ExamPaperStatus.Publish) { dialogHelper.Error({ content: "撤销失败!只能对已发布的试卷做撤销。", success: function () { location.href = location.href; } }); return; } dialogHelper.Confirm({ content: "确认是否撤销?", success: function () { $.ajax({ url: "/Teacher/TheoryQuestion/CancelPapers", async: false, type: "POST", data: { PapersId: PapersId, }, success: function (data) { dialogHelper.Success({ content: "撤销成功!", success: function () { location.href = location.href; } }); } }); } }); } //编辑 function EditPapers(PapersId, Status) { if (Status != EnumList.ExamPaperStatus.UnPublish) { dialogHelper.Error({ content: "修改失败!只能对未发布的试卷做修改。", success: function () { location.href = location.href; } }); return; } location.href = "/Teacher/TheoryQuestion/TestPapers?Status=Edit&PapersId=" + PapersId; } //删除 function DelPapers(PapersId) { dialogHelper.Confirm({ content: "确认是否删除?", success: function () { $.ajax({ url: "/Teacher/TheoryQuestion/DelPapers", async: false, type: "POST", data: { PapersId: PapersId }, success: function (data) { dialogHelper.Success({ content: "删除成功!", success: function () { location.href = location.href; } }); } }); } }); }