AgvOperate.html 2.52 KB
<!DOCTYPE HTML>
<html  lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body>
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-receiving-add">
        <div class="form-group" style="text-align: center;transform: scale(1.2, 1.2);">
            <div class="col-sm-8" id="stationBind">
                <div class="radio radio-info radio-inline">
                    <input type="radio" id="task1" name="task" value="1" data-info="1号站台" checked="checked" class="radio_select">
                    <label for="task1">1号站台</label>
                </div>
            </div>
        </div>
        <div class="form-group" style="position: absolute;right: 120px">
            <div class="form-control-static col-sm-offset-9">
                <input type="button" onclick="typeSelect()" class="btn btn-primary" value="确定">
                <!--<button onclick="$.modal.close()" class="btn btn-danger" type="button">关闭</button>-->
            </div>
        </div>
    </form>
</div>
<div th:include="include::footer"></div>
<script type="text/javascript">
    var prefix = ctx + "receipt/AgvReceiving";

    $(function () {
       $.ajax({
           url:prefix+'/getStation',
           type:'post',
           success:function (res) {
               if(res.code===200){
                   $("#task1").attr("data-station",res.data[0].code);
                   let len=res.data.length;
                   for (let i = 2; i <= len; i++) {
                       let dom="<div class='radio radio-info radio-inline'><input type='radio' id='task"+ i +"' name='task' value='"+ i+"' " +
                           "data-info='"+ i +"号站台' data-station='"+ res.data[i-1].code+"'>" + "<label for='task"+ i+"'>"+ i+"号站台</label></div>";
                       $("#stationBind").append(dom);
                   }
               }
           }
       })
    });

    //站台选择
    function typeSelect() {
        let stationSelect=$("input[name='task']:checked").attr("data-info");
        let stationVal=$("input[name='task']:checked").val();
        let stationCode=$("input[name='task']:checked").attr("data-station");
        window.parent.$("#stationInfo").text(stationSelect);
        window.parent.$("#stationInfo").attr("data-info",stationVal);
        window.parent.$("#stationInfo").attr("data-station",stationCode);
        window.parent.station=stationVal;
        $.modal.close()
    }
</script>
</body>
</html>