TG.WXCRM.V4/WEB/html/SalesGroupDetails.html

365 lines
17 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<title>Index</title>
<script src="/Scripts/jquery.min.js" type="text/javascript"></script>
<script src="/Scripts/op/jquery.rewrite.js"></script>
<script src="/Scripts/json2.js"></script>
<script src="/Scripts/jquery.easyui.min.js" type="text/javascript"></script>
<script src="/Scripts/jquery.easyui.plus.js"></script>
<script src="/Scripts/op/datagrid_op.js"></script>
<script src="/Scripts/op/main_op.js"></script>
<script src="/Scripts/jquery.form.js"></script>
<script src="/Scripts/op/jquery.tablegrid.js"></script>
<script src="/Scripts/My97DatePicker/WdatePicker.js"></script>
<script src="/Scripts/op/UserComBoxByRole.js"></script>
<script src="/Scripts/common.js"></script>
<link rel="stylesheet" type="text/css" href="/Content/Common.css" />
<link href="/Content/themes/blue/easyui.css" rel="stylesheet" />
<link href="/Content/Site.css" rel="stylesheet" />
<script src="/Scripts/common.js"></script>
<link href="/Content/data_grid_list.css" rel="stylesheet" />
<link href="/layui-v2.5.4/css/layui _up.css" rel="stylesheet" />
<link href="/layui-v2.5.4/css/common.css" rel="stylesheet" />
<style>
.bodyDiv {
margin: 7px 5px 0px 0px;
padding-left: 15px;
padding-right: 15px;
overflow: hidden;
background-color: white;
}
body {
background-color: #eff0f4;
}
.layui-table th {
word-wrap: normal;
}
.layui-table td {
word-break: break-all;
word-wrap: break-word;
padding: 9px 5px;
display: table-cell;
}
.window-header {
border: unset;
}
</style>
<script>
$(function () {
var mm22 = $("#btnQuery");
if ($(mm22).length > 0) {
mm22.remove();
var searchHtml = '<button class="layui-btn layui-btn-sm layui-btn-primary" data-method="search" id="btnQuery">'
+ '<span class="csicon2 icon-search"></span>'
+ '<span class="csicontitle">搜索</span>'
+ '</button>';
var html = '<li class="show_condition"><input id="btnQuery" class="layui-btn layui-btn-sm layui-btn-ok" data-method="search" type="button" value="查询"><input class="layui-btn layui-btn-sm layui-btn-reset" type="reset" value="清空"></li>';
//var html = '<li class="show_condition">' + searchHtml+'<input class="layui-btn layui-btn-sm layui-btn-reset" type="reset" value="清空"></li>';
$(".grid_toolbar .toolBar_ul").append(html);
}
var tttbar = $(".grid_toolbar");
if (tttbar.length > 0) {
$(tttbar).wrapAll("<form></form>");
}
$(".mvctool .datagrid-btn-separator").remove();
var toolbartitle = $(".mvctool .mvctool_mytitle");
if (toolbartitle.length == 0) {
var defaulttitle = "";
var titlehtml = '<div class="mvctool_mytitle">数据列表</div >';
if (defaulttitle != "") {
titlehtml = '<div class="mvctool_mytitle">' + defaulttitle + '</div >'
}
$(".mvctool:not([noControl])").prepend(titlehtml);
}
$(".mvctool .l-btn-plain").each(function (x, a) {
var icon = $(this).find(".l-btn-text").attr("class");
if (icon != null) {
icon = icon.replace("l-btn-text", "");
}
var buttonhtml = '<button class="layui-btn layui-btn-sm layui-btn-primary" data-method="' + $(this).attr("id") + '" ' + ($(this).attr("onclick") != null ? 'onclick="' + $(this).attr("onclick") + '"' : '') + '" id="' + $(this).attr("id") + '" >'
buttonhtml += '<span class="csicon2 ' + icon + '"></span>';
buttonhtml += '<span class="csicontitle">' + $(this).find(".l-btn-text").text() + '</span>';
buttonhtml += "</button>";
$(this).after(buttonhtml);
$(this).remove();
});
//tableHeader();
});
</script>
</head>
<body>
<div class="bodyDiv">
<div class="mvctool">
<a id="btnQuery" style="float: left;" class="l-btn l-btn-plain">
<span class="l-btn-left">
<span class="l-btn-text icon-search" style="padding-left: 20px;">
查询
</span>
</span>
</a>
<div class="datagrid-btn-separator"></div>
<a id="btnSave" style="float: left;" class="l-btn l-btn-plain">
<span class="l-btn-left">
<span class="l-btn-text icon-save" style="padding-left: 20px;">
确定选择
</span>
</span>
</a>
<div class="datagrid-btn-separator"></div>
</div>
<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="innerGroupId" id="innerGroupId" style="width:160px;" /><input type="hidden" name="txt_innerGroupId" id="txt_innerGroupId" value="" />&nbsp;</li>
<li>工号:<input type="text" name="txt_eID" />&nbsp;</li>
<li>姓名:<input type="text" name="txt_uName" />&nbsp;</li>
</ul>
</div>
<div class='grid_table'>
<table width='100%' id='tablist' state='false' cellspacing='0' cellpadding='0' class='layui-table ' lay-size='sm' columns='pkid,map_eID,map_uName,map_trueName,gName'>
<thead>
<tr class='grid_table_head'>
<th style='width:25px;'>&nbsp;</th>
<th style='width:25px;'><input type='checkbox' ntype='checkAll' /></th>
<th field='pkid' style='display:none'>ID</th>
<th field='map_eID' class='tablegrid_sort ' width="">工号<span class='tablegrid-sort-icon'>&nbsp;</span></th>
<th field='map_uName' class='tablegrid_sort ' width="">姓名<span class='tablegrid-sort-icon'>&nbsp;</span></th>
<th field='map_trueName' width="">真实姓名</th>
<th field='gName' width="">销售组</th>
</tr>
</thead>
<tbody></tbody>
</table><div style='width:100%;height:100px;'></div>
</div><div pagination='{"pagination":"50,100","rows":50,"page":1,"order":null,"sort":null,"totalRows":0,"totalPages":0}' class='datagrid-pager pagination' tableId='tablist'> </div>
</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 style="padding:5px;height:auto;">
<span style="padding-right:40%">已选择员工</span>
</div>
<div class='grid_table'>
<table width='100%' id='tablis2' state='false' cellspacing='0' cellpadding='0' class='layui-table ' lay-size='sm' columns='pkid,map_eID,map_uName,resrate'>
<thead>
<tr class='grid_table_head'>
<th style='width:25px;'>&nbsp;</th>
<th style='width:25px;'><input type='checkbox' ntype='checkAll' /></th>
<th field='pkid' style='display:none'>ID</th>
<th field='map_eID' width="65px">工号</th>
<th field='map_uName' width="">姓名</th>
</tr>
</thead>
<thead>
</thead>
<tbody></tbody>
</table><div style='width:100%;height:100px;'></div>
</div>
</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 userIds = "";
var userTxt = "";
$(rightRow).each(function (i, n) {
userTxt += n.map_uName + "-" + n.map_eID + ",";
userIds += n.pkid + ",";
});
userIds = userIds.substr(0, userIds.length - 1);
userTxt = userTxt.substr(0, userTxt.length - 1);
window.parent.setUser(userTxt, userIds);
window.parent.frameReturnByClose();
});
});
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.pkid == n.pkid) {
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='map_eID'>" + n.map_eID + "</td>" +
"<td field='map_uName'>" + n.map_uName + "</td>" +
//"<td field='resrate'><input type='text' value='0' style='width: 50px' onchange='setrate(this)' rate='0' />%</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 GetGroups() {
var node = $("#innerGroupId").combotree("tree").tree('getSelected');
var tree = $("#innerGroupId").tree;
var isLeaf = tree('isLeaf', node.target);
var gorupidvalues = "";
if (node.id.toString().indexOf("com_") == -1 && node.id.toString().indexOf("sale_") == -1)
gorupidvalues = node.id.toString() + ",";
if (!isLeaf) {//不是最底层
var child = $("#innerGroupId").combotree("tree").tree("getChildren", node.target);
if (node.id != 0 && child != null) {
for (var i = 0; i < child.length; i++) {
if (child[i].id.toString().indexOf("com_") == -1 && child[i].id.toString().indexOf("sale_") == -1)
gorupidvalues += child[i].id + ","
}
}
}
if (gorupidvalues.length > 0)
return gorupidvalues.substr(0, gorupidvalues.length - 1);
else
return "-1";
}
$(function () {
$("#innerGroupId").combotree({
url: "/Base/InnerGroup/GetTreeIsSaleList?type=0",
onSelect: function (node) {
var groups = GetGroups();
$("#txt_innerGroupId").val(groups);//获取组
},
onLoadSuccess: function () {
var root = $("#innerGroupId").combotree("tree").tree("getRoots");
if (root != null) {
//$("#innerGroupId").combotree('tree').tree("select", root.target);
$("#innerGroupId").combotree('setValue', root[0].id);
}
}
});
$('#tablist').tablegrid({
url: '/Res/SalesGroup/SalesGroupDetailsGetHtmlList',
height: $(window).height() - 110,
loadNow: false,
isCheckMore: true,
isPage: true
});
$('#tablis2').tablegrid({
url: '',
height: $(window).height() - 110,
loadNow: false,
isCheckMore: true,
isPage: false
});
$("#btnQuery").click(function () {//搜索按钮点击事件
//$('#tablist').tablegrid("Search");
$('#tablist').tablegrid({
url: '/Res/SalesGroup/SalesGroupDetailsGetHtmlList',
height: $(window).height() - 110,
loadNow: true,
isCheckMore: true,
isPage: true
});
});
$(window).resize(function () {//自动适应大小
$('#tablist').tablegrid('resize', {
height: $(window).height() - 110
});
$('#tablis2').tablegrid('resize', {
height: $(window).height() - 110
});
});
$('#tablis2').tablegrid('resize', {
height: $(window).height() - 110
});
});
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>
</div>
</body>
</html>