Browse Source

台账分解、台账修订、修订历史、修订对比、计量台账、关联台账、结算选择、结算台账、结算汇总,查找定位,查找计量单元

MaiXinRong 1 month ago
parent
commit
60e2853119

+ 10 - 3
app/public/js/change_revise.js

@@ -4350,9 +4350,9 @@ $(document).ready(() => {
                 dealBills.spread.refresh();
                 dealBills.spread.refresh();
             } else if (tab.attr('content') === '#search') {
             } else if (tab.attr('content') === '#search') {
                 if (!searchLedger) {
                 if (!searchLedger) {
-                    searchLedger = $.billsSearch({
+                    searchLedger = $.ledgerSearch({
                         selector: '#search',
                         selector: '#search',
-                        searchSpread: billsSpread,
+                        ledger: { billsTree: billsTree, pos: pos },
                         searchOver: true,
                         searchOver: true,
                         searchEmpty: true,
                         searchEmpty: true,
                         resultSpreadSetting: {
                         resultSpreadSetting: {
@@ -4375,8 +4375,15 @@ $(document).ready(() => {
                             selectedBackColor: '#fffacd',
                             selectedBackColor: '#fffacd',
                             readOnly: true,
                             readOnly: true,
                         },
                         },
-                        afterLocated: function () {
+                        locate: function(cur) {
+                            if (!cur.lid) return;
+
+                            SpreadJsObj.locateTreeNode(billsSheet, cur.lid, true);
                             posSpreadObj.loadCurPosData();
                             posSpreadObj.loadCurPosData();
+                            if (cur.pid && cur.pid !== -1) {
+                                const pIndex = posSheet.zh_data.findIndex(x => { return x.id === cur.pid; });
+                                SpreadJsObj.locateRow(posSheet, pIndex);
+                            }
                         },
                         },
                         customSearch: [
                         customSearch: [
                             {
                             {

+ 12 - 5
app/public/js/ledger.js

@@ -122,6 +122,7 @@ $(document).ready(function() {
         id: 'id', ledgerId: 'lid',
         id: 'id', ledgerId: 'lid',
     });
     });
     const posSpread = SpreadJsObj.createNewSpread($('#pos-spread')[0]);
     const posSpread = SpreadJsObj.createNewSpread($('#pos-spread')[0]);
+    const posSheet = posSpread.getActiveSheet();
 
 
     // 初始化 附属工程量
     // 初始化 附属工程量
     const ancGcl = createAncillaryGcl({ id: 'id', masterId: 'lid', sort: [['g_order', 'asc']] });
     const ancGcl = createAncillaryGcl({ id: 'id', masterId: 'lid', sort: [['g_order', 'asc']] });
@@ -3066,9 +3067,9 @@ $(document).ready(function() {
                 dealBills.spread.refresh();
                 dealBills.spread.refresh();
             } else if (tab.attr('content') === '#search') {
             } else if (tab.attr('content') === '#search') {
                 if (!searchLedger) {
                 if (!searchLedger) {
-                    searchLedger = $.billsSearch({
+                    searchLedger = $.ledgerSearch({
                         selector: '#search',
                         selector: '#search',
-                        searchSpread: ledgerSpread,
+                        ledger: { billsTree: ledgerTree, pos: pos },
                         resultSpreadSetting: {
                         resultSpreadSetting: {
                             cols: [
                             cols: [
                                 {title: '项目节编号', field: 'code', hAlign: 0, width: 90, formatter: '@'},
                                 {title: '项目节编号', field: 'code', hAlign: 0, width: 90, formatter: '@'},
@@ -3089,9 +3090,15 @@ $(document).ready(function() {
                             selectedBackColor: '#fffacd',
                             selectedBackColor: '#fffacd',
                             readOnly: true,
                             readOnly: true,
                         },
                         },
-                        afterLocated: function () {
-                            posOperationObj.loadCurPosData();
-                            ancGclObj.loadCurAncillaryGcl();
+                        locate: function(cur) {
+                            if (!cur.lid) return;
+
+                            SpreadJsObj.locateTreeNode(ledgerSheet, cur.lid, true);
+                            treeOperationObj.loadRelaData();
+                            if (cur.pid && cur.pid !== -1) {
+                                const pIndex = posSheet.zh_data.findIndex(x => { return x.id === cur.pid; });
+                                SpreadJsObj.locateRow(posSheet, pIndex);
+                            }
                         },
                         },
                         calcSum: function (result) {
                         calcSum: function (result) {
                             const sum = { name: '合计' };
                             const sum = { name: '合计' };

+ 10 - 3
app/public/js/revise.js

@@ -2946,9 +2946,9 @@ $(document).ready(() => {
                 bgBills.spread.refresh();
                 bgBills.spread.refresh();
             } else if (tab.attr('content') === '#search') {
             } else if (tab.attr('content') === '#search') {
                 if (!searchLedger) {
                 if (!searchLedger) {
-                    searchLedger = $.billsSearch({
+                    searchLedger = $.ledgerSearch({
                         selector: '#search',
                         selector: '#search',
-                        searchSpread: billsSpread,
+                        ledger: { billsTree, pos },
                         resultSpreadSetting: {
                         resultSpreadSetting: {
                             cols: [
                             cols: [
                                 {title: '项目节编号', field: 'code', hAlign: 0, width: 90, formatter: '@'},
                                 {title: '项目节编号', field: 'code', hAlign: 0, width: 90, formatter: '@'},
@@ -2969,8 +2969,15 @@ $(document).ready(() => {
                             selectedBackColor: '#fffacd',
                             selectedBackColor: '#fffacd',
                             readOnly: true,
                             readOnly: true,
                         },
                         },
-                        afterLocated: function () {
+                        locate: function(cur) {
+                            if (!cur.lid) return;
+
+                            SpreadJsObj.locateTreeNode(billsSheet, cur.lid, true);
                             posSpreadObj.loadCurPosData();
                             posSpreadObj.loadCurPosData();
+                            if (cur.pid && cur.pid !== -1) {
+                                const pIndex = posSheet.zh_data.findIndex(x => { return x.id === cur.pid; });
+                                SpreadJsObj.locateRow(posSheet, pIndex);
+                            }
                         },
                         },
                         calcSum: function (result) {
                         calcSum: function (result) {
                             const sum = { name: '合计' };
                             const sum = { name: '合计' };

+ 11 - 4
app/public/js/revise_compare.js

@@ -338,9 +338,9 @@ $(document).ready(() => {
             showSideTools(tab.hasClass('active'));
             showSideTools(tab.hasClass('active'));
             if (tab.attr('content') === '#search') {
             if (tab.attr('content') === '#search') {
                 if (!searchLedger) {
                 if (!searchLedger) {
-                    searchLedger = $.billsSearch({
+                    searchLedger = $.ledgerSearch({
                         selector: '#search',
                         selector: '#search',
-                        searchSpread: billsSpread,
+                        ledger: { billsTree: billsTree, getLedgerPos: function (node){ return node.pos; } },
                         resultSpreadSetting: {
                         resultSpreadSetting: {
                             cols: [
                             cols: [
                                 {title: '项目节编号', field: 'code', hAlign: 0, width: 90, formatter: '@', readOnly: true},
                                 {title: '项目节编号', field: 'code', hAlign: 0, width: 90, formatter: '@', readOnly: true},
@@ -357,9 +357,16 @@ $(document).ready(() => {
                             font: '12px 微软雅黑',
                             font: '12px 微软雅黑',
                             selectedBackColor: '#fffacd',
                             selectedBackColor: '#fffacd',
                         },
                         },
-                        afterLocated: function () {
+                        locate: function(cur) {
+                            if (!cur.lid) return;
+
+                            SpreadJsObj.locateTreeNode(billsSheet, cur.lid, true);
                             posSpreadObj.loadCurPosData();
                             posSpreadObj.loadCurPosData();
-                        }
+                            if (cur.pid && cur.pid !== -1) {
+                                const pIndex = posSheet.zh_data.findIndex(x => { return x.id === cur.pid; });
+                                SpreadJsObj.locateRow(posSheet, pIndex);
+                            }
+                        },
                     });
                     });
                 }
                 }
                 searchLedger.spread.refresh();
                 searchLedger.spread.refresh();

+ 11 - 3
app/public/js/revise_history.js

@@ -306,9 +306,10 @@ $(document).ready(() => {
             showSideTools(tab.hasClass('active'));
             showSideTools(tab.hasClass('active'));
             if (tab.attr('content') === '#search' && !searchLedger) {
             if (tab.attr('content') === '#search' && !searchLedger) {
                 if (!searchLedger) {
                 if (!searchLedger) {
-                    searchLedger = $.billsSearch({
+                    searchLedger = $.ledgerSearch({
                         selector: '#search',
                         selector: '#search',
                         searchSpread: billsSpread,
                         searchSpread: billsSpread,
+                        ledger: { billsTree: billsTree, pos: pos },
                         resultSpreadSetting: {
                         resultSpreadSetting: {
                             cols: [
                             cols: [
                                 {title: '项目节编号', field: 'code', hAlign: 0, width: 90, formatter: '@'},
                                 {title: '项目节编号', field: 'code', hAlign: 0, width: 90, formatter: '@'},
@@ -329,9 +330,16 @@ $(document).ready(() => {
                             selectedBackColor: '#fffacd',
                             selectedBackColor: '#fffacd',
                             readOnly: true,
                             readOnly: true,
                         },
                         },
-                        afterLocated: function () {
+                        locate: function(cur) {
+                            if (!cur.lid) return;
+
+                            SpreadJsObj.locateTreeNode(billsSheet, cur.lid, true);
                             posSpreadObj.loadCurPosData();
                             posSpreadObj.loadCurPosData();
-                        }
+                            if (cur.pid && cur.pid !== -1) {
+                                const pIndex = posSheet.zh_data.findIndex(x => { return x.id === cur.pid; });
+                                SpreadJsObj.locateRow(posSheet, pIndex);
+                            }
+                        },
                     });
                     });
                 }
                 }
                 searchLedger.spread.refresh();
                 searchLedger.spread.refresh();

+ 10 - 3
app/public/js/settle_gather.js

@@ -176,9 +176,9 @@ $(document).ready(() => {
             tabPanel.addClass('active');
             tabPanel.addClass('active');
             showSideTools(tab.hasClass('active'));
             showSideTools(tab.hasClass('active'));
             if (tab.attr('content') === '#search' && !searchLedger) {
             if (tab.attr('content') === '#search' && !searchLedger) {
-                searchLedger = $.billsSearch({
+                searchLedger = $.ledgerSearch({
                     selector: '#search',
                     selector: '#search',
-                    searchSpread: slSpread,
+                    ledger: { billsTree: settleTree, pos: settlePos },
                     searchOver: true,
                     searchOver: true,
                     searchEmpty: true,
                     searchEmpty: true,
                     keyId: 'tree_id',
                     keyId: 'tree_id',
@@ -201,8 +201,15 @@ $(document).ready(() => {
                         selectedBackColor: '#fffacd',
                         selectedBackColor: '#fffacd',
                         readOnly: true,
                         readOnly: true,
                     },
                     },
-                    afterLocated: function () {
+                    locate: function(cur) {
+                        if (!cur.lid) return;
+
+                        SpreadJsObj.locateTreeNode(slSheet, cur.lid, true);
                         settlePosObj.loadCurPosData();
                         settlePosObj.loadCurPosData();
+                        if (cur.pid && cur.pid !== -1) {
+                            const pIndex = spSheet.zh_data.findIndex(x => { return x.id === cur.pid; });
+                            SpreadJsObj.locateRow(spSheet, pIndex);
+                        }
                     },
                     },
                 });
                 });
                 searchLedger.spread.refresh();
                 searchLedger.spread.refresh();

+ 10 - 3
app/public/js/settle_ledger.js

@@ -281,9 +281,9 @@ $(document).ready(() => {
             tabPanel.addClass('active');
             tabPanel.addClass('active');
             showSideTools(tab.hasClass('active'));
             showSideTools(tab.hasClass('active'));
             if (tab.attr('content') === '#search' && !searchLedger) {
             if (tab.attr('content') === '#search' && !searchLedger) {
-                searchLedger = $.billsSearch({
+                searchLedger = $.ledgerSearch({
                     selector: '#search',
                     selector: '#search',
-                    searchSpread: slSpread,
+                    ledger: { billsTree: settleTree, pos: settlePos },
                     searchOver: true,
                     searchOver: true,
                     searchEmpty: true,
                     searchEmpty: true,
                     keyId: 'tree_id',
                     keyId: 'tree_id',
@@ -306,8 +306,15 @@ $(document).ready(() => {
                         selectedBackColor: '#fffacd',
                         selectedBackColor: '#fffacd',
                         readOnly: true,
                         readOnly: true,
                     },
                     },
-                    afterLocated: function () {
+                    locate: function(cur) {
+                        if (!cur.lid) return;
+
+                        SpreadJsObj.locateTreeNode(slSheet, cur.lid, true);
                         settlePosObj.loadCurPosData();
                         settlePosObj.loadCurPosData();
+                        if (cur.pid && cur.pid !== -1) {
+                            const pIndex = spSheet.zh_data.findIndex(x => { return x.id === cur.pid; });
+                            SpreadJsObj.locateRow(spSheet, pIndex);
+                        }
                     },
                     },
                 });
                 });
                 searchLedger.spread.refresh();
                 searchLedger.spread.refresh();

+ 10 - 3
app/public/js/settle_select.js

@@ -408,9 +408,9 @@ $(document).ready(() => {
             tabPanel.addClass('active');
             tabPanel.addClass('active');
             showSideTools(tab.hasClass('active'));
             showSideTools(tab.hasClass('active'));
             if (tab.attr('content') === '#search' && !searchLedger) {
             if (tab.attr('content') === '#search' && !searchLedger) {
-                searchLedger = $.billsSearch({
+                searchLedger = $.ledgerSearch({
                     selector: '#search',
                     selector: '#search',
-                    searchSpread: slSpread,
+                    ledger: { billsTree: settleTree, pos: settlePos },
                     searchOver: true,
                     searchOver: true,
                     searchEmpty: true,
                     searchEmpty: true,
                     resultSpreadSetting: {
                     resultSpreadSetting: {
@@ -432,8 +432,15 @@ $(document).ready(() => {
                         selectedBackColor: '#fffacd',
                         selectedBackColor: '#fffacd',
                         readOnly: true,
                         readOnly: true,
                     },
                     },
-                    afterLocated: function () {
+                    locate: function(cur) {
+                        if (!cur.lid) return;
+
+                        SpreadJsObj.locateTreeNode(slSheet, cur.lid, true);
                         settlePosObj.loadCurPosData();
                         settlePosObj.loadCurPosData();
+                        if (cur.pid && cur.pid !== -1) {
+                            const pIndex = spSheet.zh_data.findIndex(x => { return x.id === cur.pid; });
+                            SpreadJsObj.locateRow(spSheet, pIndex);
+                        }
                     },
                     },
                     customSearch: [
                     customSearch: [
                         {
                         {

+ 146 - 0
app/public/js/shares/cs_tools.js

@@ -765,6 +765,152 @@ const showSelectTab = function(select, spread, afterShow) {
         });
         });
         return {spread: resultSpread};
         return {spread: resultSpread};
     };
     };
+    $.ledgerSearch = function (setting) {
+        if (!setting.selector || !setting.ledger || !setting.resultSpreadSetting) return;
+        if (!setting.ledger.billsTree) return;
+        if (!setting.ledger.pos && !setting.ledger.getLedgerPos) return;
+        if (!setting.searchRangeStr) setting.searchRangeStr = '项目节编号/清单编号/名称/台账数量';
+        if (!setting.keyId) setting.keyId = 'ledger_id';
+        const ledger = setting.ledger;
+        const resultId = setting.id + '-search-result';
+        const obj = $(setting.selector);
+        let filter = [];
+        if (setting.searchOver || setting.searchEmpty) {
+            filter.push('<select class="input-group-text" id="search-filter">');
+            filter.push('<option value="">台账</option>');
+            if (setting.customSearch) {
+                for (const cs of setting.customSearch) {
+                    if (cs.valid) filter.push('<option value="' + cs.key + '">' + cs.title + '</option>');
+                }
+            }
+            filter.push('</select>');
+        }
+        obj.html(
+            '                        <div class="sjs-bar">\n' +
+            '                            <div class="input-group input-group-sm pb-1">\n' +
+            '                                <div class="input-group-prepend">\n' +
+            filter.join('') +
+            '                                </div>' +
+            '                                <input id="searchKeyword" type="text" class="form-control" autocomplete="off" placeholder="可查找 ' + setting.searchRangeStr + '" aria-label="Recipient\'s username" aria-describedby="button-addon2">\n' +
+            '                                <div class="input-group-append">\n' +
+            '                                    <button class="btn btn-outline-secondary" type="button"">搜索</button>\n' +
+            '                                </div>\n' +
+            '                            </div>\n' +
+            '                        </div>\n' +
+            '                        <div id="' + resultId + '" class="sjs-sh">\n' +
+            '                        </div>'
+        );
+        autoFlashHeight();
+        const resultSpread = SpreadJsObj.createNewSpread($('#' + resultId)[0]);
+        SpreadJsObj.initSheet(resultSpread.getActiveSheet(), setting.resultSpreadSetting);
+        const searchSheet = setting.searchSpread.getActiveSheet();
+        let searchResult = [];
+        const defaultCheck = function(node, keyword) {
+            const keyNum = _.toNumber(keyword);
+            return (node.code && node.code.indexOf(keyword) > -1) ||
+                (node.b_code && node.b_code.indexOf(keyword) > -1) ||
+                (node.name && node.name.indexOf(keyword) > -1) ||
+                (!_.isNaN(keyNum) && checkZero(ZhCalc.sub(keyNum, node.quantity)));
+        };
+        const getCheckFun = function (key) {
+            const cs = setting.customSearch.find(function (x) {return x.key === key});
+            return cs ? [cs.billsCheck, cs.posCheck] : [null, null];
+        };
+        const search = function () {
+            const filter = $('#search-filter').val();
+            const [billsCheck, posCheck] = filter ? getCheckFun(filter) : [null, null];
+            searchCustom(billsCheck || defaultCheck, posCheck || defaultCheck);
+        };
+        const get18Bw = function(tree, data) {
+            let parent = tree.getParent(data);
+            while (parent && (!parent.code || /^[a-zA-Z]/.test(parent.code || ''))) {
+                parent = tree.getParent(parent);
+            }
+            return parent ? parent.name : '';
+        };
+        const get08Bw = function(tree, data) {
+            let parent = tree.getParent(data);
+            let lastXmj = '', level4Xmj = '';
+            while (parent) {
+                if (parent.code && !lastXmj) lastXmj = parent.name;
+                if (parent.code && parent.level === 4) level4Xmj = parent.name;
+                parent = tree.getParent(parent);
+            }
+            return level4Xmj || lastXmj;
+        };
+        const getBw = function (data) {
+            if (!data.b_code) return '';
+
+            const sortTree = ledger.billsTree;
+            if (!sortTree.checkCodeType) return '';
+
+            if (sortTree.checkCodeType() === '18') {
+                return get18Bw(sortTree, data)
+            } else {
+                return get08Bw(sortTree, data);
+            }
+        };
+        const searchCustom = function (billsCheckFun, posCheckFun) {
+            const keyword = $('#searchKeyword', obj).val();
+
+            searchResult = [];
+            for (const node of ledger.billsTree.nodes) {
+                if (billsCheckFun(node, keyword)) {
+                    const convertData = { lid: node[ledger.billsTree.setting.id], pid: -1 };
+                    for (const col of setting.resultSpreadSetting.cols) {
+                        if (col.field === 'bw') {
+                            convertData.bw = getBw(node);
+                        } else {
+                            convertData[col.field] = node[col.field];
+                        }
+                    }
+                    searchResult.push(data);
+                }
+                const posRange = ledger.pos ? ledger.pos.getLedgerPos(node.id) : ledger.getLedgerPos(node);
+                if (!posRange || posRange.length === 0) continue;
+                for (const p of posRange) {
+                    if (posCheckFun(p, keyword)) {
+                        const convertData = { lid: node[ledger.billsTree.setting.id], pid: p[ledger.pos.setting.id] };
+                        for (const col of setting.resultSpreadSetting.cols) {
+                            convertData[col.field] = p[col.field];
+                        }
+                        searchResult.push(convertData);
+                    }
+                }
+            }
+            calculateCompletePercent(searchResult);
+            calculateSum();
+            SpreadJsObj.loadSheetData(resultSpread.getActiveSheet(), 'data', searchResult);
+        };
+        const calculateSum = function () {
+            if (!searchResult || searchResult.length === 0 || !setting.calcSum) return;
+
+            const sum = setting.calcSum(searchResult);
+            if (sum) searchResult.unshift(sum);
+        };
+        const calculateCompletePercent = function (searchResult) {
+            if (!searchResult) return;
+            for (const sr of searchResult) {
+                const base = ZhCalc.add(sr.total_price, sr.end_qc_tp);
+                sr.complete_percent = base !== 0 ? ZhCalc.mul(ZhCalc.div(sr.end_gather_tp, base), 100, 2) : 0;
+            }
+        };
+
+        $('input', obj).bind('keydown', function (e) {
+            if (e.keyCode == 13) search();
+        });
+        $('button', obj).bind('click', () => {search()});
+        resultSpread.getActiveSheet().bind(spreadNS.Events.CellDoubleClick, function (e, info) {
+            const sheet = info.sheet;
+            const data = sheet.zh_data;
+            if (!data) { return }
+
+            const curBills = data[info.row];
+            if (!curBills) return;
+            setting.locate(curBills);
+        });
+        return {spread: resultSpread};
+    };
 
 
     $.xmjSearch = function (setting) {
     $.xmjSearch = function (setting) {
         if (!setting.selector || !setting.searchSpread) return;
         if (!setting.selector || !setting.searchSpread) return;

+ 13 - 3
app/public/js/sr_detail.js

@@ -215,6 +215,7 @@ $(document).ready(() => {
 
 
     // 初始化 台账 spread
     // 初始化 台账 spread
     const slSpread = SpreadJsObj.createNewSpread($('#stage-ledger')[0]);
     const slSpread = SpreadJsObj.createNewSpread($('#stage-ledger')[0]);
+    const slSheet = slSpread.getActiveSheet();
     customizeStageTreeSetting(ledgerSpreadSetting, customColDisplay());
     customizeStageTreeSetting(ledgerSpreadSetting, customColDisplay());
     const ratioCol = ledgerSpreadSetting.cols.find(x => {return x.field === 'end_final_1_percent' || x.field === 'end_correct_1_percent'});
     const ratioCol = ledgerSpreadSetting.cols.find(x => {return x.field === 'end_final_1_percent' || x.field === 'end_correct_1_percent'});
     if (ratioCol) ratioCol.field = tenderInfo.display.stage.correct ? 'end_correct_1_percent' : 'end_final_1_percent';
     if (ratioCol) ratioCol.field = tenderInfo.display.stage.correct ? 'end_correct_1_percent' : 'end_final_1_percent';
@@ -288,6 +289,7 @@ $(document).ready(() => {
 
 
     // 初始化 计量单元 Spread
     // 初始化 计量单元 Spread
     const spSpread = SpreadJsObj.createNewSpread($('#stage-pos')[0]);
     const spSpread = SpreadJsObj.createNewSpread($('#stage-pos')[0]);
+    const spSheet = spSpread.getActiveSheet();
     const spCol = _.find(posSpreadSetting.cols, {field: 'qc_qty'});
     const spCol = _.find(posSpreadSetting.cols, {field: 'qc_qty'});
     spCol.cellType = 'activeImageBtn';
     spCol.cellType = 'activeImageBtn';
     spCol.normalImg = '#ellipsis-icon';
     spCol.normalImg = '#ellipsis-icon';
@@ -1057,9 +1059,9 @@ $(document).ready(() => {
             tabPanel.addClass('active');
             tabPanel.addClass('active');
             showSideTools(tab.hasClass('active'));
             showSideTools(tab.hasClass('active'));
             if (tab.attr('content') === '#search' && !searchLedger) {
             if (tab.attr('content') === '#search' && !searchLedger) {
-                searchLedger = $.billsSearch({
+                searchLedger = $.ledgerSearch({
                     selector: '#search',
                     selector: '#search',
-                    searchSpread: slSpread,
+                    ledger: { billsTree: stageTree, pos: stagePos },
                     searchOver: true,
                     searchOver: true,
                     searchEmpty: true,
                     searchEmpty: true,
                     resultSpreadSetting: {
                     resultSpreadSetting: {
@@ -1082,8 +1084,16 @@ $(document).ready(() => {
                         font: '12px 微软雅黑',
                         font: '12px 微软雅黑',
                         selectedBackColor: '#fffacd',
                         selectedBackColor: '#fffacd',
                     },
                     },
-                    afterLocated: function () {
+                    locate: function(cur) {
+                        if (!cur.lid) return;
+
+                        SpreadJsObj.locateTreeNode(slSheet, cur.lid, true);
                         stagePosSpreadObj.loadCurPosData();
                         stagePosSpreadObj.loadCurPosData();
+                        // stageTreeSpreadObj.loadRelaData();
+                        if (cur.pid && cur.pid !== -1) {
+                            const pIndex = spSheet.zh_data.findIndex(x => { return x.id === cur.pid; });
+                            SpreadJsObj.locateRow(spSheet, pIndex);
+                        }
                     },
                     },
                     customSearch: [
                     customSearch: [
                         {
                         {

+ 13 - 4
app/public/js/stage.js

@@ -733,6 +733,7 @@ $(document).ready(() => {
 
 
     // 初始化 台账 spread
     // 初始化 台账 spread
     const slSpread = SpreadJsObj.createNewSpread($('#stage-ledger')[0]);
     const slSpread = SpreadJsObj.createNewSpread($('#stage-ledger')[0]);
+    const slSheet = slSpread.getActiveSheet();
     customizeStageTreeSetting(ledgerSpreadSetting, customColDisplay());
     customizeStageTreeSetting(ledgerSpreadSetting, customColDisplay());
     // 数量变更列,添加按钮
     // 数量变更列,添加按钮
     const qcColShowImage = function (data) {
     const qcColShowImage = function (data) {
@@ -841,6 +842,7 @@ $(document).ready(() => {
 
 
     // 初始化 计量单元 Spread
     // 初始化 计量单元 Spread
     const spSpread = SpreadJsObj.createNewSpread($('#stage-pos')[0]);
     const spSpread = SpreadJsObj.createNewSpread($('#stage-pos')[0]);
+    const spSheet = spSpread.getActiveSheet();
     const posQcColShowImage = function (data) {
     const posQcColShowImage = function (data) {
         return data !== undefined && data !== null;
         return data !== undefined && data !== null;
     };
     };
@@ -4599,9 +4601,9 @@ $(document).ready(() => {
             tabPanel.addClass('active');
             tabPanel.addClass('active');
             showSideTools(tab.hasClass('active'));
             showSideTools(tab.hasClass('active'));
             if (tab.attr('content') === '#search' && !searchLedger) {
             if (tab.attr('content') === '#search' && !searchLedger) {
-                searchLedger = $.billsSearch({
+                searchLedger = $.ledgerSearch({
                     selector: '#search',
                     selector: '#search',
-                    searchSpread: slSpread,
+                    ledger: { billsTree: stageTree, pos: stagePos },
                     searchOver: true,
                     searchOver: true,
                     searchEmpty: true,
                     searchEmpty: true,
                     resultSpreadSetting: {
                     resultSpreadSetting: {
@@ -4625,8 +4627,15 @@ $(document).ready(() => {
                         selectedBackColor: '#fffacd',
                         selectedBackColor: '#fffacd',
                         readOnly: true,
                         readOnly: true,
                     },
                     },
-                    afterLocated: function () {
-                        stagePosSpreadObj.loadCurPosData();
+                    locate: function(cur) {
+                        if (!cur.lid) return;
+
+                        SpreadJsObj.locateTreeNode(slSheet, cur.lid, true);
+                        stageTreeSpreadObj.loadRelaData();
+                        if (cur.pid && cur.pid !== -1) {
+                            const pIndex = spSheet.zh_data.findIndex(x => { return x.id === cur.pid; });
+                            SpreadJsObj.locateRow(spSheet, pIndex);
+                        }
                     },
                     },
                     customSearch: [
                     customSearch: [
                         {
                         {