diff --git a/AMESCoreStudio.Web/Controllers/REPController.cs b/AMESCoreStudio.Web/Controllers/REPController.cs index 905e2d5e..16baa8f5 100644 --- a/AMESCoreStudio.Web/Controllers/REPController.cs +++ b/AMESCoreStudio.Web/Controllers/REPController.cs @@ -151,6 +151,22 @@ namespace AMESCoreStudio.Web.Controllers ViewBag.RMAReasonList = RMAReasonList; } + [HttpPost] + public async Task GetRepairTypeJson(string repair_type_no) + { + var result = await _ppsApi.GetRepairType(repair_type_no); + + var item = new List(); + + for (int i = 0; i < result.Count; i++) + { + item.Add(new SelectListItem(result[i].RepairTypeDesc, result[i].RepairTypeNo.ToString())); + } + + //将数据Json化并传到前台视图 + return Json(new { data = item }); + } + private async Task GetRepairTypeList() { diff --git a/AMESCoreStudio.Web/Views/REP/REP001R.cshtml b/AMESCoreStudio.Web/Views/REP/REP001R.cshtml index 828fdf2f..2e7413d6 100644 --- a/AMESCoreStudio.Web/Views/REP/REP001R.cshtml +++ b/AMESCoreStudio.Web/Views/REP/REP001R.cshtml @@ -20,7 +20,7 @@
-
+
@@ -289,7 +289,8 @@
- + +
@@ -346,7 +347,8 @@
@Html.ValidationMessage("error") - + +
@@ -366,12 +368,48 @@ } }); + function getRepairType(data) + { + $.ajax( + { + url: "@Url.Action("GetRepairTypeJson", "REP")", + dataType: 'json', + data: { "repair_type_no": data}, + type: 'post', + success: function (result) + { + console.info(result.data); + $.each(result.data, function (index, item) { + $("#txtRepairTypeDesc").val(item.text); + }); + }, + error: function (result) + { + alert(result); + } + }); + }; + $("#saveimage1").click(function (event) { alert('save1'); }); + $("#btnOK").click(function (event) { + $("#form").submit(); + }); + + $('#txtRepairTypeNo').on('keypress', function (event) { + + if (event.keyCode == 13) { + //alert($('#txtRepairTypeNo').val()); + getRepairType($('#txtRepairTypeNo').val()); + } + + }); + + var tableCols = [[ { field: 'repairID',