浏览代码

判断条件更改

laiguoran 4 年之前
父节点
当前提交
798a0e7171
共有 1 个文件被更改,包括 15 次插入4 次删除
  1. 15 4
      app/public/js/material_list.js

+ 15 - 4
app/public/js/material_list.js

@@ -8,6 +8,10 @@
  * @version
  */
 
+function getStageId() {
+    return window.location.pathname.split('/')[5];
+}
+
 function findNotJoinLeafXmj(x, type = '') {
     if (type === 'index') {
         return notJoinList.findIndex(function (item) {
@@ -20,10 +24,17 @@ function findNotJoinLeafXmj(x, type = '') {
 }
 
 function getMpSpreadByMBData(id) {
-    const info = materialBillsData.find(function (item) {
-        return item.mb_id === parseInt(id);
-    });
-    return info.m_spread;
+    let info = null;
+    if (parseInt(getStageId()) === parseInt(stage_order)) {
+        info = materialBillsData.find(function (item) {
+            return item.id === parseInt(id);
+        });
+    } else {
+        info = materialBillsData.find(function (item) {
+            return item.mb_id === parseInt(id);
+        });
+    }
+    return info ? info.m_spread : 0;
 }
 
 function getMaterialListByLeafXmj(gcl_id, xmj_id, mx_id = null) {