博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
表格中的下拉框
阅读量:4096 次
发布时间:2019-05-25

本文共 4622 字,大约阅读时间需要 15 分钟。

要实现表格中如图所示的下拉框,点击“操作”时显示,点击其他地方时隐藏,并且每个下拉框的可选项根据版本号状态的不同而不同,

子系统的版本号 版本号状态 GIT分支
操作 >
  • { {item.name}}
  • { {item.name}}
  • { {item.name}}
  • { {item.name}}

js代码

//子系统版本列表        $scope.systemCode=document.getElementById("systemCode").value;        $scope.systemVersionList=function(){            $http.get('/systemVersion/' + $scope.systemCode).success(function (res) {                $scope.systemVersions = angular.copy(res.data);            });        };        $scope.systemVersionList();        //初始-隐藏所有列表        angular.forEach($scope.systemVersions,function(item){        	item.selected = false;        })//        点击显示        $scope.showOpration = function (currentItem, $event) {            $event.stopPropagation();            angular.forEach($scope.systemVersions, function (item) {                item.selected = false;            });            currentItem.selected = !currentItem.selected;        }                $(document).click(function(){        	 $scope.$apply(function(){             	angular.forEach($scope.systemVersions, function (item) {                    item.selected = false;                });        	 });        })                var develop = function(systemVersion){//预发布    		$scope.systemVersion = systemVersion;            $scope.systemVersion.gitBranch = "release-";            layer.open({                type: 1,                area: ['600px', '200px'], //宽高                skin: 'layui-layer-molv', //加上边框                title: '添加',                content: $('#system-version-update-pop')                , btn: ['预发布', '取消']                , yes: function (index, layero) {                    $http.put('/systemVersion/' + systemVersion.id + "/" + systemVersion.gitBranch + "/pre").success(result_handle);                    $scope.systemVersion = {};                    layer.close(index);                }            });    	}                var pre = function(systemVersion){//发布        	layer.confirm('确认项目已发布?', {                btn: ['确认', '取消'] //可以无限个按钮            }, function (index, layero) {                $http.put('/systemVersion/' + systemVersion.id + "/" + systemVersion.gitBranch + "/online").success(result_handle);                layer.close(index);            });        }                var online = function(systemVersion){//下线        	layer.confirm('确认项目已下线?', {                btn: ['确认', '取消'] //可以无限个按钮            }, function (index, layero) {                $http.put('/systemVersion/' + systemVersion.id + "/" + systemVersion.gitBranch + "/offline").success(result_handle);                layer.close(index);            });        }                var offline = function(systemVersion){//删除        	layer.confirm('此操作同时会删除此版本下面的所有项目,确认删除吗?', {                btn: ['删除', '取消'] //可以无限个按钮            }, function (index, layero) {                $http.delete('/systemVersion/' + systemVersion.id).success(result_handle);                layer.close(index);            });        }                var initJenkins = function(systemVersion){//初始化jenkins    		layer.confirm('此操作将删除并重新创建对应的Jenkins空间,是否继续?', {                btn: ['确定', '取消'] //可以无限个按钮            }, function (index, layero) {            	var index = layer.load(1, {          		  shade: [0.3,'#f5f5f5'] //0.3透明度的白色背景          		});          		$http.post('/initJenkins/'+systemVersion.id).success(function(response){          			if(response.success){          				layer.alert('操作成功');          				layer.close(index);            			}else{          				layer.msg("操作失败,原因:" + response.message);          				layer.close(index);           			}          		})            });        }                $scope.developList =[             {id:1,name:'预发布',state:develop},             {id:4,name:'删除',state:offline},             {id:5,name:'初始化Jenkins',state:initJenkins}        ];        $scope.preList = [		{id:2,name:'发布',state:pre},		{id:5,name:'初始化Jenkins',state:initJenkins}		];       	$scope.onlineList = [		{id:3,name:'下线',state:online},		{id:5,name:'初始化Jenkins',state:initJenkins}		];       	$scope.offlineList = [			{id:4,name:'删除',state:offline},			{id:5,name:'初始化Jenkins',state:initJenkins}		];                //选择操作按钮        $scope.selectOpration = function(item,systemVersion){        	if(systemVersion.selected){        		systemVersion.selected = false;        	}        	item.state(systemVersion);        }

你可能感兴趣的文章
Java编程基础:异常处理
查看>>
Java编程基础:了解面向对象
查看>>
新一代Java模板引擎Thymeleaf
查看>>
Spring MVC中使用Thymeleaf模板引擎
查看>>
Spring Boot构建简单的微博应用
查看>>
Spring处理表单提交
查看>>
Spring MVC异常处理
查看>>
Leetcode 1180. Count Substrings with Only One Distinct Letter [Python]
查看>>
PHP 7 的五大新特性
查看>>
php使用 memcache 来存储 session
查看>>
php实现socket(转)
查看>>
PHP底层的运行机制与原理
查看>>
深入了解php底层机制
查看>>
PHP中的stdClass 【转】
查看>>
XHProf-php轻量级的性能分析工具
查看>>
PHP7新特性 What will be in PHP 7/PHPNG
查看>>
比较strtr, str_replace和preg_replace三个函数的效率
查看>>
ubuntu 下编译PHP5.5.7问题:configure: error: freetype.h not found.
查看>>
PHP编译configure时常见错误 debian centos
查看>>
configure: error: Please reinstall the BZip2 distribution
查看>>