TG.WXCRM.V4/WEB/Views/Res/WX/UserPercent.cshtml

139 lines
4.9 KiB
Plaintext

@using WX.CRM.WebHelper;
@{
ViewBag.Title = "UserPercent";
Layout = "~/Views/Shared/_Index_Layout2.cshtml";
}
<script type="text/javascript">
$(function () {
$('#tablist').tablegrid({
url: '/Res/WX/GetUserPercentHtmlList',
height: $(window).height() - 110,
loadNow: true
});
$(window).resize(function () {//自动适应大小
$('#tablist').tablegrid('resize', {
height: $(window).height() - 110
});
});
});
//ifram 返回
function frameReturnByClose() {
$("#modalwindow").window('close');
}
function frameReturnByReload(flag) {
$("#tablist").tablegrid("Load");
}
function frameReturnByMes(mes) {
$.messageBox5s('提示', mes);
}
</script>
<div class="mvctool">
@Html.Action("ToolBar", "Control", ViewBag.ToolBar as ToolBar)
</div>
<div class="bas_datagrid">
@if (ViewBag.showGroup == "1")
{
<div id="tb" style="padding:5px;height:auto" class="grid_toolbar">
<ul class="toolBar_ul">
<li>
客服小组:<select id="slt_gid" name="slt_gid" style="width:150px;height:22px" onChange="changeselect(this.value)">
@foreach (var item in ViewBag.groupList as List<SelectListItem>)
{
<option value="@item.Value">@item.Text</option>
}
</select>
</li>
</ul>
</div>
}
@Html.Raw(ViewBag.gridTable)
</div>
@*ToolBar事件处理*@
<script type="text/javascript">
function GetIframeHtml(src) {
return "<iframe width='100%' height='98%' scrolling='no' frameborder='0'' src='" + src + "'></iframe>";
}
function UpdateUserPercent_Click() {
$.messager.confirm('提示', '你确定要更新分配比例吗?', function (r) {
if (r) {
var percents = "";
var gids = "";
var eids = "";
var flag = true;
$("[eID]").each(function () {
if (isNaN($(this).val())) {
alert('比例只能是数字');
flag = false;
return;
}
if ($(this).attr("oldvalue") != $(this).val() || $(this).val() != 0) {//只获取以改变的数据
var s = parseFloat($(this).attr("ratevalue")) + parseFloat($(this).val());
if (s < 0) {
$.messageBox5s('错误', '微调的比例与对应小组分配的比例之和不能小于0');
flag = false;
return;
}
gids += $(this).attr("gID") + ",";
percents += $(this).val() + ",";
eids += $(this).attr("eID") + ",";
}
});
if (flag) {
if (gids.length > 0){
gids = gids.substr(0, gids.length - 1)
}
else {
$.messageBox5s('错误', '没有需要修改的数据');
return;
}
if (percents.length > 0)
percents = percents.substr(0, percents.length - 1)
if (eids.length > 0)
eids = eids.substr(0, eids.length - 1)
$.r_post("/Res/WX/UpdateUserPercent?percents=" + percents + "&gids=" + gids + "&eids=" + eids, function (data) {
if (data.type == 1) {
$("#tablist").tablegrid('Load');
}
$.messageBox5s('提示', data.message + '!<br>' + data.value);
}, "json");
}
}
});
}
function UserAverageAllot_Click() {
$.messager.confirm('提示', '你确定要更平均分配比例吗?', function (r) {
if (r) {
$.r_post("/Res/WX/UserAverageAllot", function (data) {
if (data.type == 1) {
$("#tablist").tablegrid('Load');
}
$.messageBox5s('提示', data.message);
}, "json");
}
});
}
function getDataGridHeader() {
var columns = $('#tablist').tablegrid("getHead");
return columns;
}
function ExportAllPage_Click1()
{
$("#modalwindow").html(GetIframeHtml("/Control/ExcelExport?Query=" + encodeURIComponent("/Res/WX/UserPercentExport?" + GetQueryStr())));
$("#modalwindow").window({ title: '导出', width: 480, height: 300, iconCls: 'icon-export' }).window('open');
}
function changeselect(gid) {
$("#tablist").tablegrid("Search");
}
</script>