Explorar o código

会签,其他台账下数据读取问题

MaiXinRong hai 1 mes
pai
achega
27899ef70b

+ 33 - 0
app/public/js/stage.js

@@ -2053,6 +2053,39 @@ $(document).ready(() => {
                     return readOnly || stage.revising || stage.status !== auditConst.status.uncheck;
                 },
             },
+            exportTestData: {
+                name: '导出测试数据',
+                callback: function (key, opt, menu, e) {
+                    const data = stageTree.nodes.map(x => {
+                        const parent = stageTree.getParent(x);
+                        return {
+                            id: x.id, parentId: parent ? parent.id : '-1', seq: x.order,
+                            code: x.code || '', b_code: x.b_code || '', name: x.name || '', unit: x.unit || '', unit_price: x.unit_price || 0,
+                            quantity: x.quantity || 0, total_price: x.total_price || 0,
+                            is_tp: x.is_tp || 0,
+                            contract_qty: x.contract_qty || 0, contract_tp: x.contract_tp || 0,
+                            qc_qty: x.qc_qty || 0, qc_tp: x.qc_tp || 0,
+                            gather_qty: x.gather_qty || 0, gather_tp: x.gather_tp || 0,
+                            pre_contract_qty: x.pre_contract_qty || 0, pre_contract_tp: x.pre_contract_tp || 0,
+                            pre_qc_qty: x.pre_qc_qty || 0, pre_qc_tp: x.pre_qc_tp || 0,
+                            pre_gather_qty: x.pre_gather_qty || 0, pre_gather_tp: x.pre_gather_tp || 0,
+                            end_contract_qty: x.end_contract_qty || 0, end_contract_tp: x.end_contract_tp || 0,
+                            end_qc_qty: x.end_qc_qty || 0, end_qc_tp: x.end_qc_tp || 0,
+                            end_gather_qty: x.end_gather_qty || 0, end_gather_tp: x.end_gather_tp || 0,
+
+                            memo: x.memo || '',
+                            gxby_status: x.gxby_status || 0, gxby_url: x.gxby_status || '',
+                            dagl_status: x.gxby_status || 0, dagl_url: x.dagl_url || '',
+                            wbs_url: x.wbs_url || '',
+                        };
+                    });
+                    const blob = new Blob([JSON.stringify(data, '', '\t')], { type: 'application/text'});
+                    saveAs(blob, 'test.json');
+                },
+                visible: function() {
+                    return is_debug || false;
+                }
+            },
             sumLoadSpr: '---',
             importStageGcl: {
                 name: '导入(其他标段)工程量清单计量数据',

+ 18 - 17
app/service/stage_jgcl.js

@@ -24,23 +24,24 @@ module.exports = app => {
 
         async getStageData(stage, cancel = false) {
             const data = await this.getAllDataByCondition({where: { sid: stage.id }});
-            if (!cancel && stage && stage.readOnly && !this.ctx.tender.isTourist && stage.status !== auditConst.status.checked) {
-                for (const d of data) {
-                    const his = d.shistory ? JSON.parse(d.shistory) : [];
-                    const h = this.ctx.helper._.find(his, {
-                        stimes: stage.curTimes, sorder: stage.curOrder
-                    });
-                    if (h) {
-                        d.arrive_qty = h.arrive_qty ? h.arrive_qty : h.arraive_qty;
-                        d.arrive_tp = h.arrive_tp;
-                        d.deduct_qty = h.deduct_qty;
-                        d.deduct_tp = h.deduct_tp;
-                    } else {
-                        d.arrive_qty = null;
-                        d.arrive_tp = null;
-                        d.deduct_qty = null;
-                        d.deduct_tp = null;
-                    }
+            if (!stage || cancel || !stage.readOnly || this.ctx.tender.isTourist || stage.status === auditConst.status.checked
+                || (stage.flowAuditorIds && stage.flowAuditorIds.indexOf(this.ctx.session.sessionUser.accountId) > 0)) return data;
+
+            for (const d of data) {
+                const his = d.shistory ? JSON.parse(d.shistory) : [];
+                const h = this.ctx.helper._.find(his, {
+                    stimes: stage.curTimes, sorder: stage.curOrder
+                });
+                if (h) {
+                    d.arrive_qty = h.arrive_qty ? h.arrive_qty : h.arraive_qty;
+                    d.arrive_tp = h.arrive_tp;
+                    d.deduct_qty = h.deduct_qty;
+                    d.deduct_tp = h.deduct_tp;
+                } else {
+                    d.arrive_qty = null;
+                    d.arrive_tp = null;
+                    d.deduct_qty = null;
+                    d.deduct_tp = null;
                 }
             }
             return data;

+ 9 - 8
app/service/stage_other.js

@@ -24,14 +24,15 @@ module.exports = app => {
 
         async getStageData(stage, cancel = false) {
             const data = await this.getAllDataByCondition({where: { sid: stage.id }});
-            if (!cancel && stage && stage.readOnly && !this.ctx.tender.isTourist && stage.status !== auditConst.status.checked) {
-                for (const d of data) {
-                    const his = d.shistory ? JSON.parse(d.shistory) : [];
-                    const h = this.ctx.helper._.find(his, {
-                        stimes: stage.curTimes, sorder: stage.curOrder
-                    });
-                    d.tp = h ? h.tp : null;
-                }
+            if (!stage || cancel || !stage.readOnly || this.ctx.tender.isTourist || stage.status === auditConst.status.checked
+                || (stage.flowAuditorIds && stage.flowAuditorIds.indexOf(this.ctx.session.sessionUser.accountId) > 0)) return data;
+
+            for (const d of data) {
+                const his = d.shistory ? JSON.parse(d.shistory) : [];
+                const h = this.ctx.helper._.find(his, {
+                    stimes: stage.curTimes, sorder: stage.curOrder
+                });
+                d.tp = h ? h.tp : null;
             }
             return data;
         }

+ 11 - 10
app/service/stage_safe_prod.js

@@ -25,16 +25,17 @@ module.exports = app => {
 
         async getStageData(stage, cancel) {
             const data = await this.getAllDataByCondition({where: { sid: stage.id }});
-            if (!cancel && stage && stage.readOnly && !this.ctx.tender.isTourist && stage.status !== auditConst.status.checked) {
-                for (const d of data) {
-                    const his = d.shistory ? JSON.parse(d.shistory) : [];
-                    const h = this.ctx.helper._.find(his, {
-                        stimes: stage.curTimes, sorder: stage.curOrder
-                    });
-                    delete d.shistory;
-                    d.qty = h ? h.qty : null;
-                    d.tp = h ? h.tp : null;
-                }
+            if (!stage || cancel || !stage.readOnly || this.ctx.tender.isTourist || stage.status === auditConst.status.checked
+                || (stage.flowAuditorIds && stage.flowAuditorIds.indexOf(this.ctx.session.sessionUser.accountId) > 0)) return data;
+
+            for (const d of data) {
+                const his = d.shistory ? JSON.parse(d.shistory) : [];
+                const h = this.ctx.helper._.find(his, {
+                    stimes: stage.curTimes, sorder: stage.curOrder
+                });
+                delete d.shistory;
+                d.qty = h ? h.qty : null;
+                d.tp = h ? h.tp : null;
             }
             return data;
         }

+ 11 - 10
app/service/stage_temp_land.js

@@ -25,16 +25,17 @@ module.exports = app => {
 
         async getStageData(stage, cancel = false) {
             const data = await this.getAllDataByCondition({where: { sid: stage.id }});
-            if (!cancel && stage && stage.readOnly && !this.ctx.tender.isTourist && stage.status !== auditConst.status.checked) {
-                for (const d of data) {
-                    const his = d.shistory ? JSON.parse(d.shistory) : [];
-                    const h = this.ctx.helper._.find(his, {
-                        stimes: stage.curTimes, sorder: stage.curOrder
-                    });
-                    delete d.shistory;
-                    d.qty = h ? h.qty : null;
-                    d.tp = h ? h.tp : null;
-                }
+            if (!stage || cancel || !stage.readOnly || this.ctx.tender.isTourist || stage.status === auditConst.status.checked
+                || (stage.flowAuditorIds && stage.flowAuditorIds.indexOf(this.ctx.session.sessionUser.accountId) > 0)) return data;
+
+            for (const d of data) {
+                const his = d.shistory ? JSON.parse(d.shistory) : [];
+                const h = this.ctx.helper._.find(his, {
+                    stimes: stage.curTimes, sorder: stage.curOrder
+                });
+                delete d.shistory;
+                d.qty = h ? h.qty : null;
+                d.tp = h ? h.tp : null;
             }
             return data;
         }

+ 2 - 1
app/service/stage_yjcl.js

@@ -26,7 +26,8 @@ module.exports = app => {
 
         async getStageData(stage) {
             const data = await this.getAllDataByCondition({ where: { sid: stage.id } });
-            if (!stage.readOnly || stage.status === auditConst.status.checked) return data;
+            if (!stage.readOnly  || stage.status === auditConst.status.checked
+                || (stage.flowAuditorIds && stage.flowAuditorIds.indexOf(this.ctx.session.sessionUser.accountId) > 0)) return data;
 
             for (const d of data) {
                 const his = d.shistory ? JSON.parse(d.shistory) : [];