前端使用for循环展示所有后端数据


@{
    this.Layout = null;
}
<title>IAS - PMTC - Molding</title>
<script src="~/Scripts/vue.min.js"></script>
<script src="~/Scripts/ElementUI/element-ui.js"></script>
<link rel="stylesheet" href="~/Content/ElementUI/element-ui.css" />
<script src="~/Scripts/axios.js"></script>
<style>
    h2 {
        font-family: "Helvetica Neue",Helvetica,"PingFang SC","Hiragino Sans GB","Microsoft YaHei","微软雅黑",Arial,sans-serif;
        color: dimgrey;
        font-size: 3vh;
    }

    .running {
        background: #67C23A;
        border-radius: 15px;
    }

    .planstop {
        background: #6E6B68;
        border-radius: 15px;
    }

    .planstopAct {
        background: #C0C0C0;
        border-radius: 15px;
    }
    .warning {
        background: #A40000;
        border-radius: 15px;
    }
    .unplanstop {
        background: #E1644B;
        border-radius: 15px;
    }
    /* .el-row {
        padding: 10px 0;
        background-color: #93280B;
    }*/
    .el-col {
        border-radius: 4px;
    }

    .grid-content {
        border-radius: 0px;
        min-height: 10vh;
        display: flex;
        /*justify-content: center;*/
        align-items: center;
        font-family: "Helvetica Neue",Helvetica,"PingFang SC","Hiragino Sans GB","Microsoft YaHei","微软雅黑",Arial,sans-serif;
        font-size: 2vh;
    }

        .grid-content:hover {
            background-color: #B3C0D1;
            cursor: pointer;
        }

    .grid-contentsel {
        border-radius: 15px;
        min-height: 10vh;
        display: flex;
        /*border: 3px solid #409EFF;*/
        /*justify-content: center;*/
        align-items: center;
        font-family: "Helvetica Neue",Helvetica,"PingFang SC","Hiragino Sans GB","Microsoft YaHei","微软雅黑",Arial,sans-serif;
        font-size: 2vh;
        font: bold;
    }

    .el-row {
        margin-bottom: 20px;
    }

    .bg-green {
        background: #67C23A;
        border-radius: 15px;
    }

    .bg-wickhousing {
        background: #00FFFF;
    }

    .bg-purple-light {
        background: #e5e9f2;
    }

    .grid-contentdetail {
        min-height: 350px;
        display: flex;
        justify-content: center;
        /*align-items: center;*/
        font-family: "Helvetica Neue",Helvetica,"PingFang SC","Hiragino Sans GB","Microsoft YaHei","微软雅黑",Arial,sans-serif;
    }

    .el-icon-share {
        color: lightgray;
        font: bold;
        font-size: 3vh;
    }

    .el-icon-message-solid {
        color: lightgray;
        font: bold;
        font-size: 3vh;
    }

    .p1 {
        margin: 0 2vh 0 3vh;
        font-size: 4vh;
        font: bold;
    }

    .p2 {
        margin: 0 1vh 0 0;
        font-size: 2.5vh;
    }

    p {
        font-size: 3vh;
        font: bold;
        font-family: "Helvetica Neue",Helvetica,"PingFang SC","Hiragino Sans GB","Microsoft YaHei","微软雅黑",Arial,sans-serif;
    }

    .middivhousing {
        border-radius: 15px;
        min-height: 10vh;
        background: #00FFFF;
    }

    .tank {
        border-radius: 15px;
        min-height: 10vh;
        background: #2EDA4B;
    }

    .mouthpiece {
        border-radius: 15px;
        min-height: 10vh;
        background: #9B9B9B;
    }

    .hexcap {
        border-radius: 15px;
        min-height: 10vh;
        background: #D7B76F;
    }
</style>
<style scoped>
    .el-dialog {
        background: rgba(192,192,192,0.5);
        padding: 0px;
    }
