@model AMESCoreStudio.WebApi.Models.AMES.CycleTime @{ ViewData["Title"] = "PPS003C"; Layout = "~/Views/Shared/_FormLayout.cshtml"; } <style> .control-label { justify-content: flex-end !important; } </style> <div class="row"> <div class="col-sm-12"> <form enctype="multipart/form-data" method="post" asp-action="PPS003CSave"> <div asp-validation-summary="ModelOnly" class="text-danger"></div> <div class="form-group form-inline my-sm-1"> <label asp-for="ItemNo" class="control-label col-sm-3"></label> <input asp-for="ItemNo" class="form-control col-sm-9" placeholder="請輸入料號" /> <span asp-validation-for="ItemNo" class="text-danger offset-sm-3 my-sm-1"></span> </div> <div class="form-group form-inline my-sm-1"> <label asp-for="CT1" class="control-label col-sm-3"></label> <input asp-for="CT1" class="form-control col-sm-9" placeholder="請輸入每個產出時間" /> <span asp-validation-for="CT1" class="text-danger offset-sm-3 my-sm-1"></span> </div> <div class="form-group form-inline my-sm-1"> <label asp-for="CT2" class="control-label col-sm-3"></label> <input asp-for="CT2" class="form-control col-sm-9" placeholder="請輸入每分鐘產出個數" /> <span asp-validation-for="CT2" class="text-danger offset-sm-3 my-sm-1"></span> </div> <div class="form-group form-inline my-sm-1"> <label asp-for="SectionNo" class="control-label col-sm-3"></label> <select id="section" lay-filter="section" lay-verify="required" asp-for="SectionNo" asp-items="@ViewBag.SectionList" class="custom-select col-sm-9"></select> <span asp-validation-for="SectionNo" class="text-danger offset-sm-3 my-sm-1"></span> <input id="sectionNo" type="hidden" name="sectionNo" value="*" /> </div> <div class="form-group form-inline my-sm-1"> <label asp-for="LineID" class="control-label col-sm-3"></label> <select id="line" lay-filter="line" lay-verify="required" asp-for="LineID" asp-items="@ViewBag.LineList" class="custom-select col-sm-9"></select> <span asp-validation-for="LineID" class="text-danger offset-sm-3 my-sm-1"></span> </div> <div class="form-group form-inline my-sm-1"> <label asp-for="FirstTime" class="control-label col-sm-3"></label> <input asp-for="FirstTime" class="form-control col-sm-9" placeholder="請輸入首件產出時間" /> <span asp-validation-for="FirstTime" class="text-danger offset-sm-3 my-sm-1"></span> </div> <div class="form-group form-inline my-sm-1"> <label asp-for="PassTime" class="control-label col-sm-3"></label> <input asp-for="PassTime" class="form-control col-sm-9" placeholder="請輸入良品產出時間" /> <span asp-validation-for="PassTime" class="text-danger offset-sm-3 my-sm-1"></span> </div> <div class="form-group form-inline my-sm-1"> <label asp-for="OPCnt" class="control-label col-sm-3"></label> <input asp-for="OPCnt" class="form-control col-sm-9" placeholder="請輸入作業人數" /> <span asp-validation-for="OPCnt" class="text-danger offset-sm-3 my-sm-1"></span> </div> <div class="form-group form-inline my-sm-1"> <label asp-for="PROCnt" class="control-label col-sm-3"></label> <input asp-for="PROCnt" class="form-control col-sm-9" placeholder="請輸入日產能" /> <span asp-validation-for="PROCnt" class="text-danger offset-sm-3 my-sm-1"></span> </div> <div class="form-group form-inline my-sm-1"> <label asp-for="MOHUnit" class="control-label col-sm-3"></label> <input asp-for="MOHUnit" class="form-control col-sm-9" placeholder="請輸入月產出" /> <span asp-validation-for="MOHUnit" class="text-danger offset-sm-3 my-sm-1"></span> </div> <div class="form-group form-inline my-sm-1"> <label asp-for="WIUnit" class="control-label col-sm-3"></label> <input asp-for="WIUnit" class="form-control col-sm-9" placeholder="請輸入週產出" /> <span asp-validation-for="WIUnit" class="text-danger offset-sm-3 my-sm-1"></span> </div> <div class="form-group form-inline my-sm-1"> <label asp-for="Memo" class="control-label col-sm-3"></label> <input asp-for="Memo" class="form-control col-sm-9" placeholder="請輸入備註" /> <span asp-validation-for="Memo" class="text-danger offset-sm-3 my-sm-1"></span> </div> <span style="color: firebrick;word-break: break-all;" class="text-danger offset-sm-3">@Html.ValidationMessage("error")</span> <div class="form-group"> <input type="submit" value="儲存" class="btn btn-primary offset-sm-3" /> </div> </form> </div> </div> @section Scripts { @{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); await Html.RenderPartialAsync("_FileinputScriptsPartial"); } <script type="text/javascript"> function getLineList(data) { $.ajax( { url: "@Url.Action("GetLineJson", "PPS")", dataType: 'json', data: { "unit_no": $("#sectionNo").val() }, type: 'post', success: function (result) { console.info(result.data); $("#line").empty();//清空下拉框的值 $.each(result.data, function (index, item) { $("#line").append(new Option(item.text, item.value));// 下拉菜单里添加元素 //$("#errorClass").append($("<option>").text(item.text).val(item.value)) }); layui.form.render("select");//重新渲染 固定写法 }, error: function (result) { alert(result); } }); }; $(document).ready(function () { var error = '@Html.ValidationMessage("error")'; if ($(error).text() != '') { parent.hg.msg(error); } $("#section").change(function () { //alert("hi"); var section_no = $(this).children('option:selected').val(); $("#sectionNo").val(section_no); //alert(section_no); getLineList(section_no); }); }); </script> }