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.

128 lines
4.5 KiB
JavaScript

$(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 keyword = $.trim($("#keywordText").val()).replace(/[<>&"]/g, function (c) { return { '<': '&lt;', '>': '&gt;', '&': '&amp;', '"': '&quot;', '"': '&quot;', "'": '&prime;', "'": '&prime;' }[c]; });
if (keyword == "客户编号/客户姓名/身份证号") {
keyword = "";
}
StuCustomerList(keyword);
}
//列表显示
function StuCustomerList(keyword) {
pageHelper.Init({
url: "/Student/StuCustomer2/StuCustomerList",
type: "POST",
pageDiv: "#pages",
data:
{
rId: Math.random(),
keyword: keyword
},
bind: function (data) {
var html = "";
$(data.Data).each(function (index, dom) {
//每行html
var trHtml = "";
trHtml += "<tr>";
trHtml += "<td>{0}</td>";
trHtml += "<td><div title=\"{1}\" class=\"ellipsis\">{1}</div></td>";
trHtml += "<td>{2}</td>";
trHtml += "<td>{8}</td>";
trHtml += "<td>{3}</td>";
trHtml += "<td class=\"operate\">";
trHtml += "<a href=\"javascript:UpdateStuCustomer({5});\">完善客户信息</a>";
if (dom.Status == EnumList.StuCustomerProposalStatus.Add) {
trHtml += "<a href=\"javascript:AddProposal({6},{5});\">新增建议书</a>";
} else if (dom.Status == EnumList.StuCustomerProposalStatus.Edit) {
trHtml += "<a href=\"javascript:EditProposal({6},{7});\">编辑建议书</a>";
} else {
trHtml += "";
}
// trHtml += "<a href=\"javascript:DeleteStuCustomer({5});\">删除</a></td>";
trHtml += "<a href=\"javascript:DeleteStuCustomer('{4}',{5},{7});\">删除</a></td>";
trHtml += "</tr>";
//拼接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
dom.ProposalCount //建议书数量
);
});
$("#SutCustomerBody").html(html);
}
});
}
//删除潜在客户
function DeleteStuCustomer(CustomerSourceName, id, ProposalId) {
dialogHelper.Confirm({
content: msgList["20009"],
success: function () {
$.ajax({
url: "/Student/StuCustomer2/DeleteStuCustomer",
type: "POST",
pageDiv: "#pages",
data:
{
CustomerSourceName: CustomerSourceName,
id: id,
ProposalId: ProposalId
},
success: function (data, txtStatus) {
dialogHelper.Success({ content: "删除成功!", success: function () { StuCustomerList(""); } });
}
});
},
});
}
//跳转至完善客户信息界面
function UpdateStuCustomer(id) {
location.href = "/Student/StuCustomer2/EditStuCustomer?Id=" + id;
}
//编辑建议书
function EditProposal(TrainExamId, ProposalId) {
location.href = "/Student/ProposalCustomer/Index?TrainExamId=" + TrainExamId + "&ProposalId=" + ProposalId;
}
//新增建议书
function AddProposal(TrainExamId, StuCustomerId) {
RemarkSystemLogin();
location.href = "/Student/ProposalCustomer/Index?TrainExamId=" + TrainExamId + "&StuCustomerId=" + StuCustomerId;
}
//查看
function LookProposal(ProposalId) {
location.href = "/Student/ProposalCustomer/PreviewIndex?ProposalId=" + ProposalId;
}