<!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"> 品牌首字母:&nbsp;&nbsp;<input ng-model="searchEntity.firstChar">&nbsp;&nbsp;<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页面实现的更多相关文章

  1. 列表的初识,列表的索引切片,列表的增删改查,列表的嵌套,元组的初识,range

    1 内容总览 列表的初识 列表的索引切片 列表的增删改查 列表的嵌套 元组的初识(了解) 元组的简单应用(了解) range 2 具体内容 列表的初识 why: str: 存储少量的数据.切片出来全都 ...

  2. 页面循环绑定(变量污染问题),js面向对象编程(对象属性增删改查),js字符串操作,js数组操作

    页面循环绑定(变量污染问题) var lis = document.querySelectorAll(".ul li") for ( var i = 0 ; i < lis. ...

  3. JS组件系列——BootstrapTable+KnockoutJS实现增删改查解决方案(四):自定义T4模板快速生成页面

    前言:上篇介绍了下ko增删改查的封装,确实节省了大量的js代码.博主是一个喜欢偷懒的人,总觉得这些基础的增删改查效果能不能通过一个什么工具直接生成页面效果,啥代码都不用写了,那该多爽.于是研究了下T4 ...

  4. JS组件系列——BootstrapTable+KnockoutJS实现增删改查解决方案(二)

    前言:上篇 JS组件系列——BootstrapTable+KnockoutJS实现增删改查解决方案(一) 介绍了下knockout.js的一些基础用法,由于篇幅的关系,所以只能分成两篇,望见谅!昨天就 ...

  5. 03 基于umi搭建React快速开发框架(封装列表增删改查)

    前言 大家在做业务系统的时候,很多地方都是列表增删改查,做这些功能占据了大家很长时间,如果我们有类似的业务,半个小时就能做出一套那是不是很爽呢. 这样我们就可以有更多的时间学习一些新的东西.我们这套框 ...

  6. 元组,列表的增删改查, for,range 循环

    1. list(增删改查) 列表可以装大量的数据. 不限制数据类型. 表示方式:[] 方括号中的每一项用逗号隔开 列表和字符串一样.也有索引和切片 常用的功能: 1. 增: append() 2. 删 ...

  7. Python(二)列表的增删改查

    一,列表的增删改查 列表中增加元素: 1,从列表的末尾增加一个元素:append("") 2,从列表中插入一个元素:insert(下标位置,插入的元素) 合并列表: 1,name. ...

  8. BootstrapTable+KnockoutJS实现增删改查解决方案

    BootstrapTable+KnockoutJS实现增删改查解决方案 前言:上篇介绍了下ko增删改查的封装,确实节省了大量的js代码.博主是一个喜欢偷懒的人,总觉得这些基础的增删改查效果能不能通过一 ...

  9. BootstrapTable与KnockoutJS相结合实现增删改查功能

    http://www.jb51.net/article/83910.htm KnockoutJS是一个JavaScript实现的MVVM框架.通过本文给大家介绍BootstrapTable与Knock ...

随机推荐

  1. IDEA创建简单servlet程序

    创建项目 创建完后的目录结构为: web项目配置 在WEB-INF目录下新建两个文件夹,分别命名未classes和lib(classes目录用于存放编译后的class文件,lib用于存放依赖的jar包 ...

  2. postgresql 查看数据库,表,索引,表空间以及大小

    转载 http://blog.51yip.com/pgsql/1525.html 1,查看数据库 playboy=> \l //\加上字母l,相当于mysql的,mysql> show d ...

  3. WARNING: Package of target [javax.servlet.jsp.jstl.core.LoopTagSupport$1Status@7439e436] or package of member [public int javax.servlet.jsp.jstl.core.LoopTagSupport$1Status.getIndex()] are excluded!

    Struts2爆出045漏洞后,将struts版本升级到了2.3.32.但是在验证时发现有些jstl循环未出现预期的结果. debug发现,数据没有问题,断定是前端页面显示出了问题.根据日志信息WAR ...

  4. Spring-framework应用程序启动loadtime源码分析笔记(一)

    1,实例化DefaultListableBeanFactory DefaultListableBeanFactory是AnnotationConfigApplicationContext的组件,Def ...

  5. OpenStack存储(单节点)

    一.OpenStack Swift对象存储 1.安装Swift服务 在controller节点依次执行iaas-install-swift-controller.sh和iaas-install-swi ...

  6. MCC MNC in china

    A mobile country code (MCC) is used in combination with a mobile network code (MNC) (a combination k ...

  7. echart-X轴标签文字方向

    1. rotate斜体: axisLabel:{interval:0,rotate:45, margin:2, textStyle:{ color:"#222" }2. forma ...

  8. Java虚拟机------JVM分析工具

    主要介绍JVM的分析工具: jps jps:Java Virtual Machine Process Status Tool http://docs.oracle.com/javase/1.5.0/d ...

  9. Java - 16 Java 方法

    在前面几个章节中我们经常使用到System.out.println(),那么它是什么呢? println()是一个方法(Method),而System是系统类(Class),out是标准输出对象(Ob ...

  10. CS229 6.5 Neurons Networks Implements of Sparse Autoencoder

    sparse autoencoder的一个实例练习,这个例子所要实现的内容大概如下:从给定的很多张自然图片中截取出大小为8*8的小patches图片共10000张,现在需要用sparse autoen ...