Explorar el Código

Merge branch 'master' of http://192.168.1.41:3000/maixinrong/Calculation

MaiXinRong hace 5 años
padre
commit
97dac41dbc

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

@@ -1946,5 +1946,6 @@ function checkAuditorFrom () {
         toastr.error('请先选择审批人,再上报数据');
         return false;
     }
+    $('#hide-all').show();
 }
 

+ 40 - 3
app/public/js/material.js

@@ -35,10 +35,10 @@ $(document).ready(() => {
             {title: '基准时间', colSpan: '1', rowSpan: '2', field: 'basic_times', hAlign: 0, width: 60, formatter: '@', readOnly: 'readOnly.isEdit'},
             {title: '本期信息价|单价', colSpan: '3|1', rowSpan: '1|1', field: 'msg_tp', hAlign: 2, width: 60, type: 'Number', readOnly: 'readOnly.isEdit'},
             {title: '|时间', colSpan: '|1', rowSpan: '|1', field: 'msg_times', hAlign: 0, width: 60, formatter: '@', readOnly: 'readOnly.isEdit'},
-            {title: '|价差', colSpan: '1', rowSpan: '1|1', field: 'msg_spread', hAlign: 2, width: 60, type: 'Number', readOnly: true},
+            {title: '|价差', colSpan: '1', rowSpan: '1|1', field: 'msg_spread', hAlign: 2, width: 60, type: 'Number', readOnly: true, getValue: 'getValue.msg_spread'},
             {title: '本期材料调差|风险幅度(%)', colSpan: '3|1', rowSpan: '1|1', field: 'm_risk', hAlign: 2, width: 100, type: 'Number', readOnly: 'readOnly.isEdit'},
-            {title: '|有效价差', colSpan: '|1', rowSpan: '|1', field: 'm_spread', hAlign: 2, width: 80, type: 'Number', readOnly: true},
-            {title: '|调整金额', colSpan: '|1', rowSpan: '1|1', field: 'm_tp', hAlign: 2, width: 80, type: 'Number', readOnly: true},
+            {title: '|有效价差', colSpan: '|1', rowSpan: '|1', field: 'm_spread', hAlign: 2, width: 80, type: 'Number', readOnly: true, getValue: 'getValue.m_spread'},
+            {title: '|调整金额', colSpan: '|1', rowSpan: '1|1', field: 'm_tp', hAlign: 2, width: 80, type: 'Number', readOnly: true, getValue: 'getValue.m_tp'},
             {title: '截止上期调差金额', colSpan: '1', rowSpan: '2', field: 'pre_tp', hAlign: 2, width: 120, type: 'Number', readOnly: true},
             {title: '备注', colSpan: '1', rowSpan: '2', field: 'remark', hAlign: 0, width: 60, formatter: '@', readOnly: 'readOnly.remark'},
         ],
@@ -60,6 +60,19 @@ $(document).ready(() => {
     }
 
     const materialCol = {
+        getValue: {
+            msg_spread: function (data) {
+                return ZhCalc.sub(data.msg_tp, data.basic_price);
+            },
+            m_spread : function (data) {
+                const cor = ZhCalc.mul(data.basic_price, ZhCalc.div(data.m_risk, 100));
+                const msg_spread = materialCol.getValue.msg_spread(data);
+                return Math.abs(msg_spread) > Math.abs(cor) ? (msg_spread > 0 ? ZhCalc.sub(msg_spread, cor) : ZhCalc.add(msg_spread, cor)) : 0;
+            },
+            m_tp: function (data) {
+                return ZhCalc.mul(materialCol.getValue.m_spread(data), data.quantity);
+            }
+        },
         readOnly: {
             isEdit: function (data) {
                 return !(readOnly || materialBase.isEdit(data) === undefined);
@@ -131,6 +144,30 @@ $(document).ready(() => {
                     SpreadJsObj.reLoadRowData(info.sheet, info.row);
                     return;
                 }
+                // 判断部分值是否输入的是数字判断和数据计算
+                if (col.field === 'basic_price') {
+                    if (isNaN(validText)) {
+                        toastr.error('不能输入其它非数字类型字符');
+                        SpreadJsObj.reLoadRowData(info.sheet, info.row);
+                        return;
+                    }
+                }
+                if (col.field === 'msg_tp') {
+                    if (isNaN(validText)) {
+                        toastr.error('不能输入其它非数字类型字符');
+                        SpreadJsObj.reLoadRowData(info.sheet, info.row);
+                        return;
+                    }
+                }
+                if (col.field === 'm_risk') {
+                    // 只能输入正整数
+                    if (isNaN(validText)) {
+                        toastr.error('不能输入其它非数字类型字符');
+                        SpreadJsObj.reLoadRowData(info.sheet, info.row);
+                        return;
+                    }
+                }
+
                 select[col.field] = validText;
                 // 更新至服务器
                 postData(window.location.pathname + '/save', { type:'update', updateData: select }, function (result) {

+ 1 - 0
app/public/js/material_audit.js

@@ -144,4 +144,5 @@ function checkAuditorFrom () {
         toast('请先选择审批人,再上报数据', 'error', 'exclamation-circle');
         return false;
     }
+    $('#hide-all').show();
 }

+ 1 - 0
app/public/js/stage_audit.js

@@ -148,4 +148,5 @@ function checkAuditorFrom () {
         toast.error('请先选择审批人,再上报数据');
         return false;
     }
+    $('#hide-all').show();
 }

+ 3 - 0
app/view/layout/layout.ejs

@@ -37,6 +37,9 @@
     <i class="icon fa"></i>
     <span class="message"></span>
 </div>
+<!-- 遮罩层 -->
+<div id="hide-all" style="display:none;position: absolute;width: 100%;height: 100%;top:0;left: 0;z-index:10000000">
+</div>
 <%- modal %>
 <script type="text/javascript">
     toastr.options = {

+ 2 - 0
app/view/material/list_modal.ejs

@@ -20,6 +20,7 @@
                         </thead>
                         <tbody id="materialBills">
                         <% for (const [index,m] of materialBillsData.entries()) { %>
+                        <% if (m.code !== null && m.code !== '') { %>
                         <tr class="table-secondary">
                             <td><%= index+1 %></td>
                             <td><input type="checkbox" checked disabled value="<%= m.id %>"></td>
@@ -29,6 +30,7 @@
                             <td><%= m.spec %></td>
                         </tr>
                         <% } %>
+                        <% } %>
                         </tbody>
                     </table>
                 </div>

+ 2 - 1
app/view/revise/info_modal.ejs

@@ -481,5 +481,6 @@
             toastr.error('请先选择审批人,再上报数据');
             return false;
         }
+        $('#hide-all').show();
     }
-</script>
+</script>