| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059 | <% if (stg_id === -1) {%>    <% include ../tender/tender_sub_menu.ejs %><% } else if (stg_id === -100) { %>    <% include ../payment_safe/sub_menu.ejs %><% } else if (stg_id === -200) { %>    <% include ../budget/sub_menu.ejs %><% } else if ([-300, -301, -302, -303].includes(stg_id)) { %>    <% include ../tender/tender_sub_menu.ejs %><% } else { %>    <% include ../stage/stage_sub_menu.ejs %><% } %><div class="panel-content">    <div class="panel-title">        <div class="title-main d-flex">            <% if(stg_id === -1) { %>                <% include ../tender/tender_sub_mini_menu.ejs %>            <% } else if ([-100, -200, -300, -301, -302, -303].includes(stg_id)) { %>            <% } else { %>                <% include ../stage/stage_sub_mini_menu.ejs %>            <% } %>            <div>                <% if(stg_id === -1) { %>                <div class="d-inline-block">                    <div class="dropdown">                        <button class="btn btn-sm btn-light dropdown-toggle text-primary" type="button" id="allBizDropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">                            计量期                        </button>                        <div class="dropdown-menu" aria-labelledby="allBizDropdownMenuButton" id="biz-select-item">                            <a class="dropdown-item" href="javascript:void(0);" data-type="stage" style="display: none">计量期</a>                            <a class="dropdown-item" href="javascript:void(0);" data-type="change_prepay">预付款</a>                            <a class="dropdown-item" href="javascript:void(0);" data-type="change_material_adjustment">材料调差</a>                        </div>                    </div>                </div>                <div class="d-inline-block">                    <div class="dropdown" style="display: none" id="biz-prepay-item">                        <button class="btn btn-sm btn-light dropdown-toggle text-primary" type="button" id="allPrepayButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">                            开工预付款                        </button>                        <div class="dropdown-menu" aria-labelledby="allPrepayButton" id="prepay-select-item">                            <a class="dropdown-item" href="javascript:void(0);" data-type="tplType_prePay1" style="display: none">开工预付款</a>                            <a class="dropdown-item" href="javascript:void(0);" data-type="tplType_prePay2">材料预付款</a>                            <a class="dropdown-item" href="javascript:void(0);" data-type="tplType_prePay3">安全生产费预付款</a>                            <a class="dropdown-item" href="javascript:void(0);" data-type="tplType_prePay4">扬尘污染预付款</a>                        </div>                    </div>                </div>                <% } %>                <% if (false || ![-100, -200, -300, -301, -302, -303].includes(stg_id)) { %>                <div class="d-inline-block" id="divSelectableBizs_up">                    <div class="dropdown" id="divSelectableStages">                        <button class="btn btn-sm btn-light dropdown-toggle text-primary" type="button" id="btnCurrentStage" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"></button>                        <div class="dropdown-menu" aria-labelledby="dropdownMenuButton" id="optionSelectableStages"></div>                    </div>                    <div class="dropdown" id="divSelectableAdvancePays" style="display:none;">                        <button class="btn btn-sm btn-light dropdown-toggle text-primary" type="button" id="btnCurrentAdvancePay" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"></button>                        <div class="dropdown-menu" aria-labelledby="dropdownMenuButton" id="optionSelectableAdvancePays"></div>                    </div>                    <div class="dropdown" id="divSelectableMaterials" style="display:none;">                        <button class="btn btn-sm btn-light dropdown-toggle text-primary" type="button" id="btnCurrentMaterial" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"></button>                        <div class="dropdown-menu" aria-labelledby="dropdownMenuButton" id="optionSelectableMaterials"></div>                    </div>                </div>                <% } %>                <% if (stg_id === -200 || ![-100, -300, -301, -302, -303].includes(stg_id)) { %>                <div class="d-inline-block" id="report_selects_div">                    <ul class="nav nav-pills m-0" id="report_selects_ul">                        <% if (ctx.session.sessionUser.is_admin || ctx.session.sessionProject.page_show.isCommonSetup) { %>                        <li class="nav-item mr-1"><a href="#man-c" data-toggle="modal" data-target="#man-c" class=" btn btn-outline-primary btn-sm"><i class="fa fa-cog"></i> 推荐报表</a></li>                        <% } %>                        <% if (ctx.session.sessionUser.is_admin || ctx.session.sessionProject.page_show.isPrivateSetup) { %>                        <li class="nav-item"><a href="#man-i" data-toggle="modal" data-target="#man-i" class=" btn btn-outline-primary btn-sm"><i class="fa fa-plus"></i> 定制报表</a></li>                        <% } %>                        <!--                        -->                    </ul>                </div>                <% } %>                <% if ([-300, -301, -302, -303].includes(stg_id)) { %>                <!--                <div class="d-inline-block">                    <div class="dropdown">                        <button class="btn btn-sm btn-light dropdown-toggle text-primary" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">变更令</button>                        <div class="dropdown-menu" aria-labelledby="dropdownMenuButton" id="bglKeyVals"></div>                    </div>                </div>                -->                <div class="btn-group btn-group-toggle group-tab">                    <% if ([-300].includes(stg_id)) { %>                    <a class="btn btn-sm btn-light" href="/tender/<%- tender_id %>/change/<%- bizId %>/information">变更详情</a>                    <% } %>                    <% if ([-301].includes(stg_id)) { %>                    <a class="btn btn-sm btn-light" href="/tender/<%- tender_id %>/change/plan/<%- bizId %>/information">方案详情</a>                    <% } %>                    <% if ([-302].includes(stg_id)) { %>                    <a class="btn btn-sm btn-light" href="/tender/<%- tender_id %>/change/project/<%- bizId %>/information">立项详情</a>                    <% } %>                    <% if ([-303].includes(stg_id)) { %>                    <a class="btn btn-sm btn-light" href="/tender/<%- tender_id %>/change/apply/<%- bizId %>/information">申请详情</a>                    <% } %>                    <a class="btn btn-sm btn-light active" href="javascript:void(0);">输出报表</a>                    <% if (ctx.subProject.page_show.openChangePlan && [-300].includes(stg_id)) { %>                    <a class="btn btn-sm btn-light" href="/tender/<%- tender_id %>/change/<%- bizId %>/relation">关联数据</a>                    <% } %>                </div>                <% } %>                <% if (false || ![-100, -200, -300, -301, -302, -303].includes(stg_id)) { %>                <% if (ctx.session.sessionProject.page_show.isPreset) { %>                <div class="d-inline-block">                    <div class="dropdown" id="divPresets">                        <button class="btn btn-sm btn-light dropdown-toggle text-primary" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">报表数据预设</button>                        <div class="dropdown-menu" aria-labelledby="dropdownMenuButton">                            <a class="dropdown-item" href="javascript: void(0)" onclick="rptShowLevel.show('show_level');">显示层级</a>                            <a class="dropdown-item" href="javascript: void(0)" onclick="rptOtherStage.showOtherStage('advance');">预付款</a>                            <a class="dropdown-item" href="javascript: void(0)" onclick="rptChangeRela.showChangeRela('change_project');">变更立项</a>                            <a class="dropdown-item" href="javascript: void(0)" onclick="rptChangeRela.showChangeRela('change_apply');">变更申请</a>                            <a class="dropdown-item" href="javascript: void(0)" onclick="rptChangeRela.showChangeRela('change_plan');">变更方案</a>                            <a class="dropdown-item" href="javascript: void(0)" onclick="rptChangeRela.showChangeRela('change');">变更令</a>                            <% if (viewPmData) { %>                            <a class="dropdown-item" href="javascript: void(0)" onclick="rptOtherStage.showOtherStage('pm_deal');">项目管理-合同管理</a>                            <% } %>                        </div>                    </div>                </div>                <% } %>                <% } %>            </div>            <div>            </div>        </div>    </div>    <div class="content-wrap">        <div class="c-header p-0"></div>        <div class="c-body">            <div class="row">                <div class="col-auto pr-0" id="tree-view" style="width: 17%">                    <div class="sjs-height-1" style="overflow: auto">                        <div class="text-center"></div>                        <ul id="rptTplTree" class="ztree"></ul>                    </div>                </div>                <div class="col-auto" id="main-view" style="width: 83%">                    <div class="resize-x" id="right-spr" r-Type="width" div1="#tree-view" div2="#main-view" title="调整大小" a-type="percent"><!--调整左右高度条--></div>                    <div class="toolsbar-f d-flex justify-content-between">                        <div class="print-toolsbar">                            <div class="panel">                                <div class="panel-body" id="print_div">                                    <button class="btn btn-outline-primary btn-sm" type="button" onclick="rptPrintHelper.preview()">                                        <i class="fa fa-print"></i><br>                                        打印 <span id="checkCountPrint" class="badge badge-primary">0</span>                                    </button>                                    <!--                                    <button class="btn btn-outline-primary btn-sm" type="button" onclick="rptPrintHelper.individualPreview()">                                        <i class="fa fa-print"></i><br>                                        现场收方 <span id="checkCountPrint" class="badge badge-primary">0</span>                                    </button>                                    -->                                </div>                            </div>                            <div class="panel">                                <div class="panel-body" id="export_div">                                    <div class="btn-group" role="group" aria-label="Button group with nested dropdown">                                        <button type="button" class="btn btn-outline-primary btn-sm" onclick="rptControlObj.checkAndGetExcel()" <% if (pageShow !== null && parseInt(pageShow.closeExportExcel) === 1) { %> disabled <% } %> ><i class="fa fa-file-excel-o"></i> Excel <span class="badge badge-primary">0</span></button>                                        <button type="button" class="btn btn-outline-primary btn-sm" id="show_excel_output_cfg" data-toggle="modal" data-target="#export_excel" style="display:none"></button>                                        <button type="button" class="btn btn-outline-primary btn-sm" onclick="rptControlObj.getPDFPre()" <% if (pageShow !== null && parseInt(pageShow.closeExportPdf) === 1) { %> disabled <% } %> ><i class="fa fa-file-pdf-o"></i> PDF <span class="badge badge-primary">0</span></button>                                        <!-- <button type="button" class="btn btn-outline-primary btn-sm" onclick="rptControlObj.getTestPDFPre()"><i class="fa fa-file-pdf-o"></i> T_PDF <span class="badge badge-primary">0</span></button> -->                                    </div>                                </div>                                <div class="panel-foot text-muted">                                    导出报表                                </div>                            </div>                            <div class="panel" <% if (pageShow === null || parseInt(pageShow.showArchive) === 0 || isNaN(parseInt(pageShow.showArchive))) { %> style="display:none" <% } %>>                                <div class="panel-body">                                    <div class="btn-group" role="group">                                        <button id="btnArchiveRpt" type="button" class="btn btn-outline-primary btn-sm" data-toggle="modal" data-target="#guidang" disabled><i class="fa fa-archive"></i> 归档报表</button>                                        <button id="btnBatchArchiveRpt" type="button" class="btn btn-outline-primary btn-sm" onclick="rptArchiveObj.batchArchive()" disabled><i class="fa fa-archive"></i>批量归档</button>                                        <!--                                        -->                                        <div class="btn-group" role="group">                                            <button id="btnArchiveList" type="button" class="btn btn-success btn-sm dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" disabled>                                                已归档                                            </button>                                            <div class="dropdown-menu" aria-labelledby="btnGroupDrop1" style="min-width:112px" id="selectionArchiveInfo">                                            </div>                                        </div>                                    </div>                                </div>                                <div class="panel-foot text-muted">                                    报表归档                                </div>                            </div>                            <div class="panel">                                <div class="panel-body">                                    <div class="btn-group" role="group" aria-label="Button group with nested dropdown">                                        <div class="btn-group" role="group">                                            <button id="btnRptOrientation" type="button" class="btn btn-outline-primary btn-sm dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">纵向</button>                                            <div class="dropdown-menu" aria-labelledby="btnGroupDrop1">                                                <a class="dropdown-item" id="hrefRptOrientation" style="cursor:pointer" onclick="zTreeOprObj.changeOrientation(this)">横向</a>                                            </div>                                        </div>                                        <div class="btn-group" role="group">                                            <button id="btnRptPageSize"  type="button" class="btn btn-outline-primary btn-sm dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">A4</button>                                            <div class="dropdown-menu" aria-labelledby="btnGroupDrop1">                                                <a class="dropdown-item" id="hrefRptPageSize" style="cursor:pointer" onclick="zTreeOprObj.changePageSize(this)">A3</a>                                                <!--                                                <a class="dropdown-item" id="hrefRptPageSize_A5" style="cursor:pointer" onclick="zTreeOprObj.changePageSize(this)">A5</a>                                                <a class="dropdown-item" id="hrefRptPageSize_B4" style="cursor:pointer" onclick="zTreeOprObj.changePageSize(this)">B4</a>                                                <a class="dropdown-item" id="hrefRptPageSize_B5" style="cursor:pointer" onclick="zTreeOprObj.changePageSize(this)">B5</a>                                                <a class="dropdown-item" id="hrefRptPageSize_LETTER" style="cursor:pointer" onclick="zTreeOprObj.changePageSize(this)">LETTER</a>                                                -->                                            </div>                                        </div>                                    </div>                                </div>                                <div class="panel-foot text-muted">                                    预览设置                                </div>                            </div>                            <!--                            <div class="panel">                                <div class="panel-body">                                    <div class="btn-group" role="group">                                        <button type="button" class="btn btn-outline-primary btn-sm" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="缩小" onclick="zTreeOprObj.scaleReport(-0.25)">-</button>                                        <button id="btnNormalScale" class="btn btn-outline-primary btn-sm" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="重置默认大小" onclick="zTreeOprObj.scaleReport(0)">100%</button>                                        <button type="button" class="btn btn-outline-primary btn-sm" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="放大" onclick="zTreeOprObj.scaleReport(0.25)">+</button>                                    </div>                                </div>                                <div class="panel-foot text-muted">                                    缩放                                </div>                            </div>                            -->                            <div class="panel">                                <div class="panel-body">                                    <div class="btn-group" role="group" aria-label="Button group with nested dropdown">                                        <button type="button" class="btn btn-outline-primary btn-sm" data-toggle="modal" data-target="#paper" onclick="zTreeOprObj.renderRptCfg(CUST_CFG)"><i class="fa fa-file-o"></i> 纸张</button>                                        <button type="button" class="btn btn-outline-primary btn-sm" data-toggle="modal" data-target="#format" onclick="zTreeOprObj.renderRptCfg(CUST_CFG)"><i class="fa fa-bold"></i> 格式</button>                                        <button type="button" class="btn btn-outline-primary btn-sm" data-toggle="modal" data-target="#setting" onclick="zTreeOprObj.renderRptCfg(CUST_CFG)"><i class="fa fa-cog"></i> 设置</button>                                    </div>                                </div>                                <div class="panel-foot text-muted">                                    报表设置                                </div>                            </div>                            <% if (!pageShow.openNetCaSign) { %>                            <div class="panel" id="pnl_eSignature">                                <div class="panel-body">                                    <button class="btn btn-outline-primary btn-sm" type="button" data-toggle="modal" data-target="#eSignature" onclick="rptSignatureHelper.resetESignature(zTreeOprObj.currentRptPageRst, 'eSignatureBodyDiv'); rptSignatureHelper.checkAndShowCrossTendersESignature(fujianOssPath);">                                        <i class="fa fa-pencil"></i><br>                                        签字                                    </button>                                </div>                            </div>                            <% } %>                            <div class="panel">                                <div class="panel-body">                                    <div class="input-group input-group-sm">                                        <div class="input-group-prepend">                                            <button type="button" class="btn btn-outline-primary btn-sm" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="首页" onclick="rptControlObj.firstPage(this)"><i class="fa fa-angle-double-left "></i></button>                                            <button type="button" class="btn btn-outline-primary btn-sm" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="上一页" onclick="rptControlObj.prePage(this)"><i class="fa fa-angle-left"></i></button>                                        </div>                                        <input class="form-control form-control-sm" id="rpt_page_num" value="1/10" onKeydown="rptControlObj.onKeydown(event, this)" style="width:60px" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="输入页码按回车键,快速跳转">                                        <div class="input-group-append">                                            <button type="button" class="btn btn-outline-primary btn-sm" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="下一页" onclick="rptControlObj.nextPage(this)"><i class="fa fa-angle-right"></i></button>                                            <button type="button" class="btn btn-outline-primary btn-sm" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="尾页" onclick="rptControlObj.lastPage(this)"><i class="fa fa-angle-double-right"></i></button>                                        </div>                                    </div>                                </div>                                <div class="panel-foot text-muted">                                    翻页                                </div>                            </div>                            <div class="panel">                                <div class="panel-body">                                    <div class="btn-group" role="group">                                        <button class="btn btn-outline-primary btn-sm" type="button" onclick="canvasOprObj.showFullSreen()">                                            <i class="fa fa-window-maximize"></i><br>                                            全屏显示                                        </button>                                        <button id="btn_show_full_screen" class="btn btn-outline-primary btn-sm" type="button" data-toggle="modal" data-target="#fullscreen" style="display: none;"></button>                                    </div>                                </div>                            </div>                            <div class="panel" id="material" style="display: none;">                                <div class="panel-body">                                    <div class="btn-group" role="group">                                        <div class="btn-group" role="group">                                            <button type="button" class="btn btn-outline-primary btn-sm dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"                                                    <% if (materialList.length === 0) { %>disabled<% } %>>                                                <span id="material-select" class="d-inline-flex" style="min-width: 40px" m-order="<%- (materialList.length === 0 ? 0 : materialList[0].order) %>">                                                    <%- (materialList.length === 0 ? '无' : '第' + materialList[0].order + '期') %>                                                </span>                                            </button>                                            <div class="dropdown-menu" aria-labelledby="btnGroupDrop1" style="min-width:112px" id="material-list">                                                <% for (const ml of materialList) { %>                                                <a class="dropdown-item" href="javascript: void(0);" m-order="<%- ml.order %>" onclick="rptCustomObj.changeMaterial(this)">第<%- ml.order %>期</a>                                                <% } %>                                            </div>                                        </div>                                    </div>                                </div>                                <div class="panel-foot text-muted">                                    材料调差                                </div>                            </div>                            <div class="panel" id="pnl_audit_select" style="display: none;">                                <div class="panel-body">                                    <button class="btn btn-outline-primary btn-sm" type="button" data-toggle="modal" data-target="#audit-select">                                        <i class="fa fa-pencil"></i><br>                                        审批人选择                                    </button>                                </div>                            </div>                            <div class="panel" id="pnl_gather_select" style="display: none;">                                <div class="panel-body">                                    <div class="btn-group" role="group">                                        <button class="btn btn-primary btn-sm" type="button" data-toggle="modal" data-target="#gather-select">                                            选择标段<br><span class="badge badge-light" id="gather-select-count">5</span>                                        </button>                                    </div>                                </div>                            </div>                            <div class="panel" id="pnl_stage_select" style="display: none;">                                <div class="panel-body">                                    <div class="btn-group" role="group">                                        <button class="btn btn-primary btn-sm" type="button" data-toggle="modal" data-target="#stage-select">                                            选择期<br><span class="badge badge-light" id="stage-select-count">5</span>                                        </button>                                    </div>                                </div>                            </div>                            <div class="panel" id="pnl_material_sum_select" style="display: none;">                                <div class="panel-body">                                    <div class="btn-group" role="group">                                        <button class="btn btn-primary btn-sm" type="button" data-toggle="modal" data-target="#material-sum-select">                                            选择材差期<br><span class="badge badge-light" id="material-sum-select-count">5</span>                                        </button>                                    </div>                                </div>                            </div>                        </div>                    </div>                    <div class="sjs-height-4">                        <div class="print-view form-view" style="position: relative;">                            <div class="pageContainer">                                <canvas id="rptCanvas" height="820" width="920"></canvas>                            </div>                        </div>                    </div>                </div>            </div>        </div>    </div></div><script src="/public/js/sub_menu.js"></script><script src="/public/js/div_resizer.js"></script><script>    $.subMenu({        menu: '#sub-menu', miniMenu: '#sub-mini-menu', miniMenuList: '#mini-menu-list',        toMenu: '#to-menu', toMiniMenu: '#to-mini-menu',        key: 'menu.1.0.0',        miniHint: '#sub-mini-hint', hintKey: 'menu.hint.1.0.1',        callback: function (info) {            if (info.mini) {                $('.panel-title').addClass('fluid');                $('#sub-menu').removeClass('panel-sidebar');            } else {                $('.panel-title').removeClass('fluid');                $('#sub-menu').addClass('panel-sidebar');            }            autoFlashHeight();        }    });    let CURRENT_SELECTED_BIZ_TYPE = 'stage';    function advancePayClick(ele = null) {        $('#prepay-select-item a').show();        const thisEle = ele === null ? this : ele;        $(thisEle).hide();        $('#prepay-select-item').siblings('button').text($(thisEle).text());        current_advance_type = $(thisEle).data('type');        const typeStr = ['tplType_prePay1', 'tplType_prePay2', 'tplType_prePay3', 'tplType_prePay4']; // 分别对应 开工、材料、安全生产、扬尘污染 预付款,可直接用来判断模板的flags.rptTplType属性        const tIdx = typeStr.indexOf(current_advance_type)        const adList = [];        ADVANCE_LIST.forEach(advance => {            if (advance.type === tIdx) {                adList.push(advance);            }        });        buildAdvancePaySelection(adList);        filterReportsByType();    }    $('#prepay-select-item a').on('click', function (){        advancePayClick(this);    });    $('#biz-select-item a').on('click', function () {        $('#biz-select-item a').show();        $(this).hide();        $('#biz-select-item').siblings('button').text($(this).text());        const type = $(this).data('type');        CURRENT_SELECTED_BIZ_TYPE = type;        // CHANGE_ID = -1;        // BUSINESS_ID = -1;        zTreeOprObj.reIniReport();        if (type === 'stage') {            // 计量期            $('#divSelectableStages').show();            $('#divSelectableAdvancePays').hide();            $('#divSelectableMaterials').hide();            $('#biz-prepay-item').hide();            $('#report_selects_ul').show();            $('#divPresets').show();            SOURCE_TYPE = 1;            current_advance_id = -1;            current_advance_type = '';            current_material_id = -1;            current_stage_id = bk_current_stage_id;            BUSINESS_ID = bk_current_stage_id;            // 还有归档按钮处理            // current_stage_id            rptArchiveObj.toggleBtn(true);            filterReportsByType();        } else if (type === 'change_prepay') {            // 预付款            $('#divSelectableStages').hide();            $('#divSelectableAdvancePays').show();            $('#divSelectableMaterials').hide();            $('#biz-prepay-item').show();            $('#report_selects_ul').hide();            $('#divPresets').hide();            // 要触发一下            SOURCE_TYPE = 10;            current_advance_id = -1;            current_material_id = -1;            bk_current_stage_id = current_stage_id;            current_stage_id = -400;            rptArchiveObj.toggleBtn(true);            advancePayClick( $('#prepay-select-item a')[0]);        } else if (type === 'change_material_adjustment') {            // 材料调差            $('#divSelectableStages').hide();            $('#divSelectableAdvancePays').hide();            $('#divSelectableMaterials').show();            $('#biz-prepay-item').hide();            $('#report_selects_ul').hide();            $('#divPresets').hide();            // 要触发一下            SOURCE_TYPE = 30;            current_advance_id = -1;            current_advance_type = '';            current_material_id = -1;            bk_current_stage_id = current_stage_id;            current_stage_id = -500;            rptArchiveObj.toggleBtn(true);            buildMaterialSelection();            filterReportsByType();        }        // filterReportsByType();    });    $.divResizer({        select: '#right-spr',        callback: function () {            autoFlashHeight();        }    });</script><script>    const tenders = JSON.parse(unescape('<%- escape(JSON.stringify(tenderList)) %>'));    let ARCHIVE_LIST = JSON.parse('<%- JSON.stringify(archiveList) %>');    let LAST_AUDITOR = JSON.parse('<%- JSON.stringify(lastAuditor) %>');    const category = JSON.parse(unescape('<%- escape(JSON.stringify(categoryData)) %>'));    const auditConst = JSON.parse('<%- JSON.stringify(auditConst) %>');    const ledgerAuditConst = JSON.parse('<%- JSON.stringify(ledgerAuditConst) %>');    const OSS_PATH = '<%- OSS_PATH %>';    let TENDER_SOURCE_TREE;    $(document).ready(() => {        TENDER_SOURCE_TREE = Tender2Tree.convert(category, tenders, ledgerAuditConst, auditConst);        rptCustomObj.initTenderTree(tenders, category); // 好像没用上                // rptCustomObj.initTenderTreeForCross(tenders, category);    });</script><script type="text/javascript">    let COMMON_WATER_MARK_PIC_DATA = null;</script><script type="text/javascript">  autoFlashHeight();</script><script type="text/javascript" src="/public/jspdf/jspdf.min.js"></script><script src="/public/js/datepicker/datepicker.min.js"></script><script src="/public/js/datepicker/datepicker.zh.js"></script><script src="/public/js/shares/cs_tools.js"></script><script src="/public/js/js-xlsx/jszip.min.js"></script><script src="/public/js/file-saver/FileSaver.js"></script><!-- zTree --><script type="text/javascript" src="/public/js/ztree/jquery.ztree.core.js"></script><script type="text/javascript" src="/public/js/ztree/jquery.ztree.excheck.js"></script><!----><script type="text/javascript" src="/public/js/rpt_tpl_def.js"></script><script type="text/javascript" src="/public/js/common_ajax.js"></script><script type="text/javascript" src="/public/js/treeDataHelper.js"></script><script type="text/javascript" src="/public/js/string_util_light.js"></script><script type="text/javascript" src="/public/js/ztree_common.js"></script><script type="text/javascript" src="/public/js/storageUtil.js"></script><script type="text/javascript" src="/public/report/js/rpt_public.js"></script><script type="text/javascript" src="/public/report/js/rpt_main.js?20231217"></script><script type="text/javascript" src="/public/report/js/rpt_archive.js?20231217"></script><script type="text/javascript" src="/public/report/js/rpt_cfg_const.js"></script><script type="text/javascript" src="/public/report/js/jpc_output_value_define.js"></script><script type="text/javascript" src="/public/report/js/rpt_figure.js"></script><script type="text/javascript" src="/public/report/js/jpc_output.js"></script><script type="text/javascript" src="/public/report/js/rpt_print.js?20231217"></script><script type="text/javascript" src="/public/report/js/rpt_signature.js?20240605"></script><script type="text/javascript" src="/public/report/js/rpt_jspdf.js?20231217"></script><script type="text/javascript" src="/public/report/js/rpt_jsexcel.js?20231217"></script><script type="text/javascript" src="/public/report/js/rpt_indexDb.js?20231217"></script><script type="text/javascript" src="/public/report/js/rpt_move_signature.js"></script><script type="text/javascript" src="/public/report/js/rpt_change.js"></script><!--<script type="text/javascript" src="/public/report/js/rpt_custom.js"></script>--><script type="text/javascript">    let TOP_TREE_NODES = <%- rpt_tpl_data %>;    const DETAIL_ID = <%- detail_id %>;    const BUDGET_ID = <%- budget_id %>;    const SP_ID = '<%- sp_id %>';    let SOURCE_TYPE = <%- source_type %>;    const ALL_CHANGES = <%- changes %>;    const ALL_OTHER = <%- otherChangeList %>;    const BGL_OBJ = <%- bglObj %>;    const ADVANCE_LIST = <%- advanceList %>;    const ADVANCE_AUDIT_LISt = <%- advanceAuditList %>;    ADVANCE_LIST.sort(function(a1, a2) {        return a1.order - a2.order;    });    ADVANCE_AUDIT_LISt.sort(function(aa1, aa2) {        let rst = aa1.vid - aa2.vid;        if (rst === 0) {            rst = aa1.order - aa2.order;            if (rst === 0) {                rst = aa2.times - aa1.times; // 这个排序是为了后续判断方便,只需要找第一个符合advance_id即可,无需再循环            }        }        return rst;    });    const MATERIAL_LIST = <%- materialAdjList %>;    MATERIAL_LIST.sort(function(m1, m2) {        return m1.order - m2.order;    });    const MATERIAL_AUDIT_LIST = <%- materialAdjAuditList %>;    MATERIAL_AUDIT_LIST.sort(function(ma1, ma2) {        let rst = ma1.mid - ma2.mid;        if (rst === 0) {            rst = ma1.order - ma2.order;            if (rst === 0) {                rst = ma2.times - ma1.times; // 这个排序是为了后续判断方便,只需要找第一个符合advance_id即可,无需再循环            }        }        return rst;    });    const CHANGE_ID = BGL_OBJ?.change?.cid || '-1';    const CHANGE_TIMES = BGL_OBJ?.change?.times || 1;    let BUSINESS_ID = BGL_OBJ?.BUSINESS_ID || '-1';    const CHNAGE_PLAN_ID = BGL_OBJ?.change_plan?.id || '-1';    const CHNAGE_PLAN_TIMES = BGL_OBJ?.change_plan?.times || '-1';    const CHNAGE_PROJECT_ID = BGL_OBJ?.change_project?.id || '-1';    const CHNAGE_PROJECT_TIMES = BGL_OBJ?.change_project?.times || '-1';    const CHNAGE_APPLY_ID = BGL_OBJ?.change_apply?.id || '-1';    const CHNAGE_APPLY_TIMES = BGL_OBJ?.change_apply?.times || '-1';    const PAGE_SHOW = {closeWatermark: 0, closeExportPdf: 0, closeExportExcel: 0, showArchive: 0, closeShowAllCustomized: 0, isTextSignature: 0, closeArchiveSignature: 0};    <% if (pageShow !== null) { %>        <% if (parseInt(pageShow.closeWatermark) === 1) { %>            PAGE_SHOW['closeWatermark'] = 1;        <% } %>        <% if (parseInt(pageShow.closeExportPdf) === 1) { %>            PAGE_SHOW['closeExportPdf'] = 1;        <% } %>        <% if (parseInt(pageShow.closeExportExcel) === 1) { %>            PAGE_SHOW['closeExportExcel'] = 1;        <% } %>        <% if (parseInt(pageShow.showArchive) === 1) { %>            PAGE_SHOW['showArchive'] = 1;        <% } %>        <% if (parseInt(pageShow.closeShowAllCustomized) === 1) { %>            PAGE_SHOW['closeShowAllCustomized'] = 1;        <% } %>        <% if (parseInt(pageShow.isTextSignature) === 1) { %>            PAGE_SHOW['isTextSignature'] = 1;        <% } %>        <% if (parseInt(pageShow.closeArchiveSignature) === 1) { %>            PAGE_SHOW['closeArchiveSignature'] = 1;        <% } %>    <% } %>//    PAGE_SHOW['closeWatermark'] = 0; //测试用,check in 前要屏蔽    const CUST_TREE_NODES = <%- cust_tpl_data %>;    const ALL_COMMON_TREE_NODES = <%- all_common_tpl_data %>;    const ALL_INDIVI_TREE_NODES = <%- all_indivi_tpl_data %>;    const CUST_SELECT_KEYS = <%- cust_select_keys %>;    if (!(CUST_TREE_NODES.customize instanceof Array)) {        CUST_TREE_NODES.customize = [];    }    const ORG_CUST_TREE_NODES = JSON.parse(JSON.stringify(CUST_TREE_NODES));    let CUST_CFG = <%- cust_cfg %>;    CUST_CFG = JSON.parse(CUST_CFG[0].cfg_content);    CUST_CFG.closeWarterMark = (PAGE_SHOW['closeWatermark'] === 1);    if (!CUST_CFG.hasOwnProperty('continuousOutput')) {        CUST_CFG.continuousOutput = false;    }    //    const PROJECT_ID = <%- project_id %>;    const TENDER_ID = <%- tender_id %>;    const TENDER_NAME = '<%- tender_name %>';    const STAGE_ID = <%- stg_id %>;    const STAGE_ORDER = <%- stg_order %>;    const CUR_ORDER = <%- cur_order %>;    const STAGE_TIMES = <%- stg_times %>;    const STAGE_LIST = <%- stage_list %>;    const PRJ_ACCOUNT_LIST = <%- prj_account_list %>;    const CONSTRUCT_UNIT_LIST = <%- unitList %>;    const ROLE_LIST = <%- role_list %>;    const CUST_NAME = '<%- ctx.session.sessionUser.name %>';    const fujianOssPath = '<%- ctx.app.config.fujianOssPath %>';    const PRE_PAY = <%- prePay %>;    if (localStorage[CUST_NAME + '_custCfg']) {        CUST_CFG = JSON.parse(localStorage[CUST_NAME + '_custCfg']);    } else {        localStorage[CUST_NAME + '_custCfg'] = JSON.stringify(CUST_CFG);    }    let CUST_CFG_ORG = JSON.parse(JSON.stringify(CUST_CFG));    let USED_LIST = <%- used_list %>;    const STAGE_STATUS = <%- stg_status %>;    const FOLDER_SEPERATER = '->';    let STAGE_AUDIT = [];    let STAGE_AUDIT_ORG = [];    let STAGE_FLOW = [];    let LEDGER_LIST = [];    let ROLE_REL_LIST = [];    let CURRENT_ROLE_REL_ID = -1;    let current_stage_order = -1;    let current_advance_id = -1;  // 预付款期id    let current_advance_order = -1;  // 预付款期    let current_advance_type = '';// 预付款报表类型    let current_material_id = -1; // 材差期id    let current_material_order = -1; // 材差期    let current_stage_id = STAGE_ID;    let bk_current_stage_id = current_stage_id;    let current_stage_times = -1;    let current_stage_status = -1;    const customSelects = <%- JSON.stringify(customSelects) %>;    const dataSelects = <%- JSON.stringify(dataSelects) %>;    if (STAGE_ORDER > 0) {        current_stage_order = STAGE_ORDER;        current_stage_id = STAGE_ID;        current_stage_times = STAGE_TIMES;        current_stage_status = STAGE_STATUS;    } else if (STAGE_LIST.length > 0) {        current_stage_order = STAGE_LIST[STAGE_LIST.length - 1].order;        current_stage_id = STAGE_LIST[STAGE_LIST.length - 1].id;        current_stage_times = STAGE_LIST[STAGE_LIST.length - 1].times;        current_stage_status = STAGE_LIST[STAGE_LIST.length - 1].status;    }    <% if (false || ![-100, -200, -300, -301, -302, -303].includes(stg_id)) { %>    buildStageSelection();    <% } %>    setupSignature();    for (let item of TOP_TREE_NODES) {        if (item.name === '通用报表') {            item.name = '推荐报表';        }    }    const ORG_TOP_TREE_NODES = JSON.parse(JSON.stringify(TOP_TREE_NODES));    for (let item of TOP_TREE_NODES) {        item.items = JSON.parse(item.items);        if (item.items && item.items.length > 0) {            for (let dtlItem of item.items) {                chkAndSetNode(dtlItem);            }        }    }    for (let item of ORG_TOP_TREE_NODES) {        item.items = JSON.parse(item.items);        if (item.items && item.items.length > 0) {            for (let dtlItem of item.items) {                chkAndSetNode(dtlItem);            }        }    }    for (let item of ALL_COMMON_TREE_NODES) {        // item.items = JSON.parse(item.items);        if (item.items && item.items.length > 0) {            for (let dtlItem of item.items) {                chkAndSetNode(dtlItem);            }        }    }    for (let item of ALL_INDIVI_TREE_NODES) {        // item.items = JSON.parse(item.items);        if (item.items && item.items.length > 0) {            for (let dtlItem of item.items) {                chkAndSetNode(dtlItem);            }        }    }    buildTplTree();    function chkAndSetNode(parentItem) {        parentItem.title = '';        if (parentItem.nodeType === 1) {            parentItem.isParent = true;        } else {            parentItem.title = parentItem.name + '(' + parentItem.refId + ')';        }        if (parentItem.items) {            for (let dtlItem of parentItem.items) {                chkAndSetNode(dtlItem);            }        }    }    const SCREEN_DPI = [];    function filterReportsByType() {        function _filterBySourceType(nodes, srcType) {            for (let idx = nodes.length - 1; idx >= 0; idx--) {                if (!nodes[idx].hasOwnProperty('source_type')) {                    nodes[idx].source_type = 1;                }                if (nodes[idx].source_type !== srcType) {                    nodes.splice(idx, 1);                }            }        }        const newCommonTreeNodes = JSON.parse(JSON.stringify(ALL_COMMON_TREE_NODES));        const newCustomTreeNodes = JSON.parse(JSON.stringify(ALL_INDIVI_TREE_NODES));        let bizType = 1;        if (CURRENT_SELECTED_BIZ_TYPE === 'stage') bizType = 1; // 计量期        if (CURRENT_SELECTED_BIZ_TYPE === 'change_prepay') bizType = 10; // 预付款        if (CURRENT_SELECTED_BIZ_TYPE === 'change_material_adjustment') bizType = 30; // 材差        _filterBySourceType(newCommonTreeNodes, bizType);        _filterBySourceType(newCustomTreeNodes, bizType);        TOP_TREE_NODES[0].items = [];        TOP_TREE_NODES[0].items.push(...newCustomTreeNodes);        TOP_TREE_NODES[1].items = [];        TOP_TREE_NODES[1].items.push(...newCommonTreeNodes);        if (bizType === 1) {            filterUnchkTplTreeNode(TOP_TREE_NODES[0], CUST_TREE_NODES.customize);            filterUnchkTplTreeNode(TOP_TREE_NODES[1], CUST_TREE_NODES.common);        }        zTreeOprObj.getReportTemplateTree();    }    function filterUnchkTplTreeNode(topNode, srcData) {        const _chkAndSpliceItem = function(pNode, pStr) {            let rst = false;            if (srcData.indexOf(pStr + pNode.name) < 0) {                if (pNode.items && pNode.items.length > 0) {                    for (let subIdx = pNode.items.length - 1; subIdx >= 0; subIdx--) {                        if (!_chkAndSpliceItem(pNode.items[subIdx], pStr + pNode.name + FOLDER_SEPERATER)) {                            pNode.items.splice(subIdx, 1);                        } else {                            rst = true;                        }                    }                }            } else {                rst = true;            }            return rst;        };        for (let rIdx = topNode.items.length - 1; rIdx >= 0; rIdx--) {            if (!_chkAndSpliceItem(topNode.items[rIdx], '')) {                topNode.items.splice(rIdx, 1);            }        }    }    function buildTplTree() {        if (TOP_TREE_NODES.length > 0) {            //1. 整理模板树 (原始状态的TOP_TREE_NODES包含了推荐报表与定制表,需要分割)            const individualNode = {id: 99999, name: '定制报表', pid: -1, rpt_type: 0, items: [], isParent: true};            for (let tnIdx = TOP_TREE_NODES.length - 1; tnIdx >= 0; tnIdx--) {                if (TOP_TREE_NODES[tnIdx].pid !== -1) {                    TOP_TREE_NODES[tnIdx].isParent = true;                    TOP_TREE_NODES[tnIdx].nodeType = 1;                    individualNode.items.unshift(TOP_TREE_NODES[tnIdx]);                    TOP_TREE_NODES.splice(tnIdx, 1);                }            }            if (TOP_TREE_NODES.length > 0) {                // 1.1 移除未被选择的模板                filterUnchkTplTreeNode(TOP_TREE_NODES[0], CUST_TREE_NODES.common);                TOP_TREE_NODES.unshift(individualNode); //定制在前                if (CUST_TREE_NODES.customize && CUST_TREE_NODES.customize.length > 0) {                    // 优先过滤用户选择                    filterUnchkTplTreeNode(TOP_TREE_NODES[0], CUST_TREE_NODES.customize);                } else if (PAGE_SHOW['closeShowAllCustomized'] === 1) {                    // 如果没有用户选择 且 关闭显示所有定制表                    filterUnchkTplTreeNode(TOP_TREE_NODES[0], []);                }            }            //2. 原始的模板树(恢复用)            const individualNodeOrg = {id: 99999, name: '定制报表', pid: -1, rpt_type: 0, items: [], isParent: true};            for (let tnIdx = ORG_TOP_TREE_NODES.length - 1; tnIdx >= 0; tnIdx--) {                if (ORG_TOP_TREE_NODES[tnIdx].pid !== -1) {                    ORG_TOP_TREE_NODES[tnIdx].isParent = true;                    ORG_TOP_TREE_NODES[tnIdx].nodeType = 1;                    individualNodeOrg.items.unshift(ORG_TOP_TREE_NODES[tnIdx]);                    ORG_TOP_TREE_NODES.splice(tnIdx, 1);                }            }            //ORG_TOP_TREE_NODES.push(individualNode);            ORG_TOP_TREE_NODES.unshift(individualNodeOrg);        }    }    function buildStageSelection() {        if (STAGE_LIST.length === 0) {            $("#optionSelectableStages")[0].style.display = 'none';        } else {            $("#optionSelectableStages")[0].style.display = '';            $("#btnCurrentStage")[0].innerText = '第' + current_stage_order + '期';            $("#optionSelectableStages").empty();            if (STAGE_LIST.length > 0 && STAGE_ID < 0) {                for (let i = STAGE_LIST.length; i > 0; i--) {                    if (parseInt(STAGE_LIST[i - 1].order) !== current_stage_order) {                        const str = '<a class="dropdown-item" style="cursor:pointer" onclick="changeCurrentStage(this)" stg_id = "' + STAGE_LIST[i - 1].id + '" stg_order="' + STAGE_LIST[i - 1].order + '">第' + STAGE_LIST[i - 1].order + '期</a>';                        $("#optionSelectableStages").append(str);                    }                }            }        }        if (STAGE_ID > 0) {            $("#divSelectableStages")[0].style.display = 'none';        }    }    function buildAdvancePaySelection(adList) {        zTreeOprObj.reIniReport();        $("#optionSelectableAdvancePays").empty();        $("#btnCurrentAdvancePay")[0].innerText = '';        let hasMatch = false;        if (current_advance_id !== -1) {            // 这里要考虑不同预付款的切换            current_advance_id = -1;            current_advance_order = -1;        }        for (const advance of adList) {            if (current_advance_id === advance.id) {                hasMatch = true; // 预付款有好几种类型,需要考虑不同类型的转换检测                break;            }        }        const maxIdx = (adList.length - 1) || 0;        for (let adIndex = adList.length - 1; adIndex >= 0; adIndex--) {            const advance = adList[adIndex];        // adList.forEach((advance, adIndex) => {            let dispStr = '';            if (!hasMatch && adIndex === maxIdx || current_advance_id === advance.id) {                current_advance_id = advance.id;                current_advance_order = adIndex + 1;                BUSINESS_ID = advance.id;                $("#btnCurrentAdvancePay")[0].innerText = `第${adIndex + 1}期`;                dispStr = ';display:none';            }            const str = `<a class="dropdown-item" style="cursor:pointer${dispStr}" onclick="changeCurrentAdvance(this)" advance_id = "${advance.id}" advance_order="${adIndex + 1}">第${adIndex + 1}期</a>`;            $("#optionSelectableAdvancePays").append(str);        // });        }        if (current_advance_id > 0) {            rptArchiveObj.toggleBtn(false);            getReportArchive();        }    }    function buildMaterialSelection() {        $("#optionSelectableMaterials").empty();        $("#btnCurrentMaterial")[0].innerText = '';        const maxIdx = (MATERIAL_LIST.length - 1) || 0;        for (let maIndex = MATERIAL_LIST.length - 1; maIndex >= 0; maIndex--) {            const materialAdj = MATERIAL_LIST[maIndex];        // MATERIAL_LIST.forEach((materialAdj, maIndex) => {            let dispStr = '';            if (current_material_id === -1 && maIndex === maxIdx || current_material_id === materialAdj.id) {                current_material_id = materialAdj.id;                current_material_order = maIndex + 1;                BUSINESS_ID = materialAdj.id;                $("#btnCurrentMaterial")[0].innerText = `第${maIndex + 1}期`;                dispStr = ';display:none';            }            const str = `<a class="dropdown-item" style="cursor:pointer${dispStr}" onclick="changeCurrentMaterial(this)" material_id = "${materialAdj.id}" material_order="${maIndex + 1}">第${maIndex + 1}期</a>`;            $("#optionSelectableMaterials").append(str);        // });        }        if (current_material_id > 0) {            getReportArchive();        }    }    function selectPreRptTpl() {        if (zTreeOprObj.currentRptPageRst) {            const tplId = zTreeOprObj.currentRptPageRst.id;            const allNodes = zTreeOprObj.treeObj.transformToArray(zTreeOprObj.treeObj.getNodes());            for (const node of allNodes) {                if (node.ID === tplId) {                    zTreeOprObj.treeObj.selectNode(node, false);                    // 还有必要触发报表刷新!???                    zTreeOprObj.onClick(null, null, node);                    break;                }            }        }    }    function changeCurrentMaterial(ele) {        // 此方法与changeCurrentStage不同,不需要与后台交互,只需要调整 params: material_id (约定的参数),然后触发一下报表        $('#optionSelectableMaterials a').show();        $(ele).hide();        current_material_id = +ele.attributes[3].value;        current_material_order = +ele.attributes[4].value;        BUSINESS_ID = current_material_id;        $('#optionSelectableMaterials').siblings('button').text($(ele).text());        // 刷新报表模板        zTreeOprObj.onClick(null, null, zTreeOprObj.currentNode);        zTreeOprObj.countChkedRptTpl();        getReportArchive();    }    function changeCurrentAdvance(ele) {        // 此方法与changeCurrentStage不同,不需要与后台交互,只需要调整 params: advance_id (约定的参数),然后触发一下报表        $('#optionSelectableAdvancePays a').show();        $(ele).hide();        current_advance_id = +ele.attributes[3].value;        current_advance_order = +ele.attributes[4].value;        BUSINESS_ID = current_advance_id;        $('#optionSelectableAdvancePays').siblings('button').text($(ele).text());        // 刷新报表模板        zTreeOprObj.onClick(null, null, zTreeOprObj.currentNode);        zTreeOprObj.countChkedRptTpl();        getReportArchive();    }    function changeCurrentStage(ele) {        // alert('you are selecting: ' + ele.innerText);        current_stage_order = parseInt(ele.attributes.stg_order.value);        current_stage_id = parseInt(ele.attributes.stg_id.value);        // BUSINESS_ID = current_stage_id;        BUSINESS_ID = BGL_OBJ?.BUSINESS_ID || '-1';        // 调整当前stage times        for (let i = STAGE_LIST.length; i > 0; i--) {            if (parseInt(STAGE_LIST[i - 1].order) === current_stage_order) {                current_stage_times = STAGE_LIST[i - 1].times;                current_stage_status = STAGE_LIST[i - 1].status;                break;            }        }        getReportArchive();    }    function getReportArchive() {        const params = {prjId: PROJECT_ID, stgId: current_stage_id, stgTimes: current_stage_times, stgStatus: current_stage_status};        if (current_stage_id === -400) {            params.bizId = current_advance_id;        } else if (current_stage_id === -500) {            params.bizId = current_material_id;        }        $.bootstrapLoading.start();        CommonAjax.postXsrfEx("/tender/report_api/getReportArchive", params, 10000, true, getCookie('csrfToken_j'),            function(result){                $.bootstrapLoading.end();                ARCHIVE_LIST = result.data;                LAST_AUDITOR = result.lastAuditor;                buildStageSelection();                setupSignature();                zTreeOprObj.refreshNodes();                zTreeOprObj.countChkedRptTpl();                selectPreRptTpl();            }, function(err){                $.bootstrapLoading.end();            }, function(ex){                $.bootstrapLoading.end();            }        );        //    }    function setupSignature() {//        if (current_stage_status === 3) {//            $('#pnl_eSignature')[0].style.display = '';//        } else {//            $('#pnl_eSignature')[0].style.display = 'none';//        }        // 用户可以设置,但只有审核通过后才显示签名    }    setupDateFormat();    rptTplObj.iniPage();    $(function () {        // 多层modal关闭后的滚动bug修复        $('#add-sign').on('hidden.bs.modal', function (e) {            $(document.body).addClass('modal-open');        });    })    function getStdTxtWidthByFont(ctx) {        let rst = {'宋体': {'normal': {}, 'bold': {}, 'italic': {}}, 'SmartSimsun': null, 'Arial Narrow': {'normal': {}, 'bold': {}, 'italic': {}}}        const _createStdWidth = function(dftFontHeight, chkFontName) {            let dftOthers = '';            ctx.font = dftOthers + dftFontHeight + "px 宋体";            rst[chkFontName]['normal']['_' + dftFontHeight + '_ascii'] = ctx.measureText('_').width;            rst[chkFontName]['normal']['_' + dftFontHeight + '_chn'] = ctx.measureText('一').width;            dftOthers = 'bold';            ctx.font = dftOthers + dftFontHeight + "px 宋体";            rst[chkFontName][dftOthers]['_' + dftFontHeight + '_ascii'] = ctx.measureText('_').width;            rst[chkFontName][dftOthers]['_' + dftFontHeight + '_chn'] = ctx.measureText('一').width;            dftOthers = 'italic';            ctx.font = dftOthers + dftFontHeight + "px 宋体";            rst[chkFontName][dftOthers]['_' + dftFontHeight + '_ascii'] = ctx.measureText('_').width;            rst[chkFontName][dftOthers]['_' + dftFontHeight + '_chn'] = ctx.measureText('一').width;        }        try {            ctx.save();            for (let dftFontHeight = 6; dftFontHeight <= 66; dftFontHeight++) {                _createStdWidth(dftFontHeight, '宋体');                rst['SmartSimsun'] = rst['宋体'];                _createStdWidth(dftFontHeight, 'Arial Narrow');            }        } finally {            ctx.restore();            return rst;        }    }    //const STD_TXT_WIDTH = getStdTxtWidthByFont(document.getElementById("rptCanvas").getContext('2d')); //这个可以给后台用(if need it)    $(document).ready(() => {        const node = zTreeOprObj.treeObj.getNodeByParam('refId', <%- rpt_id %>);        if (!node) return;        zTreeOprObj.treeObj.selectNode(node);        zTreeOprObj.onClick(null, null, node);        rptChangeObj.initBglList();    });</script>
 |