| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 | /** * Created by Tony on 2024/02/07. * 这个跟 rpt_change_rela不同,那个不是我写的,不去干扰 * 本文件处理跟变更令报表相关的操作 */'use strict'const rptChangeObj = {    initBglList: function() {        // 初始化变更令ID值 ALL_CHANGES bglKeyVals        /*        if (ALL_CHANGES) {            const $bglDivDom = $('#bglKeyVals');            $bglDivDom.empty();            let content = [];            ALL_CHANGES.forEach((change, index) => {                // 审批通过的才显示                if (change.status === 3) content.push(`<a class="dropdown-item" href="javascript: void(0)" onclick="rptChangeObj.changeBglId('${index}');">${change.code}</a>`);            });            $bglDivDom.append(content);        }        //*/    },    changeBglId: function(index) {        const change = ALL_CHANGES[index];        alert(change.cid);        if (zTreeOprObj.currentRptPageRst && zTreeOprObj.currentRptPageRst.splitArcPagesInfo && zTreeOprObj.currentRptPageRst.splitArcPages) {            let pgAccAmt = 0;            for (let idx = 0; idx < zTreeOprObj.currentRptPageRst.splitArcPages.length; idx++) {                const pgArcVal = zTreeOprObj.currentRptPageRst.splitArcPages[idx];                const pgInfoVals = zTreeOprObj.currentRptPageRst.splitArcPagesInfo.splitPageValues[idx];                // 根据3种数据(id、code、name)来判断输出哪个页面                if (pgInfoVals[0] === change.cid || pgInfoVals[0] === change.code || pgInfoVals[0] === change.name) {                    // 这里判断3种值(考虑到这3种值的差别极大,应该不会有重合的情况)                    const firstPage = pgArcVal;                    let lastPage = zTreeOprObj.currentRptPageRst.items.length;                    if (idx < zTreeOprObj.currentRptPageRst.splitArcPages.length - 1) {                        lastPage = zTreeOprObj.currentRptPageRst.splitArcPages[idx + 1];                    }                    this.sliceRptData(zTreeOprObj.currentRptPageRst, firstPage, lastPage);                    this.refreshPage(zTreeOprObj.currentRptPageRst);                    break;                } else {                    pgAccAmt = pgArcVal;                }            }        }    },    refreshPage: function(pageData) {        // 刷新页面(重新调整页码数量)        zTreeOprObj.maxPages = zTreeOprObj.currentRptPageRst.items.length;        zTreeOprObj.currentPage = 1;        zTreeOprObj.displayPageValue();        zTreeOprObj.showPage(1, zTreeOprObj.canvas);    },    prepareRawData: function(pageDatas) {        const _prepareRawData = function(pageData) {            if (!pageData.bk_items) pageData.bk_items = pageData.items;        };        // 这里pageDatas可以是勾选多个的也可以是单个选择        if (pageDatas instanceof Array) {            _prepareRawData(pageDatas);        } else {            pageDatas.forEach(pageData => {                _prepareRawData(pageData);            });        }    },    restoreRawData: function(pageDatas) {        const _restoreRawData = function(pageData) {            if (!pageData.bk_items) pageData.items = pageData.bk_items;        };        // 这里pageDatas可以是勾选多个的也可以是单个选择        if (pageDatas instanceof Array) {            _restoreRawData(pageDatas);        } else {            pageDatas.forEach(pageData => {                _restoreRawData(pageData);            });        }    },    sliceRptData: function(pageData, firstPage, lastPage) {        if (pageData.bk_items && firstPage > 0 && lastPage <= pageData.bk_items.length) {            pageData.items = pageData.bk_items.slice(firstPage - 1, lastPage);            return true;        }        return false;    }};
 |