TG.WXCRM.V4/WEB/Views/Res/Allocate/SeniordistributeBatchBind.c...

179 lines
6.5 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

@using WX.CRM.WebHelper
@{
ViewBag.Title = "分配员工";
Layout = "~/Views/Shared/_Index_Layout2.cshtml";
}
<div class="mvctool">
@Html.ToolButton("btnQuery", "icon-search", "查询", true)
@Html.ToolButton("btnSave", "icon-save", "保存", true)
</div>
<table style="width: 100%;margin-bottom:10px;margin-top:10px;">
<tr><td>新高级客服工号:<input type="text" name="NewEid" id="NewEid" /></td></tr>
</table>
<table style="width: 100%; border: 1px solid #95b8e7;">
<tr>
<td width="65%">
<div class="bas_datagrid">
<div id="tb" style="padding:5px;height:auto" class="grid_toolbar">
<ul class="toolBar_ul">
<li>原高级客服工号:<input type="text" name="txt_eID" />&nbsp;</li>
</ul>
</div>
@Html.Raw(ViewBag.gridTable)
</div>
</td>
<td width="5%">
<input type="button" value=">" style="width:40px;" onclick="MoveDataToRight()" title="将选中的vip客户移至已选择" />
<input type="button" value="<" style="width:40px;" onclick="RemoveChooseData()" title="清空右边选中vip客户" />
<input type="button" value="<<" style="width:40px;" onclick="ClearAllRightData()" title="清除所有" />
</td>
<td style="border: 1px solid #95b8e7;">
<div class="bas_datagrid">
<div id="tb" style="padding:5px;height:auto" class="grid_toolbar">
已选择VIP客户
</div>
@Html.Raw(ViewBag.gridTable2)
</div>
</td>
</tr>
</table>
<script type="text/javascript">
$(function () {
$("#btnSave").click(function () {
var rightRow = $('#tablis2').tablegrid('getAllRows');
if (rightRow == null || rightRow.length == 0) {
$.messager.alert('提示', '请添加你要绑定的高级客服工号!');
return;
}
var resIds = "";
$(rightRow).each(function (i, n) {
resIds += n.pkid + ",";
});
resIds = resIds.substr(0, resIds.length - 1);
newEid = $('#NewEid').val();
$.r_ajax({
url: "/Res/Allocate/SeniordistributeBatchBindSave",
type: "Post",
data: { resIds: resIds, newEid: newEid },
dataType: "json",
loading: true,
success: function (data) {
if (data.type == 1) {
window.parent.frameReturnByMes(data.message);
window.parent.frameReturnByReload(true);
window.parent.frameReturnByClose()
}
else {
window.parent.frameReturnByMes(data.message);
}
}
});
});
});
function MoveDataToRight() {
var leftRow = $('#tablist').tablegrid('getSelections');
var rightRow = $('#tablis2').tablegrid('getAllRows');
var isMove = 1;
$(leftRow).each(function (i, n) {
isMove = 1;
$(rightRow).each(function (x, w) {
if (w.resid == n.resid) {
isMove = 0;
}
});
if (isMove == 1) {
var html = "<tr><td style='width:25px;'>" + i + "</td>" +
"<td style='width:25px;'><input type='checkbox'></td>" +
"<td style='display:none;' field='pkid'>" + n.pkid + "</td>" +
"<td field='resid'>" + n.resid + "</td>" +
"<td field='subProductName'>" + n.subProductName + "</td>" +
"</tr>";
$("#tablis2").find("tbody").append(html);
}
});
RebuildIndex();
}
function RemoveChooseData() {
var rightRow = $('#tablis2').tablegrid('getSelections');
$("#tablis2").find("tbody tr").each(function (i, n) {
var nrow = $(this);
var npkid = $(nrow).find("td:[field='pkid']").text()
$(rightRow).each(function (x, w) {
if (w.pkid == npkid) {
$(nrow).remove()
}
});
});
$("#tablis2").find("tbody tr").each(function (i, n) {
$(this).find("td:first-child").html(i + 1);
});
}
function ClearAllRightData() {
$.messager.confirm('提示', '您确定要全部清除右边所选数据吗?', function (r) {
if (r) {
$('#tablis2').tablegrid('Clear');
}
});
}
//重建序号
function RebuildIndex() {
$("#tablis2").find("tbody tr").each(function (i, n) {
$(this).find("td:first-child").html(i + 1);
});
}
</script>
<script type="text/javascript">
$(function () {
$('#tablist').tablegrid({
url: '/Res/Allocate/SeniordistributeBatchBindGetHtmlList',
height: $(window).height() - 150,
loadNow: false,
isCheckMore: true,
isPage: true
});
$('#tablis2').tablegrid({
url: '',
height: $(window).height() - 150,
loadNow: false,
isCheckMore: true,
isPage: false
});
$("#btnQuery").click(function () {//搜索按钮点击事件
$('#tablist').tablegrid("Search");
});
$(window).resize(function () {//自动适应大小
$('#tablist').tablegrid('resize', {
height: $(window).height() - 150
});
$('#tablis2').tablegrid('resize', {
height: $(window).height() - 150
});
});
$('#tablis2').tablegrid('resize', {
height: $(window).height() - 150
});
});
function frameReturnByClose() {
$("#modalwindow").window('close');
}
function frameReturnByReload(flag) {
$("#tablist").tablegrid("Load");
}
function frameReturnByMes(mes) {
$.messageBox5s('提示', mes);
}
function getPageOptions(gridID) {
var option = $("#tablist").tablepage('getPagination');
var str = "rows=" + option.rows + "&page=" + option.page + "&order=" + option.order + "&sort=" + option.sort;
return str;
}
//获取datagrid头部及字段
function getDataGridHeader() {
var columns = $('#tablist').tablegrid("getHead");
return columns;
}
</script>