TG.WXCRM.V4/WEB/Views/Ww/MyWork/Index.cshtml

612 lines
30 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;
}
.layui-btn-red {
background: #FF4D4D;
}
</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 style="float:right;position:relative;">
@Html.Action("ToolBarNew", "Control", new
{
tool = ViewBag.ToolBar as ToolBar,
otherToolBars = new ToolBarNew[] {
new ToolBarNew(){ btnColor="", btnName="聊天记录" },
new ToolBarNew(){ btnColor="", btnName="外部联系人" },
new ToolBarNew(){ btnColor="", btnName="查找客户" },
new ToolBarNew(){ btnColor="", btnName="群管理" },
new ToolBarNew(){ btnColor="", btnName="解绑" },
new ToolBarNew(){ btnColor="layui-btn-red", btnName="设置" },
new ToolBarNew(){ btnColor="", btnName="测试企微" },
new ToolBarNew(){ btnColor="layui-btn-red", btnName="批量设置推广" },
new ToolBarNew(){ btnColor="", btnName="导出" },
new ToolBarNew(){ btnColor="", btnName="拉取信息" }
}
})
</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">
<div class="layui-form-item">
<div class="layui-inline" style="width:900px;display:flex">
@Html.Action("UserSSOComBox", "Control", new { currentRight = WX.CRM.WebHelper.InitRights.CONST_付费企业微信 })
</div>
客服工号:
<div class="layui-inline">
<input type="text" name="seid" required lay-verify="required" placeholder="客服工号" autocomplete="off" class="layui-input" value="@ViewBag.eid">
</div>
企业:
<div class="layui-inline" style="width:250px">
@* @Html.DropDownList("corp", ViewBag.Select as List<SelectListItem>, new Dictionary<string, object> {
{ "lay-filter", "corp_deptid" },
})*@
<div id="corp"></div>
<div id="firstcorp" style="display:none"></div>
</div>
名称:
<div class="layui-inline">
<input type="text" name="name" required lay-verify="required" placeholder="ID/名称/号码" autocomplete="off" class="layui-input">
<input type="hidden" name="deptid" id="deptid" value="">
</div>
<div style="@(ViewBag.IsJG?"display:none":"")">
推广状态:
<span class="layui-inline">
@if (ViewBag.assignStatus == 3)
{
<select name="assignStatus">
<option value="-1">全部</option>
<option value="1">推广可生码</option>
<option value="0">不推广可生码</option>
<option value="4">不推广不可生码</option>
</select>
}
else if (ViewBag.assignStatus == 4)
{
<select name="assignStatus">
<option value="-1">全部</option>
<option value="1">推广可生码</option>
<option value="0">不推广可生码</option>
<option value="4" selected="selected">不推广不可生码</option>
</select>
}
else
{
<select name="assignStatus">
<option value="-1">全部</option>
<option value="1">推广可生码</option>
<option value="0">不推广可生码</option>
<option value="4">不推广不可生码</option>
</select>
}
</span>
企微状态:
<div class="layui-inline">
<select name="Status">
<option value="-1">全部</option>
<option value="1">正常</option>
<option value="3">删除</option>
<option value="4">异常</option>
</select>
</div>
</div>
是否绑定:
<div class="layui-inline">
<select name="bindStatus">
<option value="">全部</option>
<option value="1">已绑定</option>
<option value="2">未绑定</option>
<option value="3">部门绑定</option>
</select>
</div>
排序:
<div class="layui-inline">
<select name="orderType">
<option value="1">本部门优先</option>
<option value="2">非本部门优先</option>
</select>
</div>
<div class="layui-inline" style="display:none">
是够查看:
<input type="text" name="isExe" id="isExe" style="width: 100px" value="@ViewBag.isExe" />
<input type="text" name="fiterUser" id="fiterUser" style="width: 100px" value="@ViewBag.fiterUser" />
</div>
日期:
<div class="layui-inline">
<input class="layui-input" placeholder="开始日" name="xstime" id="start" style="width:120px;" autocomplete="off">
</div>
<div class="layui-inline">
<input class="layui-input" placeholder="截止日" name="xetime" id="end" style="width:120px;" autocomplete="off">
</div>
<div class="layui-inline">
<input 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" data-method="reset" type="reset" value="清空" />
</div>
</div>
</form>
<table class="layui-hide" id="tab_kefuzhuangtaiyi1" lay-filter="wochao"></table>
<iframe id="BillOpen" width="0" height="0" scrolling="no" frameborder="0" style="display:none;"></iframe>
</div>
</div>
</div>
<!--确定宽度-->
<script>
function onLoadSucced() {
}
var allChannel = @Html.Raw(ViewBag.Select);
var firstname = "";
var optionsChannel = {
el: '#corp',
name: 'corp',//表单的name属性
layVerify: '',
tips: '请选择企业',
toolbar: {//工具条,全选,清空,反选,自定义
show: true,
list: [
'CLEAR'
]
},
on: function (data) {
debugger
var userid = "";
let mydeptid = "";
for (var i = 0; i < data.arr.length; i++) {
userid += data.arr[i].value + ",";
$(mydata.filter(m => m.corpid == data.arr[i].value)).each(function (is, sw) {
if (sw.deptid != "") {
mydeptid += data.arr[i].value + "_" + sw.deptid + ";";
}
});
}
if (data.arr.length > 0) {
$("#firstcorp").val(data.arr[0].value);
firstname = data.arr[0].name;
} else {
$("#firstcorp").val("");
firstname = "";
}
mydeptid = mydeptid.substring(0, mydeptid.length - 1)
$("#deptid").val(mydeptid);
},
data: []
};
var selectChannel = xmSelect.render(optionsChannel);
selectChannel.update({ data: allChannel, initValue: allChannel });
if (allChannel.length > 0) {
$("#firstcorp").val(allChannel[0].value);
firstname = allChannel[0].name;
}
//企业号的数据
var mydata=@Html.Raw(ViewBag.DataList);
var table;
$(function () {
var myrequest = "@Html.Raw(ViewBag.companycode)";
if (myrequest != "") {
let mydeptid = "";
$(mydata).each(function (is, sw) {
if (sw.deptid != "") {
mydeptid += sw.corpid + "_" + sw.deptid + ";";
}
});
mydeptid = mydeptid.substring(0, mydeptid.length - 1)
$("#deptid").val(mydeptid);
}
});
</script>
<script>
layui.use('laydate', function () {
var laydate = layui.laydate;
//执行一个laydate实例
//本月的开始时间
var nowDate = new Date(); //当前日期;
laydate.render({
elem: '#start', //指定元素
value: nowDate
});
//执行一个laydate实例
laydate.render({
elem: '#end',//指定元素
value: '@DateTime.Now.AddDays(1).ToString("yyyy-MM-dd")'
});
});
var selectRow = {};
var winindex;
var layer;
var rowid;
var hide_jg = @(ViewBag.IsJG? "true": "false");
//注意:选项卡 依赖 element 模块,否则无法进行功能性操作
layui.use('element', function () {
var element = layui.element;
element.on('tab(tonghuajiankong)', function (n) {
$(".bodytable").addClass("hidden");
$("#kefuzhuangtai" + (n.index + 1)).removeClass("hidden");
});
element.on('tab(maintab)', function (n) {
if (n.index == 0)
$("#bottomcard").removeClass("hidden");
else
$("#bottomcard").addClass("hidden");
});
});
layui.use(['laypage', 'layer', 'table', 'laydate', 'form'], function () {
var form = layui.form;
var laydate = layui.laydate;
layer = layui.layer;
table = layui.table;
table.render({
id: 'listReload'//列表别名ID
, elem: '#tab_kefuzhuangtaiyi1'
, url: 'GetWeWorktHtmlList'
, method: 'POST'
, cellMinWidth: 80 //全局定义常规单元格的最小宽度layui 2.2.1 新增
, page: true
, limit: 90
, height: "full-160"
,autoSort:false
//, size:"sm"
, cols: [[
{ field: 'checkobj', type: 'checkbox', fixed: 'left' }
,{ field: 'numbers', type: 'numbers' }
, { field: 'corpid', title: '企业ID' }
, { field: 'corpname', title: '企业号' }
, { field: 'userid', title: 'ID' }
, { field: 'mobile', title: '号码' }
, { field: 'uname', title: '名称' }
, { field: 'eidAndName', title: '工号/姓名' }
, { field: 'gname', title: '组别' }
, { field: 'assignStatu', title: '推广', templet: '#assignStatuTpl', hide: hide_jg }
, { field: 'Status', title: '企微状态', templet: '#statusTpl', hide: hide_jg }
, { field: 'lmsgtime', title: '最后聊天时间' }
, { field: 'deptname', title: '部门信息', templet: '#DeptTpl', width: 200 }
, { field: 'email', title: '邮箱' }
, { field: 'newAdd', title: '新增数量', sort: true }
, { field: 'myExtuser', title: '客户总数', width: 100 }
]], where: $("#myform").serializeFormJSON()
,
done: function (res, curr, count) {
$("#isExe").val("");
$("#fiterUser").val("");
}
});
//监听行单击事件单击事件为rowDouble
table.on('row(wochao)', function (obj) {
var data = obj.data;
//console.log(data);
//标注选中样式
obj.tr.addClass('self-table-click').siblings().removeClass('self-table-click');
selectRow = data;
});
table.on('sort(wochao)', function (obj) {
console.log(obj.field);
console.log(obj.type);
table.reload('listReload',
{
initSort: obj
, where: {
sort: obj.field,
order: obj.type
}
})
});
form.on('select(corp_deptid)', function (data) {
console.log(data);
let mydeptid = "";
$(mydata.filter(m => m.corpid == data.value)).each(function (is, sw) {
if (sw.deptid != "") {
mydeptid += sw.corpid + "_" + sw.deptid + ";";
}
});
mydeptid = mydeptid.substring(0, mydeptid.length - 1)
$("#deptid").val(mydeptid);
});
var messageUrl = "@Html.Raw(ViewBag.WwMessage_Url)";
if (messageUrl.indexOf("$") > -1) {
messageUrl = messageUrl.split("$")[0];
}
if (messageUrl.indexOf("|") > -1) {//分内外网
var ssw = window.location.href;
if (ssw.indexOf("192.168.") > -1 || ssw.indexOf("localhost") > -1) {//内网无疑
messageUrl = messageUrl.split('|')[0];
} else {
messageUrl = messageUrl.split('|')[1];
}
}
if (messageUrl.charAt(messageUrl.length - 1) != '/') {
messageUrl = messageUrl + "/"
}
var active = {
other5: function () {
var checkdata = table.checkStatus('listReload');
var uidata = checkdata.data;
if (uidata.length == 0) {
layer.msg("请至少选中一条记录!", { icon: 7 });
return;
}
layer.confirm("是否确认解绑", function () {
$.ajax({
type: "POST",
url: "ClearEid",
data: { data: JSON.stringify(uidata) },
dataType: "json",
success: function (da) {
if (da.result == true) {
parent.layer.msg('操作成功!', { icon: 1 });
var param = $("#myform").serializeFormJSON();
location.reload();
} else {
layer.msg(da.retmsg, { icon: 2 });
}
},
error: function () {
layer.msg('操作失败!', { icon: 2 });
}
});
});
},
other9: function () {
var param = $("#myform").serializeFormJSON();
$("#BillOpen").attr("src", "/MyWork/ExportData?assignStatus=" + param.assignStatus + "&bindStatus=" + param.bindStatus + "&corp=" + param.corp + "&deptid=" + param.deptid + "&fiterUser=" + param.fiterUser + "&name=" + param.name + "&xstime=" + param.xstime
+ "&xetime=" + param.xetime + "&orderType=" + param.orderType + "&seid=" + param.seid
+ "&txt_deptId=" + param.txt_deptId + "&txt_groupIds=" + param.txt_groupIds + "&txt_userId=" + param.txt_userId
+ "&userids=" + param.userids + "&status=" + param.Status);
},
other8: function () {
var checkdata = table.checkStatus('listReload');
var uidata = checkdata.data;
if (uidata.length == 0) {
layer.msg("请至少选中一条记录!", { icon: 7 });
return;
}
var postdata = "";
for (var i = 0; i < uidata.length; i++) {
if (i == 0) {
assignStatus = uidata[i].assignStatus
}
if (uidata[i].isMyController != 1 && !uidata[i].eidAndName) {
layer.msg("非本部门的企业微信" + uidata[i].userid + "不能被操作!", { icon: 7 });
return;
}
postdata += uidata[i].corpid + ':' + uidata[i].userid + ';'
}
winindex = layer.open({
type: 2,
content: '/Ww/MyWork/BatchSetStatus?data=' + postdata,
area: ['500px', '300px']
});
},
other6: function () {
if (selectRow.userid == "undefined" || selectRow.userid == null) {
layer.msg("请先选中一条记录!", { icon: 7 });
return;
}
if (selectRow.isMyController != 1 && !selectRow.eidAndName) {
//layer.alert("请先选中一条记录!", { title: '提示' });
layer.msg("非本部门的企业微信不能被操作!", { icon: 7 });
return;
}
winindex = layer.open({
type: 2,
content: '/Ww/MyWork/SetEid?corp=' + selectRow.corpid + '&userid=' + selectRow.userid,
area: ['500px', '300px']
});
},
other7: function () {
debugger
var checkdata = table.checkStatus('listReload');
var uidata = checkdata.data;
if (uidata.length == 0) {
layer.msg("请至少选中一条记录!", { icon: 7 });
return;
}
var postdata = "";
for (var i = 0; i < uidata.length; i++) {
postdata += uidata[i].corpid + "|" + uidata[i].userid+";"
}
$.get("check?postdata=" + postdata, function (rsp) {
if (rsp.result) {
layer.msg(rsp.msg +'账号可用');
}
else {
layer.msg(rsp.msg+'账号不可用');
}
});
},
other10: function () {
if (selectRow.userid == "undefined" || selectRow.userid == null) {
layer.msg("请先选中一条记录!", { icon: 7 });
return;
}
$.get("UpdateWorkUser?appid=" + selectRow.corpid + "&userid=" + selectRow.userid, function (rsp) {
if (rsp.resutl) {
layer.msg('拉取成功');
TableReload();
}
else {
layer.msg('拉取失败');
}
});
},
other4: function () {
var corp = $("#firstcorp").val();
if (corp == "") {
layer.msg("请选择企业!", { icon: 7 });
return;
}
var corpname = firstname;
//window.parent.ChildAddTab('微信群--' + corpname, '/Admin/HHuser/Group?corp=' + corp, "icon-detail");
//if (window["context"] == undefined) {
// if (!window.location.origin) {
// window.location.origin = window.location.protocol + "//" + window.location.hostname + (window.location.port ? ':' + window.location.port : '');
// }
// window["context"] = location.origin + "/V6.0";
//}
//window.top.postMessage({ name: '微信群--' + corpname, url: location.origin + '/Admin/OutHHuser/Group?corp=' + corp, icon: "icon-detail" }, "*");
parent.ChildAddTab('微信群--' + corpname, messageUrl + 'Admin/OutHHuser/Group?corp=' + corp, '');
},
other3: function () {
var width = $(window).width() * 0.7;
var height = $(window).height() * 0.7;
if (width < 600)
width == 600;
if (height < 500)
height = 500;
winindex = layer.open({
type: 2,
content: messageUrl + 'Admin/OutHHuser/Find?companycode=@Html.Raw(ViewBag.companycode)',
area: [width + 'px', height + 'px']
});
}, other1: function () {
if (selectRow.userid == "undefined" || selectRow.userid == null) {
//layer.alert("请先选中一条记录!", { title: '提示' });
layer.msg("请先选中一条记录!", { icon: 7 });
return;
}
if (selectRow.isMyController != 1 && !selectRow.eidAndName) {
//layer.alert("请先选中一条记录!", { title: '提示' });
layer.msg("非本部门的企业微信不能被操作!", { icon: 7 });
return;
}
//winindex = layer.open({
// type: 2,
// content: '/Admin/HHuser/Message?userid=' + selectRow.userid + "&uname=" + selectRow.uname + "&corp=" + selectRow.corpid,
// area: ['600px', '500px']
//});
//if (window["context"] == undefined) {
// if (!window.location.origin) {
// window.location.origin = window.location.protocol + "//" + window.location.hostname + (window.location.port ? ':' + window.location.port : '');
// }
// window["context"] = location.origin + "/V6.0";
//}
//window.top.postMessage({ name: '企微聊天记录--' + selectRow.uname, url: location.origin + '/Admin/OutHHuser/Message?userid=' + selectRow.userid + "&uname=" + encodeURIComponent(selectRow.uname) + "&corp=" + selectRow.corpid, icon: "icon-detail" }, "*");
// messageUrl = "https://localhost:44338/" ;
// 企业微信管理聊天记录
parent.ChildAddTab('企微聊天记录--' + selectRow.uname, messageUrl + 'Admin/OutHHuser/Message?userid=' + selectRow.userid + "&uname=" + encodeURIComponent(selectRow.uname) + "&corp=" + selectRow.corpid + "&isHg=@Html.Raw(ViewBag.IsHg)" + "&eid=@Html.Raw(ViewBag.wweid)" + "&appid=@Html.Raw(ViewBag.appid)"+"&ext_flag=@Html.Raw(System.Web.HttpUtility.UrlEncode(WX.CRM.Common.Utility.Encrypt(WX.CRM.Common.DateTimeTool.ConvertDateTimeLong(DateTime.Now).ToString())))", '');
//window.parent.ChildAddTab('企微聊天记录--' + selectRow.uname, '/Admin/HHuser/Message?userid=' + selectRow.userid + "&uname=" + selectRow.uname + "&corp=" + selectRow.corpid, "icon-detail");
}, other2: function () {
if (selectRow.userid == "undefined" || selectRow.userid == null) {
//layer.alert("请先选中一条记录!", { title: '提示' });
layer.msg("请先选中一条记录!", { icon: 7 });
return;
}
if (selectRow.isMyController != 1 && !selectRow.eidAndName) {
//layer.alert("请先选中一条记录!", { title: '提示' });
layer.msg("非本部门的企业微信不能被操作!", { icon: 7 });
return;
}
//if (window["context"] == undefined) {
// if (!window.location.origin) {
// window.location.origin = window.location.protocol + "//" + window.location.hostname + (window.location.port ? ':' + window.location.port : '');
// }
// window["context"] = location.origin + "/V6.0";
//}
//window.top.postMessage({ name: '企微聊天记录--' + selectRow.uname, url: location.origin + '/Admin/OutHHuser/Outer?userid=' + selectRow.userid + "&uname=" + encodeURIComponent(selectRow.uname) + "&corp=" + selectRow.corpid, icon: "icon-detail" }, "*");
parent.ChildAddTab('外部联系人--' + selectRow.uname, messageUrl + 'Admin/OutHHuser/Outer?userid=' + selectRow.userid + "&uname=" + encodeURIComponent(selectRow.uname) + "&corp=" + selectRow.corpid, '');
//window.parent.ChildAddTab('外部联系人--' + selectRow.uname, '/Admin/HHuser/Outer?userid=' + selectRow.userid + "&uname=" + selectRow.uname + "&corp=" + selectRow.corpid, "icon-detail");
//winindex = layer.open({
// type: 2,
// content: '/Admin/HHuser/Outer?userid=' + row.userid + "&uname=" + row.uname + "&corp=" + row.corpid,
// area: ['600px', '500px']
//});
}, search: function () {
//alert($("#myform").serialize());
//console.log($("#myform").serialize());
//console.log($("#myform").serializeFormJSON());
var param = $("#myform").serializeFormJSON();
table.reload('listReload', {
where: param,
page: {
curr: 1
}
});
}, reset: function () {
$("#deptid").val("");
selectChannel.reset();
allChannel.forEach(function (item) {
item.selected = false;
})
selectChannel = xmSelect.render(optionsChannel);
selectChannel.update({ data: allChannel });
}
};
$('.layui-btn').on('click', function () {
var othis = $(this), method = othis.data('method');
console.log(method);
active[method] ? active[method].call(this, othis) : '';
});
});
function Closed() {
layer.close(winindex);
}
function TableReload() {
table.reload('listReload', {
});
}
</script>
<script type="text/html" id="agentTpl">
{{
# if(d.ISOUTERAGENT == '1'){ }}
{{# } else if(d.ISOUTERAGENT == '0') { }}
{{# } }}
</script>
<script type="text/html" id="assignStatuTpl">
{{# if(d.assignStatus == '1'){ }}
<span style="color:green">{{ d.assignStatusName }}</span>
{{# } else if(d.assignStatus == '0') { }}
<span style="color:gray">{{ d.assignStatusName }}</span>
{{# } else if(d.assignStatus == '4') { }}
<span style="color:red">{{ d.assignStatusName }}</span>
@* <a style="padding-left:10px;" href="https://open.work.weixin.qq.com/devtool/query?e={{d.errorcode}}" target="_blank">查看原因</a>*@
{{# } }}
</script>
<script type="text/html" id="statusTpl">
{{# if(d.Status == '1'){ }}
<span style="color:green">{{ d.StatusName }}</span>
{{# } else { }}
<span style="color:gray">{{ d.StatusName }}</span>
<a style="padding-left:10px;" href="https://open.work.weixin.qq.com/devtool/query?e={{d.errorcode}}" target="_blank">查看原因</a>
{{# } }}
</script>
<script type="text/html" id="DeptTpl">
{{# if(d.isMyController == '1'){ }}
<span style="color:green">{{ d.deptname }}</span>
{{# } else { }}
<span style="color:gray">{{ d.deptname }}</span>
{{# } }}
</script>