$(function () { //条件搜索事件绑定 $("#Search").bind("click", function () { SerachList(); }); //列表显示 StuCustomerList("", ""); //新增客户 $("#AddCustomer").bind("click", function () { AddStuCustomer(0); }); $("#keywordText").unbind("focus").focus(function () { $("#keywordText").val("").css("color", "black"); }); }); //条件搜索 function SerachList() { var CustomerSource = $('#selectFT').find('option:selected').attr('value'); var keyword = $.trim($("#keywordText").val()).replace(/[<>&"]/g, function (c) { return { '<': '<', '>': '>', '&': '&', '"': '"', '"': '"', "'": '′', "'": '′' }[c]; }); if (keyword == "客户编号/客户姓名/身份证号") { keyword = ""; } StuCustomerList(CustomerSource, keyword); } //列表显示 function StuCustomerList(CustomerSource, keyword) { pageHelper.Init({ url: "/Student/StuCustomer/StuCustomerList", type: "POST", pageDiv: "#pages", data: { rId: Math.random(), CustomerSource: CustomerSource, keyword: keyword }, bind: function (data) { var html = ""; $(data.Data).each(function (index, dom) { //每行html var trHtml = ""; trHtml += ""; trHtml += "{0}"; trHtml += "
{1}
"; trHtml += "{2}"; trHtml += "{3}"; trHtml += "{4}"; trHtml += ""; trHtml += "完善客户信息"; if (dom.Status == EnumList.StuCustomerProposalStatus.Add) { trHtml += "新增建议书"; } else if (dom.Status == EnumList.StuCustomerProposalStatus.Edit) { trHtml += "编辑建议书"; } else { trHtml += ""; } trHtml += "删除"; trHtml += ""; //拼接tbody html += StringHelper.FormatStr(trHtml, dom.CustomerNo, //0客户编号 dom.CustomerName, //1客户名称 dom.IDNum, //2身份证号 dom.strUpdateDate, //3信息更新日期 dom.CustomerSourceName, //4客户来源 dom.Id, dom.TrainExamId, //6销售机会/实训考核Id dom.ProposalId //7建议书Id ); }); $("#SutCustomerBody").html(html); } }); } //删除潜在客户 function DeleteStuCustomer(CustomerSourceName, id, ProposalId) { dialogHelper.Confirm({ content: msgList["20009"], success: function () { $.ajax({ url: "/Student/StuCustomer/DeleteStuCustomer", type: "POST", pageDiv: "#pages", data: { CustomerSourceName:CustomerSourceName, id: id, ProposalId: ProposalId }, success: function (data) { dialogHelper.Success({ content: "删除成功!", success: function () { StuCustomerList(0, ""); } }); } }); }, }); } //跳转至完善客户信息界面 function UpdateStuCustomer(id) { location.href = "/Student/StuCustomer/EditStuCustomer?Id=" + id; } //新增建议书 function AddProposal(TrainExamId, StuCustomerId) { RemarkSystemLogin(); location.href = "/Student/ProposalCustomer/Index?TrainExamId=" + TrainExamId + "&StuCustomerId=" + StuCustomerId; } //编辑建议书 function EditProposal(TrainExamId, ProposalId, StuCustomerId) { RemarkSystemLogin(); location.href = "/Student/ProposalCustomer/Index?TrainExamId=" + TrainExamId + "&ProposalId=" + ProposalId + "&StuCustomerId=" + StuCustomerId; }