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

320 lines
11 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;
}
.avatar {
width: 60px;
height: 60px;
}
</style>
<!--确定宽度-->
<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>
<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-body " id="contentBody">
<form class="layui-form selftopwhere" id="myform">
<div class="layui-form-item">
ID/名称/号码:
<div class="layui-inline">
<input type="text" name="name" required lay-verify="required" autocomplete="off" class="layui-input">
</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>
<input type="text" name="userChose" id="userChose" required lay-verify="required" autocomplete="off" class="layui-input">
<table class="layui-hide" id="tab_kefuzhuangtaiyi1" lay-filter="wochao"></table>
</div>
</div>
</div>
<!--确定宽度-->
<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;
var userChose = parent.GetQiweiData();
//注意:选项卡 依赖 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: 'ChooseQWGetHtmlList'
, method: 'POST'
, cellMinWidth: 80 //全局定义常规单元格的最小宽度layui 2.2.1 新增
, page: true
, limit: 30
, height: "full-160"
, size:"sm"
, cols: [[
{
field: 'thumb_avatar', title: '头像', width: 90, templet: function (d) {
return "<img class='avatar' src='" + d.thumb_avatar+"'>"
}
}
,{ field: 'corpname', title: '企业号', width: 120 }
, { field: 'userid', title: 'ID', width: 220 }
, { field: 'uname', title: '名称', width: 220 }
, { field: 'mobile', title: '号码', width: 120 }
,{
field: 'num', title: '已选人数', width: 250, templet: function (d) {
var mydata = userChose;
var count = 0;
$(mydata).each(function (aa, bb) {
if (bb.userid == d.userid) {
count = bb.outuserList.length;
}
});
return count;
}
}
, {
field: 'OP', title: '操作', width: 250, templet: function (d) {
var opertHtml = "<input type='button' class='layui-btn layui-btn-sm layui-btn-ok' value='选择' onClick='Choose(\"" + d.corpid + "\",\"" + d.userid + "\")'>";
opertHtml += "<input type='button' class='layui-btn layui-btn-sm layui-btn-ok' value='清空' onClick='DelChoose(\"" + d.corpid + "\",\"" + d.userid + "\")'>";;
return opertHtml;
}
}
]], 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 = {
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 OpenExecute(pkid) {
winindex = layer.open({
type: 2,
content: '/MsgToolTask/Execute?taskid=' + pkid,
area: ['1048px', '600px']
});
}
function GetWindowInfo() {
var width = $(window).width() * 0.95;
var height = $(window).height() * 0.95;
if (width < 1000)
width = 1000;
if (height < 550)
height = 550;
return [width + "px", height + "px"]
}
function Choose(corpid, userid) {
var pageType = 1;
var postData = "";
for (var i = 0; i < userChose.length; i++) {
if (userChose[i].userid == userid) {
pageType = userChose[i].pagetype;
postData = userChose[i];
}
}
var urlHost = '@ViewBag.qiweiUrl';
if (pageType == 1 || pageType == undefined) {
winindex = layer.open({
type: 2,
content: urlHost + '/Home/CSelectionTag?corpid=' + corpid + "&userid=" + userid,
area: GetWindowInfo(),
success: function (index, layero) {
window[index.find('iframe')[0]['name']].postMessage({ type: "initData", userChose: postData }, '*');
},
});
} else if (pageType == 2) {
winindex = layer.open({
type: 2,
content: urlHost + '/Home/CSelection?corpid=' + corpid + "&userid=" + userid,
area: GetWindowInfo(),
success: function (index, layero) {
window[index.find('iframe')[0]['name']].postMessage({ type: "initData", userChose: postData }, '*');
},
});
} else {
winindex = layer.open({
type: 2,
content: urlHost + '/Home/CSelectionQY?corpid=' + corpid + "&userid=" + userid,
area: GetWindowInfo(),
success: function (index, layero) {
window[index.find('iframe')[0]['name']].postMessage({ type: "initData", userChose: postData }, '*');
},
});
}
}
function DelChoose(corpid, userid) {
var newData = [];
for (var i = 0; i < userChose.length; i++) {
if (userChose[i].userid == userid) {
continue;
}
newData.push(userChose[i]);
}
userChose = newData;
TableReload();
parent.SetUserChoose(userChose);
layer.msg('清空成功!', { icon: 1 });
}
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>";
}
window.addEventListener("message", receiveMessage, false);
function receiveMessage(event) {
var allData = table.cache["listReload"];
console.log(event.data);
var mydata = event.data;
if (mydata.type == "chooseMsgToolUser") {
var userData = userChose;
var newData = [];
var newObj = {
userid: mydata.userid,
outuserList: mydata.outuserList,
corpid: mydata.corpid,
pagetype: mydata.pagetype
};
for (var i = 0; i < allData.length; i++) {
if (allData[i].userid == newObj.userid && allData[i].corpid == newObj.corpid) {
newObj.corpname = allData[i].corpname;
newObj.kfnickname = allData[i].uname;
}
}
for (var i = 0; i < userChose.length; i++) {
if (userChose[i].userid == mydata.userid && userChose[i].corpid == mydata.corpid) {
continue;
} else {
newData.push(userChose[i])
}
}
if (newObj.outuserList.length > 0) {
newData.push(newObj);
}
userChose = newData;
}
TableReload();
parent.SetUserChoose(userChose);
Closed();
}
function GetChoose() {
return userChose;
}
</script>