添加数据

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style type="text/css">
#t tr:nth-child(2n){
background-color:moccasin ;
}
</style>
<script type="text/javascript" src="js/angular.min.js" ></script>
<script type="text/javascript" src="js/jquery-1.11.1.min.js" ></script>
<script>
angular.module("Dxm",[])
.controller("deom",function($scope,$filter){

$scope.datas=[];
$scope.ruku = false;
for(var i=1;i<6;i++){
var a={
"name":"开心果"+i,
"number":i,
"chandi":"内心"+i,
"price":100+i,
"time":new Date()
};
$scope.datas.push(a);
}

$scope.tijiao=function(){
$scope.datas.push({
"name":$scope.hname,
"number":$scope.hnumber,
"chandi":$scope.hctiy,
"price":$scope.hprice,
"time":new Date()
})

//点击提交按钮后隐藏弹出框
$scope.ruku=false;
alert("是否确认添加数据?");
}

$scope.del=function(v){

var  f = confirm("确认删除选定项?");
if(f){
for(a in $scope.datas){
if($scope.datas[a].name==v){
$scope.datas.splice(a,1);
break;
}
}
}
}



});
</script>
</head>
<body ng-app="Dxm" ng-controller="deom">
<div>
<h1 align="center">商品库存管理系统</h1>
<input style="height: 30px;" placeholder="输入关键字搜索" ng-model="ss"/>
<select style="height: 35px; margin-left: 300px;" ng-model="op">
<option value="">-请选择排序方式-</option>
<option value="number">按货物数量正序排列</option>
<option value="-number">按货物数量倒序排列</option>
<option value="time">按入库时间正序排列</option>
<option value="-time">按入库时间倒序排列</option>
</select>
<input type="button" ng-click="ruku=true" value="入库" style="margin-left: 80px; background-color: sandybrown;" />

<table id="t" style="margin-top: 30px;" border="1px" >
<tr style="background-color: sandybrown;">
<th>货物名称</th>
<th>货物数量</th>
<th>货物产地</th>
<th>货物单价</th>
<th>货物入库时间</th>
<th>操作</th>
</tr>
<tr align="center" ng-repeat="data in datas|filter:ss|orderBy:op">
<td>{{data.name}}</td>
<td>{{data.number}}</td>
<td>{{data.chandi}}</td>
<td>{{data.price|currency:'¥'}}</td>
<td>{{data.time|date:"yyyy-MM-dd HH:mm:ss"}}</td>
<td><input type="button" value="删除" ng-click="del(data.name)"/></td>
</tr>

</table>
<table id="t" ng-show="ruku">
<tr>
<td>货物名称</td>
<td><input ng-model="hname"/></td>
</tr>
<tr>
<td>货物数量</td>
<td><input ng-model="hnumber"/></td>
</tr>
<tr>
<td>货物产地</td>
<td><input ng-model="hctiy"/></td>
</tr>
<tr>
<td>货物单价</td>
<td><input ng-model="hprice"/></td>
</tr>
<tr>
<td><input ng-click="tijiao()" type="button" value="提交" /></td>
</tr>

</table>
</div>
</body>
</html>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值