cameraSetup.esp 4.09 KB
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>相机架设</title>
    <link href="../../css/frame.css" rel="stylesheet" />
    <link href="../../scripts/easyui/themes/default/easyui.css" rel="stylesheet" />
    <link href="../../scripts/easyui/themes/icon.css" rel="stylesheet" />
    <style type="text/css">
        .mainContainer {
            width: 90%;
            height: 400px;
            padding: 8px;
        }
        .tdTitle {
            width: 110px;
        }
         .picExample {
             height: 276px;
             width: 322px;
             background: url(../../images/cameraSetup.png) no-repeat 0 0;
         }
    </style>
</head>
<body>
    <div class="mainContainer">
        <form id="cameraSetupForm">
            <table class="settingsContainer">
                <tr>
                    <td class="tdTitle">杆高(1-10米)</td>
                    <td class="tdContent">
                        <input type="text" name="210" id="210" class="settingParameter" />
                    </td>
                </tr>
                <tr>
                    <td class="tdTitle">焦距(5-50毫米)</td>
                    <td class="tdContent">
                    	<input type="text" name="211" id="211" class="settingParameter">
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <div class="picExample">

                        </div>
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                    	<% inputSecurityToken(); %>
                        <a href="#" id="btnSave" class="settingBtn">保存</a>
                    </td>
                </tr>
            </table>
        </form>
    </div>
    <script src="../../scripts/easyui/jquery.min.js"></script>
    <script src="../../scripts/easyui/jquery.easyui.min.js"></script>
    <script src="../../scripts/easyui/locale/easyui-lang-zh_CN.js"></script>
    <script src="../../scripts/utilities.js"></script>
    <script src="../../scripts/jquery.validate.min.js"></script>
    <script src="../../scripts/jquery.validate.extend.js"></script>
    <script type="text/javascript">
        var parameterAdaptor = new ParameterAdaptor();
		var rebootManager = new RebootManager();
		
        $().ready(function() {
            loadCameraSetupInfo();
            setTimeout(loadAttributeInfo, 200);
            $("#btnSave").click(saveParametersToServer);

            //表单验证
            $("#cameraSetupForm").validate({
                rules: {
                    210: {
                        required:true,
                        range:[1,10]
                    },
                    211: {
                        required:true,
                        range:[5,50]
                    }
                }
            });
        });

        //加载相机设置参数
        function loadCameraSetupInfo() {
			var RefererInfo = "cameraSetup";
            parameterAdaptor.getParameters(RefererInfo, function(data) {
                $("#cameraSetupForm").form("load", data.feedback);
            });
        }
        
		function loadAttributeInfo() {
			var RefererInfo = "cameraSetup";
			parameterAdaptor.getAttribute(RefererInfo, function(data){
	            for(var pId in data){
	            	if(document.getElementById(pId) != null)
						document.getElementById(pId).setAttribute( "title", data[pId]);
				} 
			});
		}

        //保存参数到服务器
        function saveParametersToServer() {
            var formObj = $("#cameraSetupForm");
            if (!formObj.valid()) {
                $.messager.alert("提示", "参数验证有误,请修改后再提交!", "error");
                return;
            }
            parameterAdaptor.saveParameters(formObj, function(response) {
                if (response.error) {
                    $.messager.show({
						title:'结果',
						msg:'修改成功!',
						timeout:3000,
						showType:'slide'
					});
                }
            });
            
        }
    </script>
</body>
</html>