function iniPage() { dynamicLoadJs('/public/jspdf/Arial Narrow-normal.js'); dynamicLoadJs('/public/jspdf/Arial Narrow-bold.js'); dynamicLoadJs('/public/jspdf/Arial Narrow-italic.js'); dynamicLoadJs('/public/jspdf/Arial Narrow-bolditalic.js'); rptTplObj.isLoading = true; dynamicLoadJs('https://d2.smartcost.com.cn/cach/SmartSimsun-normal2.js', 'normal', getPdfFontCallbackLight); dynamicLoadJs('https://d2.smartcost.com.cn/cach/SmartSimsun-bold.js', 'bold', getPdfFontCallbackLight); } function getPdfFontCallbackLight(fontProperty) { rptTplObj.pdfFont['SmartSimsun'].push(fontProperty); if (rptTplObj.pdfFont['SmartSimsun'].length === 2) { rptTplObj.isLoading = false; } } function getPdfFontCallback(fontProperty) { if (rptTplObj.pdfFont['SmartSimsun'].length === 2) { downloadPDFReport([tesRpttData], 'A4', ['测试审核表'], [], [], [-1], []); } } $(function () { autoFlashHeight(); auditRptPrintHelper.showPage(); iniPage(); $('#rpt-form input').on('change', function () { const newVal = $(this).val(); const index = parseInt($(this).data('index')); checkAndUpdate(index, newVal, $(this)); }); $('#rpt-form textarea').on('change', function () { const newVal = $(this).val(); const index = parseInt($(this).data('index')); checkAndUpdate(index, newVal, $(this)); }); $('#chose-private-stamp-path .stamp-img').on('click', function () { if (!$(this).hasClass('card-gk-active')) { $('#chose-private-stamp-path .stamp-img').removeClass('card-gk-active'); $('#chose-private-stamp-path .stamp-img').find('.sel-width').removeClass('sel-blue'); $(this).addClass('card-gk-active'); $(this).find('.sel-width').addClass('sel-blue'); } }); $('#chose-private-stamp-path').on('show.bs.modal', function () { $('#chose-private-stamp-path .stamp-img').removeClass('card-gk-active'); $('#chose-private-stamp-path .stamp-img').find('.sel-width').removeClass('sel-blue'); $('#chose-private-stamp-path .stamp-img').each(function () { const src = $(this).find('img').attr('data-src'); if (src === currentStamp) { $(this).addClass('card-gk-active'); $(this).find('.sel-width').addClass('sel-blue'); return; } }); }); $('#select_stamp_path_btn').click(function () { const src = $('#chose-private-stamp-path .card-gk-active').find('img').attr('data-src'); currentStamp = src; $('#stamp_path').val(src); $('#chose-private-stamp-path').modal('hide'); }); let signatureDate = null; $('#sub-sp5').on('show.bs.modal', function () { $('#sign_path').prop('checked', rptAudit.signature_msg.sign_path !== null); $('#company_stamp').prop('checked', rptAudit.signature_msg.company_stamp !== null); $('#stamp_path').prop('checked', rptAudit.signature_msg.stamp_path !== null); $('#signature_date').val(rptAudit.signature_msg.date ? rptAudit.signature_msg.date : ''); signatureDate = !signatureDate ? $('#signature_date').datepicker().data('datepicker') : signatureDate; if (signatureDate && rptAudit.signature_msg.date) { signatureDate.selectDate(new Date(rptAudit.signature_msg.date)); } else if (signatureDate) { signatureDate.clear(); } $('#signature_content').val(rptAudit.signature_msg.content ? rptAudit.signature_msg.content : ''); }); $('#commit_sign').click(function () { rptAudit.signature_msg.sign_path = $('#sign_path').is(':checked') ? $('#sign_path').val() : null; rptAudit.signature_msg.company_stamp = $('#company_stamp').is(':checked') ? $('#company_stamp').val() : null; rptAudit.signature_msg.stamp_path = $('#stamp_path').is(':checked') ? $('#stamp_path').val() : null; rptAudit.signature_msg.date = $('#signature_date').val() ? $('#signature_date').val() : null; rptAudit.signature_msg.content = $('#signature_content').val() ? $('#signature_content').val() : null; console.log(rptAudit.signature_msg); // 签章 if (rptAudit.signature_msg.sign_path !== null || rptAudit.signature_msg.company_stamp !== null || rptAudit.signature_msg.stamp_path !== null) { const signArray = []; if (rptAudit.signature_msg.sign_path) signArray.push('/public/upload/sign/' + rptAudit.signature_msg.sign_path); if (rptAudit.signature_msg.company_stamp) signArray.push(rptAudit.signature_msg.company_stamp); if (rptAudit.signature_msg.stamp_path) signArray.push(rptAudit.signature_msg.stamp_path); tesRpttData.items[0].signature_cells[rptAudit.signature_index].path = signArray.length > 0 ? signArray.join('!;!') : null; const date_index = _.findIndex(tesRpttData.items[0].signature_date_cells, { signature_name: rptAudit.signature_name + '_签字日期' }); if (date_index !== -1) { tesRpttData.items[0].signature_date_cells[date_index].Value = rptAudit.signature_msg.date ? rptAudit.signature_msg.date : ''; } const content_index = _.findIndex(tesRpttData.items[0].signature_audit_cells, { signature_name: rptAudit.signature_name + '_审核意见' }); if (content_index !== -1) { tesRpttData.items[0].signature_audit_cells[content_index].Value = rptAudit.signature_msg.content ? rptAudit.signature_msg.content : ''; } postData('/payment/' + tenderId + '/detail/' + detailId + '/save', { type: 'update_sign', signature_msg: rptAudit.signature_msg }, function (result) { auditRptPrintHelper.showPage(); }); $('#sub-sp5').modal('hide'); } else { toastr.error('至少选择一个签字/签章'); } }); let timer = null function checkAndUpdate(index, newVal, _self) { console.log(index, newVal); clearTimeout(timer); timer = setTimeout(() => { tesRpttData.items[0].interact_cells[index].Value = tesRpttData.items[0].interact_cells[index].Prefix ? tesRpttData.items[0].interact_cells[index].Prefix + newVal : newVal; postData('/payment/' + tenderId + '/detail/' + detailId + '/save', { type: 'update_rpt', report_json: tesRpttData }, function (result) { auditRptPrintHelper.showPage(); }); clearTimeout(timer); }, 500); } });