| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="UTF-8" />
- <script src="../js/huayi.load.js"></script>
- <script src="../js/laydate/laydate.js"></script>
- <link href="../js/laydate/theme/default/laydate.css" />
- <title>添加</title>
- <style>
- </style>
- </head>
- <body>
- <input type="hidden" id="PID" value="" />
- <div class="wrapper wrapper-content animated fadeInRight">
- <div style="padding: 10px" class="tj_content clearFix">
- <div class="Common">
- <table>
- <tr>
- <th style="width:120px;"><span style="color:red;">*</span>手机号:</th>
- <td>
- <input type="text" id="mobile" class="form-control" maxlength="12" />
- </td>
- </tr>
- <tr>
- <th style="width:120px;"><span style="color:red;">*</span>类型:</th>
- <td>
- <label>
- <input type="radio" name="type" value="1" checked />
- 黑名单
- </label>
- <label>
- <input type="radio" name="type" value="2" />
- 白名单
- </label>
- </td>
- </tr>
- <tr class="start">
- <th style="width:120px;"><span style="color:red;">*</span>开始时间:</th>
- <td>
- <input type="text" id="startTime" class="form-control" />
- </td>
- </tr>
- <tr class="end">
- <th style="width:120px;"><span style="color:red;">*</span>结束时间:</th>
- <td>
- <input type="text" id="endTime" class="form-control" />
- </td>
- </tr>
- <tr >
- <th style="width:120px;">备注:</th>
- <td>
- <input type="text" id="remark" class="form-control" />
- </td>
- </tr>
- <tr>
- <td colspan="4" style="text-align: center">
- <button class="btns save">保存</button>
- </td>
- </tr>
- </table>
- </div>
- </div>
- </div>
- <script>
- var id = helper.request.queryString("id");
- $(document).ready(function () {
- laydate.render({
- elem: '#startTime',
- event: 'focus',
- type:'datetime'
- });
- laydate.render({
- elem: '#endTime',
- event: 'focus',
- type: 'datetime'
- });
- $(".save").click(function () {
- Add();
- });
- $("input[name='type']").change(function () {
- var val = $("input[name='type']:checked").val();
- if (val == '1') {
- $(".start").show();
- $(".end").show();
- }
- else {
- $(".start").hide();
- $(".end").hide();
- }
- })
- if (id) {
- $.getJSON(huayi.config.callcenter_url + "SystemApi/GetBlackWhite", {
- mobile: id
- }, function (data) {
- if (data.state.toLowerCase() == "success") {
- var model = data.data;
- $("#mobile").attr("readonly", true);
- $("#mobile").val(model.mobile);
- $("input[name=type][value='" + model.type + "']").attr('checked', true);
- $("input[name='type']").trigger("change");
- $("#startTime").val(model.startTime);
- $("#endTime").val(model.endTime);
- $("#remark").val(model.remark);
- }
- });
- }
- });
- //修改工单
- function Add() {
- var mobile = $("#mobile").val();
- if (!mobile) {
- layer.confirm("请输入手机号!", {
- btn: ['确定'] //按钮
- });
- return;
- }
- else {
- if (mobile.length > 12) {
- layer.confirm("手机号不能超过12位!", {
- btn: ['确定'] //按钮
- });
- return;
- }
- }
- var type = $("input[name='type']:checked").val();
- if (type == '1') {
- if (!$("#startTime").val()) {
- layer.confirm("请选择开始时间!", {
- btn: ['确定'] //按钮
- });
- return;
- }
- if (!$("#endTime").val()) {
- layer.confirm("请选择结束时间!", {
- btn: ['确定'] //按钮
- });
- return;
- }
- }
- var api;
- if (id) {
- api = "SystemApi/EditBlackWhite";
- } else {
- api = "SystemApi/AddBlackWhite";
- }
- $.post(huayi.config.callcenter_url + api, {
- mobile: $("#mobile").val(),
- type: $("input[name='type']:checked").val(),
- startTime: type == '2' ? '' : $("#startTime").val(),
- endTime: type == '2' ? '' : $("#endTime").val(),
- remark: $("#remark").val()
- }, function (data) {
- if (data.state.toLowerCase() == "success") {
- var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
- parent.layer.close(index); //再执行关闭
- parent.$("#tableList").bootstrapTable("refresh");
- parent.layer.msg("保存成功");
- }
- });
- }
- </script>
- </body>
- </html>
|