This commit is contained in:
parent
597d61ba6d
commit
3f3d75915e
|
|
@ -75,12 +75,14 @@ function initTable(dataList, limit, page) {
|
|||
let loadingMsg = layer.msg("数据加载中,请稍候...", {icon: 16, scrollbar: false, time: 0,});
|
||||
tableIns = table.render({
|
||||
elem: "#table_data",
|
||||
id:'testData',
|
||||
height: "full-140",
|
||||
data: dataList,
|
||||
limit: limit,
|
||||
cols: [
|
||||
[
|
||||
//表头
|
||||
{type: 'checkbox', fixed: 'left'},
|
||||
{
|
||||
title: "序号", width: 80, unresize: true, align: "center",
|
||||
templet: function (d) {
|
||||
|
|
@ -103,8 +105,8 @@ function initTable(dataList, limit, page) {
|
|||
title: "操作", unresize: true, width: 180, align: "center",
|
||||
templet: function (d) {
|
||||
let html = '';
|
||||
html += "<a title='通过' onclick=\"passData('" + d.id + "',1)\">通过</a>";
|
||||
html += "<a style='margin: 0 0 0 10px' title='不通过' onclick=\"passData('" + d.id + "',2)\">不通过</a>";
|
||||
html += "<a title='通过' onclick=\"passData('" + d.experId + "','" + d.sampleId + "',1)\">通过</a>";
|
||||
html += "<a style='margin: 0 0 0 10px' title='不通过' onclick=\"passData('" + d.experId + "','" + d.sampleId + "',2)\">不通过</a>";
|
||||
// html += setButtonName(d.id, d.roleCode, d.status);
|
||||
return html;
|
||||
}
|
||||
|
|
@ -179,3 +181,37 @@ function viewData(experId,devTypeCode) {
|
|||
}
|
||||
openIframe7("viewData", title, "child/viewExperData.html", '1500px', '800px', param);
|
||||
}
|
||||
|
||||
/**/
|
||||
function passData(experId,sampleId,type){
|
||||
let title = type === 1 ? '通过确认':'驳回确认';
|
||||
let param = {
|
||||
'experId': experId,
|
||||
'sampleId': sampleId,
|
||||
'type': type
|
||||
}
|
||||
openIframe3("passData", title, "passDataForm.html", '600px', '325px', param);
|
||||
}
|
||||
|
||||
/*1.批量通过 2.批量不通过*/
|
||||
function batchAudit(type){
|
||||
const tableStatus = table.checkStatus('testData');
|
||||
const size = tableStatus.data.length
|
||||
if(size === 0){
|
||||
return layer.msg('未选择数据',{icon:7});
|
||||
}
|
||||
let experIdArr = [],sampleId = null;
|
||||
$.each(tableStatus.data,function (index,item){
|
||||
if(index === 0){
|
||||
sampleId = item.sampleId;
|
||||
}
|
||||
experIdArr.push(item.experId)
|
||||
})
|
||||
let index = layer.confirm('批量'+(type === 1 ? '通过':'不通过')+'确认前,请仔细检查数据?',{title:'操作提示',icon:7,move:false},function (){
|
||||
layer.close(index);
|
||||
passData(experIdArr,sampleId,type);
|
||||
})
|
||||
console.log(tableStatus.data) // 选中行的数据
|
||||
console.log(tableStatus.data.length) // 选中行数量,可作为是否有选中行的条件
|
||||
console.log(tableStatus.isAll) // 表格是否全选
|
||||
}
|
||||
|
|
@ -0,0 +1,72 @@
|
|||
let form, layer, experIdParam,sampleIdParam,typeParam;
|
||||
function setParams(params) {
|
||||
experIdParam = JSON.parse(params).experId;
|
||||
sampleIdParam = JSON.parse(params).sampleId;
|
||||
typeParam = JSON.parse(params).type;
|
||||
if(typeParam === 2) {
|
||||
$('#auditRemakr').attr('lay-verify', 'required');
|
||||
$('#labelTitle').html('<i style="padding: 0 10px;">*</i>备注');
|
||||
}
|
||||
layui.use(['form', 'layer'], function () {
|
||||
layer = layui.layer;
|
||||
form = layui.form;
|
||||
form.render();
|
||||
form.on('submit(formData)', function (data) {
|
||||
// saveData(data);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// 设置表单内容
|
||||
function setFormData(data) {
|
||||
if (data) {
|
||||
$('#id').val(data.lockNumber)
|
||||
$('#lockNumber').val(data.lockNumber).attr('readonly', 'readonly').css('backgroundColor', '#eee')
|
||||
$('#lockName').val(data.lockName)
|
||||
lockNumberParam = data.lockNumber;
|
||||
lockNameParam = data.lockName;
|
||||
layui.form.render();
|
||||
}
|
||||
}
|
||||
|
||||
function saveData2() {
|
||||
$('#formSubmit').trigger('click')
|
||||
}
|
||||
|
||||
// 保存数据
|
||||
function saveData(data) {
|
||||
let loadingMsg = layer.msg('数据上传中,请稍候...', {icon: 16, scrollbar: false, time: 0});
|
||||
let url = lockNumberParam ? dataUrl + "/sys/doorLock/addDoorLock" : dataUrl + "/sys/doorLock/updateDoorLock";
|
||||
let obj = data.field;
|
||||
let params = {
|
||||
encryptedData: encryptCBC(JSON.stringify(obj))
|
||||
}
|
||||
ajaxRequest(url, "POST", params, true, function () {
|
||||
$('.save').addClass("layui-btn-disabled").attr("disabled", true);
|
||||
$('.cancel').addClass("layui-btn-disabled").attr("disabled", true);
|
||||
}, function (result) {
|
||||
layer.close(loadingMsg); // 关闭提示层
|
||||
if (result.status === 200) {
|
||||
closePage(1);
|
||||
parent.layer.msg(result.msg, {icon: 1});
|
||||
} else if (result.status === 500) {
|
||||
layer.alert(result.msg, {icon: 2,move:false})
|
||||
$('.save').removeClass("layui-btn-disabled").attr("disabled", false);
|
||||
$('.cancel').removeClass("layui-btn-disabled").attr("disabled", false);
|
||||
}
|
||||
}, function (xhr) {
|
||||
layer.close(loadingMsg); // 关闭提示层
|
||||
$('.save').removeClass("layui-btn-disabled").attr("disabled", false);
|
||||
$('.cancel').removeClass("layui-btn-disabled").attr("disabled", false);
|
||||
error(xhr)
|
||||
});
|
||||
}
|
||||
|
||||
// 关闭页面
|
||||
function closePage(type) {
|
||||
let index = parent.layer.getFrameIndex(window.name); //先得到当前 iframe层的索引
|
||||
parent.layer.close(index); //再执行关闭
|
||||
if (type === 1) {
|
||||
parent.reloadData()
|
||||
}
|
||||
}
|
||||
|
|
@ -58,7 +58,7 @@ function openIframe3(id, title, content, width, height, params) {
|
|||
iframeWin.setParams(JSON.stringify(params));
|
||||
},
|
||||
end:function (){
|
||||
if(id === 'auditData'){
|
||||
if(id === 'auditData' || id === 'passData'){
|
||||
window.reloadData();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,6 +47,10 @@
|
|||
<div class="layui-inline btns">
|
||||
<button type="button" class="layui-btn layui-btn-normal layui-btn-sm btn-1" onclick="query(1)">查询
|
||||
</button>
|
||||
<button type="button" class="layui-btn layui-btn-primary layui-btn-sm layui-border-blue" onclick="batchAudit(2)">不通过
|
||||
</button>
|
||||
<button type="button" class="layui-btn layui-btn-normal layui-btn-sm btn-1" onclick="batchAudit(1)">通过
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,36 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<link rel="stylesheet" href="../../../js/layui-v2.9.14/layui/css/layui.css">
|
||||
<link rel="stylesheet" href="../../../css/dataForm.css">
|
||||
<script src="../../../js/libs/jquery-2.1.1.min.js" charset="UTF-8" type="text/javascript"></script>
|
||||
<script src="../../../js/layui-v2.9.14/layui/layui.js" charset="UTF-8" type="text/javascript"></script>
|
||||
<script src="../../../js/my/aes.js"></script>
|
||||
<script src="../../../js/publicJs.js"></script>
|
||||
<script src="../../../js/ajaxRequest.js"></script>
|
||||
<script src="../../../js/commonUtils.js"></script>
|
||||
<title>审查-确认驳回/确认通过</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="main-box">
|
||||
<form class="layui-form" onsubmit="return false;">
|
||||
<div class="layui-form-item" style="margin-top: 4%;">
|
||||
<label class="layui-form-label" style="width: 80px;" id="labelTitle">备注</label>
|
||||
<div class="layui-input-inline" style="width: 340px;">
|
||||
<textarea class="layui-textarea" id="auditRemakr" name="auditRemakr" autocomplete="off"
|
||||
maxlength="256"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<button type="submit" id="formSubmit" class="layui-btn" lay-submit="" lay-filter="formData"
|
||||
style="display: none;"></button>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
<div class="btn-box">
|
||||
<button class="layui-btn layui-btn-norma save" onclick="saveData2()">确定</button>
|
||||
<button class="layui-btn layui-btn-primary cancel" onclick="closePage()">取消</button>
|
||||
</div>
|
||||
</body>
|
||||
<script src="../../../js/basis/child/passDataForm.js" charset="UTF-8" type="text/javascript"></script>
|
||||
</html>
|
||||
Loading…
Reference in New Issue