| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203 |
- // update--begin--author:zhangjiaqiang date:20170621 for:如何避免console.log引起javascript的兼容问题
- if(!window.console){
- window.console = {};
- }
- if(!window.console.log){
- window.console.log = function(msg){};
- }
- // update--end--author:zhangjiaqiang date:20170621 for:如何避免console.log引起javascript的兼容问题
- //update-begin--Author:scott --- Date:20170401 --- for:inputclick ajax请求追加根路径,防止深路径访问有问题----
- var basePath;
- try{
- var local = window.location;
- var contextPath = local.pathname.split("/")[1];
- basePath = local.protocol+"//"+local.host+"/"+contextPath;
- //alert(basePath);
- }catch(e){}
- //update-end--Author:scott --- Date:20170401 --- for:inputclick ajax请求追加根路径,防止深路径访问有问题----
- //var jq = jQuery.noConflict();
- /**
- * 增删改工具栏
- */
- /*window.onerror = function() {
- return true;
- };*/
- var iframe;// iframe操作对象
- var win;//窗口对象
- var gridname="";//操作datagrid对象名称
- //scott 20160426 JS异常报错
- var windowapi;
- var W;
- try {
- windowapi = frameElement.api, W = windowapi.opener;//内容页中调用窗口实例对象接口
- } catch (e) {
- }
- /**
- * 设置 window的 zIndex
- * @param flag true: 不增量(因为 tip提示经常使用 zIndex, 所以如果是 tip的话 ,则不增量)
- * @returns
- */
- function getzIndex(flag){
- var zindexNumber = getCookie("ZINDEXNUMBER");
- if(zindexNumber == null){
- zindexNumber = 2010;
- setCookie("ZINDEXNUMBER",zindexNumber);
- //zindexNumber = 1980;
- }else{
- if(zindexNumber < 2010){
- zindexNumber = 2010;
- }
- var n = flag?zindexNumber:parseInt(zindexNumber) + parseInt(10);
- setCookie("ZINDEXNUMBER",n);
- }
- return zindexNumber;
- }
- function upload(curform) {
- upload();
- }
- /**
- * 添加事件打开窗口
- * @param title 编辑框标题
- * @param addurl//目标页面地址
- */
- function add(title,addurl,gname,width,height) {
- gridname=gname;
- createwindow(title, addurl,width,height);
- }
- /**
- * 树列表添加事件打开窗口
- * @param title 编辑框标题
- * @param addurl//目标页面地址
- */
- function addTreeNode(title,addurl,gname) {
- if (rowid != '') {
- addurl += '&id='+rowid;
- }
- gridname=gname;
- createwindow(title, addurl);
- }
- /**
- * 更新事件打开窗口
- * @param title 编辑框标题
- * @param addurl//目标页面地址
- * @param id//主键字段
- */
- //update-begin--Author:luobaoli Date:20150705 for:增加了一个判断是否需要转换为restful风格URL的参数,如果该参数为true,那么转换为restful风格
- function update(title,url, id,width,height,isRestful) {
- gridname=id;
- var rowsData = $('#'+id).datagrid('getSelections');
- if (!rowsData || rowsData.length==0) {
- tip('请选择编辑项目');
- return;
- }
- if (rowsData.length>1) {
- tip('请选择一条记录再编辑');
- return;
- }
- if(isRestful!='undefined'&&isRestful){
- url += '/'+rowsData[0].id;
- }else{
- url += '&id='+rowsData[0].id;
- }
- createwindow(title,url,width,height);
- }
- //update-end--Author:luobaoli Date:20150705 for:增加了一个判断是否需要转换为restful风格URL的参数,如果该参数为true,那么转换为restful风格
- /**
- * 如果页面是详细查看页面,无效化所有表单元素,只能进行查看
- */
- $(function(){
- Array.prototype.removeItem = function(val) {
- var index = this.indexOf(val);
- if (index > -1) {
- this.splice(index, 1);
- }
- };
- // https://tc39.github.io/ecma262/#sec-array.prototype.includes
- if (!Array.prototype.includes) {
- Object.defineProperty(Array.prototype, 'includes', {
- value: function(searchElement, fromIndex) {
- // 1. Let O be ? ToObject(this value).
- if (this == null) {
- throw new TypeError('"this" is null or not defined');
- }
- var o = Object(this);
- // 2. Let len be ? ToLength(? Get(O, "length")).
- var len = o.length >>> 0;
- // 3. If len is 0, return false.
- if (len === 0) {
- return false;
- }
- // 4. Let n be ? ToInteger(fromIndex).
- // (If fromIndex is undefined, this step produces the value 0.)
- var n = fromIndex | 0;
- // 5. If n ≥ 0, then
- // a. Let k be n.
- // 6. Else n < 0,
- // a. Let k be len + n.
- // b. If k < 0, let k be 0.
- var k = Math.max(n >= 0 ? n : len - Math.abs(n), 0);
- // 7. Repeat, while k < len
- while (k < len) {
- // a. Let elementK be the result of ? Get(O, ! ToString(k)).
- // b. If SameValueZero(searchElement, elementK) is true, return true.
- // c. Increase k by 1.
- // NOTE: === provides the correct "SameValueZero" comparison needed here.
- if (o[k] === searchElement) {
- return true;
- }
- k++;
- }
- // 8. Return false
- return false;
- }
- });
- }
- if(location.href.indexOf("load=detail")!=-1){
- $(":input").attr("disabled","true");
- $(".easyui-linkbutton").hide();
- $(".requiredIcon").hide();
- //$(":input").attr("style","border:0;border-bottom:1 solid black;background:white;");
- }
- try{
- //--author:zhaohualong-----start----date: 2017年10月11日--------for:-----easyui拓展方法:动态添加editor
- $.extend($.fn.datagrid.methods, {
- addEditor : function(jq, param) {
- if (param instanceof Array) {
- $.each(param, function(index, item) {
- var e = $(jq).datagrid('getColumnOption', item.field);
- e.editor = item.editor;
- });
- } else {
- var e = $(jq).datagrid('getColumnOption', param.field);
- e.editor = param.editor;
- }
- },
- removeEditor : function(jq, param) {
- if (param instanceof Array) {
- $.each(param, function(index, item) {
- var e = $(jq).datagrid('getColumnOption', item);
- e.editor = {};
- });
- } else {
- var e = $(jq).datagrid('getColumnOption', param);
- e.editor = {};
- }
- }
- });
- //--author:zhaohualong-----end----date: 2017年10月11日--------for:-----easyui拓展方法:动态添加editor
- //--author:zhaohualong-----start----date:20170906--------for:------初始化editor
- $.extend($.fn.datagrid.defaults.editors, {
- text: {
- init: function (container, options) {
- if(!options){
- options = {};
- }
- var input = $('<input type="text"></input>').validatebox(options).appendTo(container);
- return input;
- },
- destroy: function (target) {
- },
- getValue: function (target) {
- return $(target).val();
- },
- setValue: function (target, value) {
- return $(target).val(value);//获得旧值
- },
- resize : function(target, width) {
- var input = $(target);
- if ($.boxModel == true) {
- input.width(width - (input.outerWidth() - input.width()));
- } else {
- input.width(width);
- }
- }
- },
- WdateboxTime: {
- init: function (container, options) {
- if(!options){
- options = {};
- }
- var input = $(' <input type="text" class="Wdate" onClick=\'WdatePicker({readOnly:true,enableKeyboard:false,enableInputMask:false,dateFmt: "yyyy-MM-dd HH:mm"})\' />').appendTo(container);
- return input;
- },
- destroy: function (target) {
- },
- getValue: function (target) {
- return $(target).val();
- },
- setValue: function (target, value) {
- value = new Date().format('yyyy-MM-dd hh:mm',value);
- return $(target).val(value);//获得旧值
- },
- resize : function(target, width) {
- var input = $(target);
- if ($.boxModel == true) {
- input.width(width - (input.outerWidth() - input.width()));
- } else {
- input.width(width);
- }
- }
- },
- AttendWdateboxTime: {
- init: function (container, options) {
- if(!options){
- options = {};
- }
- var minDate= "1900-01-01 00:00:00";
- var maxDate="2099-12-31 23:59:59";
- if(undefined!=options.minDate&&''!=options.minDate){
- minDate= options.minDate;
- }
- if(undefined!=options.maxDate&&''!=options.maxDate){
- maxDate = options.maxDate;
- }
- var input = $(' <input type="text" class="Wdate" onClick=\'WdatePicker({readOnly:true,minDate: "'+minDate+'",maxDate: "'+maxDate+'",dateFmt: "yyyy-MM-dd HH:mm"})\' />').appendTo(container);
- return input;
- },
- destroy: function (target) {
- },
- getValue: function (target) {
- return $(target).val();
- },
- setValue: function (target, value) {
- value = new Date().format('yyyy-MM-dd hh:mm',value);
-
- return $(target).val(value);//获得旧值
- },
- resize : function(target, width) {
- var input = $(target);
- if ($.boxModel == true) {
- input.width(width - (input.outerWidth() - input.width()));
- } else {
- input.width(width);
- }
- }
- },
- WdateboxDay: {
- init: function (container, options) {
- if(!options){
- options = {};
- }
- var input = $(' <input type="text" class="Wdate" onClick=\'WdatePicker({readOnly:true,enableKeyboard:false,enableInputMask:false,dateFmt: "yyyy-MM-dd"})\' />').appendTo(container);
- return input;
- },
- destroy: function (target) {
- },
- getValue: function (target) {
- return $(target).val();
- },
- setValue: function (target, value) {
- value = new Date().format('yyyy-MM-dd',value);
- return $(target).val(value);//获得旧值
- },
- resize : function(target, width) {
- var input = $(target);
- if ($.boxModel == true) {
- input.width(width - (input.outerWidth() - input.width()));
- } else {
- input.width(width);
- }
- }
- },
- WdateboxMonth: {
- init: function (container, options) {
- if(!options){
- options = {};
- }
- var input = $(' <input type="text" class="Wdate" onClick=\'WdatePicker({readOnly:true,enableKeyboard:false,enableInputMask:false,dateFmt: "yyyy-MM"})\' />').validatebox(options).appendTo(container);
- return input;
- },
- destroy: function (target) {
- },
- getValue: function (target) {
- return $(target).val();
- },
- setValue: function (target, value) {
- value = new Date().format('yyyy-MM',value);
- return $(target).val(value);//获得旧值
- },
- resize : function(target, width) {
- var input = $(target);
- if ($.boxModel == true) {
- input.width(width - (input.outerWidth() - input.width()));
- } else {
- input.width(width);
- }
- }
- },
- WdateboxYear: {
- init: function (container, options) {
- if(!options){
- options = {};
- }
- var input = $(' <input type="text" class="Wdate" onClick=\'WdatePicker({readOnly:true,enableKeyboard:false,enableInputMask:false,dateFmt: "yyyy"})\' />').validatebox(options).appendTo(container);
- return input;
- },
- destroy: function (target) {
- },
- getValue: function (target) {
- return $(target).val();
- },
- setValue: function (target, value) {
- value = new Date().format('yyyy',value);
- return $(target).val(value);//获得旧值
- },
-
- },
- });
- //--author:zhaohualong-----start----date:20170906--------for:------初始化editor
-
- }catch(e){
-
- }
-
- });
- /**
- * 查看详细事件打开窗口
- * @param title 查看框标题
- * @param addurl//目标页面地址
- * @param id//主键字段
- */
- function detail(title,url, id,width,height) {
- var rowsData = $('#'+id).datagrid('getSelections');
- // if (rowData.id == '') {
- // tip('请选择查看项目');
- // return;
- // }
-
- if (!rowsData || rowsData.length == 0) {
- tip('请选择查看项目');
- return;
- }
- if (rowsData.length > 1) {
- tip('请选择一条记录再查看');
- return;
- }
- url += '&load=detail&id='+rowsData[0].id;
- createdetailwindow(title,url,width,height);
- }
- /**
- * 多记录刪除請求
- * @param title
- * @param url
- * @param gname
- * @return
- */
- function deleteALLSelect(title,url,gname) {
- gridname=gname;
- var ids = [];
- var rows = $("#"+gname).datagrid('getSelections');
- if (rows.length > 0) {
- $.dialog.setting.zIndex = getzIndex(true);
- $.dialog.confirm('你确定永久删除该数据吗?', function(r) {
- if (r) {
- for ( var i = 0; i < rows.length; i++) {
- ids.push(rows[i].id);
- }
- $.ajax({
- url : url,
- type : 'post',
- data : {
- ids : ids.join(',')
- },
- cache : false,
- success : function(data) {
- var d = data; // ------ $.parseJSON(data);
- if (d.success) {
- var msg = d.msg;
- tip(msg);
- reloadTable();
- $("#"+gname).datagrid('unselectAll');
- ids='';
- }
- }
- });
- }
- });
- } else {
- tip("请选择需要删除的数据");
- }
- }
- /**
- * 查看时的弹出窗口
- *
- * @param title
- * @param addurl
- * @param saveurl
- */
- function createdetailwindow(title, addurl,width,height) {
- width = width?width:700;
- height = height?height:400;
- if(width=="100%" ){
- width = window.top.document.body.offsetWidth;
- }
- if(height=="100%"){
- height =window.top.document.body.offsetHeight-100;
- }
- if(typeof(windowapi) == 'undefined'){
- $.dialog({
- content: 'url:'+addurl,
- zIndex: getzIndex(),
- lock : true,
- width:width,
- height: height,
- title:title,
- opacity : 0.3,
- cache:false,
- cancelVal: '关闭',
- cancel: true /*为true等价于function(){}*/
- });
- }else{
- //update-begin--Author:xuelin Date:20170421 for:#1804 【体验】需要选中行数据,点击阅读才弹出页面--------------------
- W.$.dialog({
- content: 'url:'+addurl,
- zIndex: getzIndex(),
- lock : true,
- width:width,
- height: height,
- parent:windowapi,
- title:title,
- opacity : 0.3,
- cache:false,
- cancelVal: '关闭',
- cancel: function(){
- windowapi.zindex();
- }
- //cancel:true /*为true等价于function(){}*/
- });
- //update-end--Author:xuelin Date:20170421 for:#1804 【体验】需要选中行数据,点击阅读才弹出页面----------------------
- }
-
- }
- /**
- * 全屏编辑
- * @param title 编辑框标题
- * @param addurl//目标页面地址
- * @param gridname//datagrid id
- */
- function editfs(title,url,gridname) {
- var name=gridname;
- var rowsData = $('#'+name).datagrid('getSelections');
- if (!rowsData || rowsData.length==0) {
- tip('请选择编辑项目');
- return;
- }
- if (rowsData.length>1) {
- tip('请选择一条记录再编辑');
- return;
- }
- url += '&id='+rowid;
- //update-begin--Author:scott --- Date:20170406 --- for:弹出窗口最大化问题处理----
- width = window.top.document.body.offsetWidth;
- height =window.top.document.body.offsetHeight-100;
- openwindow(title,url,name,width,height);
- //update-end--Author:scott --- Date:20170406 --- for:弹出窗口最大化问题处理----
- }
- // 删除调用函数
- function delObj(url,name) {
- gridname=name;
- createdialog('删除确认 ', '确定删除该记录吗 ?', url,name);
- }
- // 删除调用函数
- function confuploadify(url, id) {
- $.dialog.setting.zIndex = getzIndex(true);
- $.dialog.confirm('确定删除吗', function(){
- deluploadify(url, id);
- }, function(){
- });
- }
- /**
- * 执行删除附件
- *
- * @param url
- * @param index
- */
- function deluploadify(url, id) {
- $.ajax({
- async : false,
- cache : false,
- type : 'POST',
- url : url,// 请求的action路径
- error : function() {// 请求失败处理函数
- },
- success : function(data) {
- var d = data; // ------ $.parseJSON(data);
- if (d.success) {
- $("#" + id).remove();// 移除SPAN
- m.remove(id);// 移除MAP对象内字符串
- }
- }
- });
- }
- // 普通询问操作调用函数
- function confirm(url, content,name) {
- createdialog('提示信息 ', content, url,name);
- }
- /**
- * 提示信息
- */
- function tip_old(msg) {
- $.dialog.setting.zIndex = getzIndex(true);
- $.dialog.tips(msg, 1);
- }
- /**
- * 提示信息
- */
- function tip(msg) {
- try{
- $.dialog.setting.zIndex = getzIndex(true);
- //update--begin--author:zhangjiaqiang Date:20170227 for:更新提示框
- var navigatorName = "Microsoft Internet Explorer";
- //update--begin--author:taoYan Date:20170628 for:default/shortcut提示用原风格---
- if(navigator.appName == navigatorName||"default,shortcut".indexOf(getCookie("JEECGINDEXSTYLE"))>=0){
- //update--end--author:taoYan Date:20170628 for:default/shortcut提示用原风格---
- $.messager.show({
- title : '提示信息',
- msg : msg,
- timeout : 1000 * 6
- });
- }else{
- var icon = 7;
- if(msg.indexOf("成功") > -1){
- icon = 1;
- }else if(msg.indexOf("失败") > -1){
- icon = 2;
- }
- layer.open({
- title:'提示信息',
- offset:'rb',
- content:msg,
- time:3000,
- btn:false,
- shade:false,
- icon:icon,
- shift:2
- });
- }
- //update--begin--author:zhangjiaqiang Date:20170227 for:更新提示框
- }catch(e){
- alertTipTop(msg,'10%');
- }
- }
- /**
- * Layer风格alert提示
- */
- function alerLayerTip(msg) {
- if(msg==null || msg==''){
- msg = "系统异常,请看系统日志!";
- }
- try{
- var navigatorName = "Microsoft Internet Explorer";
- //update--begin--author:zhangjiaqiang date:20170711 for:TASK 2218 shortcut风格 使用jqueryui对话框
- if( navigator.appName == navigatorName ||"shortcut".indexOf(getCookie("JEECGINDEXSTYLE"))>=0){
- //update--end--author:zhangjiaqiang date:20170711 for:TASK 2218 shortcut风格 使用jqueryui对话框
- $.messager.alert('提示信息',msg);
- }else{
- layer.open({
- title:'提示信息',
- content:msg,
- time:6000,
- btn:false,
- shade:false,
- icon:2
- });
- }
- }catch(e){
- alertTipTop(msg,'10%');
- }
- }
- function alertTipTop(msg,top,title) {
- $.dialog.setting.zIndex = getzIndex(true);
- title = title?title:"提示信息";
- $.dialog({
- title:title,
- zIndex: getzIndex(),
- icon:'tips.gif',
- top:top,
- content: msg
- });
- }
- /**
- * 提示信息像alert一样
- */
- function alertTip(msg,title) {
- $.dialog.setting.zIndex = getzIndex(true);
- title = title?title:"提示信息";
- $.dialog({
- title:title,
- zIndex: getzIndex(),
- icon:'tips.gif',
- content: msg
- });
- }
- /**
- * 创建添加或编辑窗口
- *
- * @param title
- * @param addurl
- * @param saveurl
- */
- function createwindow(title, addurl,width,height) {
- width = width?width:700;
- height = height?height:400;
- if(width=="100%" ){
- width = window.top.document.body.offsetWidth;
- }
- if( height=="100%"){
- height =window.top.document.body.offsetHeight-100;
- }
- //--author:JueYue---------date:20140427---------for:弹出bug修改,设置了zindex()函数
- if(typeof(windowapi) == 'undefined'){
- $.dialog({
- content: 'url:'+addurl,
- lock : true,
- zIndex: getzIndex(),
- width:width,
- height:height,
- title:title,
- opacity : 0.3,
- cache:false,
- ok: function(){
- iframe = this.iframe.contentWindow;
- saveObj();
- return false;
- },
- cancelVal: '关闭',
- cancel: true /*为true等价于function(){}*/
- });
- }else{
- //update-begin--Author:xuelin Date:20170705 for:TASK #2196 【bug】云桌面问题--------------------
- /*W.*/$.dialog({//使用W,即为使用顶级页面作为openner,造成打开的次级窗口获取不到关联的主窗口
- content: 'url:'+addurl,
- lock : true,
- width:width,
- zIndex:getzIndex(),
- height:height,
- parent:windowapi,
- title:title,
- opacity : 0.3,
- cache:false,
- ok: function(){
- iframe = this.iframe.contentWindow;
- saveObj();
- return false;
- },
- cancelVal: '关闭',
- cancel: true /*为true等价于function(){}*/
- });
- //update-end--Author:xuelin Date:20170705 for:TASK #2196 【bug】云桌面问题----------------------
- }
- //--author:JueYue---------date:20140427---------for:弹出bug修改,设置了zindex()函数
-
- }
- //--author:zhaohualong---------date:20170801---------for:弹出窗口优化,屏蔽确定取消按钮
- /**
- * 关闭当前窗口参数,可传入回调函数
- */
- function closeCurrentDialog(callback){
- frameElement.api.close();
- if(typeof callback!="undefined"){
- callback();
- }
- }
- /**
- * 创建无确定取消按钮的窗口
- *
- * @param title 窗口标题
- * @param url 窗口内url
- * @param width 窗口宽度
- * @param height 窗口高度
- */
- function createwindowWithoutSavebtn(title, addurl,width,height) {
- width = width?width:700;
- height = height?height:400;
- if(width=="100%" || height=="100%"){
- width = window.top.document.body.offsetWidth;
- height =window.top.document.body.offsetHeight-100;
- }
- if(typeof(windowapi) == 'undefined'){
- $.dialog({
- content: 'url:'+addurl,
- lock : true,
- zIndex: getzIndex(),
- width:width,
- height:height,
- title:title,
- opacity : 0.3,
- cache:false,
- /*为true等价于function(){}*/
- });
- }else{
- /*W.*/$.dialog({//使用W,即为使用顶级页面作为openner,造成打开的次级窗口获取不到关联的主窗口
- content: 'url:'+addurl,
- lock : true,
- width:width,
- zIndex:getzIndex(),
- height:height,
- parent:windowapi,
- title:title,
- opacity : 0.3,
- cache:false,
- });
- }
-
- }
- //--author:zhaohualong---------date:20170801---------for:弹出窗口优化,屏蔽确定取消按钮
- /**
- * 创建上传页面窗口
- *
- * @param title
- * @param addurl
- * @param saveurl
- */
- function openuploadwin(title, url,name,width, height) {
- gridname=name;
- $.dialog({
- content: 'url:'+url,
- zIndex: getzIndex(),
- cache:false,
- button: [
- {
- name: "开始上传",
- callback: function(){
- iframe = this.iframe.contentWindow;
- iframe.upload();
- return false;
- },
- focus: true
- },
- {
- name: "取消上传",
- callback: function(){
- iframe = this.iframe.contentWindow;
- iframe.cancel();
- }
- }
- ]
- });
- }
- /**
- * 创建查询页面窗口
- *
- * @param title
- * @param addurl
- * @param saveurl
- */
- function opensearchdwin(title, url, width, height) {
- $.dialog({
- content: 'url:'+url,
- zIndex: getzIndex(),
- title : title,
- lock : true,
- height : height,
- cache:false,
- width : width,
- opacity : 0.3,
- button : [ {
- name : '查询',
- callback : function() {
- iframe = this.iframe.contentWindow;
- iframe.searchs();
- },
- focus : true
- }, {
- name : '取消',
- callback : function() {
- }
- } ]
- });
- }
- /**
- * 创建不带按钮的窗口
- *
- * @param title
- * @param addurl
- * @param saveurl
- */
- function openwindow(title, url,name, width, height) {
- //update-begin--Author:scott --- Date:20170406 --- for:弹出窗口最大化问题处理----
- if(width=="100%" || height=="100%"){
- width = window.top.document.body.offsetWidth;
- height =window.top.document.body.offsetHeight-100;
- }
- //update-end--Author:scott --- Date:20170406 --- for:弹出窗口最大化问题处理----
- gridname=name;
- if (typeof (width) == 'undefined'&&typeof (height) != 'undefined')
- {
- if(typeof(windowapi) == 'undefined'){
- $.dialog({
- content: 'url:'+url,
- zIndex: getzIndex(),
- title : title,
- cache:false,
- lock : true,
- width: 'auto',
- height: height
- });
- }else{
- $.dialog({
- content: 'url:'+url,
- zIndex: getzIndex(),
- title : title,
- cache:false,
- parent:windowapi,
- lock : true,
- width: 'auto',
- height: height
- });
- }
- }
- if (typeof (height) == 'undefined'&&typeof (width) != 'undefined')
- {
- if(typeof(windowapi) == 'undefined'){
- $.dialog({
- content: 'url:'+url,
- title : title,
- zIndex: getzIndex(),
- lock : true,
- width: width,
- cache:false,
- height: 'auto'
- });
- }else{
- $.dialog({
- content: 'url:'+url,
- zIndex: getzIndex(),
- title : title,
- lock : true,
- parent:windowapi,
- width: width,
- cache:false,
- height: 'auto'
- });
- }
- }
- if (typeof (width) == 'undefined'&&typeof (height) == 'undefined')
- {
- if(typeof(windowapi) == 'undefined'){
- $.dialog({
- content: 'url:'+url,
- zIndex: getzIndex(),
- title : title,
- lock : true,
- width: 'auto',
- cache:false,
- height: 'auto'
- });
- }else{
- $.dialog({
- content: 'url:'+url,
- zIndex: getzIndex(),
- title : title,
- lock : true,
- parent:windowapi,
- width: 'auto',
- cache:false,
- height: 'auto'
- });
- }
- }
-
- if (typeof (width) != 'undefined'&&typeof (height) != 'undefined')
- {
- if(typeof(windowapi) == 'undefined'){
- $.dialog({
- width: width,
- height:height,
- content: 'url:'+url,
- zIndex: getzIndex(),
- title : title,
- cache:false,
- lock : true
- });
- }else{
- $.dialog({
- width: width,
- height:height,
- content: 'url:'+url,
- zIndex: getzIndex(),
- parent:windowapi,
- title : title,
- cache:false,
- lock : true
- });
- }
- }
- }
- /**
- * 创建询问窗口
- *
- * @param title
- * @param content
- * @param url
- */
- function createdialog(title, content, url,name) {
- $.dialog.setting.zIndex = getzIndex(true);
- // $.dialog.confirm(content, function(){
- // doSubmit(url,name);
- // rowid = '';
- // }, function(){
- // });
- //update--begin---author:zhangjiaqiang date:20170301 for:修订提示框
- var navigatorName = "Microsoft Internet Explorer";
- //update--begin--author:zhangjiaqiang date:20170711 for:TASK 2218 shortcut风格 使用jqueryui对话框
- if( navigator.appName == navigatorName ||"shortcut".indexOf(getCookie("JEECGINDEXSTYLE"))>=0){
- //update--begin--author:zhangjiaqiang date:20170711 for:TASK 2218 shortcut风格 使用jqueryui对话框
- $.dialog.confirm(content, function(){
- doSubmit(url,name);
- rowid = '';
- }, function(){
- });
- }else{
- layer.open({
- title:title,
- content:content,
- icon:7,
- yes:function(index){
- doSubmit(url,name);
- rowid = '';
- },
- btn:['确定','取消'],
- btn2:function(index){
- layer.close(index);
- }
- });
- }
-
- //update--end---author:zhangjiaqiang date:20170301 for:修订提示框
- }
- /**
- * 执行保存
- *
- * @param url
- * @param gridname
- */
- function saveObj() {
- $('#btn_sub', iframe.document).click();
- }
- /**
- * 执行AJAX提交FORM
- *
- * @param url
- * @param gridname
- */
- function ajaxSubForm(url) {
- $('#myform', iframe.document).form('submit', {
- url : url,
- onSubmit : function() {
- iframe.editor.sync();
- },
- success : function(r) {
- tip('操作成功');
- reloadTable();
- }
- });
- }
- /**
- * 执行查询
- *
- * @param url
- * @param gridname
- */
- function search() {
- $('#btn_sub', iframe.document).click();
- iframe.search();
- }
- /**
- * 执行操作
- *
- * @param url
- * @param index
- */
- function doSubmit(url,name,data) {
- gridname=name;
- //--author:JueYue ---------date:20140227---------for:把URL转换成POST参数防止URL参数超出范围的问题
- var paramsData = data;
- if(!paramsData){
- paramsData = new Object();
- if (url.indexOf("&") != -1) {
- var str = url.substr(url.indexOf("&")+1);
- url = url.substr(0,url.indexOf("&"));
- var strs = str.split("&");
- for(var i = 0; i < strs.length; i ++) {
- paramsData[strs[i].split("=")[0]]=(strs[i].split("=")[1]);
- }
- }
- }
- //--author:JueYue ---------date:20140227---------for:把URL转换成POST参数防止URL参数超出范围的问题
- $.ajax({
- async : false,
- cache : false,
- type : 'POST',
- data : paramsData,
- url : url,// 请求的action路径
- error : function() {// 请求失败处理函数
- },
- success : function(data) {
- var d = data; // ------ $.parseJSON(data);
- if (d.success) {
- var msg = d.msg;
- tip(msg);
- reloadTable();
- } else {
- //--author:zhaohualong-----start----date: 2017年10月20日--------for:当签收任务失败时, 也刷新列表------
- if (url.indexOf("activitiController.do?claim") != -1){
- reloadTable();
- }
- //--author:zhaohualong-----end----date: 2017年10月20日--------for:当签收任务失败时, 也刷新列表------
- alertTip(d.msg);
- }
- }
- });
-
-
- }
- /**
- * 退出确认框
- *
- * @param url
- * @param content
- * @param index
- */
- function exit(url, content) {
- $.dialog.setting.zIndex = getzIndex(true);
- $.dialog.confirm(content, function(){
- window.location = url;
- }, function(){
- });
- }
- /**
- * 模板页面ajax提交
- *
- * @param url
- * @param gridname
- */
- function ajaxdoSub(url, formname) {
- $('#' + formname).form('submit', {
- url : url,
- onSubmit : function() {
- editor.sync();
- },
- success : function(r) {
- tip('操作成功');
- }
- });
- }
- /**
- * ajax提交FORM
- *
- * @param url
- * @param gridname
- */
- function ajaxdoForm(url, formname) {
- $('#' + formname).form('submit', {
- url : url,
- onSubmit : function() {
- },
- success : function(r) {
- tip('操作成功');
- }
- });
- }
- function opensubwin(title, url, saveurl, okbutton, closebutton) {
- $.dialog({
- content: 'url:'+url,
- zIndex: getzIndex(),
- title : title,
- lock : true,
- opacity : 0.3,
- button : [ {
- name : okbutton,
- callback : function() {
- iframe = this.iframe.contentWindow;
- win = frameElement.api.opener;// 来源页面
- $('#btn_sub', iframe.document).click();
- return false;
- }
- }, {
- name : closebutton,
- callback : function() {
- }
- } ]
- });
- }
- function openauditwin(title, url, saveurl, okbutton, backbutton, closebutton) {
- $.dialog({
- content: 'url:'+url,
- zIndex: getzIndex(),
- title : title,
- lock : true,
- opacity : 0.3,
- button : [ {
- name : okbutton,
- callback : function() {
- iframe = this.iframe.contentWindow;
- win = $.dialog.open.origin;// 来源页面
- $('#btn_sub', iframe.document).click();
- return false;
- }
- }, {
- name : backbutton,
- callback : function() {
- iframe = this.iframe.contentWindow;
- win = frameElement.api.opener;// 来源页面
- $('#formobj', iframe.document).form('submit', {
- url : saveurl + "&code=exit",
- onSubmit : function() {
- $('#code').val('exit');
- },
- success : function(r) {
- $.dialog.tips('操作成功', 2);
- win.location.reload();
- }
- });
- }
- }, {
- name : closebutton,
- callback : function() {
- }
- } ]
- });
- }
- /*获取Cookie值*/
- function getCookie(c_name)
- {
- if (document.cookie.length > 0) {
- c_start = document.cookie.indexOf(c_name + "=")
- if (c_start != -1) {
- c_start = c_start + c_name.length + 1
- c_end = document.cookie.indexOf(";", c_start)
- if (c_end == -1)
- c_end = document.cookie.length
- return unescape(document.cookie.substring(c_start, c_end))
- }
- }
- return ""
- }
- /* 设置 cookie */
- function setCookie(c_name, value, expiredays){
- var exdate=new Date();
- exdate.setDate(exdate.getDate() + expiredays);
- document.cookie=c_name+ "=" + escape(value) + ((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
- }
- function createTabId(str){
- var val="";
- for(var i = 0; i < str.length; i++){
- val += str.charCodeAt(i).toString(16);
- }
- return val;
- }
- // 添加标签
- function addOneTab(subtitle, url, icon) {
- var indexStyle = getCookie("JEECGINDEXSTYLE");
- if(indexStyle=='sliding'||indexStyle=='bootstrap'){
- //shortcut和bootstrap风格的tab跳转改为直接跳转
- window.location.href=url;
- }else if(indexStyle=='acele'||indexStyle=='ace'){
- var id = "";
- //if(url.indexOf("=")!=-1){
- // id = url.substring(url.indexOf("=")+1);
- //}else{
- id = createTabId(subtitle);
- //}
- window.top.addTabs({id:id,title:subtitle,close: true,url: url});
- }else if(indexStyle=='hplus'){
- var id = "";
- id = createTabId(subtitle);
- window.top.addTabs({id:id,title:subtitle,close: true,url: url});
- }else{
- if (icon == '') {
- icon = 'icon folder';
- }
- window.top.$.messager.progress({
- text : '页面加载中....',
- interval : 300
- });
- window.top.$('#maintabs').tabs({
- onClose : function(subtitle, index) {
- window.top.$.messager.progress('close');
- }
- });
- if (window.top.$('#maintabs').tabs('exists', subtitle)) {
- window.top.$('#maintabs').tabs('select', subtitle);
- if (url.indexOf('isHref') != -1) {
- window.top.$('#maintabs').tabs('update', {
- tab : window.top.$('#maintabs').tabs('getSelected'),
- options : {
- title : subtitle,
- href:url,
- //content : '<iframe src="' + url + '" frameborder="0" style="border:0;width:100%;height:99.4%;"></iframe>',
- closable : true,
- icon : icon
- }
- });
- }else {
- window.top.$('#maintabs').tabs('update', {
- tab : window.top.$('#maintabs').tabs('getSelected'),
- options : {
- title : subtitle,
- content : '<iframe src="' + url + '" frameborder="0" style="border:0;width:100%;height:99.4%;"></iframe>',
- //content : '<iframe src="' + url + '" frameborder="0" style="border:0;width:100%;height:99.4%;"></iframe>',
- closable : true,
- icon : icon
- }
- });
- }
- } else {
- if (url.indexOf('isHref') != -1) {
- window.top.$('#maintabs').tabs('add', {
- title : subtitle,
- href:url,
- closable : true,
- icon : icon
- });
- }else {
- window.top.$('#maintabs').tabs('add', {
- title : subtitle,
- content : '<iframe src="' + url + '" frameborder="0" style="border:0;width:100%;height:99.4%;"></iframe>',
- closable : true,
- icon : icon
- });
- }
- }
- }
- }
- // 关闭自身TAB刷新父TABgrid
- function closetab(title) {
- //暂时先不刷新
- //window.top.document.getElementById('tabiframe').contentWindow.reloadTable();
- //window.top.document.getElementById('maintabs').contentWindow.reloadTable();
- window.top.$('#maintabs').tabs('close', title);
- //tip("添加成功");
- }
- //popup
- //object: this name:需要选择的列表的字段 code:动态报表的code
- function inputClick(obj,name,code) {
- if(name==""||code==""){
- alert("popup参数配置不全");
- return;
- }
- //update-begin--Author:scott --- Date:20170401 --- for:inputclick ajax请求追加根路径,防止深路径访问有问题----
- var inputClickUrl = basePath + "/cgReportController.do?popup&id="+code;
- //update-end--Author:scott --- Date:20170401 --- for:inputclick ajax请求追加根路径,防止深路径访问有问题----
- if(typeof(windowapi) == 'undefined'){
- $.dialog({
- content: "url:"+inputClickUrl,
- zIndex: getzIndex(),
- lock : true,
- title:"选择",
- width:800,
- height: 400,
- cache:false,
- ok: function(){
- iframe = this.iframe.contentWindow;
- var selected = iframe.getSelectRows();
- if (selected == '' || selected == null ){
- alert("请选择");
- return false;
- }else {
- var str = "";
- $.each( selected, function(i, n){
- if (i==0)
- str+= n[name];
- else
- str+= ","+n[name];
- });
- $(obj).val("");
- //$('#myText').searchbox('setValue', str);
- $(obj).val(str);
- return true;
- }
-
- },
- cancelVal: '关闭',
- cancel: true //为true等价于function(){}
- });
- }else{
- $.dialog({
- content: "url:"+inputClickUrl,
- zIndex: getzIndex(),
- lock : true,
- title:"选择",
- width:800,
- height: 400,
- parent:windowapi,
- cache:false,
- ok: function(){
- iframe = this.iframe.contentWindow;
- var selected = iframe.getSelectRows();
- if (selected == '' || selected == null ){
- alert("请选择");
- return false;
- }else {
- var str = "";
- $.each( selected, function(i, n){
- if (i==0)
- str+= n[name];
- else
- str+= ","+n[name];
- });
- $(obj).val("");
- //$('#myText').searchbox('setValue', str);
- $(obj).val(str);
- return true;
- }
-
- },
- cancelVal: '关闭',
- cancel: true //为true等价于function(){}
- });
- }
- }
- /*
- 自定义url的弹出
- obj:要填充的控件,可以为多个,以逗号分隔
- name:列表中对应的字段,可以为多个,以逗号分隔(与obj要对应)
- url:弹出页面的Url
- */
- function popClick_embed(obj,name,url,callback) {
- $.dialog.setting.zIndex = getzIndex(true);
- var names = name.split(",");
- var objs = obj.split(",");
- $.dialog({
- content: "url:"+url,
- zIndex: getzIndex(),
- lock : true,
- title:"选择",
- width:900,
- height: 600,
- parent:windowapi,
- cache:true,
- ok: function(){
- iframe = this.iframe.contentWindow;
- var selected = iframe.getSelectRows();
- //alert(JSON.stringify(selected));
- //alert(names);
- if (selected == '' || selected == null ){
- alert("请选择");
- return false;
- }else {
- for(var i1=0;i1<names.length;i1++){
- var str = "";
- $.each( selected, function(i, n){
- if (i==0)
- str+= n[names[i1]];
- else{
- str+= ",";
- str+=n[names[i1]];
- }
- });
- if($("#"+objs[i1]).length>=1){
- $("#"+objs[i1]).val("");
- $("#"+objs[i1]).val(str);
- }else{
- $("[name='"+objs[i1]+"']").val("");
- $("[name='"+objs[i1]+"']").val(str);
- }
- }
- if(typeof callback!="undefined"){
- callback();
- }
- return true;
- }
-
- },
- cancelVal: '关闭',
- cancel: true /*为true等价于function(){}*/
- });
- }
- /*
- 自定义url的弹出
- obj:要填充的控件,可以为多个,以逗号分隔
- name:列表中对应的字段,可以为多个,以逗号分隔(与obj要对应)
- url:弹出页面的Url
- */
- function popClick(obj,name,url) {
- $.dialog.setting.zIndex = getzIndex(true);
- var names = name.split(",");
- var objs = obj.split(",");
- if(typeof(windowapi) == 'undefined'){
- $.dialog({
- content: "url:"+url,
- zIndex: getzIndex(),
- lock : true,
- title:"选择",
- width:700,
- height: 400,
- cache:false,
- ok: function(){
- iframe = this.iframe.contentWindow;
- var selected = iframe.getSelectRows();
- if (selected == '' || selected == null ){
- alert("请选择");
- return false;
- }else {
- for(var i1=0;i1<names.length;i1++){
- var str = "";
- $.each( selected, function(i, n){
- if (i==0)
- str+= n[names[i1]];
- else{
- str+= ",";
- str+=n[names[i1]];
- }
- });
- if($("#"+objs[i1]).length>=1){
- $("#"+objs[i1]).val("");
- $("#"+objs[i1]).val(str);
- }else{
- $("input[name='"+objs[i1]+"']").val("");
- $("input[name='"+objs[i1]+"']").val(str);
- }
- }
- return true;
- }
-
- },
- cancelVal: '关闭',
- cancel: true /*为true等价于function(){}*/
- });
- }else{
- $.dialog({
- content: "url:"+url,
- zIndex: getzIndex(),
- lock : true,
- title:"选择",
- width:700,
- height: 400,
- parent:windowapi,
- cache:false,
- ok: function(){
- iframe = this.iframe.contentWindow;
- var selected = iframe.getSelectRows();
- if (selected == '' || selected == null ){
- alert("请选择");
- return false;
- }else {
- for(var i1=0;i1<names.length;i1++){
- var str = "";
- $.each( selected, function(i, n){
- if (i==0)
- str+= n[names[i1]];
- else{
- str+= ",";
- str+=n[names[i1]];
- }
- });
- if($("#"+objs[i1]).length>=1){
- $("#"+objs[i1]).val("");
- $("#"+objs[i1]).val(str);
- }else{
- $("[name='"+objs[i1]+"']").val("");
- $("[name='"+objs[i1]+"']").val(str);
- }
- }
- return true;
- }
-
- },
- cancelVal: '关闭',
- cancel: true /*为true等价于function(){}*/
- });
- }
- }
- /**
- * Jeecg Excel 导出
- * 代入查询条件
- */
- function JeecgExcelExport(url,datagridId){
- var queryParams = $('#'+datagridId).datagrid('options').queryParams;
- $('#'+datagridId+'tb').find('*').each(function() {
- queryParams[$(this).attr('name')] = $(this).val();
- });
- var params = '&';
- $.each(queryParams, function(key, val){
- params+='&'+key+'='+val;
- });
- var fields = '&field=';
- $.each($('#'+ datagridId).datagrid('options').columns[0], function(i, val){
- if(val.field != 'opt'){
- fields+=val.field+',';
- }
- });
- //update-begin--Author:dangzhenghui Date:20170429 for:TASK #1869 【demo】jeecg excel导出 可以导出 指定行的数据
- var id='&id=';
- //update-by yulong.zhao 17-10-15 注释该代码具体业务不需要导出指定行
- $.each($('#'+ datagridId).datagrid('getSelections'), function(i, val){
- id+=val.id+",";
- });
- // alert(fields+params+id);
- layer.msg('数据导出中,请稍候···', {
- time : 6000,
- shade: 0.1});
- window.location.href = url+ encodeURI(fields+params+id);
- }
- /**
- * 自动完成的解析函数
- * @param data
- * @returns {Array}
- */
- function jeecgAutoParse(data){
- var parsed = [];
- $.each(data.rows,function(index,row){
- parsed.push({data:row,result:row,value:row.id});
- });
- return parsed;
- }
- //add--start--Author:xugj date:20160531 for: TASK #1089 【demo】针对jeecgdemo,实现一个新的页面方式
- /**
- * 更新跳转新页面
- * @param title 编辑框标题 未实现标题改变
- * @param addurl//目标页面地址
- * @param id//主键字段
- */
- function updateNotCreateWin(title,url, id,isRestful) {
- var rowsData = $('#'+id).datagrid('getSelections');
- if (!rowsData || rowsData.length==0) {
- tip('请选择编辑项目');
- return;
- }
- if (rowsData.length>1) {
- tip('请选择一条记录再编辑');
- return;
- }
- if(isRestful!='undefined'&&isRestful){
- url += '/'+rowsData[0].id;
- }else{
- url += '&id='+rowsData[0].id;
- }
- window.location.href=url
- }
- /**
- * 查看详情跳转新页面
- * @param title 编辑框标题 未实现标题改变
- * @param id//主键字段
- */
- function viewNotCreateWin(title,url, id,isRestful)
- {
- var rowsData = $('#'+id).datagrid('getSelections');
- if (!rowsData || rowsData.length==0) {
- tip('请选择查看项目');
- return;
- }
- if (rowsData.length>1) {
- tip('请选择一条记录再查看');
- return;
- }
- if(isRestful!='undefined'&&isRestful){
- url += '/'+rowsData[0].id;
- }else{
- url += '&id='+rowsData[0].id;
- }
- window.location.href=url
- }
- //add--end--Author:xugj date:20160531 for: TASK #1089 【demo】针对jeecgdemo,实现一个新的页面方式
- //add--start--Author:gengjiajia date:20160802 for: TASK #1175 批量添加数据的时popup多值的传递
- //popup
- //object: pobj当前操作的文本框. tablefield:对应字典TEXT,要从popup报表中获取的字段.inputnames:对应字典CODE,当前需要回填数据的文本框名称. pcode:动态报表的code
- function popupClick(pobj,tablefield,inputnames,pcode) {
- $.dialog.setting.zIndex = getzIndex(true);
- if(inputnames==""||pcode==""){
- alert("popup参数配置不全");
- return;
- }
- if(typeof(windowapi) == 'undefined'){
- $.dialog({
- content: "url:cgReportController.do?popup&id="+pcode,
- zIndex: getzIndex(),
- lock : true,
- title:"选择",
- width:800,
- height: 400,
- cache:false,
- ok: function(){
- iframe = this.iframe.contentWindow;
- var selected = iframe.getSelectRows();
- if (selected == '' || selected == null ){
- alert("请选择");
- return false;
- }else {
- //对应数据库字段不为空的情况下,根据表单中字典TEXT的值来取popup的值
- if(tablefield != "" && tablefield != null){
- var fields = tablefield.split(",");
- var inputfield = inputnames.split(",");
- for(var i1=0;i1<fields.length;i1++){
- var str = "";
- $.each( selected, function(i, n){
- if (i==0)
- str+= n[fields[i1]];
- else{
- str+= ",";
- str+=n[fields[i1]];
- }
- });
- var inputname = $(pobj).attr("name");
- var inputs = inputname.split(".");
- //判断传入的this格式是否为 "AA[#index#].aa"的形式
- if(str.indexOf("undefined")==-1){
- if(inputs.length>1){
- var inpu = inputs[i1]+"."+inputfield[i1];
- $("input[name='"+inpu+"']").val(str);
- }else{
- $("input[name='"+inputfield[i1]+"']").val(str);
- }
- }else{
- if(inputs.length>1){
- var inpu = inputs[i1]+"."+inputfield[i1];
- $("input[name='"+inpu+"']").val("");
- }else{
- $("input[name='"+inputfield[i1]+"']").val("");
- }
- }
- }
- }else{
- //对应数据库字段为空的情况下并且字典CODE传入多个值时,根据表单中字典CODE的值从popup中来取值
- var inputfield = inputnames.split(",");
- if(inputfield.length>1){
- for(var i1=0;i1<inputfield.length;i1++){
- var str = "";
- $.each( selected, function(i, n){
- if (i==0)
- str+= n[inputfield[i1]];
- else{
- str+= ",";
- str+=n[inputfield[i1]];
- }
- });
- var inputname = $(pobj).attr("name");
- var inputs = inputname.split(".");
- if(str.indexOf("undefined")==-1){
- if(inputs.length>1){
- var inpu = inputs[i1]+"."+inputfield[i1];
- $("input[name='"+inpu+"']").val(str);
- }else{
- $("input[name='"+inputfield[i1]+"']").val(str);
- }
- }else{
- if(inputs.length>1){
- var inpu = inputs[i1]+"."+inputfield[i1];
- $("input[name='"+inpu+"']").val("");
- }else{
- $("input[name='"+inputfield[i1]+"']").val("");
- }
- }
- }
- }else{
- //对应数据库字段为空的情况下并且字典CODE传入一个值时,根据表单中字典TEXT的值从popup中来取值
- var str = "";
- $.each( selected, function(i, n){
- if (i==0)
- str+= n[inputfield];
- else
- str+= ","+n[inputfield];
- });
- var inputname = $(pobj).attr("name");
- var inputs = inputname.split(".");
- if(str.indexOf("undefined")==-1){
- if(inputs.length>1){
- var inpu = inputs[i1]+"."+inputfield[i1];
- $("input[name='"+inpu+"']").val(str);
- }else{
- $("input[name='"+inputfield+"']").val(str);
- }
- }else{
- if(inputs.length>1){
- var inpu = inputs[i1]+"."+inputfield[i1];
- $("input[name='"+inpu+"']").val("");
- }else{
- $("input[name='"+inputfield+"']").val("");
- }
- }
- }
- }
- return true;
- }
-
- },
- cancelVal: '关闭',
- cancel: true // 为true等价于function(){}
- });
- }else{
- $.dialog({
- content: "url:cgReportController.do?popup&id="+pcode,
- zIndex: getzIndex(),
- lock : true,
- title:"选择",
- width:800,
- height: 400,
- parent:windowapi,
- cache:false,
- ok: function(){
- iframe = this.iframe.contentWindow;
- var selected = iframe.getSelectRows();
- if (selected == '' || selected == null ){
- alert("请选择");
- return false;
- }else {
- //对应数据库字段不为空的情况下,根据表单中字典TEXT的值来取popup的值
- if(tablefield != "" && tablefield != null){
- var fields = tablefield.split(",");
- var inputfield = inputnames.split(",");
- for(var i1=0;i1<fields.length;i1++){
- var str = "";
- $.each( selected, function(i, n){
- if (i==0)
- str+= n[fields[i1]];
- else{
- str+= ",";
- str+=n[fields[i1]];
- }
- });
- var inputname = $(pobj).attr("name");
- var inputs = inputname.split(".");
- //判断传入的this格式是否为 "AA[#index#].aa"的形式
- if(str.indexOf("undefined")==-1){
- if(inputs.length>1){
- var inpu = inputs[i1]+"."+inputfield[i1];
- $("input[name='"+inpu+"']").val(str);
- }else{
- $("input[name='"+inputfield[i1]+"']").val(str);
- }
- }else{
- if(inputs.length>1){
- var inpu = inputs[i1]+"."+inputfield[i1];
- $("input[name='"+inpu+"']").val("");
- }else{
- $("input[name='"+inputfield[i1]+"']").val("");
- }
- }
- }
- }else{
- //对应数据库字段为空的情况下并且字典CODE传入多个值时,根据表单中字典CODE的值从popup中来取值
- var inputfield = inputnames.split(",");
- if(inputfield.length>1){
- for(var i1=0;i1<inputfield.length;i1++){
- var str = "";
- $.each( selected, function(i, n){
- if (i==0)
- str+= n[inputfield[i1]];
- else{
- str+= ",";
- str+=n[inputfield[i1]];
- }
- });
- var inputname = $(pobj).attr("name");
- var inputs = inputname.split(".");
- if(str.indexOf("undefined")==-1){
- if(inputs.length>1){
- var inpu = inputs[i1]+"."+inputfield[i1];
- $("input[name='"+inpu+"']").val(str);
- }else{
- $("input[name='"+inputfield[i1]+"']").val(str);
- }
- }else{
- if(inputs.length>1){
- var inpu = inputs[i1]+"."+inputfield[i1];
- $("input[name='"+inpu+"']").val("");
- }else{
- $("input[name='"+inputfield[i1]+"']").val("");
- }
- }
- }
- }else{
- //对应数据库字段为空的情况下并且字典CODE传入一个值时,根据表单中字典TEXT的值从popup中来取值
- var str = "";
- $.each( selected, function(i, n){
- if (i==0)
- str+= n[inputfield];
- else
- str+= ","+n[inputfield];
- });
- var inputname = $(pobj).attr("name");
- var inputs = inputname.split(".");
- if(str.indexOf("undefined")==-1){
- if(inputs.length>1){
- var inpu = inputs[i1]+"."+inputfield[i1];
- $("input[name='"+inpu+"']").val(str);
- }else{
- $("input[name='"+inputfield+"']").val(str);
- }
- }else{
- if(inputs.length>1){
- var inpu = inputs[i1]+"."+inputfield[i1];
- $("input[name='"+inpu+"']").val("");
- }else{
- $("input[name='"+inputfield+"']").val("");
- }
- }
- }
- }
- return true;
- }
-
- },
- cancelVal: '关闭',
- cancel: true // 为true等价于function(){}
- });
- }
- }
- //add--end--Author:gengjiajia date:20160802 for: TASK #1175 批量添加数据的时popup多值的传递
- //update--begin--author:zhangjiaqiang date:20170527 for:增加鼠标放在图片上方,显示图片大图
- /*
- * 鼠标放在图片上方,显示大图
- */
- var bigImgIndex = null;
- function tipImg(obj){
- try{
- var navigatorName = "Microsoft Internet Explorer";
- if( navigator.appName != navigatorName ){
- if(obj.nodeName == 'IMG'){
- var e = window.event;
- var x = e.clientX+document.body.scrollLeft + document.documentElement.scrollLeft
- var y = e.clientY+document.body.scrollTop + document.documentElement.scrollTop
- var src = obj.src;
- var width = obj.naturalWidth;
- var height = obj.naturalHeight;
- bigImgIndex = layer.open({
- content:[src,'no'],
- type:2,
- offset:[y+"px",x+"px"],
- title:false,
- area:[width+"px",height+"px"],
- shade:0,
- closeBtn:0
- });
- }
- }
- }catch(e){
- }
-
- }
- //add--start--Author:赵华龙 date:20170801 for: 附件管理封装
- /*
- * 展示该业务表相关的附件
- * 需要传入以下参数
- * var webUpload = {
- fileSingleSizeLimit:5242880,//String 类型 可为空 单个文件最大限制 默认5M[1024*1024*5]
- duplicate:duplicate,// String 类型 可为空 默认为false 新上传的文件做重复性校验
- busiTable : busiTable,//String 类型 可为空但是不建议为空 业务表名称
- busiId : busiId,// String 类型 不可为空,关联业务id
- bizType : bizType,//String 类型 不可为空 , 关联业务code
- remark : remark,//String 类型 可为空 拓展字段 备注信息
- createrDelete:createrDelete,是否为只允许创建者删除文件 默认为false
- readOnly : readOnly,//String 类型 可为空 是否只读 备注false
- extensions:extensions //String 类型 可为空 默认允许全部类型 允许的文件后缀,不带点,多个用逗号分割
- };
- *
- */
- function showFileList(webUpload) {
- if(undefined==webUpload.busiId||null==webUpload.busiId||undefined==webUpload.bizType||null==webUpload.bizType)
- {
- tip('传入参数错误!');
- return false;
- }
- if(undefined==webUpload.fileSingleSizeLimit|| null ==webUpload.fileSingleSizeLimit)
- {
- webUpload.fileSingleSizeLimit = '5242880';
- }
- if(undefined==webUpload.duplicate|| null==webUpload.duplicate)
- {
- webUpload.duplicate = "false";
- }
- if(undefined==webUpload.readOnly|| null==webUpload.readOnly)
- {
- webUpload.readOnly = "false";
- }
- if(undefined==webUpload.busiTable|| null ==webUpload.busiTable)
- {
- webUpload.busiTable = '';
- }
- if(undefined==webUpload.remark|| null ==webUpload.remark)
- {
- webUpload.remark = '';
- }
- if(undefined==webUpload.extensions|| null ==webUpload.extensions)
- {
- webUpload.extensions = '';
- }
- if(undefined==webUpload.createrDelete|| null ==webUpload.createrDelete)
- {
- webUpload.createrDelete = 'false';
- }
-
- console.log("入参");
- console.log(webUpload);
- $.dialog.setting.zIndex = getzIndex();
- $.dialog(
- {
- content : 'url:tSysFileController.do?list'
- + "&fileSingleSizeLimit=" + webUpload.fileSingleSizeLimit
- + "&duplicate=" + webUpload.duplicate
- + "&busiTable=" + webUpload.busiTable
- + "&busiId=" + webUpload.busiId
- + "&bizType=" + webUpload.bizType
- + "&remark=" + webUpload.remark
- + "&readOnly=" + webUpload.readOnly
- + "&createrDelete=" + webUpload.createrDelete
- + "&extensions=" + webUpload.extensions,
- zIndex : getzIndex(),
- title : '查看文件',//选择框标题
- lock : true,//是否锁定 当为true 时 下层有蒙版,不允许用户在弹出窗口以外有其它操作
- width : '800px',// 选择框宽度
- height : '350px',//选择框高度
- opacity : 0.4,//透明度 (经过测试 效果好像不太明显 )
- button : [ {
- name : '关闭',
- focus : true,
- callback : function() {
- }
- } ]
- }).zindex();
- }
- //add--end--Author:赵华龙 date:20170801 for: 附件管理封装
- function moveTipImg(){
- try{
- if(bigImgIndex != null){
- layer.close(bigImgIndex);
- }
- }catch(e){
-
- }
- }
- //update--end--author:zhangjiaqiang date:20170527 for:增加鼠标放在图片上方,显示图片大图
- //--author:zhaohualong-----start----date:20180901--------for:合并单元格共通方法------
- /**
- * tableID datagrid id名称
- * mergeFileds 需要合并单元格的列的集合 demo如下
- * var mergeFileds=[
- * {mergeFiled:"age"}, //合并列的field数组及对应前提条件filed(为空则直接内容合并)
- * {mergeFiled:"depId",premiseFiled:"age"}, //合并列的field数组及对应前提条件filed(为空则直接内容合并)
- * {mergeFiled:"sex",premiseFiled:"age"},
- * {mergeFiled:"status",premiseFiled:"age"},
- * {mergeFiled:"extField"}
- * ];
- */
- function commonMergeCells(tableID,mergeFileds){
-
- var arr = mergeFileds;
- var dg = $('#' + tableID); // 要合并的datagrid中的表格id
- var rowCount = dg.datagrid("getRows").length;
- var cellName;
- var span;
- var perValue = "";
- var curValue = "";
- var perCondition="";
- var curCondition="";
- var flag=true;
- var condiName="";
- var length = arr.length - 1;
- for (i = length; i >= 0; i--) {
- cellName = arr[i].mergeFiled;
- condiName=arr[i].premiseFiled;
- if(null!=condiName){
- flag=false;
- }
- perValue = "";
- perCondition="";
- span = 1;
- for (row = 0; row <= rowCount; row++) {
- if (row == rowCount) {
- curValue = "";
- curCondition="";
- } else {
- curValue = dg.datagrid("getRows")[row][cellName];
-
- if(!flag){
- curCondition=dg.datagrid("getRows")[row][condiName];
- }
- }
- if (perValue == curValue&&(flag||perCondition==curCondition)) {
- span += 1;
- } else {
- var index = row - span;
- dg.datagrid('mergeCells', {
- index : index,
- field : cellName,
- rowspan : span,
- colspan : null
- });
- span = 1;
- perValue = curValue;
- if(!flag){
- perCondition=curCondition;
- }
- }
- }
- }
- }
-
- //--author:zhaohualong-----end----date:20180901--------for:合并单元格共通方法------
- //--author:zhaohualong-----start----date:20170908--------for:pdf预览------
- /**
- * 打开pdf 预览窗口
- * @param title 窗口标题
- * @param fileUrl //文件的访问路径
- */
- function showpdfview(title,fileUrl,width,height) {
- url = "tSysFileController.do?showpdfview&fileUrl="+fileUrl;
- if(undefined ==title ||'' ==title){
- title ="pdf预览";
- }
- createwindowWithoutSavebtn(title, url,width,height);
- }
- //--author:zhaohualong-----start----date:20170908--------for:pdf预览------
- /**
- * 打开图片预览窗口
- * @param title 窗口标题
- * @param fileUrl //文件的访问路径
- */
- function showImgview(title,fileUrl,width,height) {
- url = "tSysFileController.do?showPictureview&fileUrl="+fileUrl;
- if(undefined ==title ||'' ==title){
- title ="图片预览";
- }
- createwindowWithoutSavebtn(title, url,width,height);
- }
- /**
- * 列表format 将分钟数 转化为 x 小时y 分钟
- * @param value
- * @param rec
- * @param index
- * @returns
- */
- function minsToHoursandMinsfmt(value, rec, index) {
- var result = '';
- if (null != value) {
- var mins = value % 60;
- var hour = (value - mins) / 60;
- if (0 == hour) {
- result = mins + '分'
- } else {
- if( mins<0){
- mins = 0-mins;
- }
- result = hour + '小时' + mins + '分'
- }
- }
- return result;
- }
- //update-begin-author:jiaqiankun date:20180713 for:TASK #2872 【新功能】列表按钮改造成配置,支持折叠模式,增加一个参数
- function optsMenuToggle(data){
- var dgPanel = $("#"+data).datagrid('getPanel');
- //update-begin-author:taoYan date:20180718 for:TASK #2980 【BUG】分组按钮问题
- var tr = dgPanel.find('div.datagrid-body tr');
- tr.each(function(){
- var td = tr.children('td[field="opt"]');
- var toggleIcon = td.find(".opts-menu-triangle");
- toggleIcon.mouseenter(function(){
- $(this).parent(".datagrid-cell").addClass("menu-active");
- var w = $(this).next('.opts-menu-container').find(".opts-menu-box").width();
- var l = $(this).offset().left;
- var il = $(this).next('.opts-menu-container').offset().left;
- if(w+l+36<$(window).width()){
- td.find(".opts-menu-box").css("left",(l-il+46)+"px");
- }else{
- td.find(".opts-menu-box").css("left",-(w-l+il+6)+"px");
- }
- });
- td.mouseleave(function(){
- td.children(".datagrid-cell").removeClass("menu-active");
- });
- });
- //update-end-author:taoYan date:20180718 for:TASK #2980 【BUG】分组按钮问题
- }
- //点击页面当中的其他部分,隐藏分组按钮
- $(document).click(function(){
- $(".datagrid-cell").removeClass("menu-active");
- });
- //update-end-author:jiaqiankun date:20180713 for:TASK #2872 【新功能】列表按钮改造成配置,支持折叠模式,增加一个参数
- //update-begin-author:zhoujf date:20180713 for:TASK #2809 【bug】网友反馈问题,字典性能问题
- function loadAjaxDict(rowData){
- $("body").find("span[name='ajaxDict']").each(function(i){
- var $this = $(this);
- var dictionary = $this.attr('dictionary');
- var dictCondition = $this.attr('dictCondition');
- var popup = $this.attr('popup');
- var value = $this.attr('value');
- $.ajax({
- url : "commonController.do?getDictInfo",
- type : 'post',
- data : {
- dictionary:dictionary,
- dictCondition:dictCondition,
- popup:popup,
- value:value
- },
- dataType:"json",
- async : true,
- cache : false,
- success : function(data) {
- $this.html(data.obj);
- }
- });
-
- });
- }
- //update-end-author:zhoujf date:20180713 for:TASK #2809 【bug】网友反馈问题,字典性能问题
- //update-begin-author:taoyan date:20180717 for:TASK #2873 【新功能】按钮折叠功能
- function toggleMoreToolbars(obj){
- $(".toolbar-more-list").toggleClass("active");
- if($(".toolbar-more-list").hasClass("active")){
- $(".toolbar-more-list").css("left",-($(obj).next().offset().left-$(obj).offset().left)+"px");
- $(".toolbar-more-list").css("top",($(obj).outerHeight(true)/2)+"px");
- }
- //鼠标移开 列表隐藏
- $(".toolbar-more-list").mouseleave(function(){
- $(".toolbar-more-list").removeClass("active");
- });
- }
- //update-end-author:taoyan date:20180717 for:TASK #2873 【新功能】按钮折叠功能
- //列表显示自定义样式,显示对号
- function statusFmt(value, row, index){
- if (value != null && value != '')
- return '<span style="color:green;font-size: 16px;">✔</span>';
- return '<span style="color:red;font-size: 16px;">x</span>';
- }
|