<!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. vue vuex 大型项目demo示例

    1.vuex 动态模块配置 import Vue from 'vue' import Vuex from 'vuex' import store from '@/store'; // 使用Vuex插件 ...

  2. 关于vector push_back()与其他方式读取数据的效率对比(转)

    引言: 在读取大量数据(数组)时,使用vector会尽量保证不会炸空间(MLE),但是相比于scanf的读取方式会慢上不少.但到底效率相差有多大,我们将通过对比测试得到结果. 测试数据:利用srand ...

  3. XAudio2学习之混音

    XAudio2不仅能够进行採样率转换.还能够进行混音.所谓混音就是将多路音频混合成一路进行输出.混音主要是IXAudio2SubmixVoice进行此项功能. 数据由IXAudio2SourceVoi ...

  4. 使用js+Ajax请求API接口数据-带请求头方式

    C# http请求带请求头部分 先上代码: <script type="text/javascript"> function zLoginCheck() { var A ...

  5. struts 防止重复提交表单

    <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE struts PUBLIC     &qu ...

  6. Linux 修改终端显示bash-1.4$

    先取得root权限,然后在终端如下操作[root@host]$su -然后输入密码接着[root@host]#PS1='[\u@\H \W]\$' 你取得root权限后在,在终端命令下输入这个,一定要 ...

  7. 5V转3.3v电路

    方案一: MIC5205-3.3 输出电流150ma 输出电压3.3V 其中:CT24为钽电容: 方案二: AMS1117-3.3 输出电流800ma 输出电压:3.3V 输入电压:4.75~12v

  8. ConcurrentBag同线程元素的添加和删除

    https://www.mgenware.com/blog/?p=232 ConcurrentBag<T>对于同一个线程值的添加和删除是非常快的,因为ConcurrentBag内部将数据按 ...

  9. Atitit .h5文件上传 v3

    Atitit .h5文件上传 v3 1. 上传原理1 2. V3版新特性1 3. Html1 4. Js2 5. uploadV2.js2 6. upServlet & FileUploadS ...

  10. [svc][jk]gpu温度监测

    在使用TensorFlow跑深度学习的时候,经常出现显存不足的情况,所以我们希望能够随时查看GPU时使用率.如果你是Nvidia的GPU,那么在命令行下,只需要一行命令就可以实现. 1. 显示当前GP ...