ry-ui.js 51 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223
  1. /**
  2. * 通用js方法封装处理
  3. * Copyright (c) 2019 ruoyi
  4. */
  5. (function ($) {
  6. $.extend({
  7. _treeTable: {},
  8. _tree: {},
  9. // 表格封装处理
  10. table: {
  11. _option: {},
  12. // 初始化表格参数
  13. init: function(options) {
  14. var defaults = {
  15. id: "bootstrap-table",
  16. type: 0, // 0 代表bootstrapTable 1代表bootstrapTreeTable
  17. height: undefined,
  18. sidePagination: "server",
  19. sortName: "",
  20. sortOrder: "asc",
  21. pagination: true,
  22. pageSize: 10,
  23. toolbar: "toolbar",
  24. striped: false,
  25. escape: false,
  26. showFooter: false,
  27. search: false,
  28. showSearch: true,
  29. showPageGo: false,
  30. showRefresh: true,
  31. showColumns: true,
  32. showToggle: true,
  33. showExport: false,
  34. clickToSelect: false,
  35. rememberSelected: false,
  36. fixedColumns: false,
  37. fixedNumber: 0,
  38. rightFixedColumns: false,
  39. rightFixedNumber: 0,
  40. queryParams: $.table.queryParams,
  41. };
  42. var options = $.extend(defaults, options);
  43. $.table._option = options;
  44. $.table.initEvent();
  45. $('#' + options.id).bootstrapTable({
  46. url: options.url, // 请求后台的URL(*)
  47. contentType: "application/x-www-form-urlencoded", // 编码类型
  48. method: 'post', // 请求方式(*)
  49. cache: false, // 是否使用缓存
  50. height: options.height, // 表格的高度
  51. striped: options.striped, // 是否显示行间隔色
  52. sortable: true, // 是否启用排序
  53. sortStable: true, // 设置为 true 将获得稳定的排序
  54. sortName: options.sortName, // 排序列名称
  55. sortOrder: options.sortOrder, // 排序方式 asc 或者 desc
  56. pagination: options.pagination, // 是否显示分页(*)
  57. pageNumber: 1, // 初始化加载第一页,默认第一页
  58. pageSize: options.pageSize, // 每页的记录行数(*)
  59. pageList: [10, 25, 50], // 可供选择的每页的行数(*)
  60. escape: options.escape, // 转义HTML字符串
  61. showFooter: options.showFooter, // 是否显示表尾
  62. iconSize: 'outline', // 图标大小:undefined默认的按钮尺寸 xs超小按钮sm小按钮lg大按钮
  63. toolbar: '#' + options.toolbar, // 指定工作栏
  64. sidePagination: options.sidePagination, // server启用服务端分页client客户端分页
  65. search: options.search, // 是否显示搜索框功能
  66. showSearch: options.showSearch, // 是否显示检索信息
  67. showPageGo: options.showPageGo, // 是否显示跳转页
  68. showRefresh: options.showRefresh, // 是否显示刷新按钮
  69. showColumns: options.showColumns, // 是否显示隐藏某列下拉框
  70. showToggle: options.showToggle, // 是否显示详细视图和列表视图的切换按钮
  71. showExport: options.showExport, // 是否支持导出文件
  72. clickToSelect: options.clickToSelect, // 是否启用点击选中行
  73. rememberSelected: options.rememberSelected, // 启用翻页记住前面的选择
  74. fixedColumns: options.fixedColumns, // 是否启用冻结列(左侧)
  75. fixedNumber: options.fixedNumber, // 列冻结的个数(左侧)
  76. rightFixedColumns: options.rightFixedColumns, // 是否启用冻结列(右侧)
  77. rightFixedNumber: options.rightFixedNumber, // 列冻结的个数(右侧)
  78. queryParams: options.queryParams, // 传递参数(*)
  79. columns: options.columns, // 显示列信息(*)
  80. responseHandler: $.table.responseHandler, // 在加载服务器发送来的数据之前处理函数
  81. onLoadSuccess: $.table.onLoadSuccess, // 当所有数据被加载时触发处理函数
  82. });
  83. },
  84. // 查询条件
  85. queryParams: function(params) {
  86. return {
  87. // 传递参数查询参数
  88. pageSize: params.limit,
  89. pageNum: params.offset / params.limit + 1,
  90. searchValue: params.search,
  91. orderByColumn: params.sort,
  92. isAsc: params.order
  93. };
  94. },
  95. // 请求获取数据后处理回调函数
  96. responseHandler: function(res) {
  97. if (res.code == 0) {
  98. if ($.common.isNotEmpty($.table._option.sidePagination) && $.table._option.sidePagination == 'client') {
  99. return res.rows;
  100. } else {
  101. if ($.common.isNotEmpty($.table._option.rememberSelected) && $.table._option.rememberSelected) {
  102. var column = $.common.isEmpty($.table._option.uniqueId) ? $.table._option.columns[1].field : $.table._option.uniqueId;
  103. $.each(res.rows, function(i, row) {
  104. row.state = $.inArray(row[column], selectionIds) !== -1;
  105. })
  106. }
  107. return { rows: res.rows, total: res.total };
  108. }
  109. } else {
  110. $.modal.alertWarning(res.msg);
  111. return { rows: [], total: 0 };
  112. }
  113. },
  114. // 初始化事件
  115. initEvent: function(data) {
  116. // 触发行点击事件 加载成功事件
  117. $("#" + $.table._option.id).on("check.bs.table uncheck.bs.table check-all.bs.table uncheck-all.bs.table load-success.bs.table", function () {
  118. // 工具栏按钮控制
  119. var rows = $.common.isEmpty($.table._option.uniqueId) ? $.table.selectFirstColumns() : $.table.selectColumns($.table._option.uniqueId);
  120. $('#' + $.table._option.toolbar + ' .btn-del').toggleClass('disabled', !rows.length);
  121. $('#' + $.table._option.toolbar + ' .btn-edit').toggleClass('disabled', rows.length!=1);
  122. });
  123. // 绑定选中事件、取消事件、全部选中、全部取消
  124. $("#" + $.table._option.id).on("check.bs.table check-all.bs.table uncheck.bs.table uncheck-all.bs.table", function (e, rows) {
  125. // 复选框分页保留保存选中数组
  126. var rowIds = $.table.affectedRowIds(rows);
  127. if ($.common.isNotEmpty($.table._option.rememberSelected) && $.table._option.rememberSelected) {
  128. func = $.inArray(e.type, ['check', 'check-all']) > -1 ? 'union' : 'difference';
  129. selectionIds = _[func](selectionIds, rowIds);
  130. }
  131. });
  132. },
  133. // 当所有数据被加载时触发
  134. onLoadSuccess: function(data) {
  135. // 浮动提示框特效
  136. $("[data-toggle='tooltip']").tooltip();
  137. },
  138. // 表格销毁
  139. destroy: function (tableId) {
  140. var currentId = $.common.isEmpty(tableId) ? $.table._option.id : tableId;
  141. $("#" + currentId).bootstrapTable('destroy');
  142. },
  143. // 序列号生成
  144. serialNumber: function (index) {
  145. var table = $('#' + $.table._option.id).bootstrapTable('getOptions');
  146. var pageSize = table.pageSize;
  147. var pageNumber = table.pageNumber;
  148. return pageSize * (pageNumber - 1) + index + 1;
  149. },
  150. // 列超出指定长度浮动提示
  151. tooltip: function (value, length) {
  152. var _length = $.common.isEmpty(length) ? 20 : length;
  153. var _text = "";
  154. var _value = $.common.nullToStr(value);
  155. if (_value.length > _length) {
  156. _text = _value.substr(0, _length) + "...";
  157. return $.common.sprintf("<a href='#' class='tooltip-show' data-toggle='tooltip' title='%s'>%s</a>", _value, _text);
  158. } else {
  159. _text = _value;
  160. return _text;
  161. }
  162. },
  163. // 下拉按钮切换
  164. dropdownToggle: function (value) {
  165. var actions = [];
  166. actions.push('<div class="btn-group">');
  167. actions.push('<button type="button" class="btn btn-xs dropdown-toggle" data-toggle="dropdown" aria-expanded="false">');
  168. actions.push('<i class="fa fa-cog"></i>&nbsp;<span class="fa fa-chevron-down"></span></button>');
  169. actions.push('<ul class="dropdown-menu">');
  170. actions.push(value.replace(/<a/g,"<li><a").replace(/<\/a>/g,"</a></li>"));
  171. actions.push('</ul>');
  172. actions.push('</div>');
  173. return actions.join('');
  174. },
  175. // 搜索-默认第一个form
  176. search: function(formId) {
  177. var currentId = $.common.isEmpty(formId) ? $('form').attr('id') : formId;
  178. var params = $("#" + $.table._option.id).bootstrapTable('getOptions');
  179. params.queryParams = function(params) {
  180. var search = {};
  181. $.each($("#" + currentId).serializeArray(), function(i, field) {
  182. search[field.name] = field.value;
  183. });
  184. search.pageSize = params.limit;
  185. search.pageNum = params.offset / params.limit + 1;
  186. search.searchValue = params.search;
  187. search.orderByColumn = params.sort;
  188. search.isAsc = params.order;
  189. return search;
  190. }
  191. $("#" + $.table._option.id).bootstrapTable('refresh', params);
  192. },
  193. // 导出数据
  194. exportExcel: function(formId) {
  195. $.modal.confirm("确定导出所有" + $.table._option.modalName + "吗?", function() {
  196. var currentId = $.common.isEmpty(formId) ? $('form').attr('id') : formId;
  197. $.modal.loading("正在导出数据,请稍后...");
  198. $.post($.table._option.exportUrl, $("#" + currentId).serializeArray(), function(result) {
  199. if (result.code == web_status.SUCCESS) {
  200. window.location.href = ctx + "common/download?fileName=" + encodeURI(result.msg) + "&delete=" + true;
  201. } else if (result.code == web_status.WARNING) {
  202. $.modal.alertWarning(result.msg)
  203. } else {
  204. $.modal.alertError(result.msg);
  205. }
  206. $.modal.closeLoading();
  207. });
  208. });
  209. },
  210. // 下载模板
  211. importTemplate: function() {
  212. $.get($.table._option.importTemplateUrl, function(result) {
  213. if (result.code == web_status.SUCCESS) {
  214. window.location.href = ctx + "common/download?fileName=" + encodeURI(result.msg) + "&delete=" + true;
  215. } else if (result.code == web_status.WARNING) {
  216. $.modal.alertWarning(result.msg)
  217. } else {
  218. $.modal.alertError(result.msg);
  219. }
  220. });
  221. },
  222. // 导入数据
  223. importExcel: function(formId) {
  224. var currentId = $.common.isEmpty(formId) ? 'importForm' : formId;
  225. $.form.reset(currentId);
  226. layer.open({
  227. type: 1,
  228. area: ['400px', '230px'],
  229. fix: false,
  230. //不固定
  231. maxmin: true,
  232. shade: 0.3,
  233. title: '导入' + $.table._option.modalName + '数据',
  234. content: $('#' + currentId),
  235. btn: ['<i class="fa fa-check"></i> 导入', '<i class="fa fa-remove"></i> 取消'],
  236. // 弹层外区域关闭
  237. shadeClose: true,
  238. btn1: function(index, layero){
  239. var file = layero.find('#file').val();
  240. if (file == '' || (!$.common.endWith(file, '.xls') && !$.common.endWith(file, '.xlsx'))){
  241. $.modal.msgWarning("请选择后缀为 “xls”或“xlsx”的文件。");
  242. return false;
  243. }
  244. var index = layer.load(2, {shade: false});
  245. $.modal.disable();
  246. var formData = new FormData();
  247. formData.append("file", $('#file')[0].files[0]);
  248. formData.append("updateSupport", $("input[name='updateSupport']").is(':checked'));
  249. $.ajax({
  250. url: $.table._option.importUrl,
  251. data: formData,
  252. cache: false,
  253. contentType: false,
  254. processData: false,
  255. type: 'POST',
  256. success: function (result) {
  257. if (result.code == web_status.SUCCESS) {
  258. $.modal.closeAll();
  259. $.modal.alertSuccess(result.msg);
  260. $.table.refresh();
  261. } else if (result.code == web_status.WARNING) {
  262. layer.close(index);
  263. $.modal.enable();
  264. $.modal.alertWarning(result.msg)
  265. } else {
  266. layer.close(index);
  267. $.modal.enable();
  268. $.modal.alertError(result.msg);
  269. }
  270. }
  271. });
  272. }
  273. });
  274. },
  275. // 刷新表格
  276. refresh: function() {
  277. $("#" + $.table._option.id).bootstrapTable('refresh', {
  278. silent: true
  279. });
  280. },
  281. // 查询表格指定列值
  282. selectColumns: function(column) {
  283. var rows = $.map($('#' + $.table._option.id).bootstrapTable('getSelections'), function (row) {
  284. return row[column];
  285. });
  286. if ($.common.isNotEmpty($.table._option.rememberSelected) && $.table._option.rememberSelected) {
  287. rows = rows.concat(selectionIds);
  288. }
  289. return $.common.uniqueFn(rows);
  290. },
  291. // 获取当前页选中或者取消的行ID
  292. affectedRowIds: function(rows) {
  293. var column = $.common.isEmpty($.table._option.uniqueId) ? $.table._option.columns[1].field : $.table._option.uniqueId;
  294. var rowIds;
  295. if ($.isArray(rows)) {
  296. rowIds = $.map(rows, function(row) {
  297. return row[column];
  298. });
  299. } else {
  300. rowIds = [rows[column]];
  301. }
  302. return rowIds;
  303. },
  304. // 查询表格首列值
  305. selectFirstColumns: function() {
  306. var rows = $.map($('#' + $.table._option.id).bootstrapTable('getSelections'), function (row) {
  307. return row[$.table._option.columns[1].field];
  308. });
  309. if ($.common.isNotEmpty($.table._option.rememberSelected) && $.table._option.rememberSelected) {
  310. rows = rows.concat(selectionIds);
  311. }
  312. return $.common.uniqueFn(rows);
  313. },
  314. // 回显数据字典
  315. selectDictLabel: function(datas, value) {
  316. var actions = [];
  317. $.each(datas, function(index, dict) {
  318. if (dict.dictValue == ('' + value)) {
  319. var listClass = $.common.equals("default", dict.listClass) ? "" : "badge badge-" + dict.listClass;
  320. actions.push($.common.sprintf("<span class='%s'>%s</span>", listClass, dict.dictLabel));
  321. return false;
  322. }
  323. });
  324. return actions.join('');
  325. },
  326. // 显示表格指定列
  327. showColumn: function(column) {
  328. $("#" + $.table._option.id).bootstrapTable('showColumn', column);
  329. },
  330. // 隐藏表格指定列
  331. hideColumn: function(column) {
  332. $("#" + $.table._option.id).bootstrapTable('hideColumn', column);
  333. }
  334. },
  335. // 表格树封装处理
  336. treeTable: {
  337. // 初始化表格
  338. init: function(options) {
  339. var defaults = {
  340. id: "bootstrap-tree-table",
  341. type: 1, // 0 代表bootstrapTable 1代表bootstrapTreeTable
  342. height: 0,
  343. rootIdValue: null,
  344. ajaxParams: {},
  345. toolbar: "toolbar",
  346. striped: false,
  347. expandColumn: 1,
  348. showRefresh: true,
  349. showColumns: true,
  350. expandAll: true,
  351. expandFirst: true
  352. };
  353. var options = $.extend(defaults, options);
  354. $.table._option = options;
  355. var treeTable = $('#' + options.id).bootstrapTreeTable({
  356. code: options.code, // 用于设置父子关系
  357. parentCode: options.parentCode, // 用于设置父子关系
  358. type: 'get', // 请求方式(*)
  359. url: options.url, // 请求后台的URL(*)
  360. ajaxParams: options.ajaxParams, // 请求数据的ajax的data属性
  361. rootIdValue: options.rootIdValue, // 设置指定根节点id值
  362. height: options.height, // 表格树的高度
  363. expandColumn: options.expandColumn, // 在哪一列上面显示展开按钮
  364. striped: options.striped, // 是否显示行间隔色
  365. bordered: true, // 是否显示边框
  366. toolbar: '#' + options.toolbar, // 指定工作栏
  367. showRefresh: options.showRefresh, // 是否显示刷新按钮
  368. showColumns: options.showColumns, // 是否显示隐藏某列下拉框
  369. expandAll: options.expandAll, // 是否全部展开
  370. expandFirst: options.expandFirst, // 是否默认第一级展开--expandAll为false时生效
  371. columns: options.columns
  372. });
  373. $._treeTable = treeTable;
  374. },
  375. // 条件查询
  376. search: function(formId) {
  377. var currentId = $.common.isEmpty(formId) ? $('form').attr('id') : formId;
  378. var params = {};
  379. $.each($("#" + currentId).serializeArray(), function(i, field) {
  380. params[field.name] = field.value;
  381. });
  382. $._treeTable.bootstrapTreeTable('refresh', params);
  383. },
  384. // 刷新
  385. refresh: function() {
  386. $._treeTable.bootstrapTreeTable('refresh');
  387. },
  388. },
  389. // 表单封装处理
  390. form: {
  391. // 表单重置
  392. reset: function(formId) {
  393. var currentId = $.common.isEmpty(formId) ? $('form').attr('id') : formId;
  394. $("#" + currentId)[0].reset();
  395. },
  396. // 获取选中复选框项
  397. selectCheckeds: function(name) {
  398. var checkeds = "";
  399. $('input:checkbox[name="' + name + '"]:checked').each(function(i) {
  400. if (0 == i) {
  401. checkeds = $(this).val();
  402. } else {
  403. checkeds += ("," + $(this).val());
  404. }
  405. });
  406. return checkeds;
  407. },
  408. // 获取选中下拉框项
  409. selectSelects: function(name) {
  410. var selects = "";
  411. $('#' + name + ' option:selected').each(function (i) {
  412. if (0 == i) {
  413. selects = $(this).val();
  414. } else {
  415. selects += ("," + $(this).val());
  416. }
  417. });
  418. return selects;
  419. }
  420. },
  421. // 弹出层封装处理
  422. modal: {
  423. // 显示图标
  424. icon: function(type) {
  425. var icon = "";
  426. if (type == modal_status.WARNING) {
  427. icon = 0;
  428. } else if (type == modal_status.SUCCESS) {
  429. icon = 1;
  430. } else if (type == modal_status.FAIL) {
  431. icon = 2;
  432. } else {
  433. icon = 3;
  434. }
  435. return icon;
  436. },
  437. // 消息提示
  438. msg: function(content, type) {
  439. if (type != undefined) {
  440. layer.msg(content, { icon: $.modal.icon(type), time: 1000, shift: 5 });
  441. } else {
  442. layer.msg(content);
  443. }
  444. },
  445. // 错误消息
  446. msgError: function(content) {
  447. $.modal.msg(content, modal_status.FAIL);
  448. },
  449. // 成功消息
  450. msgSuccess: function(content) {
  451. $.modal.msg(content, modal_status.SUCCESS);
  452. },
  453. // 警告消息
  454. msgWarning: function(content) {
  455. $.modal.msg(content, modal_status.WARNING);
  456. },
  457. // 弹出提示
  458. alert: function(content, type) {
  459. layer.alert(content, {
  460. icon: $.modal.icon(type),
  461. title: "系统提示",
  462. btn: ['确认'],
  463. btnclass: ['btn btn-primary'],
  464. });
  465. },
  466. // 消息提示并刷新父窗体
  467. msgReload: function(msg, type) {
  468. layer.msg(msg, {
  469. icon: $.modal.icon(type),
  470. time: 500,
  471. shade: [0.1, '#8F8F8F']
  472. },
  473. function() {
  474. $.modal.reload();
  475. });
  476. },
  477. // 错误提示
  478. alertError: function(content) {
  479. $.modal.alert(content, modal_status.FAIL);
  480. },
  481. // 成功提示
  482. alertSuccess: function(content) {
  483. $.modal.alert(content, modal_status.SUCCESS);
  484. },
  485. // 警告提示
  486. alertWarning: function(content) {
  487. $.modal.alert(content, modal_status.WARNING);
  488. },
  489. // 关闭窗体
  490. close: function () {
  491. var index = parent.layer.getFrameIndex(window.name);
  492. parent.layer.close(index);
  493. },
  494. // 关闭全部窗体
  495. closeAll: function () {
  496. layer.closeAll();
  497. },
  498. // 确认窗体
  499. confirm: function (content, callBack) {
  500. layer.confirm(content, {
  501. icon: 3,
  502. title: "系统提示",
  503. btn: ['确认', '取消'],
  504. btnclass: ['btn btn-primary', 'btn btn-danger'],
  505. }, function (index) {
  506. layer.close(index);
  507. callBack(true);
  508. });
  509. },
  510. // 弹出层指定宽度
  511. open: function (title, url, width, height, callback) {
  512. //如果是移动端,就使用自适应大小弹窗
  513. if (navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)) {
  514. width = 'auto';
  515. height = 'auto';
  516. }
  517. if ($.common.isEmpty(title)) {
  518. title = false;
  519. };
  520. if ($.common.isEmpty(url)) {
  521. url = "/404.html";
  522. };
  523. if ($.common.isEmpty(width)) {
  524. width = 800;
  525. };
  526. if ($.common.isEmpty(height)) {
  527. height = ($(window).height() - 50);
  528. };
  529. if ($.common.isEmpty(callback)) {
  530. callback = function(index, layero) {
  531. var iframeWin = layero.find('iframe')[0];
  532. iframeWin.contentWindow.submitHandler();
  533. }
  534. }
  535. layer.open({
  536. type: 2,
  537. area: [width + 'px', height + 'px'],
  538. fix: false,
  539. //不固定
  540. maxmin: true,
  541. shade: 0.3,
  542. title: title,
  543. content: url,
  544. btn: ['确定', '关闭'],
  545. // 弹层外区域关闭
  546. shadeClose: true,
  547. yes: callback,
  548. cancel: function(index) {
  549. return true;
  550. }
  551. });
  552. },
  553. // 弹出层指定参数选项
  554. openOptions: function (options) {
  555. var _url = $.common.isEmpty(options.url) ? "/404.html" : options.url;
  556. var _title = $.common.isEmpty(options.title) ? "系统窗口" : options.title;
  557. var _width = $.common.isEmpty(options.width) ? "800" : options.width;
  558. var _height = $.common.isEmpty(options.height) ? ($(window).height() - 50) : options.height;
  559. layer.open({
  560. type: 2,
  561. maxmin: true,
  562. shade: 0.3,
  563. title: _title,
  564. fix: false,
  565. area: [_width + 'px', _height + 'px'],
  566. content: _url,
  567. shadeClose: true,
  568. btn: ['<i class="fa fa-check"></i> 确认', '<i class="fa fa-close"></i> 关闭'],
  569. yes: function (index, layero) {
  570. options.callBack(index, layero)
  571. }, cancel: function () {
  572. return true;
  573. }
  574. });
  575. },
  576. // 弹出层全屏
  577. openFull: function (title, url, width, height) {
  578. //如果是移动端,就使用自适应大小弹窗
  579. if (navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)) {
  580. width = 'auto';
  581. height = 'auto';
  582. }
  583. if ($.common.isEmpty(title)) {
  584. title = false;
  585. };
  586. if ($.common.isEmpty(url)) {
  587. url = "/404.html";
  588. };
  589. if ($.common.isEmpty(width)) {
  590. width = 800;
  591. };
  592. if ($.common.isEmpty(height)) {
  593. height = ($(window).height() - 50);
  594. };
  595. var index = layer.open({
  596. type: 2,
  597. area: [width + 'px', height + 'px'],
  598. fix: false,
  599. //不固定
  600. maxmin: true,
  601. shade: 0.3,
  602. title: title,
  603. content: url,
  604. btn: ['确定', '关闭'],
  605. // 弹层外区域关闭
  606. shadeClose: true,
  607. yes: function(index, layero) {
  608. var iframeWin = layero.find('iframe')[0];
  609. iframeWin.contentWindow.submitHandler();
  610. },
  611. cancel: function(index) {
  612. return true;
  613. }
  614. });
  615. layer.full(index);
  616. },
  617. // 选卡页方式打开
  618. openTab: function (title, url) {
  619. createMenuItem(url, title);
  620. },
  621. // 禁用按钮
  622. disable: function() {
  623. var doc = window.top == window.parent ? window.document : window.parent.document;
  624. $("a[class*=layui-layer-btn]", doc).addClass("layer-disabled");
  625. },
  626. // 启用按钮
  627. enable: function() {
  628. var doc = window.top == window.parent ? window.document : window.parent.document;
  629. $("a[class*=layui-layer-btn]", doc).removeClass("layer-disabled");
  630. },
  631. // 打开遮罩层
  632. loading: function (message) {
  633. $.blockUI({ message: '<div class="loaderbox"><div class="loading-activity"></div> ' + message + '</div>' });
  634. },
  635. // 关闭遮罩层
  636. closeLoading: function () {
  637. setTimeout(function(){
  638. $.unblockUI();
  639. }, 50);
  640. },
  641. // 重新加载
  642. reload: function () {
  643. parent.location.reload();
  644. }
  645. },
  646. // 操作封装处理
  647. operate: {
  648. // 提交数据
  649. submit: function(url, type, dataType, data) {
  650. var config = {
  651. url: url,
  652. type: type,
  653. dataType: dataType,
  654. data: data,
  655. beforeSend: function () {
  656. $.modal.loading("正在处理中,请稍后...");
  657. },
  658. success: function(result) {
  659. $.operate.ajaxSuccess(result);
  660. }
  661. };
  662. $.ajax(config)
  663. },
  664. // post请求传输
  665. post: function(url, data) {
  666. $.operate.submit(url, "post", "json", data);
  667. },
  668. // get请求传输
  669. get: function(url) {
  670. $.operate.submit(url, "get", "json", "");
  671. },
  672. // 详细信息
  673. detail: function(id, width, height) {
  674. var _url = $.common.isEmpty(id) ? $.table._option.detailUrl : $.table._option.detailUrl.replace("{id}", id);
  675. var _width = $.common.isEmpty(width) ? "800" : width;
  676. var _height = $.common.isEmpty(height) ? ($(window).height() - 50) : height;
  677. //如果是移动端,就使用自适应大小弹窗
  678. if (navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)) {
  679. _width = 'auto';
  680. _height = 'auto';
  681. }
  682. layer.open({
  683. type: 2,
  684. area: [_width + 'px', _height + 'px'],
  685. fix: false,
  686. //不固定
  687. maxmin: true,
  688. shade: 0.3,
  689. title: $.table._option.modalName + "详细",
  690. content: _url,
  691. btn: ['关闭'],
  692. // 弹层外区域关闭
  693. shadeClose: true,
  694. cancel: function(index){
  695. return true;
  696. }
  697. });
  698. },
  699. // 删除信息
  700. remove: function(id) {
  701. $.modal.confirm("确定删除该条" + $.table._option.modalName + "信息吗?", function() {
  702. var url = $.common.isEmpty(id) ? $.table._option.removeUrl : $.table._option.removeUrl.replace("{id}", id);
  703. if($.table._option.type == table_type.bootstrapTreeTable) {
  704. $.operate.get(url);
  705. } else {
  706. var data = { "ids": id };
  707. $.operate.submit(url, "post", "json", data);
  708. }
  709. });
  710. },
  711. // 批量删除信息
  712. removeAll: function() {
  713. var rows = $.common.isEmpty($.table._option.uniqueId) ? $.table.selectFirstColumns() : $.table.selectColumns($.table._option.uniqueId);
  714. if (rows.length == 0) {
  715. $.modal.alertWarning("请至少选择一条记录");
  716. return;
  717. }
  718. $.modal.confirm("确认要删除选中的" + rows.length + "条数据吗?", function() {
  719. var url = $.table._option.removeUrl;
  720. var data = { "ids": rows.join() };
  721. $.operate.submit(url, "post", "json", data);
  722. });
  723. },
  724. // 清空信息
  725. clean: function() {
  726. $.modal.confirm("确定清空所有" + $.table._option.modalName + "吗?", function() {
  727. var url = $.table._option.cleanUrl;
  728. $.operate.submit(url, "post", "json", "");
  729. });
  730. },
  731. // 添加信息
  732. add: function(id) {
  733. $.modal.open("添加" + $.table._option.modalName, $.operate.addUrl(id));
  734. },
  735. // 添加信息,以tab页展现
  736. addTab: function (id) {
  737. $.modal.openTab("添加" + $.table._option.modalName, $.operate.addUrl(id));
  738. },
  739. // 添加信息 全屏
  740. addFull: function(id) {
  741. var url = $.common.isEmpty(id) ? $.table._option.createUrl : $.table._option.createUrl.replace("{id}", id);
  742. $.modal.openFull("添加" + $.table._option.modalName, url);
  743. },
  744. // 添加访问地址
  745. addUrl: function(id) {
  746. var url = $.common.isEmpty(id) ? $.table._option.createUrl : $.table._option.createUrl.replace("{id}", id);
  747. return url;
  748. },
  749. // 修改信息
  750. edit: function(id) {
  751. if($.common.isEmpty(id) && $.table._option.type == table_type.bootstrapTreeTable) {
  752. var row = $('#' + $.table._option.id).bootstrapTreeTable('getSelections')[0];
  753. if ($.common.isEmpty(row)) {
  754. $.modal.alertWarning("请至少选择一条记录");
  755. return;
  756. }
  757. var url = $.table._option.updateUrl.replace("{id}", row[$.table._option.uniqueId]);
  758. $.modal.open("修改" + $.table._option.modalName, url);
  759. } else {
  760. $.modal.open("修改" + $.table._option.modalName, $.operate.editUrl(id));
  761. }
  762. },
  763. // 修改信息,以tab页展现
  764. editTab: function(id) {
  765. $.modal.openTab("修改" + $.table._option.modalName, $.operate.editUrl(id));
  766. },
  767. // 修改信息 全屏
  768. editFull: function(id) {
  769. var url = "/404.html";
  770. if ($.common.isNotEmpty(id)) {
  771. url = $.table._option.updateUrl.replace("{id}", id);
  772. } else {
  773. var row = $.common.isEmpty($.table._option.uniqueId) ? $.table.selectFirstColumns() : $.table.selectColumns($.table._option.uniqueId);
  774. url = $.table._option.updateUrl.replace("{id}", row);
  775. }
  776. $.modal.openFull("修改" + $.table._option.modalName, url);
  777. },
  778. // 修改访问地址
  779. editUrl: function(id) {
  780. var url = "/404.html";
  781. if ($.common.isNotEmpty(id)) {
  782. url = $.table._option.updateUrl.replace("{id}", id);
  783. } else {
  784. var id = $.common.isEmpty($.table._option.uniqueId) ? $.table.selectFirstColumns() : $.table.selectColumns($.table._option.uniqueId);
  785. if (id.length == 0) {
  786. $.modal.alertWarning("请至少选择一条记录");
  787. return;
  788. }
  789. url = $.table._option.updateUrl.replace("{id}", id);
  790. }
  791. return url;
  792. },
  793. // 保存信息 刷新表格
  794. save: function(url, data) {
  795. var config = {
  796. url: url,
  797. type: "post",
  798. dataType: "json",
  799. data: data,
  800. beforeSend: function () {
  801. $.modal.loading("正在处理中,请稍后...");
  802. $.modal.disable();
  803. },
  804. success: function(result) {
  805. $.operate.successCallback(result);
  806. }
  807. };
  808. $.ajax(config)
  809. },
  810. // 保存信息 弹出提示框
  811. saveModal: function(url, data) {
  812. var config = {
  813. url: url,
  814. type: "post",
  815. dataType: "json",
  816. data: data,
  817. beforeSend: function () {
  818. $.modal.loading("正在处理中,请稍后...");
  819. },
  820. success: function(result) {
  821. if (result.code == web_status.SUCCESS) {
  822. $.modal.alertSuccess(result.msg)
  823. } else if (result.code == web_status.WARNING) {
  824. $.modal.alertWarning(result.msg)
  825. } else {
  826. $.modal.alertError(result.msg);
  827. }
  828. $.modal.closeLoading();
  829. }
  830. };
  831. $.ajax(config)
  832. },
  833. // 保存选项卡信息
  834. saveTab: function(url, data) {
  835. var config = {
  836. url: url,
  837. type: "post",
  838. dataType: "json",
  839. data: data,
  840. beforeSend: function () {
  841. $.modal.loading("正在处理中,请稍后...");
  842. },
  843. success: function(result) {
  844. $.operate.successTabCallback(result);
  845. }
  846. };
  847. $.ajax(config)
  848. },
  849. // 保存结果弹出msg刷新table表格
  850. ajaxSuccess: function (result) {
  851. if (result.code == web_status.SUCCESS && $.table._option.type == table_type.bootstrapTable) {
  852. $.modal.msgSuccess(result.msg);
  853. $.table.refresh();
  854. } else if (result.code == web_status.SUCCESS && $.table._option.type == table_type.bootstrapTreeTable) {
  855. $.modal.msgSuccess(result.msg);
  856. $.treeTable.refresh();
  857. } else if (result.code == web_status.WARNING) {
  858. $.modal.alertWarning(result.msg)
  859. } else {
  860. $.modal.alertError(result.msg);
  861. }
  862. $.modal.closeLoading();
  863. },
  864. // 成功结果提示msg(父窗体全局更新)
  865. saveSuccess: function (result) {
  866. if (result.code == web_status.SUCCESS) {
  867. $.modal.msgReload("保存成功,正在刷新数据请稍后……", modal_status.SUCCESS);
  868. } else if (result.code == web_status.WARNING) {
  869. $.modal.alertWarning(result.msg)
  870. } else {
  871. $.modal.alertError(result.msg);
  872. }
  873. $.modal.closeLoading();
  874. },
  875. // 成功回调执行事件(父窗体静默更新)
  876. successCallback: function(result) {
  877. if (result.code == web_status.SUCCESS) {
  878. var parent = window.parent;
  879. if (parent.$.table._option.type == table_type.bootstrapTable) {
  880. $.modal.close();
  881. parent.$.modal.msgSuccess(result.msg);
  882. parent.$.table.refresh();
  883. } else if (parent.$.table._option.type == table_type.bootstrapTreeTable) {
  884. $.modal.close();
  885. parent.$.modal.msgSuccess(result.msg);
  886. parent.$.treeTable.refresh();
  887. } else {
  888. $.modal.msgReload("保存成功,正在刷新数据请稍后……", modal_status.SUCCESS);
  889. }
  890. } else if (result.code == web_status.WARNING) {
  891. $.modal.alertWarning(result.msg)
  892. } else {
  893. $.modal.alertError(result.msg);
  894. }
  895. $.modal.closeLoading();
  896. $.modal.enable();
  897. },
  898. // 选项卡成功回调执行事件(父窗体静默更新)
  899. successTabCallback: function(result) {
  900. if (result.code == web_status.SUCCESS) {
  901. var topWindow = $(window.parent.document);
  902. var currentId = $('.page-tabs-content', topWindow).find('.active').attr('data-panel');
  903. var $contentWindow = $('.RuoYi_iframe[data-id="' + currentId + '"]', topWindow)[0].contentWindow;
  904. $.modal.close();
  905. $contentWindow.$.modal.msgSuccess(result.msg);
  906. $contentWindow.$(".layui-layer-padding").removeAttr("style");
  907. if ($contentWindow.$.table._option.type == table_type.bootstrapTable) {
  908. $contentWindow.$.table.refresh();
  909. } else if ($contentWindow.$.table._option.type == table_type.bootstrapTreeTable) {
  910. $contentWindow.$.treeTable.refresh();
  911. }
  912. closeItem();
  913. } else if (result.code == web_status.WARNING) {
  914. $.modal.alertWarning(result.msg)
  915. } else {
  916. $.modal.alertError(result.msg);
  917. }
  918. $.modal.closeLoading();
  919. }
  920. },
  921. // 校验封装处理
  922. validate: {
  923. // 判断返回标识是否唯一 false 不存在 true 存在
  924. unique: function (value) {
  925. if (value == "0") {
  926. return true;
  927. }
  928. return false;
  929. },
  930. // 表单验证
  931. form: function (formId) {
  932. var currentId = $.common.isEmpty(formId) ? $('form').attr('id') : formId;
  933. return $("#" + currentId).validate().form();
  934. }
  935. },
  936. // 树插件封装处理
  937. tree: {
  938. _option: {},
  939. _lastValue: {},
  940. // 初始化树结构
  941. init: function(options) {
  942. var defaults = {
  943. id: "tree", // 属性ID
  944. expandLevel: 0, // 展开等级节点
  945. view: {
  946. selectedMulti: false, // 设置是否允许同时选中多个节点
  947. nameIsHTML: true // 设置 name 属性是否支持 HTML 脚本
  948. },
  949. check: {
  950. enable: false, // 置 zTree 的节点上是否显示 checkbox / radio
  951. nocheckInherit: true, // 设置子节点是否自动继承
  952. },
  953. data: {
  954. key: {
  955. title: "title" // 节点数据保存节点提示信息的属性名称
  956. },
  957. simpleData: {
  958. enable: true // true / false 分别表示 使用 / 不使用 简单数据模式
  959. }
  960. },
  961. };
  962. var options = $.extend(defaults, options);
  963. $.tree._option = options;
  964. // 树结构初始化加载
  965. var setting = {
  966. callback: {
  967. onClick: options.onClick, // 用于捕获节点被点击的事件回调函数
  968. onCheck: options.onCheck, // 用于捕获 checkbox / radio 被勾选 或 取消勾选的事件回调函数
  969. onDblClick: options.onDblClick // 用于捕获鼠标双击之后的事件回调函数
  970. },
  971. check: options.check,
  972. view: options.view,
  973. data: options.data
  974. };
  975. $.get(options.url, function(data) {
  976. var treeId = $("#treeId").val();
  977. tree = $.fn.zTree.init($("#" + options.id), setting, data);
  978. $._tree = tree;
  979. var nodes = tree.getNodesByParam("level", options.expandLevel - 1);
  980. for (var i = 0; i < nodes.length; i++) {
  981. tree.expandNode(nodes[i], true, false, false);
  982. }
  983. var node = tree.getNodesByParam("id", treeId, null)[0];
  984. $.tree.selectByIdName(treeId, node);
  985. });
  986. },
  987. // 搜索节点
  988. searchNode: function() {
  989. // 取得输入的关键字的值
  990. var value = $.common.trim($("#keyword").val());
  991. if ($.tree._lastValue == value) {
  992. return;
  993. }
  994. // 保存最后一次搜索名称
  995. $.tree._lastValue = value;
  996. var nodes = $._tree.getNodes();
  997. // 如果要查空字串,就退出不查了。
  998. if (value == "") {
  999. $.tree.showAllNode(nodes);
  1000. return;
  1001. }
  1002. $.tree.hideAllNode(nodes);
  1003. // 根据搜索值模糊匹配
  1004. $.tree.updateNodes($._tree.getNodesByParamFuzzy("name", value));
  1005. },
  1006. // 根据Id和Name选中指定节点
  1007. selectByIdName: function(treeId, node) {
  1008. if ($.common.isNotEmpty(treeId) && treeId == node.id) {
  1009. $._tree.selectNode(node, true);
  1010. }
  1011. },
  1012. // 显示所有节点
  1013. showAllNode: function(nodes) {
  1014. nodes = $._tree.transformToArray(nodes);
  1015. for (var i = nodes.length - 1; i >= 0; i--) {
  1016. if (nodes[i].getParentNode() != null) {
  1017. $._tree.expandNode(nodes[i], true, false, false, false);
  1018. } else {
  1019. $._tree.expandNode(nodes[i], true, true, false, false);
  1020. }
  1021. $._tree.showNode(nodes[i]);
  1022. $.tree.showAllNode(nodes[i].children);
  1023. }
  1024. },
  1025. // 隐藏所有节点
  1026. hideAllNode: function(nodes) {
  1027. var tree = $.fn.zTree.getZTreeObj("tree");
  1028. var nodes = $._tree.transformToArray(nodes);
  1029. for (var i = nodes.length - 1; i >= 0; i--) {
  1030. $._tree.hideNode(nodes[i]);
  1031. }
  1032. },
  1033. // 显示所有父节点
  1034. showParent: function(treeNode) {
  1035. var parentNode;
  1036. while ((parentNode = treeNode.getParentNode()) != null) {
  1037. $._tree.showNode(parentNode);
  1038. $._tree.expandNode(parentNode, true, false, false);
  1039. treeNode = parentNode;
  1040. }
  1041. },
  1042. // 显示所有孩子节点
  1043. showChildren: function(treeNode) {
  1044. if (treeNode.isParent) {
  1045. for (var idx in treeNode.children) {
  1046. var node = treeNode.children[idx];
  1047. $._tree.showNode(node);
  1048. $.tree.showChildren(node);
  1049. }
  1050. }
  1051. },
  1052. // 更新节点状态
  1053. updateNodes: function(nodeList) {
  1054. $._tree.showNodes(nodeList);
  1055. for (var i = 0, l = nodeList.length; i < l; i++) {
  1056. var treeNode = nodeList[i];
  1057. $.tree.showChildren(treeNode);
  1058. $.tree.showParent(treeNode)
  1059. }
  1060. },
  1061. // 获取当前被勾选集合
  1062. getCheckedNodes: function(column) {
  1063. var _column = $.common.isEmpty(column) ? "id" : column;
  1064. var nodes = $._tree.getCheckedNodes(true);
  1065. return $.map(nodes, function (row) {
  1066. return row[_column];
  1067. }).join();
  1068. },
  1069. // 不允许根父节点选择
  1070. notAllowParents: function(_tree) {
  1071. var nodes = _tree.getSelectedNodes();
  1072. for (var i = 0; i < nodes.length; i++) {
  1073. if (nodes[i].level == 0) {
  1074. $.modal.msgError("不能选择根节点(" + nodes[i].name + ")");
  1075. return false;
  1076. }
  1077. if (nodes[i].isParent) {
  1078. $.modal.msgError("不能选择父节点(" + nodes[i].name + ")");
  1079. return false;
  1080. }
  1081. }
  1082. return true;
  1083. },
  1084. // 不允许最后层级节点选择
  1085. notAllowLastLevel: function(_tree) {
  1086. var nodes = _tree.getSelectedNodes();
  1087. for (var i = 0; i < nodes.length; i++) {
  1088. if (!nodes[i].isParent) {
  1089. $.modal.msgError("不能选择最后层级节点(" + nodes[i].name + ")");
  1090. return false;
  1091. }
  1092. }
  1093. return true;
  1094. },
  1095. // 隐藏/显示搜索栏
  1096. toggleSearch: function() {
  1097. $('#search').slideToggle(200);
  1098. $('#btnShow').toggle();
  1099. $('#btnHide').toggle();
  1100. $('#keyword').focus();
  1101. },
  1102. // 折叠
  1103. collapse: function() {
  1104. $._tree.expandAll(false);
  1105. },
  1106. // 展开
  1107. expand: function() {
  1108. $._tree.expandAll(true);
  1109. }
  1110. },
  1111. // 通用方法封装处理
  1112. common: {
  1113. // 判断字符串是否为空
  1114. isEmpty: function (value) {
  1115. if (value == null || this.trim(value) == "") {
  1116. return true;
  1117. }
  1118. return false;
  1119. },
  1120. // 判断一个字符串是否为非空串
  1121. isNotEmpty: function (value) {
  1122. return !$.common.isEmpty(value);
  1123. },
  1124. // 空对象转字符串
  1125. nullToStr: function(value) {
  1126. if ($.common.isEmpty(value)) {
  1127. return "-";
  1128. }
  1129. return value;
  1130. },
  1131. // 是否显示数据 为空默认为显示
  1132. visible: function (value) {
  1133. if ($.common.isEmpty(value) || value == true) {
  1134. return true;
  1135. }
  1136. return false;
  1137. },
  1138. // 空格截取
  1139. trim: function (value) {
  1140. if (value == null) {
  1141. return "";
  1142. }
  1143. return value.toString().replace(/(^\s*)|(\s*$)|\r|\n/g, "");
  1144. },
  1145. // 比较两个字符串(大小写敏感)
  1146. equals: function (str, that) {
  1147. return str == that;
  1148. },
  1149. // 比较两个字符串(大小写不敏感)
  1150. equalsIgnoreCase: function (str, that) {
  1151. return String(str).toUpperCase() === String(that).toUpperCase();
  1152. },
  1153. // 将字符串按指定字符分割
  1154. split: function (str, sep, maxLen) {
  1155. if ($.common.isEmpty(str)) {
  1156. return null;
  1157. }
  1158. var value = String(str).split(sep);
  1159. return maxLen ? value.slice(0, maxLen - 1) : value;
  1160. },
  1161. // 字符串格式化(%s )
  1162. sprintf: function (str) {
  1163. var args = arguments, flag = true, i = 1;
  1164. str = str.replace(/%s/g, function () {
  1165. var arg = args[i++];
  1166. if (typeof arg === 'undefined') {
  1167. flag = false;
  1168. return '';
  1169. }
  1170. return arg;
  1171. });
  1172. return flag ? str : '';
  1173. },
  1174. // 指定随机数返回
  1175. random: function (min, max) {
  1176. return Math.floor((Math.random() * max) + min);
  1177. },
  1178. // 判断字符串是否是以start开头
  1179. startWith: function(value, start) {
  1180. var reg = new RegExp("^" + start);
  1181. return reg.test(value)
  1182. },
  1183. // 判断字符串是否是以end结尾
  1184. endWith: function(value, end) {
  1185. var reg = new RegExp(end + "$");
  1186. return reg.test(value)
  1187. },
  1188. // 数组去重
  1189. uniqueFn: function(array) {
  1190. var result = [];
  1191. var hashObj = {};
  1192. for (var i = 0; i < array.length; i++) {
  1193. if (!hashObj[array[i]]) {
  1194. hashObj[array[i]] = true;
  1195. result.push(array[i]);
  1196. }
  1197. }
  1198. return result;
  1199. }
  1200. }
  1201. });
  1202. })(jQuery);
  1203. /** 表格类型 */
  1204. table_type = {
  1205. bootstrapTable: 0,
  1206. bootstrapTreeTable: 1
  1207. };
  1208. /** 消息状态码 */
  1209. web_status = {
  1210. SUCCESS: 0,
  1211. FAIL: 500,
  1212. WARNING: 301
  1213. };
  1214. /** 弹窗状态码 */
  1215. modal_status = {
  1216. SUCCESS: "success",
  1217. FAIL: "error",
  1218. WARNING: "warning"
  1219. };