534 lines
26 KiB
Plaintext
534 lines
26 KiB
Plaintext
|
|
<%@ page contentType="text/html;charset=UTF-8" %>
|
|||
|
|
<%@ include file="/webpage/include/taglib.jsp" %>
|
|||
|
|
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
|
|||
|
|
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
|
|||
|
|
<html>
|
|||
|
|
<head>
|
|||
|
|
<title>问卷页面</title>
|
|||
|
|
<meta name="decorator" content="default"/>
|
|||
|
|
<script type="text/javascript" src="${ctxStatic}/jquery/jquery-1.8.3.min.js"></script>
|
|||
|
|
<script language="javascript" type="text/javascript" src="${ctxStatic}/call/qnviccub.js"></script>
|
|||
|
|
<script language="javascript" type="text/javascript" src="${ctxStatic}/call/qnvfunc.js"></script>
|
|||
|
|
<script language="javascript" type="text/javascript" src="${ctxStatic}/call/json2.js"></script>
|
|||
|
|
<script language="javascript" type="text/javascript" src="${ctxStatic}/call/deviceapi.js"></script>
|
|||
|
|
<script language="javascript" type="text/javascript" src="${ctxStatic}/call/phone.js"></script>
|
|||
|
|
<style type="text/css">
|
|||
|
|
.bg{
|
|||
|
|
box-shadow:0px 0px 4px #fd5252 inset;
|
|||
|
|
}
|
|||
|
|
.tijiaole{
|
|||
|
|
background-color:#d7f5c7 !important;
|
|||
|
|
}
|
|||
|
|
* {
|
|||
|
|
padding: 0;
|
|||
|
|
margin: 0;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#top {
|
|||
|
|
width: 100%;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.one {
|
|||
|
|
height: 700px;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.three {
|
|||
|
|
width: 19%;
|
|||
|
|
height: 900px;
|
|||
|
|
}
|
|||
|
|
</style>
|
|||
|
|
<script language="JavaScript">
|
|||
|
|
// 电话调用方法
|
|||
|
|
function doCall(phone){
|
|||
|
|
if(phone==null||phone==''){
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
//参数传个电话号 phone
|
|||
|
|
TV_StartDial(0,phone);
|
|||
|
|
openDialogView('电话随访', '${ctx}/assessment/execution/call?id=${spotCheckerOne.id}','600px', '300px')
|
|||
|
|
}
|
|||
|
|
function importUser(){
|
|||
|
|
top.layer.open({
|
|||
|
|
type : 1,
|
|||
|
|
area : ['400px', '400px'],
|
|||
|
|
title : "导入数据",
|
|||
|
|
content : $("#importBox").html(),
|
|||
|
|
btn : ['关闭' ],
|
|||
|
|
/* btn1 : function(index, layero) {
|
|||
|
|
|
|||
|
|
top.layer.close(index);
|
|||
|
|
location.reload();
|
|||
|
|
}, */
|
|||
|
|
|
|||
|
|
btn1 : function(index) {
|
|||
|
|
top.layer.close(index);
|
|||
|
|
location.reload();
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
function trClick(spotCheckerId,subtaskId){
|
|||
|
|
location.replace("${ctx}/assessment/task/questionnaireHome?subtaskId="+subtaskId+"&userId="+spotCheckerId+"&pageNo=${page.pageNo}&pageSize=${page.pageSize}");
|
|||
|
|
//$("#"+spotCheckerId+"").addClass("bg");
|
|||
|
|
this.addClass("bg");
|
|||
|
|
}
|
|||
|
|
function searchByWJ(obj){
|
|||
|
|
// document.getElementById('officeContent').contentWindow.location.reload(true);
|
|||
|
|
var val=obj.options[obj.options.selectedIndex].value;
|
|||
|
|
var identityNumber=obj.options[obj.options.selectedIndex].id;
|
|||
|
|
location.replace("${ctx}/assessment/task/questionnaireHome?subtaskId=${subtask.id}&userId="+val+"&pageNo=${page.pageNo}&pageSize=${page.pageSize}");
|
|||
|
|
$("#"+identityNumber).addClass("bg");
|
|||
|
|
//定位
|
|||
|
|
var $objTr = $("#"+identityNumber); //找到要定位的地方 tr
|
|||
|
|
var objTr = $objTr[0]; //转化为dom对象
|
|||
|
|
$("#dataDiv").animate({scrollTop:objTr.offsetTop},"slow"); //定位tr
|
|||
|
|
//定位
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
</script>
|
|||
|
|
<script type="text/javascript">
|
|||
|
|
function initLayDate() {
|
|||
|
|
laydate.render({
|
|||
|
|
elem: '#startTime',
|
|||
|
|
type: 'date',
|
|||
|
|
format: 'yyyy-MM-dd',
|
|||
|
|
value: new Date(),
|
|||
|
|
btns: ['now', 'confirm']
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
$(document).ready(function () {
|
|||
|
|
var f=document.getElementById("officeContent");
|
|||
|
|
f.onload = function() {
|
|||
|
|
var value="${value}";
|
|||
|
|
f.contentWindow.postMessage(value, "${surveyServer}");// "http://192.168.18.130:8081"
|
|||
|
|
}
|
|||
|
|
initLayDate();
|
|||
|
|
var lost ='${spotCheckerOne.lost}' ;
|
|||
|
|
if(lost==null||lost==''||lost=='0'){
|
|||
|
|
//$("input:radio[value=2]").attr('checked','true');
|
|||
|
|
}else{
|
|||
|
|
$("input:radio[value='${spotCheckerOne.lost}']").attr('checked','true');
|
|||
|
|
}
|
|||
|
|
var id= "${spotCheckerOne.identityNumber}";
|
|||
|
|
$("#"+id).addClass("bg");
|
|||
|
|
//定位
|
|||
|
|
var $objTr = $("#"+id); //找到要定位的地方 tr
|
|||
|
|
var objTr = $objTr[0]; //转化为dom对象
|
|||
|
|
$("#dataDiv").animate({scrollTop:objTr.offsetTop},"slow"); //定位tr
|
|||
|
|
//定位
|
|||
|
|
var selectedVal ="${userId}";
|
|||
|
|
$("#wenjuanId option[value='"+selectedVal+"']").attr("selected","selected");
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
function ajaxRefresh(id,lost,subtaskId){
|
|||
|
|
if(id==null||id==''){
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
$.ajax({
|
|||
|
|
async: false,
|
|||
|
|
url: "${ctx}/assessment/task/updateStatusByUserId",
|
|||
|
|
data:{"id":id,"lost":lost},
|
|||
|
|
dataType: "json",
|
|||
|
|
success: function (data) {
|
|||
|
|
if(data.success){
|
|||
|
|
top.layer.alert(data.msg);
|
|||
|
|
location.replace("${ctx}/assessment/task/questionnaireHome?subtaskId="+subtaskId+"&userId="+id+"&pageNo=${page.pageNo}&pageSize=${page.pageSize}");
|
|||
|
|
}else{
|
|||
|
|
top.layer.alert(data.msg);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
//发布任务!
|
|||
|
|
function releaseTask(subtaskId,questionId){
|
|||
|
|
if(null==questionId){
|
|||
|
|
return top.layer.alert("数据不全!");
|
|||
|
|
}
|
|||
|
|
// console.log(questionId);
|
|||
|
|
if(questionId!='402892fc6c406f66016c4214edef0519'&&questionId!='402892fc6c406f66016c415116a102a7'){
|
|||
|
|
return top.layer.alert("该问卷暂无此操作!");
|
|||
|
|
}
|
|||
|
|
openQuestionnaireFileDialog("${ctx}/assessment/questionnaireFile/chooseTime?subtaskId="+subtaskId+"&questionId="+questionId,"选择截止时间",'500','500');
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 对话框
|
|||
|
|
* @param url 地址
|
|||
|
|
* @param title 标题
|
|||
|
|
* @param width 宽
|
|||
|
|
* @param height 高
|
|||
|
|
*/
|
|||
|
|
function openQuestionnaireFileDialog(url, title, width, height) {
|
|||
|
|
top.layer.open({
|
|||
|
|
type: 2,
|
|||
|
|
area: [width + 'px', height + 'px'],
|
|||
|
|
title: title,
|
|||
|
|
maxmin: true,
|
|||
|
|
content: url,
|
|||
|
|
btn: ['确定', '关闭'],
|
|||
|
|
yes: function (index, layero) {
|
|||
|
|
var body = top.layer.getChildFrame('body', index);
|
|||
|
|
// 得到iframe页的窗口对象,执行iframe页的方法:iframeWin.method();
|
|||
|
|
var iframeWin = layero.find('iframe')[0];
|
|||
|
|
var inputForm = body.find('#inputForm');
|
|||
|
|
// 获取当前active的tab的iframe
|
|||
|
|
var top_iframe = top.getActiveTab().attr("name");
|
|||
|
|
// 表单提交成功后,从服务器返回的url在当前tab中展示
|
|||
|
|
inputForm.attr("target", top_iframe);
|
|||
|
|
if (iframeWin.contentWindow.doSubmit()) {
|
|||
|
|
setTimeout(function () {
|
|||
|
|
top.layer.close(index);
|
|||
|
|
location.reload()
|
|||
|
|
}, 1000);
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
cancel: function (index) {
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
function fileDown(url,questionId){
|
|||
|
|
if(questionId!='402892fc6c406f66016c4214edef0519'&&questionId!='402892fc6c406f66016c415116a102a7'){
|
|||
|
|
return top.layer.alert("该问卷暂无此操作!");
|
|||
|
|
}
|
|||
|
|
window.location =url;
|
|||
|
|
}
|
|||
|
|
function viewFileByUser(url,questionId){
|
|||
|
|
if(questionId!='402892fc6c406f66016c4214edef0519'&&questionId!='402892fc6c406f66016c415116a102a7'){
|
|||
|
|
return top.layer.alert("该问卷暂无此操作!");
|
|||
|
|
}
|
|||
|
|
top.layer.open({
|
|||
|
|
type: 2,
|
|||
|
|
area: ['800px', '800px'],
|
|||
|
|
title: "文件预览",
|
|||
|
|
maxmin: true,
|
|||
|
|
content: url,
|
|||
|
|
btn: ['关闭'],
|
|||
|
|
cancel: function (index) {
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
function viewFileByUser2(url){
|
|||
|
|
var wind =window.open(url);
|
|||
|
|
wind.print();
|
|||
|
|
}
|
|||
|
|
</script>
|
|||
|
|
</head>
|
|||
|
|
|
|||
|
|
<body style="font-size: large">
|
|||
|
|
<div style="width: 100%;margin: auto auto">
|
|||
|
|
<form:form id="searchForm" modelAttribute="spotCheckerOne" action="${ctx}/assessment/task/questionnaireHome?subtaskId=${subtask.id}&userId=" method="post" class="form-inline">
|
|||
|
|
<input id="pageNo" name="pageNo" type="hidden" vaspotCheckerlue="${page.pageNo}"/>
|
|||
|
|
<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
|
|||
|
|
</form:form>
|
|||
|
|
<div id="top" style="width:75%">
|
|||
|
|
|
|||
|
|
<table class="table table-striped table-bordered table-hover table-condensed dataTables-example dataTable">
|
|||
|
|
<tr>
|
|||
|
|
<td align="left">问卷名称:</td>
|
|||
|
|
<td><input type="text" name="" value="${surveyDirectory.surveyName}" readonly class="layui-input"/></td>
|
|||
|
|
|
|||
|
|
|
|||
|
|
<td align="right">该问卷文件上传任务:</td>
|
|||
|
|
<td align="center" valign="middle">
|
|||
|
|
<button class="layui-btn" onclick="releaseTask('${subtask.id}','${spotCheckerOne.questionId}')">任务发布</button>
|
|||
|
|
</td>
|
|||
|
|
|
|||
|
|
|
|||
|
|
<td align="right">考核人:</td>
|
|||
|
|
<td>${examiner.name}</td>
|
|||
|
|
</tr>
|
|||
|
|
</table>
|
|||
|
|
</div>
|
|||
|
|
<div class="one">
|
|||
|
|
<div id="dataDiv" style="width: 25%;float: left;height:127%;overflow-y: auto;overflow-x: auto;">
|
|||
|
|
<!-- 表格 -->
|
|||
|
|
<table id="contentTable" style="height:100%;"
|
|||
|
|
class="table table-striped table-bordered table-hover table-condensed dataTables-example dataTable" >
|
|||
|
|
<thead>
|
|||
|
|
<tr>
|
|||
|
|
<td class="sort-column issuer" colspan="5" align="center">抽选人列表</td>
|
|||
|
|
</tr>
|
|||
|
|
<tr>
|
|||
|
|
<th class="sort-column issuer">基本信息</th>
|
|||
|
|
<th class="sort-column publishState">本人电话</th>
|
|||
|
|
<th class="sort-column publishState">人群</th>
|
|||
|
|
<th class="sort-column publishState">是否失访</th>
|
|||
|
|
<th class="sort-column publishState">是否提交</th>
|
|||
|
|
</tr>
|
|||
|
|
</thead>
|
|||
|
|
<tbody>
|
|||
|
|
<c:forEach items="${spotCheckers}" var="spotChecker" varStatus="status" >
|
|||
|
|
<tr onclick="trClick('${spotChecker.id}','${subtask.id}')" id="${spotChecker.identityNumber}" <c:if test="${spotChecker.status eq '1'}">class="tijiaole"</c:if>>
|
|||
|
|
|
|||
|
|
<td>${spotChecker.name} / ${spotChecker.gender}</td>
|
|||
|
|
<td>${spotChecker.phone}</td>
|
|||
|
|
<td>${spotChecker.type}</td>
|
|||
|
|
<c:choose>
|
|||
|
|
<c:when test="${empty spotChecker.lost}">
|
|||
|
|
<td></td>
|
|||
|
|
</c:when>
|
|||
|
|
<c:otherwise>
|
|||
|
|
<c:if test="${spotChecker.lost eq '1'}">
|
|||
|
|
<td>失访</td>
|
|||
|
|
</c:if>
|
|||
|
|
<c:if test="${spotChecker.lost eq '2'}">
|
|||
|
|
<td>未失访</td>
|
|||
|
|
</c:if>
|
|||
|
|
<c:if test="${spotChecker.lost eq '0'}">
|
|||
|
|
<td></td>
|
|||
|
|
</c:if>
|
|||
|
|
</c:otherwise>
|
|||
|
|
</c:choose>
|
|||
|
|
<td >${spotChecker.status eq '1'?'已提交':'未提交'}</td>
|
|||
|
|
|
|||
|
|
</tr>
|
|||
|
|
</c:forEach>
|
|||
|
|
<%--<tr>
|
|||
|
|
<td colspan="5" align="center" valign="middle">
|
|||
|
|
<button class="layui-btn" onclick="importUser()">导入用户</button>
|
|||
|
|
</td>
|
|||
|
|
</tr>--%>
|
|||
|
|
</tbody>
|
|||
|
|
</table>
|
|||
|
|
<div class="fixed-table-pagination">${page}</div>
|
|||
|
|
|
|||
|
|
</div>
|
|||
|
|
<div style="width:50%;float: left ;height:120%;">
|
|||
|
|
<table class="table table-bordered table-condensed dataTables-example dataTable no-footer">
|
|||
|
|
<tbody>
|
|||
|
|
<tr>
|
|||
|
|
|
|||
|
|
<td class="width-10 active"><label class="pull-right">姓名</label></td>
|
|||
|
|
<td class="width-23">
|
|||
|
|
${spotCheckerOne.name}
|
|||
|
|
</td>
|
|||
|
|
<td class="width-10 active"><label class="pull-right">性别</label></td>
|
|||
|
|
<td class="width-23">
|
|||
|
|
<%-- ${spotCheckerOne.gender eq '1'?'男':'女'}--%>
|
|||
|
|
${spotCheckerOne.gender}
|
|||
|
|
</td>
|
|||
|
|
<td class="width-10 active"><label class="pull-right">身份证号</label></td>
|
|||
|
|
<td class="width-23">
|
|||
|
|
${spotCheckerOne.identityNumber}
|
|||
|
|
</td>
|
|||
|
|
</tr>
|
|||
|
|
<tr>
|
|||
|
|
<td class="width-10 active"><label class="pull-right">居住地址</label></td>
|
|||
|
|
<td class="width-23">
|
|||
|
|
${spotCheckerOne.nirthplace}
|
|||
|
|
</td>
|
|||
|
|
<td class="width-10 active"><label class="pull-right">本人电话</label></td>
|
|||
|
|
<td class="width-23">
|
|||
|
|
${spotCheckerOne.phone}
|
|||
|
|
<a href="#" onclick="doCall('${spotCheckerOne.phone}')">
|
|||
|
|
<img alt="电话" width="30px" height="30px" src="${ctxStatic}/images/zhsf/huchu.png">
|
|||
|
|
</a>
|
|||
|
|
<input type="button" value="挂机" name="B8" onClick="TV_HangUpCtrl(0)" class="layui-btn layui-btn-sm layui-btn-danger">
|
|||
|
|
</td>
|
|||
|
|
<td class="width-10 active"><label class="pull-right">联系人电话</label></td>
|
|||
|
|
<td class="width-23">
|
|||
|
|
${spotCheckerOne.sparePhone}
|
|||
|
|
<a href="#" onclick="doCall('${spotCheckerOne.sparePhone}')">
|
|||
|
|
<img alt="电话" width="30px" height="30px" src="${ctxStatic}/images/zhsf/huchu.png">
|
|||
|
|
</a>
|
|||
|
|
<input type="button" value="挂机" name="B8" onClick="TV_HangUpCtrl(0)" class="layui-btn layui-btn-sm layui-btn-danger">
|
|||
|
|
</td>
|
|||
|
|
|
|||
|
|
</tr>
|
|||
|
|
<tr>
|
|||
|
|
<td class="width-10 active"><label class="pull-right">既往史疾病</label></td>
|
|||
|
|
<td class="width-23">
|
|||
|
|
${spotCheckerOne.historyDisease}
|
|||
|
|
</td>
|
|||
|
|
<td class="width-10 active"><label class="pull-right">是否失访</label></td>
|
|||
|
|
<td class="width-23">
|
|||
|
|
<input type="radio" onclick="ajaxRefresh('${spotCheckerOne.id}','1','${subtask.id}')" value="1" name="options" >是</input>
|
|||
|
|
<input type="radio" onclick="ajaxRefresh('${spotCheckerOne.id}','2','${subtask.id}')" value="2" name="options">否</input>
|
|||
|
|
</td>
|
|||
|
|
<td class="width-15 active"><label class="pull-right">选择问卷:</label></td>
|
|||
|
|
<td class="width-35" >
|
|||
|
|
<select id="wenjuanId" onchange="searchByWJ(this)" class="form-control required">
|
|||
|
|
<c:forEach items="${spotCheckerWJList}" var="spotCheckerWJ">
|
|||
|
|
<option id="${spotCheckerWJ.identityNumber}" value="${spotCheckerWJ.id}">${spotCheckerWJ.survey.surveyName}</option>
|
|||
|
|
</c:forEach>
|
|||
|
|
</select></td>
|
|||
|
|
</tr>
|
|||
|
|
<tr>
|
|||
|
|
<%-- <td class="width-10 active"><label class="pull-right">文件查看</label></td>
|
|||
|
|
<td class="width-33" >
|
|||
|
|
<button class="layui-btn" onclick="viewFileByUser('${ctx}/assessment/questionnaireFile/viewFileByUser?spotId=${spotCheckerOne.id}&subtaskId=${spotCheckerOne.subtaskId}','${spotCheckerOne.questionId}')" style="margin-left: 20%">文件预览</button>
|
|||
|
|
</td>--%>
|
|||
|
|
|
|||
|
|
<td class="width-10 active"><label class="pull-right">问卷打印</label></td>
|
|||
|
|
<td class="width-33" >
|
|||
|
|
<button class="layui-btn" onclick="viewFileByUser2('${surveyUrl}')" style="margin-left: 20%">文件预览</button>
|
|||
|
|
</td>
|
|||
|
|
<td class="width-10 active"><label class="pull-right">文件下载</label></td>
|
|||
|
|
<td class="width-33" >
|
|||
|
|
<button class="layui-btn" onclick="fileDown('${ctx}/assessment/questionnaireFile/downloadFileSelf?spotId=${spotCheckerOne.id}&subtaskId=${spotCheckerOne.subtaskId}','${spotCheckerOne.questionId}')" style="margin-left: 20%">文件下载</button>
|
|||
|
|
</td>
|
|||
|
|
</tr>
|
|||
|
|
</tbody>
|
|||
|
|
</table>
|
|||
|
|
<%--问卷--%>
|
|||
|
|
<iframe style="border:1px solid #ddd;" id="officeContent" name="officeContent" src="${surveyUrl}" width="100%" height="82%" frameborder="0"></iframe>
|
|||
|
|
</div>
|
|||
|
|
<div style="width:25%;height:144%;float: left;margin-top: -160px;" class="three">
|
|||
|
|
<%-- http://20.1.1.77:9081/sdcsm --%>
|
|||
|
|
<a href="http://20.1.1.77:9081/sdcsm" style="width:100%;height:55px;line-height:55px;margin-top: 100px;font-size: larger;" class="layui-btn" target="_blank"><i class="layui-icon" style="font-size: 30px;"></i><i class="layui-icon" style="font-size: 30px;"></i> 山东省卫生机构机构管理信息系统</a>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
<%--用户导入--%>
|
|||
|
|
<div id="importBox" class="hide">
|
|||
|
|
<form id="importForm" action="${ctx}/assessment/task/import" method="post" enctype="multipart/form-data" style="padding-left:20px;text-align:center;" onsubmit="loading('正在导入,请稍等...');">
|
|||
|
|
<br />
|
|||
|
|
<table>
|
|||
|
|
<tr>
|
|||
|
|
<td class="width-15 active"><label class="pull-right">数据上传:</label></td>
|
|||
|
|
<td class="width-85">
|
|||
|
|
<style type="text/css">
|
|||
|
|
#ctlBtn {
|
|||
|
|
position: relative;
|
|||
|
|
display: inline-block;
|
|||
|
|
cursor: pointer;
|
|||
|
|
background: #00b7ee;
|
|||
|
|
padding: 10px 15px;
|
|||
|
|
color: #fff;
|
|||
|
|
text-align: center;
|
|||
|
|
border-radius: 3px;
|
|||
|
|
overflow: hidden;
|
|||
|
|
}
|
|||
|
|
#downLoadTP {
|
|||
|
|
position: relative;
|
|||
|
|
display: inline-block;
|
|||
|
|
cursor: pointer;
|
|||
|
|
background: #00b7ee;
|
|||
|
|
padding: 10px 15px;
|
|||
|
|
color: #fff;
|
|||
|
|
text-align: center;
|
|||
|
|
border-radius: 3px;
|
|||
|
|
overflow: hidden;
|
|||
|
|
}
|
|||
|
|
</style>
|
|||
|
|
<script type="text/javascript">
|
|||
|
|
var uploader = WebUploader.create({
|
|||
|
|
// swf文件路径
|
|||
|
|
swf: '/${ctxStatic}/webuploader-0.1.5/Uploader.swf',
|
|||
|
|
// 文件接收服务端。
|
|||
|
|
server: "${ctx}/assessment/task/import?subtaskId=${subtask.id}&directoryId=${surveyDirectory.id}",
|
|||
|
|
// 选择文件的按钮。可选。
|
|||
|
|
// 内部根据当前运行是创建,可能是input元素,也可能是flash.
|
|||
|
|
pick: '#pickerOnly',
|
|||
|
|
// 不压缩image, 默认如果是jpeg,文件上传前会压缩一把再上传!
|
|||
|
|
resize: false,
|
|||
|
|
fileNumLimit: 1, //文件上传队列文件数量
|
|||
|
|
fileSingleSizeLimit: 102457600, //单个文件上传大小限制100M以下
|
|||
|
|
//auto:true //不需要开始上传按钮,进入队列即开始上传
|
|||
|
|
/* accept: {
|
|||
|
|
title: 'intoTypes'
|
|||
|
|
} */
|
|||
|
|
accept: {
|
|||
|
|
title: 'xlsx',
|
|||
|
|
extensions: 'xlsx',
|
|||
|
|
mimeTypes: 'xlsx/*'
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
|
|||
|
|
$(function () {
|
|||
|
|
// 当有文件被添加进队列的时候
|
|||
|
|
uploader.on('fileQueued', function (file) {
|
|||
|
|
$("#thelist").append('<div id="' + file.id + '" class="item">' +
|
|||
|
|
'<div class="row" style="margin: 10px 0;font-size: 16px;">' +
|
|||
|
|
'<span class="info">' + file.name + '----' + WebUploader.Base.formatSize(file.size, 0, ['B', 'KB', 'MB']) + '</span>' +
|
|||
|
|
'<span class="col-md-2" style="text-align: center;">' +
|
|||
|
|
'<a style="cursor:pointer;" class="tooltip-error" data-rel="tooltip" title="删除" onclick="remove_file(this);">' +
|
|||
|
|
'<span class="red">' +
|
|||
|
|
'<i class="ace-icon fa fa-trash-o bigger-120" title="删除"></i>' +
|
|||
|
|
'</span>' +
|
|||
|
|
'</a>' +
|
|||
|
|
'</span>' +
|
|||
|
|
'</div>' +
|
|||
|
|
'<p class="state">等待上传...</p>' + '</div>');
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
//开始上传按钮
|
|||
|
|
var $btn = $("#ctlBtn"); //开始上传。
|
|||
|
|
$btn.on('click', function () {
|
|||
|
|
uploader.upload();
|
|||
|
|
});
|
|||
|
|
var $btnDownLoad=$("#downLoadTP");
|
|||
|
|
$btnDownLoad.on('click', function () {
|
|||
|
|
window.location.href='${ctx}/assessment/task/import/template';
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
// 文件上传过程中创建进度条实时显示。
|
|||
|
|
uploader.on('uploadProgress', function (file, percentage) {
|
|||
|
|
var $li = $('#' + file.id),
|
|||
|
|
$percent = $li.find('.progress .progress-bar');
|
|||
|
|
|
|||
|
|
// 避免重复创建
|
|||
|
|
if (!$percent.length) {
|
|||
|
|
$percent = $('<div class="progress progress-striped active">' +
|
|||
|
|
'<div class="progress-bar" role="progressbar" style="width: 0%">' +
|
|||
|
|
'</div>' +
|
|||
|
|
'</div>').appendTo($li).find('.progress-bar');
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
$li.find('p.state').text('上传中');
|
|||
|
|
|
|||
|
|
$percent.css('width', percentage * 100 + '%');
|
|||
|
|
});
|
|||
|
|
//文件上传成功,失败处理
|
|||
|
|
uploader.on('uploadSuccess', function (file,ret) {
|
|||
|
|
if (ret.success == "1") {
|
|||
|
|
$('#' + file.id).find('p.state').text('已上传');
|
|||
|
|
}else if(ret.success == "-1"){
|
|||
|
|
$('#' + file.id).find('p.state').text('表格格式不匹配');
|
|||
|
|
}else {
|
|||
|
|
// $('#' + file.id).find('p.state').text('上传文件超出限制(<100M)');
|
|||
|
|
$('#' + file.id).find('p.state').text('已上传');
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
uploader.on('uploadError', function (file) {
|
|||
|
|
$('#' + file.id).find('p.state').text('上传出错');
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
uploader.on('uploadComplete', function (file) {
|
|||
|
|
$('#' + file.id).find('.progress').fadeOut();
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
});
|
|||
|
|
//删除
|
|||
|
|
function remove_file(node) {
|
|||
|
|
var item = node.parentNode.parentNode.parentNode;
|
|||
|
|
uploader.removeFile(item.id, true);
|
|||
|
|
$(item).remove();
|
|||
|
|
}
|
|||
|
|
//删除file
|
|||
|
|
|
|||
|
|
</script>
|
|||
|
|
<div class="span4">
|
|||
|
|
<div id="uploader" class="wu-example">
|
|||
|
|
<!--用来存放文件信息-->
|
|||
|
|
<div id="thelist" class="uploader-list"></div>
|
|||
|
|
<div class="btns">
|
|||
|
|
<%--这个错不要动! 动了样式就乱套--%>
|
|||
|
|
<div id="downLoadTP" style="display:inline">下载模板</div>
|
|||
|
|
<div id="pickerOnly" style="display:inline">选择文件</div>
|
|||
|
|
<div id="ctlBtn">开始上传</div>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
导入文件不能超过5M,仅允许导入“xls”或“xlsx”格式文件!
|
|||
|
|
</td>
|
|||
|
|
</tr>
|
|||
|
|
</table>
|
|||
|
|
</form>
|
|||
|
|
</div>
|
|||
|
|
<%--用户导入 end--%>
|
|||
|
|
|
|||
|
|
</body>
|
|||
|
|
</html>
|