<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <meta name="keywords" content="jquery,ui,easy,easyui,web" />
    <meta name="description" content="easyui help you build your web page easily!" />
    <title>短信管理</title>
    <link href="../Scripts/easyui/themes/default/easyui.css" rel="stylesheet" />
    <link href="../Scripts/easyui/themes/icon.css" rel="stylesheet" />
    <link href="../Scripts/easyui/demo/demo.css" rel="stylesheet" />
    <style type="text/css">
        #fm {
            margin: 0;
            padding: 10px 30px;
        }

.ftitle {
            font-size: 14px;
            font-weight: bold;
            color: #666;
            padding: 5px 0;
            margin-bottom: 10px;
            border-bottom: 1px solid #ccc;
        }

.fitem {
            margin-bottom: 5px;
        }

.fitem label {
                display: inline-block;
                width: 80px;
            }
    </style>
    <script type="text/javascript" src="../Scripts/easyui/jquery.min.js"></script>
    <script type="text/javascript" src="../Scripts/easyui/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="../Scripts/easyui/locale/easyui-lang-zh_CN.js"></script>
    <script type="text/javascript">
        var url;
        function newUser() {
            $('#dlg').dialog('open').dialog('setTitle', '添加短信');
            $('#fm').form('clear');
            url = "/OnlineMonitoring/ashx/MSGMgr.ashx?type=insert";
        }
        function editUser() {
            var row = $('#dg').datagrid('getSelected');
            if (row) {
                $('#dlg').dialog('open').dialog('setTitle', '编辑短信内容');
                $('#fm').form('load', row);
                url = "/OnlineMonitoring/ashx/MSGMgr.ashx?type=update";
            } else {
                parent.$.messager.alert('提示', '请选择一行', "info");
            }
        }
        function saveUser() {
            $('#fm').form('submit', {
                url: url,
                onSubmit: function () {
                    return $(this).form('validate');
                },
                success: function (result) {
                    var result = eval('(' + result + ')');
                    if (result.result) {
                        $('#dlg').dialog('close');        // close the dialog
                        $('#dg').datagrid('reload');    // reload the user data
                    } else {
                        $.messager.show({
                            title: '服务端错误',
                            msg: "添加失败"
                        });
                    }
                }
            });
        }
        function removeUser() {
            var row = $('#dg').datagrid('getSelected');
            if (row) {
                parent.$.messager.confirm('操作提示', '你确定删除这条短信吗?', function (r) {
                    if (r) {
                        $.post("/OnlineMonitoring/ashx/MSGMgr.ashx?type=delete", { short_message_id: row.short_message_id }, function (result) {
                            if (result.result) {
                                $('#dg').datagrid('reload');    // reload the user data
                            } else {
                                $.messager.show({    // show error message
                                    title: '服务端错误',
                                    msg: "删除短信失败"
                                });
                            }
                        }, 'json');
                    }
                });
            }
        }
    </script>
</head>
<body class="easyui-layout">
    <div data-options="region:'center',fit:true,border:false" style="height: 100%">
        <table id="dg" title="短信管理" class="easyui-datagrid"
            url="/OnlineMonitoring/ashx/MSGMgr.ashx?type=select"
            toolbar="#toolbar" pagination="false"
            rownumbers="true" fitcolumns="true" singleselect="true" fit="true" method="get">
            <thead>
                <tr>
                    <th field="short_message_content" width="50" align="center">短信内容</th>
                    <th field="short_message_time" width="50" align="center">短信创建时间</th>
                    <th field="short_message_state" width="50" align="center" formatter="messageFormater">短信状态</th>
                </tr>
            </thead>
        </table>
    </div>
    <div id="toolbar">
        <a href="#" class="easyui-linkbutton" iconcls="icon-add" plain="true" onclick="newUser()">添加</a>
        <a href="#" class="easyui-linkbutton" iconcls="icon-edit" plain="true" onclick="editUser()">编辑</a>
        <a href="#" class="easyui-linkbutton" iconcls="icon-remove" plain="true" onclick="removeUser()">删除</a>
    </div>
    <div id="dlg" class="easyui-dialog" style="width: 400px; height: 280px; padding: 10px 20px"
        closed="true" buttons="#dlg-buttons">
        <div class="ftitle">短信信息</div>
        <form id="fm" method="post" novalidate>
            <input type="hidden" name="short_message_id" />
            <div class="fitem">
                <label>短信内容:</label>
                <input name="short_message_content" class="easyui-validatebox" required="true">
            </div>
        </form>
    </div>
    <div id="dlg-buttons">
        <a href="#" class="easyui-linkbutton" iconcls="icon-ok" onclick="saveUser()">确认</a>
        <a href="#" class="easyui-linkbutton" iconcls="icon-cancel" onclick="javascript:$('#dlg').dialog('close')">取消</a>
    </div>
</body>
</html>
<style type="text/css">
    .panel-title {
        text-align: center;
        font-size: 20px;
    }

#sex {
        width: 50px;
    }
