123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- var selectRoomCtrl = function ($scope, $http, AuthUser, flowaudit, $loading, $uuid, $modal) {
- $scope.params = selectRoomModal.params;
- $scope.selectRoomBack = selectRoomModal.selectRoomBack;
- $scope.isShow = true;
- $scope.dataList = [];
- $scope.selectList = [];
- $scope.buildingList = [];
- $scope.floorList = [];
- $scope.pageInfo = { ptotal: 0 };
- //查询参数
- $scope.selectparams = {
- name: null,
- buildingId: null,
- floorId: null,
- pageIndex: 1,
- pageSize: 10,
- };
- $scope.search = function () {
- $scope.getRoomList();
- };
- $scope.getRoomList = function () {
- $loading.show();
- $http
- ({
- method: 'get', url: '../../api/build/room/GetRoomList', params: $scope.selectparams
- }).then(function (result) {
- $loading.hide();
- $scope.dataList = result.data.Data.rows;
- $scope.pageInfo.ptotal = result.data.Data.total;
- }, function (resp) {
- $loading.hide();
- $scope.showMsg('错误', '服务器错误');
- });
- };
- $scope.save = function () {
- if ($scope.selectList.length == 0) {
- $scope.showMsg('提示', '请选择需要添加的房间!');
- return false;
- }
- $scope.selectRoomBack($scope.selectList);
- $scope.$hide();
- };
- $scope.select = function () {
- var checkList = $scope.dataList.filter(e => e.rowChecked == true);
- if (checkList.length <= 0) {
- $scope.showMsg('提示', '请选择需要添加的房间!');
- return false;
- }
- var copyDataList = [];
- angular.copy(checkList, copyDataList);
- copyDataList.forEach(item => {
- item.rowChecked = false;
- if ($scope.selectList.filter(e => e.BuildingFloorRoomId == item.BuildingFloorRoomId).length == 0)
- $scope.selectList.push(item);
- });
- };
- $scope.remove = function (index) {
- if (index != null)
- $scope.selectList.splice(index, 1);
- else
- $scope.selectList.forEach(item => {
- if (item.rowChecked == true)
- $scope.selectList = $scope.selectList.filter(e => e.BuildingFloorRoomId != item.BuildingFloorRoomId);
- });
- };
- $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.selectparams.buildingId) {
- $http({
- method: "get",
- url: "../../api/build/building/GetFloorList",
- params: {
- buildingId: $scope.selectparams.buildingId
- }
- }).then(function (result) {
- $scope.floorList = result.data.Data;
- }, function (resp) {
- });
- }
- else {
- $scope.floorList = [];
- }
- };
- $scope.getBuildingList();
- };
- var selectRoomModal;
|