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.

1942 lines
85 KiB

2 years ago
  1. 'use strict';
  2. var EditableData = false;
  3. var DefaultState = parent.top.OrgID === 'SG' ? 'CHN' : 'TWN';
  4. var fnPageInit = function () {
  5. var sLang = g_ul.GetLang(),
  6. sAction = getUrlParam('Action') || 'Add',
  7. oAuditFlag = { 'N': 'P', 'Z': 'A', 'Q': 'A' },
  8. saDealExhibitions = {},
  9. saUnDealExhibitions = {},
  10. saContactorList = [],
  11. oGrid = null,
  12. oGrid1 = null,
  13. oGrid2 = null,
  14. oGrid3 = null,
  15. oGrid4 = null,
  16. oGrid5 = null,
  17. canDo = new CanDo({
  18. /**
  19. * 是否返回查詢頁面
  20. */
  21. goBack: false,
  22. /**
  23. * 當前程式所有ID名稱集合
  24. */
  25. idKeys: ['OrgID', 'guid'],
  26. /**
  27. * 當前程式所有參數名稱集合
  28. */
  29. paramKeys: ['guid', 'From', 'FromId', 'Flag'],
  30. /**
  31. * 頁簽回調函數
  32. */
  33. tabAction: function (el, pargs) {
  34. switch (el.id) {
  35. case 'litab2':
  36. if (!$(el).data('action')) {
  37. oGrid.loadData();
  38. oGrid1.loadData();
  39. $(el).data('action', true);
  40. }
  41. break;
  42. case 'litab3':
  43. if (!$(el).data('action')) {
  44. oGrid2.loadData();
  45. $(el).data('action', true);
  46. }
  47. break;
  48. case 'litab4':
  49. if (!$(el).data('action')) {
  50. oGrid3.loadData();
  51. $(el).data('action', true);
  52. }
  53. break;
  54. case 'litab5':
  55. if (!$(el).data('action')) {
  56. oGrid4.loadData();
  57. $(el).data('action', true);
  58. }
  59. break;
  60. case 'litab6':
  61. if (!$(el).data('action')) {
  62. oGrid5.loadData();
  63. $(el).data('action', true);
  64. }
  65. break;
  66. }
  67. },
  68. /**
  69. * 查詢當前資料
  70. * @param {Object} pargs CanDo 對象
  71. * @param {Object} data 當前資料實體
  72. */
  73. getOneBack: function (pargs, data) {
  74. var oRes = data,
  75. sText = '',
  76. elAuditReason = $('#AuditReason');
  77. oRes.Contactors = $.parseJSON(oRes.Contactors || '[]');
  78. $('.NotPassReason').show();
  79. switch (oRes.IsAudit) {
  80. case 'N':// ╠common.NotAudit⇒未提交審核╣
  81. EditableData = true;
  82. sText = i18next.t("common.NotAudit");
  83. elAuditReason.css('color', 'red');
  84. break;
  85. case 'Y':// ╠common.Audited⇒已審核╣
  86. sText = i18next.t("common.Audited");
  87. elAuditReason.css('color', 'green');
  88. break;
  89. case 'P':// ╠common.InAudit⇒提交審核中╣
  90. sText = i18next.t("common.InAudit");
  91. elAuditReason.css('color', 'blue');
  92. break;
  93. case 'A':// ╠common.AuditAgain⇒重新提交審核中╣
  94. sText = i18next.t("common.AuditAgain") + ' (' + (oRes.NotPassReason || '') + ')';
  95. elAuditReason.css('color', 'blue');
  96. break;
  97. case 'Z':// ╠common.ApplyforUpdateing⇒申請修改中╣
  98. EditableData = true;
  99. sText = i18next.t("common.ApplyforUpdateing") + ' (' + (oRes.NotPassReason || '') + ')';
  100. elAuditReason.css('color', 'blue');
  101. break;
  102. case 'Q':// ╠common.NotPass⇒不通過╣
  103. sText = i18next.t("common.NotPass") + ' (' + (oRes.NotPassReason || '') + ')';
  104. elAuditReason.css('color', 'red');
  105. break;
  106. }
  107. elAuditReason.text(sText);
  108. if ('Y,P,A'.indexOf(oRes.IsAudit) > -1) {
  109. disableInput(pargs._form, '.plustemplkey,.btn-custom,[data-input],#WebsiteAdress,#State,#Memo,#Industry,[name="IsGroupUnit"],[name="IsImporter"]');
  110. if ('P,A'.indexOf(oRes.IsAudit) > -1 && parent.top.SysSet.CustomersAuditUsers.indexOf(parent.top.UserInfo.MemberID) > -1) {
  111. $('#Toolbar_Audit').show();
  112. }
  113. if (oRes.IsAudit === 'Y') {
  114. $('#Toolbar_ApplyforUpdate').show();
  115. }
  116. }
  117. else {
  118. disableInput(pargs._form, '#CustomerNO,#Potential,#BlackListReason,#IndustryStatistics', false);
  119. $('#Toolbar_ToAudit').show();
  120. }
  121. if (pargs.params.Flag === 'Fit') {
  122. $('#Toolbar_Leave,#Toolbar_Del').hide();
  123. }
  124. $('#Toolbar_CopySync').hide();
  125. if (data.IsAudit === 'Y' && 'TE,TG'.indexOf(parent.UserInfo.OrgID) > -1) {
  126. //只有已審核才顯示
  127. $('#Toolbar_CopySync').show();
  128. }
  129. if(oRes.UniCode == ""){
  130. $(".APIImport").show();
  131. }
  132. /*
  133. let saIndustry = oRes.Industry.split(',');
  134. $.each(oRes.Industry.split(','), function (idx, data) {
  135. if(data.ListSource != "" && data.ListSource != null ){
  136. if($.inArray(data.ListSource, saListSource) < 0){
  137. saListSource.push(data.ListSource);
  138. }
  139. }
  140. });
  141. */
  142. //alert(oRes.Industry);
  143. //$("#Industry").val(oRes.Industry.split(',')).trigger('change');
  144. },
  145. /**
  146. * 處理新增資料參數
  147. * @param {Object} pargs CanDo 對象
  148. * @param {Object} data 當前表單資料
  149. */
  150. getInsertParams: function (pargs, data) {
  151. var sCustomerFirstChart = '',
  152. sCustomerNo_O = '',
  153. sCustomerNo_N = '';
  154. //若失敗後,資料已經變成字串了。需要再次轉回陣列,才能刪除
  155. if (typeof pargs.data.Contactors === 'string') {
  156. pargs.data.Contactors = JSON.parse(pargs.data.Contactors || '[]');
  157. }
  158. data.Contactors = JSON.stringify(pargs.data.Contactors);
  159. sCustomerFirstChart = getCustomerFirstChart(data.TransactionType, data.CustomerEName, data.CustomerCName);
  160. if((parent.top.OrgID == "TE" || parent.top.OrgID == "TG") && (data.CustomerNO.substr(0, 2) == "TE" || data.CustomerNO.substr(0, 2) == "TG")){
  161. sCustomerNo_O = data.CustomerNO.substr(0, 2) + data.TransactionType + sCustomerFirstChart;
  162. } else {
  163. sCustomerNo_O = parent.top.OrgID + data.TransactionType + sCustomerFirstChart;
  164. }
  165. sCustomerNo_N = data.TransactionType + sCustomerFirstChart;
  166. if (sAction === 'Upd') {
  167. //if(data.CustomerNO.substr(0, 2) == "TE" || data.CustomerNO.substr(0, 2) == "TG" || data.CustomerNO.substr(0, 2) == "SG" || data.CustomerNO.substr(0, 2) == "SE"){ //舊編碼
  168. if(data.CustomerNO.substr(0, 2) == "TE" || data.CustomerNO.substr(0, 2) == "TG" || data.CustomerNO.substr(0, 2) == "SG" || data.CustomerNO.substr(0, 2) == "SE" || data.CustomerNO.substr(0, 2) == "HY"){ //舊編碼
  169. if (data.CustomerNO.substr(0, 4) !== sCustomerNo_O) {
  170. //與原先不相同,重新產生編碼
  171. data.CustomerNO = sCustomerNo_O;
  172. }
  173. } else {
  174. if (data.CustomerNO.substr(0, 2) !== sCustomerNo_N) {
  175. //與原先不相同,重新產生編碼
  176. if(parent.top.OrgID == "TE" || parent.top.OrgID == "TG"){
  177. data.CustomerNO = sCustomerNo_N;
  178. } else {
  179. data.CustomerNO = sCustomerNo_O;
  180. }
  181. }
  182. }
  183. }
  184. else {
  185. if (!data.CustomerNO) {
  186. if(parent.top.OrgID == "TE" || parent.top.OrgID == "TG"){
  187. data.CustomerNO = sCustomerNo_N;
  188. } else {
  189. data.CustomerNO = sCustomerNo_O;
  190. }
  191. }
  192. }
  193. let sIndustry = "";
  194. if($("#Industry").val() != "" && $("#Industry").val() != null){
  195. $.each($("#Industry").val(), function (idx, item) {
  196. sIndustry = sIndustry + item + ",";
  197. });
  198. }
  199. data.Industry = sIndustry;
  200. delete data.IndustryStatistics;
  201. return data;
  202. },
  203. /**
  204. * 處理修改資料參數
  205. * @param {Object} pargs CanDo 對象
  206. * @param {Object} data 當前表單資料
  207. */
  208. getUpdateParams: function (pargs, data) {
  209. let sIndustry = "";
  210. if($("#Industry").val() != "" && $("#Industry").val() != null){
  211. $.each($("#Industry").val(), function (idx, item) {
  212. sIndustry = sIndustry + item + ",";
  213. });
  214. }
  215. data.Industry = sIndustry;
  216. return pargs.options.getInsertParams(pargs, data);
  217. },
  218. /**
  219. * 新增資料
  220. * @param {Object} pargs CanDo 對象
  221. * @param {Object} data 當前新增的資料
  222. * @param {String} flag 新增 or 儲存后新增
  223. */
  224. getInsertBack: function (pargs, data, flag) {
  225. if (pargs.params.From === 'Appoint') {
  226. fnReEditCustomer($('body').attr('PopId') || '', data.guid).done(function () {
  227. if (pargs.params.Flag === 'Pop') {
  228. $('#Toolbar button').prop('disabled', true);
  229. parent.fnReFresh(data.guid);
  230. showMsg(i18next.t("message.Save_Success"), 'success'); // ╠message.Save_Success⇒新增成功╣
  231. }
  232. else {
  233. showMsgAndGo(i18next.t("message.Save_Success"), pargs.ProgramId, '?Action=Upd&guid=' + data.guid); // ╠message.Save_Success⇒新增成功╣
  234. }
  235. });
  236. }
  237. else {
  238. if (flag == 'add') {
  239. showMsgAndGo(i18next.t("message.Save_Success"), pargs.ProgramId, '?Action=Upd&guid=' + data.guid); // ╠message.Save_Success⇒新增成功╣
  240. }
  241. else {
  242. showMsgAndGo(i18next.t("message.Save_Success"), pargs.ProgramId, '?Action=Add'); // ╠message.Save_Success⇒新增成功╣
  243. }
  244. }
  245. },
  246. /**
  247. * 修改資料
  248. * @param {Object} pargs CanDo 對象
  249. * @param {Object} data 當前修改的資料
  250. */
  251. getUpdateBack: function (pargs, data) {
  252. if (typeof pargs.data.Contactors === 'string') {
  253. pargs.data.Contactors = $.parseJSON(pargs.data.Contactors || '[]');
  254. }
  255. showMsg(i18next.t("message.Modify_Success"), 'success'); //╠message.Modify_Success⇒修改成功╣
  256. if (window.bLeavePage) {
  257. setTimeout(function () {
  258. pargs._pageLeave();
  259. }, 1000);
  260. }
  261. else {
  262. pargs._setFormVal(data);
  263. //location.reload();
  264. }
  265. },
  266. /**
  267. * 客製化驗證規則
  268. * @param {Object} pargs CanDo 對象
  269. */
  270. validRulesCus: function (pargs) {
  271. $.validator.addMethod("unicoderequired", function (value, element, parms) {
  272. var sTransactionType = $('[name="TransactionType"]:checked').val();
  273. if ((sTransactionType === 'A' || sTransactionType === 'D') && value === '') {
  274. return false;
  275. }
  276. return true;
  277. });
  278. $.validator.addMethod("unicodelen", function (value) {
  279. if (value !== '' && value.length != 8) {
  280. return false;
  281. }
  282. return true;
  283. });
  284. $.validator.addMethod("customercnamerequired", function (value, element, parms) {
  285. var sTransactionType = $('[name="TransactionType"]:checked').val();
  286. if (!(sTransactionType === 'B' || sTransactionType === 'C') && value === '') {
  287. return false;
  288. }
  289. return true;
  290. });
  291. $.validator.addMethod("customerenamecus", function (value, element, parms) {
  292. var p = /[a-z]/i,
  293. b = p.test(value.substr(0, 1));
  294. if (!b && value !== '') {
  295. return false;
  296. }
  297. return true;
  298. });
  299. $.validator.addMethod("customerenamerequired", function (value, element, parms) {
  300. var sTransactionType = $('[name="TransactionType"]:checked').val();
  301. if ((sTransactionType === 'B' || sTransactionType === 'C') && value === '') {
  302. return false;
  303. }
  304. return true;
  305. });
  306. $.validator.addMethod("customershortnamerule", function (value) {
  307. var bRetn = true;
  308. g_api.ConnectLite(pargs.ProgramId, pargs._api.getcout,
  309. {
  310. guid: pargs.ids.guid,
  311. CustomerShotCName: value
  312. },
  313. function (res) {
  314. if (res.RESULT && res.DATA.rel > 0) {
  315. bRetn = false;
  316. }
  317. }, null, false);
  318. return bRetn;
  319. });
  320. $.validator.addMethod("unicoderule", function (value) {
  321. var bRetn = true;
  322. if (value) {
  323. g_api.ConnectLite(pargs.ProgramId, pargs._api.getcout,
  324. {
  325. guid: pargs.ids.guid,
  326. UniCode: value
  327. },
  328. function (res) {
  329. if (res.RESULT && res.DATA.rel > 0) {
  330. bRetn = false;
  331. }
  332. }, null, false);
  333. }
  334. return bRetn;
  335. });
  336. },
  337. /**
  338. * 驗證規則
  339. */
  340. validRules: {
  341. //若是換頁新增會出錯,必須驗證隱藏的tab
  342. //ignore: 'disabled',
  343. onfocusout: false,
  344. rules: {
  345. Email: {
  346. email: true
  347. },
  348. UniCode: {
  349. unicodelen: true,
  350. unicoderule: true
  351. },
  352. TransactionType: { required: true },
  353. CustomerShotCName: { customershortnamerule: true }
  354. },
  355. messages: {
  356. Email: i18next.t("message.IncorrectEmail"),// ╠message.IncorrectEmail⇒郵箱格式不正確╣
  357. TransactionType: { required: i18next.t("Customers_Upd.TransactionType_required") },// ╠Customers_Upd.TransactionType_required⇒請選擇交易類型╣
  358. UniCode: {
  359. unicodelen: i18next.t("message.UniCodeLength"),// ╠message.UniCodeLength⇒客戶統一編號必須是8碼╣
  360. unicoderule: i18next.t("message.Data_Repeat")// ╠message.Data_Repeat⇒此筆資料已建檔╣
  361. },
  362. CustomerShotCName: { customershortnamerule: i18next.t("message.ShotNameExist") }// ╠message.ShotNameExist⇒該簡稱已被使用╣
  363. }
  364. },
  365. /**
  366. * 客製化按鈕
  367. * @param {Object} pargs CanDo 對象
  368. */
  369. cusBtns: function (pargs) {
  370. var saCusBtns = [];
  371. if (pargs.action !== 'add') {
  372. saCusBtns.push({
  373. id: 'Toolbar_ToAudit',
  374. value: 'common.SubmitAudit',// ╠common.SubmitAudit⇒提交審核╣
  375. /**
  376. * 業務提交審核
  377. */
  378. action: function (pargs) {
  379. if (pargs.data.Effective === 'N') {
  380. showMsg(i18next.t('message.DataHasInvalid')); // ╠message.DataHasInvalid⇒該資料已無效╣
  381. return false;
  382. }
  383. if (pargs.data.CustomerNO.length != 7) {
  384. showMsg('客戶編號為空或非正式格式,請修改儲存後再提交審核','error');
  385. return false;
  386. }
  387. /* if (pargs.data.CustomerShotCName == '' || pargs.data.CustomerShotCName == null) {
  388. showMsg('客戶簡稱不可為空,請修改儲存後再提交審核');
  389. return false;
  390. }
  391. if (pargs.data.UniCode == '' || pargs.data.UniCode == null) {
  392. showMsg('統一編號不可為空,請修改儲存後再提交審核');
  393. return false;
  394. }
  395. if (pargs.data.CustomerCName == '' || pargs.data.CustomerCName == null) {
  396. showMsg('客戶中文名稱不可為空,請修改儲存後再提交審核');
  397. return false;
  398. }
  399. if (pargs.data.Telephone == '' || pargs.data.Telephone == null) {
  400. showMsg('電話不可為空,請修改儲存後再提交審核');
  401. return false;
  402. }
  403. if (pargs.data.State == '' || pargs.data.State == null) {
  404. showMsg('國家不可為空,請修改儲存後再提交審核');
  405. return false;
  406. }
  407. if (pargs.data.address == '' || pargs.data.address == null) {
  408. showMsg('公司地址不可為空,請修改儲存後再提交審核');
  409. return false;
  410. }
  411. if (pargs.data.InvoiceAddress == '' || pargs.data.InvoiceAddress == null) {
  412. showMsg('發票地址不可為空,請修改儲存後再提交審核');
  413. return false;
  414. } */
  415. var sIsAudit = oAuditFlag[pargs.data.IsAudit];
  416. var sCustomerShotCName = $('#CustomerShotCName').val();
  417. var sUniCode = $('#UniCode').val();
  418. var sTransactionType = $('[name="TransactionType"]:checked').val();
  419. var sTaxpayerOrgID = $('#TaxpayerOrgID').val();
  420. g_api.ConnectLite(pargs.ProgramId, 'ToAudit', {
  421. guid: pargs.ids.guid,
  422. IsAudit: sIsAudit,
  423. CustomerShotCName: sCustomerShotCName,
  424. UniCode: sUniCode,
  425. TransactionType: sTransactionType,
  426. TaxpayerOrgID: sTaxpayerOrgID
  427. }, function (res) {
  428. if (res.RESULT) {
  429. $('#Toolbar_ToAudit').hide();
  430. pargs._getOne();
  431. showMsg(i18next.t("message.ToAudit_Success"), 'success'); // ╠message.ToAudit_Success⇒提交審核成功╣
  432. parent.top.msgs.server.pushTips(parent.top.fnReleaseUsers(res.DATA.rel));
  433. }
  434. else {
  435. showMsg(i18next.t('message.ToAudit_Failed') + '<br>' + res.MSG, 'error'); // ╠message.ToAudit_Failed⇒提交審核失敗╣
  436. }
  437. }, function () {
  438. showMsg(i18next.t('message.ToAudit_Failed'), 'error'); // ╠message.ToAudit_Failed⇒提交審核失敗╣
  439. });
  440. }
  441. }, {
  442. id: 'Toolbar_CopySync',
  443. value: 'Customers_Upd.CopySync', // 複製同步,
  444. action: function (parg) {
  445. },
  446. 'data-toggle': 'modal',
  447. 'data-target': '#CopySync'
  448. });
  449. if (parent.top.SysSet.CustomersAuditUsers.indexOf(parent.top.UserInfo.MemberID) > -1) {
  450. saCusBtns.push({
  451. id: 'Toolbar_Audit',
  452. value: 'common.Audit',// ╠common.Audit⇒審核╣
  453. /**
  454. * 主管審核
  455. */
  456. action: function (pargs) {
  457. layer.open({
  458. type: 1,
  459. title: i18next.t('common.Audit'),// ╠common.Audit⇒審核╣
  460. area: ['400px', '260px'],//寬度
  461. shade: 0.75,//遮罩
  462. shadeClose: true,
  463. btn: [i18next.t('common.Cancel')],// ╠common.Cancel⇒取消╣// ╠common.Cancel⇒取消╣
  464. content: '<div class="pop-box">\
  465. <textarea name="NotPassReason" id="NotPassReason" style="min-width:300px;" class="form-control" rows="5" cols="20" placeholderid="common.NotPassReason" placeholder="不通過原因..."></textarea><br>\
  466. <button type="button" data-i18n="common.Pass" id="audit_pass" class="btn-custom green">通過</button>\
  467. <button type="button" data-i18n="common.NotPass" id="audit_notpass" class="btn-custom red">不通過</button>\
  468. </div>',
  469. success: function (layero, idx) {
  470. $('.pop-box :button').click(function () {
  471. var oAudit = {},
  472. sNotPassReason = $('#NotPassReason').val();
  473. if (this.id === 'audit_pass') {
  474. oAudit.IsAudit = 'Y';
  475. oAudit.NotPassReason = '';
  476. }
  477. else {
  478. oAudit.IsAudit = 'Q';
  479. oAudit.NotPassReason = sNotPassReason;
  480. if (!sNotPassReason) {
  481. showMsg(i18next.t("message.NotPassReason_Required")); // ╠message.NotPassReason_Required⇒請填寫不通過原因╣
  482. return false;
  483. }
  484. }
  485. g_api.ConnectLite(pargs.ProgramId, 'Audit', {
  486. IsAudit: oAudit.IsAudit,
  487. NotPassReason: oAudit.NotPassReason,
  488. guid: pargs.ids.guid
  489. }, function (res) {
  490. if (res.RESULT) {
  491. $('#Toolbar_Audit').hide();
  492. layer.close(idx);
  493. pargs._getOne();
  494. showMsg(i18next.t("message.Audit_Completed"), 'success'); // ╠message.Audit_Completed⇒審核完成╣
  495. parent.top.msgs.server.pushTip(parent.top.OrgID, res.DATA.rel);
  496. if (oAudit.IsAudit === 'Y') {
  497. parent.top.msgs.server.pushTransfer(parent.top.OrgID, parent.top.UserID, pargs.data.CustomerNO, 2);
  498. }
  499. }
  500. else {
  501. showMsg(i18next.t('message.Audit_Failed') + '<br>' + res.MSG, 'error'); // ╠message.Audit_Failed⇒審核失敗╣
  502. }
  503. }, function () {
  504. showMsg(i18next.t('message.Audit_Failed'), 'error'); // ╠message.Audit_Failed⇒審核失敗╣
  505. });
  506. });
  507. pargs._transLang(layero);
  508. }
  509. });
  510. }
  511. });
  512. }
  513. saCusBtns.push({
  514. id: 'Toolbar_ApplyforUpdate',
  515. value: 'common.ApplyforUpdate',// ╠common.ApplyforUpdate⇒申請修改╣
  516. /**
  517. * 申請修改
  518. */
  519. action: function (pargs) {
  520. layer.open({
  521. type: 1,
  522. title: i18next.t('common.ApplyforUpdate'),// ╠common.ApplyforUpdate⇒申請修改╣
  523. area: ['400px', '260px'],//寬度
  524. shade: 0.75,//遮罩
  525. shadeClose: true,
  526. btn: [i18next.t('common.Confirm'), i18next.t('common.Cancel')],//╠common.Confirm⇒確定╣╠common.Cancel⇒取消╣
  527. content: '<div class="pop-box"><textarea name="Reason" id="Reason" style="min-width:300px;" class="form-control" rows="5" cols="20" placeholderid="common.ApplyforUpdateReason" placeholder="申請修改原因..."></textarea></div>',
  528. success: function (layero, idx) {
  529. pargs._transLang(layero);
  530. },
  531. yes: function (index, layero) {
  532. var sReason = $('#Reason').val();
  533. if (!sReason) {
  534. showMsg(i18next.t("message.Reason_Required")); // ╠message.Reason_Required⇒請填寫原因╣
  535. return false;
  536. }
  537. g_api.ConnectLite(pargs.ProgramId, 'ApplyforUpdate', {
  538. Guid: pargs.ids.guid,
  539. NotPassReason: sReason
  540. }, function (res) {
  541. if (res.RESULT) {
  542. layer.close(index);
  543. $('#Toolbar_ApplyforUpdate').hide();
  544. pargs._getOne();
  545. showMsg(i18next.t("message.HasNoticeAditor"), 'success'); // ╠message.HasNoticeAditor⇒已通知審核人員╣
  546. parent.top.msgs.server.pushTips(parent.top.fnReleaseUsers(res.DATA.rel));
  547. }
  548. else {
  549. showMsg(i18next.t('message.ToApplyFailed') + '<br>' + res.MSG, 'error'); // ╠message.ToApplyFailed⇒提交申請失敗╣
  550. }
  551. }, function () {
  552. showMsg(i18next.t('message.ToApplyFailed'), 'error');// ╠message.ToApplyFailed⇒提交申請失敗╣
  553. });
  554. }
  555. });
  556. }
  557. });
  558. }
  559. return saCusBtns;
  560. },
  561. /**
  562. * 頁面初始化
  563. * @param {Object} pargs CanDo 對象
  564. */
  565. pageInit: function (pargs) {
  566. var postArray = [];
  567. if (pargs.action === 'add') {
  568. $("#litab3").hide();
  569. $("#litab2").hide();
  570. $("#litab4").hide();
  571. $("#litab5").hide();
  572. $("#litab6").hide();
  573. }
  574. $('#CopySync').find('label[OrgID=\"' + g_db.GetItem("orgid").toUpperCase() + '\"]').hide(); //隱藏自己組織別
  575. $('#Toolbar_CopySync').click(function () {
  576. $('#CopySync').find('label[OrgID] > :checkbox').prop('checked', false); //清除已勾選項目
  577. });
  578. $('#CopySycnOK').click(function () {
  579. var aryCheckOrgID = [];
  580. //取得勾選組織別
  581. $('#CopySync').find('label[OrgID]').each(function (idx, element) {
  582. var sOrgID = $(element).attr('OrgID');
  583. if ($(element).find(':checkbox').is(':checked')) {
  584. aryCheckOrgID.push(sOrgID);
  585. }
  586. });
  587. if (aryCheckOrgID.length <= 0) {
  588. showMsg(i18next.t("請先選擇要複製同步的公司別"), 'error');
  589. }
  590. else {
  591. canDo.data.currOrgID = g_db.GetItem("orgid").toUpperCase();
  592. canDo.data.OrgID = aryCheckOrgID[0];
  593. var sCustomerFirstChart = getCustomerFirstChart(canDo.data.TransactionType, canDo.data.CustomerEName, canDo.data.CustomerCName),
  594. sCustomerNo = canDo.data.OrgID + canDo.data.TransactionType + sCustomerFirstChart;
  595. canDo.data.CustomerNO = sCustomerNo;
  596. g_api.ConnectLite(pargs.ProgramId, 'CopySync', canDo.data, function (res) {
  597. if (res.RESULT) {
  598. var data = res.DATA.rel;
  599. showMsg(i18next.t("執行成功,同步新客戶編號為" + data.CustomerNO), 'success');
  600. parent.top.msgs.server.pushTips(parent.top.fnReleaseUsers(data));
  601. }
  602. else {
  603. showMsg(i18next.t('message.ToAudit_Failed') + '<br>' + res.MSG, 'error'); // ╠message.ToAudit_Failed⇒提交審核失敗╣
  604. }
  605. }, function () {
  606. showMsg(i18next.t('message.ToAudit_Failed'), 'error'); // ╠message.ToAudit_Failed⇒提交審核失敗╣
  607. });
  608. }
  609. });
  610. if (pargs.action === 'upd') {
  611. postArray.push(pargs._getOne());
  612. }
  613. else {
  614. if (g_db.GetItem("orgid").toUpperCase() === 'SG') // if (parent.OrgID.toUpperCase() === 'SG')
  615. $('.APIImport').hide();
  616. else
  617. $('.APIImport').show();
  618. $('.CustomerEName').hide();
  619. pargs.data.Contactors = [];
  620. }
  621. postArray.push(fnSetArgDrop([
  622. {
  623. OrgID: 'TE',
  624. ArgClassID: 'Potential',
  625. CallBack: function (data) {
  626. $('#Potential').html(createOptions(data, 'id', 'text').replace("請選擇...",""))
  627. }
  628. },
  629. {
  630. ArgClassID: 'TranType',
  631. CallBack: function (data) {
  632. $('#transactiontype').html(createRadios(data, 'id', 'text', 'TransactionType', '', true)).find('label:first').click();
  633. pargs._uniformInit($('#transactiontype'));
  634. }
  635. },
  636. {
  637. OrgID: 'TE',
  638. ArgClassID: 'ExhibClass',
  639. ShowId: true,
  640. CallBack: function (data) {
  641. $('#Industry').html(createOptions(data, 'id', 'text', true)).select2();
  642. $('#IndustryStatistics').html(createOptions(data, 'id', 'text', true)).select2();
  643. }
  644. },
  645. {
  646. OrgID: 'TE',
  647. ArgClassID: 'BlackListReason',
  648. CallBack: function (data) {
  649. $('#BlackListReason').html(createOptions(data, 'id', 'text'))
  650. }
  651. },
  652. {
  653. OrgID: 'TE',
  654. ArgClassID: 'TrasportCompany',
  655. CallBack: function (data) {
  656. $('#CoopTrasportCompany').html(createOptions(data, 'id', 'text')).select2();
  657. }
  658. }
  659. ]));
  660. //postArray return 要是function 才會生效
  661. postArray.push(setStateDrop());
  662. if (parent.top.OrgID === 'SG') {
  663. $('.unicode-box').hide();
  664. $('.sg-box').show();
  665. }
  666. //加載報關類別,加載報價頁簽,加載運輸方式, 加載機場, 加載貨棧場, 加載倉庫
  667. $.whenArray(postArray).done(function (res) {
  668. let resState = '';
  669. if (pargs.action === 'upd' && res[0].RESULT) {
  670. var oRes = res[0].DATA.rel;
  671. pargs._setFormVal(oRes);
  672. fnBindContactors();
  673. pargs._getPageVal();//緩存頁面值,用於清除
  674. resState = oRes.State;
  675. switch (pargs.data.IsAudit) {
  676. case 'N'://未提交
  677. case 'Q'://退件
  678. case 'Z'://申請修改中
  679. $('#Toolbar_ApplyforUpdate,#Toolbar_Audit').hide();
  680. break;
  681. case 'Y':// ╠common.Audited⇒已審核╣
  682. $('#Toolbar_ToAudit,#Toolbar_Audit').hide();
  683. break;
  684. case 'P':// ╠common.InAudit⇒提交審核中╣
  685. case 'A'://重新提交審核中
  686. $('#Toolbar_ApplyforUpdate').hide();
  687. $('#Toolbar_ToAudit').hide();
  688. break;
  689. }
  690. if(oRes.Industry){
  691. $("#Industry").val(oRes.Industry.split(',')).trigger('change');
  692. }
  693. if(oRes.IndustryStatistics){
  694. $("#IndustryStatistics").val(oRes.IndustryStatistics.split(',')).trigger('change');
  695. }
  696. if(oRes.IsBlackList == "Y"){
  697. $("#BlackListReason" ).attr('disabled', false);
  698. }
  699. if(oRes.CoopTrasportCompany){
  700. $("#CoopTrasportCompany").val(oRes.CoopTrasportCompany.split(',')).trigger('change');
  701. }
  702. }
  703. if (pargs.params.Flag === 'Pop') {
  704. $('#Toolbar_Leave,#Toolbar_ReAdd,#APIImport').hide();
  705. }
  706. else if (pargs.params.Flag === 'Fit') {
  707. $('#Toolbar_Leave,#Toolbar_Del').hide();
  708. }
  709. if (canDo.params.FromId) {
  710. fnGetImportCustomersByAppointNO();
  711. }
  712. if ('Y,P,A'.indexOf(pargs.data.IsAudit) > -1) {
  713. disableInput(pargs._form, '.plustemplkey,.btn-custom,[data-input],#WebsiteAdress,#State,#Memo,#Industry,[name="IsGroupUnit"],[name="IsImporter"]');
  714. }
  715. $('[name="TransactionType"]').click(function () {
  716. if (this.value === 'A' || this.value === 'D') {
  717. $('.innercol,.address,.telephone').show();
  718. $('#BankName,#BankAcount,#TaxpayerOrgID,#Telephone,#Address').attr('required', true);
  719. }
  720. else {
  721. $('.innercol,.address,.telephone').hide();
  722. $('#BankName,#BankAcount,#TaxpayerOrgID,#Telephone,#Address').removeAttr('required');
  723. }
  724. if (this.value === 'B' || this.value === 'C') {
  725. $('.CustomerCName').hide();
  726. $('.CustomerEName').show();
  727. }
  728. else {
  729. $('.CustomerCName').show();
  730. $('.CustomerEName').hide();
  731. }
  732. if (EditableData || sAction === 'Add') {
  733. var DefaultChangeState = 'A,D,E,F'.indexOf(this.value) > -1;
  734. if (DefaultChangeState) {
  735. $('#State').val(DefaultState).trigger("change");
  736. }
  737. else {
  738. $('#State').val('').trigger("change");
  739. }
  740. }
  741. });
  742. $('[name="TransactionType"]:checked').click();
  743. if (!!resState) {
  744. $('#State').val(resState);
  745. }
  746. $('.plustemplkey').on('click', function () {
  747. var oNewKey = {};
  748. oNewKey.guid = guid();
  749. oNewKey.FullName = '';
  750. oNewKey.JobtitleName = '';
  751. oNewKey.TEL1 = '';
  752. oNewKey.TEL2 = '';
  753. oNewKey.FAX = '';
  754. oNewKey.Email = '';
  755. oNewKey.Memo = '';
  756. //若失敗後,資料已經變成字串了。需要再次轉回陣列,才能刪除
  757. if (typeof pargs.data.Contactors === 'string') {
  758. pargs.data.Contactors = JSON.parse(pargs.data.Contactors || '[]');
  759. }
  760. pargs.data.Contactors.push(oNewKey);
  761. fnBindContactors();
  762. });
  763. });
  764. var iHeight = $('body').height() - $('.page-title').height() - $('#searchbar').height() - 120;
  765. $("#jsGrid").jsGrid({
  766. width: "100%",
  767. height: "auto",
  768. autoload: false,
  769. filtering: false,
  770. pageLoading: true,
  771. inserting: false,
  772. editing: false,
  773. sorting: false,
  774. paging: false,
  775. pageIndex: 1,
  776. pageSize: parent.top.SysSet.GridRecords || 10,
  777. confirmDeleting: true,
  778. deleteConfirm: i18next.t('message.ConfirmToDelete'),// ╠message.ConfirmToDelete⇒確定要刪除嗎 ?╣
  779. pagePrevText: "<",
  780. pageNextText: ">",
  781. pageFirstText: "<<",
  782. pageLastText: ">>",
  783. rowDoubleClick: function (args) {
  784. parent.openPageTab("Exhibition_Upd", '?Action=Upd&SN=' + args.item.SN);
  785. },
  786. fields: [
  787. {
  788. name: "RowIndex", title: 'common.RowNumber', width: 50, align: "center"
  789. },
  790. {
  791. type: "control", title: '查詢單號', itemTemplate: function (val, item) {
  792. var iTips = 0,
  793. sTipsHtml = '<div class="layui-layer-btn-c">' + '查詢單號' + '</div>',
  794. saRefNumber = item.RefNumber.split(','),
  795. oOption = {
  796. btnAlign: 'c',
  797. time: 600000 //一個小時(如果不配置,默认是3秒)
  798. },
  799. oTips = $('<span>', {
  800. 'class': 'glyphicon glyphicon-info-sign',
  801. 'aria-hidden': true
  802. }).on({
  803. click: function () {
  804. oOption.btn = [i18next.t("common.Close")];// ╠common.Close⇒關閉╣
  805. layer.msg(sTipsHtml, oOption);
  806. },
  807. mouseenter: function (event) {
  808. delete oOption.btn;
  809. iTips = layer.msg(sTipsHtml, oOption);
  810. },
  811. mouseleave: function (event) {
  812. layer.close(iTips);
  813. }
  814. });
  815. if (saRefNumber.length > 0) {
  816. sTipsHtml += '<ul class="bill-status">';
  817. $.each(saRefNumber, function (idx, data) {
  818. let saData = data.split(';');
  819. let sDataType = saData[0];
  820. let sGuid = saData[1];
  821. let sDataContent = saData[2];
  822. let sTypeName = "";
  823. let sOnClick = "onclick=''";
  824. switch(sDataType){
  825. case "1":
  826. sTypeName = "進口:";
  827. sOnClick = "onclick='parent.openPageTab(\"ExhibitionImport_Upd\",\"?Action=Upd&ImportBillNO=" + sGuid + "\")'";
  828. break;
  829. case "2":
  830. sTypeName = "出口:";
  831. sOnClick = "onclick='parent.openPageTab(\"ExhibitionExport_Upd\",\"?Action=Upd&GoTab=2&ExportBillNO=" + sGuid + "\")'";
  832. break;
  833. case "3":
  834. sTypeName = "其他:";
  835. sDataContent = sDataContent.substring(0,10);
  836. sOnClick = "onclick='parent.openPageTab(\"OtherBusiness_Upd\",\"?Action=Upd&ImportBillNO=" + sGuid + "\")'";
  837. break;
  838. case "4":
  839. sTypeName = "其他駒驛:";
  840. sDataContent = sDataContent.substring(0,10);
  841. sOnClick = "onclick='parent.openPageTab(\"OtherExhibitionTG_Upd\",\"?Action=Upd&GoTab=2&Guid=" + sGuid + "\")'";
  842. break;
  843. }
  844. sTipsHtml += "<li><a class='gopagetab' " + sOnClick + "><div>" + sTypeName + sDataContent + "</div></a></li>";
  845. });
  846. sTipsHtml += '</ul>';
  847. oOption.area = ['300px'];
  848. /* if (saRefNumber.length > 15) {
  849. oOption.area = ['550px', '500px'];
  850. } */
  851. }
  852. else {
  853. sTipsHtml = '<div></div>';
  854. }
  855. oTips.css('color', 'blue');
  856. return oTips;
  857. }
  858. },
  859. {
  860. name: "ExhibitioShotName_TW", title: 'Exhibition_Upd.ExhibitioShotName_TW', width: 150, align: "center"
  861. },
  862. {
  863. name: "Exhibitioname_TW", title: 'Exhibition_Upd.Exhibitioname_TW', width: 150,align: "center"
  864. },
  865. {
  866. name: "Exhibitioname_EN", title: 'Exhibition_Upd.Exhibitioname_EN', width: 150,align: "center"
  867. },
  868. {
  869. name: "ExhibitionDateStart", title: 'Exhibition_Upd.ExhibitionDateRange', type: "text", align: "center", width: 150,
  870. itemTemplate: function (val, item) {
  871. var sDateRange = newDate(item.ExhibitionDateStart, 'date', true) + '~' + newDate(item.ExhibitionDateEnd, 'date', true);
  872. return sDateRange === '~' ? '' : sDateRange;
  873. }
  874. },
  875. {
  876. name: "CreateUserName", title: 'common.CreateUser', width: 150,align: "center"
  877. }
  878. ],
  879. controller: {
  880. loadData: function (args) {
  881. return fnGetGridData();
  882. },
  883. insertItem: function (args) {
  884. },
  885. updateItem: function (args) {
  886. },
  887. deleteItem: function (args) {
  888. }
  889. },
  890. onInit: function (args) {
  891. oGrid = args.grid;
  892. //pargs.setGrid(args.grid);
  893. }
  894. });
  895. $("#jsGrid1").jsGrid({
  896. width: "100%",
  897. height: "auto",
  898. autoload: false,
  899. filtering: false,
  900. pageLoading: true,
  901. inserting: false,
  902. editing: false,
  903. sorting: false,
  904. paging: false,
  905. pageIndex: 1,
  906. pageSize: parent.top.SysSet.GridRecords || 10,
  907. confirmDeleting: true,
  908. deleteConfirm: i18next.t('message.ConfirmToDelete'),// ╠message.ConfirmToDelete⇒確定要刪除嗎 ?╣
  909. pagePrevText: "<",
  910. pageNextText: ">",
  911. pageFirstText: "<<",
  912. pageLastText: ">>",
  913. rowDoubleClick: function (args) {
  914. parent.openPageTab("Exhibition_Upd", '?Action=Upd&SN=' + args.item.SN);
  915. },
  916. fields: [
  917. {
  918. name: "RowIndex", title: 'common.RowNumber', width: 50, align: "center"
  919. },
  920. {
  921. name: "SN", title: '專案代號', width: 50, align: "center"
  922. },
  923. {
  924. name: "ExhibitioShotName_TW", title: 'Exhibition_Upd.ExhibitioShotName_TW', width: 150, align: "center"
  925. },
  926. {
  927. name: "Exhibitioname_TW", title: 'Exhibition_Upd.Exhibitioname_TW', width: 150,align: "center"
  928. },
  929. {
  930. name: "Exhibitioname_EN", title: 'Exhibition_Upd.Exhibitioname_EN', width: 150,align: "center"
  931. },
  932. {
  933. name: "ExhibitionDateStart", title: 'Exhibition_Upd.ExhibitionDateRange', type: "text", align: "center", width: 150,
  934. itemTemplate: function (val, item) {
  935. var sDateRange = newDate(item.ExhibitionDateStart, 'date', true) + '~' + newDate(item.ExhibitionDateEnd, 'date', true);
  936. return sDateRange === '~' ? '' : sDateRange;
  937. }
  938. },
  939. {
  940. name: "CreateUserName", title: 'common.CreateUser', width: 150,align: "center"
  941. }
  942. ],
  943. controller: {
  944. loadData: function (args) {
  945. return fnGetGridData1();
  946. },
  947. insertItem: function (args) {
  948. },
  949. updateItem: function (args) {
  950. },
  951. deleteItem: function (args) {
  952. }
  953. },
  954. onInit: function (args) {
  955. oGrid1 = args.grid;
  956. //pargs.setGrid(args.grid);
  957. }
  958. });
  959. $("#jsGrid2").jsGrid({
  960. width: "100%",
  961. height: "auto",
  962. autoload: false,
  963. filtering: false,
  964. pageLoading: true,
  965. inserting: false,
  966. editing: false,
  967. sorting: true,
  968. paging: false,
  969. pageIndex: 1,
  970. pageSize: parent.top.SysSet.GridRecords || 10,
  971. confirmDeleting: true,
  972. deleteConfirm: i18next.t('message.ConfirmToDelete'),// ╠message.ConfirmToDelete⇒確定要刪除嗎 ?╣
  973. pagePrevText: "<",
  974. pageNextText: ">",
  975. pageFirstText: "<<",
  976. pageLastText: ">>",
  977. rowDoubleClick: function (args) {
  978. fnEditContactor(args.item.guid);
  979. },
  980. fields: [
  981. {
  982. name: "RowIndex", title: 'common.RowNumber', width: 30, align: "center"
  983. },
  984. {
  985. name: "Call", title: '稱呼', width: 40, align: "center", itemTemplate: function (val, item) {
  986. if(val=="1"){
  987. return "Mr.";
  988. } else if (val=="2"){
  989. return "Miss.";
  990. }
  991. }
  992. },
  993. {
  994. name: "ContactorName", title: '聯絡人名稱', width: 150, align: "center"
  995. },
  996. {
  997. name: "JobTitle", title: 'common.JobTitle', width: 100, align: "center"
  998. },
  999. {
  1000. name: "Telephone1", title: 'common.Telephone', width: 120, align: "center"
  1001. },
  1002. {
  1003. name: "Ext1", title: 'common.EXT', width: 50, align: "center"
  1004. },
  1005. {
  1006. name: "Email1", title: 'common.Email', width: 150, align: "center"
  1007. },
  1008. {
  1009. name: "Memo", title: 'common.Memo', width: 150, align: "center"
  1010. },
  1011. {
  1012. name: "OrderByValue", title: 'common.OrderByValue', type: "select", width: 50,
  1013. itemTemplate: function (val, item) {
  1014. return this._createSelect = $("<select>", {
  1015. //class: 'w70',
  1016. html: createOptions(parseInt(item.OrderCount)),
  1017. change: function () {
  1018. let sOldValue = val,
  1019. sNewValue = this.value;
  1020. g_api.ConnectLite(canDo.ProgramId, canDo._api.order, {
  1021. CustomerId: canDo.ids.guid,
  1022. Id: item.guid,
  1023. OldOrderByValue: sOldValue,
  1024. NewOrderByValue: sNewValue
  1025. }, function (res) {
  1026. if (res.RESULT) {
  1027. showMsg(i18next.t('message.Update_Success'), 'success');// ╠message.Update_Success⇒更新成功╣
  1028. //canDo.Grid.openPage(canDo.options.toFirstPage ? 1 : canDo.options.queryPageidx);
  1029. oGrid2.loadData();
  1030. }
  1031. else {
  1032. showMsg(i18next.t('message.Update_Failed') + '<br>' + res.MSG, 'error'); // ╠message.Update_Failed⇒更新失敗╣
  1033. }
  1034. });
  1035. }
  1036. }).val(val);
  1037. }
  1038. }
  1039. ],
  1040. controller: {
  1041. loadData: function (args) {
  1042. return fnGetGridData2(args);
  1043. },
  1044. insertItem: function (args) {
  1045. },
  1046. updateItem: function (args) {
  1047. },
  1048. deleteItem: function (args) {
  1049. }
  1050. },
  1051. onInit: function (args) {
  1052. //pargs.setGrid(args.grid);
  1053. oGrid2= args.grid;
  1054. }
  1055. });
  1056. $("#jsGrid3").jsGrid({
  1057. width: "100%",
  1058. height: "auto",
  1059. autoload: false,
  1060. filtering: false,
  1061. pageLoading: true,
  1062. inserting: false,
  1063. editing: false,
  1064. sorting: false,
  1065. paging: false,
  1066. pageIndex: 1,
  1067. pageSize: parent.top.SysSet.GridRecords || 10,
  1068. confirmDeleting: true,
  1069. deleteConfirm: i18next.t('message.ConfirmToDelete'),// ╠message.ConfirmToDelete⇒確定要刪除嗎 ?╣
  1070. pagePrevText: "<",
  1071. pageNextText: ">",
  1072. pageFirstText: "<<",
  1073. pageLastText: ">>",
  1074. rowDoubleClick: function (args) {
  1075. parent.openPageTab("Callout_Upd", '?Action=Upd&SN=' + args.item.SN + '&guid=' + canDo.ids.guid);
  1076. },
  1077. fields: [
  1078. {
  1079. name: "RowIndex", title: 'common.RowNumber', width: 50, align: "center"
  1080. },
  1081. {
  1082. name: "ExhibitionCode", title: 'Exhibition_Upd.ExhibitionCode', width: 150, align: "center"
  1083. },
  1084. {
  1085. name: "ExhibitioShotName_TW", title: 'Exhibition_Upd.ExhibitioShotName_TW', width: 150, align: "center"
  1086. },
  1087. {
  1088. name: "Exhibitioname_TW", title: 'Exhibition_Upd.Exhibitioname_TW', width: 150,align: "center"
  1089. },
  1090. {
  1091. name: "Exhibitioname_EN", title: 'Exhibition_Upd.Exhibitioname_EN', width: 150,align: "center"
  1092. },
  1093. {
  1094. name: "ExhibitionDateStart", title: 'Exhibition_Upd.ExhibitionDateRange', type: "text", align: "center", width: 150,
  1095. itemTemplate: function (val, item) {
  1096. var sDateRange = newDate(item.ExhibitionDateStart, 'date', true) + '~' + newDate(item.ExhibitionDateEnd, 'date', true);
  1097. return sDateRange === '~' ? '' : sDateRange;
  1098. }
  1099. },
  1100. {
  1101. name: "CreateUserName", title: 'common.CreateUser', width: 150,align: "center"
  1102. }
  1103. ],
  1104. controller: {
  1105. loadData: function (args) {
  1106. return fnGetGridData3();
  1107. },
  1108. insertItem: function (args) {
  1109. },
  1110. updateItem: function (args) {
  1111. },
  1112. deleteItem: function (args) {
  1113. }
  1114. },
  1115. onInit: function (args) {
  1116. oGrid3= args.grid;
  1117. }
  1118. });
  1119. $("#jsGrid4").jsGrid({
  1120. width: "100%",
  1121. height: "auto",
  1122. autoload: false,
  1123. filtering: false,
  1124. pageLoading: true,
  1125. inserting: false,
  1126. editing: false,
  1127. sorting: false,
  1128. paging: false,
  1129. pageIndex: 1,
  1130. pageSize: parent.top.SysSet.GridRecords || 10,
  1131. confirmDeleting: true,
  1132. deleteConfirm: i18next.t('message.ConfirmToDelete'),// ╠message.ConfirmToDelete⇒確定要刪除嗎 ?╣
  1133. pagePrevText: "<",
  1134. pageNextText: ">",
  1135. pageFirstText: "<<",
  1136. pageLastText: ">>",
  1137. rowDoubleClick: function (args) {
  1138. if ('A,C'.indexOf(args.item.DataType) > -1 && args.item.CreateUser === parent.UserID) {
  1139. parent.openPageTab('Complaint_Upd', '?Action=Upd&Guid=' + args.item.Guid);
  1140. }
  1141. else {
  1142. parent.openPageTab('Complaint_View', '?Action=Upd&Guid=' + args.item.Guid);
  1143. }
  1144. },
  1145. fields: [
  1146. {
  1147. name: "RowIndex", title: 'common.RowNumber', width: 30, align: "center"
  1148. },
  1149. {
  1150. name: "ComplaintNumber", title: '個案代號', width: 50, align: "center"
  1151. },
  1152. {
  1153. name: "ExhibitioShotName_TW", title: 'Exhibition_Upd.ExhibitioShotName_TW', width: 100, align: "center"
  1154. },
  1155. {
  1156. name: "ExhibitionName", title: 'Exhibition_Upd.Exhibitioname_TW', width: 150,align: "center"
  1157. },
  1158. {
  1159. name: "ComplaintType", title: '類型', width: 50, align: "center", itemTemplate: function (val, item) {
  1160. let strComplaintType = "";
  1161. switch(val){
  1162. case "1":
  1163. strComplaintType = "貨損";
  1164. break;
  1165. case "2":
  1166. strComplaintType = "延誤";
  1167. break;
  1168. case "3":
  1169. strComplaintType = "遺失";
  1170. break;
  1171. case "4":
  1172. strComplaintType = "抱怨";
  1173. break;
  1174. }
  1175. return strComplaintType;
  1176. }
  1177. },
  1178. {
  1179. name: "Description", title: '內容', width: 300, align: "center"
  1180. },
  1181. {
  1182. name: "CreateUserName", title: 'common.CreateUser', width: 70,align: "center"
  1183. }
  1184. ],
  1185. controller: {
  1186. loadData: function (args) {
  1187. return fnGetGridData4();
  1188. },
  1189. insertItem: function (args) {
  1190. },
  1191. updateItem: function (args) {
  1192. },
  1193. deleteItem: function (args) {
  1194. }
  1195. },
  1196. onInit: function (args) {
  1197. oGrid4= args.grid;
  1198. }
  1199. });
  1200. $("#jsGrid5").jsGrid({
  1201. width: "100%",
  1202. height: "auto",
  1203. autoload: false,
  1204. filtering: false,
  1205. pageLoading: true,
  1206. inserting: false,
  1207. editing: false,
  1208. sorting: false,
  1209. paging: false,
  1210. pageIndex: 1,
  1211. pageSize: parent.top.SysSet.GridRecords || 10,
  1212. confirmDeleting: true,
  1213. deleteConfirm: i18next.t('message.ConfirmToDelete'),// ╠message.ConfirmToDelete⇒確定要刪除嗎 ?╣
  1214. pagePrevText: "<",
  1215. pageNextText: ">",
  1216. pageFirstText: "<<",
  1217. pageLastText: ">>",
  1218. rowDoubleClick: function (args) {
  1219. parent.openPageTab('SatisfactionCase_Upd',"?Action=Upd&SN=" + args.item.SN );
  1220. },
  1221. fields: [
  1222. {
  1223. name: "RowIndex", title: 'common.RowNumber', width: 50, align: "center"
  1224. },
  1225. {
  1226. name: "ExhibitioShotName_TW", title: 'Exhibition_Upd.ExhibitioShotName_TW', width: 150, align: "center"
  1227. },
  1228. {
  1229. name: "Exhibitioname_TW", title: 'Exhibition_Upd.Exhibitioname_TW', width: 150,align: "center"
  1230. },
  1231. {
  1232. name: "Feild01", title: '整體服務品質滿意度', width: 150, align: "center"
  1233. },
  1234. /* {
  1235. name: "SatisfactionDetail", title: '滿意度細節', width: 150, align: "center"
  1236. }, */
  1237. {
  1238. name: "control1",
  1239. width: 100,
  1240. title: '滿意度細節',
  1241. align: "center",
  1242. itemTemplate: function (val, item) {
  1243. var saBtn = [];
  1244. saBtn.push($('<button />', {
  1245. type: 'button', 'class': 'btn-custom blue', title: i18next.t('common.Toolbar_Imp'), html: '<i class="glyphicon glyphicon-file"></i>', click: function () {
  1246. fnGetSatisfactionCaseData(item.CustomerSN);
  1247. }
  1248. }));
  1249. return saBtn;
  1250. },
  1251. deleteButton: false,
  1252. editButton: false
  1253. },
  1254. {
  1255. name: "CreateUserName", title: 'common.CreateUser', width: 150,align: "center"
  1256. }
  1257. ],
  1258. controller: {
  1259. loadData: function (args) {
  1260. return fnGetGridData5();
  1261. },
  1262. insertItem: function (args) {
  1263. },
  1264. updateItem: function (args) {
  1265. },
  1266. deleteItem: function (args) {
  1267. }
  1268. },
  1269. onInit: function (args) {
  1270. oGrid5= args.grid;
  1271. }
  1272. });
  1273. $('#UniCode').on('blur', function () {
  1274. this.value = $.trim(this.value);
  1275. });
  1276. $('#CustomerEName,#CustomerShotCName,#Address,#InvoiceAddress').on('blur', function () {
  1277. this.value = this.value.toUpperCase();
  1278. });
  1279. $('#APIImport').on('click', function () {
  1280. var sUniCode = $('#UniCode').val(),
  1281. sCustomerCName = $('#CustomerCName').val();
  1282. if (!sUniCode && !sCustomerCName) {
  1283. showMsg(i18next.t('message.UniCodeOrCustomerCName_Required')); // ╠message.UniCodeOrCustomerCName_Required⇒請輸入客戶統編或者客戶全稱╣
  1284. return false;
  1285. }
  1286. if (sUniCode && sUniCode.length !== 8) {
  1287. showMsg(i18next.t('message.UniCodeInvalid')); // ╠message.UniCodeInvalid⇒統編號碼不合法╣
  1288. return false;
  1289. }
  1290. g_api.ConnectLite(pargs.ProgramId, 'GetCrmBaseDataByUniCode', {
  1291. UniCode: sUniCode,
  1292. KeyWords: sCustomerCName
  1293. }, function (res) {
  1294. if (res.RESULT) {
  1295. var oBase = res.DATA.rel,
  1296. oFirst = {};
  1297. if (oBase) {
  1298. var saBase = $.parseJSON(oBase);
  1299. if ($.isArray(saBase)) {
  1300. oFirst = saBase[0];
  1301. if (!$.isEmptyObject(oFirst)) {
  1302. $('#UniCode').val(oFirst.Business_Accounting_NO);
  1303. $('#CustomerCName').val(oFirst.Company_Name);
  1304. $('#Address').val(oFirst.Company_Location);
  1305. $('#InvoiceAddress').val(oFirst.Company_Location);
  1306. }
  1307. }
  1308. }
  1309. }
  1310. else {
  1311. showMsg(i18next.t('message.NotFindData') + '<br>' + res.MSG, 'error'); // ╠message.NotFindData⇒查不到對應的資料╣
  1312. }
  1313. }, function () {
  1314. showMsg(i18next.t('message.NotFindData'), 'error');
  1315. });
  1316. });
  1317. $("[name='IsBlackList']").on('change', function () {
  1318. if($("[name='IsBlackList']:checked").val() == "Y"){
  1319. $("#BlackListReason" ).attr('disabled', false);
  1320. } else {
  1321. $("#BlackListReason").val("");
  1322. $("#BlackListReason" ).attr('disabled', true);
  1323. }
  1324. });
  1325. $('#InsertContactor').on('click', function () {
  1326. fnCreateContactor();
  1327. });
  1328. $('#InsertExhibitionList').on('click', function () {
  1329. fnInsertExhibitionList();
  1330. });
  1331. $('#InsertComplaint').click(function () {
  1332. parent.openPageTab('Complaint_Upd', '?Action=Add&CustomerId=' + canDo.ids.guid);
  1333. return false;
  1334. });
  1335. }
  1336. }),
  1337. /**
  1338. * 設定國家下拉選單
  1339. */
  1340. setStateDrop = function () {
  1341. return g_api.ConnectLite(Service.com, ComFn.GetArguments, {
  1342. OrgID: 'TE',
  1343. ArgClassID: 'Area',
  1344. LevelOfArgument: 1
  1345. }, function (res) {
  1346. if (res.RESULT) {
  1347. let saState = res.DATA.rel;
  1348. if (saState.length > 0) {
  1349. $('#State').append(createOptions(saState, 'id', 'text', true)).select2();
  1350. }
  1351. }
  1352. });
  1353. },
  1354. /**
  1355. * 客戶轉為正式資料后回寫動作
  1356. * @param {String} preid 轉正前的客戶id
  1357. * @param {String} afterid 轉正后的客戶id
  1358. */
  1359. fnReEditCustomer = function (previd, afterid) {
  1360. return g_api.ConnectLite('Exhibition_Upd', 'UpdateCustomerTag', {//匯入費用項目
  1361. PrevId: previd,
  1362. AfterId: afterid
  1363. }, function (res) { });
  1364. },
  1365. /**
  1366. * 綁定模版參數
  1367. */
  1368. fnBindContactors = function () {
  1369. var sKeysHtml = '';
  1370. $.each(canDo.data.Contactors, function (idx, item) {
  1371. sKeysHtml += '<tr data-id="' + item.guid + '">\
  1372. <td class="wcenter">' + (idx + 1) + '</td>\
  1373. <td><input type="text" data-input="FullName" class="form-control w100p" value="' + item.FullName + '"></td>\
  1374. <td><input type="text" data-input="JobtitleName" class="form-control w100p" value="' + (item.JobtitleName || '') + '"></td>\
  1375. <td><input type="text" data-input="TEL1" class="form-control w100p" value="' + item.TEL1 + '" placeholderid="Customers_Upd.Instruction_ContactorTEL" placeholder="含分機"></td>\
  1376. <td><input type="text" data-input="TEL2" class="form-control w100p" value="' + item.TEL2 + '" placeholderid="Customers_Upd.Instruction_ContactorTEL" placeholder="含分機"></td>\
  1377. <td><input type="text" data-input="FAX" class="form-control w100p" value="' + item.FAX + '"></td>\
  1378. <td><input type="text" data-input="Email" class="form-control w100p" value="' + item.Email + '"></td>\
  1379. <td><input type="text" data-input="Memo" class="form-control w100p" value="' + item.Memo + '"></td>\
  1380. <td><input type="number" data-input="RowID" class="form-control w100p" data-OriValue="' + (idx + 1) + '" value="' + (idx + 1) + '"></td>\
  1381. <td class="wcenter">\
  1382. <i class="glyphicon glyphicon-trash" data-value="' + item.guid + '" title="刪除"></i>\
  1383. </td>\
  1384. </tr>';
  1385. });
  1386. $('#table_box').html(sKeysHtml).find('.glyphicon-trash').on('click', function () {
  1387. var sId = $(this).attr('data-value'),
  1388. saNewList = [];
  1389. //若失敗後,資料已經變成字串了。需要再次轉回陣列,才能刪除
  1390. if (typeof canDo.data.Contactors === 'string') {
  1391. canDo.data.Contactors = JSON.parse(canDo.data.Contactors || '[]');
  1392. }
  1393. $.each(canDo.data.Contactors, function (idx, item) {
  1394. if (sId !== item.guid) {
  1395. saNewList.push(item);
  1396. }
  1397. });
  1398. $(this).parents('tr').remove();
  1399. canDo.data.Contactors = saNewList;
  1400. });
  1401. canDo._transLang($('#table_box'));
  1402. $('#table_box [data-input]').on('change click', function () {
  1403. var sKey = $(this).attr('data-input'),
  1404. sId = $(this).parents('tr').attr('data-id'),
  1405. sVal = this.value;
  1406. if (sKey === "RowID") {
  1407. let OriValue = $(this).attr('data-OriValue');
  1408. let FromIndex = Number(OriValue) - 1;
  1409. let ToIndex = Number(sVal) - 1;
  1410. let TempTarget = canDo.data.Contactors[ToIndex];
  1411. let TempOrigin = canDo.data.Contactors[FromIndex];
  1412. canDo.data.Contactors.splice(FromIndex, 1);
  1413. canDo.data.Contactors.splice(ToIndex, 0,TempOrigin);
  1414. fnBindContactors();
  1415. }
  1416. else {
  1417. $.each(canDo.data.Contactors, function (idx, item) {
  1418. if (sId === item.guid) {
  1419. item[sKey] = sVal;
  1420. return false;
  1421. }
  1422. });
  1423. }
  1424. });
  1425. },
  1426. /**
  1427. * 設定交易型態下拉選單
  1428. * @param {String} type 公司類別
  1429. * @param {String} egname 英文名稱
  1430. * @param {String} cnname 中文名稱
  1431. */
  1432. getCustomerFirstChart = function (type, egname, cnname) {
  1433. var sFirstChart = '';
  1434. if (type === 'E') {
  1435. if (egname) {
  1436. if (egname.indexOf('.') > -1) {
  1437. if (egname.split('.')[1]) {
  1438. sFirstChart = egname.split('.')[1].substr(0, 1);
  1439. }
  1440. else {
  1441. sFirstChart = egname.split('.')[0].substr(0, 1);
  1442. }
  1443. }
  1444. else {
  1445. sFirstChart = egname.substr(0, 1);
  1446. }
  1447. }
  1448. else {
  1449. sFirstChart = cnname.substr(0, 1);
  1450. }
  1451. }
  1452. else {
  1453. if (egname) {
  1454. sFirstChart = egname.substr(0, 1);
  1455. }
  1456. else {
  1457. sFirstChart = cnname.substr(0, 1);
  1458. }
  1459. }
  1460. sFirstChart = makePy(sFirstChart[0]);
  1461. return sFirstChart[0].toUpperCase();
  1462. },
  1463. /**
  1464. * 依據預約單號查詢匯入廠商并預設
  1465. */
  1466. fnGetImportCustomersByAppointNO = function () {
  1467. g_api.ConnectLite(canDo.ProgramId, 'GetImportCustomersByAppointNO', {
  1468. AppointNO: canDo.params.FromId
  1469. }, function (res) {
  1470. if (res.RESULT) {
  1471. var oRes = res.DATA.rel;
  1472. if (oRes) {
  1473. $('#CustomerCName').val(oRes.CustomerCName);
  1474. $('#Telephone').val(oRes.Telephone);
  1475. $('#Email').val(oRes.Email);
  1476. $('#Address').val(oRes.Address);
  1477. $('#InvoiceAddress').val(oRes.InvoiceAddress);
  1478. $('body').attr('PopId', oRes.guid);
  1479. setTimeout(function () {
  1480. $('.plustemplkey ').trigger('click');
  1481. var _input = $('#table_box').find(':input');
  1482. _input.eq(0).val(oRes.Contactor);
  1483. _input.eq(2).val(oRes.Telephone);
  1484. _input.eq(5).val(oRes.Email);
  1485. setTimeout(function () {
  1486. _input.eq(0).trigger('click');
  1487. _input.eq(2).trigger('click');
  1488. _input.eq(5).trigger('click');
  1489. }, 500);
  1490. }, 1000);
  1491. }
  1492. }
  1493. });
  1494. },
  1495. /**
  1496. * 抓去參加展覽已成交列表資料
  1497. * @return {Object} ajax物件
  1498. */
  1499. fnGetGridData = function () {
  1500. if (canDo.ids.guid) {
  1501. return g_api.ConnectLite(canDo.ProgramId, 'GetDealExhibitionlist', {
  1502. guid: canDo.ids.guid
  1503. });
  1504. }
  1505. else {
  1506. return $.Deferred().resolve().promise();
  1507. }
  1508. },
  1509. /**
  1510. * 抓去參加展覽未成交列表資料
  1511. * @return {Object} ajax物件
  1512. */
  1513. fnGetGridData1 = function () {
  1514. if (canDo.ids.guid) {
  1515. return g_api.ConnectLite(canDo.ProgramId, 'GetUnDealExhibitionlist', {
  1516. guid: canDo.ids.guid
  1517. });
  1518. }
  1519. else {
  1520. return $.Deferred().resolve().promise();
  1521. }
  1522. },
  1523. /**
  1524. * 抓去聯絡人列表資料
  1525. * @return {Object} ajax物件
  1526. */
  1527. fnGetGridData2 = function (args) {
  1528. if (canDo.ids.guid) {
  1529. return g_api.ConnectLite(canDo.ProgramId, 'GetContactorlist', {
  1530. Guid: canDo.ids.guid,
  1531. sortField: args.sortField,
  1532. sortOrder: args.sortOrder
  1533. });
  1534. }
  1535. else {
  1536. return $.Deferred().resolve().promise();
  1537. }
  1538. },
  1539. /**
  1540. * 抓去Callout記錄列表資料
  1541. * @return {Object} ajax物件
  1542. */
  1543. fnGetGridData3 = function () {
  1544. if (canDo.ids.guid) {
  1545. return g_api.ConnectLite(canDo.ProgramId, 'GetCalloutlist', {
  1546. guid: canDo.ids.guid
  1547. });
  1548. }
  1549. else {
  1550. return $.Deferred().resolve().promise();
  1551. }
  1552. },
  1553. /**
  1554. * 抓去客訴列表資料
  1555. * @return {Object} ajax物件
  1556. */
  1557. fnGetGridData4 = function () {
  1558. if (canDo.ids.guid) {
  1559. return g_api.ConnectLite(canDo.ProgramId, 'GetComplaintlist', {
  1560. guid: canDo.ids.guid
  1561. });
  1562. }
  1563. else {
  1564. return $.Deferred().resolve().promise();
  1565. }
  1566. },
  1567. /**
  1568. * 抓去滿意度列表資料
  1569. * @return {Object} ajax物件
  1570. */
  1571. fnGetGridData5 = function () {
  1572. if (canDo.ids.guid) {
  1573. return g_api.ConnectLite(canDo.ProgramId, 'GetSatisfactionCaselist', {
  1574. guid: canDo.ids.guid
  1575. });
  1576. }
  1577. else {
  1578. return $.Deferred().resolve().promise();
  1579. }
  1580. },
  1581. /**
  1582. * 新增聯絡人
  1583. */
  1584. fnCreateContactor = function () {
  1585. layer.open({
  1586. type: 2, //0(信息框,默认)1(页面层)2(iframe层)3(加载层)4(tips层)
  1587. title: i18next.t('common.InsertContactor'),// ╠common.CustomerTransferToFormal⇒匯入廠商轉正╣
  1588. area: ['70%', '90%'],//寬度
  1589. shade: 0.75,//遮罩
  1590. maxmin: true, //开启最大化最小化按钮
  1591. id: 'layer_InsertContactor', //设定一个id,防止重复弹出
  1592. anim: 0,//彈出動畫
  1593. btnAlign: 'c',//按鈕位置
  1594. content: '../Crm/Contactors_Upd.html?Action=Add&Flag=Pop&CustomerId=' + canDo.ids.guid,
  1595. success: function (layero, index) {
  1596. var iframe = layero.find('iframe').contents();
  1597. iframe.find('#hiddenIndex').val(index);
  1598. },
  1599. end: function () {
  1600. oGrid2.loadData();
  1601. }
  1602. });
  1603. },
  1604. /**
  1605. * 編輯聯絡人
  1606. */
  1607. fnEditContactor = function (_guid) {
  1608. layer.open({
  1609. type: 2, //0(信息框,默认)1(页面层)2(iframe层)3(加载层)4(tips层)
  1610. title: i18next.t('common.InsertContactor'),// ╠common.CustomerTransferToFormal⇒匯入廠商轉正╣
  1611. area: ['70%', '90%'],//寬度
  1612. shade: 0.75,//遮罩
  1613. maxmin: true, //开启最大化最小化按钮
  1614. id: 'layer_InsertContactor', //设定一个id,防止重复弹出
  1615. anim: 0,//彈出動畫
  1616. btnAlign: 'c',//按鈕位置
  1617. content: '../Crm/Contactors_Upd.html?Action=Upd&Flag=Pop&guid=' + _guid,
  1618. success: function (layero, index) {
  1619. var iframe = layero.find('iframe').contents();
  1620. iframe.find('#hiddenIndex').val(index);
  1621. },
  1622. end: function () {
  1623. oGrid2.loadData();
  1624. }
  1625. });
  1626. },
  1627. /**
  1628. * 新增至展覽名單
  1629. */
  1630. fnInsertExhibitionList = function () {
  1631. layer.open({
  1632. type: 1, //0(信息框,默认)1(页面层)2(iframe层)3(加载层)4(tips层)
  1633. title: '新增至展覽名單', // ╠common.CorrespondImpCus⇒對應正式客戶╣
  1634. area: ['60%', '90%'],//寬度
  1635. shade: 0.75,//遮罩
  1636. closeBtn: 1,
  1637. //maxmin: true, //开启最大化最小化按钮
  1638. id: 'layer_InsertExhibitionList', //设定一个id,防止重复弹出
  1639. offset: '10px',//右下角弹出
  1640. anim: 0,//彈出動畫
  1641. btn: [i18next.t('common.Confirm'), i18next.t('common.Cancel')],//╠common.Confirm⇒確定╣╠common.Cancel⇒取消╣
  1642. btnAlign: 'c',//按鈕位置
  1643. content: '<style>.select2-container{z-index: 39891015;}</style>\
  1644. <div class="pop-box row w100p">\
  1645. <label class="col-sm-2 col-sm-offset-2 control-label" for="input-Default">\
  1646. <span>請選擇展覽</span><span></span>\
  1647. </label>\
  1648. <div class="col-sm-5">\
  1649. <select class= "form-control w95p" id="ExhibitionCode" name="ExhibitionCode"></select>\
  1650. </div>\
  1651. </div >\
  1652. <hr>\
  1653. <div class="col-sm-10 col-sm-offset-1">\
  1654. <div id="jsGridChooseContactors"></div>\
  1655. </div>',
  1656. success: function (layero, index) {
  1657. saContactorList = [];
  1658. fnSetEpoDrop({
  1659. Select: $('#ExhibitionCode'),
  1660. Select2: true
  1661. });
  1662. $("#jsGridChooseContactors").jsGrid({
  1663. width: "100%",
  1664. height: "auto",
  1665. autoload: true,
  1666. filtering: false,
  1667. pageLoading: true,
  1668. inserting: false,
  1669. editing: false,
  1670. sorting: false,
  1671. paging: false,
  1672. pageIndex: 1,
  1673. pageSize: parent.SysSet.GridRecords || 10,
  1674. confirmDeleting: true,
  1675. //deleteConfirm: i18next.t('message.ConfirmToDelete'),// ╠message.ConfirmToDelete⇒確定要刪除嗎 ?╣
  1676. pagePrevText: "<",
  1677. pageNextText: ">",
  1678. pageFirstText: "<<",
  1679. pageLastText: ">>",
  1680. fields: [
  1681. {
  1682. name: "RowIndex", title: 'common.RowNumber', width: 5, align: "center",
  1683. itemTemplate: function (value, item) {
  1684. return $("<input>", {
  1685. type: 'checkbox', click: function (e) {
  1686. e.stopPropagation();
  1687. if (this.checked) {
  1688. item.RowIndex = saContactorList.length + 1;
  1689. saContactorList.push(item);
  1690. }
  1691. else {
  1692. var saNewList2 = [];
  1693. $.each(saContactorList, function (idx, data) {
  1694. let i = 0;
  1695. if (item.guid !== data.guid) {
  1696. data.RowIndex = i++;
  1697. saNewList2.push(data);
  1698. }
  1699. });
  1700. saContactorList = saNewList2;
  1701. }
  1702. }
  1703. });
  1704. }
  1705. },
  1706. {
  1707. name: "ContactorName", title: 'common.Contactor', width: 25, align: "center"
  1708. },
  1709. {
  1710. name: "Telephone1", title: 'common.Telephone', width: 30
  1711. },
  1712. {
  1713. name: "Ext1", title: 'common.EXT', width: 15
  1714. },
  1715. {
  1716. name: "Email1", title: 'common.Email', width: 40
  1717. }
  1718. ],
  1719. controller: {
  1720. loadData: function (args) {
  1721. return g_api.ConnectLite('Contactors_Qry', 'QueryByCustomer', {
  1722. CustomerId: canDo.ids.guid
  1723. });
  1724. },
  1725. insertItem: function (args) {
  1726. },
  1727. updateItem: function (args) {
  1728. },
  1729. deleteItem: function (args) {
  1730. }
  1731. }
  1732. });
  1733. },
  1734. yes: function (index, layero) {
  1735. g_api.ConnectLite(sProgramId, 'InsertExhibitionList', {
  1736. ExhibitionNO:$("#ExhibitionCode").val(),
  1737. CustomerId: canDo.ids.guid,
  1738. Contactors:saContactorList
  1739. }, function (res) {
  1740. if (res.RESULT) {
  1741. oGrid.loadData();
  1742. oGrid1.loadData();
  1743. showMsg(i18next.t("message.Save_Success"), 'success'); // ╠message.Save_Success⇒新增成功╣
  1744. layer.close(index);
  1745. }
  1746. else {
  1747. showMsg(res.MSG, 'error');
  1748. }
  1749. }, function () {
  1750. showMsg(i18next.t("message.Save_Failed"), 'error'); // ╠message.Save_Failed⇒新增失敗╣
  1751. });
  1752. }
  1753. });
  1754. },
  1755. fnGetSatisfactionCaseData = function (_SN) {
  1756. return g_api.ConnectLite('SatisfactionCase_Upd', 'GetSatisfactionCaseData', {
  1757. SN: _SN,
  1758. }, function (res) {
  1759. var oRes = res.DATA.rel;
  1760. layer.open({
  1761. type: 1, //0(信息框,默认)1(页面层)2(iframe层)3(加载层)4(tips层)
  1762. title: "滿意度問卷", // ╠common.CorrespondImpCus⇒對應正式客戶╣
  1763. area: ['40%', '90%'],//寬度
  1764. shade: 0.75,//遮罩
  1765. closeBtn: 1,
  1766. //maxmin: true, //开启最大化最小化按钮
  1767. id: 'layer_SatisfactionCaseData', //设定一个id,防止重复弹出
  1768. offset: '10px',//右下角弹出
  1769. anim: 0,//彈出動畫
  1770. //btn: [i18next.t('common.Confirm'), i18next.t('common.Cancel')],//╠common.Confirm⇒確定╣╠common.Cancel⇒取消╣
  1771. //btnAlign: 'c',//按鈕位置
  1772. content: '<div class="pop-box row w100p">\
  1773. <label class="col-sm-3 control-label" for="input-Default">\
  1774. <span data-i18n="">客戶名稱</span><span></span>\
  1775. </label>\
  1776. <div class="col-sm-8">\
  1777. <input type="text" maxlength="50" id="CustomerName" name="CustomerName" class="form-control w100p" placeholderid="" value="' + oRes.CustomerName + '" disabled>\
  1778. </div>\
  1779. </div>\
  1780. <div class="pop-box row w100p">\
  1781. <label class="col-sm-3 control-label" for="input-Default">\
  1782. <span data-i18n="">填寫人</span><span></span>\
  1783. </label>\
  1784. <div class="col-sm-8">\
  1785. <input type="text" maxlength="50" id="FillerName" name="FillerName" class="form-control w100p" placeholderid="" value="' + oRes.FillerName + '" disabled>\
  1786. </div>\
  1787. </div>\
  1788. <div class="pop-box row w100p">\
  1789. <label class="col-sm-3 control-label" for="input-Default">\
  1790. <span data-i18n="">填寫人電子郵件</span><span></span>\
  1791. </label>\
  1792. <div class="col-sm-8">\
  1793. <input type="text" maxlength="50" id="Email" name="Email" class="form-control w100p" placeholderid="" value="' + oRes.Email + '" disabled>\
  1794. </div>\
  1795. </div>\
  1796. <div class="pop-box row w100p">\
  1797. <label class="col-sm-3 control-label" for="input-Default">\
  1798. <span data-i18n="">填寫人聯絡電話</span><span></span>\
  1799. </label>\
  1800. <div class="col-sm-8">\
  1801. <input type="text" maxlength="50" id="Phone" name="Phone" class="form-control w100p" placeholderid="" value="' + oRes.Phone + '" disabled>\
  1802. </div>\
  1803. </div>\
  1804. <div class="pop-box row w100p">\
  1805. <label class="col-sm-3 control-label" for="input-Default">\
  1806. <span data-i18n="">備註</span><span></span>\
  1807. </label>\
  1808. <div class="col-sm-8">\
  1809. <textarea name="Memo" id="Memo" class="form-control" rows="3" disabled>' + oRes.Memo + '</textarea>\
  1810. </div>\
  1811. </div>\<hr>\
  1812. <div>\
  1813. <table class="w80p text-left" style="border:1px #cccccc solid;margin-Left:10%;font-size:14px"><thead></thead>\
  1814. <tbody>\
  1815. <tr>\
  1816. <td class="col-sm-7" style="border:1px #cccccc solid;">奕達提供整體服務品質的滿意度</td>\
  1817. <td class="col-sm-5" style="border:1px #cccccc solid;"><div id="Feild01">' + oRes.Feild01 + '</div></td>\
  1818. </tr>\
  1819. <tr>\
  1820. <td class="col-sm-7" style="border:1px #cccccc solid;">奕達提供的價格是否合理</td>\
  1821. <td class="col-sm-5" style="border:1px #cccccc solid;"><div id="Feild02">' + oRes.Feild02 + '</div></td>\
  1822. </tr>\
  1823. <tr>\
  1824. <td class="col-sm-7" style="border:1px #cccccc solid;">展品送達時間是否滿意</td>\
  1825. <td class="col-sm-5" style="border:1px #cccccc solid;"><div id="Feild03">' + oRes.Feild03 + '</div></td>\
  1826. </tr>\
  1827. <tr>\
  1828. <td class="col-sm-7" style="border:1px #cccccc solid;">現場人員的專業技能與服務態度是否滿意</td>\
  1829. <td class="col-sm-5" style="border:1px #cccccc solid;"><div id="Feild04">' + oRes.Feild04 + '</div></td>\
  1830. </tr>\
  1831. <tr>\
  1832. <td class="col-sm-7" style="border:1px #cccccc solid;">承辦同仁的配合度及服務態度是否滿意</td>\
  1833. <td class="col-sm-5" style="border:1px #cccccc solid;"><div id="Feild05">' + oRes.Feild05 + '</div></td>\
  1834. </tr>\
  1835. <tr>\
  1836. <td class="col-sm-7" style="border:1px #cccccc solid;">貨況線上查詢系統是否滿意</td>\
  1837. <td class="col-sm-5" style="border:1px #cccccc solid;"><div id="Feild06">' + oRes.Feild06 + '</div></td>\
  1838. </tr>\
  1839. <tr>\
  1840. <td class="col-sm-7" style="border:1px #cccccc solid;">為何選擇奕達</td>\
  1841. <td class="col-sm-5" style="border:1px #cccccc solid;"><div id="Feild07">' + oRes.Feild07 + '</div></td>\
  1842. </tr>\
  1843. <tr>\
  1844. <td class="col-sm-7" style="border:1px #cccccc solid;">貴公司年度平均參與海外展會活動次數</td>\
  1845. <td class="col-sm-5" style="border:1px #cccccc solid;"><div id="Feild08">' + oRes.Feild08 + '</div></td>\
  1846. </tr>\
  1847. <tr>\
  1848. <td class="col-sm-7" style="border:1px #cccccc solid;">您是否會推薦奕達給合作夥伴</td>\
  1849. <td class="col-sm-5" style="border:1px #cccccc solid;"><div id="Feild9">' + oRes.Feild09 + '</div></td>\
  1850. </tr>\
  1851. <tr>\
  1852. <td class="col-sm-7" style="border:1px #cccccc solid;">其他建議</td>\
  1853. <td class="col-sm-5" style="border:1px #cccccc solid;"><div id="Feild10">' + oRes.Feild10 + '</div></td>\
  1854. </tr>\
  1855. </tbody>\
  1856. </table>\
  1857. </div><div class="pop-box row w100p"></div>',
  1858. success: function (layero, index) {
  1859. },
  1860. yes: function (index, layero) {
  1861. }
  1862. });
  1863. });
  1864. };
  1865. };
  1866. require(['base', 'select2', 'jsgrid', 'cando'], fnPageInit);