btyjj-inspection/src/main/resources/static/route/check2/get-check-item.html

242 lines
12 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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.

<!doctype html>
<html lang="en">
<head>
<base href="/inspection/">
<meta charset="utf-8">
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
<link rel="stylesheet" href="assets/fonts/font-awesome/css/font-awesome.css"/>
<link rel="stylesheet" href="assets/layuiadmin/layui/css/layui.css" media="all">
<link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all">
<link rel="stylesheet" href="assets/js/vendor/viewer/viewer.min.css">
<style>
.check-item-option-number-box {display: inline-block; vertical-align: middle; margin-top: 6px; margin-right: 20px;}
.check-item-option-text-box {display: inline-block; vertical-align: middle; margin-top: 6px; margin-right: 20px;}
.check-item-option-number-input {width: 50px; height: 24px; text-align: center;}
.check-item-option-text-input {width: 200px; height: 24px; text-align: center;}
</style>
</head>
<body>
<div class="layui-anim layui-anim-fadein">
<div class="layui-card">
<div id="app" class="layui-card-body" style="padding: 15px;">
<form class="layui-form layui-form-pane" lay-filter="dataForm">
<div class="layui-form-item layui-form-text">
<div class="layui-input-block" id="checkItemTemplateBox"></div>
<script id="checkItemTemplate" type="text/html">
<table class="layui-table">
<thead>
<tr>
<th style="width: 300px;">检查项</th>
<th>检查结果</th>
</tr>
</thead>
<tbody>
{{# for(var i = 0, item; item = d[i++]; ) { }}
{{# if(item.type == 1) {continue;} }}
<tr>
<td>{{item.name}}({{item.checkItemType == '1' ? '必查': '选查'}})</td>
<td>
{{# for(var j = 0, jItem; jItem = item.hiddenDangerReports[j++]; ) { }}
{{# if(jItem.checkItemType == 1) { }}
<input type="radio" name="hd_checkResult_{{item.checkItemId}}" value="{{jItem.checkItemOptionId}}" title="{{jItem.nameJoinByCheckItemId}}" data-checktype="{{item.type}}" data-type="{{jItem.type}}" data-iswrong="{{jItem.isWrong}}" lay-filter="checkItemOptionCheckResult" checked>
{{# } else if(jItem.checkItemType == 2) { }}
<div class="check-item-option-number-box"><span>{{jItem.nameJoinByCheckItemId}}</span><input class="check-item-option-number-input" id="hd_checkNumber_{{item.checkItemId}}_{{jItem.checkItemOptionId}}" name="hd_checkNumber_{{item.checkItemId}}_{{jItem.checkItemOptionId}}" type="number" value="{{jItem.checkResult}}" step="1" disabled/> <span>{{jItem.unitJoinByCheckItemId}}</span></div>
{{# } else if(jItem.checkItemType == 3) { }}
<div class="check-item-option-text-box"><span>{{jItem.nameJoinByCheckItemId}}</span><input class="check-item-option-text-input" id="hd_checkText_{{item.checkItemId}}_{{jItem.checkItemOptionId}}" name="hd_checkText_{{item.checkItemId}}_{{jItem.checkItemOptionId}}" value="{{jItem.checkResult}}" type="text" disabled/> <span>{{jItem.unitJoinByCheckItemId}}</span></div>
{{# } }}
{{# } }}
</td>
</tr>
{{# if(item.scenePhotos) { }}
<tr>
<td></td>
<td>
<div>
{{# var sencePhotoArray = item.scenePhotos.split(','); }}
{{# for(var j = 0, jItem; jItem = sencePhotoArray[j++];) { }}
<div class="upload-image-box">
<span class="upload-image-span">
<img src="route/file/downloadfile/false/{{jItem}}" align="加载失败">
</span>
</div>
{{# } }}
</div>
</td>
</tr>
{{# } }}
{{# } }}
</tbody>
</table>
<table id="handleTable" class="layui-table" style="display: none;">
<thead>
<tr>
<th>整改处理</th>
</tr>
</thead>
</thead>
<tbody>
<tr id="hd_checkResult">
<td>
<input type="radio" name="rectificationType" value="1" title="立即整改" lay-filter="checkResultFilter" checked>
<input type="radio" name="rectificationType" value="2" title="限期整改" lay-filter="checkResultFilter">
</td>
</tr>
<tr id="hd_immediatelyChangeType">
<td>
<input type="radio" name="immediatelyChangeType" value="1" title="当场" checked>
<input type="radio" name="immediatelyChangeType" value="2" title="当天">
</td>
</tr>
<tr id="hd_rectificationDays" style="display: none;">
<td>
<input type="radio" name="rectificationDays" value="1" title="1天" checked>
<input type="radio" name="rectificationDays" value="5" title="5天">
<input type="radio" name="rectificationDays" value="15" title="15天">
<input type="radio" name="rectificationDays" value="20" title="20天">
<input type="radio" name="rectificationDays" value="25" title="25天">
<input type="radio" name="rectificationDays" value="30" title="30天">
</td>
</tr>
</tbody>
</table>
</script>
</div>
</form>
</div>
</div>
</div>
<script src="assets/js/vendor/viewer/viewer.min.js"></script>
<script src="assets/layuiadmin/layui/layui.js"></script>
<script>
layui.config({
base: 'assets/layuiadmin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'form', 'laydate', 'laytpl'], function(){
var $ = layui.$;
var form = layui.form;
var laytpl = layui.laytpl;
var laydate = layui.laydate;
var checkId = top.restAjax.params(window.location.href).checkId;
var checkItemArray = [];
var wrongCheckItemArray = [];
function closeBox() {
parent.layer.close(parent.layer.getFrameIndex(window.name));
}
// 初始化内容
function initData() {
var loadLayerIndex;
top.restAjax.get(top.restAjax.path('api/check2/get/{checkId}', [checkId]), {}, null, function(code, data) {
var dataFormData = {
enterpriseId: data.enterpriseId,
enterpriseName: data.nameJoinByEnterpriseId,
};
form.val('dataForm', dataFormData);
form.render(null, 'dataForm');
laytpl(document.getElementById("checkItemTemplate").innerHTML).render(data.checkItems, function(html) {
document.getElementById("checkItemTemplateBox").innerHTML = html;
new Viewer(document.getElementById('app'), {navbar: false});
});
form.render('radio');
}, function(code, data) {
top.dialog.msg(data.msg);
}, function() {
loadLayerIndex = top.dialog.msg(top.dataMessage.loading, {icon: 16, time: 0, shade: 0.3});
}, function() {
top.dialog.close(loadLayerIndex);
});
}
initData();
function refreshDownloadTemplet(fileName, file) {
var dataRander = {};
dataRander[fileName] = file;
var photos = '';
for(var i = 0, item; item = file[i++];) {
photos += '<div class="upload-image-box">'+
'<span class="upload-image-span">'+
'<img src="route/file/downloadfile/false/'+ item.fileId +'" align="加载失败">'+
'</span>'+
'<a class="layui-btn layui-btn-xs layui-btn-danger text-danger remove-image" href="javascript:void(0);" lay-form-button data-id="'+ item.fileId +'" data-name="'+ fileName +'" lay-filter="scenePhotosRemoveFile">'+
'<i class="fa fa-trash-o"></i>'+
'</a>'+
'</div>';
}
$('#'+ fileName +'_ImageBox').empty();
$('#'+ fileName +'_ImageBox').append(photos);
}
// 初始化文件列表
function initFileList(fileName, ids, callback) {
var dataForm = {};
dataForm[fileName] = ids;
form.val('dataForm', dataForm);
if(!ids) {
refreshDownloadTemplet(fileName, []);
if(callback) {
callback(fileName, []);
}
return;
}
top.restAjax.get(top.restAjax.path('api/file/listfilebyfileid', []), {
ids: ids
}, null, function(code, data) {
refreshDownloadTemplet(fileName, data);
if(callback) {
callback(fileName, data);
}
}, function(code, data) {
top.dialog.msg(data.msg);
});
}
// 上传图片
form.on('button(scenePhotosUploadFiles)', function(obj) {
var name = this.dataset.name;
var explain = this.dataset.explain;
top.dialog.file({
type: 'image',
title: '上传'+ explain,
width: '400px',
height: '420px',
maxFileCount: '1',
onClose: function() {
var uploadFileArray = top.dialog.dialogData.uploadFileArray;
if(typeof(uploadFileArray) != 'undefined' && uploadFileArray.length > 0) {
var files = $('#'+ name).val();
for(var j = 0, file = uploadFileArray[j]; file = uploadFileArray[j++];) {
if(files.length > 0) {
files += ',';
}
files += file.data;
}
initFileList(name, files, function(fileName) {});
}
}
});
});
form.on('button(scenePhotosRemoveFile)', function(obj) {
var name = this.dataset.name;
var id = this.dataset.id;
var files = $('#'+ name).val().replace(id, '');
files = files.replace(/\,+/g, ',');
if(files.charAt(0) == ',') {
files = files.substring(1);
}
if(files.charAt(files.length - 1) == ',') {
files = files.substring(0, files.length - 1);
}
initFileList(name, files, function(fileName) {});
});
});
</script>
</body>
</html>