409 lines
21 KiB
HTML
409 lines
21 KiB
HTML
<div class="easyui-layout" style="width:100%;height:100%;">
|
||
<div id='southdiv' data-options="region:'south'" style="height:50px;text-align:center;padding:5px">
|
||
<a href="javascript:void(0)" iconCls="fa-check" class="easyui-linkbutton" onclick="wssubmitForm()" id="submitb">提交</a>
|
||
<a href="javascript:void(0)" iconCls="fa-close" class="easyui-linkbutton" onclick="closeForm()">取消</a>
|
||
</div>
|
||
<div data-options="region:'center'" style="height:100%;padding:15px 15px;">
|
||
<form id="wsff" method="post" name="wsff" enctype="multipart/form-data">
|
||
<table class="listTab">
|
||
<tr>
|
||
<td>任务名称</td>
|
||
<td>
|
||
<input id="checktask__checktaskname" class="easyui-textbox" name="checktaskname" style="width:480px" disabled>
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td>检查人</td>
|
||
<td>
|
||
<input id="checkname__name" class="easyui-textbox" name="checktabtitle" style="width:480px" disabled/>
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td>检查地点</td>
|
||
<td>
|
||
<input id="checkplace" class="easyui-textbox" name="checkplace" style="width:480px" disabled/>
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td>检查内容</td>
|
||
<td>
|
||
<input id="checkcontent" class="easyui-textbox" name="checkcontent" style="width:480px;height:100px" data-options="multiline:true" disabled>
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td>检查开始</td>
|
||
<td>
|
||
<input id="jctime" editable="false" name="jctime" class="easyui-datetimebox" style="width:480px"
|
||
data-options="currentText:'今天',closeText:'关闭',showSeconds:false" />
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td>检查结束</td>
|
||
<td>
|
||
<input id="jctime2" editable="false" name="jctime2" class="easyui-datetimebox" style="width:480px"
|
||
data-options="currentText:'今天',closeText:'关闭',showSeconds:false" />
|
||
</td>
|
||
</tr>
|
||
|
||
|
||
<tr>
|
||
<td>检查记录</td>
|
||
<td>
|
||
<input id="checkquestion" class="easyui-textbox" name="checkquestion" style="width:480px;height:100px" data-options="multiline:true" required=true>
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td>检查图片</td>
|
||
<td> <input type="file" id="file" name="" accept="image/*" style="margin-left:30px;" /></td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<td><input type="hidden" name="yhtp" id="yhtp" /></td>
|
||
<td>
|
||
<span id='ps' style="display:none">
|
||
<progress id="progressBar" value="0" max="100" style="width: 100px;"></progress>
|
||
<span id="percentage"></span><span id="time"></span>
|
||
</span>
|
||
</td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<td colspan="2"><ul id="addImage" class="imgul"></ul></td>
|
||
</tr>
|
||
|
||
|
||
<tr>
|
||
<td>整改期限</td>
|
||
<td>
|
||
<input id="zgtime" editable="false" name="zgtime" class="easyui-datetimebox" style="width:480px"
|
||
data-options="currentText:'今天',closeText:'关闭',showSeconds:false" required=true/>
|
||
</td>
|
||
</tr>
|
||
|
||
<!--<tr>
|
||
<td>整改时间</td>
|
||
<td>
|
||
<input id="zgtime" editable="false" name="zgtime" class="easyui-datetimebox" style="width:480px"
|
||
data-options="currentText:'今天',closeText:'关闭',showSeconds:false" required=true />
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td>整改人</td>
|
||
<td>
|
||
<input id="zguser" class="easyui-textbox" name="zguser" style="width:480px" required=true />
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td>整改要求</td>
|
||
<td>
|
||
<input id="zgyq" class="easyui-textbox" name="zgyq" style="width:480px;height:60px" data-options="multiline:true" required=true>
|
||
</td>
|
||
</tr></tr>-->
|
||
|
||
<tr>
|
||
<td>需要整改</td>
|
||
<td>
|
||
<input id="zgjg" class="easyui-textbox" name="zgjg" style="width:480px;height:60px" data-options="multiline:true" required=true>
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td>整改图片</td>
|
||
<td> <input type="file" id="file2" name="" accept="image/*" style="margin-left:30px;" /></td>
|
||
</tr>
|
||
<tr>
|
||
<td><input type="hidden" name="zgtp" id="zgtp" /></td>
|
||
<td>
|
||
<span id='ps2' style="display:none">
|
||
<progress id="progressBar2" value="0" max="100" style="width: 100px;"></progress>
|
||
<span id="percentage2"></span><span id="time2"></span>
|
||
</span>
|
||
</td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<td colspan="2"><ul id="addImage2" class="imgul"></ul></td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<td>工作状态</td>
|
||
<td>
|
||
|
||
<input type="radio" name="taskstate" value="2">已整改完成</input>
|
||
<input type="radio" name="taskstate" checked="true" value="1">正在整改中</input>
|
||
</td>
|
||
</tr>
|
||
|
||
|
||
</table>
|
||
<div id="chufa" style="margin-top:10px;margin-bottom:5px;">
|
||
<input class="easyui-textbox" id="participantname" style="width:480px;height:60px" editable="false"
|
||
data-options="label:'涉及人员:',multiline:true,prompt:'没有涉及人员可以不选'">
|
||
<input type="hidden" id="participant" name="participant" />
|
||
<a id="chooserys" class='easyui-linkbutton' onclick="choseusers()" style="width:auto">选择</a>
|
||
</div>
|
||
<div>
|
||
<input class="easyui-textbox" id="content" name="content" style="width:480px;height:60px"
|
||
data-options="label:'经验总结:',multiline:true">
|
||
</div>
|
||
</form>
|
||
</div>
|
||
</div>
|
||
<script>
|
||
|
||
var jobid = {{ id }}
|
||
function aaa(x) {
|
||
if (x == "participant") {
|
||
$('#participant').attr('value', top.$('#in').val());
|
||
$('#participantname').textbox('setValue', top.$('#in').attr('show'));
|
||
$('#participantnum').textbox('setValue', top.$('#in').attr('total'));
|
||
}
|
||
}
|
||
|
||
|
||
$(function () {
|
||
|
||
|
||
|
||
$.get('api/checkproject?a=jobdetail&id=' + jobid, function (res) {
|
||
var data = res.data
|
||
$('#checktask__checktaskname').textbox('setValue', data.checktask__checktaskname)
|
||
$('#checkname__name').textbox('setValue', data.checkname__name)
|
||
$('#checkcontent').textbox('setValue', data.checktask__checktype__checkcontent)
|
||
$('#checkplace').textbox('setValue', data.checktask__checkplace)
|
||
$('#checkquestion').textbox('setValue', data.checkquestion)
|
||
$('#zgjg').textbox('setValue', data.zgjg)
|
||
$('#content').textbox('setValue', data.content)
|
||
$('#jctime').datetimebox('setValue', data.jctime)
|
||
$('#jctime2').datetimebox('setValue', data.jctime2)
|
||
$('#zgtime').datetimebox('setValue', data.zgtime)
|
||
|
||
var yhtp = data.yhtp;
|
||
if(yhtp!=null){
|
||
for (var i = 0; i < yhtp.length; i++) {
|
||
$("#addImage").append('<li ><img title="点击放大" style="display:block;" onclick="bigger(this)" class = "yhtpimg" width="120" height="120" filepath="' + yhtp[i] + '" src="http://' + window.location.host + '/' + yhtp[i] + '"/></li>');
|
||
}}
|
||
if (yhtp == []) { $("#addImage").append('<b >无图片</b>') }
|
||
|
||
// if (data.taskstate == 1) {
|
||
// $("input[name='taskstate'][value=1]").attr("checked",true);
|
||
// }
|
||
//else
|
||
// $("input[name='taskstate'][value=2]").attr("checked",true);
|
||
});
|
||
})
|
||
|
||
//检查问题上传图片
|
||
document.getElementById('file').onchange = function () {
|
||
var fileObj = this.files[0];
|
||
var url = 'upfile'
|
||
var form = new FormData();
|
||
if (fileObj.size / 1024 > 500) { //大于500k,进行压缩上传
|
||
$("#file").after('<span id="tip" style="color:blue">图片大于500k,正在压缩...</span>');
|
||
photoCompress(fileObj, {}, function (base64Codes) {
|
||
//console.log("压缩后" + base.length / 1024 + " " + base);
|
||
var bl = convertBase64UrlToBlob(base64Codes);
|
||
form.append("upfile", bl, fileObj.name); // 文件对象
|
||
xhr = new XMLHttpRequest(); // XMLHttpRequest 对象
|
||
xhr.open("post", url, true); //post方式,url为服务器请求地址,true 该参数规定请求是否异步处理。
|
||
$("#tip").remove();
|
||
$('#ps').show();
|
||
xhr.onload = function (evt) { //服务断接收完文件返回的结果
|
||
var data = JSON.parse(evt.target.responseText);
|
||
if (data.code = 1) {
|
||
$('#ps').hide();
|
||
$("#addImage").append('<li ><img title="点击放大" style="display:block;" onclick="bigger(this)" class = "yhtpimg" width="120" height="120" filepath="' + data.filepath + '" src="http://' + window.location.host + '/' + data.filepath + '"/><button onclick="removep(this)" >删除</button></li>');
|
||
document.getElementById('file').value = '';
|
||
} else { alert("上传失败!"); }
|
||
}; //请求完成
|
||
xhr.onerror = function (evt) { alert("上传失败!"); $('#ps').hide(); };; //请求失败
|
||
|
||
xhr.upload.onprogress = progressFunction;//【上传进度调用方法实现】
|
||
xhr.upload.onloadstart = function () {//上传开始执行方法
|
||
ot = new Date().getTime(); //设置上传开始时间
|
||
oloaded = 0;//设置上传开始时,以上传的文件大小为0
|
||
};
|
||
|
||
xhr.send(form); //开始上传,发送form数据
|
||
});
|
||
} else { //小于等于500k 原图上传
|
||
form.append("upfile", fileObj); // 文件对象
|
||
xhr = new XMLHttpRequest(); // XMLHttpRequest 对象
|
||
xhr.open("post", url, true); //post方式,url为服务器请求地址,true 该参数规定请求是否异步处理。
|
||
xhr.onload = function (evt) { //服务断接收完文件返回的结果
|
||
var data = JSON.parse(evt.target.responseText);
|
||
if (data.code = 1) {
|
||
$('#ps').hide();
|
||
$("#addImage").append('<li ><img title="点击放大" style="display:block;" onclick="bigger(this)" class = "yhtpimg" width="110" height="110" filepath="' + data.filepath + '" src="http://' + window.location.host + '/' + data.filepath + '"/><button onclick="removep(this)" >删除</button></li>');
|
||
document.getElementById('file').value = '';
|
||
} else { alert("上传失败!"); }
|
||
}; //请求完成
|
||
xhr.onerror = function (evt) { alert("上传失败!"); $('#ps').hide(); };; //请求失败
|
||
xhr.upload.onprogress = progressFunction;//【上传进度调用方法实现】
|
||
xhr.upload.onloadstart = function () {//上传开始执行方法
|
||
ot = new Date().getTime(); //设置上传开始时间
|
||
oloaded = 0;//设置上传开始时,以上传的文件大小为0
|
||
};
|
||
|
||
xhr.send(form); //开始上传,发送form数据
|
||
}
|
||
function progressFunction(evt) {
|
||
var progressBar = document.getElementById("progressBar");
|
||
var percentageDiv = document.getElementById("percentage");
|
||
// event.total是需要传输的总字节,event.loaded是已经传输的字节。如果event.lengthComputable不为真,则event.total等于0
|
||
if (evt.lengthComputable) {//
|
||
progressBar.max = evt.total;
|
||
progressBar.value = evt.loaded;
|
||
percentageDiv.innerHTML = Math.round(evt.loaded / evt.total * 100) + "%";
|
||
}
|
||
var time = document.getElementById("time");
|
||
var nt = new Date().getTime();//获取当前时间
|
||
var pertime = (nt - ot) / 1000; //计算出上次调用该方法时到现在的时间差,单位为s
|
||
ot = new Date().getTime(); //重新赋值时间,用于下次计算
|
||
var perload = evt.loaded - oloaded; //计算该分段上传的文件大小,单位b
|
||
oloaded = evt.loaded;//重新赋值已上传文件大小,用以下次计算
|
||
//上传速度计算
|
||
var speed = perload / pertime;//单位b/s
|
||
var bspeed = speed;
|
||
var units = 'b/s';//单位名称
|
||
if (speed / 1024 > 1) {
|
||
speed = speed / 1024;
|
||
units = 'k/s';
|
||
}
|
||
if (speed / 1024 > 1) {
|
||
speed = speed / 1024;
|
||
units = 'M/s';
|
||
}
|
||
speed = speed.toFixed(1);
|
||
//剩余时间
|
||
var resttime = ((evt.total - evt.loaded) / bspeed).toFixed(1);
|
||
time.innerHTML = ',速度' + speed + units + ',剩余时间' + resttime + 's';
|
||
//if(bspeed==0) time.innerHTML = '上传已取消';
|
||
}
|
||
}
|
||
|
||
document.getElementById('file2').onchange = function () {
|
||
var fileObj = this.files[0];
|
||
var url = 'upfile'
|
||
var form = new FormData();
|
||
if (fileObj.size / 1024 > 500) { //大于500k,进行压缩上传
|
||
$("#file2").after('<span id="tip" style="color:blue">图片大于500k,正在压缩...</span>');
|
||
photoCompress(fileObj, {}, function (base64Codes) {//quality: 0.2
|
||
//console.log("压缩后" + base.length / 1024 + " " + base);
|
||
var bl = convertBase64UrlToBlob(base64Codes);
|
||
form.append("upfile", bl, fileObj.name); // 文件对象
|
||
xhr = new XMLHttpRequest(); // XMLHttpRequest 对象
|
||
xhr.open("post", url, true); //post方式,url为服务器请求地址,true 该参数规定请求是否异步处理。
|
||
$("#tip").remove();
|
||
$('#ps2').show();
|
||
xhr.onload = function (evt) { //服务断接收完文件返回的结果
|
||
var data = JSON.parse(evt.target.responseText);
|
||
if (data.code = 1) {
|
||
$('#ps2').hide();
|
||
$("#addImage2").append('<li ><img title="点击放大" style="display:block;" onclick="bigger(this)" class = "zghtpimg" width="120" height="120" filepath="' + data.filepath + '" src="http://' + window.location.host + '/' + data.filepath + '"/><button onclick="removep(this)" >删除</button></li>');
|
||
document.getElementById('file2').value = '';
|
||
} else { alert("上传失败!"); }
|
||
}; //请求完成
|
||
xhr.onerror = function (evt) { alert("上传失败!"); $('#ps2').hide(); };; //请求失败
|
||
|
||
xhr.upload.onprogress = progressFunction;//【上传进度调用方法实现】
|
||
xhr.upload.onloadstart = function () {//上传开始执行方法
|
||
ot = new Date().getTime(); //设置上传开始时间
|
||
oloaded = 0;//设置上传开始时,以上传的文件大小为0
|
||
};
|
||
|
||
xhr.send(form); //开始上传,发送form数据
|
||
});
|
||
} else { //小于等于1M 原图上传
|
||
form.append("upfile", fileObj); // 文件对象
|
||
xhr = new XMLHttpRequest(); // XMLHttpRequest 对象
|
||
xhr.open("post", url, true); //post方式,url为服务器请求地址,true 该参数规定请求是否异步处理。
|
||
xhr.onload = function (evt) { //服务断接收完文件返回的结果
|
||
var data = JSON.parse(evt.target.responseText);
|
||
if (data.code = 1) {
|
||
$('#ps2').hide();
|
||
$("#addImage2").append('<li ><img title="点击放大" style="display:block;" onclick="bigger(this)" class = "zghtpimg" width="120" height="120" filepath="' + data.filepath + '" src="http://' + window.location.host + '/' + data.filepath + '"/><button onclick="removep(this)" >删除</button></li>');
|
||
document.getElementById('file2').value = '';
|
||
} else { alert("上传失败!"); }
|
||
}; //请求完成
|
||
xhr.onerror = function (evt) { alert("上传失败!"); $('#ps2').hide(); };; //请求失败
|
||
xhr.send(form); //开始上传,发送form数据
|
||
}
|
||
//上传进度实现方法,上传过程中会频繁调用该方法
|
||
function progressFunction(evt) {
|
||
var progressBar = document.getElementById("progressBar2");
|
||
var percentageDiv = document.getElementById("percentage2");
|
||
// event.total是需要传输的总字节,event.loaded是已经传输的字节。如果event.lengthComputable不为真,则event.total等于0
|
||
if (evt.lengthComputable) {//
|
||
progressBar.max = evt.total;
|
||
progressBar.value = evt.loaded;
|
||
percentageDiv.innerHTML = Math.round(evt.loaded / evt.total * 100) + "%";
|
||
}
|
||
var time = document.getElementById("time2");
|
||
var nt = new Date().getTime();//获取当前时间
|
||
var pertime = (nt - ot) / 1000; //计算出上次调用该方法时到现在的时间差,单位为s
|
||
ot = new Date().getTime(); //重新赋值时间,用于下次计算
|
||
var perload = evt.loaded - oloaded; //计算该分段上传的文件大小,单位b
|
||
oloaded = evt.loaded;//重新赋值已上传文件大小,用以下次计算
|
||
//上传速度计算
|
||
var speed = perload / pertime;//单位b/s
|
||
var bspeed = speed;
|
||
var units = 'b/s';//单位名称
|
||
if (speed / 1024 > 1) {
|
||
speed = speed / 1024;
|
||
units = 'k/s';
|
||
}
|
||
if (speed / 1024 > 1) {
|
||
speed = speed / 1024;
|
||
units = 'M/s';
|
||
}
|
||
speed = speed.toFixed(1);
|
||
//剩余时间
|
||
var resttime = ((evt.total - evt.loaded) / bspeed).toFixed(1);
|
||
time.innerHTML = ',速度' + speed + units + ',剩余时间' + resttime + 's';
|
||
if (bspeed == 0) time.innerHTML = '上传已取消';
|
||
}
|
||
|
||
}
|
||
|
||
|
||
|
||
function wssubmitForm() {
|
||
|
||
var wsdata = $('#wsff').serializeJSON();
|
||
var yhtp = new Array();
|
||
$(".yhtpimg").each(function () {
|
||
yhtp.push($(this).attr("filepath"));
|
||
});
|
||
wsdata['yhtp1'] = yhtp
|
||
var zghtp = new Array();
|
||
$(".zghtpimg").each(function () {
|
||
zghtp.push($(this).attr("filepath"));
|
||
});
|
||
wsdata['zghtp']=zghtp
|
||
$.ajax({
|
||
type: "POST",
|
||
url: 'api/checkproject?a=addjob&jobid='+jobid,
|
||
data: JSON.stringify(wsdata),
|
||
datatype: "json",
|
||
processData: false,
|
||
contentType: "application/json;charset=utf-8",
|
||
beforeSend: function () {
|
||
var bo = $('#wsff').form('validate')
|
||
if (bo == false) {
|
||
return bo
|
||
} else {
|
||
$('#submitb').linkbutton('disable');
|
||
}
|
||
},
|
||
success: function (data) {
|
||
if (data.code == 1) {
|
||
$('#jobtab').datagrid('reload');
|
||
$("#dd").dialog("close");
|
||
} else { $.messager.alert('提示', data.msg); }
|
||
$('#submitb').linkbutton('enable');
|
||
},
|
||
});
|
||
}
|
||
|
||
|
||
</script> |