(function () { 'use strict'; angular.module('task.controller') .controller('PreviewPlaceCtrl', PreviewPlaceCtrl); function PreviewPlaceCtrl($scope, CurdHelper, $timeout, Utils, $window, $state, Common, $document) { $scope.init = init; $scope.haveMaterialPlace = 0; $scope.lockMaterialPlace = 0; $scope.emptyPlace = 0; $scope.emptyLockPlace = 0; $scope.showInfo = showInfo; $scope.currentTab = 1; $scope.unShowInfo = unShowInfo; $scope.changeCurrentTab = changeCurrentTab; $scope.data = {}; $scope.tabs = [{ id: 1, tag: "one", name: "库位预览", datas: {} }]; $scope.containerInfo = { typename: "", name: "", code: "", description: "", updatetime: "", quantity: "", }; $scope.placeTypeNum = { emptyPlace: 0, fullPlace: 0, lockPlace: 0, }; $scope.rows = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]; $scope.columns = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,27,28]; $scope.x = 0; $scope.y = 0; $scope.nav_div = { top: 0, left: 0 }; //$scope.showProdFlag = showProdFlag; //function showProdFlag(flag) { // var str = "无"; // switch (flag) { // case 1: // str = "试"; // break; // case 2: // str = "跟"; // break; // case 3: // str = "优"; // break; // case 4: // str = "返"; // break; // } // return str; //} function init() { changeCurrentTab(1); $timeout(queryNum, 5000); $timeout(queryTab, 5000); } function queryNum() { CurdHelper.query("./Home/GetPlaceStatusNum", function (data) { if (Utils.isBlank(data.Message)) { var res = data.Result[0]; $scope.placeTypeNum.emptyPlace = res.EmptyPlace; $scope.placeTypeNum.fullPlace = res.FullPlace; $scope.placeTypeNum.lockPlace = res.LockPlace; } if ($state.includes("task.preview-place")) { $timeout(queryNum, 10000); } }); } function queryTab() { CurdHelper.query("./Home/GetPlacePreview", function (data) { debugger; if (Utils.isBlank(data.Message)) { $scope.dataLack = data.Result; } if ($state.includes("task.preview-place")) { $timeout(queryTab, 10000); } }); } function changeCurrentTab(n) { $scope.currentTab = n; } function showInfo($event, b) { if (b == undefined) { return; } $scope.x = $event.screenX; $scope.y = $event.screenY; $scope.showPlaceInfo = true; if ($event.screenY > 700) { $scope.nav_div.top = $event.screenY - 250 - 200; } else if ($event.screenY < 560) { $scope.nav_div.top = $event.screenY*2.2; } else { $scope.nav_div.top = $event.screenY - 100 - 200; } if ($event.screenX > 700) { $scope.nav_div.left = $event.screenX - 600; } else { $scope.nav_div.left = $event.screenX+100 ; } $scope.containerInfo.name = b.name; $scope.containerInfo.code = b.code; $scope.containerInfo.typename = b.typename; $scope.containerInfo.description = b.description; $scope.containerInfo.updatetime = b.updatetime; $scope.containerInfo.quantity = 1; } function unShowInfo() { $scope.showPlaceInfo = false; $scope.showEmptyPlaceInfo = false; } } })();