Browse Source

Merge branch 'master' of http://192.168.1.41:3000/maixinrong/Calculation

TonyKang 5 years ago
parent
commit
59badd8edc

+ 3 - 3
app/const/spread.js

@@ -428,8 +428,8 @@ const stageCompare = {
             {title: '单价', colSpan: '1', rowSpan: '2', field: 'unit_price', hAlign: 2, width: 60, type: 'Number'},
         ],
         extraCols: [
-            {title: '%s|数量', colSpan: '2|1', rowSpan: '1|1', field: 'gather_qty%s', hAlign: 2, width: 60, formatter: '@'},
-            {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'gather_tp%s', hAlign: 2, width: 60, formatter: '@'},
+            {title: '%s|数量', colSpan: '2|1', rowSpan: '1|1', field: 'gather_qty%s', hAlign: 2, width: 60, type: 'Number'},
+            {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'gather_tp%s', hAlign: 2, width: 60, type: 'Number'},
         ],
         emptyRows: 3,
         headRows: 2,
@@ -444,7 +444,7 @@ const stageCompare = {
             {title: '名称', colSpan: '1', rowSpan: '1', field: 'name', hAlign: 0, width: 230, formatter: '@'},
         ],
         extraCols: [
-            {title: '%s', colSpan: '1', rowSpan: '1', field: 'gather_qty%s', hAlign: 2, width: 60, formatter: '@'},
+            {title: '%s', colSpan: '1', rowSpan: '1', field: 'gather_qty%s', hAlign: 2, width: 60, type: 'Number'},
         ],
         emptyRows: 3,
         headRows: 1,

+ 1 - 1
app/controller/report_controller.js

@@ -180,7 +180,7 @@ module.exports = app => {
                 await encodeSignatureDataUri(roleRel, this.app.baseDir);
                 await encodeDummySignatureDataUri(pageRst, this.app.baseDir);
                 // console.log('encodeSignatureDataUri!');
-                ctx.body = { data: pageRst, signatureRelInfo: roleRel, stageAudit: stgAudit };
+                ctx.body = { data: pageRst, signatureRelInfo: roleRel, stageAudit: stgAudit, debugInfo: ctx.app.config.is_debug ? ctx.debugInfo : null };
                 // ctx.body = { data: { msg: 'test the network' } };
                 ctx.status = 201;
             } catch (ex) {

+ 2 - 20
app/controller/stage_controller.js

@@ -1110,25 +1110,6 @@ module.exports = app => {
          * @returns {Promise<void>}
          */
         async compare(ctx) {
-            function getCompareSpreadSetting () {
-                function setColFormat(cols, field, formatter) {
-                    const filterCols = cols.filter(function (c) {
-                        return c.field.search(field) !== -1;
-                    });
-                    for (const col of filterCols) {
-                        col.formatter = formatter;
-                    }
-                }
-                const tpFormatter = ctx.helper.getNumberFormatter(ctx.tender.info.decimal.tp);
-                const upFormatter = ctx.helper.getNumberFormatter(2);
-                const ledger = JSON.parse(JSON.stringify(spreadConst.stageCompare.ledger));
-                setColFormat(ledger.baseCols, 'unit_price', upFormatter);
-                setColFormat(ledger.extraCols, 'total_price', tpFormatter);
-                setColFormat(ledger.extraCols, 'tp', tpFormatter);
-
-                const pos = JSON.parse(JSON.stringify(spreadConst.stageCompare.pos));
-                return [ledger, pos];
-            }
             try {
                 await this._getStageAuditViewData(ctx);
                 const renderData = await this._getDefaultRenderData(ctx);
@@ -1137,7 +1118,8 @@ module.exports = app => {
                 } else {
                     renderData.compareAuditors = ctx.stage.auditors;
                 }
-                [renderData.ledgerSpread, renderData.posSpread] = getCompareSpreadSetting();
+                renderData.ledgerSpread = JSON.parse(JSON.stringify(spreadConst.stageCompare.ledger));
+                renderData.posSpread = JSON.parse(JSON.stringify(spreadConst.stageCompare.pos));
                 renderData.jsFiles = this.app.jsFiles.common.concat(this.app.jsFiles.stage.compare);
                 await this.layout('stage/compare.ejs', renderData, 'stage/compare_modal.ejs');
             } catch (err) {

+ 15 - 1
app/extend/helper.js

@@ -431,7 +431,7 @@ module.exports = {
             const num = parseInt(codePath[0]);
             return this.mul(this.div(num, 100, 0), 100) + '';
         } else {
-            return '';
+            return '10000';
         }
     },
 
@@ -902,5 +902,19 @@ module.exports = {
                 body: this.ctx.session.body,
             }));
         }
