用户全

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>综合练习</title>
    <style>
        .addUser{
            width: 100px;height: 40px;font-size: 18px;background-color: #11C1F3;
        }
    </style>
    <script type="text/javascript" src="angular-1.3.0.js" ></script>
    <script src="https://apps.bdimg.com/libs/angular-route/1.3.13/angular-route.js"></script>


    <script type="text/javascript">
        var app = angular.module("myApp",["ngRoute"]);
        //使用config配置路由规则
        app.config(["$routeProvider",function($routeProvider){
            $routeProvider
                    .when("/addUser",{
                        controller:"addUserCtrl",
                        templateUrl:"addUser.html"
                    })
                    .when("/updatePwd/:name",{
                        controller:"updatePwdCtrl",
                        templateUrl:"updatePwd.html"
                    })
                    .otherwise({redirectTo:"/addUser"});
        }]);
        app.controller("myCtrl",function($scope,$location){
            $scope.users = [
                {"id":1,"name":"张三","pwd":"123","age":20,"sex":"男"},
                {"id":2,"name":"李四","pwd":"456","age":33,"sex":"女"},
                {"id":3,"name":"王五","pwd":"789","age":42,"sex":"男"}
            ];
            //定义页面跳转方法
            $scope.goToUrl = function(path){
                alert(path);
                $location.path(path);
            }
            //全部删除
            $scope.del=function(){
                if(confirm("确实删除吗?")){
                    $scope.users=[];
                }
            };
            $scope.ageTest=function(age,agesize){

                if(agesize !="--请选择--"){
                    var ages=agesize.split("-");
                    var ageMin=ages[0];
                    var ageMax=ages[1];

                    if(age<ageMin || age>ageMax){

                        return false;
                    }else{
                        return true;
                    }
                }else{
                    return true;
                }
            }
            //批量删除
            $scope.deleteSel=function(){
                var userNames=[];
                for(index in $scope.users){
                    if($scope.users[index].state == true){
                        userNames.push($scope.users[index].name);
                    }
                }

                if(userNames.length>0){
                    if(confirm("是否删除选中项?")){
                        for(i in userNames){
                            var name=userNames[i];
                            for(i2 in $scope.users){
                                if($scope.users[i2].name==name){
                                    $scope.users.splice(i2,1);
                                }
                            }
                        }
                    }
                }else{
                    alert("请选择删除的项")
                }
            }
            //全选按钮
            $scope.gou=function () {
                for(var i=0;i<$scope.users.length;i++) {
                    if($scope.checkAll==true) {
                        $scope.users[i].state=true;
                    } else {
                        $scope.users[i].state=false;
                    }
                }
            }
        });
        //定义添加用户控制器
        app.controller("addUserCtrl",function($scope){

            $scope.name = "";
            $scope.pwd = "";
            $scope.pwd2 = "";
            $scope.age = "";
            $scope.sex = "";

            $scope.sub = function(){
                if($scope.name==""){
                    alert("用户名不能为空");
                }else {
                    if($scope.age>=10&&$scope.age<=60){
                        var newUser = {
                            id:$scope.users.length + 1,
                            name:$scope.name,
                            pwd:$scope.pwd,
                            age:$scope.age,
                            sex:$scope.sex
                        }
                        //添加新用户.
                        $scope.users.push(newUser);
                    }else{
                        alert("年龄在10到60之间");
                    }

                }


            }
        });
        //定义修改用户控制器
        app.controller("updatePwdCtrl",function($scope,$routeParams){
            $scope.name = $routeParams.name;
            $scope.oldPwd = "";
            $scope.pwd1 = "";
            $scope.pwd2 = "";
            $scope.updatePwd = function(){
                for(index in $scope.users){
                    if($scope.users[index].name==$scope.name){
                        if($scope.users[index].pwd==$scope.oldPwd){
                            if($scope.pwd1==$scope.pwd2){
                                $scope.users[index].pwd=$scope.pwd1;
                            }else{
                                alert("两次密码不一致");
                            }
                        }else{
                            alert("旧密码错误");
                        }
                    }
                }
            }

        });


    </script>
