TG.WXCRM.V4/WEB/Views/MsgToolTask/Execute.cshtml

279 lines
11 KiB
Plaintext
Raw Permalink 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.

@{
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>
.ps {
font-size: 18px;
}
.ps_title {
font-size: 20px;
font-weight: bold;
}
.layui-table-cell {
height: auto;
text-align: center;
}
.resultItem {
text-align: center
}
.refreshBtn {
margin-left: 93%;
}
</style>
<div class="tabs-box">
<div class="layui-card" id="topcard" style="width:100%;">
<div class="layui-card-body " id="contentBody">
<form class="layui-form" id="myform">
<input type="hidden" value="@ViewBag.Taskid" name="taskid" id="taskid" />
<input type="hidden" value="@ViewBag.Type" name="taskType" id="taskType" />
</form>
<div class="ps">
<div class="ps_title">注意事项</div>
<p>1、企微电脑版是否已经登录如未登录请登录。发完一个账号后需要进行切换企微主体</p>
<p>2、群发助手软件是否有安装如未安装请安装</p>
<p>3、群发过程当中不影响手机企微与客户的沟通也可切换企业进行聊天</p>
<p>4、在群发过程中不要进行多账号的群发如有问题请联系技术处理</p>
</div>
<button type="button" class="layui-btn layui-btn-sm layui-btn-normal refreshBtn" onclick="TableReload()" title="点击刷新整个页面">
<i class="layui-icon">
刷新
</i>
</button>
<table class="table" id="tab_execute" lay-filter="wochao"></table>
</div>
</div>
</div>
<script>
var winindex;
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_execute'
, url: 'GetExecuteList'
, method: 'POST'
, cellMinWidth: 60 //全局定义常规单元格的最小宽度layui 2.2.1 新增
, page: true
, limit: 10
, height: "full-200"
//, size:"sm"
, cols: [[
{ field: 'PKID', title: '指令id', width: 125 }
, { field: 'WeworkName', title: '企微', width: 125}
, { field: 'Phone', title: '号码', width: 125 }
, { field: 'Nickname', title: '名称', width: 125 }
, { field: 'Euser', title: '工号', width: 125 }
, { field: 'Email', title: '邮箱', width: 125}
, { field: 'Count', title: '群发数量', templet: '#countTpl', width: 125 }
, { field: 'ASSIGNSTATUS', title: '是否推广', templet: '#statusTpl', width: 125 }
, { field: 'Result', title: '结果反馈', templet: '#resultTpl', width: 125 }
, { field: 'statusnameTpl', title: '状态', templet: '#statusnameTpl', width: 125}
, { field: 'operationTpl', title: '操作', width: 300, templet: '#operationTpl' }
]], where: $("#myform").serializeFormJSON()
,
done: function (res, curr, count) {
$("#isExe").val("");
$("#fiterUser").val("");
}
});
var num = -1;
//监听行单击事件单击事件为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;
});
form.on('select(corp_deptid)', function (data) {
console.log(data);
let mydeptid = "";
$(mydata.filter(m => m.corpid == data.value)).each(function (is, sw) {
mydeptid = sw.deptid;
});
$("#deptid").val(mydeptid);
});
var active = {
add: function () {
winindex = layer.open({
type: 2,
content: '/MsgToolTask/Add',
area: ['1048px', '600px']
});
},
update: function () {
if (selectRow.PKID == "undefined" || selectRow.PKID == null) {
layer.msg("请先选中一条记录!", { icon: 7 });
return;
}
layer.msg('待完成');
},
other1: function () {
},
other2: function () {
if (selectRow.PKID == "undefined" || selectRow.PKID == null) {
layer.msg("请先选中一条记录!", { icon: 7 });
return;
}
layer.msg('取消发送todo');
}, other3: function () {
if (selectRow.PKID == "undefined" || selectRow.PKID == null) {
layer.msg("请先选中一条记录!", { icon: 7 });
return;
}
layer.msg('开始发送todo');
},
// 立即执行
other4: function () {
winindex = layer.open({
type: 2,
content: '/MsgToolTask/Execute',
area: ['1048px', '600px']
});
}, 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
}
});
}
};
$('.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', {
});
}
function openExec(pkid) {
winindex = layer.open({
type: 2,
content: '/MsgToolTask/CmdEdit?cmdid=' + pkid,
area: ['80%', '80%']
});
}
function Exec(pkid, sendtype) {
$.ajax({
type: "Get",
url: "@Html.Raw(ViewBag.webapi)Api/MsgTool/GetExecCmdEnable?CmdId=" + pkid,
dataType: "json",
headers: {appid:"@ViewBag.appid" },
success: function (da) {
if (da.code == 0) {
window.open('@Html.Raw(ViewBag.Servicename)://{"taskid":"' + pkid + '","appid":"@Html.Raw(ViewBag.appid)","sendtype":' + sendtype+'}', "_self");
} else {
layer.msg(da.message, { icon: 2 });
TableReload();
}
},
error: function () {
layer.msg('操作失败!', { icon: 2 });
}
});
}
var msgIndex;
var isfrist = $('#taskType').val();
if (isfrist == 1) {
var t = 10;
var timer = setInterval(function () {
//timName.innerHTML = t;
msgIndex = layer.msg('正在生成任务:' + t + 's');
t--;
if (t < 0) {
layer.close(msgIndex);
clearInterval(timer);
TableReload();
parent.TableReload();
$('#taskType').val(2);
}
}, 1000)
}
</script>
<script type="text/html" id="statusTpl">
{{# if(d.ASSIGNSTATUS == 0){ }}
<span>否</span>
{{# } else if(d.ASSIGNSTATUS ==3) { }}
<span>永久删除</span>
{{# } else if(d.ASSIGNSTATUS ==4) { }}
<span>暂停</span>
{{# } else { }}
<span>是</span>
{{# } }}
</script>
<script type="text/html" id="resultTpl">
{{# if(d.UnExecCount > 0){ }}
<div class="resultItem">待执行({{ d.UnExecCount }})</div>
{{# } if(d.SuccessCount > 0) { }}
<div class="resultItem">成功({{ d.SuccessCount }})</div>
{{# } if(d.FailCount >0) { }}
<div class="resultItem">失败({{ d.FailCount }})</div>
{{# } if(d.NotFoundCount >0) { }}
<div class="resultItem">找不到人({{ d.NotFoundCount }})</div>
{{# } }}
</script>
<script type="text/html" id="statusnameTpl">
{{# if(d.STATUS == 180){ }}
<span>待执行</span>
{{# } else if(d.STATUS==220) { }}
<span style="color:green;">已执行</span>
{{# } else if(d.STATUS==250) { }}
<span>暂停</span>
{{# } else if(d.STATUS==500) { }}
<span style="color:red;">执行错误</span>
{{# } else if(d.STATUS==70) { }}
<span>已取消</span>
{{# } }}
</script>
<script type="text/html" id="countTpl">
{{# if(d.EnableCount< d.Count){ }}
<a href="javascript:openExec('{{ d.PKID }}')"><span style="color:red">{{ d.EnableCount }}/{{ d.Count }}</span></a>
{{# } else { }}
<a href="javascript:openExec('{{ d.PKID }}')">{{ d.Count }}</a>
{{# } }}
</script>
<script type="text/html" id="operationTpl">
{{# if(d.TaskStatus ==70 || !d.CanRun){ }}
<a class="layui-btn layui-btn-sm" href='@Html.Raw(ViewBag.Servicename)://{"taskid":"{{d.PKID}}","appid":"@Html.Raw(ViewBag.appid)"}' style="pointer-events: none; cursor: default;background-color:gray; color:white; ">立即执行</a>
{{# } else if(d.STATUS == 180 || d.STATUS == 250 || d.STATUS == 500 ){ }}
@*<input class="layui-btn layui-btn-sm" onclick="" type="button" value="立即执行" />*@
<a class="layui-btn layui-btn-sm" style="color:#fff" href="javascript:Exec('{{ d.PKID }}',1)">一键单发</a>
<a class="layui-btn layui-btn-sm" style="color:#fff" href="javascript:Exec('{{ d.PKID }}',2)">一键转发</a>
@*<a class="layui-btn layui-btn-sm" style="color:#fff" href="javascript:Exec('{{ d.PKID }}',3)">全量转发</a>*@
@* <a class="layui-btn layui-btn-sm" href='@Html.Raw(ViewBag.Servicename)://{"taskid":"{{d.PKID}}","appid":"@Html.Raw(ViewBag.appid)"}'>立即执行</a>*@
@*<a href='wwsendservice://{"cmd":"sendmsg","ext":"1656310627810"}'>打开文件测试</a>*@
{{# } else { }}
@*<input class="layui-btn layui-btn-sm" onclick="" type="button" value="暂停" />*@
{{# } }}
</script>