From df1cc74c3f284ebf52749e374bbef287d49682d5 Mon Sep 17 00:00:00 2001 From: lSun <15893999301@qq.com> Date: Mon, 22 Jul 2024 15:35:37 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=95=E9=AA=8C=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../js/basis/standard/child/testList.js | 174 +++++++++++++++ .../js/basis/standard/testManagementList.js | 200 ++++++++++++++++++ .../js/basis/tools/testStandardsList.js | 15 -- src/main/resources/static/js/openIframe.js | 4 +- .../pages/basic/standard/child/testList.html | 42 ++++ .../basic/standard/testManagementList.html | 63 ++++++ 6 files changed, 482 insertions(+), 16 deletions(-) create mode 100644 src/main/resources/static/js/basis/standard/child/testList.js create mode 100644 src/main/resources/static/js/basis/standard/testManagementList.js create mode 100644 src/main/resources/static/pages/basic/standard/child/testList.html create mode 100644 src/main/resources/static/pages/basic/standard/testManagementList.html diff --git a/src/main/resources/static/js/basis/standard/child/testList.js b/src/main/resources/static/js/basis/standard/child/testList.js new file mode 100644 index 0000000..447ca85 --- /dev/null +++ b/src/main/resources/static/js/basis/standard/child/testList.js @@ -0,0 +1,174 @@ +let form, layer, table, tableIns; +let pageNum = 1, limitSize = 10; // 默认第一页,分页数量为10 +layui.use(['form', 'layer', 'table', 'laydate'], function () { + form = layui.form; + layer = layui.layer; + table = layui.table; + layui.form.render(); + getDevSelected(); + pages(1, 10, 1); +}) + +function pages(pageNum, pageSize, typeNum) { + let params = getReqParams(pageNum, pageSize, typeNum); + let url = dataUrl + "/experimental/getDetailList" + ajaxRequest(url, "POST", params, true, function () { + }, function (result) { + if (result.code === 200) { + if (result.data) { + initTable(result.data, result.limit, result.curr) + laypages(result.count, result.curr, result.limit) + } + } else if (result.code === 500) { + layer.alert(result.msg, {icon: 2}) + } + }, function (xhr) { + error(xhr) + }); +} + +function laypages(total, page, limit) { + layui.use(['laypage'], function () { + let laypage = layui.laypage; + laypage.render({ + elem: 'voi-page', + count: total, + curr: page, + limit: limit, + limits: [10, 20, 50, 100, 200, 500], + layout: ['prev', 'page', 'next', 'skip', 'count', 'limit'], + groups: 5, + jump: function (obj, first) { + if (!first) { + pageNum = obj.curr, limitSize = obj.limit; + pages(obj.curr, obj.limit, null); + } + } + }); + }) +} + +/*初始化表格*/ +function initTable(dataList, limit, page) { + let loadingMsg = layer.msg("数据加载中,请稍候...", {icon: 16, scrollbar: false, time: 0,}); + tableIns = table.render({ + elem: "#table_data", + height: "full-130", + data: dataList, + limit: limit, + cols: [ + [ + //表头 + {title: "序号", width: 80, unresize: true, align: "center", + templet: function (d) { + return (page - 1) * limit + d.LAY_INDEX; + } + }, + {field: "devTypeName", title: "样品类型", unresize: true, align: "center"}, + {field: "devModule", title: "规格型号", unresize: true, align: "center"}, + {field: "sampleQuantity", title: "样品数量", unresize: true, align: "center"}, + {field: "", title: "状态", unresize: true, align: "center"}, + {field: "causeOfRejection", title: "驳回原因", unresize: true, align: "center"}, + {title: "原始记录", unresize: true, width: 300, align: "center", + templet: function (d) { + var html = ''; + if (d.status == "待提交" || d.status == "审阅不通过" || d.status == "审核不通过" || d.status == "审批不通过") { + let search="查看"; + let edit="编制"; + html=search+edit; + return html; + } else { + + } + } + }, + ], + ], + done: function (res, curr, count) { + layer.close(loadingMsg); + table.resize("table_data"); + count || this.elem.next(".layui-table-view").find(".layui-table-header").css("display", "inline-block"); + count || this.elem.next(".layui-table-view").find(".layui-table-box").css("overflow", "auto"); + }, + }); +} + + +// 获取参数 +function getReqParams(page, limit, type) { + let obj = {}; + if (!type) { + obj = { + page: page + "", + limit: limit + "", + devTypeCode: $('#devId').val(), + keyWord: $('#keyWord').val(), + sampleUserName: $('#sampleUserName').val(), + sampleDate: $('#sampleDate').val(), + }; + } else { + obj = { + page: '1', + limit: '10', + devTypeCode: '', + keyWord: '', + sampleUserName: '', + sampleDate: '', + }; + } + obj={ + encryptedData:encryptCBC(JSON.stringify(obj)) + } + return obj; +} + +// 查询/重置 +function query() { + pageNum = 1; + pages(1, limitSize); +} + +function reloadData() { + pages(pageNum, limitSize); +} + +// 试验标准新增、修改 +function testClick(id) { + let title = '试验' + let param = { + 'id': id + } + openIframeMax("testList", title, "child/addTestStandards.html", '1000px', '625px', param); +} + +function getDevSelected() { + let url = dataUrl + '/sys/select/getDicts'; + let obj = { + 'code':"dev_code" + } + let params = { + encryptedData: encryptCBC(JSON.stringify(obj)) + } + + ajaxRequest(url, "POST", params, true, function () { + }, function (result) { + if (result.code === 200) { + setSelectValue(result.data, 'devId'); + // return result.data + } else { + layer.alert(result.msg, {icon: 2}) + } + }, function (xhr) { + error(xhr) + }); +} + +/*下拉选表单赋值*/ +function setSelectValue(list, selectName) { + let html = ''; + $.each(list, function (index, item) { + html += ''; + }) + $('#' + selectName).empty().append(html); + layui.form.render(); +} \ No newline at end of file diff --git a/src/main/resources/static/js/basis/standard/testManagementList.js b/src/main/resources/static/js/basis/standard/testManagementList.js new file mode 100644 index 0000000..2aed92a --- /dev/null +++ b/src/main/resources/static/js/basis/standard/testManagementList.js @@ -0,0 +1,200 @@ +let form, layer, table, tableIns; +let pageNum = 1, limitSize = 10; // 默认第一页,分页数量为10 +layui.use(['form', 'layer', 'table', 'laydate'], function () { + form = layui.form; + layer = layui.layer; + table = layui.table; + var laydate = layui.laydate; + // 渲染 + laydate.render({ + elem: '#sampleDate' + }); + layui.form.render(); + getDevSelected(); + pages(1, 10, 1); +}) + +function pages(pageNum, pageSize, typeNum) { + let params = getReqParams(pageNum, pageSize, typeNum); + let url = dataUrl + "/experimental/getList" + ajaxRequest(url, "POST", params, true, function () { + }, function (result) { + if (result.code === 200) { + if (result.data) { + initTable(result.data, result.limit, result.curr) + laypages(result.count, result.curr, result.limit) + } + } else if (result.code === 500) { + layer.alert(result.msg, {icon: 2}) + } + }, function (xhr) { + error(xhr) + }); +} + +function laypages(total, page, limit) { + layui.use(['laypage'], function () { + let laypage = layui.laypage; + laypage.render({ + elem: 'voi-page', + count: total, + curr: page, + limit: limit, + limits: [10, 20, 50, 100, 200, 500], + layout: ['prev', 'page', 'next', 'skip', 'count', 'limit'], + groups: 5, + jump: function (obj, first) { + if (!first) { + pageNum = obj.curr, limitSize = obj.limit; + pages(obj.curr, obj.limit, null); + } + } + }); + }) +} + +/*初始化表格*/ +function initTable(dataList, limit, page) { + let loadingMsg = layer.msg("数据加载中,请稍候...", {icon: 16, scrollbar: false, time: 0,}); + tableIns = table.render({ + elem: "#table_data", + height: "full-130", + data: dataList, + limit: limit, + cols: [ + [ + //表头 + {title: "序号", width: 80, unresize: true, align: "center", + templet: function (d) { + return (page - 1) * limit + d.LAY_INDEX; + } + }, + {field: "customName", title: "送样单位", unresize: true, align: "center"}, + {field: "sampleTime", title: "送样时间", unresize: true, align: "center"}, + {field: "sampleDev", title: "送样设备", unresize: true, align: "center"}, + {field: "customNum", title: "送样数量", unresize: true, align: "center"}, + {field: "sampleUserName", title: "收样人", unresize: true, align: "center"}, + {field: "sampleDate", title: "收样时间", unresize: true, align: "center"}, + {field: "dispatchUserName", title: "派工人", unresize: true, align: "center"}, + {field: "teamName", title: "试验班组", unresize: true, align: "center"}, + {field: "audtiStatus", title: "状态", unresize: true, align: "center", + // templet: function (d) { + // if (d.audtiStatus == "0") { + // return "待试验"; + // } else if (d.audtiStatus == "1") { + // return "待审阅"; + // } else if (d.audtiStatus == "2") { + // return "待审核"; + // }else if (d.audtiStatus == "3") { + // return "待审批"; + // }else if (d.audtiStatus == "4") { + // return "试验结束"; + // }else if (d.audtiStatus == "5") { + // return "待重新审阅"; + // } + // } + }, + {field: "remarks", title: "备注", unresize: true, align: "center", + templet: function (d) { + if (d.remarks) { + return d.remarks; + } else { + return ""; + } + } + }, + {title: "操作", unresize: true, width: 300, align: "center", + templet: function (d) { + return '试验'; + } + }, + ], + ], + done: function (res, curr, count) { + layer.close(loadingMsg); + table.resize("table_data"); + count || this.elem.next(".layui-table-view").find(".layui-table-header").css("display", "inline-block"); + count || this.elem.next(".layui-table-view").find(".layui-table-box").css("overflow", "auto"); + }, + }); +} + + +// 获取参数 +function getReqParams(page, limit, type) { + let obj = {}; + if (!type) { + obj = { + page: page + "", + limit: limit + "", + devTypeCode: $('#devId').val(), + keyWord: $('#keyWord').val(), + sampleUserName: $('#sampleUserName').val(), + sampleDate: $('#sampleDate').val(), + }; + } else { + obj = { + page: '1', + limit: '10', + devTypeCode: '', + keyWord: '', + sampleUserName: '', + sampleDate: '', + }; + } + obj={ + encryptedData:encryptCBC(JSON.stringify(obj)) + } + return obj; +} + +// 查询/重置 +function query() { + pageNum = 1; + pages(1, limitSize); +} + +function reloadData() { + pages(pageNum, limitSize); +} + +// 试验标准新增、修改 +function testClick(id) { + let title = '试验' + let param = { + 'id': id + } + openIframeMax("testList", title, "child/testList.html", '1000px', '625px', param); +} + +function getDevSelected() { + let url = dataUrl + '/sys/select/getDicts'; + let obj = { + 'code':"dev_code" + } + let params = { + encryptedData: encryptCBC(JSON.stringify(obj)) + } + + ajaxRequest(url, "POST", params, true, function () { + }, function (result) { + if (result.code === 200) { + setSelectValue(result.data, 'devId'); + // return result.data + } else { + layer.alert(result.msg, {icon: 2}) + } + }, function (xhr) { + error(xhr) + }); +} + +/*下拉选表单赋值*/ +function setSelectValue(list, selectName) { + let html = ''; + $.each(list, function (index, item) { + html += ''; + }) + $('#' + selectName).empty().append(html); + layui.form.render(); +} \ No newline at end of file diff --git a/src/main/resources/static/js/basis/tools/testStandardsList.js b/src/main/resources/static/js/basis/tools/testStandardsList.js index b933584..2a8b2ba 100644 --- a/src/main/resources/static/js/basis/tools/testStandardsList.js +++ b/src/main/resources/static/js/basis/tools/testStandardsList.js @@ -113,21 +113,6 @@ function getReqParams(page, limit, type) { // 查询/重置 function query() { - let pattern = new RegExp("[%_<>]"); - if (pattern.test($("#loginName").val())) { - $("#loginName").val(''); - return layer.msg('用户名查询包含特殊字符,请重新输入', { - icon: 2, - time: 2000 //2秒关闭(如果不配置,默认是3秒) - }); - } - if (pattern.test($("#phone").val())) { - $("#phone").val(''); - return layer.msg('手机号查询包含特殊字符,请重新输入', { - icon: 2, - time: 2000 //2秒关闭(如果不配置,默认是3秒) - }); - } pageNum = 1; pages(1, limitSize); } diff --git a/src/main/resources/static/js/openIframe.js b/src/main/resources/static/js/openIframe.js index 0b0340e..f21bc12 100644 --- a/src/main/resources/static/js/openIframe.js +++ b/src/main/resources/static/js/openIframe.js @@ -155,7 +155,9 @@ function openIframeMax(id, title, content, width, height, params) { } } }); - // console.log(layer) + console.log(layer) + // layer.max(layerIndex) + // 弹窗打开后立即调用 layer.full // layer.full(layerIndex); } \ No newline at end of file diff --git a/src/main/resources/static/pages/basic/standard/child/testList.html b/src/main/resources/static/pages/basic/standard/child/testList.html new file mode 100644 index 0000000..df5eb0d --- /dev/null +++ b/src/main/resources/static/pages/basic/standard/child/testList.html @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + 试验 + + +
+ +
+
+
+
+
+ + + \ No newline at end of file diff --git a/src/main/resources/static/pages/basic/standard/testManagementList.html b/src/main/resources/static/pages/basic/standard/testManagementList.html new file mode 100644 index 0000000..b2fa6f9 --- /dev/null +++ b/src/main/resources/static/pages/basic/standard/testManagementList.html @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + 试验管理 + + +
+ +
+
+
+
+
+ + + \ No newline at end of file