You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

152 lines
7.0 KiB

2 years ago
  1. 'use strict';
  2. var fnPageInit = function () {
  3. var oAuditFlag = {
  4. 'N': 'common.NotAudit',
  5. 'Y': 'common.Audited',
  6. 'P': 'common.InAudit',
  7. 'A': 'common.AuditAgain',
  8. 'Z': 'common.ApplyforUpdateing',
  9. 'Q': 'common.NotPass'
  10. },
  11. setStateDrop = function () {
  12. return g_api.ConnectLite(Service.com, ComFn.GetArguments, {
  13. OrgID: 'TE',
  14. ArgClassID: 'Area',
  15. LevelOfArgument: 1
  16. }, function (res) {
  17. if (res.RESULT) {
  18. let saState = res.DATA.rel;
  19. if (saState.length > 0) {
  20. $('#State').append(createOptions(saState, 'id', 'text', true)).select2();
  21. }
  22. }
  23. });
  24. },
  25. canDo = new CanDo({
  26. sortField: 'CreateDate',
  27. sortOrder: 'desc',
  28. /**
  29. * 當前程式所有ID名稱集合
  30. */
  31. idKeys: ['OrgID', 'guid'],
  32. /**
  33. * Grid欄位設置可以是 function
  34. */
  35. gridFields: [
  36. {
  37. name: "RowIndex", title: 'common.RowNumber', type: "text", width: 50, align: "center", sorting: false
  38. },
  39. {
  40. name: "CustomerCName", title: 'Customers_Upd.CustomerCName', type: "text", width: 200
  41. },
  42. {
  43. name: "CustomerEName", title: 'Customers_Upd.CustomerEName', type: "text", width: 200
  44. },
  45. {
  46. name: "CustomerShotCName", title: 'Customers_Upd.CustomerShotCName', type: "text", width: 100
  47. },
  48. {
  49. name: "CustomerNO", title: 'Customers_Upd.CustomerNO', type: "text", align: "center", width: 80
  50. },
  51. {
  52. name: "UniCode", title: 'Customers_Upd.UniCode', type: "text", align: "center", width: 80
  53. },
  54. {
  55. name: "Contactors", title: 'common.Contactor', type: "text", width: 120, itemTemplate: function (val, item) {
  56. var saContactors = JSON.parse(item.Contactors || '[]'),
  57. sContactors = '';
  58. if (saContactors.length > 0) {
  59. sContactors = Enumerable.From(saContactors).Select("$.FullName").ToArray().join(',');
  60. }
  61. return sContactors;
  62. }
  63. },
  64. {
  65. name: "Address", title: 'common.Address', type: "text", width: 230
  66. },
  67. {
  68. name: "CreateUserName", title: 'common.CreateUser', type: "text", width: 70
  69. },
  70. {
  71. name: "CreateDate", title: 'common.CreateDate', type: "text", width: 120, itemTemplate: function (val, item) {
  72. return newDate(val);
  73. }
  74. },
  75. {
  76. name: "IsAudit", title: 'common.Audit_Status', type: "text", width: 80, align: "center", itemTemplate: function (val, item) {
  77. return i18next.t(oAuditFlag[val]);
  78. }
  79. },
  80. {
  81. name: "Effective", title: 'common.Status', type: "text", width: 50, align: "center", itemTemplate: function (val, item) {
  82. return val === 'Y' ? i18next.t('common.Effective') : i18next.t('common.Invalid');// ╠common.Effective⇒有效╣ ╠common.Invalid⇒無效╣
  83. }
  84. }
  85. ],
  86. /**
  87. * 打開要匯出的pop選擇匯出類別
  88. */
  89. getExcel: function (pargs) {
  90. layer.open({
  91. type: 1,
  92. title: i18next.t('common.DownLoadDocuments'),// ╠common.DownLoadDocuments⇒下載文檔╣
  93. area: ['200px', '280px'],//寬度
  94. shade: 0.75,//遮罩
  95. shadeClose: true,
  96. btn: [i18next.t('common.Cancel')],// ╠common.Cancel⇒取消╣
  97. content: '\
  98. <div class="pop-box">\
  99. <p><button type="button" data-i18n="common.BasicInformation" id="Cus_BasicInformation" class="btn-custom w100p green">基本資料</button></p>\
  100. <p><button type="button" data-i18n="common.Cus_Email" id="Cus_Email" class="btn-custom w100p green">名稱+Email</button></p>\
  101. <p><button type="button" data-i18n="common.WenzhongCusFile" id="Cus_WenzhongCusFile" class="btn-custom w100p green">文中客供商檔</button></p>\
  102. </div>',//common.BasicInformation基本資料common.Cus_Email名稱+Emailcommon.WenzhongCusFile文中客供商檔
  103. success: function (layero, idx) {
  104. $('.pop-box :button').click(function () {
  105. var sToExcelType = this.id;
  106. canDo.getPage({
  107. Excel: true,
  108. ExcelType: sToExcelType,
  109. Index: idx
  110. });
  111. });
  112. canDo._transLang(layero);
  113. }
  114. });
  115. },
  116. /**
  117. * 頁面初始化
  118. * @param {Object} pargs CanDo 對象
  119. */
  120. pageInit: function (pargs) {
  121. var ss = canDo;
  122. $.whenArray([
  123. setStateDrop(),
  124. fnSetUserDrop([
  125. {
  126. Select: $('#CreateUser'),
  127. ShowId: true,
  128. Select2: true
  129. }
  130. ]),
  131. fnSetArgDrop([
  132. {
  133. ArgClassID: 'TranType',
  134. CallBack: function (data) {
  135. var sOptions = '<label for="TransactionType_7"><input type="radio" id="TransactionType_7" name="TransactionType" value="A,B,C,D,E,F" checked="checked">全部</label>' + createRadios(data, 'id', 'text', 'TransactionType')
  136. $('#transactiontype').html(sOptions).find('[name="TransactionType"]').click(function () {
  137. $('#Toolbar_Qry').trigger('click');
  138. });
  139. pargs._uniformInit($('#transactiontype'));
  140. }
  141. }
  142. ]),
  143. ])
  144. .done(function () {
  145. pargs._reSetQueryPm();
  146. pargs._initGrid();
  147. });
  148. }
  149. });
  150. };
  151. require(['base', 'select2', 'jsgrid', 'cando'], fnPageInit);