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

116 lines
4.0 KiB
Plaintext
Raw 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 = "GroupPercent";
Layout = "~/Views/Shared/_Index_Layout2.cshtml";
}
<script type="text/javascript">
$(function () {
$('#tablist').tablegrid({
url: '/Res/WX/GetGroupPercentHtmlList',
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">
@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 UpdateGroupPercent_Click() {
$.messager.confirm('提示', '你确定要更新分配比例吗?', function (r) {
if (r) {
var percents = "";
var gids = "";
var flag = true;
var sum = 0;
$("[gID]").each(function () {
if (isNaN($(this).val())) {
$.messageBox5s('错误', '比例只能是数字');
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;
}
sum += parseFloat($(this).val());
gids += $(this).attr("gID") + ",";
percents += $(this).val() + ",";
}
});
/*if (sum !== 0 && flag) {
$.messageBox5s('错误', '所有微调的比例之和必须为0');
flag = false;
return;
}*/
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)
$.r_post("/Res/WX/UpdateGroupPercent?percents=" + percents + "&gids=" + gids, function (data) {
if (data.type == 1) {
$("#tablist").tablegrid('Load');
}
$.messageBox5s('提示', data.message + '!<br>' + data.value);
}, "json");
}
}
});
}
function GroupAverageAllot_Click() {
$.messager.confirm('提示', '你确定要更平均分配比例吗?', function (r) {
if (r) {
$.r_post("/Res/WX/GroupAverageAllot", function (data) {
if (data.type == 1) {
$("#tablist").tablegrid('Load');
}
$.messageBox5s('提示', data.message);
}, "json");
}
});
}
</script>