主要是因為修改功能,原來頁面填寫數(shù)據(jù)如圖

改為

其中點擊填寫明細彈出框

填寫完畢后點擊確認返回,同事這里因為她是存的多表,所以點擊確認就直接保存數(shù)據(jù)了,改的這個功能原本保存是整體保存,我就不想改原來的邏輯,只想把填寫的值帶回去用隱藏控件存一下,到時候按照原來的邏輯整體存,所以沒辦法參考她的,最后搜索很多,解決了問題,具體代碼如下:
父頁面:
<div class="row"><div class="col-md-6"><div class="form-group PadTB10"><label class="LabelW150">經(jīng)費來源總計(元)</label><input type="text" readonly="readonly" class="form-control" id="AmountSum" name="AmountSum" onkeyup="value=value.replace(/[^/d.]/g,'')" placeholder="填寫來源明細" value="@pro.AmountSum"/><input type="button" value="填寫來源明細" onclick="ShowAmountDetail()" /><input type="hidden" name="CenterAmount" id="CenterAmount" value="@pro.CenterAmount" /><input type="hidden" name="CityAmount" id="CityAmount" value="@pro.CityAmount" /><input type="hidden" name="DisAmount" id="DisAmount" value="@pro.DisAmount" /><input type="hidden" name="StreetAmount" id="StreetAmount" value="@pro.StreetAmount" /><input type="hidden" name="OtherAmount" id="OtherAmount" value="@pro.OtherAmount" /></div></div></div>
js:
//彈出經(jīng)費來源明細function ShowAmountDetail() {var index = layer.open({type: 2,title: '填寫經(jīng)費明細',shadeClose: false,skin: 'layui-layer-rim',area: ['50%', '50%'],maxmin: true,content: '/Project/AmountDetail?ProjectCode=' + "@ProjectCode",btn: ['確定', '關閉'],yes: function (index, layero) {debugger;var body = layer.getChildFrame('body', index); //得到iframe頁的body內(nèi)容var CenterAmount = body.find("#CenterAmount").val();var CityAmount = body.find("#CityAmount").val();var DisAmount = body.find("#DisAmount").val();var StreetAmount = body.find("#StreetAmount").val();var OtherAmount = body.find("#OtherAmount").val();if (CenterAmount == null || CenterAmount == "") CenterAmount = 0;if (CityAmount == null || CityAmount == "") CityAmount = 0;if (DisAmount == null || DisAmount == "") DisAmount = 0;if (StreetAmount == null || StreetAmount == "") StreetAmount = 0;if (OtherAmount == null || OtherAmount == "") OtherAmount = 0;sum = Number(CenterAmount) + Number(CityAmount) + Number(DisAmount)+ Number(StreetAmount) + Number(OtherAmount);document.getElementById("CenterAmount").value = CenterAmount;document.getElementById("CityAmount").value = CityAmount;document.getElementById("DisAmount").value = DisAmount;document.getElementById("StreetAmount").value = StreetAmount;document.getElementById("OtherAmount").value = OtherAmount;document.getElementById("AmountSum").value = sum;//最后關閉彈出層layer.close(index);},cancel: function () {//右上角關閉回調(diào)}});// layer.full(index);}子頁面:
<!DOCTYPE html><html><head><meta name="viewport" content="width=device-width" /><title>AmountDetail</title></head><body><div><table class="table table-bordered "><tr><td rowspan="5" style="text-align: center; vertical-align: middle;">經(jīng)濟來源明細</td><td>中央撥款(元)</td><td><input id="CenterAmount" class="form-control" onkeyup="value=value.replace(/[^/d.]/g,'')" name="CenterAmount" type="text" /></td></tr><tr><td>市級專款(元)</td><td><input id="CityAmount" class="form-control" onkeyup="value=value.replace(/[^/d.]/g,'')" name="CityAmount" type="text" /></td></tr><tr><td>區(qū)級資金(元)</td><td><input id="DisAmount" class="form-control" onkeyup="value=value.replace(/[^/d.]/g,'')" name="DisAmount" type="text" /></td></tr><tr><td>街鎮(zhèn)配套(元)</td><td><input id="StreetAmount" class="form-control" onkeyup="value=value.replace(/[^/d.]/g,'')" name="StreetAmount" type="text" "/></td></tr><tr><td>其他(元)</td><td><input id="OtherAmount" class="form-control" onkeyup="value=value.replace(/[^/d.]/g,'')" name="OtherAmount" type="text" /></td></tr></table> </div></body></html>
以上這篇layer父頁獲取彈出層輸入框里面的值方法就是小編分享給大家的全部內(nèi)容了,希望能給大家一個參考,也希望大家多多支持武林網(wǎng)。
新聞熱點
疑難解答