浏览代码

合同公示相关

MaiXinRong 4 月之前
父节点
当前提交
fe1687528c
共有 4 个文件被更改,包括 65 次插入11 次删除
  1. 6 4
      app/const/spread.js
  2. 1 1
      app/public/js/ledger.js
  3. 4 1
      app/public/js/shares/export_excel.js
  4. 54 5
      app/public/js/stage.js

+ 6 - 4
app/const/spread.js

@@ -540,7 +540,7 @@ const BaseSpreadColSetting = {
             position: [{title: '位置', colSpan: '1', rowSpan: '2', field: 'position', hAlign: 0, width: 60, formatter: '@'}],
             position: [{title: '位置', colSpan: '1', rowSpan: '2', field: 'position', hAlign: 0, width: 60, formatter: '@'}],
             tz_calc: [
             tz_calc: [
                 {title: '台账数量|设计量', colSpan: '5|1', rowSpan: '1|1', field: 'sgfh_qty', hAlign: 2, width: 100, type: 'Number'},
                 {title: '台账数量|设计量', colSpan: '5|1', rowSpan: '1|1', field: 'sgfh_qty', hAlign: 2, width: 100, type: 'Number'},
-                {title: '|设计量公式', colSpan: '|1', rowSpan: '|1', field: 'sgfh_expr', hAlign: 2, width: 100},
+                {title: '|设计量公式', colSpan: '|1', rowSpan: '|1', field: 'sgfh_expr', hAlign: 0, width: 100},
                 {title: '|设计错漏增减', colSpan: '|1', rowSpan: '|1', field: 'sjcl_qty', hAlign: 2, width: 100, type: 'Number'},
                 {title: '|设计错漏增减', colSpan: '|1', rowSpan: '|1', field: 'sjcl_qty', hAlign: 2, width: 100, type: 'Number'},
                 {title: '|其他错漏增减', colSpan: '|1', rowSpan: '|1', field: 'qtcl_qty', hAlign: 2, width: 100, type: 'Number'},
                 {title: '|其他错漏增减', colSpan: '|1', rowSpan: '|1', field: 'qtcl_qty', hAlign: 2, width: 100, type: 'Number'},
                 {title: '|小计', colSpan: '|1', rowSpan: '|1', field: 'quantity', hAlign: 2, width: 60, type: 'Number', readOnly: true},
                 {title: '|小计', colSpan: '|1', rowSpan: '|1', field: 'quantity', hAlign: 2, width: 60, type: 'Number', readOnly: true},
@@ -616,7 +616,8 @@ const BaseSpreadColSetting = {
             real_qty: [{title: '现场实际数量', colSpan: '1', rowSpan: '2', field: 'real_qty', hAlign: 2, width: 60, type: 'Number'}],
             real_qty: [{title: '现场实际数量', colSpan: '1', rowSpan: '2', field: 'real_qty', hAlign: 2, width: 60, type: 'Number'}],
             estimate_qty: [{title: '预计变更数量', colSpan: '1', rowSpan: '2', field: 'estimate_qty', hAlign: 2, width: 60, type: 'Number', readOnly: true}],
             estimate_qty: [{title: '预计变更数量', colSpan: '1', rowSpan: '2', field: 'estimate_qty', hAlign: 2, width: 60, type: 'Number', readOnly: true}],
             cur_calc: [
             cur_calc: [
-                {title: '本期计量|合同', colSpan: '4|1', rowSpan: '1|1', field: 'contract_qty', hAlign: 2, width: 60, type: 'Number'},
+                {title: '本期计量|合同', colSpan: '5|1', rowSpan: '1|1', field: 'contract_qty', hAlign: 2, width: 60, type: 'Number'},
+                {title: '|合同公式', colSpan: '|1', rowSpan: '|1', field: 'contract_expr', hAlign: 0, width: 100},
                 {title: '|数量变更', colSpan: '|1', rowSpan: '|1', field: 'qc_qty', hAlign: 2, width: 80, type: 'Number'},
                 {title: '|数量变更', colSpan: '|1', rowSpan: '|1', field: 'qc_qty', hAlign: 2, width: 80, type: 'Number'},
                 {title: '|不计价', colSpan: '|1', rowSpan: '|1', field: 'qc_minus_qty', hAlign: 2, width: 60, type: 'Number'},
                 {title: '|不计价', colSpan: '|1', rowSpan: '|1', field: 'qc_minus_qty', hAlign: 2, width: 60, type: 'Number'},
                 {title: '|完成', colSpan: '|1', rowSpan: '|1', field: 'gather_qty', hAlign: 2, width: 60, type: 'Number', readOnly: true},
                 {title: '|完成', colSpan: '|1', rowSpan: '|1', field: 'gather_qty', hAlign: 2, width: 60, type: 'Number', readOnly: true},
@@ -677,7 +678,7 @@ const BaseSpreadColSetting = {
             position: [{title: '位置', colSpan: '1', rowSpan: '2', field: 'position', hAlign: 0, width: 60, formatter: '@'}],
             position: [{title: '位置', colSpan: '1', rowSpan: '2', field: 'position', hAlign: 0, width: 60, formatter: '@'}],
             tz_calc: [
             tz_calc: [
                 {title: '台账数量|设计量', colSpan: '5|1', rowSpan: '1|1', field: 'sgfh_qty', hAlign: 2, width: 100, type: 'Number'},
                 {title: '台账数量|设计量', colSpan: '5|1', rowSpan: '1|1', field: 'sgfh_qty', hAlign: 2, width: 100, type: 'Number'},
-                {title: '|设计量公式', colSpan: '|1', rowSpan: '|1', field: 'sgfh_expr', hAlign: 2, width: 100},
+                {title: '|设计量公式', colSpan: '|1', rowSpan: '|1', field: 'sgfh_expr', hAlign: 0, width: 100},
                 {title: '|设计错漏增减', colSpan: '|1', rowSpan: '|1', field: 'sjcl_qty', hAlign: 2, width: 100, type: 'Number'},
                 {title: '|设计错漏增减', colSpan: '|1', rowSpan: '|1', field: 'sjcl_qty', hAlign: 2, width: 100, type: 'Number'},
                 {title: '|其他错漏增减', colSpan: '|1', rowSpan: '|1', field: 'qtcl_qty', hAlign: 2, width: 100, type: 'Number'},
                 {title: '|其他错漏增减', colSpan: '|1', rowSpan: '|1', field: 'qtcl_qty', hAlign: 2, width: 100, type: 'Number'},
                 {title: '|小计', colSpan: '|1', rowSpan: '|1', field: 'quantity', hAlign: 2, width: 60, type: 'Number', readOnly: true},
                 {title: '|小计', colSpan: '|1', rowSpan: '|1', field: 'quantity', hAlign: 2, width: 60, type: 'Number', readOnly: true},
@@ -753,7 +754,8 @@ const BaseSpreadColSetting = {
             estimate_qty: [{title: '预计变更数量', colSpan: '1', rowSpan: '2', field: 'estimate_qty', hAlign: 2, width: 60, type: 'Number', readOnly: true}],
             estimate_qty: [{title: '预计变更数量', colSpan: '1', rowSpan: '2', field: 'estimate_qty', hAlign: 2, width: 60, type: 'Number', readOnly: true}],
             tz_calc: [{title: '台账数量', colSpan: '1', rowSpan: '2', field: 'sgfh_qty', hAlign: 2, width: 60, type: 'Number', aliasFormat: '{%s}数量'}],
             tz_calc: [{title: '台账数量', colSpan: '1', rowSpan: '2', field: 'sgfh_qty', hAlign: 2, width: 60, type: 'Number', aliasFormat: '{%s}数量'}],
             cur_calc: [
             cur_calc: [
-                {title: '本期计量|合同', colSpan: '4|1', rowSpan: '1|1', field: 'contract_qty', hAlign: 2, width: 60, type: 'Number'},
+                {title: '本期计量|合同', colSpan: '5|1', rowSpan: '1|1', field: 'contract_qty', hAlign: 2, width: 60, type: 'Number'},
+                {title: '|合同公式', colSpan: '|1', rowSpan: '|1', field: 'contract_expr', hAlign: 0, width: 100},
                 {title: '|数量变更', colSpan: '|1', rowSpan: '|1', field: 'qc_qty', hAlign: 2, width: 80, type: 'Number'},
                 {title: '|数量变更', colSpan: '|1', rowSpan: '|1', field: 'qc_qty', hAlign: 2, width: 80, type: 'Number'},
                 {title: '|不计价', colSpan: '|1', rowSpan: '|1', field: 'qc_minus_qty', hAlign: 2, width: 60, type: 'Number'},
                 {title: '|不计价', colSpan: '|1', rowSpan: '|1', field: 'qc_minus_qty', hAlign: 2, width: 60, type: 'Number'},
                 {title: '|完成', colSpan: '|1', rowSpan: '|1', field: 'gather_qty', hAlign: 2, width: 60, type: 'Number', readOnly: true},
                 {title: '|完成', colSpan: '|1', rowSpan: '|1', field: 'gather_qty', hAlign: 2, width: 60, type: 'Number', readOnly: true},

+ 1 - 1
app/public/js/ledger.js

@@ -4578,7 +4578,7 @@ $(document).ready(function() {
                 {title: '合价', colSpan: '1', rowSpan: '1', field: 'total_price', hAlign: 2, width: 80, type: 'Number'},
                 {title: '合价', colSpan: '1', rowSpan: '1', field: 'total_price', hAlign: 2, width: 80, type: 'Number'},
                 {title: '图号', colSpan: '1', rowSpan: '1', field: 'drawing_code', hAlign: 0, width: 100, formatter: '@'},
                 {title: '图号', colSpan: '1', rowSpan: '1', field: 'drawing_code', hAlign: 0, width: 100, formatter: '@'},
                 {title: '备注', colSpan: '1', rowSpan: '1', field: 'memo', hAlign: 0, width: 100, formatter: '@'},
                 {title: '备注', colSpan: '1', rowSpan: '1', field: 'memo', hAlign: 0, width: 100, formatter: '@'},
-                {title: '项目特征', colSpan: '1', rowSpan: '1', field: 'features', hAlign: 0, width: 100, formatter: '@'},
+                {title: '项目特征', colSpan: '1', rowSpan: '1', field: 'features', hAlign: 0, width: 120, formatter: '@', wordWrap: true },
             ],
             ],
             headRows: 1,
             headRows: 1,
             headRowHeight: [32],
             headRowHeight: [32],

+ 4 - 1
app/public/js/shares/export_excel.js

@@ -49,6 +49,7 @@ const SpreadExcelObj = (function() {
             }
             }
         }
         }
 
 
+        const autoFit = !!setting.cols.find(x => { return x.wordWrap; });
         for (let iRow = 0; iRow < data.length; iRow++) {
         for (let iRow = 0; iRow < data.length; iRow++) {
             const curRow = setting.headRows + iRow;
             const curRow = setting.headRows + iRow;
             const d = data[iRow];
             const d = data[iRow];
@@ -57,6 +58,7 @@ const SpreadExcelObj = (function() {
                 const col = setting.cols[iCol];
                 const col = setting.cols[iCol];
                 if (col.field !== '' && d[col.field]) {
                 if (col.field !== '' && d[col.field]) {
                     cell.value(col.getValue ? col.getValue(d) : d[col.field]);
                     cell.value(col.getValue ? col.getValue(d) : d[col.field]);
+                    if (col.wordWrap) cell.wordWrap(true);
                     if (typeof d[col.field] === 'string') {
                     if (typeof d[col.field] === 'string') {
                         cell.formatter('@');
                         cell.formatter('@');
                     }
                     }
@@ -66,8 +68,9 @@ const SpreadExcelObj = (function() {
                 } else if (setting.font) {
                 } else if (setting.font) {
                     cell.font(setting.font);
                     cell.font(setting.font);
                 }
                 }
-                cell.hAlign(col.hAlign);
+                cell.hAlign(col.hAlign).vAlign(1);
             }
             }
+            if (autoFit) sheet.autoFitRow(curRow);
         }
         }
         SpreadJsObj.endMassOperation(sheet);
         SpreadJsObj.endMassOperation(sheet);
     };
     };

+ 54 - 5
app/public/js/stage.js

@@ -15,13 +15,14 @@ function checkTzMeasureType () {
 function transExpr(expr) {
 function transExpr(expr) {
     return $.trim(expr).replace('\t', '').replace('=', '').replace(new RegExp('%', 'gm'), '/100');
     return $.trim(expr).replace('\t', '').replace('=', '').replace(new RegExp('%', 'gm'), '/100');
 }
 }
-function getExprInfo (field) {
+function getExprInfo (field, converse = false) {
     const exprField = [
     const exprField = [
         {qty: 'sgfh_qty', expr: 'sgfh_expr'},
         {qty: 'sgfh_qty', expr: 'sgfh_expr'},
         {qty: 'sjcl_qty', expr: 'sjcl_expr'},
         {qty: 'sjcl_qty', expr: 'sjcl_expr'},
         {qty: 'qtcl_qty', expr: 'qtcl_expr'},
         {qty: 'qtcl_qty', expr: 'qtcl_expr'},
         {qty: 'contract_qty', expr: 'contract_expr'},
         {qty: 'contract_qty', expr: 'contract_expr'},
     ];
     ];
+    if (converse) return _.find(exprField, { expr: field });
     return _.find(exprField, {qty: field});
     return _.find(exprField, {qty: field});
 }
 }
 
 
@@ -2125,6 +2126,23 @@ $(document).ready(() => {
                                 return;
                                 return;
                             }
                             }
                         }
                         }
+                    } else if (col.field.indexOf('_expr') > 0) {
+                        const exprInfo = getExprInfo(col.field, true);
+                        if (!exprInfo) return;
+
+                        if (newText) {
+                            try {
+                                data.updateData[exprInfo.qty] = ZhCalc.mathCalcExpr(transExpr(newText));
+                                data.updateData[exprInfo.expr] = newText;
+                            } catch(err) {
+                                toastr.error('输入的表达式非法');
+                                SpreadJsObj.reLoadRowData(info.sheet, info.row);
+                                return;
+                            }
+                        } else {
+                            data.updateData[exprInfo.qty] = 0;
+                            data.updateData[exprInfo.expr] = '';
+                        }
                     } else {
                     } else {
                         data.updateData[col.field] = newText;
                         data.updateData[col.field] = newText;
                     }
                     }
@@ -2162,6 +2180,7 @@ $(document).ready(() => {
             }
             }
             switch (col.field) {
             switch (col.field) {
                 case 'contract_qty':
                 case 'contract_qty':
+                case 'contract_expr':
                 case 'qc_qty':
                 case 'qc_qty':
                 case 'qc_minus_qty':
                 case 'qc_minus_qty':
                     info.cancel = node.settle_status === settleStatus.finish;
                     info.cancel = node.settle_status === settleStatus.finish;
@@ -2172,7 +2191,7 @@ $(document).ready(() => {
             if (info.sheet.zh_setting) {
             if (info.sheet.zh_setting) {
                 const sortData = info.sheet.zh_data;
                 const sortData = info.sheet.zh_data;
                 const range = info.cellRange;
                 const range = info.cellRange;
-                const validField = ['contract_qty', 'postil', 'real_qty', 'ex_memo1', 'ex_memo2', 'ex_memo3'];
+                const validField = ['contract_qty', 'contract_expr', 'postil', 'real_qty', 'ex_memo1', 'ex_memo2', 'ex_memo3'];
                 if (!checkTzMeasureType()) {
                 if (!checkTzMeasureType()) {
                     validField.push('name', 'sgfh_qty', 'sjcl_qty', 'qtcl_qty', 'position', 'drawing_code');
                     validField.push('name', 'sgfh_qty', 'sjcl_qty', 'qtcl_qty', 'position', 'drawing_code');
                 }
                 }
@@ -2198,6 +2217,9 @@ $(document).ready(() => {
             }
             }
         },
         },
         clipboardPasted: function (e, info) {
         clipboardPasted: function (e, info) {
+            const hint = {
+                expr: {type: 'warning', msg: '粘贴了表达式非法,已过滤'},
+            };
             if (info.sheet.zh_setting) {
             if (info.sheet.zh_setting) {
                 if (info.sheet.getColumnCount() > info.sheet.zh_setting.cols.length) {
                 if (info.sheet.getColumnCount() > info.sheet.zh_setting.cols.length) {
                     info.sheet.setColumnCount(info.sheet.zh_setting.cols.length);
                     info.sheet.setColumnCount(info.sheet.zh_setting.cols.length);
@@ -2254,6 +2276,16 @@ $(document).ready(() => {
                                     newData[colSetting.field] = null;
                                     newData[colSetting.field] = null;
                                     if (exprInfo) newData[exprInfo.expr] = '';
                                     if (exprInfo) newData[exprInfo.expr] = '';
                                 }
                                 }
+                            } else if (colSetting.field.indexOf('_expr') > 0) {
+                                try {
+                                    const exprInfo = getExprInfo(colSetting.field, true);
+                                    newData[exprInfo.expr] = trimInvalidChar(info.sheet.getText(curRow, curCol));
+                                    if (newData[exprInfo.expr] || newData[exprInfo.qty] === undefined) {
+                                        newData[exprInfo.qty] = ZhCalc.mathCalcExpr(transExpr(newData[exprInfo.expr]));
+                                    }
+                                } catch (err) {
+                                    toastMessageUniq(hint.expr);
+                                }
                             } else {
                             } else {
                                 newData[colSetting.field] = newValue;
                                 newData[colSetting.field] = newValue;
                             }
                             }
@@ -2298,6 +2330,16 @@ $(document).ready(() => {
                                             return;
                                             return;
                                         }
                                         }
                                     }
                                     }
+                                } else if (colSetting.field.indexOf('_expr') > 0) {
+                                    try {
+                                        const exprInfo = getExprInfo(colSetting.field, true);
+                                        newData[exprInfo.expr] = trimInvalidChar(info.sheet.getText(curRow, curCol));
+                                        if (newData[exprInfo.expr] || newData[exprInfo.qty] === undefined) {
+                                            newData[exprInfo.qty] = ZhCalc.mathCalcExpr(transExpr(newData[exprInfo.expr]));
+                                        }
+                                    } catch (err) {
+                                        toastMessageUniq(hint.expr);
+                                    }
                                 } else {
                                 } else {
                                     newData[colSetting.field] = newValue;
                                     newData[colSetting.field] = newValue;
                                 }
                                 }
@@ -2356,10 +2398,17 @@ $(document).ready(() => {
                                 toastr.error('已结算节点不可计量');
                                 toastr.error('已结算节点不可计量');
                                 return;
                                 return;
                             }
                             }
-                            data[colSetting.field] = null;
-                            const exprInfo = getExprInfo(colSetting.field);
-                            if (exprInfo) {
+                            if (colSetting.field.indexOf('_expr') > 0) {
+                                const exprInfo = getExprInfo(colSetting.field, true);
+                                if (!exprInfo) continue;
                                 data[exprInfo.expr] = '';
                                 data[exprInfo.expr] = '';
+                                data[exprInfo.qty] = 0;
+                            } else {
+                                data[colSetting.field] = null;
+                                const exprInfo = getExprInfo(colSetting.field);
+                                if (exprInfo) {
+                                    data[exprInfo.expr] = '';
+                                }
                             }
                             }
                         }
                         }
                         datas.push(data);
                         datas.push(data);