浏览代码

1. 期计量,获取数据相关

MaiXinRong 6 年之前
父节点
当前提交
46af24700b
共有 3 个文件被更改,包括 20 次插入5 次删除
  1. 5 3
      app/const/spread.js
  2. 7 1
      app/middleware/stage_check.js
  3. 8 1
      app/service/stage_pos.js

+ 5 - 3
app/const/spread.js

@@ -55,9 +55,6 @@ const stage = {
             {title: '名称', colSpan: '1', rowSpan: '2', field: 'name', hAlign: 0, width: 230, formatter: '@', readOnly: true},
             {title: '单位', colSpan: '1', rowSpan: '2', field: 'unit', hAlign: 1, width: 60, formatter: '@', readOnly: true, cellType: 'unit'},
             {title: '单价', colSpan: '1', rowSpan: '2', field: 'unit_price', hAlign: 2, width: 60, readOnly: true, type: 'Number'},
-            {title: '设计数量|数量1',  colSpan: '2|1', rowSpan: '1|1', field: 'dgn_qty1', hAlign: 2, width: 60, readOnly: true, type: 'Number'},
-            {title: '|数量2',  colSpan: '|1', rowSpan: '|1', field: 'dgn_qty2', hAlign: 2, width: 60, readOnly: true, type: 'Number'},
-            {title: '经济指标',  colSpan: '1', rowSpan: '2', field: 'dgn_price', hAlign: 2, width: 60, readOnly: true, type: 'Number'},
             {title: '签约|数量', colSpan: '2|1', rowSpan: '1|1', field: 'deal_qty', hAlign: 2, width: 60, readOnly: true, type: 'Number'},
             {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'deal_tp', hAlign: 2, width: 60, readOnly: true, type: 'Number'},
             {title: '施工图复核|数量', colSpan: '2|1', rowSpan: '1|1', field: 'quantity', hAlign: 2, width: 60, readOnly: true, type: 'Number'},
@@ -74,6 +71,11 @@ const stage = {
             {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'end_qc_tp', hAlign: 2, width: 60, readOnly: true, type: 'Number'},
             {title: '截止本期完成计量|数量', colSpan: '2|1', rowSpan: '1|1', field: 'end_gather_qty', hAlign: 2, width: 60, readOnly: true, type: 'Number'},
             {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'end_gather_tp', hAlign: 2, width: 60, readOnly: true, type: 'Number'},
+            {title: '合同|设计数量1',  colSpan: '2|1', rowSpan: '1|1', field: 'deal_dgn_qty1', hAlign: 2, width: 60, readOnly: true, type: 'Number'},
+            {title: '|设计数量2',  colSpan: '|1', rowSpan: '|1', field: 'deal_dgn_qty2', hAlign: 2, width: 60, readOnly: true, type: 'Number'},
+            {title: '变更|设计数量1',  colSpan: '2|1', rowSpan: '1|1', field: 'c_dgn_qty1', hAlign: 2, width: 60, readOnly: true, type: 'Number'},
+            {title: '|数量2',  colSpan: '|1', rowSpan: '|1', field: 'c_dgn_qty2', hAlign: 2, width: 60, readOnly: true, type: 'Number'},
+            {title: '经济指标',  colSpan: '1', rowSpan: '2', field: 'final_dgn_price', hAlign: 2, width: 60, readOnly: true, type: 'Number'},
             {title: '图(册)号', colSpan: '1', rowSpan: '2', field: 'drawing_code', hAlign: 0, width: 80, formatter: '@', readOnly: true},
             {title: '累计完成率(%)', colSpan: '1', rowSpan: '2', field: 'percent', hAlign: 0, width: 100, readOnly: true, type: 'Number'},
             {title: '备注', colSpan: '1', rowSpan: '2', field: 'memo', hAlign: 0, width: 100, formatter: '@', readOnly: true},

+ 7 - 1
app/middleware/stage_check.js

@@ -54,7 +54,13 @@ module.exports = options => {
             if (accountId === stage.user_id) { // 原报
                 stage.readOnly = stage.status !== status.uncheck && stage.status !== status.checkNo;
                 stage.curTimes = stage.status === status.checkNo ? stage.times + 1 : stage.times;
-                stage.curOrder = stage.status === status.checked ? _.max(_.map(stage.auditors, 'order')) : (stage.status !== status.checkNo ? stage.curAuditor.order - 1 : 0);
+                if (stage.status === status.uncheck || stage.status === status.checkNo) {
+                    stage.curOrder = 0;
+                } else if (stage.status === status.checked) {
+                    stage.curOrder = _.max(_.map(stage.auditors, 'order'));
+                } else {
+                    stage.curOrder = stage.curAuditor.order - 1;
+                }
             } else if (auditorIds.indexOf(accountId) !== -1) { // 审批人
                 if (stage.status === status.uncheck) {
                     throw '您无权查看该数据';

+ 8 - 1
app/service/stage_pos.js

@@ -32,7 +32,14 @@ module.exports = app => {
          * @returns {Promise<*>}
          */
         async getLastestStageData(tid, sid, pid) {
-            let pidSql = pid ? (' And pid in (' + (pid instanceof Array ? pid.join(', ') : pid) + ')') : '';
+            let pidSql = '';
+            if (pid) {
+                if (pid instanceof Array) {
+                    pidSql = pid.length > 0 ? (' And pid in (' + pid.join(', ') + ')') : '';
+                } else {
+                    pidSql = (pid instanceof String || pid instanceof Number) ? ' And pid = ' + pid : '';
+                }
+            }
             const sql = 'SELECT * FROM ' + this.tableName + ' As Pos ' +
                 '  INNER JOIN ( ' +
                 '    SELECT MAX(`times`) As `times`, MAX(`order`) As `order`, `tid`, `sid`, `pid` From ' + this.tableName +