curdtools_zh-cn.js 62 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203
  1. // update--begin--author:zhangjiaqiang date:20170621 for:如何避免console.log引起javascript的兼容问题
  2. if(!window.console){
  3. window.console = {};
  4. }
  5. if(!window.console.log){
  6. window.console.log = function(msg){};
  7. }
  8. // update--end--author:zhangjiaqiang date:20170621 for:如何避免console.log引起javascript的兼容问题
  9. //update-begin--Author:scott --- Date:20170401 --- for:inputclick ajax请求追加根路径,防止深路径访问有问题----
  10. var basePath;
  11. try{
  12. var local = window.location;
  13. var contextPath = local.pathname.split("/")[1];
  14. basePath = local.protocol+"//"+local.host+"/"+contextPath;
  15. //alert(basePath);
  16. }catch(e){}
  17. //update-end--Author:scott --- Date:20170401 --- for:inputclick ajax请求追加根路径,防止深路径访问有问题----
  18. //var jq = jQuery.noConflict();
  19. /**
  20. * 增删改工具栏
  21. */
  22. /*window.onerror = function() {
  23. return true;
  24. };*/
  25. var iframe;// iframe操作对象
  26. var win;//窗口对象
  27. var gridname="";//操作datagrid对象名称
  28. //scott 20160426 JS异常报错
  29. var windowapi;
  30. var W;
  31. try {
  32. windowapi = frameElement.api, W = windowapi.opener;//内容页中调用窗口实例对象接口
  33. } catch (e) {
  34. }
  35. /**
  36. * 设置 window的 zIndex
  37. * @param flag true: 不增量(因为 tip提示经常使用 zIndex, 所以如果是 tip的话 ,则不增量)
  38. * @returns
  39. */
  40. function getzIndex(flag){
  41. var zindexNumber = getCookie("ZINDEXNUMBER");
  42. if(zindexNumber == null){
  43. zindexNumber = 2010;
  44. setCookie("ZINDEXNUMBER",zindexNumber);
  45. //zindexNumber = 1980;
  46. }else{
  47. if(zindexNumber < 2010){
  48. zindexNumber = 2010;
  49. }
  50. var n = flag?zindexNumber:parseInt(zindexNumber) + parseInt(10);
  51. setCookie("ZINDEXNUMBER",n);
  52. }
  53. return zindexNumber;
  54. }
  55. function upload(curform) {
  56. upload();
  57. }
  58. /**
  59. * 添加事件打开窗口
  60. * @param title 编辑框标题
  61. * @param addurl//目标页面地址
  62. */
  63. function add(title,addurl,gname,width,height) {
  64. gridname=gname;
  65. createwindow(title, addurl,width,height);
  66. }
  67. /**
  68. * 树列表添加事件打开窗口
  69. * @param title 编辑框标题
  70. * @param addurl//目标页面地址
  71. */
  72. function addTreeNode(title,addurl,gname) {
  73. if (rowid != '') {
  74. addurl += '&id='+rowid;
  75. }
  76. gridname=gname;
  77. createwindow(title, addurl);
  78. }
  79. /**
  80. * 更新事件打开窗口
  81. * @param title 编辑框标题
  82. * @param addurl//目标页面地址
  83. * @param id//主键字段
  84. */
  85. //update-begin--Author:luobaoli Date:20150705 for:增加了一个判断是否需要转换为restful风格URL的参数,如果该参数为true,那么转换为restful风格
  86. function update(title,url, id,width,height,isRestful) {
  87. gridname=id;
  88. var rowsData = $('#'+id).datagrid('getSelections');
  89. if (!rowsData || rowsData.length==0) {
  90. tip('请选择编辑项目');
  91. return;
  92. }
  93. if (rowsData.length>1) {
  94. tip('请选择一条记录再编辑');
  95. return;
  96. }
  97. if(isRestful!='undefined'&&isRestful){
  98. url += '/'+rowsData[0].id;
  99. }else{
  100. url += '&id='+rowsData[0].id;
  101. }
  102. createwindow(title,url,width,height);
  103. }
  104. //update-end--Author:luobaoli Date:20150705 for:增加了一个判断是否需要转换为restful风格URL的参数,如果该参数为true,那么转换为restful风格
  105. /**
  106. * 如果页面是详细查看页面,无效化所有表单元素,只能进行查看
  107. */
  108. $(function(){
  109. Array.prototype.removeItem = function(val) {
  110. var index = this.indexOf(val);
  111. if (index > -1) {
  112. this.splice(index, 1);
  113. }
  114. };
  115. // https://tc39.github.io/ecma262/#sec-array.prototype.includes
  116. if (!Array.prototype.includes) {
  117. Object.defineProperty(Array.prototype, 'includes', {
  118. value: function(searchElement, fromIndex) {
  119. // 1. Let O be ? ToObject(this value).
  120. if (this == null) {
  121. throw new TypeError('"this" is null or not defined');
  122. }
  123. var o = Object(this);
  124. // 2. Let len be ? ToLength(? Get(O, "length")).
  125. var len = o.length >>> 0;
  126. // 3. If len is 0, return false.
  127. if (len === 0) {
  128. return false;
  129. }
  130. // 4. Let n be ? ToInteger(fromIndex).
  131. // (If fromIndex is undefined, this step produces the value 0.)
  132. var n = fromIndex | 0;
  133. // 5. If n ≥ 0, then
  134. // a. Let k be n.
  135. // 6. Else n < 0,
  136. // a. Let k be len + n.
  137. // b. If k < 0, let k be 0.
  138. var k = Math.max(n >= 0 ? n : len - Math.abs(n), 0);
  139. // 7. Repeat, while k < len
  140. while (k < len) {
  141. // a. Let elementK be the result of ? Get(O, ! ToString(k)).
  142. // b. If SameValueZero(searchElement, elementK) is true, return true.
  143. // c. Increase k by 1.
  144. // NOTE: === provides the correct "SameValueZero" comparison needed here.
  145. if (o[k] === searchElement) {
  146. return true;
  147. }
  148. k++;
  149. }
  150. // 8. Return false
  151. return false;
  152. }
  153. });
  154. }
  155. if(location.href.indexOf("load=detail")!=-1){
  156. $(":input").attr("disabled","true");
  157. $(".easyui-linkbutton").hide();
  158. $(".requiredIcon").hide();
  159. //$(":input").attr("style","border:0;border-bottom:1 solid black;background:white;");
  160. }
  161. try{
  162. //--author:zhaohualong-----start----date: 2017年10月11日--------for:-----easyui拓展方法:动态添加editor
  163. $.extend($.fn.datagrid.methods, {
  164. addEditor : function(jq, param) {
  165. if (param instanceof Array) {
  166. $.each(param, function(index, item) {
  167. var e = $(jq).datagrid('getColumnOption', item.field);
  168. e.editor = item.editor;
  169. });
  170. } else {
  171. var e = $(jq).datagrid('getColumnOption', param.field);
  172. e.editor = param.editor;
  173. }
  174. },
  175. removeEditor : function(jq, param) {
  176. if (param instanceof Array) {
  177. $.each(param, function(index, item) {
  178. var e = $(jq).datagrid('getColumnOption', item);
  179. e.editor = {};
  180. });
  181. } else {
  182. var e = $(jq).datagrid('getColumnOption', param);
  183. e.editor = {};
  184. }
  185. }
  186. });
  187. //--author:zhaohualong-----end----date: 2017年10月11日--------for:-----easyui拓展方法:动态添加editor
  188. //--author:zhaohualong-----start----date:20170906--------for:------初始化editor
  189. $.extend($.fn.datagrid.defaults.editors, {
  190. text: {
  191. init: function (container, options) {
  192. if(!options){
  193. options = {};
  194. }
  195. var input = $('<input type="text"></input>').validatebox(options).appendTo(container);
  196. return input;
  197. },
  198. destroy: function (target) {
  199. },
  200. getValue: function (target) {
  201. return $(target).val();
  202. },
  203. setValue: function (target, value) {
  204. return $(target).val(value);//获得旧值
  205. },
  206. resize : function(target, width) {
  207. var input = $(target);
  208. if ($.boxModel == true) {
  209. input.width(width - (input.outerWidth() - input.width()));
  210. } else {
  211. input.width(width);
  212. }
  213. }
  214. },
  215. WdateboxTime: {
  216. init: function (container, options) {
  217. if(!options){
  218. options = {};
  219. }
  220. var input = $(' <input type="text" class="Wdate" onClick=\'WdatePicker({readOnly:true,enableKeyboard:false,enableInputMask:false,dateFmt: "yyyy-MM-dd HH:mm"})\' />').appendTo(container);
  221. return input;
  222. },
  223. destroy: function (target) {
  224. },
  225. getValue: function (target) {
  226. return $(target).val();
  227. },
  228. setValue: function (target, value) {
  229. value = new Date().format('yyyy-MM-dd hh:mm',value);
  230. return $(target).val(value);//获得旧值
  231. },
  232. resize : function(target, width) {
  233. var input = $(target);
  234. if ($.boxModel == true) {
  235. input.width(width - (input.outerWidth() - input.width()));
  236. } else {
  237. input.width(width);
  238. }
  239. }
  240. },
  241. AttendWdateboxTime: {
  242. init: function (container, options) {
  243. if(!options){
  244. options = {};
  245. }
  246. var minDate= "1900-01-01 00:00:00";
  247. var maxDate="2099-12-31 23:59:59";
  248. if(undefined!=options.minDate&&''!=options.minDate){
  249. minDate= options.minDate;
  250. }
  251. if(undefined!=options.maxDate&&''!=options.maxDate){
  252. maxDate = options.maxDate;
  253. }
  254. var input = $(' <input type="text" class="Wdate" onClick=\'WdatePicker({readOnly:true,minDate: "'+minDate+'",maxDate: "'+maxDate+'",dateFmt: "yyyy-MM-dd HH:mm"})\' />').appendTo(container);
  255. return input;
  256. },
  257. destroy: function (target) {
  258. },
  259. getValue: function (target) {
  260. return $(target).val();
  261. },
  262. setValue: function (target, value) {
  263. value = new Date().format('yyyy-MM-dd hh:mm',value);
  264. return $(target).val(value);//获得旧值
  265. },
  266. resize : function(target, width) {
  267. var input = $(target);
  268. if ($.boxModel == true) {
  269. input.width(width - (input.outerWidth() - input.width()));
  270. } else {
  271. input.width(width);
  272. }
  273. }
  274. },
  275. WdateboxDay: {
  276. init: function (container, options) {
  277. if(!options){
  278. options = {};
  279. }
  280. var input = $(' <input type="text" class="Wdate" onClick=\'WdatePicker({readOnly:true,enableKeyboard:false,enableInputMask:false,dateFmt: "yyyy-MM-dd"})\' />').appendTo(container);
  281. return input;
  282. },
  283. destroy: function (target) {
  284. },
  285. getValue: function (target) {
  286. return $(target).val();
  287. },
  288. setValue: function (target, value) {
  289. value = new Date().format('yyyy-MM-dd',value);
  290. return $(target).val(value);//获得旧值
  291. },
  292. resize : function(target, width) {
  293. var input = $(target);
  294. if ($.boxModel == true) {
  295. input.width(width - (input.outerWidth() - input.width()));
  296. } else {
  297. input.width(width);
  298. }
  299. }
  300. },
  301. WdateboxMonth: {
  302. init: function (container, options) {
  303. if(!options){
  304. options = {};
  305. }
  306. var input = $(' <input type="text" class="Wdate" onClick=\'WdatePicker({readOnly:true,enableKeyboard:false,enableInputMask:false,dateFmt: "yyyy-MM"})\' />').validatebox(options).appendTo(container);
  307. return input;
  308. },
  309. destroy: function (target) {
  310. },
  311. getValue: function (target) {
  312. return $(target).val();
  313. },
  314. setValue: function (target, value) {
  315. value = new Date().format('yyyy-MM',value);
  316. return $(target).val(value);//获得旧值
  317. },
  318. resize : function(target, width) {
  319. var input = $(target);
  320. if ($.boxModel == true) {
  321. input.width(width - (input.outerWidth() - input.width()));
  322. } else {
  323. input.width(width);
  324. }
  325. }
  326. },
  327. WdateboxYear: {
  328. init: function (container, options) {
  329. if(!options){
  330. options = {};
  331. }
  332. var input = $(' <input type="text" class="Wdate" onClick=\'WdatePicker({readOnly:true,enableKeyboard:false,enableInputMask:false,dateFmt: "yyyy"})\' />').validatebox(options).appendTo(container);
  333. return input;
  334. },
  335. destroy: function (target) {
  336. },
  337. getValue: function (target) {
  338. return $(target).val();
  339. },
  340. setValue: function (target, value) {
  341. value = new Date().format('yyyy',value);
  342. return $(target).val(value);//获得旧值
  343. },
  344. },
  345. });
  346. //--author:zhaohualong-----start----date:20170906--------for:------初始化editor
  347. }catch(e){
  348. }
  349. });
  350. /**
  351. * 查看详细事件打开窗口
  352. * @param title 查看框标题
  353. * @param addurl//目标页面地址
  354. * @param id//主键字段
  355. */
  356. function detail(title,url, id,width,height) {
  357. var rowsData = $('#'+id).datagrid('getSelections');
  358. // if (rowData.id == '') {
  359. // tip('请选择查看项目');
  360. // return;
  361. // }
  362. if (!rowsData || rowsData.length == 0) {
  363. tip('请选择查看项目');
  364. return;
  365. }
  366. if (rowsData.length > 1) {
  367. tip('请选择一条记录再查看');
  368. return;
  369. }
  370. url += '&load=detail&id='+rowsData[0].id;
  371. createdetailwindow(title,url,width,height);
  372. }
  373. /**
  374. * 多记录刪除請求
  375. * @param title
  376. * @param url
  377. * @param gname
  378. * @return
  379. */
  380. function deleteALLSelect(title,url,gname) {
  381. gridname=gname;
  382. var ids = [];
  383. var rows = $("#"+gname).datagrid('getSelections');
  384. if (rows.length > 0) {
  385. $.dialog.setting.zIndex = getzIndex(true);
  386. $.dialog.confirm('你确定永久删除该数据吗?', function(r) {
  387. if (r) {
  388. for ( var i = 0; i < rows.length; i++) {
  389. ids.push(rows[i].id);
  390. }
  391. $.ajax({
  392. url : url,
  393. type : 'post',
  394. data : {
  395. ids : ids.join(',')
  396. },
  397. cache : false,
  398. success : function(data) {
  399. var d = data; // ------ $.parseJSON(data);
  400. if (d.success) {
  401. var msg = d.msg;
  402. tip(msg);
  403. reloadTable();
  404. $("#"+gname).datagrid('unselectAll');
  405. ids='';
  406. }
  407. }
  408. });
  409. }
  410. });
  411. } else {
  412. tip("请选择需要删除的数据");
  413. }
  414. }
  415. /**
  416. * 查看时的弹出窗口
  417. *
  418. * @param title
  419. * @param addurl
  420. * @param saveurl
  421. */
  422. function createdetailwindow(title, addurl,width,height) {
  423. width = width?width:700;
  424. height = height?height:400;
  425. if(width=="100%" ){
  426. width = window.top.document.body.offsetWidth;
  427. }
  428. if(height=="100%"){
  429. height =window.top.document.body.offsetHeight-100;
  430. }
  431. if(typeof(windowapi) == 'undefined'){
  432. $.dialog({
  433. content: 'url:'+addurl,
  434. zIndex: getzIndex(),
  435. lock : true,
  436. width:width,
  437. height: height,
  438. title:title,
  439. opacity : 0.3,
  440. cache:false,
  441. cancelVal: '关闭',
  442. cancel: true /*为true等价于function(){}*/
  443. });
  444. }else{
  445. //update-begin--Author:xuelin Date:20170421 for:#1804 【体验】需要选中行数据,点击阅读才弹出页面--------------------
  446. W.$.dialog({
  447. content: 'url:'+addurl,
  448. zIndex: getzIndex(),
  449. lock : true,
  450. width:width,
  451. height: height,
  452. parent:windowapi,
  453. title:title,
  454. opacity : 0.3,
  455. cache:false,
  456. cancelVal: '关闭',
  457. cancel: function(){
  458. windowapi.zindex();
  459. }
  460. //cancel:true /*为true等价于function(){}*/
  461. });
  462. //update-end--Author:xuelin Date:20170421 for:#1804 【体验】需要选中行数据,点击阅读才弹出页面----------------------
  463. }
  464. }
  465. /**
  466. * 全屏编辑
  467. * @param title 编辑框标题
  468. * @param addurl//目标页面地址
  469. * @param gridname//datagrid id
  470. */
  471. function editfs(title,url,gridname) {
  472. var name=gridname;
  473. var rowsData = $('#'+name).datagrid('getSelections');
  474. if (!rowsData || rowsData.length==0) {
  475. tip('请选择编辑项目');
  476. return;
  477. }
  478. if (rowsData.length>1) {
  479. tip('请选择一条记录再编辑');
  480. return;
  481. }
  482. url += '&id='+rowid;
  483. //update-begin--Author:scott --- Date:20170406 --- for:弹出窗口最大化问题处理----
  484. width = window.top.document.body.offsetWidth;
  485. height =window.top.document.body.offsetHeight-100;
  486. openwindow(title,url,name,width,height);
  487. //update-end--Author:scott --- Date:20170406 --- for:弹出窗口最大化问题处理----
  488. }
  489. // 删除调用函数
  490. function delObj(url,name) {
  491. gridname=name;
  492. createdialog('删除确认 ', '确定删除该记录吗 ?', url,name);
  493. }
  494. // 删除调用函数
  495. function confuploadify(url, id) {
  496. $.dialog.setting.zIndex = getzIndex(true);
  497. $.dialog.confirm('确定删除吗', function(){
  498. deluploadify(url, id);
  499. }, function(){
  500. });
  501. }
  502. /**
  503. * 执行删除附件
  504. *
  505. * @param url
  506. * @param index
  507. */
  508. function deluploadify(url, id) {
  509. $.ajax({
  510. async : false,
  511. cache : false,
  512. type : 'POST',
  513. url : url,// 请求的action路径
  514. error : function() {// 请求失败处理函数
  515. },
  516. success : function(data) {
  517. var d = data; // ------ $.parseJSON(data);
  518. if (d.success) {
  519. $("#" + id).remove();// 移除SPAN
  520. m.remove(id);// 移除MAP对象内字符串
  521. }
  522. }
  523. });
  524. }
  525. // 普通询问操作调用函数
  526. function confirm(url, content,name) {
  527. createdialog('提示信息 ', content, url,name);
  528. }
  529. /**
  530. * 提示信息
  531. */
  532. function tip_old(msg) {
  533. $.dialog.setting.zIndex = getzIndex(true);
  534. $.dialog.tips(msg, 1);
  535. }
  536. /**
  537. * 提示信息
  538. */
  539. function tip(msg) {
  540. try{
  541. $.dialog.setting.zIndex = getzIndex(true);
  542. //update--begin--author:zhangjiaqiang Date:20170227 for:更新提示框
  543. var navigatorName = "Microsoft Internet Explorer";
  544. //update--begin--author:taoYan Date:20170628 for:default/shortcut提示用原风格---
  545. if(navigator.appName == navigatorName||"default,shortcut".indexOf(getCookie("JEECGINDEXSTYLE"))>=0){
  546. //update--end--author:taoYan Date:20170628 for:default/shortcut提示用原风格---
  547. $.messager.show({
  548. title : '提示信息',
  549. msg : msg,
  550. timeout : 1000 * 6
  551. });
  552. }else{
  553. var icon = 7;
  554. if(msg.indexOf("成功") > -1){
  555. icon = 1;
  556. }else if(msg.indexOf("失败") > -1){
  557. icon = 2;
  558. }
  559. layer.open({
  560. title:'提示信息',
  561. offset:'rb',
  562. content:msg,
  563. time:3000,
  564. btn:false,
  565. shade:false,
  566. icon:icon,
  567. shift:2
  568. });
  569. }
  570. //update--begin--author:zhangjiaqiang Date:20170227 for:更新提示框
  571. }catch(e){
  572. alertTipTop(msg,'10%');
  573. }
  574. }
  575. /**
  576. * Layer风格alert提示
  577. */
  578. function alerLayerTip(msg) {
  579. if(msg==null || msg==''){
  580. msg = "系统异常,请看系统日志!";
  581. }
  582. try{
  583. var navigatorName = "Microsoft Internet Explorer";
  584. //update--begin--author:zhangjiaqiang date:20170711 for:TASK 2218 shortcut风格 使用jqueryui对话框
  585. if( navigator.appName == navigatorName ||"shortcut".indexOf(getCookie("JEECGINDEXSTYLE"))>=0){
  586. //update--end--author:zhangjiaqiang date:20170711 for:TASK 2218 shortcut风格 使用jqueryui对话框
  587. $.messager.alert('提示信息',msg);
  588. }else{
  589. layer.open({
  590. title:'提示信息',
  591. content:msg,
  592. time:6000,
  593. btn:false,
  594. shade:false,
  595. icon:2
  596. });
  597. }
  598. }catch(e){
  599. alertTipTop(msg,'10%');
  600. }
  601. }
  602. function alertTipTop(msg,top,title) {
  603. $.dialog.setting.zIndex = getzIndex(true);
  604. title = title?title:"提示信息";
  605. $.dialog({
  606. title:title,
  607. zIndex: getzIndex(),
  608. icon:'tips.gif',
  609. top:top,
  610. content: msg
  611. });
  612. }
  613. /**
  614. * 提示信息像alert一样
  615. */
  616. function alertTip(msg,title) {
  617. $.dialog.setting.zIndex = getzIndex(true);
  618. title = title?title:"提示信息";
  619. $.dialog({
  620. title:title,
  621. zIndex: getzIndex(),
  622. icon:'tips.gif',
  623. content: msg
  624. });
  625. }
  626. /**
  627. * 创建添加或编辑窗口
  628. *
  629. * @param title
  630. * @param addurl
  631. * @param saveurl
  632. */
  633. function createwindow(title, addurl,width,height) {
  634. width = width?width:700;
  635. height = height?height:400;
  636. if(width=="100%" ){
  637. width = window.top.document.body.offsetWidth;
  638. }
  639. if( height=="100%"){
  640. height =window.top.document.body.offsetHeight-100;
  641. }
  642. //--author:JueYue---------date:20140427---------for:弹出bug修改,设置了zindex()函数
  643. if(typeof(windowapi) == 'undefined'){
  644. $.dialog({
  645. content: 'url:'+addurl,
  646. lock : true,
  647. zIndex: getzIndex(),
  648. width:width,
  649. height:height,
  650. title:title,
  651. opacity : 0.3,
  652. cache:false,
  653. ok: function(){
  654. iframe = this.iframe.contentWindow;
  655. saveObj();
  656. return false;
  657. },
  658. cancelVal: '关闭',
  659. cancel: true /*为true等价于function(){}*/
  660. });
  661. }else{
  662. //update-begin--Author:xuelin Date:20170705 for:TASK #2196 【bug】云桌面问题--------------------
  663. /*W.*/$.dialog({//使用W,即为使用顶级页面作为openner,造成打开的次级窗口获取不到关联的主窗口
  664. content: 'url:'+addurl,
  665. lock : true,
  666. width:width,
  667. zIndex:getzIndex(),
  668. height:height,
  669. parent:windowapi,
  670. title:title,
  671. opacity : 0.3,
  672. cache:false,
  673. ok: function(){
  674. iframe = this.iframe.contentWindow;
  675. saveObj();
  676. return false;
  677. },
  678. cancelVal: '关闭',
  679. cancel: true /*为true等价于function(){}*/
  680. });
  681. //update-end--Author:xuelin Date:20170705 for:TASK #2196 【bug】云桌面问题----------------------
  682. }
  683. //--author:JueYue---------date:20140427---------for:弹出bug修改,设置了zindex()函数
  684. }
  685. //--author:zhaohualong---------date:20170801---------for:弹出窗口优化,屏蔽确定取消按钮
  686. /**
  687. * 关闭当前窗口参数,可传入回调函数
  688. */
  689. function closeCurrentDialog(callback){
  690. frameElement.api.close();
  691. if(typeof callback!="undefined"){
  692. callback();
  693. }
  694. }
  695. /**
  696. * 创建无确定取消按钮的窗口
  697. *
  698. * @param title 窗口标题
  699. * @param url 窗口内url
  700. * @param width 窗口宽度
  701. * @param height 窗口高度
  702. */
  703. function createwindowWithoutSavebtn(title, addurl,width,height) {
  704. width = width?width:700;
  705. height = height?height:400;
  706. if(width=="100%" || height=="100%"){
  707. width = window.top.document.body.offsetWidth;
  708. height =window.top.document.body.offsetHeight-100;
  709. }
  710. if(typeof(windowapi) == 'undefined'){
  711. $.dialog({
  712. content: 'url:'+addurl,
  713. lock : true,
  714. zIndex: getzIndex(),
  715. width:width,
  716. height:height,
  717. title:title,
  718. opacity : 0.3,
  719. cache:false,
  720. /*为true等价于function(){}*/
  721. });
  722. }else{
  723. /*W.*/$.dialog({//使用W,即为使用顶级页面作为openner,造成打开的次级窗口获取不到关联的主窗口
  724. content: 'url:'+addurl,
  725. lock : true,
  726. width:width,
  727. zIndex:getzIndex(),
  728. height:height,
  729. parent:windowapi,
  730. title:title,
  731. opacity : 0.3,
  732. cache:false,
  733. });
  734. }
  735. }
  736. //--author:zhaohualong---------date:20170801---------for:弹出窗口优化,屏蔽确定取消按钮
  737. /**
  738. * 创建上传页面窗口
  739. *
  740. * @param title
  741. * @param addurl
  742. * @param saveurl
  743. */
  744. function openuploadwin(title, url,name,width, height) {
  745. gridname=name;
  746. $.dialog({
  747. content: 'url:'+url,
  748. zIndex: getzIndex(),
  749. cache:false,
  750. button: [
  751. {
  752. name: "开始上传",
  753. callback: function(){
  754. iframe = this.iframe.contentWindow;
  755. iframe.upload();
  756. return false;
  757. },
  758. focus: true
  759. },
  760. {
  761. name: "取消上传",
  762. callback: function(){
  763. iframe = this.iframe.contentWindow;
  764. iframe.cancel();
  765. }
  766. }
  767. ]
  768. });
  769. }
  770. /**
  771. * 创建查询页面窗口
  772. *
  773. * @param title
  774. * @param addurl
  775. * @param saveurl
  776. */
  777. function opensearchdwin(title, url, width, height) {
  778. $.dialog({
  779. content: 'url:'+url,
  780. zIndex: getzIndex(),
  781. title : title,
  782. lock : true,
  783. height : height,
  784. cache:false,
  785. width : width,
  786. opacity : 0.3,
  787. button : [ {
  788. name : '查询',
  789. callback : function() {
  790. iframe = this.iframe.contentWindow;
  791. iframe.searchs();
  792. },
  793. focus : true
  794. }, {
  795. name : '取消',
  796. callback : function() {
  797. }
  798. } ]
  799. });
  800. }
  801. /**
  802. * 创建不带按钮的窗口
  803. *
  804. * @param title
  805. * @param addurl
  806. * @param saveurl
  807. */
  808. function openwindow(title, url,name, width, height) {
  809. //update-begin--Author:scott --- Date:20170406 --- for:弹出窗口最大化问题处理----
  810. if(width=="100%" || height=="100%"){
  811. width = window.top.document.body.offsetWidth;
  812. height =window.top.document.body.offsetHeight-100;
  813. }
  814. //update-end--Author:scott --- Date:20170406 --- for:弹出窗口最大化问题处理----
  815. gridname=name;
  816. if (typeof (width) == 'undefined'&&typeof (height) != 'undefined')
  817. {
  818. if(typeof(windowapi) == 'undefined'){
  819. $.dialog({
  820. content: 'url:'+url,
  821. zIndex: getzIndex(),
  822. title : title,
  823. cache:false,
  824. lock : true,
  825. width: 'auto',
  826. height: height
  827. });
  828. }else{
  829. $.dialog({
  830. content: 'url:'+url,
  831. zIndex: getzIndex(),
  832. title : title,
  833. cache:false,
  834. parent:windowapi,
  835. lock : true,
  836. width: 'auto',
  837. height: height
  838. });
  839. }
  840. }
  841. if (typeof (height) == 'undefined'&&typeof (width) != 'undefined')
  842. {
  843. if(typeof(windowapi) == 'undefined'){
  844. $.dialog({
  845. content: 'url:'+url,
  846. title : title,
  847. zIndex: getzIndex(),
  848. lock : true,
  849. width: width,
  850. cache:false,
  851. height: 'auto'
  852. });
  853. }else{
  854. $.dialog({
  855. content: 'url:'+url,
  856. zIndex: getzIndex(),
  857. title : title,
  858. lock : true,
  859. parent:windowapi,
  860. width: width,
  861. cache:false,
  862. height: 'auto'
  863. });
  864. }
  865. }
  866. if (typeof (width) == 'undefined'&&typeof (height) == 'undefined')
  867. {
  868. if(typeof(windowapi) == 'undefined'){
  869. $.dialog({
  870. content: 'url:'+url,
  871. zIndex: getzIndex(),
  872. title : title,
  873. lock : true,
  874. width: 'auto',
  875. cache:false,
  876. height: 'auto'
  877. });
  878. }else{
  879. $.dialog({
  880. content: 'url:'+url,
  881. zIndex: getzIndex(),
  882. title : title,
  883. lock : true,
  884. parent:windowapi,
  885. width: 'auto',
  886. cache:false,
  887. height: 'auto'
  888. });
  889. }
  890. }
  891. if (typeof (width) != 'undefined'&&typeof (height) != 'undefined')
  892. {
  893. if(typeof(windowapi) == 'undefined'){
  894. $.dialog({
  895. width: width,
  896. height:height,
  897. content: 'url:'+url,
  898. zIndex: getzIndex(),
  899. title : title,
  900. cache:false,
  901. lock : true
  902. });
  903. }else{
  904. $.dialog({
  905. width: width,
  906. height:height,
  907. content: 'url:'+url,
  908. zIndex: getzIndex(),
  909. parent:windowapi,
  910. title : title,
  911. cache:false,
  912. lock : true
  913. });
  914. }
  915. }
  916. }
  917. /**
  918. * 创建询问窗口
  919. *
  920. * @param title
  921. * @param content
  922. * @param url
  923. */
  924. function createdialog(title, content, url,name) {
  925. $.dialog.setting.zIndex = getzIndex(true);
  926. // $.dialog.confirm(content, function(){
  927. // doSubmit(url,name);
  928. // rowid = '';
  929. // }, function(){
  930. // });
  931. //update--begin---author:zhangjiaqiang date:20170301 for:修订提示框
  932. var navigatorName = "Microsoft Internet Explorer";
  933. //update--begin--author:zhangjiaqiang date:20170711 for:TASK 2218 shortcut风格 使用jqueryui对话框
  934. if( navigator.appName == navigatorName ||"shortcut".indexOf(getCookie("JEECGINDEXSTYLE"))>=0){
  935. //update--begin--author:zhangjiaqiang date:20170711 for:TASK 2218 shortcut风格 使用jqueryui对话框
  936. $.dialog.confirm(content, function(){
  937. doSubmit(url,name);
  938. rowid = '';
  939. }, function(){
  940. });
  941. }else{
  942. layer.open({
  943. title:title,
  944. content:content,
  945. icon:7,
  946. yes:function(index){
  947. doSubmit(url,name);
  948. rowid = '';
  949. },
  950. btn:['确定','取消'],
  951. btn2:function(index){
  952. layer.close(index);
  953. }
  954. });
  955. }
  956. //update--end---author:zhangjiaqiang date:20170301 for:修订提示框
  957. }
  958. /**
  959. * 执行保存
  960. *
  961. * @param url
  962. * @param gridname
  963. */
  964. function saveObj() {
  965. $('#btn_sub', iframe.document).click();
  966. }
  967. /**
  968. * 执行AJAX提交FORM
  969. *
  970. * @param url
  971. * @param gridname
  972. */
  973. function ajaxSubForm(url) {
  974. $('#myform', iframe.document).form('submit', {
  975. url : url,
  976. onSubmit : function() {
  977. iframe.editor.sync();
  978. },
  979. success : function(r) {
  980. tip('操作成功');
  981. reloadTable();
  982. }
  983. });
  984. }
  985. /**
  986. * 执行查询
  987. *
  988. * @param url
  989. * @param gridname
  990. */
  991. function search() {
  992. $('#btn_sub', iframe.document).click();
  993. iframe.search();
  994. }
  995. /**
  996. * 执行操作
  997. *
  998. * @param url
  999. * @param index
  1000. */
  1001. function doSubmit(url,name,data) {
  1002. gridname=name;
  1003. //--author:JueYue ---------date:20140227---------for:把URL转换成POST参数防止URL参数超出范围的问题
  1004. var paramsData = data;
  1005. if(!paramsData){
  1006. paramsData = new Object();
  1007. if (url.indexOf("&") != -1) {
  1008. var str = url.substr(url.indexOf("&")+1);
  1009. url = url.substr(0,url.indexOf("&"));
  1010. var strs = str.split("&");
  1011. for(var i = 0; i < strs.length; i ++) {
  1012. paramsData[strs[i].split("=")[0]]=(strs[i].split("=")[1]);
  1013. }
  1014. }
  1015. }
  1016. //--author:JueYue ---------date:20140227---------for:把URL转换成POST参数防止URL参数超出范围的问题
  1017. $.ajax({
  1018. async : false,
  1019. cache : false,
  1020. type : 'POST',
  1021. data : paramsData,
  1022. url : url,// 请求的action路径
  1023. error : function() {// 请求失败处理函数
  1024. },
  1025. success : function(data) {
  1026. var d = data; // ------ $.parseJSON(data);
  1027. if (d.success) {
  1028. var msg = d.msg;
  1029. tip(msg);
  1030. reloadTable();
  1031. } else {
  1032. //--author:zhaohualong-----start----date: 2017年10月20日--------for:当签收任务失败时, 也刷新列表------
  1033. if (url.indexOf("activitiController.do?claim") != -1){
  1034. reloadTable();
  1035. }
  1036. //--author:zhaohualong-----end----date: 2017年10月20日--------for:当签收任务失败时, 也刷新列表------
  1037. alertTip(d.msg);
  1038. }
  1039. }
  1040. });
  1041. }
  1042. /**
  1043. * 退出确认框
  1044. *
  1045. * @param url
  1046. * @param content
  1047. * @param index
  1048. */
  1049. function exit(url, content) {
  1050. $.dialog.setting.zIndex = getzIndex(true);
  1051. $.dialog.confirm(content, function(){
  1052. window.location = url;
  1053. }, function(){
  1054. });
  1055. }
  1056. /**
  1057. * 模板页面ajax提交
  1058. *
  1059. * @param url
  1060. * @param gridname
  1061. */
  1062. function ajaxdoSub(url, formname) {
  1063. $('#' + formname).form('submit', {
  1064. url : url,
  1065. onSubmit : function() {
  1066. editor.sync();
  1067. },
  1068. success : function(r) {
  1069. tip('操作成功');
  1070. }
  1071. });
  1072. }
  1073. /**
  1074. * ajax提交FORM
  1075. *
  1076. * @param url
  1077. * @param gridname
  1078. */
  1079. function ajaxdoForm(url, formname) {
  1080. $('#' + formname).form('submit', {
  1081. url : url,
  1082. onSubmit : function() {
  1083. },
  1084. success : function(r) {
  1085. tip('操作成功');
  1086. }
  1087. });
  1088. }
  1089. function opensubwin(title, url, saveurl, okbutton, closebutton) {
  1090. $.dialog({
  1091. content: 'url:'+url,
  1092. zIndex: getzIndex(),
  1093. title : title,
  1094. lock : true,
  1095. opacity : 0.3,
  1096. button : [ {
  1097. name : okbutton,
  1098. callback : function() {
  1099. iframe = this.iframe.contentWindow;
  1100. win = frameElement.api.opener;// 来源页面
  1101. $('#btn_sub', iframe.document).click();
  1102. return false;
  1103. }
  1104. }, {
  1105. name : closebutton,
  1106. callback : function() {
  1107. }
  1108. } ]
  1109. });
  1110. }
  1111. function openauditwin(title, url, saveurl, okbutton, backbutton, closebutton) {
  1112. $.dialog({
  1113. content: 'url:'+url,
  1114. zIndex: getzIndex(),
  1115. title : title,
  1116. lock : true,
  1117. opacity : 0.3,
  1118. button : [ {
  1119. name : okbutton,
  1120. callback : function() {
  1121. iframe = this.iframe.contentWindow;
  1122. win = $.dialog.open.origin;// 来源页面
  1123. $('#btn_sub', iframe.document).click();
  1124. return false;
  1125. }
  1126. }, {
  1127. name : backbutton,
  1128. callback : function() {
  1129. iframe = this.iframe.contentWindow;
  1130. win = frameElement.api.opener;// 来源页面
  1131. $('#formobj', iframe.document).form('submit', {
  1132. url : saveurl + "&code=exit",
  1133. onSubmit : function() {
  1134. $('#code').val('exit');
  1135. },
  1136. success : function(r) {
  1137. $.dialog.tips('操作成功', 2);
  1138. win.location.reload();
  1139. }
  1140. });
  1141. }
  1142. }, {
  1143. name : closebutton,
  1144. callback : function() {
  1145. }
  1146. } ]
  1147. });
  1148. }
  1149. /*获取Cookie值*/
  1150. function getCookie(c_name)
  1151. {
  1152. if (document.cookie.length > 0) {
  1153. c_start = document.cookie.indexOf(c_name + "=")
  1154. if (c_start != -1) {
  1155. c_start = c_start + c_name.length + 1
  1156. c_end = document.cookie.indexOf(";", c_start)
  1157. if (c_end == -1)
  1158. c_end = document.cookie.length
  1159. return unescape(document.cookie.substring(c_start, c_end))
  1160. }
  1161. }
  1162. return ""
  1163. }
  1164. /* 设置 cookie */
  1165. function setCookie(c_name, value, expiredays){
  1166. var exdate=new Date();
  1167. exdate.setDate(exdate.getDate() + expiredays);
  1168. document.cookie=c_name+ "=" + escape(value) + ((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
  1169. }
  1170. function createTabId(str){
  1171.     var val="";
  1172.     for(var i = 0; i < str.length; i++){
  1173.         val += str.charCodeAt(i).toString(16);
  1174.     }
  1175.     return val;
  1176.   }
  1177. // 添加标签
  1178. function addOneTab(subtitle, url, icon) {
  1179. var indexStyle = getCookie("JEECGINDEXSTYLE");
  1180. if(indexStyle=='sliding'||indexStyle=='bootstrap'){
  1181. //shortcut和bootstrap风格的tab跳转改为直接跳转
  1182. window.location.href=url;
  1183. }else if(indexStyle=='acele'||indexStyle=='ace'){
  1184. var id = "";
  1185. //if(url.indexOf("=")!=-1){
  1186. // id = url.substring(url.indexOf("=")+1);
  1187. //}else{
  1188. id = createTabId(subtitle);
  1189. //}
  1190. window.top.addTabs({id:id,title:subtitle,close: true,url: url});
  1191. }else if(indexStyle=='hplus'){
  1192. var id = "";
  1193. id = createTabId(subtitle);
  1194. window.top.addTabs({id:id,title:subtitle,close: true,url: url});
  1195. }else{
  1196. if (icon == '') {
  1197. icon = 'icon folder';
  1198. }
  1199. window.top.$.messager.progress({
  1200. text : '页面加载中....',
  1201. interval : 300
  1202. });
  1203. window.top.$('#maintabs').tabs({
  1204. onClose : function(subtitle, index) {
  1205. window.top.$.messager.progress('close');
  1206. }
  1207. });
  1208. if (window.top.$('#maintabs').tabs('exists', subtitle)) {
  1209. window.top.$('#maintabs').tabs('select', subtitle);
  1210. if (url.indexOf('isHref') != -1) {
  1211. window.top.$('#maintabs').tabs('update', {
  1212. tab : window.top.$('#maintabs').tabs('getSelected'),
  1213. options : {
  1214. title : subtitle,
  1215. href:url,
  1216. //content : '<iframe src="' + url + '" frameborder="0" style="border:0;width:100%;height:99.4%;"></iframe>',
  1217. closable : true,
  1218. icon : icon
  1219. }
  1220. });
  1221. }else {
  1222. window.top.$('#maintabs').tabs('update', {
  1223. tab : window.top.$('#maintabs').tabs('getSelected'),
  1224. options : {
  1225. title : subtitle,
  1226. content : '<iframe src="' + url + '" frameborder="0" style="border:0;width:100%;height:99.4%;"></iframe>',
  1227. //content : '<iframe src="' + url + '" frameborder="0" style="border:0;width:100%;height:99.4%;"></iframe>',
  1228. closable : true,
  1229. icon : icon
  1230. }
  1231. });
  1232. }
  1233. } else {
  1234. if (url.indexOf('isHref') != -1) {
  1235. window.top.$('#maintabs').tabs('add', {
  1236. title : subtitle,
  1237. href:url,
  1238. closable : true,
  1239. icon : icon
  1240. });
  1241. }else {
  1242. window.top.$('#maintabs').tabs('add', {
  1243. title : subtitle,
  1244. content : '<iframe src="' + url + '" frameborder="0" style="border:0;width:100%;height:99.4%;"></iframe>',
  1245. closable : true,
  1246. icon : icon
  1247. });
  1248. }
  1249. }
  1250. }
  1251. }
  1252. // 关闭自身TAB刷新父TABgrid
  1253. function closetab(title) {
  1254. //暂时先不刷新
  1255. //window.top.document.getElementById('tabiframe').contentWindow.reloadTable();
  1256. //window.top.document.getElementById('maintabs').contentWindow.reloadTable();
  1257. window.top.$('#maintabs').tabs('close', title);
  1258. //tip("添加成功");
  1259. }
  1260. //popup
  1261. //object: this name:需要选择的列表的字段 code:动态报表的code
  1262. function inputClick(obj,name,code) {
  1263. if(name==""||code==""){
  1264. alert("popup参数配置不全");
  1265. return;
  1266. }
  1267. //update-begin--Author:scott --- Date:20170401 --- for:inputclick ajax请求追加根路径,防止深路径访问有问题----
  1268. var inputClickUrl = basePath + "/cgReportController.do?popup&id="+code;
  1269. //update-end--Author:scott --- Date:20170401 --- for:inputclick ajax请求追加根路径,防止深路径访问有问题----
  1270. if(typeof(windowapi) == 'undefined'){
  1271. $.dialog({
  1272. content: "url:"+inputClickUrl,
  1273. zIndex: getzIndex(),
  1274. lock : true,
  1275. title:"选择",
  1276. width:800,
  1277. height: 400,
  1278. cache:false,
  1279. ok: function(){
  1280. iframe = this.iframe.contentWindow;
  1281. var selected = iframe.getSelectRows();
  1282. if (selected == '' || selected == null ){
  1283. alert("请选择");
  1284. return false;
  1285. }else {
  1286. var str = "";
  1287. $.each( selected, function(i, n){
  1288. if (i==0)
  1289. str+= n[name];
  1290. else
  1291. str+= ","+n[name];
  1292. });
  1293. $(obj).val("");
  1294. //$('#myText').searchbox('setValue', str);
  1295. $(obj).val(str);
  1296. return true;
  1297. }
  1298. },
  1299. cancelVal: '关闭',
  1300. cancel: true //为true等价于function(){}
  1301. });
  1302. }else{
  1303. $.dialog({
  1304. content: "url:"+inputClickUrl,
  1305. zIndex: getzIndex(),
  1306. lock : true,
  1307. title:"选择",
  1308. width:800,
  1309. height: 400,
  1310. parent:windowapi,
  1311. cache:false,
  1312. ok: function(){
  1313. iframe = this.iframe.contentWindow;
  1314. var selected = iframe.getSelectRows();
  1315. if (selected == '' || selected == null ){
  1316. alert("请选择");
  1317. return false;
  1318. }else {
  1319. var str = "";
  1320. $.each( selected, function(i, n){
  1321. if (i==0)
  1322. str+= n[name];
  1323. else
  1324. str+= ","+n[name];
  1325. });
  1326. $(obj).val("");
  1327. //$('#myText').searchbox('setValue', str);
  1328. $(obj).val(str);
  1329. return true;
  1330. }
  1331. },
  1332. cancelVal: '关闭',
  1333. cancel: true //为true等价于function(){}
  1334. });
  1335. }
  1336. }
  1337. /*
  1338. 自定义url的弹出
  1339. obj:要填充的控件,可以为多个,以逗号分隔
  1340. name:列表中对应的字段,可以为多个,以逗号分隔(与obj要对应)
  1341. url:弹出页面的Url
  1342. */
  1343. function popClick_embed(obj,name,url,callback) {
  1344. $.dialog.setting.zIndex = getzIndex(true);
  1345. var names = name.split(",");
  1346. var objs = obj.split(",");
  1347. $.dialog({
  1348. content: "url:"+url,
  1349. zIndex: getzIndex(),
  1350. lock : true,
  1351. title:"选择",
  1352. width:900,
  1353. height: 600,
  1354. parent:windowapi,
  1355. cache:true,
  1356. ok: function(){
  1357. iframe = this.iframe.contentWindow;
  1358. var selected = iframe.getSelectRows();
  1359. //alert(JSON.stringify(selected));
  1360. //alert(names);
  1361. if (selected == '' || selected == null ){
  1362. alert("请选择");
  1363. return false;
  1364. }else {
  1365. for(var i1=0;i1<names.length;i1++){
  1366. var str = "";
  1367. $.each( selected, function(i, n){
  1368. if (i==0)
  1369. str+= n[names[i1]];
  1370. else{
  1371. str+= ",";
  1372. str+=n[names[i1]];
  1373. }
  1374. });
  1375. if($("#"+objs[i1]).length>=1){
  1376. $("#"+objs[i1]).val("");
  1377. $("#"+objs[i1]).val(str);
  1378. }else{
  1379. $("[name='"+objs[i1]+"']").val("");
  1380. $("[name='"+objs[i1]+"']").val(str);
  1381. }
  1382. }
  1383. if(typeof callback!="undefined"){
  1384. callback();
  1385. }
  1386. return true;
  1387. }
  1388. },
  1389. cancelVal: '关闭',
  1390. cancel: true /*为true等价于function(){}*/
  1391. });
  1392. }
  1393. /*
  1394. 自定义url的弹出
  1395. obj:要填充的控件,可以为多个,以逗号分隔
  1396. name:列表中对应的字段,可以为多个,以逗号分隔(与obj要对应)
  1397. url:弹出页面的Url
  1398. */
  1399. function popClick(obj,name,url) {
  1400. $.dialog.setting.zIndex = getzIndex(true);
  1401. var names = name.split(",");
  1402. var objs = obj.split(",");
  1403. if(typeof(windowapi) == 'undefined'){
  1404. $.dialog({
  1405. content: "url:"+url,
  1406. zIndex: getzIndex(),
  1407. lock : true,
  1408. title:"选择",
  1409. width:700,
  1410. height: 400,
  1411. cache:false,
  1412. ok: function(){
  1413. iframe = this.iframe.contentWindow;
  1414. var selected = iframe.getSelectRows();
  1415. if (selected == '' || selected == null ){
  1416. alert("请选择");
  1417. return false;
  1418. }else {
  1419. for(var i1=0;i1<names.length;i1++){
  1420. var str = "";
  1421. $.each( selected, function(i, n){
  1422. if (i==0)
  1423. str+= n[names[i1]];
  1424. else{
  1425. str+= ",";
  1426. str+=n[names[i1]];
  1427. }
  1428. });
  1429. if($("#"+objs[i1]).length>=1){
  1430. $("#"+objs[i1]).val("");
  1431. $("#"+objs[i1]).val(str);
  1432. }else{
  1433. $("input[name='"+objs[i1]+"']").val("");
  1434. $("input[name='"+objs[i1]+"']").val(str);
  1435. }
  1436. }
  1437. return true;
  1438. }
  1439. },
  1440. cancelVal: '关闭',
  1441. cancel: true /*为true等价于function(){}*/
  1442. });
  1443. }else{
  1444. $.dialog({
  1445. content: "url:"+url,
  1446. zIndex: getzIndex(),
  1447. lock : true,
  1448. title:"选择",
  1449. width:700,
  1450. height: 400,
  1451. parent:windowapi,
  1452. cache:false,
  1453. ok: function(){
  1454. iframe = this.iframe.contentWindow;
  1455. var selected = iframe.getSelectRows();
  1456. if (selected == '' || selected == null ){
  1457. alert("请选择");
  1458. return false;
  1459. }else {
  1460. for(var i1=0;i1<names.length;i1++){
  1461. var str = "";
  1462. $.each( selected, function(i, n){
  1463. if (i==0)
  1464. str+= n[names[i1]];
  1465. else{
  1466. str+= ",";
  1467. str+=n[names[i1]];
  1468. }
  1469. });
  1470. if($("#"+objs[i1]).length>=1){
  1471. $("#"+objs[i1]).val("");
  1472. $("#"+objs[i1]).val(str);
  1473. }else{
  1474. $("[name='"+objs[i1]+"']").val("");
  1475. $("[name='"+objs[i1]+"']").val(str);
  1476. }
  1477. }
  1478. return true;
  1479. }
  1480. },
  1481. cancelVal: '关闭',
  1482. cancel: true /*为true等价于function(){}*/
  1483. });
  1484. }
  1485. }
  1486. /**
  1487. * Jeecg Excel 导出
  1488. * 代入查询条件
  1489. */
  1490. function JeecgExcelExport(url,datagridId){
  1491. var queryParams = $('#'+datagridId).datagrid('options').queryParams;
  1492. $('#'+datagridId+'tb').find('*').each(function() {
  1493. queryParams[$(this).attr('name')] = $(this).val();
  1494. });
  1495. var params = '&';
  1496. $.each(queryParams, function(key, val){
  1497. params+='&'+key+'='+val;
  1498. });
  1499. var fields = '&field=';
  1500. $.each($('#'+ datagridId).datagrid('options').columns[0], function(i, val){
  1501. if(val.field != 'opt'){
  1502. fields+=val.field+',';
  1503. }
  1504. });
  1505. //update-begin--Author:dangzhenghui Date:20170429 for:TASK #1869 【demo】jeecg excel导出 可以导出 指定行的数据
  1506. var id='&id=';
  1507. //update-by yulong.zhao 17-10-15 注释该代码具体业务不需要导出指定行
  1508. $.each($('#'+ datagridId).datagrid('getSelections'), function(i, val){
  1509. id+=val.id+",";
  1510. });
  1511. // alert(fields+params+id);
  1512. layer.msg('数据导出中,请稍候···', {
  1513. time : 6000,
  1514. shade: 0.1});
  1515. window.location.href = url+ encodeURI(fields+params+id);
  1516. }
  1517. /**
  1518. * 自动完成的解析函数
  1519. * @param data
  1520. * @returns {Array}
  1521. */
  1522. function jeecgAutoParse(data){
  1523. var parsed = [];
  1524. $.each(data.rows,function(index,row){
  1525. parsed.push({data:row,result:row,value:row.id});
  1526. });
  1527. return parsed;
  1528. }
  1529. //add--start--Author:xugj date:20160531 for: TASK #1089 【demo】针对jeecgdemo,实现一个新的页面方式
  1530. /**
  1531. * 更新跳转新页面
  1532. * @param title 编辑框标题 未实现标题改变
  1533. * @param addurl//目标页面地址
  1534. * @param id//主键字段
  1535. */
  1536. function updateNotCreateWin(title,url, id,isRestful) {
  1537. var rowsData = $('#'+id).datagrid('getSelections');
  1538. if (!rowsData || rowsData.length==0) {
  1539. tip('请选择编辑项目');
  1540. return;
  1541. }
  1542. if (rowsData.length>1) {
  1543. tip('请选择一条记录再编辑');
  1544. return;
  1545. }
  1546. if(isRestful!='undefined'&&isRestful){
  1547. url += '/'+rowsData[0].id;
  1548. }else{
  1549. url += '&id='+rowsData[0].id;
  1550. }
  1551. window.location.href=url
  1552. }
  1553. /**
  1554. * 查看详情跳转新页面
  1555. * @param title 编辑框标题 未实现标题改变
  1556. * @param id//主键字段
  1557. */
  1558. function viewNotCreateWin(title,url, id,isRestful)
  1559. {
  1560. var rowsData = $('#'+id).datagrid('getSelections');
  1561. if (!rowsData || rowsData.length==0) {
  1562. tip('请选择查看项目');
  1563. return;
  1564. }
  1565. if (rowsData.length>1) {
  1566. tip('请选择一条记录再查看');
  1567. return;
  1568. }
  1569. if(isRestful!='undefined'&&isRestful){
  1570. url += '/'+rowsData[0].id;
  1571. }else{
  1572. url += '&id='+rowsData[0].id;
  1573. }
  1574. window.location.href=url
  1575. }
  1576. //add--end--Author:xugj date:20160531 for: TASK #1089 【demo】针对jeecgdemo,实现一个新的页面方式
  1577. //add--start--Author:gengjiajia date:20160802 for: TASK #1175 批量添加数据的时popup多值的传递
  1578. //popup
  1579. //object: pobj当前操作的文本框. tablefield:对应字典TEXT,要从popup报表中获取的字段.inputnames:对应字典CODE,当前需要回填数据的文本框名称. pcode:动态报表的code
  1580. function popupClick(pobj,tablefield,inputnames,pcode) {
  1581. $.dialog.setting.zIndex = getzIndex(true);
  1582. if(inputnames==""||pcode==""){
  1583. alert("popup参数配置不全");
  1584. return;
  1585. }
  1586. if(typeof(windowapi) == 'undefined'){
  1587. $.dialog({
  1588. content: "url:cgReportController.do?popup&id="+pcode,
  1589. zIndex: getzIndex(),
  1590. lock : true,
  1591. title:"选择",
  1592. width:800,
  1593. height: 400,
  1594. cache:false,
  1595. ok: function(){
  1596. iframe = this.iframe.contentWindow;
  1597. var selected = iframe.getSelectRows();
  1598. if (selected == '' || selected == null ){
  1599. alert("请选择");
  1600. return false;
  1601. }else {
  1602. //对应数据库字段不为空的情况下,根据表单中字典TEXT的值来取popup的值
  1603. if(tablefield != "" && tablefield != null){
  1604. var fields = tablefield.split(",");
  1605. var inputfield = inputnames.split(",");
  1606. for(var i1=0;i1<fields.length;i1++){
  1607. var str = "";
  1608. $.each( selected, function(i, n){
  1609. if (i==0)
  1610. str+= n[fields[i1]];
  1611. else{
  1612. str+= ",";
  1613. str+=n[fields[i1]];
  1614. }
  1615. });
  1616. var inputname = $(pobj).attr("name");
  1617. var inputs = inputname.split(".");
  1618. //判断传入的this格式是否为 "AA[#index#].aa"的形式
  1619. if(str.indexOf("undefined")==-1){
  1620. if(inputs.length>1){
  1621. var inpu = inputs[i1]+"."+inputfield[i1];
  1622. $("input[name='"+inpu+"']").val(str);
  1623. }else{
  1624. $("input[name='"+inputfield[i1]+"']").val(str);
  1625. }
  1626. }else{
  1627. if(inputs.length>1){
  1628. var inpu = inputs[i1]+"."+inputfield[i1];
  1629. $("input[name='"+inpu+"']").val("");
  1630. }else{
  1631. $("input[name='"+inputfield[i1]+"']").val("");
  1632. }
  1633. }
  1634. }
  1635. }else{
  1636. //对应数据库字段为空的情况下并且字典CODE传入多个值时,根据表单中字典CODE的值从popup中来取值
  1637. var inputfield = inputnames.split(",");
  1638. if(inputfield.length>1){
  1639. for(var i1=0;i1<inputfield.length;i1++){
  1640. var str = "";
  1641. $.each( selected, function(i, n){
  1642. if (i==0)
  1643. str+= n[inputfield[i1]];
  1644. else{
  1645. str+= ",";
  1646. str+=n[inputfield[i1]];
  1647. }
  1648. });
  1649. var inputname = $(pobj).attr("name");
  1650. var inputs = inputname.split(".");
  1651. if(str.indexOf("undefined")==-1){
  1652. if(inputs.length>1){
  1653. var inpu = inputs[i1]+"."+inputfield[i1];
  1654. $("input[name='"+inpu+"']").val(str);
  1655. }else{
  1656. $("input[name='"+inputfield[i1]+"']").val(str);
  1657. }
  1658. }else{
  1659. if(inputs.length>1){
  1660. var inpu = inputs[i1]+"."+inputfield[i1];
  1661. $("input[name='"+inpu+"']").val("");
  1662. }else{
  1663. $("input[name='"+inputfield[i1]+"']").val("");
  1664. }
  1665. }
  1666. }
  1667. }else{
  1668. //对应数据库字段为空的情况下并且字典CODE传入一个值时,根据表单中字典TEXT的值从popup中来取值
  1669. var str = "";
  1670. $.each( selected, function(i, n){
  1671. if (i==0)
  1672. str+= n[inputfield];
  1673. else
  1674. str+= ","+n[inputfield];
  1675. });
  1676. var inputname = $(pobj).attr("name");
  1677. var inputs = inputname.split(".");
  1678. if(str.indexOf("undefined")==-1){
  1679. if(inputs.length>1){
  1680. var inpu = inputs[i1]+"."+inputfield[i1];
  1681. $("input[name='"+inpu+"']").val(str);
  1682. }else{
  1683. $("input[name='"+inputfield+"']").val(str);
  1684. }
  1685. }else{
  1686. if(inputs.length>1){
  1687. var inpu = inputs[i1]+"."+inputfield[i1];
  1688. $("input[name='"+inpu+"']").val("");
  1689. }else{
  1690. $("input[name='"+inputfield+"']").val("");
  1691. }
  1692. }
  1693. }
  1694. }
  1695. return true;
  1696. }
  1697. },
  1698. cancelVal: '关闭',
  1699. cancel: true // 为true等价于function(){}
  1700. });
  1701. }else{
  1702. $.dialog({
  1703. content: "url:cgReportController.do?popup&id="+pcode,
  1704. zIndex: getzIndex(),
  1705. lock : true,
  1706. title:"选择",
  1707. width:800,
  1708. height: 400,
  1709. parent:windowapi,
  1710. cache:false,
  1711. ok: function(){
  1712. iframe = this.iframe.contentWindow;
  1713. var selected = iframe.getSelectRows();
  1714. if (selected == '' || selected == null ){
  1715. alert("请选择");
  1716. return false;
  1717. }else {
  1718. //对应数据库字段不为空的情况下,根据表单中字典TEXT的值来取popup的值
  1719. if(tablefield != "" && tablefield != null){
  1720. var fields = tablefield.split(",");
  1721. var inputfield = inputnames.split(",");
  1722. for(var i1=0;i1<fields.length;i1++){
  1723. var str = "";
  1724. $.each( selected, function(i, n){
  1725. if (i==0)
  1726. str+= n[fields[i1]];
  1727. else{
  1728. str+= ",";
  1729. str+=n[fields[i1]];
  1730. }
  1731. });
  1732. var inputname = $(pobj).attr("name");
  1733. var inputs = inputname.split(".");
  1734. //判断传入的this格式是否为 "AA[#index#].aa"的形式
  1735. if(str.indexOf("undefined")==-1){
  1736. if(inputs.length>1){
  1737. var inpu = inputs[i1]+"."+inputfield[i1];
  1738. $("input[name='"+inpu+"']").val(str);
  1739. }else{
  1740. $("input[name='"+inputfield[i1]+"']").val(str);
  1741. }
  1742. }else{
  1743. if(inputs.length>1){
  1744. var inpu = inputs[i1]+"."+inputfield[i1];
  1745. $("input[name='"+inpu+"']").val("");
  1746. }else{
  1747. $("input[name='"+inputfield[i1]+"']").val("");
  1748. }
  1749. }
  1750. }
  1751. }else{
  1752. //对应数据库字段为空的情况下并且字典CODE传入多个值时,根据表单中字典CODE的值从popup中来取值
  1753. var inputfield = inputnames.split(",");
  1754. if(inputfield.length>1){
  1755. for(var i1=0;i1<inputfield.length;i1++){
  1756. var str = "";
  1757. $.each( selected, function(i, n){
  1758. if (i==0)
  1759. str+= n[inputfield[i1]];
  1760. else{
  1761. str+= ",";
  1762. str+=n[inputfield[i1]];
  1763. }
  1764. });
  1765. var inputname = $(pobj).attr("name");
  1766. var inputs = inputname.split(".");
  1767. if(str.indexOf("undefined")==-1){
  1768. if(inputs.length>1){
  1769. var inpu = inputs[i1]+"."+inputfield[i1];
  1770. $("input[name='"+inpu+"']").val(str);
  1771. }else{
  1772. $("input[name='"+inputfield[i1]+"']").val(str);
  1773. }
  1774. }else{
  1775. if(inputs.length>1){
  1776. var inpu = inputs[i1]+"."+inputfield[i1];
  1777. $("input[name='"+inpu+"']").val("");
  1778. }else{
  1779. $("input[name='"+inputfield[i1]+"']").val("");
  1780. }
  1781. }
  1782. }
  1783. }else{
  1784. //对应数据库字段为空的情况下并且字典CODE传入一个值时,根据表单中字典TEXT的值从popup中来取值
  1785. var str = "";
  1786. $.each( selected, function(i, n){
  1787. if (i==0)
  1788. str+= n[inputfield];
  1789. else
  1790. str+= ","+n[inputfield];
  1791. });
  1792. var inputname = $(pobj).attr("name");
  1793. var inputs = inputname.split(".");
  1794. if(str.indexOf("undefined")==-1){
  1795. if(inputs.length>1){
  1796. var inpu = inputs[i1]+"."+inputfield[i1];
  1797. $("input[name='"+inpu+"']").val(str);
  1798. }else{
  1799. $("input[name='"+inputfield+"']").val(str);
  1800. }
  1801. }else{
  1802. if(inputs.length>1){
  1803. var inpu = inputs[i1]+"."+inputfield[i1];
  1804. $("input[name='"+inpu+"']").val("");
  1805. }else{
  1806. $("input[name='"+inputfield+"']").val("");
  1807. }
  1808. }
  1809. }
  1810. }
  1811. return true;
  1812. }
  1813. },
  1814. cancelVal: '关闭',
  1815. cancel: true // 为true等价于function(){}
  1816. });
  1817. }
  1818. }
  1819. //add--end--Author:gengjiajia date:20160802 for: TASK #1175 批量添加数据的时popup多值的传递
  1820. //update--begin--author:zhangjiaqiang date:20170527 for:增加鼠标放在图片上方,显示图片大图
  1821. /*
  1822. * 鼠标放在图片上方,显示大图
  1823. */
  1824. var bigImgIndex = null;
  1825. function tipImg(obj){
  1826. try{
  1827. var navigatorName = "Microsoft Internet Explorer";
  1828. if( navigator.appName != navigatorName ){
  1829. if(obj.nodeName == 'IMG'){
  1830. var e = window.event;
  1831. var x = e.clientX+document.body.scrollLeft + document.documentElement.scrollLeft
  1832. var y = e.clientY+document.body.scrollTop + document.documentElement.scrollTop
  1833. var src = obj.src;
  1834. var width = obj.naturalWidth;
  1835. var height = obj.naturalHeight;
  1836. bigImgIndex = layer.open({
  1837. content:[src,'no'],
  1838. type:2,
  1839. offset:[y+"px",x+"px"],
  1840. title:false,
  1841. area:[width+"px",height+"px"],
  1842. shade:0,
  1843. closeBtn:0
  1844. });
  1845. }
  1846. }
  1847. }catch(e){
  1848. }
  1849. }
  1850. //add--start--Author:赵华龙 date:20170801 for: 附件管理封装
  1851. /*
  1852. * 展示该业务表相关的附件
  1853. * 需要传入以下参数
  1854. * var webUpload = {
  1855. fileSingleSizeLimit:5242880,//String 类型 可为空 单个文件最大限制 默认5M[1024*1024*5]
  1856. duplicate:duplicate,// String 类型 可为空 默认为false 新上传的文件做重复性校验
  1857. busiTable : busiTable,//String 类型 可为空但是不建议为空 业务表名称
  1858. busiId : busiId,// String 类型 不可为空,关联业务id
  1859. bizType : bizType,//String 类型 不可为空 , 关联业务code
  1860. remark : remark,//String 类型 可为空 拓展字段 备注信息
  1861. createrDelete:createrDelete,是否为只允许创建者删除文件 默认为false
  1862. readOnly : readOnly,//String 类型 可为空 是否只读 备注false
  1863. extensions:extensions //String 类型 可为空 默认允许全部类型 允许的文件后缀,不带点,多个用逗号分割
  1864. };
  1865. *
  1866. */
  1867. function showFileList(webUpload) {
  1868. if(undefined==webUpload.busiId||null==webUpload.busiId||undefined==webUpload.bizType||null==webUpload.bizType)
  1869. {
  1870. tip('传入参数错误!');
  1871. return false;
  1872. }
  1873. if(undefined==webUpload.fileSingleSizeLimit|| null ==webUpload.fileSingleSizeLimit)
  1874. {
  1875. webUpload.fileSingleSizeLimit = '5242880';
  1876. }
  1877. if(undefined==webUpload.duplicate|| null==webUpload.duplicate)
  1878. {
  1879. webUpload.duplicate = "false";
  1880. }
  1881. if(undefined==webUpload.readOnly|| null==webUpload.readOnly)
  1882. {
  1883. webUpload.readOnly = "false";
  1884. }
  1885. if(undefined==webUpload.busiTable|| null ==webUpload.busiTable)
  1886. {
  1887. webUpload.busiTable = '';
  1888. }
  1889. if(undefined==webUpload.remark|| null ==webUpload.remark)
  1890. {
  1891. webUpload.remark = '';
  1892. }
  1893. if(undefined==webUpload.extensions|| null ==webUpload.extensions)
  1894. {
  1895. webUpload.extensions = '';
  1896. }
  1897. if(undefined==webUpload.createrDelete|| null ==webUpload.createrDelete)
  1898. {
  1899. webUpload.createrDelete = 'false';
  1900. }
  1901. console.log("入参");
  1902. console.log(webUpload);
  1903. $.dialog.setting.zIndex = getzIndex();
  1904. $.dialog(
  1905. {
  1906. content : 'url:tSysFileController.do?list'
  1907. + "&fileSingleSizeLimit=" + webUpload.fileSingleSizeLimit
  1908. + "&duplicate=" + webUpload.duplicate
  1909. + "&busiTable=" + webUpload.busiTable
  1910. + "&busiId=" + webUpload.busiId
  1911. + "&bizType=" + webUpload.bizType
  1912. + "&remark=" + webUpload.remark
  1913. + "&readOnly=" + webUpload.readOnly
  1914. + "&createrDelete=" + webUpload.createrDelete
  1915. + "&extensions=" + webUpload.extensions,
  1916. zIndex : getzIndex(),
  1917. title : '查看文件',//选择框标题
  1918. lock : true,//是否锁定 当为true 时 下层有蒙版,不允许用户在弹出窗口以外有其它操作
  1919. width : '800px',// 选择框宽度
  1920. height : '350px',//选择框高度
  1921. opacity : 0.4,//透明度 (经过测试 效果好像不太明显 )
  1922. button : [ {
  1923. name : '关闭',
  1924. focus : true,
  1925. callback : function() {
  1926. }
  1927. } ]
  1928. }).zindex();
  1929. }
  1930. //add--end--Author:赵华龙 date:20170801 for: 附件管理封装
  1931. function moveTipImg(){
  1932. try{
  1933. if(bigImgIndex != null){
  1934. layer.close(bigImgIndex);
  1935. }
  1936. }catch(e){
  1937. }
  1938. }
  1939. //update--end--author:zhangjiaqiang date:20170527 for:增加鼠标放在图片上方,显示图片大图
  1940. //--author:zhaohualong-----start----date:20180901--------for:合并单元格共通方法------
  1941. /**
  1942. * tableID datagrid id名称
  1943. * mergeFileds 需要合并单元格的列的集合 demo如下
  1944. * var mergeFileds=[
  1945. * {mergeFiled:"age"}, //合并列的field数组及对应前提条件filed(为空则直接内容合并)
  1946. * {mergeFiled:"depId",premiseFiled:"age"}, //合并列的field数组及对应前提条件filed(为空则直接内容合并)
  1947. * {mergeFiled:"sex",premiseFiled:"age"},
  1948. * {mergeFiled:"status",premiseFiled:"age"},
  1949. * {mergeFiled:"extField"}
  1950. * ];
  1951. */
  1952. function commonMergeCells(tableID,mergeFileds){
  1953. var arr = mergeFileds;
  1954. var dg = $('#' + tableID); // 要合并的datagrid中的表格id
  1955. var rowCount = dg.datagrid("getRows").length;
  1956. var cellName;
  1957. var span;
  1958. var perValue = "";
  1959. var curValue = "";
  1960. var perCondition="";
  1961. var curCondition="";
  1962. var flag=true;
  1963. var condiName="";
  1964. var length = arr.length - 1;
  1965. for (i = length; i >= 0; i--) {
  1966. cellName = arr[i].mergeFiled;
  1967. condiName=arr[i].premiseFiled;
  1968. if(null!=condiName){
  1969. flag=false;
  1970. }
  1971. perValue = "";
  1972. perCondition="";
  1973. span = 1;
  1974. for (row = 0; row <= rowCount; row++) {
  1975. if (row == rowCount) {
  1976. curValue = "";
  1977. curCondition="";
  1978. } else {
  1979. curValue = dg.datagrid("getRows")[row][cellName];
  1980. if(!flag){
  1981. curCondition=dg.datagrid("getRows")[row][condiName];
  1982. }
  1983. }
  1984. if (perValue == curValue&&(flag||perCondition==curCondition)) {
  1985. span += 1;
  1986. } else {
  1987. var index = row - span;
  1988. dg.datagrid('mergeCells', {
  1989. index : index,
  1990. field : cellName,
  1991. rowspan : span,
  1992. colspan : null
  1993. });
  1994. span = 1;
  1995. perValue = curValue;
  1996. if(!flag){
  1997. perCondition=curCondition;
  1998. }
  1999. }
  2000. }
  2001. }
  2002. }
  2003. //--author:zhaohualong-----end----date:20180901--------for:合并单元格共通方法------
  2004. //--author:zhaohualong-----start----date:20170908--------for:pdf预览------
  2005. /**
  2006. * 打开pdf 预览窗口
  2007. * @param title 窗口标题
  2008. * @param fileUrl //文件的访问路径
  2009. */
  2010. function showpdfview(title,fileUrl,width,height) {
  2011. url = "tSysFileController.do?showpdfview&fileUrl="+fileUrl;
  2012. if(undefined ==title ||'' ==title){
  2013. title ="pdf预览";
  2014. }
  2015. createwindowWithoutSavebtn(title, url,width,height);
  2016. }
  2017. //--author:zhaohualong-----start----date:20170908--------for:pdf预览------
  2018. /**
  2019. * 打开图片预览窗口
  2020. * @param title 窗口标题
  2021. * @param fileUrl //文件的访问路径
  2022. */
  2023. function showImgview(title,fileUrl,width,height) {
  2024. url = "tSysFileController.do?showPictureview&fileUrl="+fileUrl;
  2025. if(undefined ==title ||'' ==title){
  2026. title ="图片预览";
  2027. }
  2028. createwindowWithoutSavebtn(title, url,width,height);
  2029. }
  2030. /**
  2031. * 列表format 将分钟数 转化为 x 小时y 分钟
  2032. * @param value
  2033. * @param rec
  2034. * @param index
  2035. * @returns
  2036. */
  2037. function minsToHoursandMinsfmt(value, rec, index) {
  2038. var result = '';
  2039. if (null != value) {
  2040. var mins = value % 60;
  2041. var hour = (value - mins) / 60;
  2042. if (0 == hour) {
  2043. result = mins + '分'
  2044. } else {
  2045. if( mins<0){
  2046. mins = 0-mins;
  2047. }
  2048. result = hour + '小时' + mins + '分'
  2049. }
  2050. }
  2051. return result;
  2052. }
  2053. //update-begin-author:jiaqiankun date:20180713 for:TASK #2872 【新功能】列表按钮改造成配置,支持折叠模式,增加一个参数
  2054. function optsMenuToggle(data){
  2055. var dgPanel = $("#"+data).datagrid('getPanel');
  2056. //update-begin-author:taoYan date:20180718 for:TASK #2980 【BUG】分组按钮问题
  2057. var tr = dgPanel.find('div.datagrid-body tr');
  2058. tr.each(function(){
  2059. var td = tr.children('td[field="opt"]');
  2060. var toggleIcon = td.find(".opts-menu-triangle");
  2061. toggleIcon.mouseenter(function(){
  2062. $(this).parent(".datagrid-cell").addClass("menu-active");
  2063. var w = $(this).next('.opts-menu-container').find(".opts-menu-box").width();
  2064. var l = $(this).offset().left;
  2065. var il = $(this).next('.opts-menu-container').offset().left;
  2066. if(w+l+36<$(window).width()){
  2067. td.find(".opts-menu-box").css("left",(l-il+46)+"px");
  2068. }else{
  2069. td.find(".opts-menu-box").css("left",-(w-l+il+6)+"px");
  2070. }
  2071. });
  2072. td.mouseleave(function(){
  2073. td.children(".datagrid-cell").removeClass("menu-active");
  2074. });
  2075. });
  2076. //update-end-author:taoYan date:20180718 for:TASK #2980 【BUG】分组按钮问题
  2077. }
  2078. //点击页面当中的其他部分,隐藏分组按钮
  2079. $(document).click(function(){
  2080. $(".datagrid-cell").removeClass("menu-active");
  2081. });
  2082. //update-end-author:jiaqiankun date:20180713 for:TASK #2872 【新功能】列表按钮改造成配置,支持折叠模式,增加一个参数
  2083. //update-begin-author:zhoujf date:20180713 for:TASK #2809 【bug】网友反馈问题,字典性能问题
  2084. function loadAjaxDict(rowData){
  2085. $("body").find("span[name='ajaxDict']").each(function(i){
  2086. var $this = $(this);
  2087. var dictionary = $this.attr('dictionary');
  2088. var dictCondition = $this.attr('dictCondition');
  2089. var popup = $this.attr('popup');
  2090. var value = $this.attr('value');
  2091. $.ajax({
  2092. url : "commonController.do?getDictInfo",
  2093. type : 'post',
  2094. data : {
  2095. dictionary:dictionary,
  2096. dictCondition:dictCondition,
  2097. popup:popup,
  2098. value:value
  2099. },
  2100. dataType:"json",
  2101. async : true,
  2102. cache : false,
  2103. success : function(data) {
  2104. $this.html(data.obj);
  2105. }
  2106. });
  2107. });
  2108. }
  2109. //update-end-author:zhoujf date:20180713 for:TASK #2809 【bug】网友反馈问题,字典性能问题
  2110. //update-begin-author:taoyan date:20180717 for:TASK #2873 【新功能】按钮折叠功能
  2111. function toggleMoreToolbars(obj){
  2112. $(".toolbar-more-list").toggleClass("active");
  2113. if($(".toolbar-more-list").hasClass("active")){
  2114. $(".toolbar-more-list").css("left",-($(obj).next().offset().left-$(obj).offset().left)+"px");
  2115. $(".toolbar-more-list").css("top",($(obj).outerHeight(true)/2)+"px");
  2116. }
  2117. //鼠标移开 列表隐藏
  2118. $(".toolbar-more-list").mouseleave(function(){
  2119. $(".toolbar-more-list").removeClass("active");
  2120. });
  2121. }
  2122. //update-end-author:taoyan date:20180717 for:TASK #2873 【新功能】按钮折叠功能
  2123. //列表显示自定义样式,显示对号
  2124. function statusFmt(value, row, index){
  2125. if (value != null && value != '')
  2126. return '<span style="color:green;font-size: 16px;">✔</span>';
  2127. return '<span style="color:red;font-size: 16px;">x</span>';
  2128. }