1:html代码:html
<div id="manufactureTableToolBar"> <a href="#" onclick="showManufactureDialog()" class="easyui-linkbutton" data-options="iconCls:'icon-edit',plain:true">新增</a> </div> <div id="manufactureModal" class="easyui-dialog" title="My Dialog" style="width:600px; height:700px;" data-options="modal:true,buttons:'#manufactureDialogButtons',closed:true,"> <div class="dialog-body"> <form id="manufactureForm" method="post" style="padding-left:20px"> <input type="hidden" name="id" id="idHidden"> <input type="hidden" name="manufactureImage" id="manufactureImageHidden"> <table class="formtable"> <tr style="height:50px;"> <td><label for="manufactureName">制造商名称:</label></td> <td><input type="text" name="manufactureName" class="easyui-textbox" data-options="width:250,required:true,validType:['length[0,200]']" /></td> </tr> <tr style="height:50px;"> <td><label for="manufactureNameEn">制造商英文名称:</label></td> <td><input type="text" name="manufactureNameEn" class="easyui-textbox" data-options="width:250,validType:['length[0,200]']" /></td> </tr> <tr style="height:50px;"> <td><label for="manufactureWebsite">制造商网站:</label></td> <td><input type="text" name="manufactureWebsite" class="easyui-textbox" data-options="width:250,validType:['length[0,500]']" /></td> </tr> <tr style="height:100px;"> <td><label for="manufactureImage">制造商图片:</label></td> <td> <input id="manufactureImageFileInput" type="file"/> <img src="" style="display:none;width:100px;height:100px;" id="manufactureImageShow" class="tip"/> </td> </tr> <tr style="height:50px;"> <td><label for="status">状态:</label></td> <td> <select id="statusOptionForSaveOrUpdate" class="easyui-combobox" name="status" data-options="width:250,required:true"> <option value="-1">----请选择----</option> <option value="0">未激活</option> <option value="1">已激活</option> </select> </td> </tr> <tr style="height:50px;"> <td><label for="manufactureWebsite">商品分类:</label></td> <td><ul id="categoryListTree" class="easyui-tree" data-options="url:'${rc.contextPath}/category/getCategoryList.html?parentId=0',checkbox:true"></ul></td> </tr> </table> <div id="manufactureDialogButtons"> <a href="#" id="btnSaveManufacture" data-options="iconCls:'icon-save'" onclick="submitManufactureForm()" class="easyui-linkbutton">确认</a> <a href="#" id="backbtn" onclick="closeManufactureDialog()" class="easyui-linkbutton" data-options="iconCls:'icon-cancel'" >取消</a> </div> </form> </div> </div>
2:js代码:ide
function showManufactureDialog(rowIndex, rowData) { var manufactureModal = $('#manufactureModal'); var manufactureForm = $('#manufactureForm'); var manufactureImageShow=$("#manufactureImageShow"); if (rowData) { manufactureModal.dialog({ title : "编辑制造商" }); manufactureForm.form('load', rowData); manufactureImageShow.attr("src",rowData.manufactureImage); manufactureImageShow.show(); } else { manufactureModal.dialog({ title : "新增制造商" }); manufactureForm.form('clear'); manufactureImageShow.attr("src",""); manufactureImageShow.hide(); } //获取分类选项并选中它 selectedCategory(rowData); manufactureModal.dialog("open"); }