Browse Source

Merge branch 'master' of ssh://was.baoshi56.com:10022/var/git/bswas

zengjun 4 years ago
parent
commit
82603862f5

+ 0 - 4
app/Http/Controllers/ControlPanelController.php

@@ -115,10 +115,6 @@ class ControlPanelController extends Controller
 
     public function getCountingOwnerIds($ownerIds)
     {
-
-        $user = auth()->user();
-        /** @var UserService $userService */
-        $userService = app('UserService');
         $permittingOwnerIds = app("OwnerService")->getIdArr();
         if (!$ownerIds) {
             return $permittingOwnerIds;

+ 1 - 5
app/Http/Controllers/CustomerController.php

@@ -38,11 +38,7 @@ use Oursdreams\Export\Export;
 class CustomerController extends Controller
 {
     use AsyncResponse;
-    /**
-     * Display a listing of the resource.
-     * @param Request $request
-     * @return Response
-     */
+
     public function projectReport(Request $request)
     {
         if(!Gate::allows('项目管理-项目-报表')){ return view('customer.index');  }

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

@@ -62,8 +62,6 @@ class TestController extends Controller
         }
     }
     public function test(){
-        $owners = [1,32];
-        dd("AND id_owner IN (".implode(",",$owners).")");
     }
 
     public function test123()

+ 1 - 1
app/Services/OwnerAreaReportService.php

@@ -41,7 +41,7 @@ class OwnerAreaReportService
 
     public function paginate(array $params, array $withs = null)
     {
-        $areas = OwnerAreaReport::query()->whereIn("owner_id",Auth::user()['permittingOwnerIds'])->orderByDesc('id');
+        $areas = OwnerAreaReport::query()->whereIn("owner_id",app("OwnerService")->getQuery())->orderByDesc('id');
         if ($withs)$areas->with($withs);
         return $this->query($areas,$params)->paginate($params["paginate"] ?? 50);
     }

+ 8 - 6
resources/views/customer/project/area.blade.php

@@ -294,12 +294,14 @@
                     let url="{{url('customer/project/createAreaReport')}}";
                     let params = {val:val};
                     window.tempTip.postBasicRequest(url,params,res=>{
-                        res.forEach(data =>{
-                            if (this.areas.every(area=>{
-                                if (area.id == data.id)return false;
-                                else return true;
-                            }))this.areas.unshift(data);
-                        });
+                        if (res){
+                            res.forEach(data =>{
+                                if (this.areas.every(area=>{
+                                    if (area.id == data.id)return false;
+                                    else return true;
+                                }))this.areas.unshift(data);
+                            });
+                        }
                         dom.selectpicker('val',[]);
                         return "已生成报表";
                     },true)

+ 6 - 6
resources/views/customer/project/create.blade.php

@@ -604,12 +604,12 @@
                     let params = {id:this.ownerTemp.id};
                     window.tempTip.postBasicRequest(url,params,res=>{
                         let audit = {};
-                        if (res.storage_audit_count)audit.storage = true;
-                        if (res.operation_audit_count)audit.operation = true;
-                        if (res.express_audit_count)audit.express = true;
-                        if (res.logistic_audit_count)audit.logistic = true;
-                        if (res.direct_logistic_audit_count)audit.directLogistic = true;
-                        if (res.system_audit_count)audit.system = true;
+                        if (res.storage_audit_count && Number(res.storage_audit_count))audit.storage = true;
+                        if (res.operation_audit_count && Number(res.operation_audit_count))audit.operation = true;
+                        if (res.express_audit_count && Number(res.express_audit_count))audit.express = true;
+                        if (res.logistic_audit_count && Number(res.logistic_audit_count))audit.logistic = true;
+                        if (res.direct_logistic_audit_count && Number(res.direct_logistic_audit_count))audit.directLogistic = true;
+                        if (res.system_audit_count && Number(res.system_audit_count))audit.system = true;
                         this.audit = audit;
                         if (res.owner_storage_price_models.length>0)this.selectedModel.storage = res.owner_storage_price_models;
                         if (res.owner_price_operations.length>0){

+ 1 - 8
resources/views/equipment/_detailInfo.blade.php

@@ -26,18 +26,11 @@
                 <div class="col-6" style="border-right: 1px #D3D3D3 solid">
                     <div v-for="layer in flipLayer" style="border: 1px #000000 solid;height: 70px;cursor: pointer" @click="nextDetail(layer)"
                         :style="[{width:100*(current.grid)+'px'}]">
-<!--                        <table class="table table-bordered w-100 h-100 m-0" v-if="current.children && current.children.length>0">
-                            <tr v-for="row in current.children[layer-1].row">
-                                <td v-for="column in current.children[layer-1].column"
-                                    class="p-0 text-center position-relative">
-                                </td>
-                            </tr>
-                        </table>-->
                         <span class="h-100 w-100 el-center">@{{ layer<10 ? '0'+layer : layer }}</span>
                     </div>
                 </div>
                 <div class="col-6 p-0" :style="[error.children ? {border: '2px red solid'} : '']">
-                    <div v-for="(item,i) in current.children" class="row m-0" style="border-bottom: 1px #D3D3D3 solid;height: 70px">
+                    <div v-for="(item,i) in flipChildren" class="row m-0" style="border-bottom: 1px #D3D3D3 solid;height: 70px">
                         <div class="col-4">
                             设备高度/M:<input class="form-control" min="0" type="number" step="0.01" :class="error['children['+i+'].height'] ? 'is-invalid' : ''" v-model="item.height"></input>
                         </div>

+ 7 - 1
resources/views/equipment/_location.blade.php

@@ -2,7 +2,7 @@
     <div class="modal-dialog modal-lg modal-dialog-centered" role="document" style="z-index: 1045">
         <div class="modal-content">
             <div class="modal-header">
-                <h1 class="offset-5" v-if="!batchSign">@{{ current.code+'-'+((currentEqChildIndex+1)<10 ? '0'+(currentEqChildIndex+1) : (currentEqChildIndex+1)) }}</h1>
+                <h1 class="offset-5" v-if="!batchSign">@{{ current.code+'-'+(currentEqChildIndex+1) }}</h1>
                 <button type="button" class="close" data-dismiss="modal">&times;</button>
             </div>
             <div class="modal-body p-0">
@@ -95,6 +95,12 @@
                                 <input class="switch" type="checkbox" id="loseIdFlag" v-model="buildPool.loseIdFlag" />
                             </div>
                         </div>
+                        <div class="row mt-3 mb-2">
+                            <label class="offset-1 col-4 text-right">纵数</label>
+                            <div class="col-5">
+                                <input min="1" type="number" step="1" max="26" class="form-control" v-model="buildPool.tandem" />
+                            </div>
+                        </div>
                     </div>
                 </div>
             </div>

+ 110 - 81
resources/views/equipment/index.blade.php

@@ -267,7 +267,7 @@
                                 <i class="fa fa-spinner fa-spin"></i>
                             </div>
                         </div>
-                        <div class="h-100 txt-sty w-100 el-center" :class="element.turn ? 're' : ''" v-else>@{{ element.code | removePrefix }}</div>
+                        <div class="h-100 txt-sty w-100 el-center" :class="element.turn ? 're' : ''" v-else>@{{ element.code}}</div>
                     </vue-drag-resize>
                 </div>
             </div>
@@ -378,6 +378,16 @@
                 }
                 return layer;
             },
+            flipChildren(){
+                if(!this.current.children){
+                    return [];
+                }
+                let children = [];
+                for (let i=this.current.children.length - 1;i>=0;i--){
+                    children.push(this.current.children[i]);
+                }
+                return children;
+            },
         },
         created: function() {
             let content = document.getElementById("canvasApp");
@@ -411,6 +421,87 @@
             };
         },
         methods:{
+            //仓库切换
+            selectedWarehouse(warehouse){
+                this.isLoad = false;
+                setTimeout(()=>{
+                    this.selected = warehouse.id;
+                    this.name = warehouse.name;
+                    this.ratio = warehouse.ratio;
+                    this.container = {width:warehouse.length*this.ratio,height:warehouse.width*this.ratio};
+                    localStorage.setItem("equipment:warehouse", warehouse.id);
+                    $.ajax({
+                        url : this.baseUrl+"warehouse/detail/getCoordsInfo",
+                        type : "post",
+                        dataType : "JSON",
+                        data : {id:warehouse.id},
+                        success : (res,status)=>{
+                            this.elements = res.data[0] ? JSON.parse(res.data[0]) : [];
+                            if(res.data[1] && res.data[1].length>0){
+                                let equipmentElements = [];
+                                res.data[1].forEach(eq=>{
+                                    let coords = JSON.parse(eq.info);
+                                    let selfInfo = this.equipments[coords.id-1];
+                                    equipmentElements.push(Object.assign({
+                                        eqId:eq.id,
+                                        exist:eq.exist,
+                                        code:eq.code,
+                                        width:eq.width,
+                                        depth:eq.depth,
+                                        repository:eq.repositoryId,
+                                        x:coords.x,
+                                        y:coords.y,
+                                        turn:!!coords.turn,
+                                    },selfInfo));
+                                });
+                                this.equipmentElements = equipmentElements;
+                            }else this.equipmentElements = [];
+                            this.repositories = res.data[2];
+                            this.isNotEdit = true;
+                            this.isLoad = true;
+                        },
+                        error : (err,status)=>{
+                            window.tempTip.show("坐标信息加载失败");
+                        },
+                        timeout:3000,
+                    })
+                },200);
+            },
+            /**
+             * 初始页加载
+             */
+            initPage(){
+                $.ajax({
+                    url : this.baseUrl+"warehouse/detail",
+                    type : "GET",
+                    success : (res,status)=>{
+                        this.warehouses = res.data;
+                        //这里获取warehouses
+                        let id = localStorage.getItem("equipment:warehouse");
+                        if (!id || !this.warehouses.some(warehouse=>{
+                            if (warehouse.id == id){
+                                this.selectedWarehouse(warehouse);
+                                return true;
+                            }
+                        })
+                        ){
+                            if (this.warehouses.length>0)this.selectedWarehouse(this.warehouses[0]);
+                        }
+                        $("#loading").hide();
+                    },
+                    error : (err,status)=>{
+                        window.tempTip.show("加载失败");
+                    },
+                    timeout:3000,
+                })
+            },
+            flipArr(arr){
+                let flip = [];
+                for (let i=arr.length-1;i>=0;i--){
+                    flip.push(arr[i]);
+                }
+                return flip;
+            },
             loadElement(){
                 if (this.isShowRatio===undefined){
                     this.isShowRatio = true;
@@ -710,31 +801,6 @@
                     timeout:10000,
                 })
             },
-            initPage(){
-                $.ajax({
-                    url : this.baseUrl+"warehouse/detail",
-                    type : "GET",
-                    success : (res,status)=>{
-                        this.warehouses = res.data;
-                        //这里获取warehouses
-                        let id = localStorage.getItem("equipment:warehouse");
-                        if (!id || !this.warehouses.some(warehouse=>{
-                                    if (warehouse.id == id){
-                                        this.selectedWarehouse(warehouse);
-                                        return true;
-                                    }
-                                })
-                        ){
-                            if (this.warehouses.length>0)this.selectedWarehouse(this.warehouses[0]);
-                        }
-                        $("#loading").hide();
-                    },
-                    error : (err,status)=>{
-                        window.tempTip.show("加载失败");
-                    },
-                    timeout:3000,
-                })
-            },
             //备选设备拖拽按下事件
             eqDown(equipment){
                 if (this.isNotEdit)return;
@@ -860,52 +926,6 @@
                 this.currentEl.updateCoords = true;
                 $("#canvas").focus();
             },
-            //仓库切换
-            selectedWarehouse(warehouse){
-                this.isLoad = false;
-                setTimeout(()=>{
-                    this.selected = warehouse.id;
-                    this.name = warehouse.name;
-                    this.ratio = warehouse.ratio;
-                    this.container = {width:warehouse.length*this.ratio,height:warehouse.width*this.ratio};
-                    localStorage.setItem("equipment:warehouse", warehouse.id);
-                    $.ajax({
-                        url : this.baseUrl+"warehouse/detail/getCoordsInfo",
-                        type : "post",
-                        dataType : "JSON",
-                        data : {id:warehouse.id},
-                        success : (res,status)=>{
-                            this.elements = res.data[0] ? JSON.parse(res.data[0]) : [];
-                            if(res.data[1] && res.data[1].length>0){
-                                let equipmentElements = [];
-                                res.data[1].forEach(eq=>{
-                                    let coords = JSON.parse(eq.info);
-                                    let selfInfo = this.equipments[coords.id-1];
-                                    equipmentElements.push(Object.assign({
-                                        eqId:eq.id,
-                                        exist:eq.exist,
-                                        code:eq.code,
-                                        width:eq.width,
-                                        depth:eq.depth,
-                                        repository:eq.repositoryId,
-                                        x:coords.x,
-                                        y:coords.y,
-                                        turn:!!coords.turn,
-                                    },selfInfo));
-                                });
-                                this.equipmentElements = equipmentElements;
-                            }else this.equipmentElements = [];
-                            this.repositories = res.data[2];
-                            this.isNotEdit = true;
-                            this.isLoad = true;
-                        },
-                        error : (err,status)=>{
-                            window.tempTip.show("坐标信息加载失败");
-                        },
-                        timeout:3000,
-                    })
-                },200);
-            },
             //文本类属性改变
             changeText(key){
                 this.currentEl[key] = event.target.value;
@@ -968,6 +988,10 @@
                     $("#locationModal").modal("show");
                 },20);
                 let children = this.current.children[this.currentEqChildIndex];
