($sid) { session_delete(array('sid' => $sid)); session_data_delete(array('sid' => $sid)); return TRUE; } function sess_gc($maxlifetime) { global $time; $expiry = $time - $maxlifetime; $arrlist = session_find(array('last_date' => array('<' => $expiry)), array(), 1, 10000, '', array('sid', 'bigdata', 'last_date')); if (!$arrlist) return TRUE; $expiry = $time - 21600; // 超6小时未提交丢弃上传图片和附件 $sidarr = array(); foreach ($arrlist as $val) { if ($val['last_date'] > $expiry && $val['bigdata']) continue; $sidarr[] = $val['sid']; } if (empty($sidarr)) return TRUE; session_delete(array('sid' => $sidarr)); session_data_delete(array('sid' => $sidarr)); return TRUE; } function sess_start() { global $conf, $sid, $g_session; ini_set('session.name', $conf['cookie_pre'] . 'sid'); ini_set('session.use_cookies', TRUE); ini_set('session.use_only_cookies', TRUE); ini_set('session.cookie_domain', $conf['cookie_domain']); // 为空则表示当前目录和子目录 ini_set('session.cookie_path', $conf['cookie_path']); // 打开后只有通过 https 才有效 ini_set('session.cookie_secure', FALSE); ini_set('session.cookie_lifetime', 8640000); // 打开后 js 获取不到 HTTP 设置的 cookie, 有效防止 XSS,对于安全很重要,除非有 BUG,否则不要关闭。 ini_set('session.cookie_httponly', TRUE); // 活动时间 ini_set('session.gc_maxlifetime', $conf['online_hold_time']); // 垃圾回收概率 = gc_probability/gc_divisor ini_set('session.gc_probability', 1); // 垃圾回收时间 5 秒,在线人数 * 10 / 每1000个请求回收一次垃圾 ini_set('session.gc_divisor', 1000); session_set_save_handler('sess_open', 'sess_close', 'sess_read', 'sess_write', 'sess_destroy', 'sess_gc'); // register_shutdown_function 会丢失当前目录,需要 chdir(APP_PATH) $conf['url_rewrite_on'] > 1 and function_exists('chdir') and chdir(APP_PATH); // 这个必须有,否则 ZEND 会提前释放 $db 资源 register_shutdown_function('session_write_close'); session_start(); $sid = session_id(); return $sid; } // 刷新页面清理附件缓存 废弃 function sess_clear_attach() { global $sid, $time; $arr = session_read($sid); if (!$arr || 0 == $arr['bigdata']) return TRUE; session_update($sid, array('bigdata' => 0, 'last_date' => $time)); session_data_delete(array('sid' => $sid)); return TRUE; } function online_count() { return session_count(); } function online_list_cache() { static $cache = array(); $key = 'online_list'; if (isset($cache[$key])) return $cache[$key]; $cache[$key] = cache_get($key); if (NULL === $cache[$key]) { $cache[$key] = session_find(array('uid' => array('>' => 0)), array('last_date' => -1), 1, 1000); foreach ($cache[$key] as &$online) { $user = user_read_cache($online['uid']); $online['username'] = $user['username']; $online['gid'] = $user['gid']; $online['ip_fmt'] = safe_long2ip($online['ip']); $online['last_date_fmt'] = date('Y-n-j H:i', $online['last_date']); } cache_set('online_list', $cache[$key], 300); } return $cache[$key]; } function online_user_list_cache() { static $cache = array(); $key = 'online_user_list'; if (isset($cache[$key])) return $cache[$key]; $cache[$key] = cache_get($key); if (NULL === $cache[$key]) { $cache[$key] = session_find(array('uid' => array('>' => 0)), array(), 1, 1000, 'uid', array('uid')); cache_set('online_user_list', $cache[$key], 300); } return $cache[$key]; } ?>基于jquery-easyui的机电设备管理系统布局新范例|江阴雨辰互联

基于jquery-easyui的机电设备管理系统布局新范例

使用jquery-easyui的新版本1.0.2&#xff0c;可以更有效地完成页面的布局设计。做页面布局时一般是不用编写JS代码的&#xff0c;下面重写了机电设备管理系统&#xff0c;仅供参考。 首先来看首页布

使用jquery-easyui的新版本1.0.2,可以更有效地完成页面的布局设计。做页面布局时一般是不用编写JS代码的,下面重写了机电设备管理系统,仅供参考。

首先来看首页布局例子:

    <body class="easyui-layout">
		<div region="north" style="background:#fafafa;color:#2d5593;height:40px;">
		    <div style="font-size:16px;font-weight:bold;width:400px;padding:10px 0 0 10px;">机电设备管理系统</div>
		</div>
		<div region="west" title="导航菜单" split="true" style="width:150px;">
			<div class="easyui-accordion" fit="true" border="false">
				<div title="业务操作" selected="true" style="overflow:auto;">
					<div class="nav-item">
						<a href="javascript:addTab('设备档案','device/index')">
							<img src="images/print_class.png"></img><br/>
							<span>设备档案</span>
						</a>
					</div>
					<div class="nav-item">
						<a href="javascript:addTab('设备申购')">
							<img src="images/kdmconfig.png"></img><br/>
							<span>设备申购</span>
						</a>
					</div>
					<div class="nav-item">
						<a href="javascript:addTab('设备维修')">
							<img src="images/package_settings.png"></img><br/>
							<span>设备维修</span>
						</a>
					</div>
				</div>
				<div title="数据设置" style="overflow:auto;">
					<div class="nav-item">
						<a href="javascript:addTab('区域设置')">
							<img src="images/package.png"></img><br/>
							<span>区域设置</span>
						</a>
					</div>
					<div class="nav-item">
						<a href="javascript:addTab('设备类别')">
							<img src="images/kontact.png"></img><br/>
							<span>设备类别</span>
						</a>
					</div>
				</div>
			</div>
		</div>
		<div region="center">
			<div id="main-center" class="easyui-tabs" fit="true" border="false">
				<div title="首页" style="padding:20px;">
					<img src="images/banner.gif"></img>
					<div style="margin-top:20px;">
					<p>该系统是一个由etmvc和jquery-easyui技术构建的应用示例,如果您对本系统所使用的技术感兴趣,请与我们联系。</p>
					<p> </p>
					<p>设备管理是一款记录设备使用流程的软件,其中有设备信息录入,设备类别设置,区域信息的录制,设备的使用流程,设备使用流程中出错的处理,以及报表查询等功能。</p>
					<p> </p>
					<p>我们对系统进行简化,旨在说明一般功能的开发方法。</p>
					</div>
				</div>
			</div>
		</div>
    </body>

在BODY上应用了layout布局,这种效果同EXT的VIEWPORT相似,看下效果图:


新tab的增加是动态的,如果已经存在一个TAB则打开该面板,否则新建一个,看一个这个函数:

	    	function addTab(title, href){
		    	var tt = $('#main-center');
		    	if (tt.tabs('exists', title)){
			    	tt.tabs('select', title);
		    	} else {
			    	if (href){
				    	var content = '<iframe scrolling="no" frameborder="0"  src="'+href+'" style="width:100%;height:100%;"></iframe>';
			    	} else {
				    	var content = '未实现';
			    	}
			    	tt.tabs('add',{
				    	title:title,
				    	closable:true,
				    	content:content
			    	});
		    	}
	    	}

下面来看看DATAGRID页面的布局,因为使用了DATAGRID,而这个表格比较复杂,所以有一部分的JS代码量:

<body class="easyui-layout">
	<div region="center" style="padding:5px;" border="false">
		<table id="tt" fit="true">
			<thead>
				<tr>
					<th field="code" width="60">编号</th>
					<th field="name" width="100">名称</th>
					<th field="style" width="100">型号规格</th>
					<th field="area.name" width="80" formatter="areaName">区域</th>
					<th field="manufacturer" width="100">生产厂家</th>
					<th field="factoryCode" width="100">出厂编号</th>
					<th field="country" width="60">生产国别</th>
					<th field="productionDate" width="80">生产日期</th>
					<th field="purchaseDate" width="80">购买日期</th>
				</tr>
			</thead>
		</table>
	</div>
</body>

			$('#tt').datagrid({
				url:'/easyui-dms/device/getDevices',
				pagination:true,
				toolbar:[{
					text:'新增',
					iconCls:'icon-add'
				},'-',{
					text:'修改'
				},'-',{
					text:'删除',
					iconCls:'icon-remove'
				},'-',{
					text:'查询',
					iconCls:'icon-search'
				}]
			});

好了,需要编写的代码就这么多,看一下效果图:


 

代码示例 下载地址 :http://download.csdn/detail/a9529lty/5014376

发布者:admin,转转请注明出处:http://www.yc00.com/web/1740413160a4240490.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信