From b5d8897f551693503c7ae29854d5fd494e0084da Mon Sep 17 00:00:00 2001 From: cxdbz Date: Sat, 11 Jan 2020 21:46:28 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=87=8D=E6=96=B0=E5=B8=83?= =?UTF-8?q?=E5=B1=80=E8=A1=A8=E6=A0=BC=E5=BD=95=E5=85=A5=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/chengji/controller/Index.php | 6 +- app/chengji/view/index/biaoqian.html | 104 ++++++++++++--------------- app/kaoshi/controller/Kaohao.php | 2 +- 3 files changed, 50 insertions(+), 62 deletions(-) diff --git a/app/chengji/controller/Index.php b/app/chengji/controller/Index.php index 73285a91..dace2e8d 100644 --- a/app/chengji/controller/Index.php +++ b/app/chengji/controller/Index.php @@ -247,16 +247,14 @@ class Index extends BaseController ->select() ->toArray(); - $list['kaoshiSet'] = $ks->kaoshiInfo($list['data'][0]['id']); // 设置页面标题 $list['set'] = array( - 'webtitle'=>'表格录入成绩', + 'webtitle'=>'表格录入', 'butname'=>'下载', 'formpost'=>'POST', - 'url'=>'/chengji/index/saveall', - 'kaoshi'=> $list['data'][0]['id'], + 'url'=>'/kaoshi/kaohao/dwcaiji', ); diff --git a/app/chengji/view/index/biaoqian.html b/app/chengji/view/index/biaoqian.html index 094cd2a5..f174d44b 100644 --- a/app/chengji/view/index/biaoqian.html +++ b/app/chengji/view/index/biaoqian.html @@ -2,8 +2,8 @@ {block name="form"}
- 考试管理 - 考试列表 + 成绩采集 + 表格录入 @@ -20,11 +20,12 @@
-
+
- {volist name="$list.kaoshiSet.subject" id="vo"} - - {/volist} +
@@ -60,9 +56,7 @@
@@ -93,7 +87,7 @@
- +
@@ -119,7 +113,7 @@
- 3、已录成绩 + 3、查看已录成绩
@@ -167,23 +161,6 @@ } }); - // 下载 - form.on('submit(download)', function(data){ - kaoshi =$('#kaoshi').val(); - banji = $("input[name='subject']:selected").val(); - console.log(banji); - console.log(kaoshi); - return false - $.post("/kaoshi/kaohao/dwcaiji",{"url":url},function(result){ - if(result.val == 1) - { - $("#url").val(''); - } - layer.msg(result.msg); - }); - return false; //阻止表单跳转。如果需要表单跳转,去掉这段即可。 - }); - // 上传 form.on('submit(upload)', function(data){ url=$("#url").val(); @@ -219,10 +196,14 @@ var kaoshi = $("#kaoshi").val(); // 删除原来已有值 + $('#subject').children().remove(); $('#school').children().remove(); $('#ruxuenian').children().remove(); + $('#banji').children().remove(); + $('#subject').append(''); $('#school').append(new Option('请选择学校',''));//往下拉菜单里添加元素 $('#ruxuenian').append(new Option('请选择入学年',''));//往下拉菜单里添加元素 + $('#banji').append(''); $.ajax({ url:"/kaoshi/index/kaoshiinfo/"+kaoshi, @@ -235,9 +216,18 @@ $.each(data.nianji,function(index,item){ $('#ruxuenian').append(new Option(item.nianjiname,item.nianji));//往下拉菜单里添加元素 }) + $.each(data.subject,function(index,item){ + $('#subject').append(''); + }) form.render();//菜单渲染 把内容加载进去 - } + }, + error:function(data){ + form.render();//菜单渲染 把内容加载进去 + }, }) + + + @@ -260,6 +250,7 @@ // 删除原来已有值 $(bj).children().remove(); + $(bj).append(''); // 获取班级列表 $.ajax({ @@ -273,9 +264,8 @@ dataType:'json', success:function(result){ if(result.length > 0){ - $(bj).append(''); result.forEach(function(val,index){ - $(bj).append(''); + $(bj).append(''); }) } form.render('checkbox'); //刷新select选择框渲染 @@ -290,38 +280,38 @@ } form.on('checkbox()', function(data){ - var myelem = data.elem - ,ischecked = data.elem.checked - ,action = $(myelem).attr('action') - ,pid = $(myelem).attr('pid') - ,id = $(myelem).attr('id'); - switch(action){ - case 'children': - selectChildren(pid,ischecked); - break; - case 'parent': - selectParent(id,ischecked); - break; - }; - }); + var myelem = data.elem + ,ischecked = data.elem.checked + ,ceng = $(myelem).attr('ceng') + ,fid = $(myelem).attr('fid') + ,cid = $(myelem).attr('cid'); + switch(ceng){ + case 'children': + selectParent(cid,ischecked); + break; + case 'parent': + selectChildren(fid,ischecked); + break; + }; + }); - // 更改子选项 - function selectChildren(pid,checked) + // 更改父选项 + function selectParent(fid,checked) { if(checked==true) { - $('#'+pid).prop('checked',true); + $("input[fid="+fid+"]").prop('checked',true); form.render('checkbox'); } } - // 更改父选项 - function selectParent(id,checked) + // 更改子选项 + function selectChildren(cid,checked) { if(checked == true) { - $("input[pid='"+id+"']").prop('checked',true); + $("input[cid='"+cid+"']").prop('checked',true); }else{ - $("input[pid='"+id+"']").prop('checked',false); + $("input[cid='"+cid+"']").prop('checked',false); } form.render('checkbox'); diff --git a/app/kaoshi/controller/Kaohao.php b/app/kaoshi/controller/Kaohao.php index 78dfae48..7c918ac5 100644 --- a/app/kaoshi/controller/Kaohao.php +++ b/app/kaoshi/controller/Kaohao.php @@ -498,7 +498,7 @@ class Kaohao extends BaseController $validate = new \app\kaoshi\validate\Biaoqian; // 获取表单数据 - $list = request()->only(['banjiids','kaoshi','subject'],'post'); + $list = request()->only(['banjiids'=>array(),'kaoshi','subject'=>array()],'post'); $kaoshi = $list['kaoshi']; $banji = $list['banjiids'];