Built files from Bizgaze WebServer
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

detailwidgetsplitcolumn.js 8.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. var Unibase;
  2. (function (Unibase) {
  3. let Themes;
  4. (function (Themes) {
  5. let Compact;
  6. (function (Compact) {
  7. let DetailWidgets;
  8. (function (DetailWidgets) {
  9. class Detailwidgetsplitcolumn extends Unibase.Platform.Core.BaseComponent {
  10. jsFiles() {
  11. return [];
  12. }
  13. cssFiles() {
  14. return [];
  15. }
  16. html(id, containerid) {
  17. debugger;
  18. var title = id[0].WidgetName;
  19. let html = '<section id="widget_details_' + id[0].PortletWidgetId + '" class="card shadow-hover mb-0">' +
  20. '<div id="hf-widget-title_' + id[0].PortletWidgetId + '" class="card-header"><h6>' + title + '</h6></div>' +
  21. '<div class="card-body row mx-0">' +
  22. '<div class="col-sm-12">' +
  23. '<ul class="list-group no-borders list-group-flush" id="widget_details_' + id[0].PortletWidgetId + '_col1" style="list-style-type:disc">' +
  24. '<li class="list-group-item no-borders hidden" id="widget_details_item' + id[0].PortletWidgetId + '_col1"></li>' +
  25. '</ul>' +
  26. '</div>' +
  27. '</div>' +
  28. '</div>' +
  29. '</section>';
  30. return html;
  31. }
  32. load(id, containerid, callback) {
  33. let instance = this;
  34. let inputparameters = Unibase.Themes.Providers.DashboardHelper.Instance().replaceWidgetParameterValues(id[0].WidgetParameters, id[0].InstalledAppId);
  35. let fromDate = "", toDate = "";
  36. var cf_fromDate = Unibase.Platform.Membership.Infos.Identity.currentUser.fromDate;
  37. var cf_toDate = Unibase.Platform.Membership.Infos.Identity.currentUser.toDate;
  38. if (cf_fromDate != null && cf_toDate != null) {
  39. fromDate = cf_fromDate.toString();
  40. toDate = cf_toDate.toString();
  41. }
  42. else {
  43. fromDate = Unibase.Platform.Helpers.DateTimeHelper.Instance().formatLocalDateformat(new Date(Unibase.Platform.Helpers.DateTimeHelper.Instance().currentDate()), "YYYY/MM/DD");
  44. toDate = Unibase.Platform.Helpers.DateTimeHelper.Instance().formatLocalDateformat(new Date(Unibase.Platform.Helpers.DateTimeHelper.Instance().currentDate()), "YYYY/MM/DD");
  45. }
  46. var parameters = {
  47. WidgetId: id[0].WidgetId,
  48. PortletWidgetId: id[0].PortletWidgetId,
  49. InstalledAppId: id[0].InstalledAppId,
  50. InputParameters: inputparameters,
  51. FromDate: fromDate,
  52. ToDate: toDate
  53. };
  54. instance.loadData(id[0].PortletWidgetId, containerid, parameters);
  55. }
  56. loadData(portletwidgetid, detailcontainer, parameters) {
  57. debugger;
  58. var instance = this;
  59. Unibase.Platform.Widgets.Managers.WidgetManager.Instance().getDetailWidgetData(parameters).then(function (result) {
  60. var properties = result.result.DetailWidgetProperties;
  61. var tokenarray = [];
  62. var propertyarray = [];
  63. var HyperLink = [];
  64. var arraylength = 0;
  65. for (var i = 0; i < properties.length; i++) {
  66. var model = properties[i];
  67. var propertyindex = model.PropertyIndex;
  68. if (model.Value != null) {
  69. var token = model.Value.replace(/\s/g, "");
  70. }
  71. tokenarray.push(token);
  72. propertyarray.push(propertyindex);
  73. HyperLink.push(model.HyperLink);
  74. arraylength = arraylength + 1;
  75. }
  76. if (arraylength % 2 === 0) {
  77. arraylength = arraylength;
  78. }
  79. else {
  80. arraylength = arraylength + 1;
  81. }
  82. var arrayindex = (arraylength);
  83. var slicedarray = tokenarray.splice(0, arrayindex);
  84. var propertyslice = propertyarray;
  85. for (var k = 0; k < propertyarray.length; k++) {
  86. var replace = slicedarray[k];
  87. var data = result.result.Data[0];
  88. var templateScript = Handlebars.compile(replace);
  89. let token1 = Unibase.Core.Helpers.PropertyHelper.Instance().replace(replace, data);
  90. for (var i = 0; i < token1.split("|").length; i++) {
  91. var token2 = token1.split("|")[i];
  92. if (token2 == "" || token2 == "null" || token2 == "Invalid date" || token2 == "1900/01/01" || token2 == "01/01/1900" || token2 == "[object Object]" || token2 == " " || token2 == "01/01/0001" || token2 == "0001/01/01" || token2 == "<p><br></p>") {
  93. token2 = "NA";
  94. }
  95. if (result.result.Js != null || result.result.Js != "") {
  96. eval(result.result.Js);
  97. }
  98. if (HyperLink[propertyslice[k]] != null && HyperLink[propertyslice[k]] != "") {
  99. var HL = Unibase.Core.Helpers.TokenHelper.Instance().replace(HyperLink[propertyslice[k]], data);
  100. var href = "javascript:;";
  101. var target = "";
  102. if (HyperLink[propertyslice[k]].includes('href')) {
  103. var target = "target='_blank'";
  104. href = HyperLink[propertyslice[k]].replace(/href=/, '');
  105. HL = '';
  106. }
  107. token2 = '<a href=' + href + ' ' + target + ' onclick="' + HL + '"><font class="text-ul">' + token2 + '</font></a>';
  108. }
  109. let list1 = `<li class="list-group-item no-borders Singlecolumn-NoBorder-listgroup-item Singlecolumn-NoBorder-listgroup-addeditem m-t-lg p-2 li-${propertyslice[k]}" style="border: none;display:list-item"> ${token2} </div></div></li>`;
  110. $('#widget_details_item' + portletwidgetid + '_col1:last').before(list1);
  111. }
  112. }
  113. });
  114. $('.' + detailcontainer).siblings('.line-loader').remove();
  115. $('.' + detailcontainer).removeClass('hidden');
  116. }
  117. static Instance() {
  118. if (this.instance === null || this.instance === undefined)
  119. this.instance = new Detailwidgetsplitcolumn();
  120. return this.instance;
  121. }
  122. }
  123. DetailWidgets.Detailwidgetsplitcolumn = Detailwidgetsplitcolumn;
  124. })(DetailWidgets = Compact.DetailWidgets || (Compact.DetailWidgets = {}));
  125. })(Compact = Themes.Compact || (Themes.Compact = {}));
  126. })(Themes = Unibase.Themes || (Unibase.Themes = {}));
  127. })(Unibase || (Unibase = {}));