+                this.current.children.forEach(item=>{
+                    item.row = Number(item.row);
+                    item.column = Number(item.column);
+                });
                 $.ajax({
                     url : this.baseUrl+"location/get",
                     type : "post",
@@ -1052,9 +1076,15 @@
                         switch (res.code){
                             case 200:
                                 equipment.eqId = res.data[0];
+                                let locCount = 0;
                                 equipment.children.forEach((item,index)=>{
                                     item.id = res.data[1][index];
-                                })
+                                    if (item.row && Number(item.row) > 0){
+                                        locCount += Number(item.row) * Number(item.column)
+                                    }
+                                });
+                                equipment.exist = locCount;
+                                this.$forceUpdate();
                                 $("#detailInfo").modal("hide");
                                 window.toast.success("保存成功");
                                 break;
@@ -1062,14 +1092,15 @@
                                 this.error = res.data;
                                 break;
                             case 414:
-                                this.error = {"code":"设备编码重复"};
-                                this.toast.error(this.error.code);
+                                this.error = {code:"设备编码重复"};
+                                window.toast.error(this.error.code);
                                 break;
                             default:
                                 window.toast.error("服务器错误:"+res.message);
                         }
                     },
                     error : (err)=>{
+                        console.error(err);
                         window.tempTip.setIndex(999);
                         window.tempTip.show("网络错误");
                     },
