<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
<style type="text/css">
td {
border: 1px solid black;
}
</style>
<script src="lib/angular.min.js"></script>
<script src="lib/jquery-1.11.1.min.js"></script>
<script>
var app = angular.module("myapp", []);
app.controller("mycon", ["$scope", "$filter", "$interval", function(myscope, filter, interval) {
var mlist=[];
myscope.lists=[];
for(var i=1;i<13;i++){
var a=mlist.push(i);
myscope.lists=a;
}
myscope.list = [{
"checked":false,
"id": 2,
"name": "oppo",
"user": "张三",
"tel": 182344,
"price": 2000,
"city": "北京",
"time": new Date('09-22-21 11:11:11'),
"state": "发货"
},
{ "checked":false,
"id": 4,
"name": "小米",
"user": "李四",
"tel": 136344,
"price": 4000,
"city": "深圳",
"time": new Date('10-22-21 11:11:11'),
"state": "已发货"
},
{ "checked":false,
"id": 1,
"name": "红米",
"user": "王五",
"tel": 184344,
"price": 3000,
"city": "山西",
"time": new Date('03-22-21 11:11:11'),
"state": "已发货"
},
{ "checked":false,
"id": 3,
"name": "iphone",
"user": "赵六",
"tel": 132344,
"price": 6000,
"city": "河北",
"time": new Date('04-22-21 11:11:11'),
"state": "已发货"
},
{ "checked":false,
"id": 6,
"name": "huawei",
"user": "扬起",
"tel": 152344,
"price": 3000,
"city": "北京",
"time": new Date('05-22-21 11:11:11'),
"state": "已发货"
}
];
myscope.cha = function() {
var v = document.getElementById("n").value;
if(v == "" || v == null) {
alert("请输入姓名");
} else {
var f = filter("filter");
for(var i = 0; i < myscope.list.length; i++) {
var a = myscope.list[i].user;
if(v == a) {
myscope.list = f(myscope.list, v);
} else{
alert("未找到内容");
break;
}
}
var reg = /[!@]+/;
if (reg.test("米"))
alert("包含敏感字符");
}
}
myscope.add = function() {
myscope.isshow = true;
}
myscope.save = function() {
/*var reNum = /^\d*$/;
if(reNum.test(myscope.price)) {
myscope.list.push({
"id": myscope.id,
"name": myscope.name,
"user": myscope.user,
"tel": myscope.price,
"price": myscope.price,
"city": myscope.city,
"time": myscope.time,
"state": "<a href='#'>待发货</a>"
});
} else {
alert("价格格式错误");
}*/
myscope.tips=false;
myscope.arr=[];
if(myscope.name==""||myscope.name==undefined){
myscope.arr.push("姓名不能为空");
}
if(myscope.arr.length>0){
myscope.tips=true;
}else {
alert("aa");
var g={
"id": myscope.id,
"name": myscope.name,
"user": myscope.user,
"tel": myscope.tel,
"price": myscope.price,
"city": myscope.city,
"time": myscope.time,
"state": "代发货"
}
myscope.list.push(g);
myscope.isshow=false;
}
}
myscope.del = function(good) {
for(var i=0;i<myscope.list.length;i++){
if(myscope.list[i].id==good.id){
myscope.list.splice(i,1);
}
}
}
myscope.update = function(index) {
}
interval(function() {
$("tbody tr:odd").css("background", "darkgrey");
$("tbody tr:even").css("background", "gainsboro");
}, 0);
myscope.ckAll=function(){
var ck=myscope.isck;
for(var i=0;i<myscope.list.length;i++){
myscope.list[i].checked=ck;
}
}
myscope.selfa=function(){
for(var i=0;i<myscope.list.length;i++){
if(myscope.list[i].checked==true){
myscope.list[i].state="已发货";
}
}
}
myscope.seldel=function(){
for(var i=0;i<myscope.list.length;i++){
if(myscope.list[i].checked==true){
myscope.list.splice(i,1);
i--;
}
}
}
myscope.citychange=function(){
var a=myscope.cityx;
if(a==1){
var f=filter("filter");
myscope.list=f(myscope.list,myscope.list.city="北京");
}
}
}]);
</script>
</head>
<body ng-app="myapp" ng-controller="mycon">
<input placeholder="用户名搜索" id="n" /><input placeholder="手机号搜索" ng-model="phone" />
<select ng-model="cityx" ng-change="citychange()">
<option value="">选择城市</option>
<option value="1" >北京</option>
<option value="2">深圳</option>
<option value="3">山西</option>
<option value="4">河北</option>
</select>
<select>
<option>选择状态</option>
<option>已发货</option>
<option>待发货</option>
</select>
<select ng-repeat="d in lists">
<option >开始月份</option>
<option>{{d}}</option>
</select >
<select ng-repeat="d in lists">
<option>结束月份</option>
<option>{{d}}</option>
</select>
<input type="button" value="查询" ng-click="cha()" />
<br />
<input type="button" value="新增订单" style="background: green;" ng-click="add()" />
<input type="button" value="批量发货" style="background: green;" ng-click="selfa()" />
<input type="button" value="批量删除" style="background: green;" ng-click="seldel()"/>
<br />
<table>
<thead>
<tr>
<td><input type="checkbox" ng-model="isck" ng-change="ckAll()"/></td>
<td>ID</td>
<td ng-click="title='name';desc=!desc">商品名</td>
<td ng-click="title='user';desc=!desc">用户名</td>
<td ng-click="title='tel';desc=!desc">手机号</td>
<td ng-click="title='price';desc=!desc">价格</td>
<td>城市</td>
<td>下单时间</td>
<td>状态</td>
<td>操作</td>
</tr>
</thead>
<tbody>
<tr ng-repeat="l in list|filter:phone|orderBy:title:desc">
<td><input type="checkbox" ng-model="l.checked"/></td>
<td>{{l.id}}</td>
<td>
<span ng-hide="l.e">{{l.name}}</span>
<span ng-show="l.e"><input ng-model="l.name"/></span>
</td>
<td>{{l.user}}</td>
<td>{{l.tel}}</td>
<td>{{l.price}}</td>
<td>{{l.city}}</td>
<td>{{l.time|date:"yyyy:MM:dd HH:mm:ss"}}</td>
<td>
<span ng-show="l.state=='已发货'">{{l.state}}</span>
<span ng-show="l.state=='发货'"><a href="#" ng-click="l.state='已发货'">{{l.state}}</a></span>
</td>
<td>
<a href="#" ng-hide="l.e" ng-click="l.e=true">修改</a>
<a href="#" ng-show="l.e==true" ng-click="l.e=false">保存</a>
<a href="#" ng-click="del(l)">删除</a>
</td>
</tr>
</tbody>
</table>
<div ng-show="isshow">
<form >
<tr>
<td><input placeholder="ID" ng-model="id" /></td>
<td><input placeholder="商品名" ng-model="name" /></td>
<td><input placeholder="用户名" ng-model="user" /></td>
<td><input placeholder="手机号" ng-model="tel" /></td>
<td><input placeholder="价格" ng-model="price" /></td>
<td><input placeholder="城市" ng-model="city" /></td>
<td><input placeholder="下单时间" ng-model="time" /></td>
<td><button ng-click="save()">保存</button></td>
</tr>
<div style="background: pink; width: 100px;">
<ul ng-repeat="d in arr">
<li>{{d}}</li>
</ul>
</div>
</form>
</div>
</body>
</html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
<style type="text/css">
td {
border: 1px solid black;
}
</style>
<script src="lib/angular.min.js"></script>
<script src="lib/jquery-1.11.1.min.js"></script>
<script>
var app = angular.module("myapp", []);
app.controller("mycon", ["$scope", "$filter", "$interval", function(myscope, filter, interval) {
var mlist=[];
myscope.lists=[];
for(var i=1;i<13;i++){
var a=mlist.push(i);
myscope.lists=a;
}
myscope.list = [{
"checked":false,
"id": 2,
"name": "oppo",
"user": "张三",
"tel": 182344,
"price": 2000,
"city": "北京",
"time": new Date('09-22-21 11:11:11'),
"state": "发货"
},
{ "checked":false,
"id": 4,
"name": "小米",
"user": "李四",
"tel": 136344,
"price": 4000,
"city": "深圳",
"time": new Date('10-22-21 11:11:11'),
"state": "已发货"
},
{ "checked":false,
"id": 1,
"name": "红米",
"user": "王五",
"tel": 184344,
"price": 3000,
"city": "山西",
"time": new Date('03-22-21 11:11:11'),
"state": "已发货"
},
{ "checked":false,
"id": 3,
"name": "iphone",
"user": "赵六",
"tel": 132344,
"price": 6000,
"city": "河北",
"time": new Date('04-22-21 11:11:11'),
"state": "已发货"
},
{ "checked":false,
"id": 6,
"name": "huawei",
"user": "扬起",
"tel": 152344,
"price": 3000,
"city": "北京",
"time": new Date('05-22-21 11:11:11'),
"state": "已发货"
}
];
myscope.cha = function() {
var v = document.getElementById("n").value;
if(v == "" || v == null) {
alert("请输入姓名");
} else {
var f = filter("filter");
for(var i = 0; i < myscope.list.length; i++) {
var a = myscope.list[i].user;
if(v == a) {
myscope.list = f(myscope.list, v);
} else{
alert("未找到内容");
break;
}
}
var reg = /[!@]+/;
if (reg.test("米"))
alert("包含敏感字符");
}
}
myscope.add = function() {
myscope.isshow = true;
}
myscope.save = function() {
/*var reNum = /^\d*$/;
if(reNum.test(myscope.price)) {
myscope.list.push({
"id": myscope.id,
"name": myscope.name,
"user": myscope.user,
"tel": myscope.price,
"price": myscope.price,
"city": myscope.city,
"time": myscope.time,
"state": "<a href='#'>待发货</a>"
});
} else {
alert("价格格式错误");
}*/
myscope.tips=false;
myscope.arr=[];
if(myscope.name==""||myscope.name==undefined){
myscope.arr.push("姓名不能为空");
}
if(myscope.arr.length>0){
myscope.tips=true;
}else {
alert("aa");
var g={
"id": myscope.id,
"name": myscope.name,
"user": myscope.user,
"tel": myscope.tel,
"price": myscope.price,
"city": myscope.city,
"time": myscope.time,
"state": "代发货"
}
myscope.list.push(g);
myscope.isshow=false;
}
}
myscope.del = function(good) {
for(var i=0;i<myscope.list.length;i++){
if(myscope.list[i].id==good.id){
myscope.list.splice(i,1);
}
}
}
myscope.update = function(index) {
}
interval(function() {
$("tbody tr:odd").css("background", "darkgrey");
$("tbody tr:even").css("background", "gainsboro");
}, 0);
myscope.ckAll=function(){
var ck=myscope.isck;
for(var i=0;i<myscope.list.length;i++){
myscope.list[i].checked=ck;
}
}
myscope.selfa=function(){
for(var i=0;i<myscope.list.length;i++){
if(myscope.list[i].checked==true){
myscope.list[i].state="已发货";
}
}
}
myscope.seldel=function(){
for(var i=0;i<myscope.list.length;i++){
if(myscope.list[i].checked==true){
myscope.list.splice(i,1);
i--;
}
}
}
myscope.citychange=function(){
var a=myscope.cityx;
if(a==1){
var f=filter("filter");
myscope.list=f(myscope.list,myscope.list.city="北京");
}
}
}]);
</script>
<script>
$(function(){
var aa="";
$("tr").mousedown(function(){
aa=$(this).css("background-color");
$(this).css("background-color","aquamarine");
});
$("tr").mouseleave(function(){
$(this).css("background-color",aa);
});
});
</script>
</head>
<body ng-app="myapp" ng-controller="mycon">
<input placeholder="用户名搜索" id="n" /><input placeholder="手机号搜索" ng-model="phone" />
<select ng-model="cityx" ng-change="citychange()">
<option value="">选择城市</option>
<option value="1" >北京</option>
<option value="2">深圳</option>
<option value="3">山西</option>
<option value="4">河北</option>
</select>
<select>
<option>选择状态</option>
<option>已发货</option>
<option>待发货</option>
</select>
<select ng-repeat="d in lists">
<option >开始月份</option>
<option>{{d}}</option>
</select >
<select ng-repeat="d in lists">
<option>结束月份</option>
<option>{{d}}</option>
</select>
<input type="button" value="查询" ng-click="cha()" />
<br />
<input type="button" value="新增订单" style="background: green;" ng-click="add()" />
<input type="button" value="批量发货" style="background: green;" ng-click="selfa()" />
<input type="button" value="批量删除" style="background: green;" ng-click="seldel()"/>
<br />
<table>
<thead>
<tr>
<td><input type="checkbox" ng-model="isck" ng-change="ckAll()"/></td>
<td>ID</td>
<td ng-click="title='name';desc=!desc">商品名</td>
<td ng-click="title='user';desc=!desc">用户名</td>
<td ng-click="title='tel';desc=!desc">手机号</td>
<td ng-click="title='price';desc=!desc">价格</td>
<td>城市</td>
<td>下单时间</td>
<td>状态</td>
<td>操作</td>
</tr>
</thead>
<tbody>
<tr ng-repeat="l in list|filter:phone|orderBy:title:desc">
<td><input type="checkbox" ng-model="l.checked"/></td>
<td>{{l.id}}</td>
<td>
<span ng-hide="l.e">{{l.name}}</span>
<span ng-show="l.e"><input ng-model="l.name"/></span>
</td>
<td>{{l.user}}</td>
<td>{{l.tel}}</td>
<td>{{l.price}}</td>
<td>{{l.city}}</td>
<td>{{l.time|date:"yyyy:MM:dd HH:mm:ss"}}</td>
<td>
<span ng-show="l.state=='已发货'">{{l.state}}</span>
<span ng-show="l.state=='发货'"><a href="#" ng-click="l.state='已发货'">{{l.state}}</a></span>
</td>
<td>
<a href="#" ng-hide="l.e" ng-click="l.e=true">修改</a>
<a href="#" ng-show="l.e==true" ng-click="l.e=false">保存</a>
<a href="#" ng-click="del(l)">删除</a>
</td>
</tr>
</tbody>
</table>
<div ng-show="isshow">
<form >
<tr>
<td><input placeholder="ID" ng-model="id" /></td>
<td><input placeholder="商品名" ng-model="name" /></td>
<td><input placeholder="用户名" ng-model="user" /></td>
<td><input placeholder="手机号" ng-model="tel" /></td>
<td><input placeholder="价格" ng-model="price" /></td>
<td><input placeholder="城市" ng-model="city" /></td>
<td><input placeholder="下单时间" ng-model="time" /></td>
<td><button ng-click="save()">保存</button></td>
</tr>
<div style="background: pink; width: 100px;">
<ul ng-repeat="d in arr">
<li>{{d}}</li>
</ul>
</div>
</form>
</div>
</body>
</html>