<%@ Page Language="C#" AutoEventWireup="true" CodeFile="GwDiverterUpdate.aspx.cs" Inherits="GwDiverterUpdate" %>
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
<head>
|
<meta charset="utf-8" />
|
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
|
<meta name="renderer" content="webkit" /><meta http-equiv="Cache-Control" content="no-siteapp" />
|
<title></title>
|
<!--[if lt IE 9]>
|
<meta http-equiv="refresh" content="0;ie.html" />
|
<![endif]-->
|
<link rel="shortcut icon" href="favicon.ico" />
|
<link href="css/bootstrap.min14ed.css?v=3.3.6" rel="stylesheet" />
|
<link href="css/font-awesome.min93e3.css?v=4.4.0" rel="stylesheet" />
|
<link href="css/plugins/iCheck/custom.css" rel="stylesheet" />
|
<link href="css/animate.min.css" rel="stylesheet" />
|
<link href="css/style.min862f.css?v=4.1.0" rel="stylesheet" />
|
<link href="css/plugins/sweetalert/sweetalert.css" rel="stylesheet" />
|
<link href="css/plugins/datapicker/datepicker3.css" rel="stylesheet" />
|
<link href="css/jquery.numberedtextarea.css" rel="stylesheet" />
|
<script src="js/loading.js" type="text/javascript"></script>
|
<script src="js/jquery.min.js?v=2.1.4"></script>
|
<script src="js/json.js"></script>
|
<script src="js/bootstrap.min.js?v=3.3.6"></script>
|
<script src="js/content.min.js?v=1.0.0"></script>
|
<script src="js/plugins/iCheck/icheck.min.js"></script>
|
<script src="js/plugins/sweetalert/sweetalert.min.js"></script>
|
<script src="js/plugins/datapicker/bootstrap-datepicker.js"></script>
|
<script type="text/javascript" src="/js/jquery-loading.js"></script>
|
<script type="text/javascript" src="/js/jquery-form.js"></script>
|
<script type="text/javascript" src="/js/jquery.numberedtextarea.js"></script>
|
<script type="text/javascript" src="/js/mytek-pager.js"></script>
|
<script src="js/mytek-pagination.js?r=11" type="text/javascript"></script>
|
<style>
|
body { font-size: 12px; color: #111111; }
|
.mask { position: absolute; top: 0px; filter: alpha(opacity=60); background-color: #777; z-index: 1002; left: 0px; opacity: 0.5; -moz-opacity: 0.5; text-align: center; display: none; }
|
.mask span { height: 70%; display: inline-block; vertical-align: middle; }
|
.mask span img { vertical-align: middle; }
|
</style>
|
<script>
|
(function ($) {
|
$.ajaxBak = $.ajax;
|
|
$.ajax = function (options) {
|
options.timeout = 300000;
|
options.url = options.url + (options.url.indexOf("?") > 0 ? "&" : "?") + "r=" + Math.random();
|
|
options.complete = function (e) {
|
$("body").hideLoading();
|
}
|
|
if (options.showloading !== false) {
|
$("body").showLoading();
|
}
|
|
try {
|
return $.ajaxBak.call(this, options);
|
} catch (e) {
|
if (options.showloading !== false) {
|
$("body").hideLoading();
|
}
|
}
|
return this;
|
}
|
})(jQuery);
|
|
$(document).ready(function(){
|
$(".icheck-me").iCheck({checkboxClass:"icheckbox_square-green",radioClass:"iradio_square-green",});
|
$(".input-group.date").datepicker({todayBtn:"linked",keyboardNavigation:!1,forceParse:!1,calendarWeeks:!0,autoclose:!0});
|
$("[data-toggle='tooltip']").tooltip();
|
$("[data-toggle=popover]").popover()
|
});
|
</script>
|
|
<style type="text/css">
|
.diverter-item {
|
}
|
|
.diverter-item > td > div {
|
padding: 10px;
|
}
|
|
.diverter-item span.connector {
|
background-color: #009900;
|
color: #FFFFFF;
|
padding: 5px;
|
}
|
|
.diverter-item input {
|
padding: 5px;
|
border: none;
|
border-bottom: 1px dashed #333;
|
margin: 0px 10px 0px 10px;
|
}
|
|
.diverter-item select {
|
margin-left: 5px;
|
}
|
|
.footer-bar {
|
padding: 10px 0px 10px 0px;
|
text-align: right;
|
}
|
</style>
|
<script type="text/javascript">
|
$(function() {
|
$(document).on("click", ".action-remove-item", function() {
|
var tr = $(this).parent("td").parent("tr");
|
tr.remove();
|
});
|
|
$(".action-append-item").on("click", function() {
|
createItem(0, "", 0, 0, "", 0, "", 0, "", 0, "", "", "", "", 0);
|
});
|
|
$(".action-save").on("click", function() {
|
var diverterItems = [];
|
var flag = false;
|
var items = $(".diverter-item").each(function() {
|
var data = {};
|
var me = $(this);
|
if (me.find(".Mode").val() == 0) {
|
mytek.alert("请选择导流方式");
|
flag = true;
|
return false;
|
}
|
data.Mode = me.find(".Mode").val() || "";
|
if (me.find(".Mode").val() == 1 && me.find("#Keywords").val() == "") {
|
mytek.alert("请填写关键字");
|
flag = true;
|
return false;
|
}
|
data.Keywords = me.find("#Keywords").val() || "";
|
if (me.find(".Mode").val() == 2 && (me.find("#SmMaxLength").val() == "" || me.find("#SmMinLength").val() == "")) {
|
mytek.alert("请填写字数");
|
flag = true;
|
return false;
|
}
|
data.SmMaxLength = me.find("#SmMaxLength").val() || 0;
|
data.SmMinLength = me.find("#SmMinLength").val() || 0;
|
if (me.find(".Mode").val() == 3 && me.find("#Segments").val() == "") {
|
mytek.alert("请填写号段");
|
flag = true;
|
return false;
|
}
|
var Province = [];
|
$("input[name=provinceData]").each(function() {
|
if (me.find(this).is(":checked")) {
|
//if ($(this).is(":checked")) {
|
Province.push($(this).val());
|
}
|
});
|
data.Province = "" + Province + "";
|
|
data.Segments = me.find("#Segments").val() || "";
|
|
data.CUOPID = me.find("#CUOPID").val() || 0;
|
data.CTOPID = me.find("#CTOPID").val() || 0;
|
data.CMOPID = me.find("#CMOPID").val() || 0;
|
data.CUExtNo = me.find("#CUExtNo").val() || "";
|
data.CUExtParams = me.find("#CUExtParams").val() || "";
|
data.CTExtNo = me.find("#CTExtNo").val() || "";
|
data.CTExtParams = me.find("#CTExtParams").val() || "";
|
data.CMExtNo = me.find("#CMExtNo").val() || "";
|
data.CMExtParams = me.find("#CMExtParams").val() || "";
|
data.ExtNoMode = me.find("#ExtNoMode").val() || 0;
|
|
diverterItems.push(data);
|
});
|
if (flag) {
|
return false;
|
};
|
$.ajax({
|
url: "GwDiverter.ashx",
|
type: "POST",
|
data: { action: "editDeal", DiverterID: $("#DiverterID").val(), DiverterName: $("#DiverterName").val(), Content: $.toJSON(diverterItems) },
|
success: function(result) {
|
if (result.OK) {
|
mytek.alert(result.Message, result.OK, function() {
|
location.href = "GwDiverter.aspx";
|
});
|
} else {
|
mytek.alert(result.Message, result.False);
|
}
|
}
|
});
|
});
|
|
$(document).on("change", "select[name='Mode']", function() {
|
var mode = parseInt($(this).val());
|
if (mode == 0) {
|
$(this).parent().find(".Mode-Keywords").hide();
|
$(this).parent().find(".Mode-SmMaxLength").hide();
|
$(this).parent().find(".Mode-Segments").hide();
|
$(this).parent().find(".Mode-Province").hide();
|
}
|
else if (mode == 1) {
|
//$(this).parent().find(".Mode-Keywords").css("display","block","margin-top","5px");
|
$(this).parent().find(".Mode-Keywords").show();
|
$(this).parent().find(".Mode-SmMaxLength").hide();
|
$(this).parent().find(".Mode-Segments").hide();
|
$(this).parent().find(".Mode-Province").hide();
|
} else if (mode == 2) {
|
$(this).parent().find(".Mode-SmMaxLength").show();
|
$(this).parent().find(".Mode-Keywords").hide();
|
$(this).parent().find(".Mode-Segments").hide();
|
} else if (mode == 3) {
|
$(this).parent().find(".Mode-Keywords").hide();
|
$(this).parent().find(".Mode-SmMaxLength").hide();
|
$(this).parent().find(".Mode-Province").hide();
|
$(this).parent().find(".Mode-Segments").show();
|
} else if (mode == 4) {
|
$(this).parent().find(".Mode-Keywords").hide();
|
$(this).parent().find(".Mode-SmMaxLength").hide();
|
$(this).parent().find(".Mode-Segments").hide();
|
$(this).parent().find(".Mode-Province").show();
|
}
|
});
|
|
$(document).on("click", "#checkAll", function() {
|
var me = $(this);
|
//$(this).next().siblings();
|
$(this).next().siblings().prop("checked", $(this).is(":checked"));
|
//$("input[name='provinceData']").prop("checked", $(this).is(":checked"));
|
});
|
|
|
var data = $.evalJSON(<%=Newtonsoft.Json.JsonConvert.SerializeObject(this.DataDiverterItem)%>);
|
|
|
|
loadData(data);
|
|
function loadData(data) {
|
$.each(data, function(i) {
|
createItem(this.Mode, this.Keywords, this.SmMaxLength, this.SmMinLength, this.Segments, this.CTOPID, this.CTExtNo, this.CUOPID, this.CUExtNo, this.CMOPID, this.CMExtNo, this.CMExtParams, this.CUExtParams, this.CTExtParams, this.ExtNoMode, this.Province);
|
});
|
}
|
|
function createItem(mode, keywords, max, min, segments, ctopid, ctExtNo, cuopid, cuExtNo, cmopid, cmExtNo, CMExtParams, CUExtParams, CTExtParams, extNoMode, Province) {
|
var html = [];
|
html.push('<tr class="diverter-item">');
|
html.push(' <th style="word-wrap: break-word; word-break: break-all">');
|
html.push('导流规则');
|
html.push(' </th>');
|
html.push('<td colspan="2">');
|
html.push('<div>');
|
|
html.push('<select name="Mode" class="Mode form-control" style="width: 150px;">');
|
html.push('<option value="0">请选择导流方式</option>');
|
html.push('<option value="1">关键字</option>');
|
html.push('<option value="2">字数</option>');
|
html.push('<option value="3">号段</option>');
|
html.push('<option value="4">地区</option>')
|
html.push('</select>');
|
var mode_keywords = "";
|
var mode_SmMaxLength = "";
|
var mode_Segments = "";
|
var mode_Province = "";
|
if (mode == 0 || mode == undefined) {
|
mode_keywords = "style='display:none; margin-top: 5px;'";
|
mode_SmMaxLength = "style='display:none; margin-top: 5px;'";
|
mode_Segments = "style='display:none; margin-top: 5px;'";
|
mode_Province = "style='display:none; margin-top: 5px;'"
|
}
|
else if (mode == 1) {
|
mode_keywords = "style='display:block; margin-top: 5px;'";
|
mode_SmMaxLength = "style='display:none; margin-top: 5px;'";
|
mode_Segments = "style='display:none; margin-top: 5px;'";
|
mode_Province = "style='display:none; margin-top: 5px;'"
|
} else if (mode == 2) {
|
mode_keywords = "style='display:none; margin-top: 5px;'";
|
mode_SmMaxLength = "style='display:block; margin-top: 5px;'";
|
mode_Segments = "style='display:none; margin-top: 5px;'";
|
mode_Province = "style='display:none; margin-top: 5px;'"
|
|
} else if (mode == 3) {
|
mode_keywords = "style='display:none; margin-top: 5px;'";
|
mode_SmMaxLength = "style='display:none; margin-top: 5px;'";
|
mode_Segments = "style='display:block; margin-top: 5px;'";
|
mode_Province = "style='display:none; margin-top: 5px;'"
|
} else if (mode == 4) {
|
mode_keywords = "style='display:none; margin-top: 5px;'";
|
mode_SmMaxLength = "style='display:none; margin-top: 5px;'";
|
mode_Segments = "style='display:none; margin-top: 5px;'"
|
mode_Province = "style='display:block; margin-top: 5px;'";
|
}
|
html.push('<div class="Mode-Keywords" ' + mode_keywords + '>');
|
html.push(' <span style="color:red;">每行一条内容,"*",号代替 0-10个字符,支持“你的(验证|校验)码是:*”模式,单行长度不要超过70字</span>');
|
html.push('<textarea id="Keywords" name="Keywords" style="width: 665px;height: 200px; margin-top: 5px;" height" class="form-control input-sm"></textarea>');
|
//html.push(' 当短信匹配关键:<input maxlength="200" style="width:300px" name="Keywords" id="Keywords" placeholder="关键字"></input>');
|
html.push('</div>');
|
|
html.push('<div class="Mode-SmMaxLength" ' + mode_SmMaxLength + '>');
|
html.push('当字数小于等于:<input type="text" name="SmMaxLength" id="SmMaxLength" style="width: 30px"');
|
html.push('maxlength="50" value=""/>');
|
html.push(' <span class="connector">或者</span> 当字数大于等于:<input type="text" name="SmMinLength" id="SmMinLength" style="width: 30px"');
|
html.push(' maxlength="50" value="" /> 时');
|
html.push('</div>');
|
|
html.push('<div class="Mode-Segments" ' + mode_Segments + '>');
|
html.push(' <span style="color:red;">*支持号段5—8位,号段不能超过8位</span>');
|
html.push(' <span style="color:red;">*号段格式为每行一个</span>');
|
html.push('<textarea id="Segments" name="Segments" style="width: 665px;height: 200px; margin-top: 5px;" height" class="form-control input-sm"></textarea>');
|
html.push('</div>');
|
|
html.push('<div class="Mode-Province" ' + mode_Province + '>');
|
//html.push(' <span style="color:red;">*省份</span>');
|
html.push('<input type="checkbox" id="checkAll" class="icheck-me" />全国');
|
html.push('</br>');
|
html.push('<%__w.Write(this.GwtPrivnce());%>');
|
|
//html.push('<input type="checkbox" class="icheck-me" value="2" name="provinceData" />重庆');
|
//html.push('<input type="checkbox" class="icheck-me" value="3" name="provinceData" />北京');
|
//html.push('<input type="checkbox" class="icheck-me" value="4" name="provinceData" />江苏');
|
//html.push('<textarea id="Segments" name="Segments" style="width: 665px;height: 200px; margin-top: 5px;" height" class="form-control input-sm"></textarea>');
|
html.push('</div>');
|
|
// html.push('当短信匹配关键:<input maxlength="200" style="width:300px" name="Keywords" id="Keywords" placeholder="关键字"></input>');
|
// html.push('<span class="connector">或者</span> 当字数小于等于:<input type="text" name="SmMaxLength" id="SmMaxLength" style="width: 30px"');
|
// html.push('maxlength="50" value=""/>');
|
// html.push(' <span class="connector">或者</span> 当字数大于等于:<input type="text" name="SmMinLength" id="SmMinLength" style="width: 30px"');
|
// html.push(' maxlength="50" value="" /> 时');
|
html.push(' <div>');
|
html.push(' </div>');
|
|
html.push('<div>');
|
html.push(' 将短信导流到:');
|
html.push('<div>');
|
html.push('移动<select name="CMOPID" id="CMOPID" style="background-color: #FFF;background-image: none;border: 1px solid #e5e6e7;border-radius: 1px;color: inherit;padding: 6px 12px;">');
|
|
html.push('<%__w.Write(this.GetOpOptions(0)); %>');
|
html.push('</select>');
|
html.push(' <input type="text" name="CMExtNo" id="CMExtNo" placeholder="移动扩展号"/>');
|
html.push(' <input type="text" style="width:500px" name="CMExtParams" id="CMExtParams" placeholder="移动扩展参数"/>');
|
html.push('</div>');
|
html.push('<div>');
|
html.push(' 联通<select name="CUOPID" id="CUOPID" style="background-color: #FFF;background-image: none;border: 1px solid #e5e6e7;border-radius: 1px;color: inherit;padding: 6px 12px;">');
|
html.push('<%__w.Write(this.GetOpOptions(0)); %>');
|
|
html.push(' </select>');
|
html.push(' <input type="text" name="CUExtNo" id="CUExtNo" placeholder="联通扩展号"/>');
|
html.push(' <input type="text" style="width:500px" name="CUExtParams" id="CUExtParams" placeholder="联通扩展参数"/>');
|
html.push('</div>');
|
html.push('<div>');
|
html.push('电信<select name="CTOPID" id="CTOPID" style="background-color: #FFF;background-image: none;border: 1px solid #e5e6e7;border-radius: 1px;color: inherit;padding: 6px 12px;">');
|
html.push('<%__w.Write(this.GetOpOptions(0)); %>');
|
html.push('</select>');
|
html.push(' <input type="text" name="CTExtNo" id="CTExtNo" placeholder="电信扩展号"/>');
|
html.push(' <input type="text" style="width:500px" name="CTExtParams" id="CTExtParams" placeholder="电信扩展参数"/>');
|
html.push('</div>');
|
html.push('</div>');
|
html.push(' <div style="padding: 10px;">扩展号拼接模式:');
|
html.push('<select name="ExtNoMode" id="ExtNoMode" class="ExtNoMode" style="width: 400px;background-color: #FFF;background-image: none;border: 1px solid #e5e6e7;border-radius: 1px;color: inherit;padding: 6px 12px;">');
|
html.push('<option value="0">导流扩展号优先(通道接入码+导流扩展号+账号扩展号)</option>');
|
html.push('<option value="1">账号扩展号优先(通道接入码+账号扩展号+导流扩展号)</option></select>');
|
html.push('</div>');
|
|
|
html.push('</td>');
|
html.push('<td>');
|
html.push(' <a href="javascript:;" class="btn btn-default btn-xs action-remove-item"><i class="fa fa-trash"></i> 删除</a>');
|
html.push('</td>');
|
html.push('</tr>');
|
|
var node = $(html.join("\n")).appendTo($("table"));
|
|
var modetype = mode != null ? mode : 0;
|
|
node.find("select[name='Mode'] option[value='" + modetype + "']").attr("selected", "selected");
|
node.find("textarea[name='Keywords']").val(keywords);
|
node.find("input[name='SmMaxLength']").val(max);
|
node.find("input[name='SmMinLength']").val(min);
|
node.find("textarea[name='Segments']").val(segments);
|
node.find("select[name='CUOPID']").val(cuopid);
|
node.find("select[name='CTOPID']").val(ctopid);
|
node.find("select[name='CMOPID']").val(cmopid);
|
node.find("input[name='CUExtNo']").val(cuExtNo);
|
node.find("input[name='CUExtParams']").val(CUExtParams);
|
node.find("input[name='CMExtNo']").val(cmExtNo);
|
node.find("input[name='CMExtParams']").val(CMExtParams);
|
node.find("input[name='CTExtNo']").val(ctExtNo);
|
node.find("input[name='CTExtParams']").val(CTExtParams);
|
node.find("select[name='ExtNoMode']").val(extNoMode);
|
|
var provinceData = $.evalJSON(Province);
|
node.find("input[name='provinceData']").iCheck("uncheck");
|
if (provinceData != null) {
|
$.each(provinceData, function(i) {
|
var p = provinceData[i];
|
node.find("input[name='provinceData'][value='" + this + "']").iCheck("check");
|
});
|
}
|
}
|
});
|
|
</script>
|
</head>
|
<body class="white-bg">
|
|
<div class="wrapper wrapper-content table-responsive">
|
|
<form name="Form_ID" method="post" action="GwDiverterUpdate.aspx" id="Form_ID">
|
|
<%
|
if (this.Action == "edit")
|
__w.Write("\r\n <input type=\"hidden\" name=\"action\" value=\"editDeal\" id=\"action\" />\r\n ");
|
else
|
__w.Write("\r\n <input type=\"hidden\" name=\"action\" value=\"addDeal\" id=\"action\" />\r\n ");
|
|
%>
|
|
<div class="editCanvas">
|
<table class="table table-striped table-bordered table-hover">
|
<thead>
|
<tr>
|
<th colspan="4">
|
<%
|
if (this.Action == "edit")
|
__w.Write("修改");
|
else
|
__w.Write("添加");
|
__w.Write("\r\n 导流策略(导流规则不能超过4000字符)\r\n ");
|
%>
|
</th>
|
</tr>
|
</thead>
|
|
|
<%
|
|
if (this.Action == "edit")
|
{
|
__w.Write("\r\n <tr>\r\n <th>\r\n 策略名称:\r\n </th>\r\n <td>\r\n <input type=\"hidden\" name=\"DiverterID\" id=\"DiverterID\" maxlength=\"50\" value=\"");
|
__w.Write(this.Diverter.DiverterID);
|
__w.Write("\" />\r\n <input type=\"text\" name=\"DiverterName\" style=\"width: 300px\" id=\"DiverterName\" maxlength=\"100\"\r\n value=\"");
|
__w.Write(this.Diverter.DiverterName);
|
__w.Write("\" />\r\n <span class=\"highlight\">*</span>\r\n </td>\r\n </tr>\r\n ");
|
}
|
else
|
{
|
__w.Write("\r\n <tr>\r\n <th>\r\n 策略名称:\r\n </th>\r\n <td colspan=\"4\">\r\n <input type=\"text\" name=\"DiverterName\" id=\"DiverterName\" maxlength=\"50\" value=\"");
|
__w.Write(this.Diverter.DiverterName);
|
__w.Write("\" />\r\n <span class=\"highlight\">*</span>\r\n </td>\r\n </tr>\r\n ");
|
}
|
|
%>
|
|
</table>
|
<div class="footer-bar">
|
<input class="action-append-item btn btn-warning" value="新增导流条件" type="button" />
|
<input class="butt-0 action-save btn btn-primary" value="保存" type="button" />
|
<input class="btn btn-default" value="返回" onclick="history.back();" type="button" /></div>
|
</div>
|
</form>
|
|
<div id="Div1" class="mask">
|
<span></span>
|
<img src="img/spinning-circles.svg" alt="载入中..." /></div>
|
</div>
|
</body>
|
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|