185 lines
7.1 KiB
Plaintext
185 lines
7.1 KiB
Plaintext
@using WX.CRM.WebHelper;
|
|
@{
|
|
ViewBag.Title = "bas_agent";
|
|
Layout = "~/Views/Shared/_Index_Layout2.cshtml";
|
|
}
|
|
<script src="~/Scripts/op/tablegrid.sort.js"></script>
|
|
<div class="mvctool">
|
|
@Html.ToolButton("btnQuery", "icon-search", "查询", true)
|
|
@Html.ToolButton("btnAdd", "icon-add", "编辑", true)
|
|
@Html.ToolButton("btnDelete", "icon-remove", "删除", true)
|
|
@Html.ToolButton("btnTop", "icon-top", "顶端", true)
|
|
@Html.ToolButton("btnUp", "icon-up", "向上", true)
|
|
@Html.ToolButton("btnDown", "icon-down", "向下", true)
|
|
@Html.ToolButton("btnbottom", "icon-bottom", "底部", true)
|
|
</div>
|
|
<div class="bas_datagrid">
|
|
@Html.Raw(ViewBag.gridTable)
|
|
</div>
|
|
<script type="text/javascript">
|
|
var sortPKId = "0";
|
|
$(function () {
|
|
$('#tablist').tablegrid({
|
|
url: '/Base/DailyMemu/GetHtmlList',
|
|
height: $(window).height() - 50,
|
|
loadNow: true,
|
|
onLoadSuccess: function (data) {
|
|
if (sortPKId != "0") {
|
|
$("#tablist tbody tr").each(function () {
|
|
if ($(this).find("td[field='PKID']").html() == sortPKId) {
|
|
$(this).addClass("tr_onclick");
|
|
}
|
|
});
|
|
}
|
|
}, onLoadError: function (ex) {
|
|
//失败
|
|
}
|
|
});
|
|
$("#btnQuery").click(function () {//搜索按钮点击事件
|
|
$('#tablist').tablegrid("Search");
|
|
});
|
|
$("#btnDelete").click(function () {
|
|
Delete_Click();
|
|
});
|
|
$("#btnAdd").click(function () {
|
|
Create_Click();
|
|
});
|
|
$("#btnTop").click(function () {
|
|
Sort(1);
|
|
});
|
|
$("#btnUp").click(function () {
|
|
Sort(2);
|
|
});
|
|
$("#btnDown").click(function () {
|
|
Sort(3);
|
|
});
|
|
$("#btnbottom").click(function () {
|
|
Sort(4);
|
|
});
|
|
|
|
|
|
$(window).resize(function () {//自动适应大小
|
|
$('#tablist').tablegrid('resize', {
|
|
height: $(window).height() - 50
|
|
});
|
|
});
|
|
});
|
|
function frameReturnByClose() {
|
|
$("#modalwindow").window('close');
|
|
}
|
|
function frameReturnByReload(flag) {
|
|
$("#tablist").tablegrid("Load");
|
|
}
|
|
function frameReturnByMes(mes) {
|
|
$.messageBox5s('提示', mes);
|
|
}
|
|
</script>
|
|
@*ToolBar事件处理*@
|
|
<script type="text/javascript">
|
|
function GetIframeHtml(src) {
|
|
return "<iframe width='100%' height='98%' scrolling='no' frameborder='0'' src='" + src + "'></iframe>";
|
|
}
|
|
function Create_Click() {
|
|
$("#modalwindow").html(GetIframeHtml("/Base/DailyMemu/Edit"));
|
|
$("#modalwindow").window({ title: '编辑', width: 700, height: 400, iconCls: 'icon-add' }).window('open');
|
|
}
|
|
function Delete_Click() {
|
|
var row = $('#tablist').tablegrid('getSelected');
|
|
if (row != null) {
|
|
$.messager.confirm('提示', '@Suggestion.YouWantToDeleteTheSelectedRecords', function (r) {
|
|
if (r) {
|
|
$.r_post("/Base/DailyMemu/Delete?id=" + row.PKID, function (data) {
|
|
if (data.type == 1) {
|
|
$("#tablist").tablegrid('Load');
|
|
}
|
|
$.messageBox5s('提示', data.message);
|
|
}, "json");
|
|
}
|
|
});
|
|
} else { $.messageBox5s('提示', '@Suggestion.PlaseChooseToOperatingRecords'); }
|
|
}
|
|
function Sort(type) {
|
|
var row = $('#tablist').tablegrid('getSelected');
|
|
if (row != null) {
|
|
var str = "";
|
|
var id1 = row.PKID;
|
|
var sorid1 = row.SORTID;
|
|
sortPKId = id1;
|
|
if (type == 1) {
|
|
nRow = $("#tablist tbody .tr_onclick").prevAll().not(".tr_onclick");
|
|
if (nRow.length == 0) {
|
|
$.messager.alert("信息提示", "已经是最顶端了!", "erro")
|
|
return;
|
|
}
|
|
|
|
$(nRow).each(function () {
|
|
str += $(this).find("td[field='PKID']").html() + "," + (parseInt($(this).find("td[field='SORTID']").html()) + 1) + ";";
|
|
});
|
|
str += id1 + "," + "1";
|
|
}
|
|
else if (type == 2) {
|
|
nRow = $("#tablist tbody .tr_onclick").prev();
|
|
if (nRow.length == 0) {
|
|
$.messager.alert("信息提示", "已经是最顶端了!", "erro");
|
|
return;
|
|
}
|
|
id2 = $(nRow).find("td[field='PKID']").html();
|
|
var sortID = $(nRow).find("td[field='SORTID']").html();
|
|
//交换位置
|
|
sorid2 = sorid1;
|
|
sorid1 = sortID;
|
|
|
|
str = id1 + "," + sorid1 + ";" + id2 + "," + sorid2;
|
|
}
|
|
else if (type == 3) {
|
|
nRow = $("#tablist tbody .tr_onclick").next();
|
|
if (nRow.length == 0) {
|
|
$.messager.alert("信息提示", "已经是最底部了!", "erro");
|
|
return;
|
|
}
|
|
id2 = $(nRow).find("td[field='PKID']").html();
|
|
var sortID = $(nRow).find("td[field='SORTID']").html();
|
|
//交换位置
|
|
sorid2 = sorid1;
|
|
sorid1 = sortID;
|
|
|
|
str = id1 + "," + sorid1 + ";" + id2 + "," + sorid2;
|
|
}
|
|
else if (type == 4) {
|
|
nRow = $("#tablist tbody .tr_onclick").nextAll().not(".tr_onclick");
|
|
if (nRow.length == 0) {
|
|
$.messager.alert("信息提示", "已经是最底部了!", "erro");
|
|
return;
|
|
}
|
|
$(nRow).each(function () {
|
|
str += $(this).find("td[field='PKID']").html() + "," + (parseInt($(this).find("td[field='SORTID']").html()) - 1) + ";";
|
|
});
|
|
nRow = $("#tablist tbody tr:last");
|
|
str += id1 + "," + $(nRow).find("td[field='SORTID']").html();
|
|
|
|
}
|
|
$.r_post("/Base/DailyMemu/Sort?SortIds=" + str, function (data) {
|
|
if (data.type == 1) {
|
|
//var wrow = $("#tablist tbody .tr_onclick")
|
|
//if (type == 1) {
|
|
// $(wrow).clone().insertBefore("#tablist tbody tr:first");
|
|
// $(wrow).remove();
|
|
//} else if (type == 2) {
|
|
// $(wrow).clone().insertBefore($(wrow).prev());
|
|
// $(wrow).remove();
|
|
//} else if (type == 3) {
|
|
// $(wrow).clone().insertAfter($(wrow).next());
|
|
// $(wrow).remove();
|
|
//} else if (type == 4) {
|
|
// $("#tablist tbody").append($(wrow).clone());
|
|
// $(wrow).remove();
|
|
//}
|
|
$("#tablist").tablegrid("Load");
|
|
}
|
|
$.messageBox5s('提示', data.message);
|
|
}, "json");
|
|
|
|
} else { $.messageBox5s('提示', '@Suggestion.PlaseChooseToOperatingRecords'); }
|
|
}
|
|
</script>
|