Browse Source

修复bug

laiguoran 3 years ago
parent
commit
6202775f44
2 changed files with 4 additions and 4 deletions
  1. 1 1
      app/controller/material_controller.js
  2. 3 3
      app/public/js/material_checklist.js

+ 1 - 1
app/controller/material_controller.js

@@ -1319,7 +1319,7 @@ module.exports = app => {
                     throw '无法设置非最新期的清单设置数据';
                 }
                 // 权限控制
-                if (!ctx.material.checklistPermission) {
+                if (!ctx.material.checklistPermission && data.type !== 'resetChecklist') {
                     throw '本期已审批完成或权限不足,无法设置清单数据';
                 }
                 switch (data.type) {

+ 3 - 3
app/public/js/material_checklist.js

@@ -139,6 +139,7 @@ $(document).ready(() => {
         gclGatherData = gclGatherModel.gatherGclData();
         console.log(gclGatherData);
         const hadBillsidList = _.uniq(_.map(materialListData, 'gcl_id'));
+        console.log(hadBillsidList);
         // 对比清单设置和调差清单,还要和台账对比,显示已选清单列表 不同则更新到清单设置页中
         const pushData = [];
         const updateData = [];
@@ -164,15 +165,14 @@ $(document).ready(() => {
             // 更新had_bills值
             if (mc.had_bills === 1) {
                 if (_.indexOf(hadBillsidList, gcl.leafXmjs ? gcl.leafXmjs[0].gcl_id : null) === -1) {
-                    updateData.push({ id: mc.id, had_bills: 0 });
+                    updateData.push({ id: mc.id, mid: materialID, had_bills: 0 });
                 }
             }
-
         }
         setChecklistData(pushData, removeData, updateData, true);
     });
     function setChecklistData(pushData, removeData, updateData = [], sendmsg = false) {
-        if (pushData.length > 0 || removeData.length > 0) {
+        if (pushData.length > 0 || removeData.length > 0 || updateData.length > 0) {
             postData(window.location.pathname + '/save', { type: 'resetChecklist', pushData, removeData, updateData }, function (result2) {
                 if (sendmsg && pushData.length > 0) {
                     toastr.success('已同步并添加到调差清单数据至本页中');