From 14a249e42d481adcf0c0af7f59e4b58fa350cd61 Mon Sep 17 00:00:00 2001 From: cuibaocheng Date: Mon, 21 Jun 2021 18:01:55 +0800 Subject: [PATCH] =?UTF-8?q?=E8=80=83=E5=9C=BA=E5=88=86=E9=85=8D=E8=AF=A6?= =?UTF-8?q?=E6=83=85=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../route/examination/distribution/show.html | 26 ++++++++++++------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/src/main/resources/static/route/examination/distribution/show.html b/src/main/resources/static/route/examination/distribution/show.html index 3a3b9eb..c550bd5 100644 --- a/src/main/resources/static/route/examination/distribution/show.html +++ b/src/main/resources/static/route/examination/distribution/show.html @@ -80,13 +80,13 @@
- +
- +
@@ -118,9 +118,9 @@
{{# for(var i = 0, item; item = station.fieldArray[i++];) { }} - {{# if(item.checked) { + {{# if(item.checked) { }} - } }} + {{# } }} {{# } }}
@@ -213,8 +213,9 @@ type:'get', dataType:'json', success: function (data) { - var institutionAddress = data.institutionAddress; + var institutionAddress = ""; for (var i = 0; i < data.length; i++) { + // 拼接考试地点的地址, 因为涉及到跨考点,因此此处可能是多个地址,需要判断拼接 $.ajax({ url: 'api/organization/list?organizationType=' + data[i].institutionId, async: false, @@ -222,22 +223,29 @@ dataType: 'json', success: function (orgData) { // 回显 , 选中 + var checkCount = 0; for (var a = 0; a < orgData.length; a++) { if(dataForm) { for (var j = 0; j < dataForm.distributionFieldList.length; j++) { if (orgData[a].organizationId == dataForm.distributionFieldList[j].fieldId) { orgData[a].checked = 'checked="checked"'; + checkCount++; + if(institutionAddress.indexOf(data[i].institutionAddress) == -1) { + institutionAddress = institutionAddress.length < 1 ? institutionAddress + data[i].institutionAddress : institutionAddress + "," + data[i].institutionAddress; + } } } } } - var stationData = {stationName: data[i].institutionName, fieldArray: orgData}; - stationArray.push(stationData); + if(checkCount > 0 ){ + var stationData = {stationName: data[i].institutionName, fieldArray: orgData}; + stationArray.push(stationData); + } } }); } - var inData = {address: institutionAddress , stationArray: stationArray} - laytpl(document.getElementById('distributionFieldsBoxTemplate').innerHTML).render(stationArray, function (html) { + var inData = {address: institutionAddress , stationArray: stationArray}; + laytpl(document.getElementById('distributionFieldsBoxTemplate').innerHTML).render(inData, function (html) { console.log(stationArray); document.getElementById('distributionFieldsBox').innerHTML = html; });