From 2a3e5e18b4723d45c13e41c68604fbb4f6f77476 Mon Sep 17 00:00:00 2001 From: BianLzhaoMin <11485688+bianliangzhaomin123@user.noreply.gitee.com> Date: Tue, 10 Jun 2025 16:27:47 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=85=AC=E8=B7=AF=20?= =?UTF-8?q?=E5=8D=83=E5=BC=A0=E5=9C=BA=E5=9C=B0=E8=8F=9C=E5=8D=95=E9=80=89?= =?UTF-8?q?=E9=A1=B9=E4=BB=A5=E5=8F=8A=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../basic/lineManagement/child/highwayList.js | 374 +++++++++++++++++ .../basic/lineManagement/child/qzSiteList.js | 375 ++++++++++++++++++ .../lineManagement/child/highwayList.html | 61 +++ .../lineManagement/child/qzSiteList.html | 61 +++ 4 files changed, 871 insertions(+) create mode 100644 src/main/resources/static/js/basic/lineManagement/child/highwayList.js create mode 100644 src/main/resources/static/js/basic/lineManagement/child/qzSiteList.js create mode 100644 src/main/resources/static/pages/basic/lineManagement/child/highwayList.html create mode 100644 src/main/resources/static/pages/basic/lineManagement/child/qzSiteList.html diff --git a/src/main/resources/static/js/basic/lineManagement/child/highwayList.js b/src/main/resources/static/js/basic/lineManagement/child/highwayList.js new file mode 100644 index 0000000..5f93508 --- /dev/null +++ b/src/main/resources/static/js/basic/lineManagement/child/highwayList.js @@ -0,0 +1,374 @@ +let form, layer, table, tableIns, idParam; +let pageNum = 1, + limitSize = 10; // 默认第一页,分页数量为10 + +function setParams(params) { + idParam = JSON.parse(params).id; + layui.use(["form", "layer", "table", "laydate"], function () { + form = layui.form; + layer = layui.layer; + table = layui.table; + layui.form.render(); + pages(1, 10, 1); + }); +} + +function pages(pageNum, pageSize, typeNum) { + let params = getReqParams(pageNum, pageSize, typeNum); + let url = dataUrl + "/tbCablewaTrans/tbCablewaTransList"; + ajaxRequest( + url, + "POST", + params, + true, + function () {}, + function (result) { + console.log(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: "towerName", + // title: "索道终点所在杆塔", + // unresize: true, + // align: "center", + // }, + // { + // field: "cablewayLength", + // title: "索道长度(km)", + // unresize: true, + // align: "center", + // }, + // { + // field: "maxHeight", + // title: "最大载重(kg)", + // unresize: true, + // align: "center", + // }, + // { + // field: "safetyDistance", + // title: "安全距离(m)", + // unresize: true, + // align: "center", + // }, + // { + // field: "maxSlope", + // title: "最大坡度", + // unresize: true, + // align: "center", + // }, + // { + // field: "cablewayWidth", + // title: "索道宽度(m)", + // unresize: true, + // align: "center", + // }, + { + field: "towerName", + title: "公路所在杆塔", + unresize: true, + align: "center", + }, + { + field: "highwayWidth", + title: "宽度(m)", + unresize: true, + align: "center", + }, + { + field: "highwayLength", + title: "长度(m)", + unresize: true, + align: "center", + }, + { + title: "操作", + unresize: true, + width: 200, + align: "center", + templet: function (d) { + let html = ""; + let del = + "删除"; + let edit = + "修改"; + html = edit + del; + if (d.delFlag == 1) { + return ""; + } + return html; + }, + }, + ], + ], + 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 === 2) { + $("#keyWord").val(""); + layui.form.render(); + } + obj = { + page: page + "", + limit: limit + "", + proId: idParam, + keyWord: $("#keyWord").val(), + }; + console.log("杆塔管理查询条件", obj); + obj = { + encryptedData: encryptCBC(JSON.stringify(obj)), + }; + return obj; +} + +// 查询/重置 +function query(type) { + pageNum = 1; + if (type === 2) { + $("#keyWord").val(""); + layui.form.render(); + } + pages(1, limitSize, type); +} + +function reloadData() { + pages(pageNum, limitSize); +} + +// 修改用户 +function addData(id) { + let title = "修改"; + let param = { + id: id, + proId: idParam, + }; + openIframe2( + "addDataRopeway", + title, + "ropewayFormTemp.html", + "1000px", + "625px", + param + ); +} + +// 新增索道 +function addDataRopeway(id) { + let title = "新增"; + let param = { + id: id, + proId: idParam, + }; + openIframe2( + "addDataRopeway", + title, + "ropewayFormTemp.html", + "1000px", + "625px", + param + ); +} + +// 新增公路 +function addHighway(id) { + let title = "新增公路"; + let param = { + id: id, + proId: idParam, + }; + openIframe2( + "addDataRopeway", + title, + "addAndEditHighway.html", + "1000px", + "625px", + param + ); +} + +// 新增千张场地 +function addQzSite(id) { + let title = "新增千张场地"; + let param = { + id: id, + proId: idParam, + }; + openIframe2( + "addDataRopeway", + title, + "addAndEditQzSite.html", + "1000px", + "625px", + param + ); +} + +/*删除用户*/ +function delData(id) { + layer.confirm( + "确定删除吗?", + { + move: false, + }, + function () { + let loadingMsg = layer.msg("数据删除中,请稍候...", { + icon: 16, + scrollbar: false, + time: 0, + }); + let url = dataUrl + "/tbCablewaTrans/delTbCablewaTrans"; + let params = { + id: id, + }; + params = { + encryptedData: encryptCBC(JSON.stringify(params)), + }; + ajaxRequest( + url, + "POST", + params, + true, + function () {}, + function (result) { + layer.close(loadingMsg); // 关闭提示层 + if (result.code === 200) { + layer.msg(result.msg, { icon: 1 }); + setTimeout(function () { + parent.reloadData(); + query(); + }, 1000); + } else if (result.code === 500) { + layer.alert(result.msg, { icon: 2 }); + } + }, + function (xhr) { + layer.close(loadingMsg); // 关闭提示层 + error(xhr); + } + ); + } + ); +} + +function exportRopeway() { + let obj = { + keyWord: $("#keyWord").val(), + proId: idParam, + }; + let params = { + encryptedData: encryptCBC(JSON.stringify(obj)), + }; + let loadingMsg = layer.msg("数据导出中,请稍候...", { + icon: 16, + scrollbar: false, + time: 0, + }); + let url = + dataUrl + + "/tbCablewaTrans/tbCablewaTransExport?token=" + + tokens + + "&encryptedData=" + + encodeURIComponent(encryptCBC(JSON.stringify(obj))); + let xhr = new XMLHttpRequest(); + xhr.open("post", url, true); + xhr.responseType = "blob"; // 转换流 + xhr.setRequestHeader("Content-Type", "application/json;charset=UTF-8"); + xhr.onload = function () { + layer.close(loadingMsg); + if (this.status === 200) { + let blob = this.response; + var a = document.createElement("a"); + var url = window.URL.createObjectURL(blob); + a.href = url; + a.download = "索道运输" + ".xlsx"; // 文件名 + } else { + layer.msg("数据导出发生异常,请稍后重试", { + icon: 16, + scrollbar: false, + time: 2000, + }); + } + a.click(); + window.URL.revokeObjectURL(url); + }; + // xhr.send(params); + xhr.send(); +} diff --git a/src/main/resources/static/js/basic/lineManagement/child/qzSiteList.js b/src/main/resources/static/js/basic/lineManagement/child/qzSiteList.js new file mode 100644 index 0000000..ba61150 --- /dev/null +++ b/src/main/resources/static/js/basic/lineManagement/child/qzSiteList.js @@ -0,0 +1,375 @@ +let form, layer, table, tableIns, idParam; +let pageNum = 1, + limitSize = 10; // 默认第一页,分页数量为10 + +function setParams(params) { + idParam = JSON.parse(params).id; + layui.use(["form", "layer", "table", "laydate"], function () { + form = layui.form; + layer = layui.layer; + table = layui.table; + layui.form.render(); + pages(1, 10, 1); + }); +} + +function pages(pageNum, pageSize, typeNum) { + let params = getReqParams(pageNum, pageSize, typeNum); + let url = dataUrl + "/tbCablewaTrans/tbCablewaTransList"; + ajaxRequest( + url, + "POST", + params, + true, + function () {}, + function (result) { + console.log(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: "towerName", + // title: "索道终点所在杆塔", + // unresize: true, + // align: "center", + // }, + // { + // field: "cablewayLength", + // title: "索道长度(km)", + // unresize: true, + // align: "center", + // }, + // { + // field: "maxHeight", + // title: "最大载重(kg)", + // unresize: true, + // align: "center", + // }, + // { + // field: "safetyDistance", + // title: "安全距离(m)", + // unresize: true, + // align: "center", + // }, + // { + // field: "maxSlope", + // title: "最大坡度", + // unresize: true, + // align: "center", + // }, + // { + // field: "cablewayWidth", + // title: "索道宽度(m)", + // unresize: true, + // align: "center", + // }, + { + field: "qzSiteName", + title: "名称", + unresize: true, + align: "center", + }, + { + field: "qzSiteLength", + title: "长(m)", + unresize: true, + align: "center", + }, + { + field: "highwayWidth", + title: "宽(m)", + unresize: true, + align: "center", + }, + + { + title: "操作", + unresize: true, + width: 200, + align: "center", + templet: function (d) { + let html = ""; + let del = + "删除"; + let edit = + "修改"; + html = edit + del; + if (d.delFlag == 1) { + return ""; + } + return html; + }, + }, + ], + ], + 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 === 2) { + $("#keyWord").val(""); + layui.form.render(); + } + obj = { + page: page + "", + limit: limit + "", + proId: idParam, + keyWord: $("#keyWord").val(), + }; + console.log("杆塔管理查询条件", obj); + obj = { + encryptedData: encryptCBC(JSON.stringify(obj)), + }; + return obj; +} + +// 查询/重置 +function query(type) { + pageNum = 1; + if (type === 2) { + $("#keyWord").val(""); + layui.form.render(); + } + pages(1, limitSize, type); +} + +function reloadData() { + pages(pageNum, limitSize); +} + +// 修改用户 +function addData(id) { + let title = "修改"; + let param = { + id: id, + proId: idParam, + }; + openIframe2( + "addDataRopeway", + title, + "ropewayFormTemp.html", + "1000px", + "625px", + param + ); +} + +// 新增索道 +function addDataRopeway(id) { + let title = "新增"; + let param = { + id: id, + proId: idParam, + }; + openIframe2( + "addDataRopeway", + title, + "ropewayFormTemp.html", + "1000px", + "625px", + param + ); +} + +// 新增公路 +function addHighway(id) { + let title = "新增公路"; + let param = { + id: id, + proId: idParam, + }; + openIframe2( + "addDataRopeway", + title, + "addAndEditHighway.html", + "1000px", + "625px", + param + ); +} + +// 新增千张场地 +function addQzSite(id) { + let title = "新增千张场地"; + let param = { + id: id, + proId: idParam, + }; + openIframe2( + "addDataRopeway", + title, + "addAndEditQzSite.html", + "1000px", + "625px", + param + ); +} + +/*删除用户*/ +function delData(id) { + layer.confirm( + "确定删除吗?", + { + move: false, + }, + function () { + let loadingMsg = layer.msg("数据删除中,请稍候...", { + icon: 16, + scrollbar: false, + time: 0, + }); + let url = dataUrl + "/tbCablewaTrans/delTbCablewaTrans"; + let params = { + id: id, + }; + params = { + encryptedData: encryptCBC(JSON.stringify(params)), + }; + ajaxRequest( + url, + "POST", + params, + true, + function () {}, + function (result) { + layer.close(loadingMsg); // 关闭提示层 + if (result.code === 200) { + layer.msg(result.msg, { icon: 1 }); + setTimeout(function () { + parent.reloadData(); + query(); + }, 1000); + } else if (result.code === 500) { + layer.alert(result.msg, { icon: 2 }); + } + }, + function (xhr) { + layer.close(loadingMsg); // 关闭提示层 + error(xhr); + } + ); + } + ); +} + +function exportRopeway() { + let obj = { + keyWord: $("#keyWord").val(), + proId: idParam, + }; + let params = { + encryptedData: encryptCBC(JSON.stringify(obj)), + }; + let loadingMsg = layer.msg("数据导出中,请稍候...", { + icon: 16, + scrollbar: false, + time: 0, + }); + let url = + dataUrl + + "/tbCablewaTrans/tbCablewaTransExport?token=" + + tokens + + "&encryptedData=" + + encodeURIComponent(encryptCBC(JSON.stringify(obj))); + let xhr = new XMLHttpRequest(); + xhr.open("post", url, true); + xhr.responseType = "blob"; // 转换流 + xhr.setRequestHeader("Content-Type", "application/json;charset=UTF-8"); + xhr.onload = function () { + layer.close(loadingMsg); + if (this.status === 200) { + let blob = this.response; + var a = document.createElement("a"); + var url = window.URL.createObjectURL(blob); + a.href = url; + a.download = "索道运输" + ".xlsx"; // 文件名 + } else { + layer.msg("数据导出发生异常,请稍后重试", { + icon: 16, + scrollbar: false, + time: 2000, + }); + } + a.click(); + window.URL.revokeObjectURL(url); + }; + // xhr.send(params); + xhr.send(); +} diff --git a/src/main/resources/static/pages/basic/lineManagement/child/highwayList.html b/src/main/resources/static/pages/basic/lineManagement/child/highwayList.html new file mode 100644 index 0000000..5ec4e68 --- /dev/null +++ b/src/main/resources/static/pages/basic/lineManagement/child/highwayList.html @@ -0,0 +1,61 @@ + + + +
+ + + + + + + + + + +