Explorar el Código

调差月信息价数量控制

ellisran hace 6 días
padre
commit
84f7932b1f
Se han modificado 2 ficheros con 7 adiciones y 0 borrados
  1. 4 0
      app/public/js/material.js
  2. 3 0
      app/service/material_month.js

+ 4 - 0
app/public/js/material.js

@@ -1926,6 +1926,10 @@ $(document).ready(() => {
                 yearmonths.push(yearmonth);
             }
             console.log(yearmonths);
+            if (months.length + yearmonths.length > 24) {
+                toastr.error('月信息价不能超过24个月');
+                return false;
+            }
             postData(window.location.pathname + '/month/save', { type: 'adds', updateData: { yearmonths } }, function (data) {
                 months.push(...yearmonths);
                 months.sort();

+ 3 - 0
app/service/material_month.js

@@ -46,6 +46,9 @@ module.exports = app => {
                 const material_month = this.ctx.material.months ? this.ctx.material.months.split(',') : [];
                 material_month.push(...data.yearmonths);
                 material_month.sort();
+                if (material_month.length > 24) {
+                    throw '月信息价不能超过24个月';
+                }
                 if (mbList.length !== 0) {
                     const insertArray = [];
                     const updateArray = [];