增删改查

<!DOCTYPE html>
<html>

    <head>
        <meta charset="utf-8" />
        <title></title>
        <script type="text/javascript" src="js/angular.js"></script>
        <script type="text/javascript" src="js/angular-route.js"></script>
        <script type="text/javascript" src="js/angular.min.js"></script>
        <script type="text/javascript" src="js/jquery-2.1.0.js" ></script>
        <script>
            var app = angular.module("myapp", []);

            app.controller("myCtrl", function($scope) {

                $scope.bd = "";
                $scope.yc = false;
                $scope.ad = false;
                $scope.users = [{
                    id: 1,
                    uanme: "皮鞋",
                    price: 250,
                    zt: "未发货",
                    checked: false,
                    chengs: "北京",
                    Date: new Date("2016-05-02"),
                    name: "张山丰"

                }, {
                    id: 2,
                    uanme: "大衣",
                    price: 360,
                    zt: "未发货",
                    checked: false,
                    chengs: "北京",
                    Date: new Date("2011-09-02"),
                    name: "张磊"
                }, {
                    id: 3,
                    uanme: "围脖",
                    price: 25,
                    zt: "未发货",
                    checked: false,
                    chengs: "北京",
                    Date: new Date("2019-06-02"),
                    name: "张三"
                }, {
                    id: 4,
                    uanme: "手机",
                    price: 2500,
                    zt: "未发货",
                    checked: false,
                    chengs: "台北",
                    Date: new Date(),
                    name: " 张紫凡"
                }];
                  $scope.arr1=[1,2,3,4,5,6,7,8,9,10,11,12];
                //删除
                $scope.san = function(sanid) {

                    for (index1 in $scope.users) {

                        if ($scope.users[index1].id == sanid) {

                            $scope.users.splice(index1, 1);
                        }

                    }

                }
                $scope.pl = function() {
                    var arr = [];

                    for (index2 in $scope.users) {

                        if ($scope.users[index2].checked == true) {

                            arr.push($scope.users[index2]);

                        }

                    }

                    for (index3 in arr) {

                        for (index4 in $scope.users) {

                            if (arr[index3] == $scope.users[index4]) {

                                $scope.users.splice(index4, 1);

                            }
                        }

                    }
                }
               var ms=/米/g;
                $scope.add = function() {
                        alert("adad");
                        var s = {
                            id: $scope.add_id,
                            uanme: $scope.add_uanme.replace(ms,"**"),
                            price: $scope.add_price,
                            chengs: $scope.add_chengs,
                            zt: "未发货",
                            checked: false,
                            Date: new Date(),
                            name: $scope.add_name

                        }
                        $scope.users.push(s);
                        $scope.add_id = "";
                        $scope.ad = false;

                    }
                    //(ordergz+orderCunm)
                $scope.ordergz = "";
                $scope.orderCunm="id";
                $scope.px="";
                $scope.pxa = function() {
                      if($scope.px==""){
                          
                      }else if($scope.px=="id"){
                          
                            $scope.ordergz = "";
                $scope.orderCunm=$scope.px;
                          
                      }else{
                                 $scope.ordergz = "-";
                              $scope.orderCunm="id";
                          
                      }
                }
          $scope.plfh= function(){
        
    

                    for (index5 in $scope.users) {

                        if ($scope.users[index5].checked == true) {

                         $scope.users[index5].zt="已发货";

                        }

                    }
                
          }
          $scope.valuget= function(w){
        
              var ww =  w.getMonth() +1;
        
            var start=$scope.ks;
              var end=$scope.js;
              if(start==undefined||start==""){
                  
                  start=1;
                  
              }
               if(end==undefined||end==""){
                   
                   end=12;
                   
               }
               if(ww >= start && ww <=end){
                   
                   return true;
                   
               }else{
                   
                return false;
                   
               }
              
          }
             
        
            })
        </script>
    
    </head>

    <body ng-app="myapp" ng-controller="myCtrl">
        <center><input type="text" placeholder="商品名称查" ng-model="spm"></center>
        <center><input type="text" placeholder="发货人" ng-model="fhr"><select ng-change="gbsj()" ng-model="bd">
                    <option value="">城市查询</option>
                    <option value="北京">北京</option>
                    <option value="上海">上海</option>
                    <option value="邯郸">邯郸</option>
                </select>
            <button ng-click="pl()">批量删除</button>
            <button ng-click="ad=true">新增</button>
            <select ng-model="px" ng-change="pxa()">
                <option value="">请选择根据排序的列名</option>
                <option value="id">Id升序</option>
                <option value="-id">Id降序</option>
            </select>
    <select ng-model="ks"><option value="">开始时间</option><option ng-repeat="s in arr1">{{s}}</option></select>
    <select ng-model="js"><option value="">结束时间</option><option ng-repeat="s in arr1">{{s}}</option></select>
<button ng-click="plfh()">批量发货</button>
        </center>

        <!--table-->
        <center>
            <table border="1" width="800">

                <thead>
                    <tr>
                        <td><input type="checkbox"></td>
                        <td>ID</td>
                        <td>价钱</td>
                        <td>状态</td>
                        <td>发货地址</td>
                        <td>发货时间</td>
                        <td>发货人</td>
                        <td>商品名称</td>
                        <td>操作</td>
                    </tr>
                </thead>

                <tbody ng-repeat="user in users | filter :{uanme:spm,name:fhr,chengs:bd} | orderBy :(ordergz+orderCunm) | filter :{Date:ks}" ng-show="valuget(user.Date)">
                    <tr>
                        <td><input type="checkbox" ng-model="user.checked"></td>
                        <td>{{user.id}}</td>
                        <td>{{user.price | currency:"$"}}<span ng-show="yc"><input type="text" ng-model="user.price"><button ng-click="yc=false">保存</button></span></td>
                        <td><button ng-click="user.zt='已发货'">{{user.zt}}</button></td>
                        <td>{{user.chengs}}</td>
                        <td>{{user.Date | date : "MM-dd"}}</td>
                        <td>{{user.name}}</td>
                        <td>{{user.uanme}}</td>
                        <td><button ng-click="san(user.id)">删除</button><button ng-click="yc=true">修改价钱</button></td>
                    </tr>
                </tbody>

            </table>
        </center>
<br />
<center  ng-show="ad">
    <table border="1" width="500">
            商品Id&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" ng-model="add_id" /> <br /> <br />
            商品名称<input type="text" ng-model="add_uanme" />  <br /> <br />
            商品价格<input type="text" ng-model="add_price" /> <br /> <br />
             发货地点 <input type="text" ng-model="add_chengs" /> <br /> <br />
              发货人&nbsp;&nbsp;&nbsp;<input type="text" ng-model="add_name" /> <br />
            <button ng-click="add()">add</button>
    </table>
    
</center>
    </body>

</html>