/// $(function () { Id = $.getUrlParam("Id");//获取参数Id $("#hdId").val(Id); if (Id != null && Id != "" && Id != undefined) { GetCalendar(Id); } else { $("#txttitle").text("新增工作日程"); } var type = $.getUrlParam("type"); if (type == "Details") { $("#txtCustomerName,#txtOrderTime,#selServiceType,#txtContext").attr("readonly", "readonly"); $("#btnCustomer,#btnHiddenCustomer").hide(); $("#txttitle").text("工作日程详情"); $("#txtOrderTime").css('background','#eaeaea'); $("#selServiceType").css('background', '#eaeaea'); $("#txtContext").removeAttr("style"); $("#btnSave").hide(); $("#btnClose").val("返回"); } else if (type == "Update") { $("#txttitle").text("编辑工作日程"); $("#txtCustomerName").attr("disabled", true); $("#btnHiddenCustomer,#btnCustomer").hide(); } else { $("#txttitle").text("新增工作日程"); } $("#btnHiddenCustomer").unbind("click").bind("click",function () { $("#txtSearch").val("客户编号/客户姓名/身份证号").css({ "color": "#aea8a8" }); $("#hdCustomerType").val(1); GetCustomerlist(); //获取潜在客户列表 dialogHelper.Show("divcustomerlist", 800); // $(".windowBg").show(); // $("#divcustomerlist").show(); }); //获取已有客户列表 $("#btnCustomer").unbind("click").bind("click",function () { $("#txtSearch").val("客户编号/客户姓名/身份证号").css({ "color": "#aea8a8" }); $("#hdCustomerType").val(2); GetCustomerlist(); dialogHelper.Show("divcustomerlist", 800); // $(".windowBg").show(); }); $("#btnSave").click(function () { Save(); }); $("#btnClose").click(function () { location.href = "/Student/Calendar/Index" }); $("#chosecustomer").unbind("click").bind("click",function () { var len= $(":radio[name=customerradio]:checked").length; if (len == 0) { dialogHelper.Error({ content: "必须选择一个客户信息" }); // $(".windowBg").show(); return; } GetCustomerId(); dialogHelper.Close("divcustomerlist"); }); $("#choseclose").unbind("click").bind("click", function () { dialogHelper.Close("divcustomerlist"); // $("#txtSearch").val(""); // $(".popup").hide(); // $(".windowBg").hide(); }); $("#txtSearch").unbind("focus").focus(function () { $("#txtSearch").val("").css("color", "black"); }); $("#btnSearch").click(function () { GetCustomerlist(); }); }); //得到已有客户/潜在客户列表 function GetCustomerlist() { pageHelper.Init({ url: "/Student/StuCustomer/GetStuCustomerListByCalendar", type: "post", async: true, pageDiv: "#pages", data: { CustomerType: $("#hdCustomerType").val(),//客户类型,根据选择的按钮获得 KeyWords:$("#txtSearch").val()=="客户编号/客户姓名/身份证号"?"": $("#txtSearch").val().replace(/[<>&"]/g, function (c) { return { '<': '<', '>': '>', '&': '&', '"': '"', '"': '"', "'": '′', "'": '′' }[c]; }),//搜索关键字 }, bind: function (data) { var html = ""; $(data.Data).each(function (index, dom) { //每行html var trHtml = ""; trHtml += ""; trHtml += ""; trHtml += "
{0}
"; trHtml += "
{1}
"; trHtml += "
{2}
"; trHtml += "
{3}
"; trHtml += ""; //拼接tbody html += StringHelper.FormatStr(trHtml, dom.CustomerNo, //客户编号 dom.CustomerName, //客户姓名 dom.IDNum, //IDNum dom.strUpdateDate, //信息更新日期 dom.Id //客户Id ); }); $("#customerList").html(html); dialogHelper.Reset("divcustomerlist"); } }); } //单选选中,为客户Id和客户姓名赋值 function GetCustomerId() { $("#hdCustomerId").val($(":radio[checked='checked']").attr("customerId")); $("#txtCustomerName").val($(":radio[checked='checked']").attr("customerName")) } //保存日程安排 function Save() { if (!VerificationHelper.checkFrom("divaddcalendar")) return; $.ajax({ url: "/Student/Calendar/AddUpdateCalendar", type: "POST", async: true, data: { Id: $("#hdId").val(), CustomerName: $("#txtCustomerName").val(), StuCustomerId: $("#hdCustomerId").val(), GetOrDate: $("#txtOrderTime").val(), ServiceType: $("#selServiceType").val(), Context: $("#txtContext").val() }, success: function (data) { //弹出成功提示 //code ... dialogHelper.Success({ content: "保存成功!", success: function () { location.href = "/Student/Calendar/Index"; } }); } }); } //获取页面实体,填充页面 function GetCalendar(Id) { $.ajax({ url: "/Student/Calendar/GetCalendar", type: "POST", async: true, data: { Id: Id }, success: function (data) { $("#txtCustomerName").val(data.CustomerName); $("#txtOrderTime").val(data.StrOrDate); $("#selServiceType").val(data.ServiceType); $("#txtContext").val(data.Context); } }); }