zhouzhendong 4 лет назад
Родитель
Сommit
69fea82b6f

+ 10 - 0
app/Http/Controllers/TestController.php

@@ -161,7 +161,17 @@ class TestController extends Controller
 
     public function test(Request $request)
     {
+        //9000*6000;
+
         return view("equipment.index");
+        $n = 5;
+        $m = 4;
+        for ($i=0;$i<$m;$i++){
+            for ($j=0;$j<$n;$j++){
+                dump("index:".($i*$n+$j));
+            }
+        }
+        dd(1);
         $path = '';
         $id = 190;
 

+ 13 - 4
resources/views/equipment/_location.blade.php

@@ -13,10 +13,19 @@
                     <table class="table table-bordered w-100 h-100 m-0"
                         v-if="current.children[currentEqChildIndex].row>0 && current.children[currentEqChildIndex].column>0">
                         <tr v-for="row in current.children[currentEqChildIndex].row">
-                            <td v-for="column in current.children[currentEqChildIndex].column" v-if="locations[row-1] && locations[row-1][column-1]"
-                                class="p-0 text-center">
-                                <div style="border: 2px darkgray solid;" class="el-center w-100 h-100 text-secondary font-weight-bold">
-                                    @{{ locations[row-1][column-1].code }}</div>
+                            <td v-for="column in current.children[currentEqChildIndex].column" v-if="locations[(row-1)*current.children[currentEqChildIndex].column+(column-1)]"
+                                class="p-0 text-center position-relative">
+                                <div style="border: 2px darkgray solid;" class="el-center w-100 h-100 text-secondary font-weight-bold"
+                                :style="locations[(row-1)*current.children[currentEqChildIndex].column+(column-1)].code|childStyle">
+                                    @{{ locations[(row-1)*current.children[currentEqChildIndex].column+(column-1)].code }}</div>
+                                <div style="position: absolute;bottom: 0" class="w-100 row">
+                                    <div class="col-5 offset-1">
+                                        <h6 class="text-muted">在库数量:</h6><b>@{{ locations[(row-1)*current.children[currentEqChildIndex].column+(column-1)].code | qty }}</b>
+                                    </div>
+                                    <div class="col-5">
+                                        <h6 class="text-muted">待操作数量:</h6><b>@{{ locations[(row-1)*current.children[currentEqChildIndex].column+(column-1)].code | qtyOver }}</b>
+                                    </div>
+                                </div>
                             </td>
                         </tr>
                     </table>

+ 25 - 17
resources/views/equipment/index.blade.php

@@ -234,6 +234,7 @@
         data:{
             group:[],//库区列表
             ws:[],//仓库列表
+            locationMapping:{},//库位的信息映射
             warehouseDetail:{},//当前操作的仓库
             repository:{},//当前操作的库区
             warehouses:[], //仓库描述
@@ -500,7 +501,8 @@
                     success : (res)=>{
                         switch (res.code){
                             case 200:
-                                this.locations = this._chunkArr(res.data,children.column);
+                                this.locations = res.data[0];
+                                this.locationMapping = res.data[1];
                                 this.isLoadLocation = false;
                                 setTimeout(()=>{
                                     let parentDom = document.getElementById("detailInfo").firstChild.firstChild;
@@ -509,7 +511,7 @@
                                 },10);
                                 break;
                             default:
-                                alert("未知响应");
+                                window.toast.error(res.message);
                         }
                     },
                     error : (err)=>{
@@ -519,20 +521,6 @@
                     timeout:3000,
                 })
             },
-            _chunkArr(arr, size){
-                let result = [];
-                let item = [];
-                for (let i=0;i<arr.length;i++){
-                    if (i!==0 && i%size===0){
-                        result.push(item);
-                        item = [];
-                    }
-                    item.push(arr[i]);
-                }
-                if (item.length!==0)result.push(item);
-                console.log(result);
-                return result;
-            },
             showDetail(equipment){
                 if (!this.isNotEdit)return;
                 this.current = equipment;
@@ -675,7 +663,7 @@
                     success : (res)=>{
                         switch (res.code){
                             case 200:
-                                this.locations = this._chunkArr(res.data,Number(this.buildPool.column));
+                                this.locations = res.data;
                                 window.toast.success("构建成功!");
                                 this.current.children[this.currentEqChildIndex].row = Number(this.buildPool.row);
                                 this.current.children[this.currentEqChildIndex].column = Number(this.buildPool.column);
@@ -817,6 +805,26 @@
                 })
             },
         },
+        filters:{
+            qty(code){
+                let inv = vue.locationMapping[code];
+                if(!inv)return 0;
+                return inv.QTY;
+            },
+            qtyOver(code){
+                let inv = vue.locationMapping[code];
+                if(!inv)return 0;
+                return inv.QTYALLOCATED + inv.QTYMVIN + inv.QTYMVOUT + inv.QTYONHOLD + inv.QTYPA + inv.QTYRPIN + inv.QTYRPOUT;
+            },
+            childStyle(code){
+                let inv = vue.locationMapping[code];
+                if (!inv)return '';
+                let qty = inv.QTY;
+                let other = inv.QTYALLOCATED + inv.QTYMVIN + inv.QTYMVOUT + inv.QTYONHOLD + inv.QTYPA + inv.QTYRPIN + inv.QTYRPOUT;
+                return (qty>0 || other>0) ?
+                    'color: #fff;background-color: #38c172;border-color: #38c172;' : '';
+            }
+        }
     });
 </script>
 </html>