</style>
<script>
    function messageFormater(val) {
        if (val == 1) {
            return "已发送";
        } else {
            return "未发送";
        }
    }
</script>

EasyUI简单CRUD的更多相关文章

  1. 使用Struts2和jQuery EasyUI实现简单CRUD系统(转载汇总)

    使用Struts2和jQuery EasyUI实现简单CRUD系统(一)——从零开始,ajax与Servlet的交互 使用Struts2和jQuery EasyUI实现简单CRUD系统(二)——aja ...

  2. MongoDB简单CRUD场景

    MongoDB简单CRUD命令操作 (1)新建数据库:use 数据库名 (2)显示所有数据库:show dbs; (3)新建集合(两种方式)  隐式创建:在创建集合的同时往集合里面添加数据---db. ...

  3. 使用Struts2和jQuery EasyUI实现简单CRUD系统(七)——数据分页处理

    上篇完毕多选删除的功能之后,接下来就是做分页功能了.曾经的分页是一个麻烦的问题.并且数据量巨大的时候,直接把这些元素取出来显然速度较慢,所以取一定区间的数据还是高效的. watermark/2/tex ...

  4. 使用Struts2和jQuery EasyUI实现简单CRUD系统(五)——jsp,json,EasyUI的结合

    这部分比較复杂,之前看过自己的同学开发一个选课系统的时候用到了JSON,可是一直不知道有什么用.写东西也没用到.所以没去学他.然后如今以这样的怀着好奇心,这是做什么用的,这是怎么用的.这是怎么结合的心 ...

  5. SSM——(二):easyUI的CRUD

    1.在WebContent下新建admin目录,添加index.html(用来显示user表的CRUD): 总结: 1.datagrid接收的必须是json数据: 2.使用分页插件会自动向后台传递St ...

  6. SequoiaDB 系列之二 :SequoiaDB的简单CRUD操作

    上一篇通过一系列的操作,终于把SequoiaDB的集群部署到单台机器上了. 建议去安装体验一下吧. 在整个环境的部署的体验来看,并没有MongoDB的部署简单,但是比MongoDB的部署要清晰.Mon ...

  7. easyui简单使用

    easyui近期一直都比较流行,虽然它在效果上被extjs爆了,它的使用难度低,在IE6下表现不错,的确受到了广泛企业程序员的好评. 但是他的API说明还是比较简陋的,刚上手可能还需要摸索一下,为什么 ...

  8. Servlet实现简单CRUD

    1.首先在数据库中建表 create database student create table stu( sno char(10), sna char(10), ) insert stu value ...

  9. Easyui简单布局

    1.创建布局 创建布局只需要添加 'easyui-layout' class 到 <div> 标记或者 在整个页面创建布局,即<body class="easyui-lay ...

随机推荐

  1. CosmosEngine - Unity3D /2D 轻量级游戏开发框架

    CosmosEngine https://github.com/mr-kelly/CosmosEngine 快速入门 简介 特性 约定 整体架构图 使用经验 工作流 未来功能 快速入门 1.将NGUI ...

  2. js操作当前窗口

      CreateTime--2017年7月21日09:58:34Author:Marydon js操作当前窗口 1.打开一个新的窗口(新的标签页) 实现方式:window.open(url) 实例一: ...

  3. hibernate 联合主键

      xml方式处理联合主键:   以有两个主键:id和name的student表为例. 先创建个主键类:   package com.bjsxt.hibernate; //黑色为必写项 public ...

  4. struts struts拦截器(过滤器)

    在struts中尽量避免自定义拦截器,因为大部分需要自己定义拦截器的时候,设计思路就不对了.大部分拦截器框架都有给你定义好了.而且如果在struts中定义拦截器相当于和这个框架绑定了,假如以后要扩展或 ...

  5. 自己动手,制作真正的.net Framework 3.5 SP1离线安装包(转)

    .NET Framework 3.5 SP1发布了,兴冲冲…下载,当然是完全离线安装包.net Framework 3.5 Service pack 1(Full Package) 231MB,网络慢 ...

  6. 巧用FTP命令进行文件传输

    巧用FTP进行文件传输   Internet作为现代信息高速公路已深入我们的生活,其中它所提供的电子邮件Web网站信息服务已被越来越多的人所熟知和使用.FTP作为Internet的功能之一,虽然没有像 ...

  7. R快速创建个文件

    cat("TITLE extra line", "2 3 5 7", "11 13 17", file="ex.data" ...

  8. 解决 adb devices :???????????? no permissions 方法

  9. 使用QQ互联登录应用

    QQ登录集成插件简介 互联网应用越来越多,通常每一个应用都会要求用户注册登录,粗略估记一下,QQ,微博,微信,银行帐号.邮箱,招聘网站账户,淘宝帐号,支付宝帐号,公司OA帐号....粗略算一下,十几个 ...

  10. jquery 设置checkbox选中 和获取选中值

    经常用到经常网上搜,这次写下来. 1,设置选中: $('#nrowid').prop('checked', false); 2,取选中项的值: $('#nrowid').prop("chec ...