From 23e29f1e784013a4df37800c66d2f6ffa9d96f3d Mon Sep 17 00:00:00 2001 From: wangjr Date: Mon, 27 Dec 2021 17:25:41 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=B2=BE=E9=80=89=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E8=B6=85=E8=BF=879=E4=B8=AA=E6=95=B0=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- templates/org/select_pro.tmpl | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/templates/org/select_pro.tmpl b/templates/org/select_pro.tmpl index 0bf0b08a6..e29db7d53 100644 --- a/templates/org/select_pro.tmpl +++ b/templates/org/select_pro.tmpl @@ -20,7 +20,7 @@ } .content_list{ - max-height: 200px; + max-height: 130px; overflow: auto; } .Relist{ @@ -152,11 +152,12 @@ var num=0; function showcreate(obj){ + document.getElementById("search_selectPro").value='' $('.ui.modal') .modal({ centered: false, onShow:function(){ - $("#org_list").empty() + $("#org_list").empty() getPro(1) }, @@ -179,7 +180,7 @@ pro_html = getHTML(data) $("#org_list").append(pro_html) console.log('原始',data) - checkedNum() + checkedNum(0) } }); } @@ -188,11 +189,11 @@ for (let i=0;i ` + pro_html += `
` pro_html += '' } else{ - pro_html += `
` + pro_html += `
` pro_html += '' } } @@ -205,6 +206,10 @@ saveData.push(parseInt(this.dataset.repoid)); }) + if(saveData.length>9){ + alert("最多可选9个,保存失败") + return + } // saveData = getSelecteDataID(); // console.log("数据:",saveData) $.ajax({ @@ -227,7 +232,7 @@ var selectedData=[]; $('input[name="select_pro_name"]:checked').each(function(){ // console.log(this) - console.log('值',this.dataset.selected) + // console.log('值',this.dataset.selected) selectedData.push({"RepoID":parseInt(this.dataset.repoid),"RepoName":this.dataset.reponame,"Selected":JSON.parse(this.dataset.selected)}); }) @@ -272,14 +277,22 @@ } } - function checkedNum(){ + function checkedNum(id){ + num=0; var inputs = document.getElementsByName("select_pro_name") for (var i=0;i9){ + document.getElementById(id).checked=false + alert("选择超过9个,请重新选择!") + return + } } + } + var show_num = 9-num; document.getElementById("recommend").innerHTML="还能推荐"+show_num+"个"