hzinfo.jsp 6.9 KB
<%--
  Created by IntelliJ IDEA.
  User: lenovo
  Date: 2019/3/15
  Time: 9:33
  To change this template use File | Settings | File Templates.
--%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link href="<%=basePath %>resource/css/base.css" rel="stylesheet">
    <link rel="stylesheet" href="<%=basePath %>resource/easyui/uimaker/easyui.css">
    <link rel="stylesheet" type="text/css" href="<%=basePath %>resource/easyui/uimaker/icon.css">
    <link rel="stylesheet" href="<%=basePath %>resource/css/providers.css">

    <link rel="stylesheet" href="<%=basePath%>resource/layui/css/layui.css" media="all">
    <script type="text/javascript" src="<%=basePath%>resource/easyui/jquery.min.js"></script>
    <script type="text/javascript" src="<%=basePath%>resource/layer-v3.0.3/layer/layer.js"></script>
    <script type="text/javascript" src="<%=basePath%>resource/layui/layui.js"></script>

</head>
<body>
<div class="container">
    <div data-options="closable:true">
        <table id="dg" style="width:100%;" title="货主信息管理"
               data-options="
                rownumbers:true,
                singleSelect:false,
                autoRowHeight:false,
                pagination:true,
                fitColumns:true,
                striped:true,
                collapsible:true,
                toolbar:'#tb',
                pageSize:10">
            <thead>
            <tr>
                <th field="."  formatter="editFormat"><spring:message code="opt.edit" /></th>
                <th field="forShort">简称</th>
                <th field="fullName">全称</th>
                <th field="theShipperType" sortable="true">货主类型</th>
                <th field="contacts">联系人</th>
                <th field="phone">电话</th>

            </tr>
            </thead>
        </table>
        <div id="tb" style="padding:0 30px;"><input type="hidden" id="idcc">
            <form id="searchForm">
                <table class="search_form_table">
                    <%--联系人:<input id="manifnum" type="text" name="search_LIKE_waybillnomaster" style="width:166px;height:35px;line-height:35px;">--%>
                    电话:<input class="easyui-textbox" type="text" name="search_LIKE_phone" style="width:166px;height:35px;line-height:35px;">
                    <a href="javascript:doSearch()" class="easyui-linkbutton" iconCls="icon-search" data-options="selected:true"><spring:message code="opt.search" /></a>
                    <%--<a href="javascript:doSave()" class="easyui-linkbutton" style="background:#18A197;color:#FFF;border: 1px solid #18A197;" iconCls="icon-add"><spring:message code="opt.add" /></a>--%>
                    <%--<a href="javascript:doDelete()" class="easyui-linkbutton" style="background:red;color:#FFF;border: 1px solid red" iconCls="icon-no"><spring:message code="opt.delete" /></a>--%>
                </table>
            </form>
        </div>
    </div>

</div>
<script type="text/javascript" src="<%=basePath %>resource/easyui/jquery.min.js"></script>
<script type="text/javascript" src="<%=basePath %>resource/easyui/jquery.easyui.min.js"></script>
<script type="text/javascript" src="<%=basePath %>resource/easyui/easyui-lang-${pageContext.response.locale}.js"></script>
<script type="text/javascript" src="<%=basePath %>resource/easyui/datagrid-detailview.js"></script>
<script type="text/javascript" src="<%=basePath %>resource/js/tools.js?version=${version}"></script>
<!--弹出层引入的JS-->
<script type="text/javascript" src="<%=basePath %>resource/layer-v3.0.3/layer/layer.js"></script>
<script type="text/javascript">

    $(function(){
        function getPageNumber(){
            var pageNumber = window.localStorage.getItem("pageNumber");
            if(typeof(pageNumber) != "undefined")
            {
                try{
                    var pattern = /^\d+$/g;		//判断是否是数字

                    //console.log(pageNumber.search(pattern));

                    if(pageNumber.search(pattern) >= 0)
                    {
                        var num = parseInt(pageNumber);
                        return num;
                    }
                    return 1;
                }
                catch(e){
                    return 1;
                }
            }
            return 1;
        }

        //console.log(getPageNumber());

        $('#dg').datagrid({
            url:'<%=basePath %>hzinfo/grid.json',
            //queryParams:$("#searchForm").serializeJson(),
            pageNumber:getPageNumber(),
            view: detailview,
            detailFormatter:function(index,row){
                return '<div id="ddv-' + index + '"style="padding:5px 0"></div>';
            }
        });
    });

    function editFormat(val,row,index){

        var html='<a href="javascript:void(0)" style="padding-left:10px;text-decoration:none;color:blue;padding-right:20px;" onclick="findOneHz('+row.id+')" lay-event="choose"><i class="iconfont">选择</i></a>'
        html += '<a href="javascript:void(0)" style="text-decoration:none;margin-left:20px;color:blue;" </a>';
        return html;
    }


    function doSearch(){
        $('#dg').datagrid("options").queryParams=$("#searchForm").serializeJson();
        $('#dg').datagrid("reload");
    }

    function getIds() {
        var ids = [];
        var rows = $("#dg").datagrid('getChecked');
        $.each(rows,function(key,v){
            ids.push(v.id);
        });
        return ids;
    }

    function doDelete(){
        var rows = $("#dg").datagrid('getChecked');
        if(rows.length==0){
            layer.open({content:"<spring:message code="opt.selectone" />"});
            return false;
        }
        layer.confirm("<spring:message code="opt.confirmdel" />?", {btn:['<spring:message code="opt.confirm" />','<spring:message code="opt.cancel" />']},function () {
            $.post("<%=basePath %>hzinfo/delete",{ids:getIds().join(",")},function(data){
                if(data.status == 200) {
                    layer.confirm("<spring:message code="opt.delsuccess" />!",{btn:['<spring:message code="opt.confirm" />','<spring:message code="opt.cancel" />']},function(){
                        window.location.href="<%=basePath %>hzinfo/list";
                    })
                }else{
                    layer.open({content:"<spring:message code="opt.delfailed" />!"});
                }
            },"json");

        });
    }

    $("#manifnum").keyup(function(){
        var leng =  $("#manifnum").val().length;
        if (leng == 3)
        {
            $("#manifnum").val( $("#manifnum").val()+"-")
        }
    })

</script>
</body>
</html>