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.

111 lines
4.0 KiB

  1. 'use strict';
  2. var fnPageInit = function () {
  3. var canDo = new CanDo({
  4. //當前程式所有ID名稱集合
  5. idKeys: ['OrgID', 'MemberID'],
  6. //當前程式所有參數名稱集合
  7. paramKeys: ['MemberID'],
  8. /**
  9. * 新增資料
  10. * @param {Object} pargs CanDo 對象
  11. * @param {Object} data 當前新增的資料
  12. * @param {String} flag 新增 or 儲存后新增
  13. */
  14. getInsertBack: function (pargs, data, flag) {
  15. var fnCallBack = function () {
  16. if (flag === 'add') {
  17. showMsgAndGo(i18next.t("message.Insert_Success"), pargs.QueryPrgId);
  18. }
  19. else {
  20. showMsgAndGo(i18next.t("message.Insert_Success"), pargs.ProgramId, '?Action=Add');
  21. }
  22. };
  23. layer.confirm(i18next.t('message.DefaultPassword').replace('{initpswd}', parent.SysSet['DefaultPassword'] || 123456), { icon: 3, title: i18next.t('common.Tips') }, function (index) {
  24. fnSendEmailToMember();
  25. layer.close(index);
  26. }, function () {
  27. fnCallBack();
  28. });
  29. },
  30. /**
  31. * @param {Object} pargs CanDo 對象*/
  32. pageInit: function (pargs) {
  33. var postArray = [];
  34. if (pargs.action === 'upd') {
  35. $('#MemberID').prop('disabled', true);
  36. $('#FirstName').prop('disabled', true);
  37. $('#LastName').prop('disabled', true);
  38. $('#Title').prop('disabled', true);
  39. $('#MemberType').prop('disabled', true);
  40. $('#Account').prop('disabled', true);
  41. $('#Password').prop('disabled', true);
  42. $('#Email').prop('disabled', true);
  43. $('#Country_ENCode').prop('disabled', true);
  44. $('#Phone').prop('disabled', true);
  45. $('#CountryName').prop('disabled', true);
  46. $('#ArgumentValue').prop('disabled', true);
  47. $('#BirthDate').prop('disabled', true);
  48. $('#Status').prop('disabled', true);
  49. $('#Subscribe').prop('disabled', true);
  50. $('#CreateDate').prop('disabled', true);
  51. postArray.push(pargs._getOne());
  52. }
  53. postArray.push();
  54. },
  55. /**
  56. * @param {Object} pargs CanDo 對象*/
  57. cusBtns: function (pargs) {
  58. var saCusBtns = [
  59. {
  60. id: 'ResetPassword',
  61. value: 'common.Toolbar_ResetPassword',// ╠重設密碼╣
  62. action: function (_pargs) {
  63. fnResetPassword();
  64. }
  65. }];
  66. return saCusBtns;
  67. },
  68. }),
  69. fnResetPassword = function () {
  70. return g_api.ConnectLite(canDo.ProgramId, 'ResetPassword', {
  71. MemberID: $("#MemberID").val()
  72. },
  73. function (res) {
  74. if (res.RESULT) {
  75. //showMsg(i18next(message.Initialize_Success) + 'success');
  76. fnSendMailToMember();
  77. } else {
  78. //showMsg(i18next(message.Initialize_Failed) + 'error');
  79. }
  80. }
  81. );
  82. },
  83. fnSendMailToMember = function () {
  84. return g_api.ConnectLite(canDo.ProgramId, 'Insert', {
  85. MemberID: $("#MemberID").val()
  86. },
  87. function (res) {
  88. if (res.RESULT) {
  89. if (res.DATA.rel == null) {
  90. showMsgAndGo(i18next.t("message.SendEmail_Success"));
  91. } else {
  92. showMsgAndGo(i18next.t("message.SendEmail_Error"));
  93. }
  94. }
  95. }
  96. );
  97. };
  98. };
  99. require(['base', 'cando'], fnPageInit);