+    },
+
+    /**
+     * 添加debug信息
+     * 在debug模式下,debug信息将传输到浏览器并打印
+     *
+     * @param {String}key
+     * @param {*}data
+     */
+    addDebugInfo(key, data) {
+        if (!this.ctx.debugInfo) {
+            this.ctx.debugInfo = {};
+        }
+        this.ctx.debugInfo[key] = data;
     }
 };

+ 77 - 6
app/lib/rpt_data_analysis.js

@@ -221,7 +221,6 @@ const gatherChapter = {
     },
     customSetting1: {
         count: 7,
-        other: 1,
         gclSum: {
             name: '第100章至700章清单合计',
             order: 1,
@@ -467,8 +466,8 @@ const join = {
             {main: 'unit_price', sub: 'unit_price',type: 'number'},
         ],
         importFields: [
-            {main: 'ex_value1', sub: 'quantity', type: 'number'},
-            {main: 'ex_value2', sub: 'total_price', type: 'number'}
+            {main: 'ex_value1', sub: 'quantity', type: 'sum'},
+            {main: 'ex_value2', sub: 'total_price', type: 'sum'}
         ],
         joinType: 'outer', //'outer', 'main', 'sub', 'inner',
     },
@@ -511,7 +510,12 @@ const join = {
                 result.push(r);
             }
             for (const i of options.importFields) {
-                r[i.main] = s[i.sub];
+                //r[i.main] = s[i.sub];
+                if (i.type === 'sum') {
+                    r[i.main] = ctx.helper.add(r[i.main], s[i.sub]);
+                } else {
+                    r[i.main] =  s[i.sub];
+                }
             }
         }
         switch (options.joinType) {
@@ -737,7 +741,6 @@ const union = {
     fun: function(ctx, data, fields, options) {
         if (!options || !options.union) return;
 
-        console.log(data.mem_stage_pay);
         const result = [];
         for (const u of options.union) {
             const unionData = data[u.table];
@@ -754,7 +757,74 @@ const union = {
             }
         }
         data.mem_union_data = result;
-        //console.log(data.mem_union_data);
+    }
+};
+const addSumChapter = {
+    name: '添加章级合计',
+    intro: '在排序好的工程量清单列表中,根据清单所属章级,添加章级标题行、合计行',
+    defaultSetting: {
+        table: 'mem_stage_bills',
+        code: 'b_code',
+        chapter: 'chapter',
+        stdChapter: { title: '%s章', sum: '%s章合计'},
+        otherChapter: { title: '其他章', sum: '其他章合计'},
+        sum: { name: '总合计' },
+        fields: ['ex_value1', 'ex_value2', 'end_gather_tp', 'pre_gather_tp', 'gather_tp'],
+    },
+    fun: function (ctx, data, fields, options) {
+        if (!options || !options.table || !options.code || !options.chapter || !options.stdChapter) return;
+
+        const gclData = data[options.table];
+        if (!gclData || !data.tender_info) return;
+
+        const chapters = ctx.helper._.uniq(ctx.helper._.map(gclData, options.chapter));
+        const finalSum = options.sum ? {name: options.sum.name, chapterNum: 100000, chapterPart: 1} : null;
+        for (const chapter of chapters) {
+            const chapterInfo = data.tender_info.chapter.find(function (x) { return x.code === chapter});
+            const chapterOptions = chapterInfo ? options.stdChapter : options.otherChapter;
+            // sum
+            const chapterGcl = gclData.filter(function (x) {
+                return x.chapter === chapter;
+            });
+            const sum = { chapter: chapter, chapterPart: 3, chapterNum: parseInt(chapter) };
+            for (const cg of chapterGcl) {
+                cg.chapterPart = 2;
+                cg.chapterNum = parseInt(cg[options.chapter]);
+                for (const f of options.fields) {
+                    sum[f] = ctx.helper.add(sum[f], cg[f]);
+                    if (finalSum) {
+                        finalSum[f] = ctx.helper.add(finalSum[f], cg[f]);
+                    }
+                }
+            }
+            if (chapterOptions.sum !== undefined) {
+                sum.name = chapterOptions.sum.replace('%s', chapter);
+                gclData.push(sum);
+            }
+            // title
+            if (chapterOptions.title !== undefined) {
+                const title = { chapter: chapter, chapterPart: 1, chapterNum: parseInt(chapter) };
+                if (chapterInfo) {
+                    title[options.code] = options.stdChapter.title.replace('%s', chapter);
+                    title.name = chapterInfo.name;
+                } else {
+                    title.name = chapterOptions.title;
+                }
+                gclData.push(title);
+            }
+        }
+        if (finalSum) {
+            gclData.push(finalSum);
+        }
+        gclData.sort(function (a, b) {
+            if (a.chapter !== b.chapter) {
+                return a.chapterNum - b.chapterNum;
+            } else if (a.chapterPart !== b.chapterPart) {
+                return a.chapterPart - b.chapterPart;
+            } else {
+                return ctx.helper.compareCode(a[options.code], b[options.code]);
+            }
+        });
     }
 };
 
@@ -768,6 +838,7 @@ const analysisObj = {
     filter,
     union,
     gatherStagePay,
+    addSumChapter,
 };
 const analysisDefine = (function (obj) {
     const result = [];

+ 65 - 35
app/public/js/change_set.js

@@ -67,8 +67,8 @@ $(document).ready(() => {
         const unit_price = gcl.unit_price !== null && gcl.unit_price !== undefined ? gcl.unit_price : 0;
         let gclhtml = gcl.leafXmjs !== undefined && gcl.leafXmjs !== null ? ' data-gcl="' + gcl_index + '"': '';
         gcl_index = gclhtml !== '' ? ++gcl_index : gcl_index;
-        // const lid = gcl.leafXmjs !== undefined && gcl.leafXmjs !== null ? gcl.leafXmjs[0].gcl_id : gcl.id;
-        listHtml += '<tr data-lid="' + list_index + '"'+ gclhtml +' data-index="' + list_index + '" data-bwmx="">' +
+        const lid = gcl.leafXmjs !== undefined && gcl.leafXmjs !== null ? gcl.leafXmjs[0].gcl_id : gcl.id;
+        listHtml += '<tr data-lid="' + lid + '"'+ gclhtml +' data-index="' + list_index + '" data-bwmx="">' +
             '<td>' + list_index + '</td>' +
             '<td>' + gcl.code + '</td>' +
             '<td>' + gcl.name + '</td>' +
@@ -96,6 +96,7 @@ $(document).ready(() => {
     //     list_index++;
     // }
     $('#table-list-select').html(listHtml);
+    tableDataRemake(changeListData);
 
     // 上报时按钮点击
     $('a[data-target="#sub-ap"]').on('click', function () {
@@ -232,7 +233,7 @@ $(document).ready(() => {
         if (!isObjEqual(changeInfo, back_changeInfo)) {
             changeFormRemake();
         }
-        if ($('#change-list').val() !== $('#back-change-list').val() ||  $('#change-whitelist').val !== $('#back-change-whitelist').val()) {
+        if ($('#change-list').val() !== $('#back-change-list').val() ||  $('#change-whitelist').val() !== $('#back-change-whitelist').val()) {
             $('#change-list').val($('#back-change-list').val());
             $('#change-whitelist').val($('#back-change-whitelist').val());
             tableDataRemake(changeListData);
@@ -348,7 +349,7 @@ $(document).ready(() => {
 
     // 打开签约清单modal并删除之前的操作
     $('#open-list-modal').click(function () {
-        tableDataRemake(changeListData);
+        // tableDataRemake(changeListData);
     });
 
     // 清单选中和移除
@@ -446,9 +447,10 @@ $(document).ready(() => {
 
     // 取消选中清单
     $('#cancel-list-btn').click(function () {
-        $('#table-list-select tr').removeClass('table-success');
-        $('#table-list-select tr').attr('data-bwmx', '');
-        $('#code-list').html('');
+        // $('#table-list-select tr').removeClass('table-success');
+        // $('#table-list-select tr').attr('data-bwmx', '');
+        // $('#code-list').html('');
+        tableDataRemake(changeListData);
     });
 
     // 移除已选清单并重新编号
@@ -590,43 +592,69 @@ function tableDataRemake(changeListData) {
     // 根据已添加的清单显示
     const changeList = $('#change-list').val().split('^_^');
     if (changeList.length > 0 && changeList[0]) {
-        for (const cl of changeList) {
+        for (const [index,cl] of changeList.entries()) {
             const clinfo = cl.split(';');
-            console.log(clinfo);
-            const listinfo = changeListData[clinfo[8] - 1];
-            // const listinfo = changeListData.find(function (item) {
-            //     return item.b_code === clinfo[0] && item.name === clinfo[1] && item.unit_price === parseFloat(clinfo[4])
-            // });
+            // const listinfo = changeListData[clinfo[8] - 1];
+            let listinfo = changeListData.find(function (item) {
+                return (item.id !== undefined && item.id == clinfo[8]) || (item.id === undefined && item.leafXmjs !== undefined && item.leafXmjs.length !== 0 && item.leafXmjs[0].gcl_id == clinfo[8]);
+            });
             // if (listinfo === undefined) {
             //     toastr.warning('台账清单列表已不存在'+ clinfo[0] +',故删除之');
             //     continue;
             // }
-            console.log(listinfo);
-            $('#table-list-select tr[data-index="'+ clinfo[8] +'"]').addClass('table-success');
-            let pushbwmx = '0;0';
-            if (listinfo.leafXmjs !== undefined) {
-                const leafInfo = listinfo.leafXmjs.find(function (item) {
-                    return (item.bwmx === undefined || item.bwmx === clinfo[2]) && item.quantity === parseFloat(clinfo[5]);
-                });
-                pushbwmx = leafInfo.code + '_' + (leafInfo.bwmx !== undefined ? leafInfo.bwmx : '') + ';' + leafInfo.quantity;
-            } else {
-                pushbwmx = '0;' + (listinfo.quantity !== null ? listinfo.quantity : 0);
-            }
-            const bwmx = $('#table-list-select tr[data-index="'+ clinfo[8] +'"]').attr('data-bwmx');
-            if (bwmx) {
-                const bwmxArray = bwmx.split('$#$');
-                bwmxArray.push(pushbwmx);
-                $('#table-list-select tr[data-index="'+ clinfo[8] +'"]').attr('data-bwmx', bwmxArray.join('$#$'));
+            if (listinfo === undefined) {
+                // 针对旧数据获取清单信息
+                listinfo = changeListData[clinfo[8] - 1];
+                if (listinfo === undefined) {
+                    toastr.warning('台账清单列表已不存在'+ clinfo[0] +',故删除之');
+                    changeList.splice(index, 1);
+                    continue;
+                }
+                $('#table-list-select tr[data-index="'+ clinfo[8] +'"]').addClass('table-success');
+                let pushbwmx = '0;0';
+                if (listinfo.leafXmjs !== undefined) {
+                    const leafInfo = listinfo.leafXmjs.find(function (item) {
+                        return (item.bwmx === undefined || item.bwmx === clinfo[2]) && item.quantity === parseFloat(clinfo[5]);
+                    });
+                    pushbwmx = leafInfo.code + '_' + (leafInfo.bwmx !== undefined ? leafInfo.bwmx : '') + ';' + leafInfo.quantity;
+                } else {
+                    pushbwmx = '0;' + (listinfo.quantity !== null ? listinfo.quantity : 0);
+                }
+                const bwmx = $('#table-list-select tr[data-index="'+ clinfo[8] +'"]').attr('data-bwmx');
+                if (bwmx) {
+                    const bwmxArray = bwmx.split('$#$');
+                    bwmxArray.push(pushbwmx);
+                    $('#table-list-select tr[data-index="'+ clinfo[8] +'"]').attr('data-bwmx', bwmxArray.join('$#$'));
+                } else {
+                    $('#table-list-select tr[data-index="'+ clinfo[8] +'"]').attr('data-bwmx', pushbwmx);
+                }
             } else {
-                $('#table-list-select tr[data-index="'+ clinfo[8] +'"]').attr('data-bwmx', pushbwmx);
+                $('#table-list-select tr[data-lid="'+ clinfo[8] +'"]').addClass('table-success');
+                let pushbwmx = '0;0';
+                if (listinfo.leafXmjs !== undefined) {
+                    const leafInfo = listinfo.leafXmjs.find(function (item) {
+                        return (item.bwmx === undefined || item.bwmx === clinfo[2]) && item.quantity === parseFloat(clinfo[5]);
+                    });
+                    pushbwmx = leafInfo.code + '_' + (leafInfo.bwmx !== undefined ? leafInfo.bwmx : '') + ';' + leafInfo.quantity;
+                } else {
+                    pushbwmx = '0;' + (listinfo.quantity !== null ? listinfo.quantity : 0);
+                }
+                const bwmx = $('#table-list-select tr[data-lid="'+ clinfo[8] +'"]').attr('data-bwmx');
+                if (bwmx) {
+                    const bwmxArray = bwmx.split('$#$');
+                    bwmxArray.push(pushbwmx);
+                    $('#table-list-select tr[data-lid="'+ clinfo[8] +'"]').attr('data-bwmx', bwmxArray.join('$#$'));
+                } else {
+                    $('#table-list-select tr[data-lid="'+ clinfo[8] +'"]').attr('data-bwmx', pushbwmx);
+                }
             }
         }
+        $('#change-list').val(changeList.join('^_^'));
     }
 }
 
 function changeFormRemake() {
     changeInfo = Object.assign({}, back_changeInfo);
-    console.log(changeInfo);
     $('#change_form input[name="code"]').val(changeInfo.code);
     $('#change_form input[name="name"]').val(changeInfo.name);
     $('#change_form input[name="peg"]').val(changeInfo.peg);
@@ -696,11 +724,13 @@ function maketablelist(status){
         // let oamount = $(this).children('td').eq(5).text();
 
         // 根据单位获取数量的位数,并得出
-        let numdecimal = findDecimal(unit);
+        // let numdecimal = findDecimal(unit);
 
-        let scnum = makedecimalzero(numdecimal);
+        // let scnum = makedecimalzero(numdecimal);
+        let scnum = 0;
         // let detail = $(this).attr('data-detail') != 0 ? $(this).attr('data-detail').split('_')[1] : '';
         let lid = $(this).data('lid');
+        let lindex = $(this).data('index');
         // 原清单和数量改变
         let data_bwmx = $(this).attr('data-bwmx').split('$#$');
         for (const b of data_bwmx) {
@@ -709,10 +739,11 @@ function maketablelist(status){
             let trlist = [code, name, bwmx, unit, price, oamount, scnum, '', lid];
             const radionInfo = radionList.find(function (item) {
                 const info = item.split(';');
-                return info[0] === code && parseInt(info[8]) === parseInt(lid) && info[2] === bwmx;
+                return info[0] === code && (info[8] == lid || parseInt(info[8]) === parseInt(lindex)) && info[2] === bwmx;
             });
             if (radionInfo) {
                 trlist[6] = radionInfo.split(';')[6];
+                trlist[7] = radionInfo.split(';')[7];
             }
             newTableList.push(trlist.join(';'));
         }
@@ -865,7 +896,6 @@ function judgeChange() {
     if ($('#change-whitelist').val() !== $('#back-change-whitelist').val()) {
         change = true;
     }
-    console.log(changeInfo, back_changeInfo);
     if (!isObjEqual(changeInfo, back_changeInfo)) {
         change = true;
     }

+ 3 - 0
app/public/report/js/rpt_main.js

@@ -328,6 +328,9 @@ let zTreeOprObj = {
                     JpcCanvasOutput.cleanCanvas(canvas);
                     JpcCanvasOutput.drawPageBorder(me.currentRptPageRst, canvas, getScreenDPI());
                 }
+                if (is_debug) {
+                    console.log(result.debugInfo);
+                }
             }, function(err){
                 // hintBox.unWaitBox();
             }, function(ex){

+ 3 - 3
app/service/report_memory.js

@@ -522,6 +522,7 @@ module.exports = app => {
         async getStagePayData(tid, sid, fields) {
             await this.ctx.service.tender.checkTender(tid);
             await this.ctx.service.stage.checkStage(sid);
+            const stage = this.ctx.stage;
 
             const dealPay = await this.ctx.service.stagePay.getStagePays(this.ctx.stage);
 
@@ -535,13 +536,13 @@ module.exports = app => {
             if (this._checkFieldsExistReg(fields, 'r[0-9]+_tp')) {
                 const validRole = this._getStageValidRole();
                 const allStagePays = await this.ctx.service.stagePay.getAllDataByCondition({
-                    where: {sid: this.ctx.stage.id, stimes: this.ctx.stage.curTimes}
+                    where: {sid: stage.id, stimes: stage.curTimes}
                 });
 
                 for (const [i, role] of validRole.entries()) {
                     if (i < validRole.length - 1) {
                         const stagePays = this.ctx.helper._.filter(allStagePays, function (x) {
-                            return x.times === stage.curTimes && x.order === role.dataOrder;
+                            return x.stimes === stage.curTimes && x.sorder === role.dataOrder;
                         });
                         this.ctx.helper._.pullAll(allStagePays, stagePays);
 
@@ -558,7 +559,6 @@ module.exports = app => {
                     }
                 }
             }
-
             return dealPay;
         }
 

+ 2 - 1
app/service/revise_bills.js

@@ -115,13 +115,14 @@ module.exports = app => {
                 // 更新父项isLeaf
                 if (!lastChild) {
                     await this.transaction.update(this.tableName, {
+                        id: select.id,
                         is_leaf: false,
                         unit_price: null,
                         quantity: null,
                         total_price: null,
                         deal_qty: null,
                         deal_tp: null,
-                    }, {tender_id: rid, id: select.id});
+                    });
                 }
                 // 数据库创建新增节点数据
                 await this.transaction.insert(this.tableName, bills);

+ 2 - 0
app/service/stage.js

@@ -64,10 +64,12 @@ module.exports = app => {
                     } else {
                         stage.curOrder = accountId === stage.curAuditor.aid ? stage.curAuditor.order : stage.curAuditor.order - 1;
                     }
+                    stage.readOnly = (stage.status !== status.checking && stage.status !== status.checkNoPre) || accountId !== stage.curAuditor.aid;
                 } else if (shareIds.indexOf(accountId) !== -1) { // 分享人
                     if (stage.status === status.uncheck) {
                         throw '您无权查看该数据';
                     }
+                    stage.readOnly = true;
                     stage.curTimes = stage.status === status.checkNo ? stage.times - 1 : stage.times;
                     stage.curOrder = stage.status === status.checked ? this._.max(this._.map(stage.auditors, 'order')) : stage.curAuditor.order - 1;
                 }

+ 1 - 0
app/service/stage_audit.js

@@ -641,6 +641,7 @@ module.exports = app => {
                 await transaction.insert(this.tableName, newAuditors);
 
                 // 复制一份最新数据给下一人
+                await this.ctx.service.stagePay.copyAuditStagePays(this.ctx.stage, this.ctx.stage.times, audit.order + 1, transaction);
                 await this.ctx.service.stagePay.copyAuditStagePays(this.ctx.stage, this.ctx.stage.times, audit.order + 2, transaction);
 
                 // 本期结束

+ 2 - 2
app/service/stage_pay.js

@@ -263,8 +263,8 @@ module.exports = app => {
             if (!stage || !transaction || !times || order === undefined) {
                 throw '数据错误';
             }
-            const sql = 'INSERT INTO ?? (`tid`, `sid`, `pid`, `stimes`, `sorder`, `name`, `tp`, `expr`, `pause`, `attachment`, `pre_tp`) ' +
-                        '  SELECT SP.`tid`, SP.`sid`, SP.`pid`, ?, ?, SP.name, SP.`tp`, SP.`expr`, SP.`pause`, SP.`attachment`, SP.`pre_tp` ' +
+            const sql = 'INSERT INTO ?? (`tid`, `sid`, `pid`, `stimes`, `sorder`, `name`, `tp`, `expr`, `pause`, `attachment`, `pre_tp`, `end_tp`) ' +
+                        '  SELECT SP.`tid`, SP.`sid`, SP.`pid`, ?, ?, SP.name, SP.`tp`, SP.`expr`, SP.`pause`, SP.`attachment`, SP.`pre_tp`, SP.`end_tp` ' +
                         '  FROM ?? As SP, ?? As P ' +
                         '  WHERE SP.`sid` = ? AND SP.`stimes` = ? AND SP.`sorder` = ? And SP.`pid` = P.`id` And P.`valid`';
             const sqlParam = [this.tableName, times, order, this.tableName, this.ctx.service.pay.tableName,

+ 3 - 0
app/service/tender_info.js

@@ -73,6 +73,9 @@ module.exports = app => {
             for (const ai of arrayInfo) {
                 info[ai] = !info[ai] || info[ai] === '' ? defaultInfo[ai] : JSON.parse(info[ai]);
             }
+            if (info.decimal) {
+                info.decimal._pay_tp = info.decimal.pay ? info.decimal.payTp : info.decimal.tp;
+            }
             return info;
         }
 

+ 1 - 1
app/view/change/info.ejs

@@ -15,7 +15,7 @@
 
     #list td input{
         width: 100%;
-        font-size: 0.9rem;
+        /*font-size: 0.9rem;*/
     }
     #list td select{
         /*width: 100%;*/

+ 1 - 1
app/view/layout/layout.ejs

@@ -21,7 +21,7 @@
     <% } %>
 </head>
 
-<body>
+<body oncontextmenu="return false;"> <!--屏蔽input鼠标右键-->
 <div>
 
 </div>

+ 2 - 0
config/config.qa.js

@@ -53,5 +53,7 @@ module.exports = appInfo => {
         rolling: true, // 每次都更新session有效期
     };
 
+    config.is_debug = true;
+
     return config;
 };

+ 6 - 17
test/app/service/report_memory.test.js

@@ -45,17 +45,6 @@ const addFields = function(table, name, field, type, tag) {
     }
     table.items.push(data);
 };
-const addTpFields = function(table, name, field, type) {
-    const data = {};
-    data.ID = table.ID * 100 + table.items.length + 1;
-    data.Name = name + '(' + field + ')';
-    data.DataType = type;
-    data.TableName = table.key;
-    data.descr = '';
-    data.mapExpression = "$PROJECT.REPORT.getProperty('" + table.key + "', '" + field + "')";
-    data.Precision = { type: 'fixed', fixedMapExpression: '$PROJECT.REPORT.getProperty("tender_info", "decimal.up")' };
-    table.items.push(data);
-};
 const saveTableDefine = async function (ctx, tableDefine, file) {
     delete tableDefine.ID;
     delete tableDefine.key;
@@ -345,16 +334,16 @@ describe('test/app/service/report_memory.test.js', () => {
 
             addFields(tableDefine, prefix + '名称', 'name', dataType.str);
             addFields(tableDefine, prefix + '计算公式', 'expr', dataType.str);
-            addTpFields(tableDefine, prefix + '金额', 'tp', dataType.currency, {type: 'tp', subType: 'pay'});
-            addTpFields(tableDefine, prefix + '截止上期-金额', 'pre_tp', dataType.currency, {type: 'tp', subType: 'pay'});
-            addTpFields(tableDefine, prefix + '截止本期-金额', 'end_tp', dataType.currency, {type: 'tp', subType: 'pay'});
+            addFields(tableDefine, prefix + '金额', 'tp', dataType.currency, {type: 'tp', subType: 'pay'});
+            addFields(tableDefine, prefix + '截止上期-金额', 'pre_tp', dataType.currency, {type: 'tp', subType: 'pay'});
+            addFields(tableDefine, prefix + '截止本期-金额', 'end_tp', dataType.currency, {type: 'tp', subType: 'pay'});
             addFields(tableDefine, prefix + '排序', 'order', dataType.int);
             addFields(tableDefine, prefix + '是否扣款项', 'minus', dataType.int);
             addFields(tableDefine, prefix + '支付类型', 'ptype', dataType.int);
-            addTpFields(tableDefine, prefix + '起扣金额', 'sprice', dataType.currency, {type: 'tp', subType: 'pay'});
-            addTpFields(tableDefine, prefix + '扣款限额', 'rprice', dataType.currency, {type: 'tp', subType: 'pay'});
+            addFields(tableDefine, prefix + '起扣金额', 'sprice', dataType.currency, {type: 'tp', subType: 'pay'});
+            addFields(tableDefine, prefix + '扣款限额', 'rprice', dataType.currency, {type: 'tp', subType: 'pay'});
             for (let i = 0 ;i < 10; i++) {
-                addTpFields(tableDefine, prefix + '流程-本期-金额_' + i, 'r' + i + '_tp', dataType.currency, {type: 'tp', subType: 'pay'});
+                addFields(tableDefine, prefix + '流程-本期-金额_' + i, 'r' + i + '_tp', dataType.currency, {type: 'tp', subType: 'pay'});
             }
             yield saveTableDefine(ctx, tableDefine, path.join(savePath, 'mem_stage_pay_define.json'));
         }