网页:html.01

2017-06-18  本文已影响0人  谜之龙
22.png
11.png
  <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/jsp/web/include/includes-web.jsp"%>
<html>
<head>
<script type="text/javascript">
        //功能实现:在没选择时上面各种按钮不能进行选择
        function datagridButtonAble(){
            jQuery("#edit").linkbutton('disable');
            jQuery("#remove").linkbutton('disable');
            jQuery("#show").linkbutton('disable');
            var checkeds=jQuery("#datagrid").datagrid("getChecked");
            for(var i in checkeds){
                if(checkeds.length==1){
                    jQuery("#edit").linkbutton('enable');
                    jQuery("#remove").linkbutton('enable');
                    jQuery("#show").linkbutton('enable');
                }else if(checkeds.length!=0){
                    jQuery("#remove").linkbutton('enable');//批量,需要后台批量删除
                }
            }
        }
        //添加数据的方法
        function add(){
            jQuery('#mergeForm').form('clear');
            jQuery('#merge-dialog').dialog('setTitle','添加').dialog('open');
        }
        //修改数据的方法
         function edit(){
            jQuery("#mergeForm").form("clear");
            var rows = jQuery("#datagrid").datagrid('getChecked')[0];
            jQuery("#mergeForm").form('load',rows);
            jQuery("#projectId").combogrid('setText',rows['projectInfo.name']);
            $('#chechDateStr').datebox('setValue', rows['CheckDate']?rows['CheckDate'].substr(0,10):"");
            $('#moveDateStr').datebox('setValue', rows['MoveDate']?rows['MoveDate'].substr(0,10):"");
            jQuery("#merge-dialog").dialog('setTitle','修改信息').dialog('open');
        }
        //删除数据的方法
        function remove(){
            jQuery.messager.confirm('注意', '是否确定删除?', function(r){
                 if (r){
                        var ids=new Array();
                        var checks=jQuery("#datagrid").datagrid('getChecked');
                        for(var i in checks){
                            ids.push(checks[i].id);
                        }
                    
            jsTool.ajax({
                    url:contextPath+"/web/hr/lianXi2/remove.do",
                    data:{id:ids+""},
                    dataType:'text',
                    success:function(data){
                        easyuiTool.show('成功', '执行成功');
                        jQuery('#datagrid').datagrid('load');
                        }
                    });
                 }
             })
        }  
        //显示具体信息的方法
        function show(){
            jQuery("#showForm").form("clear");
            var row=jQuery("#datagrid").datagrid('getChecked')[0];
            jQuery("#mergeForm").form('load',row);
            //jQuery("#对应下面的网页div的ID").html(row['对应实体类中的名称']);
            jQuery("#project").html(row['projectInfo.name']);
            jQuery("#chechData").html(row['CheckDate']?row['CheckDate'].substr(0,10):"");
            jQuery("#moveData").html(row['MoveDate']?row['MoveDate'].substr(0,10):"");
            jQuery("#weekData").html(row['WeekDate']);
            jQuery("#addressromm").html(row['address']);
            jQuery("#renCount").html(row['roomCount']);
            jQuery("#remarked").html(row['remarks']);
            jQuery("#show-dialog").dialog('setTitle','查看信息').dialog('open');
        }
        //主要是进行选择的菜单选项
        jQuery(function(){
            jQuery("#datagrid").datagrid({
                url:contextPath+"/web/hr/lianXi2/findpage.do",
                fit:true,
                pagination:true,
                nowrap:true,
                singleSelect:true,
                selectOnCheck:false,
                checkOnSelect:true, 
                toolbar:[
                    {
                        id:'add',
                        iconCls:'icon-erpadd',
                        text:'添加',
                        handler:function(){
                            add();
                        }
                    },'-',{
                        id:'edit',
                        iconCls:'icon-erprevise',
                        text:'修改',
                        handler:function(){
                            edit();
                        }
                    },'-',{
                        id:'remove',
                        iconCls:'icon-erpdelete',
                        text:'删除',
                        handler:function(){
                            remove();
                        }
                    },'-',{
                        id:'show',
                        iconCls:'icon-erpinformation',
                        text:'查看',
                        handler:function(){
                            show();
                        }
                    },'->',{
                        name:'param',
                        type:'searchbox'
                    },'-',{
                        iconCls: 'icon-erpquest',
                        text:'高级查询',
                        type:"extendButton",
                        extendDivStr:"#extendDiv"
                    }
            ],
            
            columns:[[
                        {field:'id',checkbox:true}, 
                        {field:'emp.name',title:'申请人',sortable:true,width:80},
                        {field:'emp.empSex.name',title:'性别',sortable:true,width:50},                        
                        {field:'projectInfo.name',title:'项目组',sortable:true,width:80},
                        {field:'CheckDate',title:'入住时期',sortable:true,width:80},
                        {field:'WeekDate',title:'入住周期',sortable:true,width:100},
                        {field:'MoveDate',title:'计划搬离时期',sortable:true,width:100},
                        {field:'address',title:'入住地址',sortable:true,width:100},
                        {field:'roomCount',title:'入住人数',sortable:true,width:50},
                        {field:'remarks',title:'申请理由',sortable:true,width:50}
                    
                    ]],
                    onDblClickRow:function(rowIndex,rowData){
                        show();
                    },
                    onCheck:function(rowIndex,rowData){
                        datagridButtonAble();
                    },
                    onUncheck:function(rowIndex,rowData){
                        datagridButtonAble();
                    },
                    onCheckAll:function(rowIndex,rowData){
                        datagridButtonAble();
                    },
                    onUncheckAll:function(rowIndex,rowData){
                        datagridButtonAble();
                    },
                    onLoadSuccess:function(data){
                        datagridButtonAble();
                    }
             });
               $("#projectId").combogrid({
                   
               });
               //显示修改的对话框
             jQuery("#merge-dialog").dialog({
                 width:800,
                 height:450,
                 modal:true,
                 collapsible:true,
                 maximizable:true,
                 closed:true,
                 buttons:[{
                     text:'保存',
                     iconCls:'icon-erpbaocun',
                     handler:function(){
                         if(jQuery("#mergeForm").form('validate')==true){
                            jQuery("#mergeForm").submit();
                        }else{
                            $.messager.alert('错误','您输入的信息输入不全,请输入完整!','error');
                        }
                     }
                 },{
                     text:'关闭',
                     iconCls:'icon-erpexit',
                     handler:function(){
                         jQuery('#merge-dialog').dialog('close');
                     }
                 }]
             });
               //显示具体信息的对话框
             jQuery("#show-dialog").dialog({
                    width : 800,
                    height : 450,
                    modal : true,
                    collapsible : true,
                    closed : true,
                    buttons : [ {
                        text : '关闭',
                        iconCls : 'icon-erpexit',
                        handler : function() {
                            jQuery('#show-dialog').dialog('close');
                        }
                    } ]
                });
             jsTool.form({
                    form:jQuery('#mergeForm'),
                    dataType:"text",
                    success:function(data){
                        easyuiTool.show('成功','执行成功');
                        jQuery("#datagrid").datagrid('reload');
                        jQuery('#merge-dialog').dialog('close');
                    },error:function(){
                        $.messager.alert('错误','错误!','error');
                    }
            });

        });
    </script>
 </head>
 <body>
 <div class="easyui-layout" data-options="fit:true">
        <div data-options="region:'center',title:'入住信息'">   
            <div id="datagrid"  data-options="fitColumns:true" ></div>
        </div>
        <!-- 显示修改的对话框 -->
        <div id="merge-dialog" class="easyui-dialog">
            <form id="mergeForm" method="post" action="${contextPath}/web/hr/lianXi2/merge.do" >
                <input name="id" type="hidden">
                <input name="empId" type="hidden" value="${hrRoom.empId!=null?hrRoom.empId:empId}"> <!-- //问题 -->
                
                <table class="forms-web">             
                    <tr>
                        <th>姓名:</th>
                        <td>${hrRoom.emp.name!=null?hrRoom.emp.name:curUser.emp.empName}</td>
                    </tr>
                    <tr>
                        <th>性别:</th>
                            <td>${hrRoom.emp.empSex.name!=null?hrRoom.emp.empSex.name:curUser.emp.empSex.name}</td>
                    </tr>
                    <tr>
                        <th>民族:</th>
                            <td>${empNation}</td>
                    </tr>
                    <tr>
                        <th>项目:</th>
                        <td>
                            <select id="projectId" class="easyui-combogrid" name="projectId" data-options="
                                    fit:true,
                                    readonly:true,
                                    pagination:true,
                                    editable:false,
                                    width:200,
                                    panelWidth: 400,
                                    idField: 'id',
                                    textField: 'name',
                                    fitColumns: true,
                                    url: contextPath+'/web/pm/projectInfo/findPage.do',
                                    value:'${HrRoom.projectId}',
                                    toolbar:[
                                            '->',{
                                                name:'param',
                                                type:'searchbox'
                                            }
                                        ],
                                    columns: [[
                                        {field:'id',hidden:true},
                                        {field:'code',title:'项目编号',width:40,sortable:true},
                                        {field:'name',title:'项目名称',width:40,sortable:true}
                                        
                                    ]]
                                ">
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <th>入住日期:</th>
                        <td><input  id="chechDateStr" name="chechDateStr" class="easyui-datebox" data-options="required:true"  style="width:200px"></td>
                    </tr>
                    <tr>
                        <th>入住周期:</th>
                        <td><input name="WeekDate" class="easyui-validatebox" data-options="required:true"></td>
                    </tr>
                    <tr>
                        <th>计划搬离日期:</th>
                        <td><input id="moveDateStr" name="moveDateStr" class="easyui-datebox" data-options="required:true"  style="width:200px"></td>
                    </tr>
                    <tr>
                        <th>入住宿舍地址:</th>
                        <td><input name="address" class="easyui-validatebox" data-options="required:true"></td>
                    </tr>
                    <tr>
                        <th>已入住人数:</th>
                        <td><input name="roomCount" class="easyui-validatebox" data-options="required:true"></td>
                    </tr>
                    <tr>
                        <th>申请理由:</th>
                        <td>
                            <textarea name="remarks"  style="width:200px"></textarea>
                        </td>
                    </tr>
                </table>
            </form> 
        </div> 
        <!-- 显示具体信息的对话框的对话框 -->
        <div id="show-dialog" class="easyui-dialog">
            <form id="showForm" style="height: 100%;width: 100%;" >
              
                <table class="show-web">             
                    <tr>
                        <th>姓名:</th>
                        <td>${hrRoom.emp.name!=null?hrRoom.emp.name:curUser.emp.empName}</td>
                    </tr>
                    <tr>
                        <th>性别:</th>
                            <td>${hrRoom.emp.empSex.name!=null?hrRoom.emp.empSex.name:curUser.emp.empSex.name}</td>
                    </tr>
                    <tr>
                        <th>民族:</th>
                            <td>${empNation}</td>
                    </tr>
                    <tr>
                        <th>项目:</th>
                        <td id="project"></td>
                    </tr>
                    <tr>
                        <th>入住日期:</th>
                        <td id="chechData"></td>
                    </tr>
                    <tr>
                        <th>入住周期:</th>
                        <td id="weekData"></td>
                    </tr>
                    <tr>
                        <th>计划搬离日期:</th>
                        <td id="moveData"></td>
                    </tr>
                    <tr>
                        <th>入住宿舍地址:</th>
                        <td id="addressromm"></td>
                    </tr>
                    <tr>
                        <th>已入住人数:</th>
                        <td id="renCount"></td>
                    </tr>
                    <tr>
                        <th>申请理由:</th>
                        <td id="remarked">
                            <textarea name="remarks"  style="width:200px"></textarea>
                        </td>
                    </tr>
                </table>
            </form> 
        </div> 
    </div>  
 </body>
 </html>
上一篇下一篇

猜你喜欢

热点阅读