TG.WXCRM.V4/WEB/Views/WeWork/WxResource/Index.cshtml

242 lines
9.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 = "Index";
Layout = "~/Views/Shared/_content.cshtml";
}
<script src="/Scripts/jquery.easyui.min.js" type="text/javascript"></script>
<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" />
<script src="/Scripts/op/jquery.rewrite.js"></script>
<style type="text/css">
.xm-option {
line-height: 30px;
}
#fromuser-box {
width: 80%;
margin: 50px;
}
#touser-box {
width: 80%;
margin: 50px;
}
</style>
<div class="layui-fluid" style="padding-left:0px;padding-top:10px;">
<div class="layui-card" id="topcard" style="width:100%;padding-top:10px;">
<div class="layui-card-header layui-self-header">
<div style="float:left;position:relative;">
流转记录
</div>
<div class="hrclass" style="position:relative;float: left;"></div>
</div>
<div class="layui-card-body " id="contentBody">
<form class="layui-form selftopwhere" id="myform">
</form>
<table class="layui-hide" id="tabl1" lay-filter="tabl1"></table>
</div>
</div>
</div>
<div id="fromuser-box" style="display:none">
<div class="layui-form">
<table cellspacing="0" cellpadding="0" border="0" class="layui-table" lay-size="sm" id="fromTable">
</table>
</div>
</div>
<div id="touser-box" style="display:none">
<h1 id="failText" style="display:none;margin-left:5px;margin-bottom:20px;">失败:<span id="failCount"></span></h1>
<div class="layui-form">
<table cellspacing="0" cellpadding="0" border="0" class="layui-table" lay-size="sm" id="toTable">
</table>
</div>
</div>
<!--确定宽度-->
<script>
function onLoadSucced() {
}
</script>
<script>
var apiPath = '@ViewBag.apiPath';
var selectRow = {};
var table;
var importData = [];
var deptids = '@ViewBag.Deptid';
layui.use(['table', 'form', 'layer', 'upload'], function () {
table = layui.table;
var layer = layui.layer;
var form = layui.form;
var upload = layui.upload;
var param2 = $("#myform").serializeFormJSON();
console.log(param2);
table.render({
id: 'testReload',//列表别名ID
elem: '#tabl1',//表ID
url: apiPath + '/Api/WeWorkResource/page?deptids=' + deptids,
method: 'Get',
request: {
pageName: 'PageIndex' //页码的参数名称默认page
,limitName: 'PageSize' //每页数据量的参数名默认limit
},
response: {
statusName: 'code' //规定数据状态的字段名称默认code
, statusCode: 0 //规定成功的状态码默认0
, msgName: 'message' //规定状态信息的字段名称默认msg
},
parseData: function (res) { //res 即为原始返回的数据'
return {
"code": res.code, //解析接口状态
"msg": res.message, //解析提示文本
"count": res.data.total, //解析数据长度
"data": res.data.data //解析数据列表
};
},
cols: [[
{ field: 'date', title: '日期' }
, { field: 'groupName', title: '转移分群名称' }
, { field: 'productModule', title: '转移人员', templet: '#tranfTpl' }
, { field: 'flowCount', title: '分配账号数' }
, { field: 'successCount', title: '成功' }
, { field: 'status', title: '接替人员及数量', templet: '#receiveTpl' }
, {
field: 'eidname', title: '操作人', width: 250, templet: function (d) {
return d.eid + "-" + d.ename;
}
}
]]
, page: { //支持传入 laypage 组件的所有参数某些参数除外jump/elem - 详见文档
layout: ['limit', 'count', 'prev', 'page', 'next', 'skip', 'refresh'] //自定义分页布局
//,curr: 5 //设定初始在第 5 页
, groups: 5 //只显示 1 个连续页码
}
, where: param2
});
$('#mytoolbar #search').on('click', function (data) {
var param = GetParams("mytoolbar");
table.reload('testReload', {
page: {
curr: 1 //重新从第 1 页开始
},
where: param
});
});
//清空
$("#clear").on('click', function (e) {
$("#mytoolbar input[type='text']").val("");
$("#mytoolbar select").val("");
form.render("select");
});
//监听行单击事件
table.on('row(tabl1)', function (obj) {
var data = obj.data;
//console.log(data);
//标注选中样式
obj.tr.addClass('self-table-click').siblings().removeClass('self-table-click');
selectRow = data;
});
//点击事件
var active = {
};
});
function GetImportData() {
return importData;
}
function TableReload() {
var param = GetParams("mytoolbar");
table.reload('testReload', {
page: {
curr: 1 //重新从第 1 页开始
},
where: param
});
}
function SearchFromUser(id) {
$.ajax({
type: "GET",
url: apiPath + '/Api/WeWorkResource/FromUser?id=' + id ,
dataType: "json",
contentType: "application/json",
success: function (da) {
if (da.code == 0) {
$("#fromTable tbody").empty();
$("#fromTable").append("<tr><th>成员</th ><th>转移关系数量</th></tr>");
for (var i = 0; i < da.data.length; i++) {
var outuser = da.data[i];
$("#fromTable tbody").append("<tr> <td>" + outuser.userid + "(" + outuser.eid + "-" + outuser.ename + ")</td><td>"
+ outuser.transferCount + "</td></tr>");
}
winindex = layer.open({
title: '',
type: 1
, content: $('#fromuser-box')
, area: ['600px', '450px']
});
} else {
layer.msg(da.message, { icon: 2 });
}
},
error: function () {
layer.msg('操作失败!', { icon: 2 });
}
});
}
function SearchToUser(id) {
$.ajax({
type: "GET",
url: apiPath + '/Api/WeWorkResource/ToUser?id=' + id,
dataType: "json",
contentType: "application/json",
success: function (da) {
if (da.code == 0) {
debugger
$("#toTable tbody").empty();
if (da.data.failCount > 0) {
$('#failText').show();
$('#failCount').text(da.data.failCount);
} else {
$('#failText').hide();
}
$("#toTable").append("<tr><th>成员</th ><th>分配数量</th><th>接替成功</th><th>无好友关系</th><th>成员禁用</th><th>用户拒绝</th><th>其他原因</th></tr>");
var data = da.data.toUserModel;
for (var i = 0; i < data.length; i++) {
var outuser = data[i];
$("#toTable tbody").append("<tr> <td>" + outuser.userid + "(" + outuser.eid + "-" + outuser.ename + ")</td><td>"
+ outuser.flowCount + "</td><td>" + outuser.successCount + "</td><td>" + outuser.noneCount + "</td><td>" + outuser.forbidCount + "</td><td>" + outuser.refundCount + "</td><td>" + outuser.otherCount + "</td></tr>");
}
winindex = layer.open({
title: '',
type: 1
, content: $('#touser-box')
, area: ['800px', '550px']
});
} else {
layer.msg(da.message, { icon: 2 });
}
},
error: function () {
layer.msg('操作失败!', { icon: 2 });
}
});
}
</script>
<script type="text/html" id="tranfTpl">
<a href="javascript:void(0)" onclick="SearchFromUser('{{d.id}}')" style="color: #169BD5;">查看</a>
</script>
<script type="text/html" id="receiveTpl">
<a href="javascript:void(0)" onclick="SearchToUser('{{d.id}}')" style="color: #169BD5;">查看</a>
</script>