前端时间需要写这个功能。主要思路是利用dwz自带的单个修改和批量删除功能。批量删除功能通过ajax,没有弹出dialog对话框,所以要结合一下。
<li><a class="edit" title="单价修改" href="${path}/fwxxwh/form" rel="ids" target="pldialog" mask=true maxable=true minable=true resizable=true drawable=true height="350" ><span>单价批量修改</span></a></li>
修改dwz.min.js 在$("a[target=dialog]",$p).each(function(){ 前面加上下面的代码,下面的代码 由 dialog和selectedTodo(批量删除,通过ajax) 组成。
function _getIds(selectedIds){
var ids="";
var targetType="";
var $box=targetType=="dialog"?$.pdialog.getCurrent():navTab.getCurrentPanel();
$box.find("input:checked").filter("[name='"+selectedIds+"']").each(function(i){
var val=$(this).val();
ids+=i==0?val:","+val;});
return ids;}
$("a[target=pldialog]",$p).each(function(){
var $this=$(this);
var selectedIds=$this.attr("rel")||"ids";
$(this).click(function(event){
var ids=_getIds(selectedIds);
alert(ids);
if(!ids){
alertMsg.error($this.attr("warn")||DWZ.msg("alertSelectMsg"));
return false;}
var $this=$(this);
var title=$this.attr("title")||$this.text();
var rel=$this.attr("rel")||"_blank";
var options={};
var w=$this.attr("width");
var h=$this.attr("height");
if(w)options.width=w;
if(h)options.height=h;
options.max=eval($this.attr("max")||"false");
options.mask=eval($this.attr("mask")||"false");
options.maxable=eval($this.attr("maxable")||"true");
options.minable=eval($this.attr("minable")||"true");
options.fresh=eval($this.attr("fresh")||"true");
options.resizable=eval($this.attr("resizable")||"true");
options.drawable=eval($this.attr("drawable")||"true");
options.close=eval($this.attr("close")||"");
options.param=$this.attr("param")||"";
var url=unescape($this.attr("href")+"/"+ids).replaceTmById($(event.target).parents(".unitBox:first"));
DWZ.debug(url);
if(!url.isFinishedTm()){
alertMsg.error($this.attr("warn")||DWZ.msg("alertSelectMsg"));
return false;}
$.pdialog.open(url,rel,title,options);
return false;});});