199 lines
8.0 KiB
Plaintext
199 lines
8.0 KiB
Plaintext
@using WX.CRM.WebHelper
|
||
|
||
@{
|
||
ViewBag.Title = "客户关系申请";
|
||
Layout = "~/Views/Shared/_EasyUI_Layout.cshtml";
|
||
}
|
||
<style>
|
||
.bas_datagrid_table th {
|
||
text-align: center;
|
||
}
|
||
</style>
|
||
|
||
<link href="~/Content/main.css" rel="stylesheet" />
|
||
|
||
<div data-options="region:'west',split:true,width:($(window).width()/5*3)" style="border-left:none;border-bottom:none;border-top:none;">
|
||
<div class="mvctool">
|
||
@Html.ToolButton("btnQuery", "icon-search", "查询", true)
|
||
</div>
|
||
<div class="bas_datagrid" style="overflow:auto;">
|
||
<div id="tb" style="padding:5px;height:auto" class="grid_toolbar">
|
||
<ul class="toolBar_ul">
|
||
<li>客户1:<input id="txt_Res1" type="text" name="txt_Res1" style="width:180px" /> </li>
|
||
<li>客户2:<input id="txt_Res2" type="text" name="txt_Res2" style="width:180px" /> </li>
|
||
<li>
|
||
@*@Html.ToolButtonPlain("btnQuery" , "icon-search", "查询", false, "")*@
|
||
</li>
|
||
</ul>
|
||
</div>
|
||
@Html.Raw(ViewBag.ListOne)
|
||
</div>
|
||
</div>
|
||
<div data-options="region:'center'" style="border-right: none; border-bottom: none; ">
|
||
<input id="btnReview" class="btn btn-primary" type="button" value="下一步" disabled="disabled"/>
|
||
<input id="btnLast" class="btn btn-primary" type="button" value="重选" disabled="disabled" />
|
||
<br /><br />
|
||
@*<div class="bas_datagrid" style="overflow:auto;display:none" id="hiddentable">
|
||
<div id="tb" style="padding:5px;height:auto" class="grid_toolbar">
|
||
<ul class="toolBar_ul"></ul>
|
||
</div>
|
||
@Html.Raw(ViewBag.ListTwo)
|
||
</div>*@
|
||
<div id="reView"></div>
|
||
<br />
|
||
<div id="reason" style="display:none">
|
||
<span style="display:block;text-align:center">
|
||
<font size="4" style="border:thick">申请理由:</font>
|
||
<textarea id="txt_Reason" name="txt_Reason" style="width:400px;"></textarea>
|
||
</span>
|
||
</div>
|
||
<br />
|
||
<div id="buttons" style="display:none">
|
||
<span style="display:block;text-align:center;">
|
||
<input id="btnSubmit" class="btn btn-primary" type="button" value="确认" />
|
||
</span>
|
||
</div>
|
||
</div>
|
||
|
||
<script type="text/javascript">
|
||
$(function () {
|
||
$('#tablist').tablegrid({
|
||
url: '/Csvr/CustomerRelation/GetAllResIdInfo',
|
||
height: $(window).height() - 100,
|
||
loadNow: true,
|
||
ispage: true,
|
||
async: false
|
||
});
|
||
|
||
$("#btnQuery").click(function () {
|
||
$('#tablist').tablegrid("Search");
|
||
$("#btnReview").removeAttr("disabled");
|
||
});
|
||
|
||
$("#btnSubmit").click(function () {
|
||
var reason = $("#txt_Reason").val();
|
||
if (reason.length <= 0) {
|
||
$.messageBox5s("提示", "申请理由不能为空!");
|
||
} else {
|
||
var getData = [];
|
||
var rows = 0;
|
||
$("#tablist2 tbody tr").each(function (trindex, tritem) {//遍历每一行
|
||
rows = rows + 1;
|
||
var resId = $(tritem).find("td:eq(1)").text();
|
||
var oldCustomerid = $(tritem).find("td:eq(2)").text();
|
||
var newCustomerid = $(tritem).find("td:eq(3)").text();
|
||
|
||
getData.push({ resId: resId, newCustomerid: newCustomerid, oldCustomerid: oldCustomerid });
|
||
|
||
});
|
||
|
||
if (rows <= 1) {
|
||
$.messageBox5s("提示", "不存在可供申请的数据!");
|
||
//} else if (rows > 1 && rows < 3) {
|
||
// $.messageBox5s("提示", "客户关系申请至少存在两条记录!");
|
||
} else {
|
||
$.ajax({
|
||
type: 'post',
|
||
ContentType: "application/json",
|
||
dataType: 'json',
|
||
url: '/Csvr/CustomerRelation/Submit',
|
||
data: { Res1: $("#txt_Res1").val(), Res2: $("#txt_Res2").val(), Reason: $("#txt_Reason").val(), detail: JSON.stringify(getData) },
|
||
success: function (data) {
|
||
if (data.type == 1) {
|
||
$("#txt_Res1").val("");
|
||
$("#txt_Res2").val("");
|
||
$("#txt_Reason").val("");
|
||
$("#reason").hide();
|
||
$("#buttons").hide();
|
||
$("#tablist").tablegrid("Search");
|
||
$("#btnReview").attr("disabled", "disabled");
|
||
$("#btnLast").attr("disabled", "disabled");
|
||
$("#reView").hide();
|
||
$.messageBox5s("提示", "申请成功!");
|
||
}
|
||
else { $.messageBox5s("提示", data.message); }
|
||
|
||
},
|
||
error: function () {
|
||
$.messageBox5s("提示", data.message);
|
||
}
|
||
});
|
||
}
|
||
}
|
||
});
|
||
|
||
$("#btnReview").click(function () {
|
||
var flag = true;
|
||
var getData = [];
|
||
var rows = 0;
|
||
$("#tablist tbody tr").each(function (trindex, tritem) {//遍历每一行
|
||
rows = rows + 1;
|
||
var resId = $(tritem).find("td:eq(1)").text();
|
||
var oldCustomerid = $(tritem).find("td:eq(2)").text();
|
||
var newCustomerid = $(tritem).find("td:eq(5)").find("option:selected").text();
|
||
getData.push({ resId: resId, newCustomerid: newCustomerid, oldCustomerid: oldCustomerid });
|
||
if (oldCustomerid != newCustomerid) {
|
||
flag = false;
|
||
}
|
||
});
|
||
if (rows <= 1) {
|
||
$.messageBox5s("提示", "数据不存在!");
|
||
}
|
||
if (flag == true && rows>1) {
|
||
$.messageBox5s("提示", "请选择需要合并或拆分的主客户ID!");
|
||
} else {
|
||
$.ajax({
|
||
type: 'post',
|
||
ContentType: "application/json",
|
||
dataType: 'json',
|
||
url: '/Csvr/CustomerRelation/CheckData',
|
||
data: { data: JSON.stringify(getData) },
|
||
success: function (data) {
|
||
if (data.type !== 0) {
|
||
$("#divCustomerid select").each(function () {
|
||
$(this).attr("disabled", "disabled");
|
||
});
|
||
$("#reason").show();
|
||
$("#buttons").show();
|
||
$("#btnLast").removeAttr("disabled");
|
||
$("#btnReview").attr("disabled", "disabled");
|
||
$("#reView").show();
|
||
$("#reView").html(data.rowsList);
|
||
}
|
||
else {
|
||
$.messageBox5s("提示", data.message);
|
||
}
|
||
},
|
||
error: function () {
|
||
$.messageBox5s("提示", data.message);
|
||
}
|
||
});
|
||
}
|
||
})
|
||
|
||
$("#btnLast").click(function () {
|
||
$("#btnReview").removeAttr("disabled");
|
||
$("#btnLast").attr("disabled", "disabled");
|
||
$("#txt_Reason").val("");
|
||
$("#reason").hide();
|
||
$("#buttons").hide();
|
||
$("#reView").hide();
|
||
$("#divCustomerid select").each(function () {
|
||
$(this).removeAttr("disabled");
|
||
});
|
||
})
|
||
});
|
||
|
||
function frameReturnByClose() {
|
||
$("#modalwindow").window('close');
|
||
}
|
||
|
||
function frameReturnByReload(flag) {
|
||
$("#tablist").tablegrid("Load");
|
||
}
|
||
|
||
function frameReturnByMes(mes) {
|
||
$.messageBox5s('提示', mes);
|
||
}
|
||
</script>
|