js 循环遍历div层

<%@ page language="java" import="java.util.*" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8" %>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
        <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
            <%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt_rt" %>
                <!DOCTYPE html>
                <html lang="en">
                    
                    <head>
                        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
                        <!-- Meta, title, CSS, favicons, etc. -->
                        <meta charset="utf-8">
                        <meta http-equiv="X-UA-Compatible" content="IE=edge">
                        <meta name="viewport" content="width=device-width, initial-scale=1">
                        <title>
                            机器看板
                        </title>
                        <!-- Bootstrap -->
                        <link href="../../vendors/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
                        <!-- Font Awesome -->
                        <link href="../../vendors/font-awesome/css/font-awesome.min.css" rel="stylesheet">
                        <!-- NProgress -->
                        <link href="../../vendors/nprogress/nprogress.css" rel="stylesheet">
                        <!-- Custom Theme Style -->
                        <link href="../build/css/custom.min.css" rel="stylesheet">
                        <script src="../../vendors/jquery/dist/jquery.min.js">
                        </script>
                    </head>
                    <style>
                        .nomorlcolor {color:green;} /** 正常**/ .waitcolor {color:red;} /** 待机 **/
                        .unlinkcolor {color:gray;} /** 断开 **/ .tiaojicolor {color:blue;} /** 调机
                        **/ .othercolor{color:orange;font-size:26px;white-space: nowrap;}/** 其他
                        **/
                    </style>
                    
                    <body>
                        <div class="row top_tiles" id="kanbanID">
                        </div>

  
            
  <script type="text/javascript">
    var list;
    $(document).ready(function() {
        var data = [{
            "machCode": "1#",
            "machStatus": "正常",
            "mouldCode": "null",
            "productUnits": "0",
            "scheduledProductUnits": "0",
            "scheduledEndTime": "null",
            "goodUnits": "null"
        },
        {
            "machCode": "2#",
            "machStatus": "调机",
            "mouldCode": "null",
            "productUnits": "0",
            "scheduledProductUnits": "0",
            "scheduledEndTime": "null",
            "goodUnits": "null"
        },
        {
            "machCode": "3#",
            "machStatus": "关机",
            "mouldCode": "null",
            "productUnits": "0",
            "scheduledProductUnits": "0",
            "scheduledEndTime": "null",
            "goodUnits": "null"
        },
        {
            "machCode": "4#",
            "machStatus": "待机",
            "mouldCode": "null",
            "productUnits": "0",
            "scheduledProductUnits": "0",
            "scheduledEndTime": "null",
            "goodUnits": "null"
        },
        {
            "machCode": "5#",
            "machStatus": "修模",
            "mouldCode": "null",
            "productUnits": "0",
            "scheduledProductUnits": "0",
            "scheduledEndTime": "null",
            "goodUnits": "null"
        },
        {
            "machCode": "6#",
            "machStatus": "首件",
            "mouldCode": "null",
            "productUnits": "0",
            "scheduledProductUnits": "0",
            "scheduledEndTime": "null",
            "goodUnits": "null"
        },
        {
            "machCode": "7#",
            "machStatus": "正常",
            "mouldCode": "null",
            "productUnits": "0",
            "scheduledProductUnits": "0",
            "scheduledEndTime": "null",
            "goodUnits": "null"
        },
        {
            "machCode": "8#",
            "machStatus": "待机",
            "mouldCode": null,
            "productUnits": "0",
            "scheduledProductUnits": "1",
            "scheduledEndTime": null,
            "goodUnits": "0"
        },
        {
            "machCode": "9#",
            "machStatus": "调机",
            "mouldCode": null,
            "productUnits": "0",
            "scheduledProductUnits": "1",
            "scheduledEndTime": null,
            "goodUnits": "0"
        }];
        for (var i in data) {
            list = data[i];
            if (list.machStatus == "正常") {
                $('#kanbanID').append('<div class="animated flipInY col-lg-2 col-md-3 col-sm-6 col-xs-12">' + ' <div class="tile-stats">' + '<div class="icon">' + '<i class="fa fa-refresh fa-spin fa-3x fa-fw nomorlcolor">' + '</i>' + '</div>' + '<div class="count nomorlcolor">' + list.machCode + '</div>' + '<h3>' + list.mouldCode + '</h3>' + '<p>' + list.productUnits + '</p>' + '<p>' + list.scheduledProductUnits + '</p>' + '<p>' + list.scheduledEndTime + '</p>' + '</div>' + '</div>');
            } else if (list.machStatus == "调机") {
                $('#kanbanID').append('<div class="animated flipInY col-lg-2 col-md-3 col-sm-6 col-xs-12">' + ' <div class="tile-stats">' + '<div class="icon">' + '<i class="fa fa fa-hand-pointer-o tiaojicolor">' + '</i>' + '</div>' + '<div class="count tiaojicolor">' + list.machCode + '</div>' + '<h3>' + list.mouldCode + '</h3>' + '<p>' + list.productUnits + '</p>' + '<p>' + list.scheduledProductUnits + '</p>' + '<p>' + list.scheduledEndTime + '</p>' + '</div>' + '</div>');
            } else if (list.machStatus == "待机") {
                $('#kanbanID').append('<div class="animated flipInY col-lg-2 col-md-3 col-sm-6 col-xs-12">' + ' <div class="tile-stats">' + '<div class="icon">' + '<i class="fa fa fa-clock-o waitcolor">' + '</i>' + '</div>' + '<div class="count waitcolor">' + list.machCode + '</div>' + '<h3>' + list.mouldCode + '</h3>' + '<p>' + list.productUnits + '</p>' + '<p>' + list.scheduledProductUnits + '</p>' + '<p>' + list.scheduledEndTime + '</p>' + '</div>' + '</div>');
            } else if (list.machStatus == "断开") {
                $('#kanbanID').append('<div class="animated flipInY col-lg-2 col-md-3 col-sm-6 col-xs-12">' + ' <div class="tile-stats">' + '<div class="icon">' + '<i class="fa fa fa-unlink unlinkcolor">' + '</i>' + '</div>' + '<div class="count unlinkcolor">' + list.machCode + '</div>' + '<h3>' + list.mouldCode + '</h3>' + '<p>' + list.productUnits + '</p>' + '<p>' + list.scheduledProductUnits + '</p>' + '<p>' + list.scheduledEndTime + '</p>' + '</div>' + '</div>');
            } else {
                $('#kanbanID').append('<div class="animated flipInY col-lg-2 col-md-3 col-sm-6 col-xs-12">' + ' <div class="tile-stats">' + '<div class="icon">' + '<h2 class="fa fa fa  othercolor">' + list.machStatus + '</h2>' + '</div>' + '<div class="count othercolor">' + list.machCode + '</div>' + '<h3>' + list.mouldCode + '</h3>' + '<p>' + list.productUnits + '</p>' + '<p>' + list.scheduledProductUnits + '</p>' + '<p>' + list.scheduledEndTime + '</p>' + '</div>' + '</div>');
            }


            document.getElementById("kanbanID").innerHTML;
        }
    });
</script>


        
           
       </body>
</html>
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值