| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="UTF-8">
- <script src="../Script/Common/huayi.load.js"></script>
- <script src="../Script/Common/huayi.config.js"></script>
- <!--<link href="../css/layer/need/layer.css" />-->
- <link rel="stylesheet" href="../css/init.css" />
- <title></title>
- <style>
- .BiaoTi{
- width: 100%;
- text-align:center;
- border-color:#ccc ;
- border:1px solid #ccc;
- }
- textarea{
- border-color:#ccc ;
- border:1px solid #ccc;
- height: 100px;
- }
- </style>
- </head>
- <body>
- <div class="Common">
- <table >
- <tr>
- <th>标题:</th>
- <td>
- <input class="BiaoTi" id="title" type="text" style="" />
- </td>
-
- </tr>
- <tr>
- <th >有效期:</th>
- <td >
- <div class="time-box form-group" style="width: 230px;">
- <i class="tub fa fa-calendar"></i>
- <input class="form-control" type="text" id="startTime" placeholder="有效期">
- </div>
- </td>
- </tr>
- <tr>
- <th>角色:</th>
- <td>
- <select name="" id="role" class="select_"></select>
- <select name="" id="zx" class="select_"></select>
- </td>
- </tr>
- <tr>
- <th >内容:</th>
- <td colspan="2">
- <textarea data-adaptheight id="content" name="" rows="" cols=""></textarea>
- </td>
- </tr>
- </table>
- <div class="btn_box">
- <button class="btns">保存</button>
- </div>
- </div>
- <script src="../js/adjustHeight.js"></script>
- <script src="../js/laydate/laydate.js"></script>
- <script >
- laydate.render({
- elem: '#startTime',
- range: '~',
- theme: '#00a1cb',
- });
-
- $(document).ready(function(){
- $(".btns").click(function(){
- if(!$("#title").val()){
- layer.msg("输入标题");
- return
- }if(!$("#startTime").val()){
- layer.msg("输入选择日期");
- return
- }
- var user=$("#zx").val();
- var role=$('#role').val();
- Add(user,role)
- })
-
- //获取下拉框
- $.getJSON(huayi.config.callcenter_url + "Notice/GetRoleList", {
- "token": $.cookie("token")
- }, function(result) {
- if(result.state.toLowerCase() == "success") {
- goodslist = result.data;
- bindseat($("#role"));
- }
- });
- //下拉框
- function bindseat(obj) {
- obj.empty();
- obj.append('<option value="0" selected="selected">所有角色</option>');
- $(goodslist).each(function(i, n) {
- obj.append('<option value="' + n.F_RoleId + '">' + n.F_RoleName + '</option>');
- })
- }
- $.getJSON(huayi.config.callcenter_url + "Notice/GetUserListByRoleId", {
- "token":$.cookie("token"),"roleid":0
- }, function(result) {
- if(result.state.toLowerCase() == "success") {
- goodslist = result.data;
- bindZX($("#zx"));
- }
- });
- function bindZX(obj) {
- obj.empty();
- obj.append('<option value="0" selected="selected">所有人</option>');
- $(goodslist).each(function(i, n) {
- obj.append('<option value="' + n.F_UserId + '">' + n.F_UserCode + '</option>');
- })
- }
- $("#role").change(function(){
- var pid=$(this).val();
- $.getJSON(huayi.config.callcenter_url + "Notice/GetUserListByRoleId", {
- "token":$.cookie("token"),"roleid":pid
- }, function(result) {
- if(result.state.toLowerCase() == "success") {
- goodslist = result.data;
- bindZX($("#zx"));
- }
- });
- })
- })
-
- function Add(user,role){
- $.post(huayi.config.callcenter_url + "Notice/AddNotice", {
- title:$("#title").val(),
- content:$("#content").val(),
- stime:$('#startTime').val() && $('#startTime').val().split('~')[0],
- etime:$('#startTime').val() && $('#startTime').val().split('~')[1],
- token: $.cookie("token"),
- userid:user,
- roleid:role
- }, function(result) {
- result = JSON.parse(result);
- if(result.state.toLowerCase() == "success") {
-
- var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
- parent.layer.close(index); //再执行关闭
- parent.initTable();
- parent.layer.msg("添加成功");
- }
- })
- }
- // function GetData() {
- // var date = new Date;
- // var year = date.getFullYear();
- // var month = date.getMonth() + 1;
- // var strDate = date.getDate();
- // month = (month <= 9 ? "0" + month : month);
- // strDate = (strDate <= 9 ? "0" + strDate : strDate)
- // var mydate = (year.toString() + '-' + month.toString() + '-' + strDate.toString());
- // $('#startTime').val() && $('#startTime').val().split('~')[0]
- // }
- // GetData();
- </script>
- </body>
- </html>
|