个人信息管理系统课程设计报告书

时间:2024.4.20

Java Web开发(JSP
课程设计报告

题    目:个人信息管理系统

设  计  者:xxxx

专业班级:xxxxxxxx

学    号:xxxxxxxx

指导教师: xxxxx

20##年  1月  5日

xxxxx大学计算机学院

个人信息管理系统报告书

一、系统需求背景

该系统实现用户的个人信息管理,根据用户的需求实现相应的信息查询以及更新为用户挺方便的使用功能。

本系统适用于所有人的个人信息管理,主要任务是对用户的的事宜、心情、工作、学习、个人帐目等等的记载,并对这些进行信息进行日常管理。社会发展越来越快,在面对多发方面压力的情况下,生活难免会陷入混乱,我们在每天的生活和学习中会接触到大量丰富的信息,对于个人信息也需要有一个系统的管理。

二、系统所涉及的一些知识

该个人信息管理系统管理系统采用JSP+JDBC+MySQL、extjs、struts、spring、ibatis来实现,视图层采用JSP来实现,并通过JDBC来连接MySQL数据库。

 JSP(Java Server Pages)是由Sun Microsystems公司倡导、许多公司参与一起建立的一种动态网页技术标准。 JSP技术是用JAVA语言作为脚本语言的,JSP网页为整个服务器端的JAVA库单元提供了一个接口来服务于HTTP的应用程序。

JDBC是一种可用于执行SQL语句的JavaAPI(ApplicationProgrammingInterface应用程序设计接口)。它由一些Java语言编写的类和界面组成。JDBC为数据库应用开发人员、数据库前台工具开发人员提供了一种标准的应用程序设计接口,使开发人员可以用纯Java语言编写完整的数据库应用程序。

MySQL是一个真正的多用户、多线程SQL数据库服务器。SQL(结构化查询语言)是世界上最流行的和标准化的数据库语言。MySQL是以一个客户机/服务器结构的实现,它由一个服务器守护程序mysqld和很多不同的客户程序和库组成。

    MySQL 主要目标是快速、健壮和易用。最初是因为我们需要这样一个SQL服务器,它能处理与任何可不昂贵硬件平台上提供数据库的厂家在一个数量级上的大型数据库,但速度更快,MySQL就开发出来。

三、   功能需求分析

对模块及其基本功能进行分析

本系统为方便用户使用起见设计了八块:主页、任务管理、笔记管理、相册管理、订阅管理、文档管理、帐目管理、系统管理。系统的基本功能是:用户登陆后,可以通过一系列的操作管理个人信息,使得日常个人信息管理得到合理的保管,及时的进行完善,使得生活更有条不紊,并且各个功能模块都可以选择性的开启或者停用。

四、   系统设计方案

整体设计方案。

根据系统功能需求分析,可将系统完善大致分为如下几步:

程序结构

 

主模块

 


五、   系统涉及的数据库表

所使用的数据库及其字段。

数据库安装的是MySQL 5.1,根据系统功能需求分析得到如下数据库表:

 

六、   具体功能分析

1、  登录界面

<%@ page language="java" pageEncoding="UTF-8" isELIgnored="false"%>

<%@page import="global.Constants"%>

<%@page import="util.ServletHelp"%>

<%@page import="global.security.SessionUtils"%><html>

<head>

    <%

        String baseUrl = request.getContextPath();

    %>

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

    <script type="text/javascript">

        $(document).ready(function(){

            // 全局参数

            var baseParams = {start:0, limit:<%=Constants.PAGE_SIZE %>, delflag:"<%=Constants.DEL_FLAG_1 %>"};

            // 用户数据源

            var userListStore = new Ext.data.JsonStore({

                url: '<%=baseUrl %>/userAction.do?method=queryForPaging',

                root: 'datas',

                totalProperty: 'results',

                fields: ['userId', 'userName', 'role', 'sex', 'birthdayStr', 'email', 'phone', 'status'],

                baseParams: baseParams,

                autoLoad: true

            });

            // 工具栏

            var userListToolbar = new Ext.Toolbar({

            renderTo: 'userListToolBarDiv',

            items: [

                    new Ext.Button({

                        id: 'userList-add-button',

                        text: '添加',

                        iconCls: 'user_add'

                    }),

                    '-',

                    new Ext.Button({

                        id: 'userList-start-button',

                        text: '启用',

                        iconCls: 'status_online'

                    }),

                    new Ext.Button({

                        id: 'userList-stop-button',

                        text: '停用',

                        iconCls: 'status_offline'

                    }),

                    new Ext.Button({

                        id: 'userList-delete-button',

                        text: '删除',

                        iconCls: 'status_busy'

                    }),

                    new Ext.ux.form.SearchField({

                        store: userListStore,

                        width: 320,

                        paramName: 'userName',

                        emptyText: '请输入用户名...',

                        style: 'margin-left: 10px;'

                    })

                ]

            });

            // 用户数据表格

            var sm = new Ext.grid.CheckboxSelectionModel();

            var userListGrid = new Ext.grid.GridPanel({

                id: 'userListGrid',

                renderTo: 'userListGridDiv',

                border: false,

                stateful: true,

                autoScroll: 'auto',

                store: userListStore,

                loadMask: true,

                cm: new Ext.grid.ColumnModel({

                    defaults: {

                        width: 100,

                        sortable: true

                    },

                    columns: [

                        sm,

                        new Ext.grid.RowNumberer({header:'№'}),

                        {id:'role',header: '角色', width: 100, sortable: true, dataIndex: 'role'},

                        {id:'userId',header: '账号', width: 100, sortable: true, dataIndex: 'userId'},

                        {id:'userName',header: '用户名', width: 100, sortable: true, dataIndex: 'userName'},

                        {id:'sex',header: '性别', width: 50, sortable: true, dataIndex: 'sex'},

                        {id:'birthdayStr',header: '生日', width: 100, sortable: true, dataIndex: 'birthdayStr'},

                        {id:'email',header: '邮箱', width: 180, sortable: true, dataIndex: 'email'},

                        {id:'phone',header: '电话', width: 100, sortable: true, dataIndex: 'phone'},

                        {id:'status',header: '状态', width: 50, sortable: true, dataIndex: 'status'}

                    ]

                }),

                sm: sm,

                columnLines: true,

                bbar: new Ext.PagingToolbar({

                    pageSize: <%=Constants.PAGE_SIZE %>,

                    store: userListStore,

                    displayInfo: true,

                    displayMsg: Anynote.PAGINGTOOLBAR_DISPLAYMSG,

                    emptyMsg: Anynote.PAGINGTOOLBAR_EMPTYMSG,

                    doLoad: function(start){

                        baseParams.start = start;

                        this.store.load({params: baseParams});

                    }

                })

            });

            // 设置Grid高度和宽度

            Anynote.resizeGridTo("userListGrid", 0, 56);

            // 添加按钮

            $("#userList-add-button").click(function(){

                // 角色数据源

                var roleStore = new Ext.data.ArrayStore({ 

                    fields : ['role', 'roleName'], 

                    data : <%=ServletHelp.getArrayFromMap(Constants.ROLE_MAP, null)%>,

                    sortInfo: {field: "role", direction: "ASC"}

                });

                if('<%=Constants.ROLE_CODE_1%>'=='<%=SessionUtils.getUserRole()%>'){

                roleStore.removeAt(0);

                }else{

                    roleStore.removeAt(0);

                    roleStore.removeAt(0);

                }

                // 性别数据源

                var sexStore = new Ext.data.ArrayStore({ 

                    fields : ['sex', 'sexName'], 

                    data : <%=ServletHelp.getArrayFromMap(Constants.SEX_MAP, null)%>,

                    sortInfo: {field: "sex", direction: "ASC"}

                });

                // 风格数据源

                var themeStore = new Ext.data.SimpleStore({ 

                    fields : ['theme', 'themeName'], 

                    data : Anynote.THEME_DATA 

                });

               

                // 编辑用户Form

                var addUserFormPanel = new Ext.FormPanel({

                    id: 'addUserFormPanel',

                    labelWidth: 60,

                    buttonAlign: 'center',

                    border: false,

                    bodyStyle: 'padding:10px;text-align:left;background-color:transparent;',

                    url: '',

                    items:[{// 角色

                            xtype:'combo',

                            hiddenName: 'role',

                            fieldLabel: '角色',

                            store: roleStore,

                            mode : 'local',

                            triggerAction: "all",

                            valueField: 'role',

                            displayField: 'roleName',

                            allowBlank:false,

                            editable: false,

                            width: 230,

                            anchor:'98%'

                        },{// 账号

                            xtype:'textfield',

                            name: 'userId',

                            fieldLabel: '账号',

                            anchor:'98%',

                            allowBlank:false,

                            maxLength: 20

                       },new Ext.form.TextField ({// 密码

                       inputType: 'password',

                           name:'password',

                           fieldLabel:'密码',

                           anchor:'98%',

                           allowBlank:false,

                           maxLength: 20

                       }),new Ext.form.TextField ({// 确认密码

                         inputType: 'password',

                           name:'repassword',

                           fieldLabel:'确认密码',

                           anchor:'98%',

                           allowBlank:false,

                           maxLength: 20

                        }),{// 姓名

                           xtype:'textfield',

                           id:'userName',

                           name:'userName',

                           fieldLabel:'姓名',

                           anchor:'98%',

                           allowBlank:false,

                           maxLength: 20

                       },{// 性别

                            xtype:'combo',

                            hiddenName: 'sex',

                            fieldLabel: '性别',

                            store: sexStore,

                            mode : 'local',

                            triggerAction: "all",

                            valueField: 'sex',

                            displayField: 'sexName',

                            allowBlank:false,

                            editable: false,

                            width: 230,

                            anchor:'98%'

                        },{// 生日

                            xtype:'datefield',

                            name: 'birthdayStr',

                            fieldLabel: '生日',

                            format: 'Y-m-d',

                            width: 230,

                            anchor:'98%'

                        },{// 邮箱

                           xtype:'textfield',

                           name:'email',

                           fieldLabel:'邮箱',

                           anchor:'98%',

                           vtype:'email',

                           allowBlank:false,

                           maxLength: 50

                       },{// 电话

                           xtype:'textfield',

                           name:'phone',

                           fieldLabel:'电话',

                           anchor:'98%',

                           maxLength: 20

                       },{// 风格

                            xtype:'combo',

                           hiddenName: 'theme',

                           fieldLabel: '风格',

                           store: themeStore,

                           mode : 'local',

                           triggerAction: "all",

                           valueField: 'theme',

                           displayField: 'themeName',

                           value: 'ext-all.css',

                           editable: false,

                           allowBlank:false,

                           width: 230,

                           anchor:'98%'

                       },{

                           xtype: 'radiogroup',

                           fieldLabel: '主页',

                           itemCls: 'x-check-group-alt',

                           columns: 3,

                           items: [

                                  {boxLabel: '任务', name: 'homePage', inputValue: "<%=Constants.HOME_PAGE_1_URL%>", checked: true},

                                {boxLabel: '笔记', name: 'homePage', inputValue: "<%=Constants.HOME_PAGE_2_URL%>"},

                                {boxLabel: '相册', name: 'homePage', inputValue: "<%=Constants.HOME_PAGE_3_URL%>"},

                                {boxLabel: '账目', name: 'homePage', inputValue: "<%=Constants.HOME_PAGE_4_URL%>"},

                                {boxLabel: '订阅', name: 'homePage', inputValue: "<%=Constants.HOME_PAGE_5_URL%>"},

                                {boxLabel: '文档', name: 'homePage', inputValue: "<%=Constants.HOME_PAGE_7_URL%>"}

                           ]

                       },{

                           xtype: 'checkboxgroup',

                           fieldLabel: '模块',

                           itemCls: 'x-check-group-alt',

                           columns: 3,

                           items: [

                               {boxLabel: '任务', name: 'showTodo', checked: true},

                               {boxLabel: '笔记', name: 'showNote', checked: true},

                               {boxLabel: '相册', name: 'showPicture', checked: true},

                               {boxLabel: '账目', name: 'showAccount', checked: true},

                               {boxLabel: '订阅', name: 'showFeed', checked: true},

                               {boxLabel: '文档', name: 'showDocument', checked: true}

                           ]

                       },{// 验证码

                           xtype:'textfield',

                           id:'verifyCode',

                           name:'verifyCode',

                           fieldLabel:'验证码',

                           anchor:'98%',

                           allowBlank:false,

                           maxLength: 20

                       },{

                           width: 110,

                           border: false,

                           style: 'margin-left:65px;line-height:20px;',

                           bodyStyle: 'background-color:transparent;',

                           html:'<img id="VerifyCodeImg" src="" style="float:left;"/><span style="float:right;"><a href="javascript:changeVerifyCode();">换一张</a></span>'

                       }],

                    buttons: [{

                        text:'提交',

                        handler: function(){

                        var form = addUserFormPanel.getForm();

                            if(form.isValid()){

                            // 发送请求

                                Anynote.ajaxRequest({

                                    baseUrl: '<%=baseUrl %>',

                                    baseParams: form.getValues(),

                                    action: '/loginAction.do?method=register',

                                    callback: function(jsonResult){

                                        userListGrid.getStore().reload();

                                        addUserWindow.close();

                                    },

                                    showWaiting: true,

                                    failureMsg: '保存失败.'

                                });

                            }

                      }

                    },{

                        text: '重置',

                        handler: function(){

                          addUserFormPanel.getForm().reset();

                        }

                    }]

                });

                // 用户注册窗口

                var addUserWindow = new Ext.Window({

                    title: '添加用户',

                    width: 330,

                    height: 490,

                    modal: true,

                    maximizable: false,

                    resizable: false,

                    layout:'fit',

                    plain: true,

                    items: [addUserFormPanel]

                }).show();

                // 获得验证码

                changeVerifyCode();

            });

            // 启用按钮

            $("#userList-start-button").click(function(){

                // 启用

                submit("start");

            });

            // 停用按钮

            $("#userList-stop-button").click(function(){

                // 停用

                submit("stop");

            });

            // 删除按钮

            $("#userList-delete-button").click(function(){

                // 提交

                submit("delete");

            });

            // 提交

            function submit(type){

                var msg = "";

                var status = "";

                if(type=="delete"){

                    msg = "确定要删除账户及其文件吗?";

                }elseif(type=="stop"){

                    msg = "确定要停用吗?";

                    status = "<%=Constants.USER_STATUS_2%>";

                    type = "updateStatus";

                }elseif(type=="start"){

                    msg = "确定要启用吗?";

                    status = "<%=Constants.USER_STATUS_1%>";

                    type = "updateStatus";

                }

                var records = userListGrid.getSelectionModel().getSelections();

                if(records.length < 1){

                    Ext.Msg.alert("提示", "请至少选择一条数据.");

                }else{

                    Ext.Msg.confirm("警告", msg, function(btn){

                        if(btn=="yes"){

                            var userIds = "";

                            for(var i=0;i<records.length;i++){

                                userIds = userIds + records[i].get("userId") + ",";

                            }

                            // 发送请求

                            Anynote.ajaxRequest({

                                baseUrl: '<%=baseUrl %>',

                                baseParams: {userIds:userIds, status:status},

                                action: '/userAction.do?method='+type,

                                callback: function(jsonResult){

                                    userListGrid.getStore().reload();

                                },

                                showWaiting: true,

                                failureMsg: '保存失败.'

                            });

                        }

                    });

                }

            }

        });

        // 更换验证码

        function changeVerifyCode(){

            $("#VerifyCodeImg").attr("src", "<%=baseUrl %>/loginAction.do?method=getVerifyCode&time="+new Date());

        }

    </script>

</head>

<body>

<div id="userListDiv">

    <div id="userListToolBarDiv"></div>

    <div id="userListGridDiv" style="width:100%;height:100%;">

</div>

帐目查询界面

<%@ page language="java" pageEncoding="UTF-8" isELIgnored="false"%>

<%@page import="global.Constants"%>

<%@page import="util.DateUtils"%>

<%@page import="util.ServletHelp"%>

<%@page import="util.StringUtils"%>

<html>

<head>

    <%

        String baseUrl = request.getContextPath();

        String accountBookId = request.getParameter("accountBookId");

        String accountBookName = request.getParameter("accountBookName");

        if(StringUtils.isEmpty(accountBookName) || "null".equals(accountBookName)){

            accountBookName = "所有账目";

        }else{

            accountBookName = java.net.URLDecoder.decode(accountBookName, "UTF-8");

        }

    %>

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

    <script type="text/javascript">

        Ext.chart.Chart.CHART_URL = '<%=baseUrl %>/websrc/js/ext-3.3.0/resources/charts.swf';

        $(document).ready(function(){

            // 全局参数

            var baseParams = {start:0, limit:"<%=Constants.PAGE_SIZE %>", accountBookId:"<%=accountBookId %>", fromDate:"<%=DateUtils.getFirstDayOfMonthAsString(DateUtils.DATE_PATTON_1)%>", toDate:"<%=DateUtils.getLastDayOfMonthAsString(DateUtils.DATE_PATTON_1)%>"};

            var accountBookName = '<%=accountBookName%>';

            // 工具栏

            var accountListToolbar = new Ext.Toolbar({

            renderTo: 'accountListToolBarDiv',

            items: [

                    '当前:'+accountBookName,

                    '-',

                    new Ext.Button({

                        id: 'accountList-search-button',

                        text: '查询',

                        iconCls: 'report_magnify'

                    }),

                    new Ext.Button({

                        id: 'accountList-add-button',

                        text: '添加',

                        iconCls: 'report_add'

                    }),

                    new Ext.Button({

                        id: 'accountList-edit-button',

                        text: '修改',

                        iconCls: 'report_edit'

                    }),

                    new Ext.Button({

                        id: 'accountList-delete-button',

                        text: '删除',

                        iconCls: 'report_delete'

                    }),

                    '-',

                    new Ext.Button({

                        id: 'accountList-inout-button',

                        text: '收支统计',

                        iconCls: 'chart_bar'

                    }),

                    new Ext.Button({

                        id: 'accountList-groupin-button',

                        text: '收入统计',

                        iconCls: 'chart_pie'

                    }),

                    new Ext.Button({

                        id: 'accountList-groupout-button',

                        text: '支出统计',

                        iconCls: 'chart_pie'

                    })

                ]

            });

            // 账目分类数据源

            var accountCategoryStore = new Ext.data.JsonStore({

                url: '<%=baseUrl %>/accountCategoryAction.do?method=query',

                root: 'datas',

                fields: ['categoryId', 'categoryName'],

                autoLoad:  {

                params: {'status':''},

                    callback: function(records, success){

                        this.insert(0, new Ext.data.Record({

                            categoryId: "",

                            categoryName: "全部"

                        }));

                    }

                }

            });

            // 账目类型数据源

            var accountTypeStore = new Ext.data.ArrayStore({ 

                fields : ['accountType', 'accountTypeName'], 

                data : <%=ServletHelp.getArrayFromMap(Constants.ACCOUNT_TYPE_MAP, "全部")%>,

                sortInfo: {field: "accountType", direction: "ASC"}

            });

            // 检索账目Form

            var searchAccountFormPanel = new Ext.FormPanel({

                id: 'searchAccountFormPanel',

                renderTo: 'accountListSearchDiv',

                labelWidth: 60,

                width:600,

                border: false,

                bodyStyle: 'padding:5px;',

                url: '',

                items: [{

                    layout:'column',

                    border: false,

                    items:[{

                        columnWidth:.5,

                        layout: 'form',

                        border: false,

                        items: [{

                          // 账目类型

                            xtype:'combo',

                            hiddenName: 'accountType',

                            fieldLabel: '账目类型',

                            store: accountTypeStore,

                            mode : 'local',

                            triggerAction: "all",

                            emptyText: '请选择...',

                            valueField: 'accountType',

                            displayField: 'accountTypeName',

                            listeners:{

                                change:function(){

                                  accountCategoryStore.load({

                                      params: {'status':this.value},

                                      callback: function(records, success){

                                          if(records.length==0){

                                              accountCategoryStore.removeAll();

                                          }else{

                                              accountCategoryStore.insert(0, new Ext.data.Record({

                                                  categoryId: "",

                                                  categoryName: "全部"

                                              }));

                                          }

                                          searchAccountFormPanel.getForm().findField("categoryId").setValue("");

                                      }

                                  });

                                }

                           },

                            editable: false,

                            anchor:'95%'

                        },{

                          // 开始日期

                            xtype:'datefield',

                            id: 'fromDate',

                            name: 'fromDate',

                            fieldLabel: '开始日期',

                            format: 'Y-m-d',

                            value: '<%=DateUtils.getFirstDayOfMonthAsString(DateUtils.DATE_PATTON_1)%>',

                            anchor:'95%'

                        }]

                    },{

                        columnWidth:.5,

                        layout: 'form',

                        border: false,

                        items: [{

                          // 收支项目

                            xtype:'combo',

                            hiddenName: 'categoryId',

                            fieldLabel: '收支项目',

                            store: accountCategoryStore,

                            mode : 'local',

                            triggerAction: "all",

                            emptyText: '请选择...',

                            valueField: 'categoryId',

                            displayField: 'categoryName',

                            editable: false,

                            anchor:'95%'

                        },{

                          // 结束日期

                            xtype:'datefield',

                            id: 'toDate',

                            name: 'toDate',

                            fieldLabel: '结束日期',

                            format: 'Y-m-d',

                            value: '<%=DateUtils.getLastDayOfMonthAsString(DateUtils.DATE_PATTON_1)%>',

                            anchor:'95%'

                        }]

                    },{

                        columnWidth:.5,

                        layout: 'form',

                        border: false,

                        items: [{

                          // 账目备注

                          xtype:'textfield',

                              id:'remark',

                              name:'remark',

                              fieldLabel:'账目备注',

                            anchor:'95%'

                        }]

                    }]

                }]

            });

            // 账目合计信息

            var accountListGridHeaderPanel = new Ext.Panel({

            id: 'accountListGridHeaderPanel',

                renderTo: 'accountListGridHeaderDiv',

                contentEl: 'accountListGridHeaderInfoDiv',

                bodyStyle: 'padding:5px;border-width:0px;border-top-width:1px;'

            });

            // 账目数据源

            var accountListStore = new Ext.data.JsonStore({

                url: '<%=baseUrl %>/accountAction.do?method=query',

                root: 'datas',

                totalProperty: 'results',

                fields: ['accountId', 'accountBookId', 'accountBookName', 'accountType', 'categoryName', 'accountDateStr', 'money', 'remark', 'updateDateStr'],

                baseParams: baseParams,

                autoLoad: true

            });

           

            // 账目数据表格

            var sm = new Ext.grid.CheckboxSelectionModel();

            var accountListGrid = new Ext.grid.GridPanel({

                id: 'accountListGrid',

                renderTo: 'accountListGridDiv',

                border: false,

                columnLines: true,

                stateful: true,

                autoScroll: 'auto',

                height: 500,

                store: accountListStore,

                loadMask: true,

                cm: new Ext.grid.ColumnModel({

                    defaults: {

                        width: 120,

                        sortable: true

                    },

                    columns: [

                        sm,

                        new Ext.grid.RowNumberer({header:'№'}),

                        {id:'accountBookId',header: '账本ID', width: 100, sortable: true, dataIndex: 'accountBookId', hidden: true},

                        {id:'accountBookName',header: '账本', width: 100, sortable: true, dataIndex: 'accountBookName'},

                        {id:'accountId',header: '账目ID', width: 100, sortable: true, dataIndex: 'accountId', hidden: true},

                        {id:'accountType',header: '账目类型', width: 100, sortable: true, dataIndex: 'accountType'},

                        {id:'categoryName',header: '收支项目', width: 150, sortable: true, dataIndex: 'categoryName'},

                        {id:'money',header: '金额', width: 100, sortable: true, dataIndex: 'money', align: 'right', renderer: Ext.util.Format.numberRenderer('0,000.00')},

                        {id:'accountDateStr',header: '账目日期', width: 100, sortable: true, dataIndex: 'accountDateStr'},

                        {id:'remark',header: '备注', width: 300, sortable: true, dataIndex: 'remark'}

                    ]

                }),

                sm: sm,

                columnLines: true,

                bbar: new Ext.PagingToolbar({

                    pageSize: <%=Constants.PAGE_SIZE %>,

                    store: accountListStore,

                    displayInfo: true,

                    displayMsg: Anynote.PAGINGTOOLBAR_DISPLAYMSG,

                    emptyMsg: Anynote.PAGINGTOOLBAR_EMPTYMSG,

                    doLoad: function(start){

                        var form = searchAccountFormPanel.getForm();

                        var param = form.getValues();

                        param.start = start;

                        param.limit = baseParams.limit;

                        this.store.load({params: param});

                    }

                }),

                listeners: accountListStore.on("load", function(){getSum();})

            });

            // 设置Grid高度和宽度

            Anynote.resizeGridTo("accountListGrid", 0, 169);

            // 行双击事件

            accountListGrid.on("rowdblclick", function(){

                $("#accountList-edit-button").click();

            });

            // 添加按钮

            $("#accountList-add-button").click(function(){

                if('<%=accountBookId %>'==0){

                    Ext.Msg.alert('提示', '请先创建一个账本.');

                }else{

                    accountWindow = new Ext.Window({

                        title: '添加账目',

                        width: 400,

                        height: 270,

                        modal: true,

                        resizable: false,

                        plain: true,

                        layout:'fit',

                        autoLoad:{url:'<%=baseUrl %>/websrc/page/account/editAccount.jsp?type=CREATE&accountBookId=<%=accountBookId%>',scripts:true,nocache:true}

                    });

                    accountWindow.show();

                }

            });

            // 修改按钮

            $("#accountList-edit-button").click(function(){

                var records = Ext.getCmp("accountListGrid").getSelectionModel().getSelections();

                if(records.length!=1){

                    Ext.Msg.alert("提示", "请选择一条数据.");

                }else{

                    var accountId = records[0].get("accountId");

                    accountWindow = new Ext.Window({

                        title: '编辑账目',

                        width: 400,

                        height: 250,

                        modal: true,

                        resizable: false,

                        layout:'fit',

                        plain: true,

                        autoLoad:{url:'<%=baseUrl %>/websrc/page/account/editAccount.jsp?type=UPDATE&accountId='+accountId,scripts:true,nocache:true}

                    });

                    accountWindow.show();

                }

               

            });

            // 删除按钮

            $("#accountList-delete-button").click(function(){

                var records = Ext.getCmp("accountListGrid").getSelectionModel().getSelections();

                if(records.length < 1){

                    Ext.Msg.alert("提示", "请至少选择一条数据.");

                }else{

                    Ext.Msg.confirm("警告", "确定要删除吗?", function(btn){

                        if(btn=="yes"){

                            var accountIds = "";

                            for(var i=0;i<records.length;i++){

                                accountIds = accountIds + records[i].get("accountId") + ",";

                            }

                            // 发送请求

                            Anynote.ajaxRequest({

                                baseUrl: '<%=baseUrl %>',

                                baseParams: {accountIds:accountIds},

                                action: '/accountAction.do?method=delete',

                                callback: function(jsonResult){

                                    Ext.getCmp("accountListGrid").getStore().reload({

                                        callback: function(records, success){getSum();}

                                    });

                                },

                                showWaiting: true,

                                failureMsg: '删除失败.'

                            });

                        }

                    });

                }

            });

            // 查询按钮

            $("#accountList-search-button").click(function(){

                var form = searchAccountFormPanel.getForm();

                var param = form.getValues();

                accountListStore.load({params: param});

            });

            // 收支统计按钮

            $("#accountList-inout-button").click(function(){

                var fromDate = searchAccountFormPanel.getForm().findField('fromDate').getValue();

                var toDate = searchAccountFormPanel.getForm().findField('toDate').getValue();

                if(fromDate=='' || toDate==''){

                    Ext.Msg.alert('提示','请选择统计日期!');

                }else{

                    // 发送请求-取合计值

                    Anynote.ajaxRequest({

                        baseUrl: '<%=baseUrl %>',

                        baseParams: {fromDate:fromDate,toDate:toDate,accountBookId:<%=accountBookId %>},

                        action: '/accountAction.do?method=getSum',

                        callback: function(jsonResult){

                            if(jsonResult.success==true){

                                // 收支统计数据

                                var accountListInOutStore = new Ext.data.ArrayStore({

                                    fields: ['inout', 'money'],

                                    data: [['收入',jsonResult.currentInMoney],['支出',jsonResult.currentOutMoney]]

                                });

                                // 收支统计窗口

                                var groupInOutWindow = new Ext.Window({

                                    title: '收支统计',

                                    width: 300,

                                    height: 450,

                                    modal: true,

                                    maximizable: false,

                                    resizable: false,

                                    layout:'fit',

                                    plain: true,

                                    items: {

                                    xtype: 'columnchart',

                                        store: accountListInOutStore,

                                        yField: 'money',

                                        xField: 'inout',

                                        xAxis: new Ext.chart.CategoryAxis({

                                            title: '收支'

                                        }),

                                        yAxis: new Ext.chart.NumericAxis({

                                            title: '金额'

                                        }),

                                        extraStyle: {

                                           xAxis: {

                                                labelRotation: 0

                                            }

                                        }

                                    }

                                }).show();

                            }else{

                                Ext.Msg.alert('提示','统计错误.');

                            }

                        }

                    });

                }

            });

            // 收入统计按钮

            $("#accountList-groupin-button").click(function(){

                var fromDate = searchAccountFormPanel.getForm().findField('fromDate').getValue();

                var toDate = searchAccountFormPanel.getForm().findField('toDate').getValue();

                if(fromDate=='' || toDate==''){

                    Ext.Msg.alert('提示','请选择统计日期.');

                }else{

                    // 收入统计数据源

                    var accountListGroupInStore = new Ext.data.JsonStore({

                        url: '<%=baseUrl %>/accountAction.do?method=getGroupSumMoney',

                        root: 'datas',

                        totalProperty: 'results',

                        fields: ['categoryName', 'money'],

                        baseParams: {accountBookId:'<%=accountBookId%>',accountType:'1',fromDate:fromDate,toDate:toDate},

                        autoLoad: true

                    });

                    var groupInWindow = new Ext.Window({

                        title: '收入统计',

                        width: 600,

                        height: 450,

                        modal: true,

                        maximizable: false,

                        resizable: false,

                        layout:'fit',

                        plain: true,

                        items: {

                            store: accountListGroupInStore,

                            xtype: 'piechart',

                            dataField: 'money',

                            categoryField: 'categoryName',

                            extraStyle:{

                                legend:{

                                    display: 'bottom',

                                    padding: 5

                                }

                            }

                        }

                    }).show();

                }

            });

            // 支出统计按钮

            $("#accountList-groupout-button").click(function(){

                var fromDate = searchAccountFormPanel.getForm().findField('fromDate').getValue();

                var toDate = searchAccountFormPanel.getForm().findField('toDate').getValue();

                if(fromDate=='' || toDate==''){

                    Ext.Msg.alert('提示','请选择统计日期.');

                }else{

                    // 支出统计数据源

                    var accountListGroupOutStore = new Ext.data.JsonStore({

                        url: '<%=baseUrl %>/accountAction.do?method=getGroupSumMoney',

                        root: 'datas',

                        totalProperty: 'results',

                        fields: ['categoryName', 'money'],

                        baseParams: {accountBookId:'<%=accountBookId%>',accountType:'2',fromDate:fromDate,toDate:toDate,accountBookId:<%=accountBookId %>},

                        autoLoad: true

                    });

                    var groupOutWindow = new Ext.Window({

                        title: '支出统计',

                        width: 600,

                        height: 450,

                        modal: true,

                        maximizable: false,

                        resizable: false,

                        layout:'fit',

                        plain: true,

                        items: {

                            store: accountListGroupOutStore,

                            xtype: 'piechart',

                            dataField: 'money',

                            categoryField: 'categoryName',

                            extraStyle:{

                                legend:{

                                    display: 'bottom',

                                    padding: 5

                                }

                            }

                        }

                    }).show();

                }

            });

        });

        // 取合计值

        function getSum(){

            var form = Ext.getCmp("searchAccountFormPanel").getForm();

            var param = form.getValues();

            param.accountBookId = '<%=accountBookId %>';

            // 发送请求-取合计值

            Anynote.ajaxRequest({

                baseUrl: '<%=baseUrl %>',

                baseParams: param,

                action: '/accountAction.do?method=getSum',

                callback: function(jsonResult){

                    setGridHeader(jsonResult);

                }

            });

        }

        // 取合计值回调方法

        function setGridHeader(jsonResult){

            if(jsonResult.success==true){

                $("#inMoneySpan").html(Ext.util.Format.number(jsonResult.inMoney,'0,000.00'));

                $("#outMoneySpan").html(Ext.util.Format.number(jsonResult.outMoney,'0,000.00'));

                $("#balanceSpan").html(Ext.util.Format.number(jsonResult.balance,'0,000.00'));

            $("#currentInMoneySpan").html(Ext.util.Format.number(jsonResult.currentInMoney,'0,000.00'));

            $("#currentOutMoneySpan").html(Ext.util.Format.number(jsonResult.currentOutMoney,'0,000.00'));

            }

        }

    </script>

</head>

<body>

<div id="accountListDiv">

    <div id="accountListToolBarDiv"></div>

    <div id="accountListSearchDiv"></div>

    <div id="accountListGridHeaderDiv">

        <div id="accountListGridHeaderInfoDiv" style="font-size:12px;font-weight:bold;" class="x-hide-display">

            <span style="float: left;">

                <span>当前收入:</span><span id="currentInMoneySpan">--</span><span>&nbsp;元</span>&nbsp;

                <span>当前支出:</span><span id="currentOutMoneySpan">--</span><span>&nbsp;元</span>

            </span>

            <span style="float: right;">

                <span>总收入:</span><span id="inMoneySpan">--</span><span>&nbsp;元</span>&nbsp;

                <span>总支出:</span><span id="outMoneySpan">--</span><span>&nbsp;元</span>&nbsp;

                <span>总余额:</span><span id="balanceSpan">--</span><span>&nbsp;元</span>

            </span>

        </div>

    </div>

    <div id="accountListGridDiv" style="width:100%;height:100%;"></div>

</div>

七、   总结:

在做系统发的过程中,学到了许多JSP知识,对JSP相关知识有了更细致的认识,以前上课时总是只听不练,虽然课上听的很明白,但由于课下缺少练习,相关的知识没有及时得到巩固,通过这次课程设计,对JSP相关知识有了更细致的认识,但同时也存在一些欠缺,部分界面没有完成,在数据库的连接过程还不够熟练,需要进一步完善学习。

更多相关推荐:
管理信息系统课程设计报告

管理信息系统课程设计设计题目班级学生成绩查询系统专业班级学生姓名终结者队指导教师2012年4月19日目录1人员介绍3A终结者3B队伍组成32学生成绩查询系统建设背景4A必要性4B实用性4C目的性43系统简介5A...

管理信息系统课程设计报告(标准格式)

管理信息系统课程设计报告题目库存管理信息系统学生姓名指导教师成绩日期20xx年9月8号目录目录2摘要3库存管理管理信息系统4第一章现行系统概述4第二章系统分析41需求分析42可行性研究521目标与方案可行性52...

管理信息系统课程设计报告

管理信息系统课程设计报告课程设计任务书一课程设计课题题目安徽工程大学地下超市收银系统开发二课程设计原始资料地下超市商品信息三课程设计内容开发适合于地下超市的高效率收银系统四课程设计要求1通过课程设计加深理解验证...

《管理信息系统》课程设计报告范文

1摘要企业工资管理系统是公司管理的一个重要内容是一种典型的管理系统企业工资管理系统是公司管理的一个重要内容是一种典型的管理系统其开发主要包括后台的数据库的建立维护以及前端的相应应用程序的开发两个方面的内容系统的...

管理信息系统MIS课程设计报告

MIS课程设计课设题目:中国电信(江苏分公司)供应链管理系统学院管理学院专业___市场营销________班别___09市场营销(2)_学号_______姓名__________指导教师_______20##年…

《管理信息系统》课程设计报告

管理信息系统设计报告院系班级姓名学号辅导老师徐恒实验题目航班售票管理系统设计报告完成日期20xx年5月17日1目录一实验题目3二实验目的3三实验内容3系统分析3一必要性分析3二可行性分析3三航班售票管理系统业务...

MIS(管理信息系统)课程设计个人总结

课程设计总结姓名:李斌专业:财务管理学号:1145543131课程设计个人总结本次课程设计持续了1个星期,时间非常紧张,我们的课题是企业人力资源管理系统,我们小组由7个人组成,需要完成企业人力资源管理系统子系统…

管理信息系统课程设计报告书

课程设计报告书题目企业库存系统开发报告书院系20xx年6月2日开发背景介绍企业的库存物资管理往往是很复杂很繁琐的由于所掌握的物资种类众多订货管理发放的渠道各有差异各个企业之间的管理体制不尽相同各类统计报表繁多因...

管理信息系统课程设计报告

MIS课程设计报告书南通大学商学院MIS课程设计报告书设计题目系统设计专业班级国贸131学生姓名学号13040120xx13040120xx指导教师日期20xx122120xx1227MIS课程设计报告书1课程...

超市管理信息系统课程设计报告

目录1需求分析111开发背景112系统可行性分析2111管理可行性分析2112经济可行性分析2113运行上的可行性2114社会可行性分析2115可行性研究结论32系统功能分析421系统功能422系统功能概述53...

管理信息系统课程设计报告模板

管理信息系统课程设计报告参考模板图书管理查询系统一系统背景二可行性分析三调查内容四系统分析五代码说明六数据库文件设计数据文件结构七系统操作与使用说明进入密码八程序设计体会与收获房地产管理系统网站制作附加CS代码...

学生信息管理系统实验报告

西安郵電學院数据库原理及应用设计报告题目:学生信息管理系统一.设计目的学生管理系统是高校管理工作中一项非常重要的组成部分。用户的需求具体体现在各种信息的提供、保存、更新和查询方面,这就要求数据库结构能充分满足各…

管理信息系统课程设计报告(19篇)