Explorar o código

修复查看投料详情的bug

695593266@qq.com hai 4 meses
pai
achega
11091afc8f
Modificáronse 2 ficheiros con 70 adicións e 34 borrados
  1. 1 1
      manifest.json
  2. 69 33
      pages/pda/picking/bill/index.vue

+ 1 - 1
manifest.json

@@ -2,7 +2,7 @@
     "name" : "智慧工厂",
     "name" : "智慧工厂",
     "appid" : "__UNI__45B3907",
     "appid" : "__UNI__45B3907",
     "description" : "",
     "description" : "",
-    "versionName" : "V1.0.3.42",
+    "versionName" : "V1.0.3.43",
     "versionCode" : "100",
     "versionCode" : "100",
     "transformPx" : false,
     "transformPx" : false,
     "h5" : {
     "h5" : {

+ 69 - 33
pages/pda/picking/bill/index.vue

@@ -10,25 +10,25 @@
       @clickLeft="back"
       @clickLeft="back"
     ></uni-nav-bar>
     ></uni-nav-bar>
 
 
-    <view class="list_box">
+    <view class="list_box" v-for="(item, idx) in dataList" :key="idx">
       <view class="card_box cx-sc">
       <view class="card_box cx-sc">
         <view class="content_table">
         <view class="content_table">
           <view class="item">
           <view class="item">
             <view class="lable rx-cc" style="color: #157a2c">领料单号</view>
             <view class="lable rx-cc" style="color: #157a2c">领料单号</view>
             <view class="content rx-bc" style="color: #157a2c">
             <view class="content rx-bc" style="color: #157a2c">
-              {{ dataList.code }}
+              {{ item.code }}
             </view>
             </view>
           </view>
           </view>
           <view class="item">
           <view class="item">
             <view class="lable rx-cc" style="color: #157a2c">领料时间</view>
             <view class="lable rx-cc" style="color: #157a2c">领料时间</view>
             <view class="content rx-bc" style="color: #157a2c">
             <view class="content rx-bc" style="color: #157a2c">
-              {{ dataList.createTime }}
+              {{ item.createTime }}
             </view>
             </view>
           </view>
           </view>
           <view class="item">
           <view class="item">
             <view class="lable rx-cc" style="color: #157a2c">领料人</view>
             <view class="lable rx-cc" style="color: #157a2c">领料人</view>
             <view class="content rx-bc" style="color: #157a2c">
             <view class="content rx-bc" style="color: #157a2c">
-              {{ dataList.executorName }}
+              {{ item.executorName }}
             </view>
             </view>
           </view>
           </view>
 
 
@@ -37,21 +37,21 @@
             <view
             <view
               class="content rx-bc"
               class="content rx-bc"
               style="color: #157a2c"
               style="color: #157a2c"
-              v-if="dataList.type == 1"
+              v-if="item.type == 1"
             >
             >
               自建领料
               自建领料
             </view>
             </view>
             <view
             <view
               class="content rx-bc"
               class="content rx-bc"
               style="color: #157a2c"
               style="color: #157a2c"
-              v-if="dataList.type == 2"
+              v-if="item.type == 2"
             >
             >
               工单领料
               工单领料
             </view>
             </view>
             <view
             <view
               class="content rx-bc"
               class="content rx-bc"
               style="color: #157a2c"
               style="color: #157a2c"
-              v-if="dataList.type == 3"
+              v-if="item.type == 3"
             >
             >
               委外领料
               委外领料
             </view>
             </view>
@@ -60,38 +60,38 @@
       </view>
       </view>
       <u-list
       <u-list
         @scrolltolower="scrolltolower"
         @scrolltolower="scrolltolower"
-        key="dataList"
+        key="dataList-catch"
         v-if="status == 1"
         v-if="status == 1"
         style="padding-bottom: 300rpx"
         style="padding-bottom: 300rpx"
       >
       >
-        <view v-if="dataList.type == 2">
+        <view v-if="item.type == 2">
           <view
           <view
             class="card_box cx-sc"
             class="card_box cx-sc"
-            v-for="(item, index) in dataList.orderInfoList"
+            v-for="(it, index) in orderInfoListSafe(item)"
             :key="index"
             :key="index"
           >
           >
-            <instanceBom :item="item" :isDetails="true"></instanceBom>
+            <instanceBom :item="it" :isDetails="true"></instanceBom>
           </view>
           </view>
 
 
           <u-list-item
           <u-list-item
-            v-if="dataList.orderInfoList.length === 0"
+            v-if="orderInfoListSafe(item).length == 0"
             style="margin-top: 20vh"
             style="margin-top: 20vh"
           >
           >
             <u-empty iconSize="150" textSize="32" text="暂无数据"> </u-empty>
             <u-empty iconSize="150" textSize="32" text="暂无数据"> </u-empty>
           </u-list-item>
           </u-list-item>
         </view>
         </view>
 
 
-        <view v-if="dataList.type == 1">
+        <view v-if="item.type == 1">
           <view
           <view
             class="card_box cx-sc"
             class="card_box cx-sc"
-            v-for="(item, index) in dataList.detailList"
+            v-for="(it, index) in detailListSafe(item)"
             :key="index"
             :key="index"
           >
           >
-            <instanceBomTwo :item="item" :isDetails="true"></instanceBomTwo>
+            <instanceBomTwo :item="it" :isDetails="true"></instanceBomTwo>
           </view>
           </view>
 
 
           <u-list-item
           <u-list-item
-            v-if="dataList.detailList.length === 0"
+            v-if="detailListSafe(item).length == 0"
             style="margin-top: 20vh"
             style="margin-top: 20vh"
           >
           >
             <u-empty iconSize="150" textSize="32" text="暂无数据"> </u-empty>
             <u-empty iconSize="150" textSize="32" text="暂无数据"> </u-empty>
@@ -105,34 +105,34 @@
         v-if="status == 2"
         v-if="status == 2"
         style="padding-bottom: 300rpx"
         style="padding-bottom: 300rpx"
       >
       >
-        <view v-if="dataList.type == 1">
+        <view v-if="item.type == 1">
           <view
           <view
             class="card_box cx-sc"
             class="card_box cx-sc"
-            v-for="(item, index) in dataList.detailList"
+            v-for="(it, index) in detailListSafe(item)"
             :key="index"
             :key="index"
           >
           >
-            <outInstanceBom :item="item" :isDetails="true"></outInstanceBom>
+            <outInstanceBom :item="it" :isDetails="true"></outInstanceBom>
           </view>
           </view>
 
 
           <u-list-item
           <u-list-item
-            v-if="dataList.detailList.length === 0"
+            v-if="detailListSafe(item).length == 0"
             style="margin-top: 20vh"
             style="margin-top: 20vh"
           >
           >
             <u-empty iconSize="150" textSize="32" text="暂无数据"> </u-empty>
             <u-empty iconSize="150" textSize="32" text="暂无数据"> </u-empty>
           </u-list-item>
           </u-list-item>
         </view>
         </view>
 
 
-        <view v-if="dataList.type == 2">
+        <view v-if="item.type == 2">
           <view
           <view
             class="card_box cx-sc"
             class="card_box cx-sc"
-            v-for="(item, index) in dataList.orderInfoList"
+            v-for="(it, index) in orderInfoListSafe(item)"
             :key="index"
             :key="index"
           >
           >
-            <outInstanceBom :item="item" :isDetails="true"></outInstanceBom>
+            <outInstanceBom :item="it" :isDetails="true"></outInstanceBom>
           </view>
           </view>
 
 
           <u-list-item
           <u-list-item
-            v-if="dataList.orderInfoList.length === 0"
+            v-if="orderInfoListSafe(item).length == 0"
             style="margin-top: 20vh"
             style="margin-top: 20vh"
           >
           >
             <u-empty iconSize="150" textSize="32" text="暂无数据"> </u-empty>
             <u-empty iconSize="150" textSize="32" text="暂无数据"> </u-empty>
@@ -177,7 +177,7 @@ export default {
   data() {
   data() {
     return {
     return {
       ids: [],
       ids: [],
-      dataList: null,
+      dataList: [],
       title: null,
       title: null,
       status: 1,
       status: 1,
       item: null,
       item: null,
@@ -186,9 +186,21 @@ export default {
 
 
   onLoad(option) {
   onLoad(option) {
     this.status = option.status || 1;
     this.status = option.status || 1;
-    this.title =
-      option.status == 1 ? "领料详情" : option.status == 2 ? " 出库详情" : "";
-    this.dataList = JSON.parse(option.item);
+    console.log(option.id, "optionoptionoption");
+    if (option.item) {
+      this.title =
+        option.status == 1 ? "领料详情" : option.status == 2 ? " 出库详情" : "";
+      const parsed = JSON.parse(option.item);
+
+      this.dataList = Array.isArray(parsed)
+        ? parsed.filter(Boolean)
+        : parsed
+          ? [parsed]
+          : [];
+    } else {
+      this.ids = [option.id];
+      this.getList();
+    }
   },
   },
 
 
   methods: {
   methods: {
@@ -199,15 +211,30 @@ export default {
         const res = await pickDetails(this.ids);
         const res = await pickDetails(this.ids);
         list = res;
         list = res;
 
 
+        // list.forEach((m) => {
+        //   if (m.orderInfoList.length > 0) {
+        //     m.orderInfoList.forEach((o) => {
+        //       let _arr = [];
+        //       _arr = [...o.bomDetailDTOS, ...o.instanceList];
+        //       _arr = _arr.sort(
+        //         (a, b) => a.rootCategoryLevelId - b.rootCategoryLevelId,
+        //       );
+        //       o["arr"] = _arr;
+        //     });
+        //   }
+        // });
         list.forEach((m) => {
         list.forEach((m) => {
-          if (m.orderInfoList.length > 0) {
+          if (Array.isArray(m.orderInfoList) && m.orderInfoList.length > 0) {
             m.orderInfoList.forEach((o) => {
             m.orderInfoList.forEach((o) => {
               let _arr = [];
               let _arr = [];
-              _arr = [...o.bomDetailDTOS, ...o.instanceList];
-              _arr = _arr.sort(
-                (a, b) => a.rootCategoryLevelId - b.rootCategoryLevelId
+              _arr = [
+                ...(Array.isArray(o.bomDetailDTOS) ? o.bomDetailDTOS : []),
+                ...(Array.isArray(o.instanceList) ? o.instanceList : []),
+              ];
+              _arr.sort(
+                (a, b) => a.rootCategoryLevelId - b.rootCategoryLevelId,
               );
               );
-              o["arr"] = _arr;
+              o.arr = _arr;
             });
             });
           }
           }
         });
         });
@@ -227,6 +254,15 @@ export default {
       }
       }
     },
     },
 
 
+    orderInfoListSafe(item) {
+      console.log(item, "itemitemitem");
+      return Array.isArray(item?.orderInfoList) ? item.orderInfoList : [];
+    },
+    detailListSafe(item) {
+      console.log(item, "itemitemitem");
+      return Array.isArray(item?.detailList) ? item.detailList : [];
+    },
+
     scrolltolower() {},
     scrolltolower() {},
 
 
     tableH(type) {
     tableH(type) {