1、实现列表

思路:

accessCtrl.js

  1 let AccessCtrl = function($scope, AlertService, DialogService, BigDataService, AdminBigDataService) {
  2   let vm = $scope;
  3   vm.pager = {
  4       pageNo:1,
  5       pageSize: 10,
  6       totalCount: 0
  7   };
  8   vm.dataSourceTypeList=[
  9     {
 10       id:"1",
 11       name:"DB2"
 12     },
 13     {
 14       id:"2",
 15       name:"Sybase"
 16     },
 17     {
 18       id:"3",
 19       name:"MySql"
 20     },
 21     {
 22       id:"4",
 23       name:"Oracle"
 24     },
 25     {
 26       id:"5",
 27       name:"FTP"
 28     },
 29     {
 30       id:"6",
 31       name:"HDFS"
 32     },
 33     {
 34       id:"7",
 35       name:"HIVE"
 36     },
 37     {
 38       id:"8",
 39       name:"HBase"
 40     }
 41   ];
 42   let queryData = {
 43     isDataSourceSet:'1',//仅作为列表展示类别所用,不需要传给后台
 44     systemId: '',
 45     dataSourceName: '',
 46     dataSourceType: '',
 47     ipAddress: '',
 48     userName: ''
 49   };
 50 
 51   //获取 数据源 访问管理列表,并分页
 52   function getAccessMngList(pageNo){
 53     BigDataService.getAccessMngList({pageNo: pageNo, pageSize: vm.pager.pageSize, systemId: queryData.systemId, dataSourceName: queryData.dataSourceName,
 54       dataSourceType: queryData.dataSourceType, ipAddress: queryData.ipAddress, userName: queryData.userName}).then(function(result){
 55       if(result){
 56         vm.dataList = result.list;
 57         vm.pager.totalCount = result.totalCount | 0;
 58         vm.pager.pageNo = result.pageNo;
 59         $scope.$broadcast('sn.controls.pager:toPage', vm.pager.pageNo);
 60       } 
 61     }); 
 62   }
 63 
 64     //获取 数据源集 访问管理列表,并分页
 65     function getAccessMngSetList(pageNo){
 66         BigDataService.getAccessMngSetList({pageNo: pageNo, pageSize: vm.pager.pageSize, dataSourceGroupName: queryData.dataSourceName,
 67             dataSourceGroupType: queryData.dataSourceType, ipAddress: queryData.ipAddress, userName: queryData.userName}).then(function(result){
 68             if(result){
 69                 // console.log(result);
 70                 vm.dataSetList = result.list;
 71                 vm.pager.totalCount = result.totalCount | 0;
 72                 vm.pager.pageNo = result.pageNo;
 73                 $scope.$broadcast('sn.controls.pager:toPage', vm.pager.pageNo);
 74             }
 75         });
 76     }
 77 
 78     $scope.$on("sn.controls.pager:pageIndexChanged", function (evt, page) {
 79         evt.stopPropagation();
 80         if(vm.isDataSourceSet=="1"){
 81             getAccessMngList(page.pageIndex + 1);
 82         }
 83         if(vm.isDataSourceSet=="2"){
 84             getAccessMngSetList(page.pageIndex + 1);
 85         }
 86     });
 87 
 88     //数据源查询列表,并分页(设置查询条件)
 89     vm.queryAccessList = function () {
 90         queryData.isDataSourceSet = vm.isDataSourceSet;
 91         queryData.dataSourceName = vm.dataSourceName;
 92         queryData.dataSourceType = vm.dataSourceType;
 93         queryData.ipAddress = vm.ipAddress;
 94         queryData.userName = vm.userName;
 95         if(vm.isDataSourceSet=="1"){
 96             getAccessMngList(1);
 97         }
 98         if(vm.isDataSourceSet=="2"){
 99             getAccessMngSetList(1);
100         }
101     };
102 
103   //获取所属系统列表
104   function getSystemList(){
105     BigDataService.getSystemList().then(function(result){
106       vm.systemList = result;
107     }); 
108   };
109 
110 
111 
112   //监控所属系统下拉框的值的变化,取对应数据源访问管理列表
113   vm.$watch("query.systemId", function(newVal, oldVal) {
114     if (newVal !== oldVal) {
115       console.log("newVal*******"+newVal);
116         queryData.systemId = vm.query.systemId;
117         getAccessMngList(vm.pager.pageNo);
118     }
119   });
120 
121   //查看明细
122   vm.detail = function (dataSourceId, dataSourceName, dataSourceType) {
123       // 弹出对话框
124       DialogService.modal({
125         key: "BigData.DataResource.DetailDialog",
126         url: "business/template/dataResource/detail-dialog.html"
127       }, {
128         data: {
129           dataSourceId: dataSourceId, 
130           dataSourceType: dataSourceType
131         }
132       });
133   };
134   //查看引用
135   vm.lookLink = function (dataSourceId, dataSourceName, dataSourceType) {
136       DialogService.modal({
137           key: "BigData.DataResource.LinkDialog",
138           url: "business/template/dataResource/link-dialog.html"
139       },{
140           linkData: {
141               dataSourceId: dataSourceId,
142               dataSourceName: dataSourceName,
143               dataSourceType: dataSourceType
144           }
145       });
146   }
147 
148   //数据源访问申请
149   vm.TipDialog=function(){
150     // 弹出对话框
151     DialogService.modal({
152       key: "BigData.DataResource.TipDialog",
153       url: "business/template/dataResource/tip-dialog.html"
154     });
155   };
156 
157     //添加数据源集
158     vm.createDataSet = function () {
159         // 弹出对话框
160         DialogService.modal({
161             key: "BigData.DataResource.CreateSetDialog",
162             url: "business/template/dataResource/create-set-dialog.html",
163             /*accept: function (dataSourceGroupType) {
164                 console.log(dataSourceGroupType);
165                 if (dataSourceGroupType) {
166                     // 弹出对话框
167                     DialogService.modal({
168                         key: "BigData.DataResource.CreateSetDialogNew",
169                         url: "business/template/dataResource/create-set-dialog-new.html",
170                     }, {
171                         data: {
172                             dataSourceGroupType: dataSourceGroupType
173                         }
174                     });
175                 }
176             }*/
177         });
178 
179        /* DialogService.modal({
180             key: "BigData.DataResource.CreateSetDialogNew",
181             url: "business/template/dataResource/create-set-dialog-new.html",
182         });*/
183     };
184 
185     //改变数据源、数据源集展示列表
186     vm.changeDataSourceList=function(obj){
187         if(obj.isDataSourceSet=='1'){
188             vm.dataSourceTypeList=[
189                 {
190                     id:"1",
191                     name:"DB2"
192                 },
193                 {
194                     id:"2",
195                     name:"Sybase"
196                 },
197                 {
198                     id:"3",
199                     name:"MySql"
200                 },
201                 {
202                     id:"4",
203                     name:"Oracle"
204                 },
205                 {
206                     id:"5",
207                     name:"FTP"
208                 },
209                 {
210                     id:"6",
211                     name:"HDFS"
212                 },
213                 {
214                     id:"7",
215                     name:"HIVE"
216                 },
217                 {
218                     id:"8",
219                     name:"HBase"
220                 }
221             ];
222             getAccessMngList(vm.pager.pageNo);
223         }
224         if(obj.isDataSourceSet=='2'){
225             vm.dataSourceTypeList=[
226                 {
227                     id:"1",
228                     name:"DB2"
229                 },
230                 {
231                     id:"2",
232                     name:"Sybase"
233                 },
234                 {
235                     id:"3",
236                     name:"MySql"
237                 },
238                 {
239                     id:"4",
240                     name:"Oracle"
241                 },
242                 {
243                     id:"5",
244                     name:"FTP"
245                 }
246             ];
247             getAccessMngSetList(vm.pager.pageNo);
248         }
249     };
250 
251     //修改数据源集
252     vm.updateSet = function (dataSourceGroupId, dataSourceGroupName, dataSourceGroupType) {
253         // 弹出对话框
254         DialogService.modal({
255             key: "BigData.DataResource.UpdateSetDialogNew",
256             url: "business/template/dataResource/update-set-dialog-new.html",
257             accept: function(formData) {
258                 vm.isDataSourceSet = '2';
259                 getAccessMngSetList(vm.pager.pageNo);
260             }
261         }, {
262             updateData: {
263                 dataSourceGroupId: dataSourceGroupId,
264                 dataSourceGroupName: dataSourceGroupName,
265                 dataSourceGroupType: dataSourceGroupType,
266             }
267         });
268     };
269 
270     //删除数据源集
271     vm.deleteSet = function (dataSourceGroupId,dataSourceGroupName) {
272         AlertService.confirm({
273             title: "确认",
274             content: "确定要删除"+dataSourceGroupName+"吗?"
275         }).then(function() {
276             //调用删除的接口
277             AdminBigDataService.deleteDataResourceGroups({dataSourceGroupId: dataSourceGroupId}).then(function(result){
278                 vm.isDataSourceSet='2';
279                 getAccessMngSetList(vm.pager.pageNo);
280             });
281         });
282     };
283 
284   (function init(){
285     getAccessMngList(vm.pager.pageNo);
286     getSystemList();
287   })();
288  
289 }
290 
291 // AccessCtrl.$inject = ['$scope', 'DialogService'];
292 export default app => app.controller('AccessCtrl', AccessCtrl);
View Code

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-10-15
  • 2021-07-19
  • 2022-02-24
  • 2021-04-30
  • 2021-12-20
猜你喜欢
  • 2021-07-25
  • 2019-02-11
  • 2021-06-01
  • 2022-12-23
  • 2022-01-01
  • 2021-08-10
  • 2021-06-08
相关资源
相似解决方案