</style>
<div id="molding">
    @*<el-dialog title="" :visible.sync="dialogTableVisible"
               :modal="true" width="70vh"
               :close-on-click-modal="false" heigth="70vh"
               :fullscreen="true"
               :show-close="false"
               :destroy-on-close="true"
               v-loading="loading" element-loading-text="Loading">
        <br />

    </el-dialog>*@

    <div style="display:flex;justify-content:space-between">
        <h2>PMTC Temperature & Humidity Monitor</h2>
        
    </div>
    <div>
        <el-container>
            <el-header>
                <template>
                    <div>
                        <el-row :gutter="50" type="flex" justify="space-around">
                            <el-col :span="8">
                                <div v-for="(item, i) in statusData.slice(0,2)" v-on:dblclick="postURL()">
                                    <div>
                                        <el-row style="margin-bottom: 0;" :class="[item.H > '65' ? 'warning':'',item.H < '40' ? 'warning':'',(item.T - 27315) / 100>'30' ? 'warning':'',(item.T - 27315) / 100<'15' ? 'warning':'',item.machineStatus == '2' ? 'planstop':'','running']">

                                            <el-col :span="12">
                                                <div style="text-align:center">
                                                    <p>
                                                        Area: {{ item.Area }}
                                                    </p>
                                                </div>
                                                <div style="text-align:center">
                                                    <p>
                                                        Time: {{ item.dateTime }}
                                                    </p>
                                                </div>
                                            </el-col>
                                            <el-col :span="12">
                                                <div style="text-align:center">
                                                    <p>
                                                        T: {{ (item.T - 27315) / 100 + ' ℃' }}
                                                    </p>
                                                </div>
                                                <div style="text-align:center">
                                                    <p>
                                                        H: {{ item.H / 100 + ' %' }}
                                                    </p>
                                                </div><div style="text-align:center">
                                                    <p>
                                                        SerialNo: {{ item.SerialNo }}
                                                    </p>
                                                </div>
                                            </el-col>
                                        </el-row>
                                        <br />
                                    </div>
                                </div>

                            </el-col>
                            <el-col :span="8">
                                <div v-for="(item, i) in statusData.slice(2,4)" v-on:dblclick="postURL()">
                                    <div>
                                        <el-row style="margin-bottom: 0;" :class="[item.H > '65' ? 'warning':'',item.H < '40' ? 'warning':'',(item.T - 27315) / 100>'30' ? 'warning':'',(item.T - 27315) / 100<'15' ? 'warning':'',item.machineStatus == '2' ? 'planstop':'','running']">

                                            <el-col :span="12">
                                                <div style="text-align:center">
                                                    <p>
                                                        Area: {{ item.Area }}
                                                    </p>
                                                </div>
                                                <div style="text-align:center">
                                                    <p>
                                                        Time: {{ item.dateTime }}
                                                    </p>
                                                </div>
                                            </el-col>
                                            <el-col :span="12">
                                                <div style="text-align:center">
                                                    <p>
                                                        T: {{ (item.T - 27315) / 100 + ' ℃' }}
                                                    </p>
                                                </div>
                                                <div style="text-align:center">
                                                    <p>
                                                        H: {{ item.H / 100 + ' %' }}
                                                    </p>
                                                </div><div style="text-align:center">
                                                    <p>
                                                        SerialNo: {{ item.SerialNo }}
                                                    </p>
                                                </div>
                                            </el-col>
                                        </el-row>
                                        <br />
                                    </div>
                                </div>
                            </el-col>
                            <el-col :span="8">
                                <div v-for="(item, i) in statusData.slice(4,5)" v-on:dblclick="postURL()">
                                    <div>
                                        <el-row style="margin-bottom: 0;" :class="[item.H > '65' ? 'warning':'',item.H < '40' ? 'warning':'',(item.T - 27315) / 100>'30' ? 'warning':'',(item.T - 27315) / 100<'15' ? 'warning':'',item.machineStatus == '2' ? 'planstop':'','running']">

                                            <el-col :span="12">
                                                <div style="text-align:center">
                                                    <p>
                                                        Area: {{ item.Area }}
                                                    </p>
                                                </div>
                                                <div style="text-align:center">
                                                    <p>
                                                        Time: {{ item.dateTime }}
                                                    </p>
                                                </div>
                                            </el-col>
                                            <el-col :span="12">
                                                <div style="text-align:center">
                                                    <p>
                                                        T: {{ (item.T - 27315) / 100 + ' ℃' }}
                                                    </p>
                                                </div>
                                                <div style="text-align:center">
                                                    <p>
                                                        H: {{ item.H / 100 + ' %' }}
                                                    </p>
                                                </div><div style="text-align:center">
                                                    <p>
                                                        SerialNo: {{ item.SerialNo }}
                                                    </p>
                                                </div>
                                            </el-col>
                                        </el-row>
                                        <br />
                                    </div>
                                </div>
                            </el-col>
                        </el-row>

                    </div>
                </template>
            </el-header>
        </el-container>
    </div>

</div>


<script>
    var app = new Vue({
        el: '#molding',
        data() {
            return {
                statusData: [],
                src: '/PIC/colorStatus.png',
                fit: 'fill',
                dialogTableVisible: true,
                loading: "true",
                picVisible: '',
                timer: '',
                value: 0
            };
        },
        mounted() {
            this.MoldingStatus();
            this.timer = setInterval(this.MoldingStatus, 300000);
        },
        methods: {
            MoldingStatus() {
                //this.dialogTableVisible = true
                //this.loading = true
                axios.get("../Facility/THMonitor").then(
                    res => {
                        this.statusData = res.data.data
                        //this.loading = false
                        //this.dialogTableVisible = false
                        //this.picVisible = true
                    }

                ).catch(
                    //错误异常
                    err => {
                        this.msg = err.status;
                    }
                )
            },
            postURL() {
                window.open("https://kochind.sharepoint.com/sites/PMC_Dev_Suzhou", "_blank");

                //if (machineType == 'ARBURG') {
                //    //window.location.href = '/PMTCProduction/MoldingOEE';
                //    window.open("/PMTCProduction/MoldingOEE", "_blank");
                //} else {
                //    //window.location.href = '/PMTCProduction/' + 'index.htm';
                //    window.open("/html/Milacron/" + machineFK + ".htm" + "?v1.0", "_blank");
                //}
            },
            mulOEE() {
                window.location.href = '/PMTCProduction/MoldingMulOEE';
            },
            OEEdefinition() {
                window.location.href = '/PMTCProduction/OEEdefinetion';
            },
            maxPage() {
                window.open("/PMTCProduction/MoldingStatus2")
            },
            homePage() {
                window.location.href = '/PMTCProduction/MoldingStatus2';
            },
            beforeDestroy() {
                clearInterval(this.timer);
            },
        }
    })
</script>

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值