增删改查列表angular.js页面实现
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>品牌管理</title>
<meta content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no" name="viewport">
<link rel="stylesheet" href="../plugins/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" href="../plugins/adminLTE/css/AdminLTE.css">
<link rel="stylesheet" href="../plugins/adminLTE/css/skins/_all-skins.min.css">
<link rel="stylesheet" href="../css/style.css">
<script src="../plugins/jQuery/jquery-2.2.3.min.js"></script>
<script src="../plugins/bootstrap/js/bootstrap.min.js"></script> <script type="text/javascript" src="../plugins/angularjs/angular.min.js"></script>
<script type="text/javascript" src="../plugins/angularjs/pagination.js"></script> <link rel="stylesheet" href="../plugins/angularjs/pagination.css"/>
<script type="text/javascript">
var app = angular.module('eshop',['pagination']);
app.controller('brandController',function($scope,$http){
//获取查询数据
$scope.findAll= function(){
$http.get('../brand/getAllBrand.do').success(
function(res){
$scope.list = res;
}
)
}; //分页控件控制
$scope.paginationConf={
currentPage:, //当前页
totalItems:, //总记录数
itemsPerPage:, //每页记录数
perPageOptions:[,,,,], //分页选项
onChange:function(){ //当页码变更后自动触发的方法
$scope.reloadList();//会变化
}
};
//带条件刷新列表
$scope.reloadList=function(){
$scope.search($scope.paginationConf.currentPage,$scope.paginationConf.itemsPerPage);
};
//刷新列表
$scope.reloadListNoCondition=function(){
$scope.findPage($scope.paginationConf.currentPage,$scope.paginationConf.itemsPerPage);
}; $scope.findPage=function(page,size){
$http.get('../brand/getBrandByPage.do?page='+page+'&size='+size).success(
function(res){
$scope.list = res.rows;//显示当前页数据
$scope.paginationConf.totalItems=res.total;//更新总记录数
}
)
} //新增品牌
$scope.save=function(){
var methodName = 'addBrand';
if($scope.entity.id){
methodName = 'updateBrand';
}
$http.post('../brand/'+methodName+'.do',$scope.entity).success(
function(res){
if(res.success){
$scope.reloadListNoCondition();//刷新列表
}else{
alert(res.message);
}
}
)
} //查询品牌
$scope.findOne=function(id){
$http.get('../brand/queryBrand.do?id='+id).success(
function(res){
$scope.entity = res;
}
)
} //获取删除品牌的id
$scope.selectIds = [];
$scope.selectid = function($event,id){
if($event.target.checked){
$scope.selectIds.push(id);//向集合元素中添加数据
}else{
var index = $scope.selectIds.indexOf(id);
$scope.selectIds.splice(index,);
}
}
//删除
$scope.del = function(){
$http.get('../brand/deleteBrand.do?ids='+$scope.selectIds).success(
function(res){
if(res.success){
$scope.reloadList();//刷新列表
}else{
alert(res.message);
}
}
)
$scope.selectIds=[];
}
//查询
$scope.searchEntity={};
$scope.search=function(page,size){
$scope.searchEntity.size=size;
$scope.searchEntity.page=page;
$http.post('../brand/search.do',$scope.searchEntity).success(
function(res){
$scope.list = res.rows;//显示当前页数据
$scope.paginationConf.totalItems=res.total;//更新总记录数
}
)
} });
</script>
</head>
<body class="hold-transition skin-red sidebar-mini" ng-app="eshop" ng-controller="brandController" >
<!-- .box-body -->
<div class="box-header with-border">
<h3 class="box-title">品牌管理</h3>
</div> <div class="box-body"> <!-- 数据表格 -->
<div class="table-box"> <!--工具栏-->
<div class="pull-left">
<div class="form-group form-inline">
<div class="btn-group">
<button type="button" class="btn btn-default" title="新增" data-toggle="modal" data-target="#editModal" ng-click="entity={}"><i class="fa fa-file-o"></i> 新增</button>
<button type="button" class="btn btn-default" title="删除" ng-click="del()"><i class="fa fa-trash-o"></i> 删除</button>
<button type="button" class="btn btn-default" title="刷新" onclick="window.location.reload();"><i class="fa fa-refresh"></i> 刷新</button>
</div>
</div>
</div>
<div class="box-tools pull-right">
<div class="has-feedback">
品牌名称:<input ng-model="searchEntity.name"> 品牌首字母: <input ng-model="searchEntity.firstChar"> <button type="button" class="btn btn-default" ng-click="reloadList()">查询</button> </div>
</div>
<!--工具栏/--> <!--数据列表-->
<table id="dataList" class="table table-bordered table-striped table-hover dataTable">
<thead>
<tr>
<th class="" style="padding-right:0px">
<input id="selall" type="checkbox" class="icheckbox_square-blue">
</th>
<th class="sorting_asc">品牌ID</th>
<th class="sorting">品牌名称</th>
<th class="sorting">品牌首字母</th>
<th class="text-center">操作</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="entity in list">
<td><input type="checkbox" ng-click="selectid($event,entity.id)"></td>
<td>{{entity.id}}</td>
<td>{{entity.name}}</td>
<td>{{entity.firstChar}}</td>
<td class="text-center">
<button type="button" class="btn bg-olive btn-xs" data-toggle="modal" data-target="#editModal" ng-click="findOne(entity.id)" >修改</button>
</td>
</tr>
</tbody>
</table>
<!--数据列表/--> </div>
<!-- 数据表格 /-->
<tm-pagination conf="paginationConf"></tm-pagination> </div>
<!-- /.box-body --> <!-- 编辑窗口 -->
<div class="modal fade" id="editModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog" >
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel">品牌编辑</h3>
</div>
<div class="modal-body">
<table class="table table-bordered table-striped" width="800px">
<tr>
<td>品牌名称</td>
<td><input class="form-control" placeholder="品牌名称" ng-model="entity.name"> </td>
</tr>
<tr>
<td>首字母</td>
<td><input class="form-control" placeholder="首字母" ng-model="entity.firstChar"> </td>
</tr>
</table>
</div>
<div class="modal-footer">
<button class="btn btn-success" data-dismiss="modal" aria-hidden="true" ng-click="save()">保存</button>
<button class="btn btn-default" data-dismiss="modal" aria-hidden="true">关闭</button>
</div>
</div>
</div>
</div> </body>
</html>
增删改查列表angular.js页面实现的更多相关文章
- 列表的初识,列表的索引切片,列表的增删改查,列表的嵌套,元组的初识,range
1 内容总览 列表的初识 列表的索引切片 列表的增删改查 列表的嵌套 元组的初识(了解) 元组的简单应用(了解) range 2 具体内容 列表的初识 why: str: 存储少量的数据.切片出来全都 ...
- 页面循环绑定(变量污染问题),js面向对象编程(对象属性增删改查),js字符串操作,js数组操作
页面循环绑定(变量污染问题) var lis = document.querySelectorAll(".ul li") for ( var i = 0 ; i < lis. ...
- JS组件系列——BootstrapTable+KnockoutJS实现增删改查解决方案(四):自定义T4模板快速生成页面
前言:上篇介绍了下ko增删改查的封装,确实节省了大量的js代码.博主是一个喜欢偷懒的人,总觉得这些基础的增删改查效果能不能通过一个什么工具直接生成页面效果,啥代码都不用写了,那该多爽.于是研究了下T4 ...
- JS组件系列——BootstrapTable+KnockoutJS实现增删改查解决方案(二)
前言:上篇 JS组件系列——BootstrapTable+KnockoutJS实现增删改查解决方案(一) 介绍了下knockout.js的一些基础用法,由于篇幅的关系,所以只能分成两篇,望见谅!昨天就 ...
- 03 基于umi搭建React快速开发框架(封装列表增删改查)
前言 大家在做业务系统的时候,很多地方都是列表增删改查,做这些功能占据了大家很长时间,如果我们有类似的业务,半个小时就能做出一套那是不是很爽呢. 这样我们就可以有更多的时间学习一些新的东西.我们这套框 ...
- 元组,列表的增删改查, for,range 循环
1. list(增删改查) 列表可以装大量的数据. 不限制数据类型. 表示方式:[] 方括号中的每一项用逗号隔开 列表和字符串一样.也有索引和切片 常用的功能: 1. 增: append() 2. 删 ...
- Python(二)列表的增删改查
一,列表的增删改查 列表中增加元素: 1,从列表的末尾增加一个元素:append("") 2,从列表中插入一个元素:insert(下标位置,插入的元素) 合并列表: 1,name. ...
- BootstrapTable+KnockoutJS实现增删改查解决方案
BootstrapTable+KnockoutJS实现增删改查解决方案 前言:上篇介绍了下ko增删改查的封装,确实节省了大量的js代码.博主是一个喜欢偷懒的人,总觉得这些基础的增删改查效果能不能通过一 ...
- BootstrapTable与KnockoutJS相结合实现增删改查功能
http://www.jb51.net/article/83910.htm KnockoutJS是一个JavaScript实现的MVVM框架.通过本文给大家介绍BootstrapTable与Knock ...
随机推荐
- System.Threading.Timer
GLog.WLog("_thdTimer before"); _thdTimer = new System.Threading.Timer(new TimerCallback(Ti ...
- NGUI 合集
UILabel 设置BBCode的时候 ,要设置颜色为白色 .不要设为其他的颜色因为会叠加的 .
- sudo 命令报错的解决方法
尝试着用终端打开Mac的安全权限(sudo spctl --master-disable),却显示以下提示,望高手解答. sudo: /etc/sudoers is world writablesud ...
- Jmeter(三十六)纵横并发、限制QPS
一.纵横并发 Jmeter设计并发事件,这应该是一项必备技能. 首先来看并发的概念. 通常在性能测试中会涉及到并发用户数的概念,有关并发用户数(系统用户数)的详解后续再记. (有关并发.并行的概念参考 ...
- Java调用R语言
R是统计计算的强大工具,JAVA是做应用系统的主流语言.JAVA负责系统的构建,R用来做运算引擎,从而实现应用型和分析性相结合的系统. 一.Rserve(远程通信模式) Rserve是一个基于TCP/ ...
- CRM 更新解决方案之注意事项
一般需要开发新功能时,企业或者软件公司往往会先从生产环境克隆出一台测试用系统. 开发人员会在测试系统中对功能进行开发或者测试. 这时当新功能开发和测试完成之后,需要将新的解决方案导入生产环境. 导入时 ...
- U3D学习10——关节和射线检测
1.弹簧 2.铰链 3.固定关节 4.角色关节 5.自定义关节 6.raycast和raycasthit 射线有位移参数,可以设定只触发某一层的. 7.射线检测用于高速和精确 update是 ...
- DB通用类:Sqlite通用类库
Sqlite通用类库 using System; using System.Collections; using System.Collections.Generic; using System.IO ...
- python装饰器(二)
有参装饰器 def outer(flag): def timer(func): def inner(*args,**kwargs): if flag: print('''执行函数之前要做的''') r ...
- HDFS高级功能
HDFS的六大高级特性: 安全模式 安全模式是HDFS所处的一种特殊状态,在这种状态下,文件系统只接受读数据请求,而不接受删除.修改等变更请求.在NameNode主节点启动时,HDFS首先进入安全模式 ...