safesite/safesite/templates/suggestupdate.html

341 lines
17 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<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="jysubmitForm()"
id="submitb">提交</a>
<a href="javascript:void(0)" iconCls="fa-close" class="easyui-linkbutton" onclick="submitreject()" style="display:none"
id="reject">驳回</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;">
<div id="jyxqdiv" class='labeldiv'>建议详情</div>
<div style="margin-bottom:5px">
<input id="jylb" class="easyui-textbox" style="width:480px" data-options="label:'建议类型'" required=true>
</div>
<div style="margin-bottom:5px">
<input type="hidden" name="jyimg" id="jyimg" />
<label>现场图片</label>
<ul id="addImage" class="imgul"></ul>
<HR width="480px" color='blue' SIZE=1 align='left'>
</div>
<div style="margin-top:10px;margin-bottom:5px">
<input id="dqxz" class="easyui-textbox" style="width:480px;height:100px"
data-options="label:'当前现状',multiline:true" required=true />
</div>
<div style="margin-bottom:5px">
<input id="jynr" class="easyui-textbox" style="width:480px;height:100px"
data-options="label:'建议内容',multiline:true" required=true />
</div>
<div style="margin-bottom:5px">
<input id="qwxg" class="easyui-textbox" style="width:480px;height:100px"
data-options="label:'期望效果',multiline:true" required=true />
</div>
<div id="pgdiv" class='labeldiv'>评估详情</div>
<div id="cldiv" style="margin-bottom:5px;">
<label style="font-weight:bold;color:red;font-size: 18px">安排处理</label>
<input type="checkbox" onclick="tapcl()" id="inputcl"></input>
<label style="font-weight:bold;color:red;font-size: 18px">转交他人</label>
<input type="checkbox" onclick="tapzj()" id="inputzj"></input>
</div>
<form id="jyff" method="post" name="jyff" enctype="multipart/form-data">
<div style="margin-bottom:5px" id="fkdiv">
<input id="jyfk" name='jyfk' class="easyui-textbox" style="width:480px;" data-options="label:'反馈意见',"
/>
</div>
<div id="apcldiv" style="display: none">
<div style="margin-bottom:5px">
<input id="clrname" class="easyui-textbox" style="width:480px;" data-options="label:'处理人',"
editable=false/>
<input type="hidden" id='clr' name='clr'/>
<a id="choseuser1" class='easyui-linkbutton' onclick="choseuser1()" style="width:auto">选择</a>
</div>
<div style="margin-bottom:5px">
<input id="clcs" name='clcs' class="easyui-textbox" style="width:480px;" data-options="label:'处理措施',"
/>
</div>
</div>
<div style="margin-bottom:5px;display:none" id="zjdiv">
<input id="zjrname" class="easyui-textbox" style="width:480px;" data-options="label:'转交人',"
editable=false />
<input type='hidden' id='zjr' name='npgr'/>
<a class='easyui-linkbutton' onclick="choseuser2()" style="width:auto">选择</a>
</div>
<div id="cljgdiv" class='labeldiv'>处理结果</div>
<div style="margin-bottom:5px" id="clmsdiv">
<input id="clms" name="clms" class="easyui-textbox" style="width:480px;"
data-options="label:'处理描述'"
/>
</div>
<div style="margin-bottom:5px" id="jyimg2div">
<input type="hidden" name="jyimg2" id="jyimg2" />
<label>处理图片</label><input type="file" id="file" name="" accept="image/*" style="margin-left: 15px" />
<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>
</div>
<ul id="addImage2" class="imgul"></ul>
<div id="shyjdiv">
<div id="shdiv" class='labeldiv'>审核意见</div>
<input id="shyj" name="shyj" class="easyui-textbox" style="width:480px;"
data-options="label:'审核意见'"
/></div>
</form>
</div>
</div>
<script>
var jyzt,jyid,shresult='pass'
$.get('api/suggest?a=detail&jyid=' + {{ jyid }}, function (res) {
$('#jylb').textbox('setValue', res.jylb__dickeyname).textbox('disable')
$('#dqxz').textbox('setValue', res.dqxz).textbox('disable')
$('#jynr').textbox('setValue', res.jynr).textbox('disable')
$('#qwxg').textbox('setValue', res.qwxg).textbox('disable')
jyzt = res.jyzt;
jyid = res.jyid;
console.log(jyzt)
if(jyzt==1){
$('#pgdiv,#cljgdiv,#clmsdiv,#jyimg2div,#shyjdiv').hide()
}
if(jyzt==2){
$('#cldiv,#fkdiv,#choseuser1,#shyjdiv').hide()
$('#apcldiv').show()
$('#clrname').textbox('setValue',res.clr__name).textbox('disable')
$('#clcs').textbox('setValue',res.clcs).textbox('disable')
$('#clms').textbox('setValue',res.clms)
var jyimg2 = res.jyimg2;
for (var i = 0; i < jyimg2.length; i++) {
$("#addImage2").append('<li ><img title="点击放大" style="display:block;" onclick="bigger(this)" class = "jyimg2" width="120" height="120" filepath="' + jyimg2[i] + '" src="http://' + window.location.host + '/' + jyimg2[i] + '"/><button href="#" onclick="removep(this)" >删除</button></li>');
}
$("#pgdiv").after('<div style="margin-bottom:5px"><span style="color:blue;font-weight:bold">' + res.pgr__name + ' ' + '</span><span style="font-weight:bold">指派处理</span></div>');
}
if(jyzt==3){
$('#cldiv,#fkdiv,#choseuser1,#file').hide()
$('#apcldiv,#reject').show()
$('#clrname').textbox('setValue',res.clr__name).textbox('disable')
$('#clcs').textbox('setValue',res.clcs).textbox('disable')
$('#clms').textbox('setValue',res.clms).textbox('disable')
var jyimg2 = res.jyimg2;
for (var i = 0; i < jyimg2.length; i++) {
$("#addImage2").append('<li ><img title="点击放大" style="display:block;" onclick="bigger(this)" class = "jyimg2" width="120" height="120" filepath="' + jyimg2[i] + '" src="http://' + window.location.host + '/' + jyimg2[i] + '"/></li>');
}
}
var jyimg = res.jyimg;
for (var i = 0; i < jyimg.length; i++) {
$("#addImage").append('<li ><img title="点击放大" style="display:block;" onclick="bigger(this)" class = "jyimg" width="120" height="120" filepath="' + jyimg[i] + '" src="http://' + window.location.host + '/' + jyimg[i] + '"/></li>');
}
$("#jyxqdiv").after('<div style="margin-bottom:5px"><span style="color:blue;font-weight:bold">' + res.jybm__partname + ' ' + res.jyr__name + ' ' + '</span><span style="font-weight:bold">提出建议</span></div>');
})
function tapcl() {
if ($('#inputcl').prop('checked') == true) {
$('#inputzj').attr("disabled", "disabled");
$("#fkdiv,#zjdiv").hide(); $('#apcldiv').show();
} else {
$('#inputzj').removeAttr("disabled");
$("#fkdiv").show(); $('#apcldiv,#zjdiv').hide();
}
}
function tapzj() {
if ($('#inputzj').prop('checked') == true) {
$('#inputcl').attr("disabled", "disabled");
$("#fkdiv").hide();
$('#zjdiv').show();
} else {
$('#inputcl').removeAttr("disabled");
$("#fkdiv").show();
$('#apcldiv,#zjdiv').hide();
}
}
function jysubmitForm() {
var jyimg2 = new Array();
$(".jyimg2").each(function () {
jyimg2.push($(this).attr("filepath"));
});
var jydata = $('#jyff').serializeJSON();
jydata['jyzt'] = jyzt
jydata['jyid'] = jyid
jydata['apcl']=false
jydata['zjtr']=false
jydata['jyimg2']=jyimg2
jydata['shresult']=shresult
if ($('#inputcl').prop('checked') == true){
jydata['apcl'] = true
}
if ($('#inputzj').prop('checked') == true){
jydata['zjtr'] = true
}
$.ajax({
type: "POST",
url: 'api/suggest?a=update',
data: JSON.stringify(jydata),
datatype: "json",
processData: false,
contentType: "application/json;charset=utf-8",
beforeSend: function () {
var bo = $('#jyff').form('validate')
if (bo == false) {
return bo
} else {
$('#submitb,#reject').linkbutton('disable');
}
},
success: function (data) {
if (data.code == 1) {
$('#jytable').datagrid('reload');
$("#dd").dialog("close");
} else { $.messager.alert('提示', '失败!'); }
$('#submitb,#reject').linkbutton('enable');
},
});
}
function choseuser1() {
var myh = screen.availHeight * 0.5;
$('#userdd').dialog({
maximizable: true,
title: '选择人员',
width: 700,
height: myh,
closed: false,
cache: false,
href: 'getuserf?a=clr',
modal: true,
border:false,
});
$('#userdd').window('center');
}
function choseuser2() {
var myh = screen.availHeight * 0.5;
$('#userdd').dialog({
maximizable: true,
title: '选择人员',
width: 700,
height: myh,
closed: false,
cache: false,
href: 'getuserf?a=zjr',
modal: true,
border:false,
});
$('#userdd').window('center');
}
function submitreject() {
shresult='reject'
$.messager.confirm('提示', '确定驳回重新处理吗?', function (r) {
if (r) { jysubmitForm(); }
});
}
function aaa(x) {
if (x == "zjr") {
$('#zjr').attr('value', top.$('#in').val());
$('#zjrname').textbox('setValue', top.$('#in').attr('show'));
}
else if (x == "clr") {
$('#clr').attr('value', top.$('#in').val());
$('#clrname').textbox('setValue', top.$('#in').attr('show'));
}
}
function upimg(i, url, objfiles) {
var fileObj = objfiles[i]
var leng = objfiles.length
if (fileObj.size / 1024 > 500) { //大于500k进行压缩上传
$("#file").after('<span id="tip" style="color:blue">图片大于500k,正在压缩...</span>');
photoCompress(fileObj, {
quality: 0.2
}, function (base64Codes) {
//console.log("压缩后:" + base.length / 1024 + " " + base);
var bl = convertBase64UrlToBlob(base64Codes);
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();
$("#addImage2").append('<li ><img title="点击放大" style="display:block;" onclick="bigger(this)" class = "jyimg2" width="120" height="120" filepath="' + data.filepath + '" src="http://' + window.location.host + '/' + data.filepath + '"/><button onclick="removep(this)" >删除</button></li>');
} else { alert("上传失败!"); }
i = i + 1
if (i < leng) {
upimg(i, url, objfiles)
}
}; //请求完成
xhr.onerror = function (evt) { alert("上传失败!"); $('#ps').hide(); };; //请求失败
xhr.upload.onprogress = progressFunction;//【上传进度调用方法实现】
xhr.upload.onloadstart = function () {//上传开始执行方法
ot = new Date().getTime(); //设置上传开始时间
oloaded = 0;//设置上传开始时以上传的文件大小为0
};
var form = new FormData();
form.append("upfile", bl, fileObj.name); // 文件对象
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();
$("#addImage2").append('<li ><img title="点击放大" style="display:block;" onclick="bigger(this)" class = "jyimg2" width="120" height="120" filepath="' + data.filepath + '" src="http://' + window.location.host + '/' + data.filepath + '"/><button onclick="removep(this)" >删除</button></li>');
} else { alert("上传失败!"); }
i = i + 1
if (i < leng) {
upimg(i, url, objfiles)
}
}; //请求完成
xhr.onerror = function (evt) { alert("上传失败!"); $('#ps').hide(); };; //请求失败
xhr.upload.onprogress = progressFunction;//【上传进度调用方法实现】
xhr.upload.onloadstart = function () {//上传开始执行方法
ot = new Date().getTime(); //设置上传开始时间
oloaded = 0;//设置上传开始时以上传的文件大小为0
};
var form = new FormData();
form.append("upfile", fileObj); // 文件对象
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('file').onchange = function () {
var url = 'upfile'
var i = 0
upimg(i, url, this.files)
}
</script>