1621 lines
60 KiB
Plaintext
1621 lines
60 KiB
Plaintext
@model WX.CRM.IBLL.MsgTool.MsgEditTaskModel
|
||
@{ ViewBag.Title = "Edit";
|
||
Layout = "~/Views/Shared/_form.cshtml";
|
||
}
|
||
@{
|
||
string isok = ViewBag.isOk == null ? "1" : Convert.ToString(ViewBag.isOk);
|
||
}
|
||
|
||
<style>
|
||
#wocaaa {
|
||
max-width:1024px;
|
||
|
||
}
|
||
.chatItem {
|
||
display: flex;
|
||
margin-top: 10px;
|
||
}
|
||
.faceClass {
|
||
max-height: 17px;
|
||
}
|
||
.xm-label-block {
|
||
background-color: #FF4D4D !important;
|
||
}
|
||
.layui-border-red {
|
||
background-color: #FF4D4D;
|
||
}
|
||
.showJsonData {
|
||
padding: 10px
|
||
}
|
||
.textarea-style {
|
||
border: 1px solid #000001;
|
||
border-radius: 5pt;
|
||
height: 60pt;
|
||
font-size: 10pt;
|
||
margin-bottom: 2vh;
|
||
width: 100%;
|
||
color: #000001;
|
||
overflow-x: hidden;
|
||
text-indent: 20px
|
||
}
|
||
|
||
.chatcontent {
|
||
@* overflow: hidden;
|
||
text-overflow: ellipsis;
|
||
display: -webkit-box;
|
||
-webkit-line-clamp: 2;
|
||
line-height: 21px;
|
||
*@
|
||
word-break: break-all;
|
||
width: 428px;
|
||
font-size: 14px;
|
||
font-family: SourceHanSansCN-Medium, SourceHanSansCN;
|
||
font-weight: 500;
|
||
color: #333333;
|
||
-webkit-box-orient: vertical
|
||
}
|
||
.remark {
|
||
width: 100%;
|
||
height: 100px;
|
||
}
|
||
.delchatItem {
|
||
margin-left: 36px !important;
|
||
}
|
||
.btnoktext {
|
||
width: 70px;
|
||
height: 16px;
|
||
font-size: 16px;
|
||
font-family: SourceHanSansCN-Medium, SourceHanSansCN;
|
||
font-weight: 500;
|
||
color: #FFFFFF;
|
||
line-height: 24px;
|
||
letter-spacing: 1px;
|
||
}
|
||
.userconfrimtext {
|
||
width: 70px;
|
||
height: 16px;
|
||
font-size: 16px;
|
||
font-family: SourceHanSansCN-Medium, SourceHanSansCN;
|
||
font-weight: 500;
|
||
color: #666666;
|
||
line-height: 24px;
|
||
letter-spacing: 1px;
|
||
}
|
||
|
||
.edittool {
|
||
width: 50px !important;
|
||
}
|
||
.layui-btn-ok {
|
||
width: 94px;
|
||
line-height: 32px;
|
||
height: 32px;
|
||
background: #FF4D4D;
|
||
border-radius: 4px;
|
||
border: 1px solid #FF4D4D;
|
||
cursor:pointer
|
||
}
|
||
.userConfrimBtn {
|
||
width: 94px;
|
||
height: 32px;
|
||
background: #F9F9F9;
|
||
border-radius: 4px;
|
||
border: 1px solid #BDBDBD;
|
||
margin-left: 24px;
|
||
cursor: pointer
|
||
}
|
||
#showJsonData {
|
||
max-height:201px;
|
||
border-radius: 4px;
|
||
border: 1px solid #DCDEDF;
|
||
overflow:auto
|
||
}
|
||
|
||
.icon-deptmini {
|
||
background: url(/Content/Images/icon/uploadfile.png) no-repeat center;
|
||
}
|
||
.icon-delmini {
|
||
background: url(/Content/Images/icon/msgtool/del.png) no-repeat center;
|
||
}
|
||
.icon-upmini {
|
||
background: url(/Content/Images/icon/msgtool/up.png) no-repeat center;
|
||
}
|
||
.icon-downmini {
|
||
background: url(/Content/Images/icon/msgtool/down.png) no-repeat center;
|
||
}
|
||
.icon-editmini {
|
||
background: url(/Content/Images/icon/msgtool/edit.png) no-repeat center;
|
||
}
|
||
.layui-layedit {
|
||
margin-top: 30px;
|
||
height: 272px;
|
||
border-radius: 4px;
|
||
border: 1px solid #DCDEDF;
|
||
}
|
||
|
||
.showItem {
|
||
display: flex;
|
||
}
|
||
|
||
.layui-form-label {
|
||
width: 100px;
|
||
}
|
||
|
||
.layui-input-block {
|
||
margin-left: 130px;
|
||
}
|
||
|
||
.userLabel {
|
||
width: 100px;
|
||
float: left;
|
||
display: block;
|
||
font-weight: 400;
|
||
line-height: 20px;
|
||
text-align: left;
|
||
padding: 9px 15px;
|
||
}
|
||
|
||
.userInput {
|
||
line-height: 20px;
|
||
padding: 9px 15px;
|
||
}
|
||
|
||
.layeditCancelBtn {
|
||
margin-left: 24px;
|
||
height: 32px;
|
||
background: #F9F9F9;
|
||
border-radius: 4px;
|
||
border: 1px solid #BDBDBD;
|
||
width: 70px;
|
||
font-size: 16px;
|
||
font-family: SourceHanSansCN-Medium, SourceHanSansCN;
|
||
font-weight: 500;
|
||
color: #666666;
|
||
line-height: 24px;
|
||
letter-spacing: 1px;
|
||
}
|
||
|
||
.layeditBtn {
|
||
line-height: 24px;
|
||
height: 24px;
|
||
margin-left: 2%;
|
||
width: 13%;
|
||
margin-bottom: 12px;
|
||
margin-top: 12px;
|
||
border: none;
|
||
cursor: pointer;
|
||
border-radius: 7%;
|
||
}
|
||
|
||
.layeditConfirmBtn {
|
||
height: 32px;
|
||
background: #FF4D4D;
|
||
border-radius: 4px;
|
||
border: 1px solid #FF4D4D;
|
||
margin-left: 49%;
|
||
width: 70px;
|
||
font-size: 16px;
|
||
font-family: SourceHanSansCN-Medium, SourceHanSansCN;
|
||
font-weight: 500;
|
||
color: #FFFFFF;
|
||
line-height: 24px;
|
||
letter-spacing: 1px;
|
||
@* color: #fff;
|
||
background-color: #1E9FFF;*@
|
||
}
|
||
|
||
.layui-layedit-iframe {
|
||
border-bottom-width: 1px;
|
||
border-bottom-style: solid;
|
||
border-color: #e6e6e6;
|
||
}
|
||
|
||
.setname {
|
||
width: 70px;
|
||
font-size: 14px;
|
||
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
|
||
font-weight: 400;
|
||
color: rgba(0,0,0,0.85);
|
||
line-height: 21px;
|
||
background-color: white;
|
||
border: none;
|
||
margin-left: 40px;
|
||
color: #777;
|
||
cursor: pointer
|
||
}
|
||
|
||
.myimage {
|
||
width: 100px;
|
||
padding: 3px 0px;
|
||
}
|
||
.layeditTitleBtn {
|
||
margin-left: 16px;
|
||
width: 32px;
|
||
height: 16px;
|
||
font-size: 16px;
|
||
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
|
||
font-weight: 400;
|
||
color: #1E9FFF;
|
||
line-height: 24px;
|
||
cursor: pointer
|
||
}
|
||
.layuieditText {
|
||
width: 661px;
|
||
height: 160px;
|
||
background: #F8F8F8;
|
||
border-radius: 4px;
|
||
border: 1px solid #DCDEDF;
|
||
margin-left: 16px;
|
||
margin-top: 16px;
|
||
margin-bottom:16px;
|
||
overflow:auto;
|
||
word-break:break-all;
|
||
}
|
||
.wordsLength {
|
||
position: absolute;
|
||
right: 70px;
|
||
bottom: 70px;
|
||
font-size: 12px;
|
||
color: #BDCADA
|
||
}
|
||
.layui-util-face {
|
||
z-index: 19891020;
|
||
position: absolute;
|
||
left: 20px;
|
||
bottom: 40px;
|
||
margin-top: -4px;
|
||
margin-left: -10px;
|
||
}
|
||
.showface {
|
||
margin-left: 16px;
|
||
cursor: pointer;
|
||
}
|
||
.layuieditText:focus {
|
||
border: 1px solid #DCDEDF;
|
||
outline: none;
|
||
}
|
||
.weekdaydetail {
|
||
width: 50px;
|
||
border-radius: 4px;
|
||
border: 1px solid #DCDEDF;
|
||
text-align: center;
|
||
cursor: pointer;
|
||
margin-right: 10px;
|
||
}
|
||
.weekdayMark {
|
||
background: #1E9FFF;
|
||
}
|
||
.monthdetail {
|
||
width: 35px;
|
||
border-radius: 4px;
|
||
border: 1px solid #DCDEDF;
|
||
text-align: center;
|
||
cursor: pointer;
|
||
margin-right: 10px;
|
||
}
|
||
.weekItem {
|
||
display: flex;
|
||
margin-bottom: 10px;
|
||
}
|
||
.monthItem {
|
||
display: flex;
|
||
flex-direction: column;
|
||
}
|
||
</style>
|
||
<script>
|
||
var isOk = "@Html.Raw(isok)";
|
||
</script>
|
||
<script src="~/Scripts/layui_ext/xm-select/xm-select.js"></script>
|
||
<div class="layui-form-item" style="margin-top:20px;">
|
||
<label class="layui-form-label">
|
||
任务名称
|
||
</label>
|
||
<div class="layui-input-block my_form_iterm">
|
||
<input type="text" name="PLANNAME" id="PLANNAME" autocomplete="off" class="layui-input" lay-reqtext="名称不可为空!" lay-verify="required" value="@Model.PLANNAME" />
|
||
<input type="text" name="PKID" id="PKID" autocomplete="off" class="layui-input" value="@Model.PKID" style="display:none" />
|
||
</div>
|
||
</div>
|
||
@if (Model.TaskType == 1)
|
||
{
|
||
<div class="layui-form-item" style="margin-top:20px;">
|
||
<label class="layui-form-label">
|
||
类型
|
||
</label>
|
||
<div class="layui-input-block my_form_iterm">
|
||
<select name="TASKTYPE" id="TASKTYPE" lay-verify="required" lay-filter="TaskType">
|
||
<option value="1" selected="selected">人群包选择</option>
|
||
<option value="2">企微标签</option>
|
||
</select>
|
||
</div>
|
||
</div>
|
||
}
|
||
else
|
||
{
|
||
<div class="layui-form-item" style="margin-top:20px;">
|
||
<label class="layui-form-label">
|
||
类型
|
||
</label>
|
||
<div class="layui-input-block my_form_iterm">
|
||
<select name="TASKTYPE" id="TASKTYPE" lay-verify="required" lay-filter="TaskType">
|
||
<option value="1">人群包选择</option>
|
||
<option value="2" selected="selected">企微标签</option>
|
||
</select>
|
||
</div>
|
||
</div>
|
||
}
|
||
|
||
<div class="layui-form-item qunfaDiv" style="margin-top:20px;" id="qunfaDiv">
|
||
<label class="layui-form-label">
|
||
群发对象
|
||
</label>
|
||
<div class="layui-input-block my_form_iterm showItem">
|
||
<input type="text" name="GROUPID" id="GROUPID" autocomplete="off" class="layui-input" style="display:none" value="@Model.GROUPID" lay-reqtext="人群包不能为空!" lay-verify="required" />
|
||
<input type="text" name="GROUPMEMO" id="GROUPMEMO" autocomplete="off" class="layui-input" style="display:none" value="@Model.GROUPMEMO" />
|
||
<input type="text" name="GROUPNAME" id="GROUPNAME" autocomplete="off" class="layui-input halfpartContent" value="@Model.GROUPNAME" readonly="readonly" />
|
||
<input onclick="SendObject()" type="button" class="layui-btn layui-btn-sm layui-border-red" value="群发对象" style="line-height: 36px; height: 36px;margin-left:1%;width:15%">
|
||
</div>
|
||
</div>
|
||
<div class="layui-form-item qunfaDiv" style="margin-top:20px;" id="qiweidiv">
|
||
<label class="layui-form-label">
|
||
企业微信
|
||
</label>
|
||
<div class="layui-input-block my_form_iterm">
|
||
<div id="CORPIDS" style="width: 100%;"></div>
|
||
</div>
|
||
</div>
|
||
<div class="layui-form-item" style="margin-top: 20px;" id="qwDiv" >
|
||
<label class="layui-form-label" style="margin-top: 10px;">
|
||
企微账号
|
||
</label>
|
||
<div class="layui-input-block my_form_iterm" style="display:flex">
|
||
<textarea id="QiWeiPostJson" lay-verify="content" name="QiWeiPostJson" style="display:none"></textarea>
|
||
<table cellspacing="0" cellpadding="0" border="0" class="layui-table" lay-size="sm" id="qiweiTable">
|
||
<tbody>
|
||
</tbody>
|
||
</table>
|
||
<input onclick="SelectQW()" type="button" class="layui-btn layui-btn-sm layui-border-red" value="选择" style="line-height: 36px; height: 36px;width:15%;margin:10px;">
|
||
</div>
|
||
</div>
|
||
<div class="layui-form-item" style="margin-top:20px;">
|
||
<label class="layui-form-label">
|
||
任务内容
|
||
</label>
|
||
<div class="layui-input-block my_form_iterm">
|
||
<div class="layui-inline" style="width:100%;">
|
||
<div id="showJsonData" class="showJsonData"></div>
|
||
<textarea id="JSONDATA" lay-verify="content" name="JSONDATA" style="display:none"></textarea>
|
||
<div class="layui-layedit">
|
||
<div class="layui-unselect layui-layedit-tool">
|
||
<i class="layeditTitleBtn" title="图片" id="uploadImgAtt">图片</i>
|
||
<input class="layui-upload-file" type="file" accept="" name="file" multiple="">
|
||
<span class="layeditTitleBtn" id="uploadAtt">文件</span>
|
||
<input class="layui-upload-file" type="file" accept="" name="file" multiple="">
|
||
</div>
|
||
<div contenteditable="true" name="layuieditText" id="layuieditText" maxlength="1000" class="committee-form-text layuieditText" placeholder="输入消息内容" onkeyup="setLength();">
|
||
</div>
|
||
<span id="wordsLength" class="wordsLength">0/1000</span>
|
||
<div class="layui-util-face" id="layui-layer6" type="tips" times="6" showtime="0" contype="object" style="display:none">
|
||
<div id="" class="layui-layer-content">
|
||
<ul class="layui-clear">
|
||
@foreach (var item in ViewBag.faceList)
|
||
{
|
||
var fileName = item.Replace("[", "").Replace("]", "") + ".png";
|
||
<li title="face"><img src="~/Content/Images/icon/msgtool/face/@fileName" id="@item" alt="@item"></li>
|
||
}
|
||
</ul>
|
||
</div>
|
||
<span class="layui-layer-setwin">
|
||
</span>
|
||
</div>
|
||
<div>
|
||
<img src="~/Content/Images/icon/msgtool/face.png" id="showface" class="showface" />
|
||
<input type="button" class="setname" id="setname" value="客户昵称">
|
||
<input onclick="ComfirmText()" type="button" class="layeditConfirmBtn" value="确定">
|
||
<input onclick="ClearText()" type="button" class="layeditCancelBtn" value="取消">
|
||
</div>
|
||
</div>
|
||
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="layui-form-item" style="margin-top:20px;">
|
||
<label class="layui-form-label">
|
||
发送类型
|
||
</label>
|
||
<div class="layui-input-block my_form_iterm">
|
||
<input type="text" name="SENDTYPE" id="SENDTYPE" autocomplete="off" class="layui-input" style="display:none" value="now" />
|
||
<div class="layui-inline">
|
||
<input type="radio" name="sendtypedio" lay-filter="sendtypedio" value="now" title="立即发布" checked="checked">
|
||
<input type="radio" name="sendtypedio" lay-filter="sendtypedio" value="tim" title="定时发布">
|
||
<input type="radio" name="sendtypedio" lay-filter="sendtypedio" value="cycle" title="循环发布">
|
||
</div>
|
||
</div>
|
||
<div class="layui-input-block my_form_iterm sendtype3" style="display:none">
|
||
<input type="radio" name="cycleType" lay-filter="cycleType" value="daily" title="每天发布" checked="checked">
|
||
<input type="radio" name="cycleType" lay-filter="cycleType" value="week" title="每周发布">
|
||
<input type="radio" name="cycleType" lay-filter="cycleType" value="month" title="每月发布">
|
||
</div>
|
||
<div class="layui-input-block my_form_iterm cycle1" style="display:none">
|
||
<label class="userLabel">
|
||
发送周期:
|
||
</label>
|
||
<div class="userInput weekdayItem" style="display:flex">
|
||
<div class="weekdaydetail" data-index="1">周一</div>
|
||
<div class="weekdaydetail" data-index="2">周二</div>
|
||
<div class="weekdaydetail" data-index="3">周三</div>
|
||
<div class="weekdaydetail" data-index="4">周四</div>
|
||
<div class="weekdaydetail" data-index="5">周五</div>
|
||
<div class="weekdaydetail" data-index="6">周六</div>
|
||
<div class="weekdaydetail" data-index="7">周日</div>
|
||
<input placeholder="发送周期" name="PLANEXECYCLE" id="PLANEXECYCLE" autocomplete="off" style="margin-left:15px;display:none" value="@Model.PLANEXECYCLE">
|
||
</div>
|
||
</div>
|
||
<div class="layui-input-block my_form_iterm cycle2" style="display:none">
|
||
<label class="userLabel">
|
||
发送周期:
|
||
</label>
|
||
<div class="userInput monthItem">
|
||
<div class="weekItem">
|
||
<div class="monthdetail">1</div>
|
||
<div class="monthdetail">2</div>
|
||
<div class="monthdetail">3</div>
|
||
<div class="monthdetail">4</div>
|
||
<div class="monthdetail">5</div>
|
||
<div class="monthdetail">6</div>
|
||
<div class="monthdetail">7</div>
|
||
</div>
|
||
<div class="weekItem">
|
||
<div class="monthdetail">8</div>
|
||
<div class="monthdetail">9</div>
|
||
<div class="monthdetail">10</div>
|
||
<div class="monthdetail">11</div>
|
||
<div class="monthdetail">12</div>
|
||
<div class="monthdetail">13</div>
|
||
<div class="monthdetail">14</div>
|
||
</div>
|
||
<div class="weekItem">
|
||
|
||
<div class="monthdetail">15</div>
|
||
<div class="monthdetail">16</div>
|
||
<div class="monthdetail">17</div>
|
||
<div class="monthdetail">18</div>
|
||
<div class="monthdetail">19</div>
|
||
<div class="monthdetail">20</div>
|
||
<div class="monthdetail">21</div>
|
||
</div>
|
||
<div class="weekItem">
|
||
|
||
<div class="monthdetail">22</div>
|
||
<div class="monthdetail">23</div>
|
||
<div class="monthdetail">24</div>
|
||
<div class="monthdetail">25</div>
|
||
<div class="monthdetail">26</div>
|
||
<div class="monthdetail">27</div>
|
||
<div class="monthdetail">28</div>
|
||
</div>
|
||
<div class="weekItem">
|
||
<div class="monthdetail">29</div>
|
||
<div class="monthdetail">30</div>
|
||
<div class="monthdetail">31</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="layui-input-block my_form_iterm planexeTime" style="display:none">
|
||
<label class="userLabel">
|
||
预计开始时间:
|
||
</label>
|
||
<div class="userInput">
|
||
<input placeholder="预计开始时间" name="PLANEXETIME" id="PLANEXETIME" autocomplete="off" style="margin-left:15px" value="@Model.PLANEXETIME">
|
||
</div>
|
||
</div>
|
||
<div class="layui-input-block my_form_iterm dailytype" style="display:none">
|
||
<label class="userLabel">
|
||
预计开始日期:
|
||
</label>
|
||
<div class="userInput">
|
||
<input placeholder="预计开始日期" name="PLANEXEDATE" id="PLANEXEDATE" autocomplete="off" style="margin-left:15px" value="@Model.PLANEXEDATE">
|
||
</div>
|
||
</div>
|
||
<div class="layui-input-block my_form_iterm dailytype" style="display:none">
|
||
<label class="userLabel">
|
||
开始时间:
|
||
</label>
|
||
<div class="userInput">
|
||
<input placeholder="预计开始时间" name="PLANEXEHOUR" id="PLANEXEHOUR" autocomplete="off" style="margin-left:15px" value="@Model.PLANEXEHOUR">
|
||
</div>
|
||
</div>
|
||
<div class="layui-input-block my_form_iterm sendtype2" style="display:none">
|
||
<label class="userLabel">
|
||
截止时间:
|
||
</label>
|
||
<div class="userInput">
|
||
<input placeholder="截止时间" name="DUEDATE" id="DUEDATE" autocomplete="off" style="margin-left:15px" value="@Model.DUEDATE">
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="layui-form-item" style="margin-top:20px;">
|
||
<label class="layui-form-label">
|
||
备注
|
||
</label>
|
||
<div class="layui-input-block my_form_iterm">
|
||
<textarea id="Remark" cols="90" rows="7" name="Remark" class="remark">@Model.REMARK</textarea>
|
||
</div>
|
||
</div>
|
||
<div class="layui-form-item" style="padding-bottom:20px">
|
||
<div class="layui-input-block my_form_iterm">
|
||
<button class="layui-btn-ok" lay-submit lay-filter="formDemo"><span class="btnoktext">保存草稿</span></button>
|
||
<button class="userConfrimBtn" lay-submit lay-filter="confirmDemo"><span class="userconfrimtext">确认执行</span></button>
|
||
<button onclick="parent.Closed()" type="button" class="userConfrimBtn"><span class="userconfrimtext">取消</span></button>
|
||
</div>
|
||
</div>
|
||
@if (isok == "0")
|
||
{
|
||
<div class="layui-form-item">
|
||
<label class="layui-form-label erro_msg">错误提示:</label>
|
||
<div class="layui-input-block my_form_iterm erro_msg">
|
||
@Html.Raw(ViewBag.Msg)
|
||
</div>
|
||
</div>
|
||
}
|
||
<script src="~/Scripts/ali/aliyun-oss-sdk-6.16.0.min.js"></script>
|
||
<script>
|
||
var upload;
|
||
var jsonData = [];
|
||
var qiweiData = [];
|
||
var kfData = [];
|
||
var layedit;
|
||
var editIndex;
|
||
var userChoose = [];
|
||
// 定义最后光标对象
|
||
var lastEditRange = '';
|
||
var winindex;
|
||
var fileType = ".pdf,.xlsx,.xls,.doc,.docx,.wmv,.mp4,.mp3";
|
||
const client = new OSS({
|
||
// region以杭州为例(oss-cn-hangzhou),其他region按实际情况填写。
|
||
region: 'oss-cn-shanghai',
|
||
// 阿里云主账号AccessKey拥有所有API的访问权限,风险很高。强烈建议您创建并使用RAM账号进行API访问或日常运维,请登录RAM控制台创建RAM账号。
|
||
accessKeyId: '@ViewBag.OssModel.AccessKeyId',
|
||
accessKeySecret: '@ViewBag.OssModel.AccessKeySecret',
|
||
stsToken: '@ViewBag.OssModel.SecurityToken',
|
||
bucket: "wxcrmbucket"
|
||
});
|
||
|
||
|
||
layui.config({
|
||
base: '../Scripts/layui_ext/',
|
||
}).extend({
|
||
selectInput: 'selectInput/selectInput'
|
||
}).use(['table', 'laydate', 'upload', 'flow', 'element', 'form', 'selectInput'], function () {
|
||
var $ = layui.jquery
|
||
, upload = layui.upload
|
||
, element = layui.element
|
||
, layer = layui.layer
|
||
, form = layui.form
|
||
, selectInput = layui.selectInput;
|
||
element = layui.element;
|
||
var laydate = layui.laydate;
|
||
|
||
laydate.render({
|
||
elem: '#PLANEXETIME'
|
||
, type: 'datetime'
|
||
, format: 'yyyy-MM-dd HH:mm:ss',
|
||
});
|
||
laydate.render({
|
||
elem: '#PLANEXEDATE'
|
||
, type: 'date'
|
||
, trigger: 'click'
|
||
});
|
||
|
||
laydate.render({
|
||
elem: '#PLANEXEHOUR'
|
||
, type: 'time'
|
||
, format: 'HH:mm:ss'
|
||
, trigger: 'click'
|
||
});
|
||
|
||
laydate.render({
|
||
elem: '#DUEDATE'
|
||
, type: 'datetime'
|
||
, format: 'yyyy-MM-dd HH:mm:ss',
|
||
});
|
||
var File_Server = '@ViewBag.File_Server';
|
||
var loading;
|
||
|
||
var id = '@Html.Raw(ViewBag.id)';
|
||
if (id != '') {
|
||
init();
|
||
} else {
|
||
renderSelectChannel([]);
|
||
}
|
||
var taskType = '@Html.Raw(Model.TaskType)';
|
||
if (taskType == 1) {
|
||
$(".qunfaDiv").show();
|
||
}
|
||
else {
|
||
|
||
$(".qunfaDiv").hide()
|
||
}
|
||
$("#uploadAtt").click(function () {
|
||
var formid = "sf_extend_form_create";
|
||
$("#" + formid).remove();
|
||
var html = '<form method="post" id="' + formid + '" style="display:none" enctype="multipart/form-data" action=""><input name="file" type="file" accept="' + fileType +'" multiple="multiple"/></form>';
|
||
$("body").append(html);
|
||
var target = $("#" + formid + " input[type='file']");
|
||
target.change(function () {
|
||
$.each(target[0].files, function (i, e) {
|
||
|
||
putObject(e);
|
||
});
|
||
});
|
||
target.click();
|
||
});
|
||
|
||
//上传文件
|
||
/*$.ajax({
|
||
type: "GET",
|
||
url: File_Server + "/api/Token?key=7AC51A5F0DE9A13D5FC9960AD45CC8D5",
|
||
success: function (da) {
|
||
token = "Bearer " + da;
|
||
var uploadListIns = upload.render({
|
||
elem: '#uploadAtt'
|
||
, elemList: $('#demoList') //列表元素对象
|
||
//, url: 'https://httpbin.org/post' //此处用的是第三方的 http 请求演示,实际使用时改成您自己的上传接口即可。
|
||
, url: File_Server + '/Streaming/UploadLargeFile'
|
||
, accept: 'file'
|
||
, headers: { Authorization: token }
|
||
, multiple: true
|
||
, number: 10
|
||
, auto: true
|
||
//, bindAction: '#testListAction'
|
||
, choose: function (obj) {
|
||
var that = this;
|
||
var files = this.files = obj.pushFile(); //将每次选择的文件追加到文件队列
|
||
|
||
//读取本地文件
|
||
obj.preview(function (index, file, result) {
|
||
if (file.size > 1024 * 1024 * 500) {
|
||
layer.msg('不能上传超过500M的文件!', { icon: 2 });
|
||
delete files[index];
|
||
return;
|
||
}
|
||
});
|
||
$(".demo-reload").on('click', function () {
|
||
obj.upload(index, file);
|
||
});
|
||
}
|
||
, done: function (res, index, upload) { //成功的回调
|
||
var file = this.files[index];
|
||
var fileSize = (file.size / (1024)) > 1024 ? (file.size / (1024 * 1024)).toFixed(2) + 'MB' :
|
||
(file.size / (1024)).toFixed(1) + 'KB';
|
||
var data = {
|
||
fileName: file.name,
|
||
fileSize: fileSize,
|
||
fileUrl: res.url,
|
||
type: "file",
|
||
text:file.name
|
||
}
|
||
insertFile(data);
|
||
delete this.files[index];
|
||
}
|
||
, allDone: function (obj) { //多文件上传完毕后的状态回调
|
||
console.log(obj)
|
||
}
|
||
, error: function (index, upload) { //错误回调
|
||
|
||
}
|
||
, progress: function (n, elem, e, index) { //注意:index 参数为 layui 2.6.6 新增
|
||
|
||
}
|
||
});
|
||
}
|
||
}) */
|
||
|
||
|
||
|
||
//上传图片
|
||
$.ajax({
|
||
type: "GET",
|
||
url: File_Server + "/api/Token?key=7AC51A5F0DE9A13D5FC9960AD45CC8D5",
|
||
success: function (da) {
|
||
token = "Bearer " + da;
|
||
var uploadListIns = upload.render({
|
||
elem: '#uploadImgAtt'
|
||
, elemList: $('#demoList') //列表元素对象
|
||
, url: File_Server + '/Streaming/UploadLargeFile'
|
||
, accept: 'images'
|
||
, headers: { Authorization: token }
|
||
, multiple: true
|
||
, number: 10
|
||
, auto: false
|
||
//, bindAction: '#testListAction'
|
||
, choose: function (obj) {
|
||
var that = this;
|
||
var files = this.files = obj.pushFile(); //将每次选择的文件追加到文件队列
|
||
|
||
//读取本地文件
|
||
obj.preview(function (index, file, result) {
|
||
//大于300k压缩后上传
|
||
if (file.size > 1024 * 300) {
|
||
_dealFileBase64(result, file, function (fileCallBack) {
|
||
//读取本地文件
|
||
if (fileCallBack.size > 1024 * 300) {
|
||
layer.msg('文件压缩后仍大于300K,无法上传!', { icon: 2 });
|
||
delete files[index];
|
||
return;
|
||
}
|
||
files[index] = fileCallBack;
|
||
obj.upload(index, fileCallBack)
|
||
})
|
||
} else {
|
||
obj.upload(index, file)
|
||
}
|
||
});
|
||
}
|
||
, done: function (res, index, upload) { //成功的回调
|
||
var file = this.files[index];
|
||
var fileSize = (file.size / (1024)) > 1024 ? (file.size / (1024 * 1024)).toFixed(2) + 'MB' :
|
||
(file.size / (1024)).toFixed(1) + 'KB';
|
||
var data = {
|
||
fileName: file.name,
|
||
fileSize: fileSize,
|
||
fileUrl: res.url,
|
||
type: "img",
|
||
text: file.name
|
||
}
|
||
insertFile(data);
|
||
delete this.files[index];
|
||
}
|
||
, allDone: function (obj) { //多文件上传完毕后的状态回调
|
||
console.log(obj)
|
||
}
|
||
, error: function (index, upload) { //错误回调
|
||
|
||
}
|
||
, progress: function (n, elem, e, index) { //注意:index 参数为 layui 2.6.6 新增
|
||
|
||
}
|
||
});
|
||
}
|
||
})
|
||
})
|
||
layui.use('form', function () {
|
||
var form = layui.form;
|
||
var layer = layui.layer;
|
||
var type = "@Html.Raw(ViewBag.type)";
|
||
//监听提交
|
||
form.on('submit(formDemo)', function (data) {
|
||
var postJson = getContent();
|
||
data.field.JSONDATA = JSON.stringify(postJson);
|
||
if ($('#SENDTYPE').val() == 'week' || $('#SENDTYPE').val() == 'month') {
|
||
var weekJson = getweekInfo();
|
||
data.field.PLANEXECYCLE = weekJson;
|
||
}
|
||
data.field.QiWeiPostJson = JSON.stringify(qiweiData);
|
||
console.log(data.field);
|
||
|
||
if (isOk == "1") {
|
||
$.ajax({
|
||
type: "POST",
|
||
url: "Add",
|
||
data: data.field,
|
||
dataType: "json",
|
||
success: function (da) {
|
||
if (da.result == true) {
|
||
parent.layer.msg(da.retmsg, { icon: 1 });
|
||
parent.TableReload();
|
||
parent.Closed();
|
||
} else {
|
||
layer.msg(da.retmsg, { icon: 2 });
|
||
}
|
||
},
|
||
error: function () {
|
||
layer.msg('操作失败!', { icon: 2 });
|
||
}
|
||
});
|
||
return false;
|
||
} else {
|
||
layer.msg('系统错误!请关闭编辑页重试!', { icon: 2 });
|
||
return false;
|
||
}
|
||
});
|
||
form.on('submit(confirmDemo)', function (data) {
|
||
var postJson = getContent();
|
||
data.field.JSONDATA = JSON.stringify(postJson);
|
||
if ($('#SENDTYPE').val() == 'week' || $('#SENDTYPE').val() == 'month') {
|
||
var weekJson = getweekInfo();
|
||
data.field.PLANEXECYCLE = weekJson;
|
||
}
|
||
data.field.QiWeiPostJson = JSON.stringify(qiweiData);
|
||
console.log(data.field);
|
||
if (isOk == "1") {
|
||
$.ajax({
|
||
type: "POST",
|
||
url: "ConfirmSend",
|
||
data: data.field,
|
||
dataType: "json",
|
||
success: function (da) {
|
||
if (da.result == true) {
|
||
parent.Closed();
|
||
parent.OpenExecute(da.retmsg,1);
|
||
|
||
} else {
|
||
if (da.retcode == 400) {
|
||
layer.msg(da.retmsg, { icon: 2 });
|
||
} else {
|
||
parent.Closed();
|
||
parent.OpenExecute(data.field.PKID, 2);
|
||
}
|
||
}
|
||
},
|
||
error: function () {
|
||
layer.msg('操作失败!', { icon: 2 });
|
||
}
|
||
});
|
||
return false;
|
||
} else {
|
||
layer.msg('系统错误!请关闭编辑页重试!', { icon: 2 });
|
||
return false;
|
||
}
|
||
});
|
||
//此处即为 radio 的监听事件
|
||
form.on('radio(sendtypedio)', function (data) {
|
||
if (data.value == "tim") {
|
||
$(".sendtype3").hide();
|
||
$(".sendtype2").show();
|
||
$(".planexeTime").show();
|
||
$(".cycle1").hide();
|
||
$(".cycle2").hide();
|
||
$('#SENDTYPE').val(data.value);
|
||
$(".dailytype").hide();
|
||
}
|
||
if (data.value == "now") {
|
||
$(".sendtype2").hide();
|
||
$(".sendtype3").hide();
|
||
$(".planexeTime").hide();
|
||
$(".cycle1").hide();
|
||
$(".cycle2").hide();
|
||
$(".dailytype").hide();
|
||
$('#SENDTYPE').val(data.value);
|
||
}
|
||
if (data.value == "cycle") {
|
||
$(".sendtype2").show();
|
||
$(".sendtype3").show();
|
||
$(".dailytype").show();
|
||
$(".planexeTime").hide();
|
||
var cycleType = $("input[name='cycleType']:checked").val();
|
||
$('#SENDTYPE').val(cycleType);
|
||
if (cycleType == "daily") {
|
||
$(".cycle1").hide();
|
||
$(".cycle2").hide();
|
||
}
|
||
if (cycleType == "week") {
|
||
$(".cycle1").show();
|
||
$(".cycle2").hide();
|
||
}
|
||
if (cycleType == "month") {
|
||
$(".cycle1").hide();
|
||
$(".cycle2").show();
|
||
$(".dailytype").hide();
|
||
}
|
||
}
|
||
});
|
||
form.on('radio(cycleType)', function (data) {
|
||
$(".planexeTime").hide();
|
||
$(".dailytype").show();
|
||
if (data.value == "daily") {
|
||
$(".cycle1").hide();
|
||
$(".cycle2").hide();
|
||
}
|
||
if (data.value == "week") {
|
||
$(".cycle1").show();
|
||
$(".cycle2").hide();
|
||
}
|
||
if (data.value == "month") {
|
||
$(".cycle1").hide();
|
||
$(".cycle2").show();
|
||
|
||
}
|
||
$('#SENDTYPE').val(data.value);
|
||
});
|
||
document.body.addEventListener('click', function (e) {
|
||
console.log(e.target.parentNode.title);
|
||
if (e.target.id == 'showface') {
|
||
$(".layui-util-face").attr("style", "display:block")
|
||
return;
|
||
}
|
||
if (e.target.id == "setname" || e.target.parentNode.title == "face" || e.target.title == "face") {
|
||
let str = "";
|
||
if (e.target.parentNode.title == "face" || e.target.title == "face") {
|
||
var id = e.target.id;
|
||
if (e.target.title == "face") {
|
||
id = e.target.children[0].id
|
||
}
|
||
var filename = id.replace('[', '').replace(']', '');
|
||
str = "<img class='faceClass' src='/Content/Images/icon/msgtool/face/" + filename + ".png' alt='" + filename + "'/>";
|
||
} else {
|
||
str = "[#name]";
|
||
}
|
||
var selection = window.getSelection
|
||
? window.getSelection()
|
||
: document.selection;
|
||
document.getElementById("layuieditText").focus();
|
||
if (lastEditRange) {
|
||
// 存在最后光标对象,选定对象清除所有光标并添加最后光标还原之前的状态
|
||
selection.removeAllRanges();
|
||
selection.addRange(lastEditRange);
|
||
}
|
||
var range = selection.createRange
|
||
? selection.createRange()
|
||
: selection.getRangeAt(0);
|
||
if (!window.getSelection) {
|
||
var selection = window.getSelection
|
||
? window.getSelection()
|
||
: document.selection;
|
||
var range = selection.createRange
|
||
? selection.createRange()
|
||
: selection.getRangeAt(0);
|
||
range.pasteHTML(str);
|
||
range.collapse(false);
|
||
range.select();
|
||
} else {
|
||
var hasR = range.createContextualFragment(str);
|
||
var hasR_lastChild = hasR.lastChild;
|
||
while (
|
||
hasR_lastChild &&
|
||
hasR_lastChild.nodeName.toLowerCase() == 'br' &&
|
||
hasR_lastChild.previousSibling &&
|
||
hasR_lastChild.previousSibling.nodeName.toLowerCase() == 'br'
|
||
) {
|
||
var e = hasR_lastChild;
|
||
hasR_lastChild = hasR_lastChild.previousSibling;
|
||
hasR.removeChild(e);
|
||
}
|
||
range.insertNode(hasR);
|
||
if (hasR_lastChild) {
|
||
range.setEndAfter(hasR_lastChild);
|
||
range.setStartAfter(hasR_lastChild);
|
||
}
|
||
range.collapse(false);
|
||
selection.removeAllRanges();
|
||
selection.addRange(range);
|
||
}
|
||
// 无论如何都要记录最后光标对象
|
||
lastEditRange = selection.getRangeAt(0);
|
||
}
|
||
if (e.target.className.indexOf('weekdaydetail') > -1) {
|
||
if (e.target.className.indexOf('weekdayMark') > -1) {
|
||
//设置标记
|
||
e.target.setAttribute("class", "weekdaydetail");
|
||
} else {
|
||
e.target.setAttribute("class", "weekdaydetail weekdayMark");
|
||
}
|
||
}
|
||
if (e.target.className.indexOf('monthdetail') > -1) {
|
||
if (e.target.className.indexOf('weekdayMark') > -1) {
|
||
//设置标记
|
||
e.target.setAttribute("class", "monthdetail");
|
||
} else {
|
||
e.target.setAttribute("class", "monthdetail weekdayMark");
|
||
}
|
||
}
|
||
$(".layui-util-face").attr("style", "display:none");
|
||
|
||
})
|
||
// 编辑框点击事件
|
||
document.getElementById('layuieditText').onclick = function () {
|
||
// 获取选定对象
|
||
var selection = getSelection()
|
||
// 设置最后光标对象
|
||
lastEditRange = selection.getRangeAt(0)
|
||
}
|
||
/*阻止回车事件*/
|
||
$(window).keydown(function (e) {
|
||
|
||
var key = window.event ? e.keyCode : e.which;
|
||
/*获取用户按键,如果是回车,则不执行任何*/
|
||
if (key.toString() == "13") {
|
||
/*调用光标插入方法,在光标处插入 换行*/
|
||
@* insertHtml("<br/>");
|
||
return false;*@
|
||
document.execCommand('insertHTML', false, '<br>‌');
|
||
e.preventDefault();
|
||
}
|
||
});
|
||
form.on('select(TaskType)', function (data) {
|
||
@* layer.confirm('切换后企微账户需重新勾选,是否切换', {
|
||
offset: '200px'
|
||
}, function (index) {
|
||
if (data.value == 2) {
|
||
$(".qunfaDiv").hide();
|
||
//$("#qwDiv").show();
|
||
}
|
||
else {
|
||
$(".qunfaDiv").show();
|
||
//$("#qwDiv").hide();
|
||
}
|
||
qiweiData = [];
|
||
layer.close(index);
|
||
});*@
|
||
if (data.value == 2) {
|
||
$(".qunfaDiv").hide();
|
||
//$("#qwDiv").show();
|
||
}
|
||
else {
|
||
$(".qunfaDiv").show();
|
||
//$("#qwDiv").hide();
|
||
}
|
||
qiweiData = [];
|
||
initQWJsonData();
|
||
});
|
||
|
||
});
|
||
|
||
function _processData(dataUrl, type) {
|
||
var binaryString = window.atob(dataUrl.split(',')[1]),
|
||
arrayBuffer = new ArrayBuffer(binaryString.length),
|
||
intArray = new Uint8Array(arrayBuffer);
|
||
for (var i = 0, j = binaryString.length; i < j; i++) {
|
||
intArray[i] = binaryString.charCodeAt(i);
|
||
}
|
||
|
||
var data = [intArray], blob;
|
||
|
||
try {
|
||
blob = new Blob(data);
|
||
} catch (e) {
|
||
window.BlobBuilder = window.BlobBuilder ||
|
||
window.WebKitBlobBuilder ||
|
||
window.MozBlobBuilder ||
|
||
window.MSBlobBuilder;
|
||
if (e.name === 'TypeError' && window.BlobBuilder) {
|
||
var builder = new BlobBuilder();
|
||
builder.append(arrayBuffer);
|
||
blob = builder.getBlob(type);
|
||
} else {
|
||
_showTip('版本过低,不支持图片压缩上传');
|
||
}
|
||
}
|
||
return blob;
|
||
}
|
||
|
||
//转换为Base64 并调用 压缩方法
|
||
function _dealFileBase64(image_base64, file, callback) {
|
||
//判断文件是不是图片
|
||
var obj = 0.5;
|
||
var img = new Image();
|
||
img.src = image_base64;
|
||
img.onload = function () {
|
||
var that = this;
|
||
// 默认按比例压缩
|
||
var w = that.width,
|
||
h = that.height,
|
||
scale = w / h;
|
||
w = obj.width || w;
|
||
h = obj.height || (w / scale);
|
||
|
||
//生成canvas
|
||
var canvas = document.createElement('canvas'),
|
||
ctx = canvas.getContext('2d');
|
||
canvas.width = w;
|
||
canvas.height = h;
|
||
ctx.drawImage(that, 0, 0, w, h);
|
||
|
||
// 默认图片质量为0.7
|
||
var quality = 0.7;
|
||
if (obj.quality && obj.quality <= 1 && obj.quality > 0) {
|
||
quality = obj.quality;
|
||
}
|
||
|
||
// 回调函数返回base64的值
|
||
var base64 = canvas.toDataURL('image/jpeg', quality);
|
||
var bl = _processData(base64, file.type);
|
||
var _file = new File([bl], file.name, { type: file.type })
|
||
callback(_file);
|
||
}
|
||
}
|
||
function Closed() {
|
||
layer.close(winindex);
|
||
}
|
||
function renderSelectChannel(check) {
|
||
var allChannel = @Html.Raw(ViewBag.AllChannel);
|
||
var optionsChannel = {
|
||
el: '#CORPIDS',
|
||
name: 'CORPIDS',//表单的name属性
|
||
tips: '请选择企业微信',
|
||
//layVerify: 'required',
|
||
toolbar: {//工具条,全选,清空,反选,自定义
|
||
show: true,
|
||
list: [
|
||
'CLEAR'
|
||
]
|
||
},
|
||
data: allChannel,
|
||
initValue: check
|
||
};
|
||
var selectChannel = xmSelect.render(optionsChannel);
|
||
return selectChannel;
|
||
}
|
||
function init() {
|
||
var allChannel = '@Html.Raw(Model.CORPIDS)';
|
||
var channel = [];
|
||
if (allChannel != "") {
|
||
channel = allChannel.split(',');
|
||
}
|
||
renderSelectChannel(channel);
|
||
var jsontext = @Html.Raw(string.IsNullOrWhiteSpace(Model.JSONDATA)?"[]": Model.JSONDATA);
|
||
if (jsontext != '') {
|
||
jsonData = jsontext;
|
||
initJsonData();
|
||
}
|
||
var qiweiText = @Html.Raw(string.IsNullOrWhiteSpace(Model.QiWeiPostJson)?"[]": Model.QiWeiPostJson);
|
||
if (qiweiText != '') {
|
||
qiweiData = qiweiText;
|
||
|
||
initQWJsonData();
|
||
}
|
||
var sendType = '@Html.Raw(Model.SENDTYPE)';
|
||
if (sendType != "") {
|
||
$('#SENDTYPE').val(sendType);
|
||
}
|
||
if (sendType == 'tim') {
|
||
$("input[name='sendtypedio'][value=now]").attr("checked", false);
|
||
$("input[name='sendtypedio'][value=tim]").attr("checked", true);
|
||
$('#SENDTYPE').val(sendType);
|
||
$(".planexeTime").show();
|
||
$(".sendtype2").show();
|
||
}
|
||
if (sendType != 'tim' & sendType != 'now')
|
||
{
|
||
$("input[name='sendtypedio'][value=now]").attr("checked", false);
|
||
$("input[name='sendtypedio'][value=tim]").attr("checked", false);
|
||
$("input[name='sendtypedio'][value=cycle]").attr("checked", true);
|
||
$(".sendtype3").show();
|
||
$(".sendtype2").show();
|
||
$(".planexeTime").hide();
|
||
$(".dailytype").show();
|
||
if (sendType == 'daily') {
|
||
$("input[name='cycleType'][value=daily]").attr("checked", true);
|
||
$(".planexeTime").hide();
|
||
} else if (sendType == 'week') {
|
||
$("input[name='cycleType'][value=week]").attr("checked", true);
|
||
$(".cycle1").show();
|
||
} else if (sendType == 'month') {
|
||
$("input[name='cycleType'][value=month]").attr("checked", true);
|
||
$(".cycle2").show();
|
||
}
|
||
}
|
||
layui.form.render("radio");
|
||
if (sendType == 'week') {
|
||
var exeCycle = '@Html.Raw(Model.PLANEXECYCLE)';
|
||
if (exeCycle != '') {
|
||
$(".weekdayItem div").each(function () {
|
||
var dataIndex = this.getAttribute("data-index");
|
||
if (exeCycle.indexOf(dataIndex) > -1) {
|
||
this.setAttribute("class","monthdetail weekdayMark");
|
||
}
|
||
})
|
||
}
|
||
}
|
||
if (sendType == 'month') {
|
||
var exeCycle = '@Html.Raw(Model.PLANEXECYCLE)';
|
||
if (exeCycle != '') {
|
||
var cycleArr = exeCycle.replace('[', '').replace(']', '').split(',');
|
||
$(".monthItem div .monthdetail").each(function () {
|
||
var dataIndex = this.textContent;
|
||
for (var i = 0; i < cycleArr.length; i++) {
|
||
if (dataIndex == cycleArr[i]) {
|
||
this.setAttribute("class", "monthdetail weekdayMark");
|
||
}
|
||
}
|
||
})
|
||
}
|
||
}
|
||
|
||
}
|
||
function ChoosePeople() {
|
||
var chooseData = $("#ReceiveData").val();
|
||
var checkids = "";
|
||
if (chooseData) {
|
||
var data = JSON.parse(chooseData);
|
||
for (var i = 0; i < data.length; i++) {
|
||
checkids += data[i].Receiverid+",";
|
||
}
|
||
}
|
||
checkids = checkids.slice(0, checkids.length - 1);
|
||
winindex = layer.open({
|
||
title: '选择部门和员工',
|
||
type: 2,
|
||
content: '/MsgToolPlan/ChoosePeople?data=' + checkids,
|
||
area: ['1000px', '550px']
|
||
});
|
||
}
|
||
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 SendObject() {
|
||
var chooseData = $("#GROUPID").val();
|
||
winindex = layer.open({
|
||
title: '选择人群包',
|
||
type: 2,
|
||
content: '/MsgToolPlan/UserGroup?data=' + chooseData,
|
||
area: ['1000px', '550px']
|
||
});
|
||
}
|
||
function SelectQW() {
|
||
var tasktype = $("#TASKTYPE").val();
|
||
if (tasktype == 1) {
|
||
winindex = layer.open({
|
||
title: '选择企业微信',
|
||
type: 2,
|
||
content: '/MsgToolTask/ChooseQWByCorp',
|
||
area: GetWindowInfo()
|
||
});
|
||
} else {
|
||
winindex = layer.open({
|
||
title: '选择企业微信',
|
||
type: 2,
|
||
content: '/MsgToolTask/ChooseQW',
|
||
area: GetWindowInfo()
|
||
});
|
||
}
|
||
}
|
||
function SetPeople(data) {
|
||
$("#ReceiveData").val(JSON.stringify(data));
|
||
var peopleText = "";
|
||
for (var i = 0; i < data.length; i++) {
|
||
peopleText += data[i].Text + ",";
|
||
}
|
||
peopleText = peopleText.slice(0, peopleText.length - 1);
|
||
$("#ShowPeopleText").val(peopleText);
|
||
Closed();
|
||
}
|
||
function SetUserGroup(data) {
|
||
$("#GROUPID").val(data.id);
|
||
$("#GROUPNAME").val(data.text);
|
||
$("#GROUPMEMO").val(data.description);
|
||
Closed();
|
||
}
|
||
function ClearText() {
|
||
$("#layuieditText").empty();
|
||
setLength();
|
||
}
|
||
function ComfirmText() {
|
||
var lastTag = document.querySelector('#layuieditText').lastElementChild;
|
||
if (lastTag && lastTag.tagName == "BR") {
|
||
lastTag.remove();
|
||
}
|
||
var value = $("#layuieditText").html();
|
||
$("#layuieditText img").each(function () {
|
||
if ($(this).attr('alt') != undefined) {
|
||
value = value.replace(this.outerHTML, "[" + $(this).attr('alt') + "]");
|
||
}
|
||
})
|
||
value = value.replaceAll("<br>", "\n");
|
||
value = value.replace(/\s*$/g, '');
|
||
value = value.replaceAll(" ", " ");
|
||
var re = /<[^>]+>/g; //清空标签的正则
|
||
value = value.replace(re, ""); //替换成没有样式的内容
|
||
if (value != "") {
|
||
var value = {
|
||
sort: jsonData.length+1,
|
||
msgtype: "txt",
|
||
content: value
|
||
}
|
||
if (editItemIndex > -1) {
|
||
InsertChatItem(value);
|
||
} else {
|
||
jsonData.push(value)
|
||
}
|
||
}
|
||
initJsonData();
|
||
setLength();
|
||
}
|
||
|
||
function initJsonData() {
|
||
$("#showJsonData").empty();
|
||
for (var i = 0; i < jsonData.length; i++) {
|
||
var content = jsonData[i].content;
|
||
if (jsonData[i].msgtype == "img") {
|
||
content = "<a href='" + jsonData[i].content + "' target='_blank'><img class='myimage' src='" + jsonData[i].content + "'/></a>";
|
||
} else if (jsonData[i].msgtype == "file") {
|
||
var lastFileIndex = jsonData[i].content.lastIndexOf("/");
|
||
var content = "<a href='" + jsonData[i].content + "' target='_blank'>" + decodeURI(jsonData[i].content.substring(lastFileIndex + 1, jsonData[i].content.length)) + "</a>";
|
||
} else {
|
||
content = replaceFace(content);
|
||
//jsonData[i].content = content;
|
||
}
|
||
var appendHtml = "<div class='chatItem' id=chat" + (i + 1) + "><div class='chatcontent'>" + (i + 1) + "、" + content + "</div>"
|
||
+ "<input onclick='EditChatItem(this)' type='button' class='layui-btn layui-btn-sm delchatItem icon-editmini' >"
|
||
+ "<input onclick='UpChatItem(this)' type='button' class='layui-btn layui-btn-sm delchatItem icon-upmini'>"
|
||
+ "<input onclick='DownChatItem(this)' type='button' class='layui-btn layui-btn-sm delchatItem icon-downmini'>"
|
||
+ "<input onclick='DelChatItem(this)' type='button' class='layui-btn layui-btn-sm delchatItem icon-delmini'>"
|
||
+ "</div>";
|
||
$("#showJsonData").append(appendHtml);
|
||
}
|
||
$("#JSONDATA").val(JSON.stringify(jsonData));
|
||
|
||
//$("#layuieditText").val("");
|
||
$("#layuieditText").empty();
|
||
}
|
||
|
||
function initQWJsonData() {
|
||
$("#qiweiTable").empty();
|
||
if (qiweiData.length > 0) {
|
||
$("#qiweidiv").hide();
|
||
} else {
|
||
$("#qiweidiv").show();
|
||
}
|
||
for (var i = 0; i < qiweiData.length; i++) {
|
||
var item = qiweiData[i];
|
||
var appendHtml = '<tr data-index="' + i + '" class="" >' + '<td>' + item.corpname + '</td>' + '<td>' + item.userid + '(' + item.kfnickname + ')</td>';
|
||
if (item.outuserList) {
|
||
appendHtml += '<td>选中' + item.outuserList.length + '人</td>';
|
||
}
|
||
appendHtml += '<td id="' + item.userid +'"><input onclick="delkfuser(this)" type="button" class="layui-btn layui-btn-sm delchatItem icon-delmini"></a></td>';
|
||
appendHtml += '</tr>';
|
||
$("#qiweiTable").append(appendHtml);
|
||
}
|
||
}
|
||
function InsertChatItem(item) {
|
||
var newChatItem = [];
|
||
for (var i = 0; i < jsonData.length; i++) {
|
||
if ((i + 1) == editItemIndex) {
|
||
newChatItem.push(item);
|
||
continue;
|
||
}
|
||
var value = {
|
||
sort: newChatItem.length + 1,
|
||
msgtype: jsonData[i].msgtype,
|
||
content: jsonData[i].content
|
||
}
|
||
newChatItem.push(value);
|
||
}
|
||
jsonData = newChatItem;
|
||
editItemIndex = -1;
|
||
}
|
||
function delkfuser(item) {
|
||
var newData = [];
|
||
for (var i = 0; i < qiweiData.length; i++) {
|
||
if (qiweiData[i].userid == item.parentNode.id)
|
||
{
|
||
continue;
|
||
}
|
||
newData.push(qiweiData[i]);
|
||
}
|
||
qiweiData = newData;
|
||
initQWJsonData();
|
||
}
|
||
function DelChatItem(item) {
|
||
var newChatItem = [];
|
||
for (var i = 0; i < jsonData.length; i++) {
|
||
if ("chat" + (i+1) == item.parentNode.id) {
|
||
continue;
|
||
}
|
||
var value = {
|
||
sort: newChatItem.length + 1,
|
||
msgtype: jsonData[i].msgtype,
|
||
content: jsonData[i].content
|
||
}
|
||
newChatItem.push(value);
|
||
}
|
||
jsonData = newChatItem;
|
||
initJsonData();
|
||
}
|
||
var editItemIndex = -1;
|
||
function EditChatItem(item) {
|
||
for (var i = 0; i < jsonData.length; i++) {
|
||
if ("chat" + (i + 1) == item.parentNode.id) {
|
||
editItemIndex = i + 1;
|
||
if (jsonData[i].msgtype == "txt") {
|
||
var content = replaceFace(jsonData[i].content);
|
||
@* while (content.indexOf('\n') > -1) {
|
||
content = content.replace('\n', '<br>');
|
||
}*@
|
||
content = content.replaceAll('\n', '<br>');
|
||
document.getElementById('layuieditText').innerHTML = content;
|
||
setLength();
|
||
break;
|
||
} else if (jsonData[i].msgtype == "file") {
|
||
$("#uploadAtt").click();
|
||
}else if (jsonData[i].msgtype == "img") {
|
||
$("#uploadImgAtt").click();
|
||
}
|
||
}
|
||
}
|
||
}
|
||
function insertFile(item) {
|
||
var newItem = {
|
||
sort: jsonData.length + 1,
|
||
msgtype: item.type,
|
||
content: item.fileUrl,
|
||
filename: item.fileName
|
||
};
|
||
if (editItemIndex > -1) {
|
||
InsertChatItem(newItem);
|
||
} else {
|
||
jsonData.push(newItem);
|
||
}
|
||
editItemIndex = -1;
|
||
initJsonData();
|
||
}
|
||
function UpChatItem(item) {
|
||
var newChatItem = [];
|
||
if (item.parentNode.id == "chat1") {
|
||
return;
|
||
}
|
||
for (var i = 1; i <= jsonData.length; i++) {
|
||
if ("chat" + (i + 1) == item.parentNode.id) {
|
||
jsonData[i].sort = jsonData[i].sort - 1;
|
||
jsonData[i-1].sort = jsonData[i-1].sort + 1;
|
||
newChatItem.push(jsonData[i]);
|
||
newChatItem.push(jsonData[i - 1]);
|
||
i++;
|
||
continue;
|
||
}
|
||
newChatItem.push(jsonData[i-1]);
|
||
}
|
||
jsonData = newChatItem;
|
||
initJsonData();
|
||
}
|
||
function DownChatItem(item) {
|
||
var newChatItem = [];
|
||
if (item.parentNode.id == "chat" + (jsonData.length)) {
|
||
return;
|
||
}
|
||
for (var i = 0; i < jsonData.length; i++) {
|
||
if ("chat" + (i + 1) == item.parentNode.id) {
|
||
jsonData[i].sort = jsonData[i].sort + 1;
|
||
jsonData[i +1].sort = jsonData[i + 1].sort - 1;
|
||
newChatItem.push(jsonData[i + 1]);
|
||
newChatItem.push(jsonData[i]);
|
||
i++;
|
||
continue;
|
||
}
|
||
newChatItem.push(jsonData[i]);
|
||
}
|
||
|
||
jsonData = newChatItem;
|
||
initJsonData();
|
||
}
|
||
function setLength() {
|
||
var _html = $("#layuieditText").text();
|
||
|
||
var num = _html.length;
|
||
if (num > 1000) {
|
||
document.getElementById("layuieditText").innerHTML = _html.substr(0, 1000);
|
||
this.blur();
|
||
}
|
||
var leng = "wordsLength";
|
||
if (num < 0) {
|
||
num = 0;
|
||
}
|
||
document.getElementById(leng).innerHTML = num + "/1000";
|
||
var selection = window.getSelection
|
||
? window.getSelection()
|
||
: document.selection;
|
||
document.getElementById("layuieditText").focus();
|
||
lastEditRange = selection.getRangeAt(0);
|
||
}
|
||
function getContent() {
|
||
var oldData = [];
|
||
for (var i = 0; i < jsonData.length; i++) {
|
||
var oldItem = jsonData[i];
|
||
var item = {
|
||
sort: i + 1,
|
||
msgtype: oldItem.msgtype,
|
||
content: oldItem.content
|
||
}
|
||
oldData.push(item);
|
||
}
|
||
return oldData;
|
||
}
|
||
function getweekInfo() {
|
||
var exeCycle = '';
|
||
if ($('#SENDTYPE').val() == 'week') {
|
||
$(".weekdayItem div").each(function () {
|
||
if (this.className.indexOf("weekdayMark") > -1) {
|
||
var dataIndex = this.getAttribute("data-index");
|
||
exeCycle = exeCycle + dataIndex + ",";
|
||
}
|
||
})
|
||
} else {
|
||
$(".monthItem div .monthdetail").each(function () {
|
||
if (this.className.indexOf("weekdayMark") > -1) {
|
||
var dataIndex = this.textContent;
|
||
exeCycle = exeCycle + dataIndex + ",";
|
||
}
|
||
})
|
||
}
|
||
exeCycle = exeCycle.substr(0, exeCycle.length - 1);
|
||
exeCycle = "[" + exeCycle + "]";
|
||
return exeCycle;
|
||
}
|
||
//替换表情
|
||
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 class="faceClass" src="/Content/Images/icon/msgtool/face/' + src + '" alt="' + facelist[i].replace("[", "").replace("]", "") +'"/>');
|
||
}
|
||
}
|
||
return cotent;
|
||
}
|
||
function SetUserChoose(userChoose) {
|
||
qiweiData = userChoose;
|
||
initQWJsonData();
|
||
}
|
||
function GetQiweiData() {
|
||
return qiweiData;
|
||
}
|
||
//上传方法
|
||
async function putObject(file) {
|
||
try {
|
||
var filepath = "@DateTime.Now.ToString("yyyyMM/")" + guid() +"/";
|
||
var filename = file.name;
|
||
if (file.size > 100 * 1024 * 1024) {//分片上传 100M分卷
|
||
const options = {
|
||
// 获取分片上传进度、断点和返回值。
|
||
progress: (p, cpt, res) => {
|
||
abortCheckpoint = cpt;
|
||
},
|
||
// 设置并发上传的分片数量。
|
||
parallel: 4,
|
||
// 设置分片大小。默认值为1 MB,最小值为100 KB。
|
||
partSize: 1024 * 1024,
|
||
// headers,
|
||
// 自定义元数据,通过HeadObject接口可以获取Object的元数据。
|
||
meta: { year: (new Date()).getFullYear(), people: "DNcustomUpFile" },
|
||
mime: file.type,
|
||
headers: {
|
||
// 指定该Object被下载时的名称。
|
||
//"Content-Disposition": "example.xls",
|
||
// 指定Object标签,可同时设置多个标签。
|
||
//"x-oss-tagging": "Tag1=1&Tag2=2",
|
||
}
|
||
};
|
||
const result = await client.multipartUpload(filepath + filename, file, options);//分页上传
|
||
var data = {
|
||
fileName: filename,
|
||
fileSize: file.size,
|
||
fileUrl: result.url,
|
||
type: "file",
|
||
text: file.name
|
||
}
|
||
insertFile(data);
|
||
//save({ filename: filename, filepath: filepath, title: file.name, locfilename: file.name, ossurl: result.url});//记录文件
|
||
} else {
|
||
const result = await client.put(filepath + filename, file);//小文件上传
|
||
var data = {
|
||
fileName: filename,
|
||
fileSize: file.size,
|
||
fileUrl: result.url,
|
||
type: "file",
|
||
text: file.name
|
||
}
|
||
insertFile(data);
|
||
//save({ filename: filename, filepath: filepath, title: file.name, locfilename: file.name, ossurl: result.url});//记录文件
|
||
}
|
||
} catch (e) {
|
||
console.log(e);
|
||
}
|
||
}
|
||
function guid() {
|
||
return "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx".replace(/[x]/g, () =>
|
||
Math.floor(Math.random() * 16)
|
||
.toString(16)
|
||
.toUpperCase()
|
||
)
|
||
}
|
||
</script>
|
||
|
||
|