| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415 |
- $(function(){
- //全选
- $("#CheckedAll").click(function(){
- //所有checkbox跟着全选的checkbox走。
- $('[name=items]:checkbox').attr("checked", this.checked );
- _btnStatus();
-
- });
- $('[name=items]:checkbox').click(function(){
- //定义一个临时变量,避免重复使用同一个选择器选择页面中的元素,提升程序效率。
- var $tmp=$('[name=items]:checkbox');
- //用filter方法筛选出选中的复选框。并直接给CheckedAll赋值。
- $('#CheckedAll').attr('checked',$tmp.length==$tmp.filter(':checked').length);
- _btnStatus();
- /*
- //一行做过多的事情需要写更多注释。复杂选择器还可能影响效率。因此不推荐如下写法。
- $('#CheckedAll').attr('checked',!$('[name=items]:checkbox').filter(':not(:checked)').length);
- */
- });
- //输出值
- $("#send").click(function(){
- var str="你选中的是:\r\n";
- $('[name=items]:checkbox:checked').each(function(){
- str+=$(this).val()+"\r\n";
- })
- //alert(str);
- });
- $("#Del").click(function(){
- // $("#dialogDel").dialog('open');
- });
-
-
- $("#dialogDel").dialog({
- buttons:[{
- text:'是',
- iconCls:'icon-ok',
- handler:function(){
- $('#dialogDel').dialog('close');
- del();
- }
- },{
- text:'否',
- handler:function(){
- $('#dialogDel').dialog('close');
- }
- }]
- });
-
- $('#dialogDel').dialog('close');
-
- });
- function initButtons(iNowPage,pages)
- {
- if (iNowPage==1)
- {
- $("#home").disabled=true;
- $("#last").disabled=true;
- }
- if(iNowPage==pages)
- {
- $("#end").disabled=true;
- $("#next").disabled=true;
- }
- }
- function noSourceExplorer()
- {
- if (event.button == 2 | event.button == 3)
- {
- alert("welcome use jbpm4.0");
- }
- }
- function showError()
- {
- var strError = new String;
- var err = source.parseError;
- strError = 'Error!\n' +
- 'file url: '+err.url +' \n'+
- 'line no.:'+err.line +'\n'+
- 'char: '+ err.linepos + '\n' +
- 'source: '+err.srcText+'\n'+
- 'code: '+err.errorCode+'\n'+
- 'description: '+err.reason+'\n';
- window.alert(strError);
- }
- function _btnStatus()
- {
- var $tmp=$('[name=items]:checkbox');
- length_=$tmp.filter(':checked').length;
- if (length_==0){
- $('[name=Del]').attr('disabled',true);
- }
- else
- {
- $('[name=Del]').attr('disabled',false);
- }
- }
- function isSelected()
- {
- var $tmp=$('[name=items]:checkbox');
- length_=$tmp.filter(':checked').length;
- if (length_==0){
- return false;
- }
- else
- {
- return true;
- }
- }
- function ShowTROut(tmpRow)
- {
- window.alert("000");
- tmpRow.CLASSNAME="tablerow2";
- }
- function ShowTROver(tmpRow)
- {
- tmpRow.CLASSNAME="tablerow";
- }
- function showCataDocs()
- {
- }
- function trim(str)
- {
- for(var i = 0 ; i<str.length && str.charAt(i)==" " ; i++ ) ;
- return str.substring(i,str.length);
- }
- function stringToSelect(str,field)
- {
- for(var beg=0 ; beg < str.length ; beg = end+1)
- {
- if(-1 == (end = str.indexOf(",",beg))) end = str.length;
- var entry = trim(str.substring(beg,end));
- if(entry!="") field.options[field.options.length++].text = entry;
- }
- }
- function selectToString(field)
- {
- if (field.length!=0)
- {
- var str = "";
- for(i=0 ; i < field.options.length-1 ; i++)
- str += field.options[i].text + ",";
- return str += field.options[i].text;
- }
- else return "";
- }
- function add()
- {
- add_=$('[name=addAppName]').val();
- //$(window.parent.document).find('#iframe-form').attr("src",add_);
- //location.href=add_;
- popup(add_);
- }
- function del_()
- {
- del_=$('[name=delAppName]').val();
- var str="";
- $('[name=items]:checkbox:checked').each(function(){
- str+=$(this).val()+";";
- })
- //alert(str);
- if (str=="") { return;}
- //id=window.confirm("删除操作,要继续吗?");
- //if (id ==false)
- //{
- // return;
- //}
- location.href=del_+"?v="+$('[name=appName]').val()+"&id="+str;
- }
- var recordId;
- var trId;
- function dlgDel(id,tr_id){
- recordId=id;
- trId=tr_id;
- $("#dialogDel").dialog('open');
- }
- function del()
- {
- $.ajax({
- type:'GET',
- dataType:'string',
- url:$('[name=delAppName]').val()+'?id='+recordId,
- cache:false,
- error:function(data){
- $("#errInfo").info("操作没有完成!");
- },
- success:function(data){
- delTr();
- $("#errInfo").info("操作完成!");
- }
- });
- }
- function delTr(){
- //alert(trId);
- $("#tr"+trId).remove();
- }
- function getSelectIds()
- {
- var str="";
- $('[name=items]:checkbox:checked').each(function(){
- str+=$(this).val()+";";
- })
- //alert(str);
- return str;
- }
- function commCmd(a,id){
- alert(a+"=================="+id);
- }
- function edit(id)
- {
- var edit_=$('[name=editAppName]').val();
- if (edit_=="-" || edit_=="null")
- {
- window.alert("禁止操作");
- return("" );
- }
- //$(window.parent.document).find('#iframe-form').attr("src",edit_+"?id="+id);
- popup(edit_+"?id="+id);
- //location.href=edit_+"?id="+id;
- }
- function see(id)
- {
- var edit_=$('[name=seeAppName]').val();
- if (edit_=="-" || edit_=="null")
- {
- window.alert("禁止操作");
- return("" );
- }
- //$(window.parent.document).find('#iframe-form').attr("src",edit_+"?id="+id);
- popup(edit_+"?id="+id);
- // location.href=edit_+"?id="+id;
- }
- function homePage()
- {
- engineName=document.ViewForm.engineName.value;
- catKey=document.ViewForm.catKeyName.value;
- findKey=document.ViewForm.findKey.value;
- p=Number(document.ViewForm.iNowPage.value);
- if (p==1) {return false};
- var url=engineName+"?p=1&c="+catKey+"&k="+findKey;
- document.ViewForm.action=url;
- document.ViewForm.submit();
- }
- function lastPage()
- {
- engineName=$('[name=engineName]').val();
- catKey=$('[name=catKeyName]').val();
- findKey=$('[name=findKey]').val();
- iNowPage=$('[name=iNowPage]').val();
- p=Number(iNowPage);
- if (p==1) {return false};
- p--;
- var url= engineName+"?p="+p+"&c="+catKey+"&k="+findKey;
- document.ViewForm.action=url;
- document.ViewForm.submit();
- }
- function nextPage()
- {
- engineName=$('[name=engineName]').val();
- catKey=$('[name=catKeyName]').val();
- findKey=$('[name=findKey]').val();
- iNowPage=$('[name=iNowPage]').val();
- pages=Number($('[name=pages]').val());
- iStart=$('[name=iStart]').val();
- p=Number(iNowPage);
- if (p==pages)
- {
- return("");
- }
- p++;
- var url=engineName+"?p="+p+"&c="+catKey+"&k="+findKey;
- document.ViewForm.action=url;
- document.ViewForm.submit();
- }
- function endPage()
- {
- engineName=document.ViewForm.engineName.value;
- catKey=document.ViewForm.catKeyName.value;
- findKey=document.ViewForm.findKey.value;
- p=Number(document.ViewForm.iNowPage.value);
- pages=Number(document.ViewForm.pages.value);
- if (p==pages)
- {
- return("");
- }
- var url= engineName+"?p="+pages+"&c="+catKey;
- document.ViewForm.action=url;
- document.ViewForm.submit();
- }
- function jumpPage()
- {
- jump=document.ViewForm.jump.value;
- var patrn=/^\d+$/;
- if(!patrn.test(jump)) {
- alert("请输入数字");
- return false;
- }
- engineName=document.ViewForm.engineName.value;
-
- p=Number(jump);
- pages=Number(document.ViewForm.pages.value);
- if(p==0) p=1;
- if (p>pages) p=pages;
- url="?p="+p;
- location.href=url;
- }
- function selectCat()
- {
- engineName=document.ViewForm.engineName.value;
- appName=document.ViewForm.appName.value;
- rows=document.ViewForm.rows.value;
- var tmp=$('[name=CatKey]').val();
- //alert(tmp)
- if (tmp=="")
- {
- window.alert('没有分类');
- return;
- }
- var url= engineName+"?v="+appName;
- url=url+"&c="+tmp;
- url=url+"&rows="+rows;
- location.href=url;
- }
- function selectRow()
- {
- engineName=document.ViewForm.engineName.value;
- appName=document.ViewForm.appName.value;
- var url= engineName+"?v="+appName;
- var rows =$('[name=Rows]').val();
- url=url+"&rows="+rows;
- document.ViewForm.action=url;
- document.ViewForm.submit();
- }
- function expandAction(code)
- {
- if (isSelected())
- {
- var tmp=code+"?ids="+getSelectIds();
- //location.href=tmp;
- $(window.parent.document).find('#iframe-form').attr("src",tmp);
- }
- }
- function search()
- {
- appName=ViewForm.appName.value;
- sending.style.visibility="visible";
- location.href=
- ("list.do?v="+appName+"&FindKey="+ViewForm.SearchInput.value)
- }
- function tr1(o1,num){
- o=document.all("tmpDelete"+num);
- if (!o.checked) o1.className="tr2";
- }
- function tr2(o1,num){
- o=document.all("tmpDelete"+num);
- if (!o.checked) o1.className="tr1";
- }
- function selectCheck(o1,num){
- recNums=ViewForm.recNums.value;
- iCount=ViewForm.iCount.value;
- selectSingleCheckBox(o1,num);
- refreshButton(recNums,iCount);
- }
- function find(){
- //alert("============");
- appName=document.ViewForm.appName.value;
- url="li.do?v="+appName+"&k="+$("#keyWord").val();
- location.href=url;
- }
- function find_(){
- appName=ViewForm.appName.value;
- //sending.style.visibility="visible";
- location.href="content/searchframe.jsp?v="+appName;
- }
- function popup(url)
- {
- var width = 700;
- var height = 510;
- var left = (screen.width - width)/2;
- var top = (screen.height - height)/2;
- var params = 'width='+width+', height='+height;
- params += ', top='+top+', left='+left;
- params += ', directories=no';
- params += ', location=no';
- params += ', menubar=no';
- params += ', resizable=yes';
- params += ', scrollbars=no';
- params += ', status=no';
- params += ', toolbar=no';
- newwin=window.open(url,'window123', params);
- if (window.focus) {newwin.focus()}
- return false;
- }
|