@@ -1081,7 +1112,6 @@
                 if (!equipment.code)error.code = "设备编号未填写";
                 if (!equipment.width)error.width = "设备宽度未填写";
                 if (!equipment.depth)error.depth = "设备深度未填写";
-                //if (!equipment.repository)error.repositoryId = "设备库区未选定";
                 if (equipment.layer !== equipment.children.length)error.children = "设备绑定错误";
                 for (let i=0;i<equipment.layer;i++){
                     if (!equipment.children[i].height)error["children["+i+"].height"] = "设备高度不得为空"
@@ -1191,7 +1221,7 @@
                 }
                 if (this.isLoadLocation)return;
                 let eq = this.current.children[this.currentEqChildIndex];
-                let code = this.current.code+'-'+((this.currentEqChildIndex+1)<10 ? '0'+(this.currentEqChildIndex+1) : (this.currentEqChildIndex+1));
+                let code = this.current.code+'-'+(this.currentEqChildIndex+1);
                 this.isLoadLocation = true;
                 $.ajax({
                     url : this.baseUrl+"location/locationBind",
@@ -1206,7 +1236,8 @@
                                 window.toast.success("构建成功!");
                                 this.current.children[this.currentEqChildIndex].row = Number(this.buildPool.row);
                                 this.current.children[this.currentEqChildIndex].column = Number(this.buildPool.column);
-                                this.buildPool = {};
+                                this._locationAttrDefault();
+                                $("#locationModal").modal("hide");
                                 this.$forceUpdate();
                                 break;
                             default:
@@ -1325,6 +1356,7 @@
                             case 200:
                                 this.repositories.push(res.data);
                                 $("#repository").modal("hide");
+                                this.repository = {};
                                 break;
                             default:
                                 window.toast.error("库区建立失败");
@@ -1377,9 +1409,6 @@
             formatCount(tab){
                 let arr = tab.split("-");
                 return arr[0]*arr[1];
-            },
-            removePrefix(code){
-                return code.slice(3);
             }
         }
     });

+ 1 - 1
resources/views/rejected/search/general.blade.php

@@ -315,7 +315,7 @@
                         this.sum+'</b> 条数据</div>');
                 },
                 getTotal(){
-                    window.axios.post(window.location.href).then(res=>{
+                    window.axios.post(decodeURIComponent(decodeURIComponent(window.location.href))).then(res=>{
                         this.sum = res.data;
                         this.renderingTotal();
                     });