Parcourir la source

1. 复制整块,复制项目特征
2. 合同管理,支付进度,显示百分比提示

MaiXinRong il y a 4 mois
Parent
commit
02e85619d2

+ 1 - 0
app/base/base_bills_service.js

@@ -673,6 +673,7 @@ class BaseBillsSerivce extends TreeService {
                     check_calc: 1,
                     dgn_qty1: d.dgn_qty1,
                     dgn_qty2: d.dgn_qty2,
+                    featrues: d.featrues,
                 };
                 for (const c of d.children) {
                     c.ledger_pid = newBills.ledger_id;

+ 2 - 1
app/controller/pay_controller.js

@@ -87,7 +87,7 @@ module.exports = app => {
 
         async del(ctx) {
             try {
-                if (!ctx.session.sessionUser.is_admin && ctx.request.body.confirm !== '确认删除本期') throw '请输入文本确认删除本期';
+                // if (!ctx.session.sessionUser.is_admin && ctx.request.body.confirm !== '确认删除本期') throw '请输入文本确认删除本期';
                 const phase_id = ctx.request.body.phase_id;
                 const phasePay = await ctx.service.phasePay.getDataById(phase_id);
                 if (!phasePay) throw '删除的期不存在,请刷新页面';
@@ -102,6 +102,7 @@ module.exports = app => {
                 ctx.redirect('/tender/' + ctx.tender.id + '/pay');
             } catch (err) {
                 ctx.log(err);
+                ctx.postError(err, '删除期失败');
                 ctx.redirect('/tender/' + ctx.tender.id + '/pay');
             }
         }

+ 3 - 3
app/public/js/contract_detail.js

@@ -61,10 +61,10 @@ $(document).ready(function() {
     };
     if (contract_type === contractConst.type.expenses) {
         contractSpreadSetting.cols.push({title: '累计应付', colSpan: '1', rowSpan: '2', field: 'yf_price', hAlign: 2, width: 120, formatter: '@', readOnly: true});
-        contractSpreadSetting.cols.push({title: '支付进度', colSpan: '1', rowSpan: '2', formatter: '@', readOnly: true, field: 'stackedBar', hAlign: 0, width: 200, cellType: 'stackedBar', stackedBarCover: true, bc_type: 'grid', getTip: getStackedBarTip});
+        contractSpreadSetting.cols.push({title: '支付进度', colSpan: '1', rowSpan: '2', formatter: '@', readOnly: true, field: 'stackedBar', hAlign: 0, width: 200, cellType: 'stackedBar', stackedBarCover: true, bc_type: 'grid', getTip: getStackedBarTip, hintNum: true});
     } else if (contract_type === contractConst.type.income) {
         contractSpreadSetting.cols.push({title: '累计应回', colSpan: '1', rowSpan: '2', field: 'yf_price', hAlign: 2, width: 120, formatter: '@', readOnly: true});
-        contractSpreadSetting.cols.push({title: '回款进度', colSpan: '1', rowSpan: '2', formatter: '@', readOnly: true, field: 'stackedBar', hAlign: 0, width: 200, cellType: 'stackedBar', stackedBarCover: true, bc_type: 'grid', getTip: getStackedBarTip});
+        contractSpreadSetting.cols.push({title: '回款进度', colSpan: '1', rowSpan: '2', formatter: '@', readOnly: true, field: 'stackedBar', hAlign: 0, width: 200, cellType: 'stackedBar', stackedBarCover: true, bc_type: 'grid', getTip: getStackedBarTip, hintNum: true});
     }
     contractSpreadSetting.cols.push({title: '合同状态', colSpan: '1', rowSpan: '2', field: 'status', hAlign: 1, width: 100, formatter: '@', readOnly: true, getValue:'getValue.status', foreColor:'foreColor.status'});
     contractSpreadSetting.cols.push({title: '备注', colSpan: '1', rowSpan: '2', field: 'remark', hAlign: 0, width: 120, formatter: '@', readOnly: 'readOnly.code', cellType: 'ellipsisAutoTip', scrollHeightClass: '.sjs-height-1'});
@@ -96,7 +96,7 @@ $(document).ready(function() {
             node.stackedBar = [];
             node.stackedBarTips = [];
             for (const cf of calcField) {
-                node.stackedBar.push({ color: calcFieldColor[cf], percent: ZhCalc.div(node[cf], base), field: cf });
+                node.stackedBar.push({ color: calcFieldColor[cf], percent: ZhCalc.div(node[cf], base), field: cf, hintNum: cf === 'yf_price' });
                 node.stackedBarTips.push(`${calcFieldCaption[cf]}: ${node[cf] || 0}`);
             }
         }

+ 15 - 0
app/public/js/spreadjs_rela/spreadjs_zh.js

@@ -2737,6 +2737,16 @@ const SpreadJsObj = {
                 canvas.fill();
                 canvas.restore();
             };
+            const drawText = function (canvas, x, y, w, h, text) {
+                // if (w < 33) return; // 33为100%的长度
+                const textWidth = canvas.measureText(text).width;
+                if (textWidth > w - 4) return;
+                const tx = x + w - textWidth - 2;
+                const ty = y + h - 2;
+
+                canvas.textAlign = 'left';
+                canvas.fillText(text, tx, ty);
+            };
             const proto = stackedBarCellType.prototype;
             /**
              * 绘制方法
@@ -2766,13 +2776,18 @@ const SpreadJsObj = {
                 for (const [i, bd] of barData.entries()) {
                     let width = ZhCalc.mul(validWidth, bd.percent, 2);
                     if (width < defaultR) continue;
+                    let percent = ZhCalc.mul(bd.percent, 100, 0);
+                    const hintText = bd.hint || (percent ? percent + '%' : '');
+                    const hintNum = bd.hintNum !== undefined ? bd.hintNum : (col.hintNum || false);
                     const top = col.stackedBarCover ? startTop : startTop + height * i + i - 1;
                     //drawBarBefore99(canvas, left, top, width, height, ZhCalc.mul(height, defaultR, 2), bd.color);
                     //drawBarBefore99(canvas, left, top, width, height, [0, 0, ZhCalc.div(height, 2, 2), 0], bd.color);
                     if (col.stackedBarCover) {
                         drawSB(canvas, left, top, width, height, ZhCalc.div(height, 2, 2), bd.color);
+                        if (hintNum && hintText) drawText(canvas, left, top, width, height, hintText);
                     } else {
                         drawBarBefore99(canvas, left, top, width, height, ZhCalc.mul(height, defaultR, 2), bd.color);
+                        if (hintNum && hintText) drawText(canvas, left, top, width, height, hintText);
                     }
                 }
             };

+ 1 - 0
app/service/change_ledger.js

@@ -1227,6 +1227,7 @@ module.exports = app => {
                         check_calc: 1,
                         ccid: this.ctx.change.cid,
                         formc: 1,
+                        features: d.features,
                     };
                     for (const c of d.children) {
                         c.ledger_pid = newBills.ledger_id;