payment_detail.js 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. function iniPage() {
  2. dynamicLoadJs('/public/jspdf/Arial Narrow-normal.js');
  3. dynamicLoadJs('/public/jspdf/Arial Narrow-bold.js');
  4. dynamicLoadJs('/public/jspdf/Arial Narrow-italic.js');
  5. dynamicLoadJs('/public/jspdf/Arial Narrow-bolditalic.js');
  6. rptTplObj.isLoading = true;
  7. dynamicLoadJs('https://d2.smartcost.com.cn/cach/SmartSimsun-normal2.js', 'normal', getPdfFontCallbackLight);
  8. dynamicLoadJs('https://d2.smartcost.com.cn/cach/SmartSimsun-bold.js', 'bold', getPdfFontCallbackLight);
  9. }
  10. function getPdfFontCallbackLight(fontProperty) {
  11. rptTplObj.pdfFont['SmartSimsun'].push(fontProperty);
  12. if (rptTplObj.pdfFont['SmartSimsun'].length === 2) {
  13. rptTplObj.isLoading = false;
  14. }
  15. }
  16. function getPdfFontCallback(fontProperty) {
  17. if (rptTplObj.pdfFont['SmartSimsun'].length === 2) {
  18. downloadPDFReport([tesRpttData], 'A4', ['测试审核表'], [], [], [-1], []);
  19. }
  20. }
  21. $(function () {
  22. autoFlashHeight();
  23. auditRptPrintHelper.showPage();
  24. iniPage();
  25. $('#rpt-form input').on('change', function () {
  26. const newVal = $(this).val();
  27. const index = parseInt($(this).data('index'));
  28. checkAndUpdate(index, newVal, $(this));
  29. });
  30. $('#rpt-form textarea').on('change', function () {
  31. const newVal = $(this).val();
  32. const index = parseInt($(this).data('index'));
  33. checkAndUpdate(index, newVal, $(this));
  34. });
  35. $('#chose-private-stamp-path .stamp-img').on('click', function () {
  36. if (!$(this).hasClass('card-gk-active')) {
  37. $('#chose-private-stamp-path .stamp-img').removeClass('card-gk-active');
  38. $('#chose-private-stamp-path .stamp-img').find('.sel-width').removeClass('sel-blue');
  39. $(this).addClass('card-gk-active');
  40. $(this).find('.sel-width').addClass('sel-blue');
  41. }
  42. });
  43. $('#chose-private-stamp-path').on('show.bs.modal', function () {
  44. $('#chose-private-stamp-path .stamp-img').removeClass('card-gk-active');
  45. $('#chose-private-stamp-path .stamp-img').find('.sel-width').removeClass('sel-blue');
  46. $('#chose-private-stamp-path .stamp-img').each(function () {
  47. const src = $(this).find('img').attr('data-src');
  48. if (src === currentStamp) {
  49. $(this).addClass('card-gk-active');
  50. $(this).find('.sel-width').addClass('sel-blue');
  51. return;
  52. }
  53. });
  54. });
  55. $('#select_stamp_path_btn').click(function () {
  56. const src = $('#chose-private-stamp-path .card-gk-active').find('img').attr('data-src');
  57. currentStamp = src;
  58. $('#stamp_path').val(src);
  59. $('#chose-private-stamp-path').modal('hide');
  60. });
  61. let signatureDate = null;
  62. $('#sub-sp5').on('show.bs.modal', function () {
  63. $('#sign_path').prop('checked', rptAudit.signature_msg.sign_path !== null);
  64. $('#company_stamp').prop('checked', rptAudit.signature_msg.company_stamp !== null);
  65. $('#stamp_path').prop('checked', rptAudit.signature_msg.stamp_path !== null);
  66. $('#signature_date').val(rptAudit.signature_msg.date ? rptAudit.signature_msg.date : '');
  67. signatureDate = !signatureDate ? $('#signature_date').datepicker().data('datepicker') : signatureDate;
  68. if (rptAudit.signature_msg.date) {
  69. signatureDate.selectDate(new Date(rptAudit.signature_msg.date));
  70. } else {
  71. signatureDate.clear();
  72. }
  73. $('#signature_content').val(rptAudit.signature_msg.content ? rptAudit.signature_msg.content : '');
  74. });
  75. $('#commit_sign').click(function () {
  76. rptAudit.signature_msg.sign_path = $('#sign_path').is(':checked') ? $('#sign_path').val() : null;
  77. rptAudit.signature_msg.company_stamp = $('#company_stamp').is(':checked') ? $('#company_stamp').val() : null;
  78. rptAudit.signature_msg.stamp_path = $('#stamp_path').is(':checked') ? $('#stamp_path').val() : null;
  79. rptAudit.signature_msg.date = $('#signature_date').val() ? $('#signature_date').val() : null;
  80. rptAudit.signature_msg.content = $('#signature_content').val() ? $('#signature_content').val() : null;
  81. console.log(rptAudit.signature_msg);
  82. // 签章
  83. if (rptAudit.signature_msg.sign_path || rptAudit.signature_msg.company_stamp || rptAudit.signature_msg.stamp_path) {
  84. const signArray = [];
  85. if (rptAudit.signature_msg.sign_path) signArray.push(rptAudit.signature_msg.sign_path);
  86. if (rptAudit.signature_msg.company_stamp) signArray.push(rptAudit.signature_msg.company_stamp);
  87. if (rptAudit.signature_msg.stamp_path) signArray.push(rptAudit.signature_msg.stamp_path);
  88. if (signArray.length > 0) {
  89. tesRpttData.items[0].signature_cells[rptAudit.signature_index].path = signArray.length > 0 ? signArray.join('!;!') : null;
  90. const date_index = _.findIndex(tesRpttData.items[0].signature_date_cells, { signature_name: rptAudit.signature_name + '_签字日期' });
  91. if (date_index !== -1) {
  92. tesRpttData.items[0].signature_date_cells[date_index].Value = rptAudit.signature_msg.date ? rptAudit.signature_msg.date : '';
  93. }
  94. const content_index = _.findIndex(tesRpttData.items[0].signature_audit_cells, { signature_name: rptAudit.signature_name + '_审核意见' });
  95. if (content_index !== -1) {
  96. tesRpttData.items[0].signature_audit_cells[content_index].Value = rptAudit.signature_msg.content ? rptAudit.signature_msg.content : '';
  97. }
  98. postData('/payment/' + tenderId + '/detail/' + detailId + '/save', { type: 'update_sign', signature_msg: rptAudit.signature_msg }, function (result) {
  99. auditRptPrintHelper.showPage();
  100. iniPage();
  101. });
  102. }
  103. $('#sub-sp5').modal('hide');
  104. } else {
  105. toastr.error('至少选择一个签字/签章');
  106. }
  107. });
  108. let timer = null
  109. function checkAndUpdate(index, newVal, _self) {
  110. console.log(index, newVal);
  111. clearTimeout(timer);
  112. timer = setTimeout(() => {
  113. tesRpttData.items[0].interact_cells[index].Value = tesRpttData.items[0].interact_cells[index].Prefix ? tesRpttData.items[0].interact_cells[index].Prefix + newVal : newVal;
  114. postData('/payment/' + tenderId + '/detail/' + detailId + '/save', { type: 'update_rpt', report_json: tesRpttData }, function (result) {
  115. auditRptPrintHelper.showPage();
  116. iniPage();
  117. });
  118. clearTimeout(timer);
  119. }, 500);
  120. }
  121. });