< html xmlns= " http://www.w3.org/1999/xhtml&.;>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<link href="css/themes/default/easyui.css" rel="stylesheet" />
<link href="css/themes/icon.css" rel="stylesheet" />
<link href="css/themes/color.css" rel="stylesheet" />
<script src="script/jquery.min.js"></script>
<script src="script/jquery.easyui.min.js"></script>
<script src="script/easyui-lang-zh_CN.js"></script>
<style>
-sharpfm{
margin:0;
padding:10px 30px;
}
.ftitle{
font-size:14px;
font-weight:bold;
color:-sharp666;
padding:5px 0;
margin-bottom:10px;
border-bottom:1px solid -sharpccc;
}
.fitem{
margin-bottom:5px;
}
.fitem label{
display:inline-block;
width:80px;
}
body {
font-size: 12px;
overflow-y: hidden;
}
input {
width: 100px;
}
select {
width: 104px;
}
-sharpsec {
/*border:1px solid -sharp0094ff;*/
width: 600px;
}
-sharpsec td {
width: 100px;
height: 20px;
text-align: right;
}
</style>
< / head >
< body >
<div>
<form id="searchform" method="post">
<table id="sec">
<tr>
<td>:</td>
<td><input type="text" name="zxkc" class="easyui-textbox" id="DisplayName" value="" /></td>
<td></td>
<td>
<input type="text" name="bjkm" class="easyui-textbox" id="DisplayName" value="" /></td>
<td>
<a href="javascript:void(0)" id="submit_search" class="easyui-linkbutton c1" style="width:70px"></a>
</td>
</tr>
</table>
</form>
</div>
<table id="dg" title="" >
</table>
<div id="toolbar">
<a href="-sharp" class="easyui-linkbutton" iconCls="icon-add" plain="true" onclick="newUser()"></a>
<a href="-sharp" class="easyui-linkbutton" iconCls="icon-edit" plain="true" onclick="editUser()"></a>
<a href="-sharp" class="easyui-linkbutton" iconCls="icon-remove" plain="true" onclick="removeUser()"></a>
</div>
<div id="dlg" class="easyui-dialog" style="width:800px;height:280px;padding:10px 20px"
closed="true" buttons="-sharpdlg-buttons">
<div class="ftitle"></div>
<form id="fm" method="post" enctype="multipart/form-data" novalidate>
<div class="fitem" >
<label>:</label>
<input name="bjnj" class="easyui-validatebox" required="true">
</div>
<div class="fitem">
<label></label>
<input name="bcsx" class="easyui-validatebox" required="true">
</div>
<div class="fitem">
<label>:</label>
<input name="bjks" class="easyui-validatebox">
</div>
<div class="fitem">
<label>:</label>
<input name="bckk" class="easyui-datebox" required="required">
</div>
<div class="fitem">
<label>:</label>
<input name="bcsk" class="easyui-validatebox" >
</div>
<div class="fitem">
<label>:</label>
<input name="bczk" class="easyui-validatebox">
</div>
<div class="fitem">
<label>:</label>
<input name="bcsx" class="easyui-validatebox">
</div>
<div class="fitem">
<label>:</label>
<input name="xqdz" class="easyui-validatebox">
</div>
<!-- <div class="fitem">
<label>:</label>
<select class="easyui-combobox" style="width: 126px;" name="sex"
data-options="
panelHeight:"auto",
valueField:"yhid",
textField:"yhmz",
url:"/xx.jyr/bcb/insertBcb.do"" style="width: 126px; height:40px" >
</select>
</div> -->
</form>
</div>
<div id="dlg-buttons">
<a href="-sharp" class="easyui-linkbutton" iconCls="icon-ok" onclick="saveUser()"></a>
<a href="-sharp" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$("-sharpdlg").dialog("close")">Cancel</a>
</div>
<script>
$("-sharpdg").datagrid({
url:"",
toolbar:"-sharptoolbar",
pagination:"true",
rownumbers:"true",
fitColumns:"true",
singleSelect:"true",
queryParams: form2Json("searchform"),
columns:[[
{field:"bcid",title:"id", hidden: true},
{field:"bjmc",title:"",width:100},
{field:"lsmc",title:"",width:100 },
{field:"bjks",title:"",width:100 },
{field:"bckk",title:"",width:100 },
{field:"bcsk",title:"",width:100 },
{field:"bczk",title:"",width:100 },
{field:"bcsx",title:"",width:100 },
{field:"xqdz",title:"",width:100 },
]]
});
function form2Json(id) {
var arr = $("-sharp" + id).serializeArray()
var jsonStr = "";
jsonStr += "{";
for (var i = 0; i < arr.length; iPP) {
jsonStr += """ + arr[i].name + "":"" + arr[i].value + "","
}
jsonStr = jsonStr.substring(0, (jsonStr.length - 1));
jsonStr += "}"
var json = JSON.parse(jsonStr)
return json
}
</script>
<script type="text/javascript">
var url;
function newUser(){
$("-sharpdlg").dialog("open").dialog("setTitle","");
$("-sharpfm").form("clear");
url = "/xx.jyr/bcb/insertBcb.do";
}
function editUser(){
var row = $("-sharpdg").datagrid("getSelected");
if (row){
$("-sharpdlg").dialog("open").dialog("setTitle","");
$("-sharpfm").form("load",row);
url = "/xx.jyr/bcb/gai.do?yhid="+row.yhid;
}
}
function saveUser(){
$("-sharpfm").form("submit",{
url: url,
onSubmit: function(){
return $(this).form("validate");
},
success: function(result){
if (result>0){
$.messager.alert("","");
$("-sharpdlg").dialog("close"); // close the dialog
$("-sharpdg").datagrid("reload"); // reload the user data
} else {
$.messager.alert("","");
}
}
});
}
function removeUser(){
var row = $("-sharpdg").datagrid("getSelected");
if (row){
$.messager.confirm("","?",function(r){
if (r){
$.post("/xx.jyr/bcb/shan.do",{id:row.yhid},function(result){
if (result>0){
$.messager.alert("","");
$("-sharpdg").datagrid("reload");
} else {
$.messager.alert("","");
}
},"json");
}
});
}
}
$("-sharpsubmit_search").click(function () {
$("-sharpdg").datagrid({ queryParams: form2Json("searchform") }); //
});
</script>
< / body >
< / html >
this is the control layer, adding and calling multiple tables is also the first time to do it.
sources of topics and their own ideas
related codes
/ / Please paste the code text below (do not replace the code with pictures)