1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- var editRoomCtrl = function ($scope, $http, $filter, $loading) {
- $scope.params = editRoomModal.params;
- $scope.parentLoad = editRoomModal.parentLoad;
- $scope.dataModel = { BuildingId:null};
- $scope.buildingList = [];
- $scope.floorList = [];
- $scope.loadData = function () {
- $loading.show();
- $http({
- method: "get",
- url: "../../api/build/room/GetRoomById",
- params: {
- roomId: $scope.params.roomId
- }
- }).then(function (result) {
- $loading.hide();
- $scope.dataModel = result.data.Data;
- $scope.getBuildingList();
- $scope.getFloorList();
- }, function (resp) {
- $loading.hide();
- $scope.showMsg('错误', '服务器错误');
- });
- }
- $scope.getBuildingList = function () {
- $http({
- method: "get",
- url: "../../api/build/building/GetBuildingList",
- params: {
- }
- }).then(function (result) {
- $scope.buildingList = result.data.Data;
- }, function (resp) {
- });
- };
- $scope.getFloorList = function () {
- if ($scope.dataModel.BuildingId) {
- $http({
- method: "get",
- url: "../../api/build/building/GetFloorList",
- params: {
- buildingId: $scope.dataModel.BuildingId
- }
- }).then(function (result) {
- $scope.floorList = result.data.Data;
- }, function (resp) {
- });
- }
- else {
- $scope.floorList = [];
- }
- };
- $scope.save = function (isflag) {
- if (!isflag) {
- $scope.showMsg('提示', '请填写相关信息');
- return false;
- }
- if (isflag) {
- $loading.show();
- $http({
- method: "post",
- url: "../../api/build/room/Save",
- data: {
- data: $scope.dataModel
- }
- }).then(function (result) {
- $loading.hide();
- if (result.data.IsSuccess) {
- $scope.showMsg('成功', "操作成功!");
- $scope.parentLoad();
- $scope.$hide();
- } else {
- $scope.showMsg('失败', result.data.Message);
- }
- }, function (resp) {
- $loading.hide();
- $scope.showMsg('错误', '服务器错误,' + resp.data.message);
- })
- }
- };
- $scope.loadData();
- };
- //定义模态框
- var editRoomModal;
|