From 3f3d75915e757946a462677a8fda1f47db9b4691 Mon Sep 17 00:00:00 2001 From: cwchen <1048842385@qq.com> Date: Wed, 24 Jul 2024 17:05:51 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=A1=E6=A0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../static/js/basis/child/auditData.js | 40 ++++++++++- .../static/js/basis/child/passDataForm.js | 72 +++++++++++++++++++ src/main/resources/static/js/openIframe.js | 2 +- .../static/pages/basis/child/auditData.html | 4 ++ .../pages/basis/child/passDataForm.html | 36 ++++++++++ 5 files changed, 151 insertions(+), 3 deletions(-) create mode 100644 src/main/resources/static/js/basis/child/passDataForm.js create mode 100644 src/main/resources/static/pages/basis/child/passDataForm.html diff --git a/src/main/resources/static/js/basis/child/auditData.js b/src/main/resources/static/js/basis/child/auditData.js index 0ad6181..a651805 100644 --- a/src/main/resources/static/js/basis/child/auditData.js +++ b/src/main/resources/static/js/basis/child/auditData.js @@ -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 += "通过"; - html += "不通过"; + html += "通过"; + html += "不通过"; // html += setButtonName(d.id, d.roleCode, d.status); return html; } @@ -178,4 +180,38 @@ function viewData(experId,devTypeCode) { 'devTypeCode': 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) // 表格是否全选 } \ No newline at end of file diff --git a/src/main/resources/static/js/basis/child/passDataForm.js b/src/main/resources/static/js/basis/child/passDataForm.js new file mode 100644 index 0000000..d8b8145 --- /dev/null +++ b/src/main/resources/static/js/basis/child/passDataForm.js @@ -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('*备注'); + } + 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() + } +} \ No newline at end of file diff --git a/src/main/resources/static/js/openIframe.js b/src/main/resources/static/js/openIframe.js index f930c62..72edf2b 100644 --- a/src/main/resources/static/js/openIframe.js +++ b/src/main/resources/static/js/openIframe.js @@ -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(); } } diff --git a/src/main/resources/static/pages/basis/child/auditData.html b/src/main/resources/static/pages/basis/child/auditData.html index e95f9d1..1a38290 100644 --- a/src/main/resources/static/pages/basis/child/auditData.html +++ b/src/main/resources/static/pages/basis/child/auditData.html @@ -47,6 +47,10 @@
+ +
diff --git a/src/main/resources/static/pages/basis/child/passDataForm.html b/src/main/resources/static/pages/basis/child/passDataForm.html new file mode 100644 index 0000000..4b9165c --- /dev/null +++ b/src/main/resources/static/pages/basis/child/passDataForm.html @@ -0,0 +1,36 @@ + + + + + + + + + + + + + 审查-确认驳回/确认通过 + + +
+
+
+ +
+ +
+
+ +
+ +
+
+ + +
+ + + \ No newline at end of file