📄 index.jsp
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@ page language="java" contentType="text/html; charset=GBK" pageEncoding="GBK"%>
<%@ taglib uri="/WEB-INF/htxx-tag.tld" prefix="hxtg"%>
<html>
<head>
<title>员工信息</title>
<hxtg:head></hxtg:head>
<script type='text/javascript' src='../dwr/engine.js'></script>
<script type='text/javascript' src='../dwr/util.js'></script>
<script type='text/javascript' src='../hxtg/public/dwr/util.js'></script>
<script type='text/javascript' src='../dwr/interface/EmployeeBus.js'></script>
</head>
<body onload="init()">
<div id="listDiv">
<hxtg:title text="员工信息列表">
<hxtg:titleitem><hxtg:button text="添加" onclick="add()"/></hxtg:titleitem>
</hxtg:title>
<hxtg:table>
<hxtg:thead>
<hxtg:theaditem text="序号" width="5%"></hxtg:theaditem>
<hxtg:theaditem text="姓名" width="10%"></hxtg:theaditem>
<hxtg:theaditem text="性别" width="5%"></hxtg:theaditem>
<hxtg:theaditem text="职务" width="10%"></hxtg:theaditem>
<hxtg:theaditem text="入职时间" width="10%"></hxtg:theaditem>
<hxtg:theaditem text="所属部门" width="40%"></hxtg:theaditem>
<hxtg:theaditem text="婚姻状况" width="10%"></hxtg:theaditem>
<hxtg:theaditem text="操作" width="10%"></hxtg:theaditem>
</hxtg:thead>
<hxtg:tbody>
<hxtg:tr>
<hxtg:td><hxtg:item id="rownum"/></hxtg:td>
<hxtg:td><hxtg:item id="name"/></hxtg:td>
<hxtg:td><hxtg:item id="sex"/></hxtg:td>
<hxtg:td><hxtg:item id="position"/></hxtg:td>
<hxtg:td><hxtg:item id="hireDate"/></hxtg:td>
<hxtg:td><hxtg:item id="department.departmentName"/></hxtg:td>
<hxtg:td><hxtg:item id="marriage"/></hxtg:td>
<hxtg:td>
<hxtg:button id="edit" onclick="edit(this.id)" text="编辑" type="edit"></hxtg:button>
<hxtg:button id="del" onclick="del(this.id)" text="删除" type="del"></hxtg:button>
</hxtg:td>
</hxtg:tr>
</hxtg:tbody>
</hxtg:table>
<hxtg:tfoot action="init"></hxtg:tfoot>
</div>
<div id="singleDiv">
<iframe id="iframe1" name="iframe1" width="100%" height="100%" marginheight="0" marginwidth="0" frameborder="0"></iframe>
</div>
</body>
<script type="text/javascript">
function init(condition){
dwr.util.useLoadingMessage("查询员工信息");
if(condition){condition=iniCondition;}
EmployeeBus.findEmployee(condition,function(resultset){fillResult("tbody",resultset,doEachRow);});
}
function doEachRow(id,obj){
if(!obj.sex&&obj.sex===0){obj.sex="男";}
else{obj.sex="女";}
// if(obj.marriage instanceof Married){dwr.util.setValue('marriage'+id,'已婚');}
// else{dwr.util.setValue('marriage'+id,'未婚');}
// if(obj instanceof Manager){dwr.util.setValue('position'+id,'管理人员');}
// else if(obj instanceof Seller){dwr.util.setValue('position'+id,'销售人员');}
// else if(obj instanceof Technician){dwr.util.setValue('position'+id,'技术人员');}
// else{dwr.util.setValue('position'+id,'其它人员');}
}
function setSrc(func){
var timeout = 1000;
if(!$("iframe1").src){$("iframe1").src="employee.jsp";}
else{timeout = 0;}
window.setTimeout(func,timeout);
}
function add(){
$("listDiv").style.display="none";
setSrc(function(){
var win = ifrwindow($("iframe1"));
if(win===null){return;}
win.add();
$("singleDiv").style.visibility="visible";
});
}
function edit(eleid){
$("listDiv").style.display="none";
setSrc(function(){
setCurrent(eleid);
var id = getCurObj().employeeId;
var win = ifrwindow($("iframe1"));
if(!win||win===null){return;}
win.edit(id);
$("singleDiv").style.visibility="visible";
});
}
function goback(){
$("listDiv").style.display="";
$("singleDiv").style.visibility="hidden";
}
function del(eleid){
delObj(eleid,"tbody",function(obj){
if(confirm("是否确定删除'"+obj.name+"'?")){
EmployeeBus.deleteEmployee(obj.employeeId);
init();
return true;}});
}
</script>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -