Просмотр исходного кода

1. 部位明细,添加排序字段
2. 合同支付,去掉公式提示

MaiXinRong 5 лет назад
Родитель
Сommit
170ccd984c

+ 2 - 0
app/lib/analysis_excel.js

@@ -179,6 +179,8 @@ class ImportBaseTree {
             pos.tid = this.ctx.tender.id;
             pos.add_stage = 0;
             pos.add_times = 0;
+            pos.in_time = new Date();
+            pos.porder = this.finalNode.pos.length + 1;
             pos.add_user = this.ctx.session.sessionUser.accountId;
             this.finalNode.pos.push(pos);
             this.pos.push(pos);

+ 4 - 2
app/public/js/ledger.js

@@ -814,7 +814,9 @@ $(document).ready(function() {
                     } else if (!posData) {
                         if (newText && newText !== '') {
                             data.updateType = 'add';
-                            data.updateData = { name: newText, lid: node.id, tid: tender.id};
+                            const sortData = info.sheet.zh_data;
+                            const order = (!sortData || sortData.length === 0) ? 1 : Math.max(sortData[sortData.length - 1].porder + 1, sortData.length + 1);
+                            data.updateData = { name: newText, lid: node.id, tid: tender.id, porder: order};
                         } else {
                             return;
                         }
@@ -1446,7 +1448,7 @@ $(document).ready(function() {
                         qd.pos.push({
                             name: posSheet.getText(iPosRow, 0),
                             drawing_code: posSheet.getText(iPosRow, 1),
-                            quantity: value,
+                            quantity: value, porder: qd.pos.length + 1,
                         });
                     }
                 }

+ 7 - 0
app/public/js/path_tree.js

@@ -43,6 +43,13 @@ class PosData {
             }
             this.ledgerPos[masterKey].push(data);
         }
+        for (const prop in this.ledgerPos) {
+            if (this.ledgerPos[prop] instanceof Array) {
+                this.ledgerPos[prop].sort(function (a, b) {
+                    return a.porder - b.porder;
+                })
+            }
+        }
     }
 
     /**

+ 24 - 21
app/public/js/spreadjs_rela/spreadjs_zh.js

@@ -998,6 +998,7 @@ const SpreadJsObj = {
          * @returns {TipCellType}
          */
         getTipCellType: function () {
+            const maxHintWidth = 200;
             const TipCellType = function () {};
             // 继承 SpreadJs定义的 普通的TextCellType
             TipCellType.prototype = new spreadNS.CellTypes.Text();
@@ -1031,7 +1032,6 @@ const SpreadJsObj = {
                     cellRect: cellRect,
                     sheet: context.sheet,
                     sheetArea: context.sheetArea,
-                    ctx: context.sheet.getParent().xs,
                 };
             };
             /**
@@ -1062,8 +1062,9 @@ const SpreadJsObj = {
                             document.body.insertBefore(div, null);
                         }
                         this._toolTipElement = div;
+                        const validWidth = Math.min($(window).width() - (pos.x + hitinfo.x + 15) - 10, maxHintWidth);
                         $(this._toolTipElement).text(text).css("top", pos.y + hitinfo.y + 15).css("left", pos.x + hitinfo.x + 15)
-                            .css("width", $(window).width() - (pos.x + hitinfo.x + 15) - 10);
+                            .css("max-width", validWidth);
                         $(this._toolTipElement).show("fast");
                     }
                 }
@@ -1082,6 +1083,7 @@ const SpreadJsObj = {
             return new TipCellType();
         },
         getAutoTipCellType: function () {
+            const maxHintWidth = 200;
             const TipCellType = function () {};
             // 继承 SpreadJs定义的 普通的TextCellType
             TipCellType.prototype = new spreadNS.CellTypes.Text();
@@ -1129,26 +1131,27 @@ const SpreadJsObj = {
                     text = col.getTip(sortData[hitinfo.row]);
                 }
                 const pos = SpreadJsObj.getObjPos(hitinfo.sheet.getParent().qo);
-                if (pos && showTip(hitinfo, text)) {
-                    if (!this._toolTipElement) {
-                        let div = $('#autoTip')[0];
-                        if (!div) {
-                            div = document.createElement("div");
-                            $(div).css("position", "absolute")
-                                .css("border", "1px #C0C0C0 solid")
-                                .css("box-shadow", "1px 2px 5px rgba(0,0,0,0.4)")
-                                .css("font", "9pt Arial")
-                                .css("background", "white")
-                                .css("padding", 5).css("z-index", 99).css("word-wrap", "break-word")
-                                .attr("id", 'autoTip');
-                            //$(div).hide();
-                            document.body.insertBefore(div, null);
-                        }
-                        this._toolTipElement = div;
-                        $(this._toolTipElement).text(text).css("top", pos.y + hitinfo.y + 15).css("left", pos.x + hitinfo.x + 15)
-                            .css("width", $(window).width() - (pos.x + hitinfo.x + 15) - 10);
-                        $(this._toolTipElement).show("fast");
+                if (!this._toolTipElement) {
+                    let div = $('#autoTip')[0];
+                    if (!div) {
+                        div = document.createElement("div");
+                        $(div).css("position", "absolute")
+                            .css("border", "1px #C0C0C0 solid")
+                            .css("box-shadow", "1px 2px 5px rgba(0,0,0,0.4)")
+                            .css("font", "9pt Arial")
+                            .css("background", "white")
+                            .css("padding", 5).css("z-index", 99).css("word-wrap", "break-word")
+                            .attr("id", 'autoTip');
+                        //$(div).hide();
+                        document.body.insertBefore(div, null);
                     }
+                    this._toolTipElement = div;
+                    const validWidth = Math.min($(window).width() - (pos.x + hitinfo.x + 15) - 10, maxHintWidth);
+                    $(this._toolTipElement).text(text).css("top", pos.y + hitinfo.y + 15).css("left", pos.x + hitinfo.x + 15)
+                        .css("max-width", validWidth);
+                    $(this._toolTipElement).show("fast");
+                }
+                if (pos && showTip(hitinfo, text)) {
                 }
             };
             /**

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

@@ -50,11 +50,11 @@ $(document).ready(() => {
         cols: [
             {title: '名称', colSpan: '1', rowSpan: '1', field: 'name', hAlign: 0, width: 150, formatter: '@', readOnly: 'readOnly.name'},
             {title: '扣款', colSpan: '1', rowSpan: '1', field: 'minus', hAlign: 1, width: 50, cellType: 'checkbox', readOnly: 'readOnly.minus'},
-            {title: '本期金额(表达式)', colSpan: '1', rowSpan: '1', field: 'tp', hAlign: 2, width: 100, readOnly: 'readOnly.tp', cellType: 'tip', getTip: function (data) {return data ? data.expr : '';}},
+            {title: '本期金额(表达式)', colSpan: '1', rowSpan: '1', field: 'tp', hAlign: 2, width: 100, readOnly: 'readOnly.tp', /*cellType: 'tip', getTip: function (data) {return data ? data.expr : '';}*/},
             {title: '截止上期金额',  colSpan: '1', rowSpan: '1', field: 'pre_tp', hAlign: 2, width: 100, readOnly: true},
             {title: '截止本期金额',  colSpan: '1', rowSpan: '1', field: 'end_tp', hAlign: 2, width: 100, readOnly: true},
-            {title: '起扣金额',  colSpan: '1', rowSpan: '1', field: 'sprice', hAlign: 2, width: 100, readOnly: 'readOnly.sprice', cellType: 'tip', getTip: function (data) {return data ? data.expr : '';}},
-            {title: '付(扣)款限额',  colSpan: '1', rowSpan: '1', field: 'rprice', hAlign: 2, width: 100, readOnly: 'readOnly.rprice', cellType: 'tip', getTip: function (data) {return data ? data.expr : '';}},
+            {title: '起扣金额',  colSpan: '1', rowSpan: '1', field: 'sprice', hAlign: 2, width: 100, readOnly: 'readOnly.sprice', /*cellType: 'tip', getTip: function (data) {return data ? data.sexpr : '';}*/},
+            {title: '付(扣)款限额',  colSpan: '1', rowSpan: '1', field: 'rprice', hAlign: 2, width: 100, readOnly: 'readOnly.rprice', /*cellType: 'tip', getTip: function (data) {return data ? data.rexpr : '';}*/},
             {
                 title: '附件', colSpan: '1', rowSpan: '1', field: 'attachment', hAlign: 0, width: 60, readOnly: true, cellType: 'imageBtn',
                 normalImg: '#rela-file-icon', hoverImg: '#rela-file-hover', getValue: 'getValue.attachment'

+ 5 - 1
app/service/pos.js

@@ -25,7 +25,8 @@ module.exports = app => {
         async getPosData(condition) {
             return await this.db.select(this.tableName, {
                 where: condition,
-                columns: ['id', 'tid', 'lid', 'name', 'quantity', 'drawing_code', 'sgfh_qty', 'sjcl_qty', 'qtcl_qty'],
+                columns: ['id', 'tid', 'lid', 'name', 'quantity', 'drawing_code', 'sgfh_qty', 'sjcl_qty', 'qtcl_qty', 'in_time', 'porder'],
+                order: [['porder', 'ASC']],
             });
         }
 
@@ -54,6 +55,7 @@ module.exports = app => {
             // todo 新增期
             data.add_stage = 0;
             data.add_times = 0;
+            data.in_time = new Date();
             data.add_user = this.ctx.session.sessionUser.accountId;
             if (data.quantity) {
                 const bills = await this.ctx.service.ledger.getDataById(data.lid);
@@ -228,6 +230,7 @@ module.exports = app => {
                     pd.id = this.uuid.v4();
                     pd.lid = newLid;
                     pd.tid = this.ctx.tender.id;
+                    pd.in_time = new Date();
                 }
                 await transaction.insert(this.tableName, posData);
             }
@@ -248,6 +251,7 @@ module.exports = app => {
                 const inD = {
                     id: this.uuid.v4(), tid: tid, lid: bills.id,
                     add_stage: 0, add_times: 0, add_user: this.ctx.session.sessionUser.accountId,
+                    in_time: new Date(), order: d.order,
                     name: d.name, drawing_code: d.drawing_code,
                 };
                 if (d.quantity) {

+ 4 - 2
app/service/stage_pos_final.js

@@ -31,7 +31,7 @@ module.exports = app => {
          * @returns {Promise<void>}
          */
         async getFinalData(tender, stage) {
-            const sql = 'SELECT Pos.pid, Pos.contract_qty, Pos.qc_qty FROM ' +
+            const sql = 'SELECT Pos.* FROM ' +
                 //'  (SELECT pid, contract_qty, qc_qty, sorder FROM ' + this.tableName + ' WHERE tid = ?) As Pos' +
                 this.tableName + ' As Pos' +
                 '  INNER JOIN ( ' +
@@ -70,8 +70,10 @@ module.exports = app => {
                     if (!p) continue;
                     c.contract_qty = this.ctx.helper.add(c.contract_qty, p.contract_qty);
                     c.qc_qty = this.ctx.helper.add(c.qc_qty, p.qc_qty);
+                    pre.splice(pre.index(p), 1);
                 }
-                await transaction.insert(this.tableName, cur);
+                //await transaction.insert(this.tableName, cur);
+                await transaction.insert(this.tableName, cur.concat(pre));
             } else {
                 const sql = 'Insert Into ??(tid, sid, lid, pid, sorder, contract_qty, qc_qty)' +
                             '  SELECT p.tid, p.sid, p.lid, p.pid, ? As `sorder`, p.contract_qty, p.qc_qty' +