Sfoglia il codice sorgente

计量期,新建时未选择创建年月、截止日期,新建后,再次编辑不应显示NaN

MaiXinRong 6 anni fa
parent
commit
fa00912121
2 ha cambiato i file con 10 aggiunte e 4 eliminazioni
  1. 1 1
      app/extend/helper.js
  2. 9 3
      app/view/measure/stage_modal.ejs

+ 1 - 1
app/extend/helper.js

@@ -415,7 +415,7 @@ module.exports = {
             });
             children.sort(function (a, b) {
                 return a.order - b.order;
-            })
+            });
             return children;
         };
         const getChildren = function (nodes, node) {

+ 9 - 3
app/view/measure/stage_modal.ejs

@@ -149,13 +149,19 @@
 <script>
     <% if (stages.length > 0 && stages[0].status === auditConst.status.uncheck && stages[0].user_id === ctx.session.sessionUser.accountId) { %>
     const editDate = $('#edit-date').datepicker().data('datepicker');
-    editDate.selectDate(new Date('<%- stages[0].s_time %>'));
+    if ('<%- stages[0].s_time %>' && '<%- stages[0].s_time %>' !== '') {
+        editDate.selectDate(new Date('<%- stages[0].s_time %>'));
+    }
     const period = [];
     for (const p of'<%- stages[0].period %>'.split('~')) {
-        period.push(new Date(p));
+        if (p && p !== '') {
+            period.push(new Date(p));
+        }
     }
     const editPeriod = $('#edit-period').datepicker().data('datepicker');
-    editPeriod.selectDate(period);
+    if (period.length > 0) {
+        editPeriod.selectDate(period);
+    }
     <% } %>
     // $('#edit-ok').click(function () {
     //     const data = {