TG.WXCRM.V4/WEB/Views/QH/CustomerSaleUser/BatchBind.cshtml

178 lines
7.0 KiB
Plaintext

@using WX.CRM.WebHelper
@{
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="将选中的售后工单移至已选择" />
<input type="button" value="<" style="width:40px;" onclick="RemoveChooseData()" title="清空右边选中售后工单" />
<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">
已选择售后工单:
</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 userAccount = "";
$(rightRow).each(function (i, n) {
userAccount += n.USERACCOUNT + ",";
});
userAccount = userAccount.substr(0, userAccount.length - 1);
newEid = $('#NewEid').val();
$.r_ajax({
url: "/QH/CustomerSaleUser/BatchBind",
type: "Post",
data: { userAccount: userAccount,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='USERACCOUNT'>" + n.USERACCOUNT + "</td>" +
"<td field='INNERUSERNAME'>" + n.INNERUSERNAME + "</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: '/QH/CustomerSaleUser/BatchBindGetHtmlList',
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>