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.
 
 
 
 
 

112 lines
4.0 KiB

'use strict';
var fnPageInit = function () {
var canDo = new CanDo({
//當前程式所有ID名稱集合
idKeys: ['OrgID', 'MemberID'],
//當前程式所有參數名稱集合
paramKeys: ['MemberID'],
/**
* 新增資料
* @param {Object} pargs CanDo 對象
* @param {Object} data 當前新增的資料
* @param {String} flag 新增 or 儲存后新增
*/
getInsertBack: function (pargs, data, flag) {
var fnCallBack = function () {
if (flag === 'add') {
showMsgAndGo(i18next.t("message.Insert_Success"), pargs.QueryPrgId);
}
else {
showMsgAndGo(i18next.t("message.Insert_Success"), pargs.ProgramId, '?Action=Add');
}
};
layer.confirm(i18next.t('message.DefaultPassword').replace('{initpswd}', parent.SysSet['DefaultPassword'] || 123456), { icon: 3, title: i18next.t('common.Tips') }, function (index) {
fnSendEmailToMember();
layer.close(index);
}, function () {
fnCallBack();
});
},
/**頁面初始化
* @param {Object} pargs CanDo 對象*/
pageInit: function (pargs) {
var postArray = [];
if (pargs.action === 'upd') {
$('#MemberID').prop('disabled', true);
$('#FirstName').prop('disabled', true);
$('#LastName').prop('disabled', true);
$('#Title').prop('disabled', true);
$('#MemberType').prop('disabled', true);
$('#Account').prop('disabled', true);
$('#Password').prop('disabled', true);
$('#Email').prop('disabled', true);
$('#Country_ENCode').prop('disabled', true);
$('#Phone').prop('disabled', true);
$('#CountryName').prop('disabled', true);
$('#ArgumentValue').prop('disabled', true);
$('#BirthDate').prop('disabled', true);
$('#Status').prop('disabled', true);
$('#Subscribe').prop('disabled', true);
$('#CreateDate').prop('disabled', true);
postArray.push(pargs._getOne());
}
postArray.push();
},
/**客製化按鈕
* @param {Object} pargs CanDo 對象*/
cusBtns: function (pargs) {
var saCusBtns = [
{
id: 'ResetPassword',
value: 'common.Toolbar_ResetPassword',// ╠重設密碼╣
action: function (_pargs) {
fnResetPassword();
}
}];
return saCusBtns;
},
}),
fnResetPassword = function () {
return g_api.ConnectLite(canDo.ProgramId, 'ResetPassword', {
MemberID: $("#MemberID").val()
},
function (res) {
if (res.RESULT) {
//showMsg(i18next(message.Initialize_Success) + 'success');
fnSendMailToMember();
} else {
//showMsg(i18next(message.Initialize_Failed) + 'error');
}
}
);
},
fnSendMailToMember = function () {
return g_api.ConnectLite(canDo.ProgramId, 'Insert', {
MemberID: $("#MemberID").val()
},
function (res) {
if (res.RESULT) {
if (res.DATA.rel == null) {
showMsgAndGo(i18next.t("message.SendEmail_Success"));
} else {
showMsgAndGo(i18next.t("message.SendEmail_Error"));
}
}
}
);
};
};
require(['base', 'cando'], fnPageInit);