diff --git a/src/main/resources/static/js/basic/lineManagement/child/ropewayList.js b/src/main/resources/static/js/basic/lineManagement/child/ropewayList.js index f9aefe0..b879d56 100644 --- a/src/main/resources/static/js/basic/lineManagement/child/ropewayList.js +++ b/src/main/resources/static/js/basic/lineManagement/child/ropewayList.js @@ -1,62 +1,72 @@ -let form, layer, table, tableIns,idParam; -let pageNum = 1, limitSize = 10; // 默认第一页,分页数量为10 +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 () { + 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) + 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 }); } - } else if (result.code === 500) { - layer.alert(result.msg, {icon: 2}) + }, + function (xhr) { + error(xhr); } - }, function (xhr) { - error(xhr) - }); - + ); } function laypages(total, page, limit) { - layui.use(['laypage'], function () { + layui.use(["laypage"], function () { let laypage = layui.laypage; laypage.render({ - elem: 'voi-page', + elem: "voi-page", count: total, curr: page, limit: limit, limits: [10, 20, 50, 100, 200, 500], - layout: ['prev', 'page', 'next', 'skip', 'count', 'limit'], + layout: ["prev", "page", "next", "skip", "count", "limit"], groups: 5, jump: function (obj, first) { if (!first) { - pageNum = obj.curr, limitSize = obj.limit; + (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,}); + let loadingMsg = layer.msg("数据加载中,请稍候...", { + icon: 16, + scrollbar: false, + time: 0, + }); tableIns = table.render({ elem: "#table_data", height: "full-130", @@ -66,70 +76,119 @@ function initTable(dataList, limit, page) { [ //表头 { - title: "序号", width: 80, unresize: true, align: "center", + 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"}, { - title: "操作", unresize: true, width: 200, align: "center", + 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", + }, + { + title: "操作", + unresize: true, + width: 200, + align: "center", templet: function (d) { - let html = ''; - let del = "删除" - let edit = "修改"; + let html = ""; + let del = + "删除"; + let edit = + "修改"; html = edit + del; if (d.delFlag == 1) { - return ''; + 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"); + 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('') + $("#keyWord").val(""); layui.form.render(); } obj = { page: page + "", limit: limit + "", proId: idParam, - keyWord: $('#keyWord').val() + keyWord: $("#keyWord").val(), + }; + console.log("杆塔管理查询条件", obj); + obj = { + encryptedData: encryptCBC(JSON.stringify(obj)), }; - console.log("杆塔管理查询条件", obj) - obj={ - encryptedData:encryptCBC(JSON.stringify(obj)) - } return obj; } // 查询/重置 function query(type) { pageNum = 1; - if(type === 2){ - $('#keyWord').val('') + if (type === 2) { + $("#keyWord").val(""); layui.form.render(); } - pages(1, limitSize,type); + pages(1, limitSize, type); } function reloadData() { @@ -138,69 +197,117 @@ function reloadData() { // 修改用户 function addData(id) { - let title = '修改' + let title = "修改"; let param = { - 'id': id, - 'proId':idParam - } - openIframe2("addDataRopeway", title, "ropewayFormTemp.html", '1000px', '625px', param); + id: id, + proId: idParam, + }; + openIframe2( + "addDataRopeway", + title, + "ropewayFormTemp.html", + "1000px", + "625px", + param + ); } function addDataRopeway(id) { - let title = '新增' + let title = "新增"; let param = { - 'id': id, - 'proId':idParam - } - openIframe2("addDataRopeway", title, "ropewayFormTemp.html", '1000px', '625px', 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, "ropewayFormTemp.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 + 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); + } + ); } - 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(){ +function exportRopeway() { let obj = { - keyWord: $('#keyWord').val(), - proId: idParam - } + 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))); + 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.setRequestHeader("Content-Type", "application/json;charset=UTF-8"); xhr.onload = function () { layer.close(loadingMsg); if (this.status === 200) { @@ -210,11 +317,15 @@ function exportRopeway(){ a.href = url; a.download = "索道运输" + ".xlsx"; // 文件名 } else { - layer.msg("数据导出发生异常,请稍后重试", {icon: 16, scrollbar: false, time: 2000}); + layer.msg("数据导出发生异常,请稍后重试", { + icon: 16, + scrollbar: false, + time: 2000, + }); } a.click(); window.URL.revokeObjectURL(url); }; // xhr.send(params); xhr.send(); -} \ No newline at end of file +} diff --git a/src/main/resources/static/pages/basic/lineManagement/child/lineFormTemp.html b/src/main/resources/static/pages/basic/lineManagement/child/lineFormTemp.html index c4a3e75..3e24f57 100644 --- a/src/main/resources/static/pages/basic/lineManagement/child/lineFormTemp.html +++ b/src/main/resources/static/pages/basic/lineManagement/child/lineFormTemp.html @@ -1,10 +1,11 @@ +
- + @@ -51,7 +52,8 @@ } /* 输入框样式 */ - .layui-input, .layui-select { + .layui-input, + .layui-select { width: 100%; } @@ -60,115 +62,123 @@ color: red; margin-right: 5px; } - .dtree-select{ + + .dtree-select { width: 34.8%; } + -