瀏覽代碼

Merge branch 'dev' of http://192.168.1.41:3000/maixinrong/Calculation into dev

laiguoran 3 年之前
父節點
當前提交
0bcc26c479

+ 6 - 0
app/const/spread.js

@@ -229,6 +229,8 @@ const stageTz = {
         defaultRowHeight: 21,
         headerFont: '12px 微软雅黑',
         font: '12px 微软雅黑',
+        frozenColCount: 5,
+        frozenLineColor: '#93b5e4',
     },
     pos: {
         cols: [
@@ -308,6 +310,8 @@ const stageCl = {
         defaultRowHeight: 21,
         headerFont: '12px 微软雅黑',
         font: '12px 微软雅黑',
+        frozenColCount: 5,
+        frozenLineColor: '#93b5e4',
     },
     pos: {
         cols: [
@@ -387,6 +391,8 @@ const stageNoCl = {
         defaultRowHeight: 21,
         headerFont: '12px 微软雅黑',
         font: '12px 微软雅黑',
+        frozenColCount: 5,
+        frozenLineColor: '#93b5e4',
     },
     pos: {
         cols: [

+ 2 - 1
app/controller/budget_controller.js

@@ -205,7 +205,7 @@ module.exports = app => {
                     {title: '项目节编号', colSpan: '1', rowSpan: '2', field: 'code', hAlign: 0, width: 180, formatter: '@', cellType: 'tree'},
                     {title: '清单编号', colSpan: '1', rowSpan: '2', field: 'b_code', hAlign: 0, width: 120, formatter: '@'},
                     {title: '名称', colSpan: '1', rowSpan: '2', field: 'name', hAlign: 0, width: 230, formatter: '@'},
-                    {title: '单位', colSpan: '1', rowSpan: '2', field: 'unit', hAlign: 1, width: 50, formatter: '@', cellType: 'unit'},
+                    {title: '单位', colSpan: '1', rowSpan: '2', field: 'unit', hAlign: 1, width: 50, formatter: '@', cellType: 'unit', comboEdit: true},
                     {title: '设计数量|数量1', colSpan: '2|1', rowSpan: '1|1', field: 'dgn_qty1', hAlign: 2, width: 80, type: 'Number'},
                     {title: '|数量2', colSpan: '|1', rowSpan: '|1', field: 'dgn_qty2', hAlign: 2, width: 80, type: 'Number'},
                     {title: '经济指标', colSpan: '1', rowSpan: '2', field: 'dgn_price', hAlign: 2, width: 80, type: 'Number', readOnly: true},
@@ -221,6 +221,7 @@ module.exports = app => {
                 defaultRowHeight: 21,
                 headerFont: '12px 微软雅黑',
                 font: '12px 微软雅黑',
+                localCache: { key: 'budget', colWidth: true },
             };
             if (!needGcl) {
                 spreadSetting.cols = spreadSetting.cols.filter(x => {

+ 2 - 1
app/controller/stage_controller.js

@@ -522,7 +522,8 @@ module.exports = app => {
                 }
                 const bills = data.bills ? data.bills : await ctx.service.ledger.getDataById(data.pos.lid);
                 const pos = data.pos;
-                const changes = await ctx.service.change.getValidChanges(ctx.tender, ctx.stage, data);
+                const projectFunInfo = await this.ctx.service.project.getFunRela(ctx.session.sessionProject.id);
+                const changes = await ctx.service.change.getValidChanges(ctx.tender, ctx.stage, data, projectFunInfo.minusNoValue && ctx.tender.info.fun_rela.stage_change.minusNoValue);
                 const useChanges = ctx.stage.readOnly
                     ? await ctx.service.stageChange.getAuditorStageData(ctx.tender.id, ctx.stage.id, ctx.stage.curTimes, ctx.stage.curOrder, bills.id, pos ? pos.id : -1)
                     : await ctx.service.stageChange.getLastestStageData(ctx.tender.id, ctx.stage.id, bills.id, pos ? pos.id : -1);

+ 26 - 15
app/public/js/budget_compare.js

@@ -35,6 +35,10 @@ $(document).ready(() => {
         headerFont: '12px 微软雅黑',
         font: '12px 微软雅黑',
         readOnly: true,
+        frozenColCount: 3,
+        frozenLineColor: '#93b5e4',
+        localCache: { key: 'budget-compare', colWidth: true },
+
     };
     sjsSettingObj.setFxTreeStyle(spreadSetting, sjsSettingObj.FxTreeStyle.jz);
     SpreadJsObj.initSheet(compareSheet, spreadSetting);
@@ -59,6 +63,20 @@ $(document).ready(() => {
                 SpreadJsObj.reLoadSheetHeader(compareSheet);
             };
         },
+        expand(tree, tag) {
+            switch (tag) {
+                case "1":
+                case "2":
+                case "3":
+                case "4":
+                case "5":
+                    tree.expandByLevel(parseInt(tag));
+                    break;
+                case "last":
+                    tree.expandByCustom(() => { return true; });
+                    break;
+            }
+        },
         loadBudgetData(result) {
             const compareTree = createNewPathTree('final', {
                 id: 'id',
@@ -116,6 +134,8 @@ $(document).ready(() => {
                 if (!y.name) return 1;
                 return x.name.localeCompare(y.name);
             });
+            const expandTag = getLocalCache('revise-compare-level');
+            if (expandTag) compareObj.expand(compareTree, expandTag);
             SpreadJsObj.loadSheetData(compareSheet, SpreadJsObj.DataType.Tree, compareTree);
         },
         loadFinalData(result, msg) {
@@ -131,9 +151,11 @@ $(document).ready(() => {
                 rootId: -1,
             });
             finalTree.loadDatas(result.final);
+            const expandTag = getLocalCache('revise-compare-level');
+            if (expandTag) compareObj.expand(finalTree, expandTag);
             SpreadJsObj.loadSheetData(compareSheet, SpreadJsObj.DataType.Tree, finalTree);
             if (sfSelect) sfSelect.reloadSelect(this.finalInfo.tender);
-        }
+        },
     };
 
     function compareCode(str1, str2, symbol = '-') {
@@ -203,20 +225,9 @@ $(document).ready(() => {
             const tree = sheet.zh_tree;
             setTimeout(() => {
                 showWaitingView();
-                switch (tag) {
-                    case "1":
-                    case "2":
-                    case "3":
-                    case "4":
-                    case "5":
-                        tree.expandByLevel(parseInt(tag));
-                        SpreadJsObj.refreshTreeRowVisible(sheet);
-                        break;
-                    case "last":
-                        tree.expandByCustom(() => { return true; });
-                        SpreadJsObj.refreshTreeRowVisible(sheet);
-                        break;
-                }
+                compareObj.expand(tree, tag);
+                SpreadJsObj.refreshTreeRowVisible(sheet);
+                setLocalCache('revise-compare-level', tag);
                 closeWaitingView();
             }, 100);
         });

+ 13 - 9
app/public/js/spreadjs_rela/spreadjs_zh.js

@@ -304,15 +304,17 @@ const SpreadJsObj = {
      * @param {GC.Spread.Sheets.Worksheet} sheet
      */
     _initSheetHeader: function (sheet) {
-        if (!sheet.zh_setting || !sheet.zh_setting.cols) { return; }
+        const setting = sheet.zh_setting;
+        if (!setting || !setting.cols) { return; }
 
-        sheet.setColumnCount(sheet.zh_setting.cols.length);
-        sheet.setRowCount(sheet.zh_setting.headRows, spreadNS.SheetArea.colHeader);
-        for (let iRow = 0; iRow < sheet.zh_setting.headRowHeight.length; iRow ++) {
-            sheet.setRowHeight(iRow, sheet.zh_setting.headRowHeight[iRow], spreadNS.SheetArea.colHeader);
+
+        sheet.setColumnCount(setting.cols.length);
+        sheet.setRowCount(setting.headRows, spreadNS.SheetArea.colHeader);
+        for (let iRow = 0; iRow < setting.headRowHeight.length; iRow ++) {
+            sheet.setRowHeight(iRow, setting.headRowHeight[iRow], spreadNS.SheetArea.colHeader);
         }
-        for (let iCol = 0; iCol < sheet.zh_setting.cols.length; iCol++) {
-            const col = sheet.zh_setting.cols[iCol];
+        for (let iCol = 0; iCol < setting.cols.length; iCol++) {
+            const col = setting.cols[iCol];
             const title = col.title.split('|');
             const colSpan = col.colSpan ? col.colSpan.split('|'): ['1'], rowSpan = col.rowSpan ? col.rowSpan.split('|'): ['1'];
             for (let i = 0; i < title.length; i++) {
@@ -329,9 +331,11 @@ const SpreadJsObj = {
         }
         sheet.rowOutlines.direction(spreadNS.Outlines.OutlineDirection.backward);
         sheet.showRowOutline(false);
-        if (sheet.zh_setting.defaultRowHeight) {
-            sheet.defaults.rowHeight = sheet.zh_setting.defaultRowHeight;
+        if (setting.defaultRowHeight) {
+            sheet.defaults.rowHeight = setting.defaultRowHeight;
         }
+        if (setting.frozenLineColor) sheet.options.frozenlineColor = setting.frozenLineColor;
+        if (setting.frozenColCount) sheet.frozenColumnCount(setting.frozenColCount);
     },
     reinitSheetHeader: function (sheet) {
         this.beginMassOperation(sheet);

+ 6 - 2
app/public/js/stage.js

@@ -729,8 +729,6 @@ $(document).ready(() => {
         return data.lock || false;
     };
     SpreadJsObj.initSheet(slSpread.getActiveSheet(), ledgerSpreadSetting);
-    slSpread.getActiveSheet().frozenColumnCount(5);
-    slSpread.getActiveSheet().options.frozenlineColor = '#93b5e4';
 
     //初始化所有附件列表
     getAllList();
@@ -3763,6 +3761,12 @@ $(document).ready(() => {
                                 const node = stageTree.nodes.find(x => {return x.id === changeBills.gcl_id});
                                 SpreadJsObj.locateTreeNode(slSpread.getActiveSheet(), node.ledger_id, true);
                                 stagePosSpreadObj.loadCurPosData();
+                                console.log(changeBills);
+                                const posData = spSpread.getActiveSheet().zh_data;
+                                if (!posData || posData.length === 0) return;
+
+                                const changePos = posData.find(x => { return x.name === changeBills.bwmx; });
+                                if (changePos) SpreadJsObj.locateData(spSpread.getActiveSheet(), changePos);
                             } else {
                                 const cb = {
                                     b_code: changeBills.code || '',

+ 2 - 0
app/reports/rpt_component/jpc_flow_tab.js

@@ -1361,6 +1361,8 @@ JpcFlowTabSrv.prototype.createNew = function() {
     };
     JpcFlowTabResult.checkCombineEvent = function($RUN_TYPE, $VER_COMB_ARRAY, $HOR_COMB_ARRAY, $CURRENT_CELL_ITEMS, $CURRENT_RPT, $CURRENT_DATA) {
         if ($CURRENT_RPT.formulas) {
+            const $JE = JE;
+            const $JV = JV;
             for (let execFmlIdx = 0; execFmlIdx < $CURRENT_RPT.formulas.length; execFmlIdx++) {
                 if ($CURRENT_RPT.formulas[execFmlIdx][JV.PROP_RUN_TYPE] === $RUN_TYPE) {
                     const expression = $CURRENT_RPT.formulas[execFmlIdx][JV.PROP_EXPRESSION];

+ 13 - 6
app/service/change.js

@@ -1190,7 +1190,7 @@ module.exports = app => {
          * @param pos - 查询的部位
          * @return {Promise<*>} - 可用的变更令列表
          */
-        async getValidChanges(tender, stage, data) {
+        async getValidChanges(tender, stage, data, minusNoValue) {
             const bills = data.bills, pos = data.pos;
             const self = this;
             const getFilterPart = function(field, value) {
@@ -1220,11 +1220,18 @@ module.exports = app => {
                 '  ORDER BY c.in_time';
             const sqlParam = [tender.id, stage.order, tender.id, audit.flow.status.checked];
             let changes = await this.db.query(sql, sqlParam);
-            if (data.minus) {
-                changes = changes.filter(c => {
-                    c.bamount = c.b_amount ? parseFloat(c.b_amount) : 0;
-                    return c.bamount < 0;
-                })
+            if (minusNoValue) {
+                if (data.minus) {
+                    changes = changes.filter(c => {
+                        c.bamount = c.b_amount ? parseFloat(c.b_amount) : 0;
+                        return c.bamount < 0;
+                    });
+                } else {
+                    changes = changes.filter(c => {
+                        c.bamount = c.b_amount ? parseFloat(c.b_amount) : 0;
+                        return c.bamount >= 0;
+                    });
+                }
             }
             for (const c of changes) {
                 let sSql = 'SELECT * FROM ' + this.ctx.service.stageChange.tableName + ' WHERE sid = ? and cbid = ?';

+ 1 - 0
app/service/ledger.js

@@ -686,6 +686,7 @@ module.exports = app => {
             const analysisExcel = new AnalysisExcel(this.ctx, this.setting);
             const tempData = await this.ctx.service.tenderNodeTemplate.getData(templateId, true);
             const cacheTree = analysisExcel.analysisData(excelData, tempData, { filterZeroGcl: filter });
+            cacheTree.calculateLeafWithPos();
             const transaction = await this.db.beginTransaction();
             try {
                 await transaction.delete(this.tableName, { tender_id: this.ctx.tender.id });

+ 1 - 0
app/service/stage.js

@@ -545,6 +545,7 @@ module.exports = app => {
                 await transaction.delete(this.ctx.service.stageAudit.tableName, { sid: id });
                 await transaction.delete(this.ctx.service.stageBills.tableName, { sid: id });
                 await transaction.delete(this.ctx.service.stageChange.tableName, { sid: id });
+                await transaction.delete(this.ctx.service.stageChangeFinal.tableName, { sid: id });
                 await transaction.delete(this.ctx.service.stageImportChange.tableName, { sid: id });
                 await transaction.delete(this.ctx.service.stagePos.tableName, { sid: id });
                 await transaction.delete(this.ctx.service.stageDetail.tableName, { sid: id });

+ 1 - 0
app/service/stage_bills_final.js

@@ -108,6 +108,7 @@ module.exports = app => {
                 p.sid = stage.id;
                 p.sorder = stage.order;
             }
+            await transaction.delete(this.tableName, { tid: tender.id, sid: stage.id });
             await transaction.insert(this.tableName, cur ? cur.concat(pre) : pre);
         }
 

+ 2 - 2
app/service/stage_change.js

@@ -37,7 +37,7 @@ module.exports = app => {
          * @return {Promise<*>}
          */
         async getLastestStageData(tid, sid, lid, pid, noValue) {
-            const filter = noValue !== undefined ? 'And no_value = ?' : '';
+            const filter = noValue !== undefined ? ' And no_value = ?' : '';
             const sql = 'SELECT c.*,' +
                 '  oc.p_code As c_code, oc.new_code As c_new_code' +
                 '  FROM ' + this.tableName + ' As c ' +
@@ -68,7 +68,7 @@ module.exports = app => {
          * @return {Promise<*>}
          */
         async getAuditorStageData(tid, sid, times, order, lid, pid, noValue) {
-            const filter = noValue !== undefined ? 'And no_value = ?' : '';
+            const filter = noValue !== undefined ? ' And no_value = ?' : '';
             const sql = 'SELECT c.*,' +
                 '  oc.p_code As c_code, oc.new_code As c_new_code, oc.quality, ocb.code as b_code, ocb.name, ocb.unit' +
                 '  FROM ' + this.tableName + ' As c ' +

+ 1 - 0
app/service/stage_change_final.js

@@ -67,6 +67,7 @@ module.exports = app => {
                     qty: c.qty, minus: c.minus, no_value: c.no_value,
                 });
             }
+            await transaction.delete(this.tableName, { tid: tender.id, sid: stage.id });
             if (data.length > 0) await transaction.insert(this.tableName, data);
         }
 

+ 1 - 0
app/service/stage_pos_final.js

@@ -85,6 +85,7 @@ module.exports = app => {
                 p.sid = stage.id;
                 p.sorder = stage.order;
             }
+            await transaction.delete(this.tableName, { tid: tender.id, sid: stage.id });
             await transaction.insert(this.tableName, cur ? cur.concat(pre) : pre);
         }