</head>
<body ng-app="myApp" ng-controller="myCtrl">
<center>
    <h3>用户信息表</h3>
    <div>
        <input ng-model="search" placeholder="用户名查询"  size="10" />
        年龄:<select id="age" ng-model="agesize" ng-init="agesize='--请选择--'">
        <option>--请选择--</option>
        <option>19-30</option>
        <option>31-40</option>
        <option>41-50</option>
    </select>
        性别:<select>
        <option></option>
        <option></option>
    </select>
        <input type="button" value="全部删除"  ng-click="del()"/>
        <input ng-click="deleteSel()" type="button" value="批量删除"/>
    </div><br />
    <div>
        <table border="1" cellspacing="1" cellpadding="10">
            <thead>
            <tr>
                <th><input type="checkbox" ng-click="gou()" ng-model="checkAll"></th>
                <th>id</th>
                <th>用户名</th>
                <th>密码</th>
                <th>年龄</th>
                <th>性别</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>
            <tr ng-repeat="user in users | filter:{'name':search}" ng-if="ageTest(user.age,agesize)">
                <th><input ng-model="user.state" type="checkbox"></th>
                <td>{{user.id}}</td>
                <td>{{user.name}}</td>
                <td>{{user.pwd}}</td>
                <td>{{user.age}}</td>
                <td>{{user.sex}}</td>
                <td><button ng-click="goToUrl('/updatePwd/'+user.name)">修改密码</button> </td>
            </tr>
            </tbody>
        </table>
    </div><br />
    <button class="addUser" ng-click="goToUrl('/addUser')">添加用户</button><br /><br />
    <!-- 1.添加用户页面 -->
    <script type="text/ng-template" id="addUser.html">
        <form action="">
            <table border="1" cellspacing="1" cellpadding="10">
                <tr>
                    <th>用户名:</th>
                    <td><input ng-model="name" type="text" required placeholder="请输入用户名"/></td>
                </tr>
                <tr>
                    <th>密 码:</th>
                    <td><input ng-model="pwd" placeholder="请输入密码" /></td>
                </tr><tr>
                <th>年 龄:</th>
                <td><input ng-model="age" placeholder="请输入年龄" /></td>
            </tr><tr>
                <th>性 别:</th>
                <td><input ng-model="sex" placeholder="请输入性别" /></td>
            </tr>
                <tr align="center">
                    <td colspan="2"><input type="button" ng-click="sub()" value="提交" /></td>
                </tr>
            </table>
        </form>
    </script>
    <!-- 2.修改用户信息页面 -->
    <script type="text/ng-template" id="updatePwd.html">
        <form>
            <table border="1" cellspacing="1" cellpadding="10">
                <tr>
                    <th>用户名:</th>
                    <td><input disabled="disabled" ng-model="name" placeholder="请输入用户名"  /></td>
                </tr>
                <tr>
                    <th>旧密码:</th>
                    <td><input ng-model="oldPwd" placeholder="请输入密码" /></td>
                </tr><tr>
                <th>新密码:</th>
                <td><input ng-model="pwd1" placeholder="请输入密码"  /></td>
            </tr><tr>
                <th>确认:</th>
                <td><input ng-model="pwd2" placeholder="请输入密码"  /></td>
            </tr>
                <tr align="center">
                    <td colspan="2"><input type="button" value="提交" ng-click="updatePwd()" /></td>
                </tr>
            </table>
        </form>
    </script>


    <!-- 6.指定相应内容 -->
    <div ng-view>

    </div>
</center>
</body>
</html>
该数据集通过合成方式模拟了多种发动机在运行过程中的传感器监测数据,旨在构建一个用于机械系统故障检测的基准资源,特别适用于汽车领域的诊断分析。数据按固定时间间隔采集,涵盖了发动机性能指标、异常状态以及工作模式等多维度信息。 时间戳:数据类型为日期时间,记录了每个数据点的采集时刻。序列起始于2024年12月24日10:00,并以5分钟为间隔持续生成,体现了对发动机运行状态的连续监测。 温度(摄氏度):以浮点数形式记录发动机的温度读数。其数值范围通常处于60至120摄氏度之间,反映了发动机在常规工况下的典型温度区间。 转速(转/分钟):以浮点数表示发动机曲轴的旋转速度。该参数在1000至4000转/分钟的范围内随机生成,符合多数发动机在正常运转时的转速特征。 燃油效率(公里/升):浮点型变量,用于衡量发动机的燃料利用效能,即每升燃料所能支持的行驶里程。其取值范围设定在15至30公里/升之间。 振动_X、振动_Y、振动_Z:这三个浮点数列分别记录了发动机在三维空间坐标系中各轴向的振动强度。测量值标准化至0到1的标度,较高的数值通常暗示存在异常振动,可能与潜在的机械故障相关。 扭矩(牛&middot;米):以浮点数表征发动机输出的旋转力矩,数值区间为50至200牛&middot;米,体现了发动机的负载能力。 功率输出(千瓦):浮点型变量,描述发动机单位时间内做功的速率,取值范围为20至100千瓦。 故障状态:整型分类变量,用于标识发动机的异常程度,共分为四个等级:0代表正常状态,1表示轻微故障,2对应中等故障,3指示严重故障。该列作为分类任务的目标变量,支持基于传感器数据预测故障等级。 运行模式:字符串类型变量,描述发动机当前的工作状态,主要包括:怠速(发动机运转但无负载)、巡航(发动机在常规负载下平稳运行)、重载(发动机承受高负荷或高压工况)。 数据集整体包含1000条记录,每条记录对应特定时刻的发动机性能快照。其中故障状态涵盖从正常到严重故障的四级分类,有助于训练模型实现故障预测与诊断。所有数据均为合成生成,旨在模拟真实的发动机性能变化与典型故障场景,所包含的温度、转速、燃油效率、振动、扭矩及功率输出等关键传感指标,均为影响发动机故障判定的重要因素。 资源来源于网络分享,仅用于学习交流使用,请勿用于商业,如有侵权请联系我删除!
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值