123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125 |
- (function ($app) {
- $app.module('ylmis').controller('depOrServiceCtrl', function ($scope, $http, $filter, $modal, $ocLazyLoad, $alert, $loading, $state, excelPopup, $bsRouterState, popupReport) {
- $state.params = $bsRouterState.$params($scope);
- $scope.isShow = false;
- $scope.dataList = [];
- $scope.buildingList = [];
- $scope.floorList = [];
- //初始化查询参数
- $scope.selectparams = {
- name: null,
- buildingId: null,
- floorId: null,
- pageIndex: 1,
- pageSize: 30,
- };
- $scope.pageInfo = { ptotal: 0 };
- //查询
- $scope.search = function () {
- $scope.loadData();
- };
- //加载列表数据
- $scope.loadData = function () {
- $loading.show();
- $http
- ({
- method: 'get', url: '../../api/build/DepOrService/GetDepOrServicePointList', 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.add = function () {
- $scope.editDepOrService(null, '新增服务点信息');
- };
- $scope.edit = function (Id) {
- $scope.editDepOrService(Id, '修改服务点信息');
- };
- $scope.editDepOrService = function (id, title) {
- editDepOrServiceModal.params = {
- depOrServicePointId: id,
- title: title,
- };
- editDepOrServiceModal.parentLoad = $scope.loadData;
- editDepOrServiceModal.$promise.then(editDepOrServiceModal.show);
- };
- editDepOrServiceCtrl.$inject = ['$scope', '$http', '$filter', '$loading','$modal'];
- editDepOrServiceModal = $modal({
- resolve: {
- load: ['$ocLazyLoad', function ($ocLazyLoad) {
- }]
- },
- scope: $scope,
- controller: editDepOrServiceCtrl,
- templateUrl: '../main/depOrService/edit.html',
- show: false,
- animation: 'am-fade-and-slide-top'
- });
- $scope.delete = function (id) {
- var ids = $.map($filter('filter')($scope.dataList, { rowChecked: true }), function (x) { return x.DepartmentOrServicePointId; });;
- if (ids.length < 1) {
- $scope.showMsg('提示', '请选择要删除的信息。');
- return false;
- }
- if (confirm("确认删除?")) {
- $http.post('../../api/build/DepOrService/Delete', { depOrServicePointIdList: ids }).then(function (res) {
- if (res.data.IsSuccess) {
- $scope.loadData();
- $scope.showMsg('成功', '删除成功');
- } else {
- $scope.showMsg('错误', res.data.Message);
- }
- });
- }
- };
- $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();
- });
- })(angular);
|