TG.WXCRM.V4/WEB/Views/MsgToolPlan/Index.cshtml

416 lines
18 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-card {
padding-top: 0px !important;
}
</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;">
@* @if (ViewBag.IndexType == 2)
{
<input class="layui-btn layui-btn-sm layui-btn-normal" data-method="other4" type="button" value="详情">
}*@
@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="分发任务" }
}
})
</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:460px;">
@Html.Action("UserSSOComBox", "Control", new { currentRight = WX.CRM.WebHelper.InitRights.CONST_群发计划列表 })
</div>
计划名称:
<div class="layui-inline">
<input type="text" name="PLANNAME" required lay-verify="required" autocomplete="off" class="layui-input">
</div>
创建者:
<div class="layui-inline">
<input type="text" name="CREATOR" required lay-verify="required" autocomplete="off" class="layui-input">
<input type="text" name="IndexType" required lay-verify="required" autocomplete="off" class="layui-input" value="@ViewBag.IndexType" style="display:none">
</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>
@if (ViewBag.IndexType == 1)
{
<label>发送类型</label>
<div class="layui-inline">
<select name="SENDTYPE">
<option value="">全部</option>
<option value="now">立即发布</option>
<option value="tim">定时发布</option>
</select>
</div>
}
发送状态:
<div class="layui-inline">
<select name="STATUS">
<option value="">全部</option>
<option value="180">草稿</option>
<option value="220">已分发</option>
<option value="70">取消分发</option>
</select>
</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" type="reset" value="清空" />
</div>
</div>
</form>
<table class="layui-hide" id="tab_kefuzhuangtaiyi1" lay-filter="wochao"></table>
</div>
</div>
</div>
<!--确定宽度-->
<style>
.layui-form-label {
width: 150px
}
.layui-input-block {
margin-left: 0;
}
.dialogName {
width: 31%;
display: inline-block;
text-align: center;
}
.layui-table-cell {
height: auto !important;
line-height: 28px !important;
}
.myimage {
width:100px;
padding:3px 0px;
}
.mydiv {
/*width:250px;*/
}
</style>
<script>
function onLoadSucced() {
}
//企业号的数据
var table;
$(function () {
});
</script>
<script>
layui.use('laydate', function () {
var laydate = layui.laydate;
//执行一个laydate实例
laydate.render({
elem: '#start' //指定元素
});
//执行一个laydate实例
laydate.render({
elem: '#end' //指定元素
});
});
var selectRow = {};
var winindex;
var layer;
var rowid;
//注意:选项卡 依赖 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;
if (@ViewBag.IndexType == 1) {
table.render({
id: 'listReload'//列表别名ID
, elem: '#tab_kefuzhuangtaiyi1'
, url: 'GetHtmlList'
, method: 'POST'
//, cellMinWidth: 130 //全局定义常规单元格的最小宽度layui 2.2.1 新增
, page: true
, limit: 30
, height: "full-160"
, size:"sm"
, cols: [[
{ field: 'PKID', title: '计划id', width:120 }
, { field: 'CREATOR', title: '计划创建人', width: 120 }
, { field: 'PLANNAME', title: '计划名称', width: 120 }
, {
field: 'JSONDATA', title: '发送内容',width:250, templet: function (d) {
var mydata = JSON.parse(d.JSONDATA);
console.log(mydata);
var html = "";
$(mydata).each(function (aa, bb) {
if (bb.msgtype == "img") {
html += "<div class='mydiv'>" + (aa + 1) + "、<img class='myimage' src='" + bb.content + "'/></div>";
} else if (bb.msgtype == 'file') {
var file = bb.content;
var filename = file.substring(file.lastIndexOf("/")+1, file.length);
var filename = decodeURI(filename);
console.log("截取的地址"+filename);
html += "<div class='mydiv'>" + (aa + 1) + "、<a href='" + bb.content +"' target='_blank' title='点击查看附件'>" + filename + "</a></div>";
} else {
bb.content = replaceFace(bb.content);
html += "<div class='mydiv'>" + (aa + 1) + "、" + bb.content + "</div>";
}
});
/*return d.JSONDATA*/
return html;
}
}
, { field: 'SendObject', title: '群发对象', width: 150 }
, { field: 'SendTypeName', title: '发送类型', width: 100 }
, { field: 'ReceiveInfo', title: '任务接受员工', width: 110 }
, { field: 'Unexec', title: '未执行', width: 80}
, { field: 'Exec', title: '已完成', width: 80 }
, { field: 'Cancel', title: '已取消', width: 80 }
, { field: 'StatusName', title: '发送状态', width: 100}
, { field: 'Remark', title: '备注', width: 120 }
, { field: 'SendTime', title: '分发任务时间', width: 150}
, { field: 'PLANEXETIME', title: '预计开始时间', width: 150 }
, { field: 'DUEDATE', title: '截止时间', width: 150}
]], where: $("#myform").serializeFormJSON()
,
done: function (res, curr, count) {
$("#isExe").val("");
$("#fiterUser").val("");
}
});
} else {
table.render({
id: 'listReload'//列表别名ID
, elem: '#tab_kefuzhuangtaiyi1'
, url: 'GetHtmlList'
, method: 'POST'
, cellMinWidth: 80 //全局定义常规单元格的最小宽度layui 2.2.1 新增
, page: true
, limit: 30
, height: "full-160"
, size:"sm"
, cols: [[
{ field: 'PKID', title: '计划id', width: 120 }
, { field: 'CREATOR', title: '计划创建人', width: 120 }
, { field: 'PLANNAME', title: '计划名称', width: 120 }
, {
field: 'JSONDATA', title: '发送内容', width: 250, templet: function (d) {
var mydata = JSON.parse(d.JSONDATA);
console.log(mydata);
var html = "";
$(mydata).each(function (aa, bb) {
if (bb.msgtype == "img") {
html += "<div class='mydiv'>" + (aa + 1) + "、<img class='myimage' src='" + bb.content + "'/></div>";
} else if (bb.msgtype == 'file') {
var file = bb.content;
var filename = file.substring(file.lastIndexOf("/") + 1, file.length);
var filename = decodeURI(filename);
console.log("截取的地址" + filename);
html += "<div class='mydiv'>" + (aa + 1) + "、<a href='" + bb.content + "' target='_blank' title='点击查看附件'>" + filename + "</a></div>";
} else {
bb.content = replaceFace(bb.content);
html += "<div class='mydiv'>" + (aa + 1) + "、" + bb.content + "</div>";
}
});
/*return d.JSONDATA*/
return html;
}
}
, { field: 'SendObject', title: '群发对象', width: 150 }
, { field: 'SendTypeName', title: '模式', width: 120}
, { field: 'Cycle', title: '周期', width: 80}
, { field: 'CycleNum', title: '循环次数', width: 120 }
, { field: 'ReceiveInfo', title: '任务接受员工', width: 120 }
, { field: 'Unexec', title: '未执行', width: 120}
, { field: 'Exec', title: '已完成', width: 120}
, { field: 'Cancel', title: '已取消', width: 120}
, { field: 'StatusName', title: '状态', width: 120}
, { field: 'Remark', title: '备注', width: 120 }
, { field: 'PLANEXETIME', title: '预计开始时间', width: 150}
, { field: 'DUEDATE', title: '截止时间', width: 150 }
]], where: $("#myform").serializeFormJSON()
,
done: function (res, curr, count) {
}
});
}
//监听行单击事件单击事件为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;
});
var active = {
add: function () {
winindex = layer.open({
type: 2,
content:'/MsgToolPlan/Add',
area: ['1048px', '600px']
});
},
update: function () {
if (selectRow.PKID == "undefined" || selectRow.PKID == null) {
layer.msg("请先选中一条记录!", { icon: 7 });
return;
}
winindex = layer.open({
type: 2,
content: '/MsgToolPlan/Add?id=' + selectRow.PKID,
area: ['1048px', '600px']
});
},
other1: function () {
if (selectRow.PKID == "undefined" || selectRow.PKID == null) {
layer.msg("请先选中一条记录!", { icon: 7 });
return;
}
winindex = layer.open({
type: 2,
content: '/MsgToolPlan/CopyPlan?id=' + selectRow.PKID,
area: ['1048px', '600px']
});
},
other2: function () {
if (selectRow.PKID == "undefined" || selectRow.PKID == null) {
layer.msg("请先选中一条记录!", { icon: 7 });
return;
}
$.ajax({
type: "POST",
url: "CancelTask",
data: { planId: selectRow.PKID },
dataType: "json",
success: function (da) {
if (da.result == true) {
layer.msg(da.retmsg, { icon: 1 });
TableReload();
} else {
layer.msg(da.retmsg, { icon: 2 });
}
},
error: function () {
layer.msg('操作失败!', { icon: 2 });
}
});
}, other3: function () {
if (selectRow.PKID == "undefined" || selectRow.PKID == null) {
layer.msg("请先选中一条记录!", { icon: 7 });
return;
}
$.ajax({
type: "POST",
url: "CreateTask",
data: { planId: selectRow.PKID},
dataType: "json",
success: function (da) {
if (da.result == true) {
layer.msg(da.retmsg, { icon: 1 });
TableReload();
} else {
layer.msg(da.retmsg, { icon: 2 });
}
},
error: function () {
layer.msg('操作失败!', { icon: 2 });
}
});
}, 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 GetIframeHtml(src) {
return "<iframe width='100%' height='98%' scrolling='no' frameborder='0'' src='" + src + "'></iframe>";
}
function replaceFace(cotent) {
if (!cotent)
return cotent;
var face = '@Html.Raw(ViewBag.faceListJson)';
var facelist = face.split(',');
for (var i = 0; i < facelist.length; i++) {
while (cotent.indexOf(facelist[i]) > -1) {
var src = facelist[i].replace("[", "").replace("]", "") + ".png";
cotent = cotent.replace(facelist[i], '<img src="/Content/Images/icon/msgtool/face/' + src + '" alt="' + facelist[i].replace("[", "").replace("]", "") +'"/>');
}
}
return cotent;
}
</script>