From f70c2f8892e6674f10822a0e1906c80ad4c0de06 Mon Sep 17 00:00:00 2001 From: 13693261870 <252740454@qq.com> Date: 星期四, 01 十二月 2022 20:40:50 +0800 Subject: [PATCH] 1 --- ExportMap/up.html | 354 +++++++++++++++++++++++++++++++++++++++++++++++----------- 1 files changed, 285 insertions(+), 69 deletions(-) diff --git a/ExportMap/up.html b/ExportMap/up.html index 301b67d..3156ddd 100644 --- a/ExportMap/up.html +++ b/ExportMap/up.html @@ -4,15 +4,18 @@ <title>涓婁紶鎺ュ彛娴嬭瘯</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <script src="js/jquery.1.12.4.js"></script> + <script src="js/rsa.min.js"></script> + <script src="js/rollups.js"></script> <script> - var data = null; - var path = "20221119094847"; + var app = {}; + var path = "20221128010101"; var url = "http://127.0.0.1:12316/"; - var token = "5e8b731c-0d9b-45d5-8781-23fd3bb8f526"; + var token = "c0014676-76e2-477e-9cc7-75c08e985737"; $(function () { $("#pathSpan").html(path); $("#tokenSpan").html(token); + getPublicKey(); }); // Ajax @@ -37,53 +40,12 @@ function getUrl(method) { return url + method + "?token=" + token; } - </script> - <script> - // 涓嬭浇鍦板浘 * - function downloadMap(guid) { - var a = document.createElement('a'); // 鍒涘缓a鏍囩 - a.style.display = 'none'; // 璁剧疆涓嶅彲瑙� - a.href = getUrl("mark/downloadFile") + "&guid=" + guid; - document.body.appendChild(a); // 鍔犲叆 - a.click(); // 瑙﹀彂鐐瑰嚮 - document.body.removeChild(a); // 閲婃斁 - } - - // 涓婁紶鏁版嵁 * - function uploadData() { - var formData = new FormData(); - var fs = document.getElementById("file1"); - for (var i = 0, c = fs.files.length; i < c; i++) { - formData.append(fs.files[i].name, fs.files[i]); // fs.files[i].name,file - } - formData.append("name", "娴嬭瘯"); - formData.append("dirid", "10"); - formData.append("depid", "1"); - formData.append("verid", "1"); - formData.append("type", "gdb"); - formData.append("cs", "CGCS 2000"); - formData.append("scale", "1:1000"); - formData.append("resolution", "0.5m"); - formData.append("gather", "2022-10-03 15:00:00"); - formData.append("descr", ""); - - $.ajax(getUrl("uploader/uploadData") + "&path=" + path, { - type: "post", - data: formData, - async: true, - cache: false, - processData: false, - contentType: false, - success: function (rs) { - alert("code = " + rs.code + ", msg = " + rs.msg + ", result = " + rs.result); - if (rs.code == 200 && rs.result != null) { - rs = rs.result; - } - console.log(rs); - }, - error: function (e) { - console.error(e); + function getPublicKey() { + $.get(url + "sign/getPublicKey", function (rs) { + if (rs && rs.code == 200) { + window.encrypt = new JSEncrypt(); + encrypt.setPublicKey(rs.result); } }); } @@ -122,24 +84,24 @@ ajax(getUrl("dataUpload/selectFiles") + "&path=" + path, "GET", null, null, null, function (rs) { console.log(rs); alert("code = " + rs.code + ", msg = " + rs.msg + ", result = " + rs.result); - data = rs.result; + app.data = rs.result; }); } // 鍒犻櫎鏂囦欢 function deleteFiles() { - if (data == null) return; + if (app.data == null) return; - ajax(getUrl("dataUpload/deleteFiles"), "POST", JSON.stringify([data[0]]), null, null, function (rs) { + ajax(getUrl("dataUpload/deleteFiles"), "POST", JSON.stringify([app.data[0]]), null, null, function (rs) { console.log(rs); alert("code = " + rs.code + ", msg = " + rs.msg + ", result = " + rs.result); selectFiles(); }); } - + // 鏂囦欢鍏ュ簱 function insertFiles() { - if (data == null) return; + if (app.data == null) return; var obj = { metaEntity: { @@ -153,12 +115,12 @@ gather: "2022-10-03 15:00:00", descr: "娴嬭瘯鏂囦欢涓婁紶", }, - fileEntities: data + fileEntities: app.data }; ajax(getUrl("dataUpload/insertFiles"), "POST", JSON.stringify(obj), null, null, function (rs) { console.log(rs); - data = null; + app.data = null; alert("code = " + rs.code + ", msg = " + rs.msg + ", result = " + rs.result); }); } @@ -197,13 +159,13 @@ ajax(getUrl("dataLoader/selectFiles") + "&path=" + path, "GET", null, null, null, function (rs) { console.log(rs); alert("code = " + rs.code + ", msg = " + rs.msg + ", result = " + rs.result); - data = rs.result; + app.data = rs.result; }); } // 鍒犻櫎鏂囦欢 function deleteFiles2() { - if (data == null) return; + if (app.data == null) return; ajax(getUrl("dataLoader/deleteFiles"), "POST", JSON.stringify([data[0]]), null, null, function (rs) { console.log(rs); @@ -212,9 +174,20 @@ }); } + // 璇诲彇鏄犲皠 + function readMappers() { + ajax(getUrl("dataLoader/selectMappers") + "&path=" + path, "GET", null, null, null, function (rs) { + console.log(rs); + alert("code = " + rs.code + ", msg = " + rs.msg + ", result = " + rs.result); + if (rs.code == 200) { + app.mappers = rs.result; + } + }); + } + // Xls鍏ュ簱 function insertXls() { - if (data == null) return; + if (app.data == null) return; var obj = { metaEntity: { @@ -228,41 +201,284 @@ gather: "2022-10-05 15:00:00", descr: "娴嬭瘯Xls", }, - fileEntities: data, + fileEntities: app.data, tabEntities: [ - { fileName: "2-2 绠$嚎鎴愭灉琛�.xlsx", tab: null, entity: "ddGdcg" }, - { fileName: "娴峰師鍘夸腑绾挎垚鏋滆〃.xlsx", tab: null, entity: "mdZxcg" } + { filename: "2-2 绠$嚎鎴愭灉琛�.xlsx", subPath: "20221128010101\2-2 绠$嚎鎴愭灉琛�.xlsx", tab: null, entity: "mdGdcg", type: "xls" }, + { filename: "娴峰師鍘夸腑绾挎垚鏋滆〃.xlsx", subPath: "20221128010101\娴峰師鍘夸腑绾挎垚鏋滆〃.xlsx", tab: null, entity: "mdZxcg", type: "xls" } ] }; ajax(getUrl("dataLoader/insertFiles"), "POST", JSON.stringify(obj), null, null, function (rs) { console.log(rs); - data = null; + app.data = null; alert("code = " + rs.code + ", msg = " + rs.msg + ", result = " + rs.result); }); + } + + // Shp鍏ュ簱 + function insertShps() { + if (app.data == null) return; + + var obj = { + metaEntity: { + depid: 1, + dirid: 10, + verid: 0, + //type: "file", + //cs: "CGCS 2000", + //scale: "1:1000", + //resolution: "0.5m", + gather: "2022-10-05 15:00:00", + descr: "娴嬭瘯Xls", + }, + fileEntities: app.data, + tabEntities: [ + { + "entity": "dlg25wboul", + "fileName": "test.shp.zip", + "subPath": "20221128010101_zip\\test.shp\\pgShp\\dlg_25w_boul.shp", + "tab": "dlg_25w_boul.shp", + "type": "shp" + }, + { + "entity": "dlg25wresa", + "fileName": "test.shp.zip", + "subPath": "20221128010101_zip\\test.shp\\pgShp\\dlg_25w_resa.shp", + "tab": "dlg_25w_resa.shp", + "type": "shp" + }, + { + "entity": "dlgagnp", + "fileName": "test.shp.zip", + "subPath": "20221128010101_zip\\test.shp\\pgShp\\dlg_agnp.shp", + "tab": "dlg_agnp.shp", + "type": "shp" + }] + }; + + ajax(getUrl("dataLoader/insertFiles"), "POST", JSON.stringify(obj), null, null, function (rs) { + console.log(rs); + app.data = null; + alert("code = " + rs.code + ", msg = " + rs.msg + ", result = " + rs.result); + }); + } + + // GDB鍏ュ簱 + function insertGdb() { + if (app.data == null) return; + + var obj = { + metaEntity: { + depid: 1, + dirid: 10, + verid: 0, + //type: "file", + //cs: "CGCS 2000", + //scale: "1:1000", + //resolution: "0.5m", + gather: "2022-10-05 15:00:00", + descr: "娴嬭瘯Xls", + }, + fileEntities: app.data, + tabEntities: [ + { + "entity": "dlg25wboul", + "fileName": "test.gdb.zip", + "subPath": "20221128010101_zip\\test.gdb\\pg.gdb", + "tab": "dlg_25w_boul", + "type": "gdb" + }, + { + "entity": "dlg25wresa", + "fileName": "test.gdb.zip", + "subPath": "20221128010101_zip\\test.gdb\\pg.gdb", + "tab": "dlg_25w_resa", + "type": "gdb" + }, + { + "entity": "dlgagnp", + "fileName": "test.gdb.zip", + "subPath": "20221128010101_zip\\test.gdb\\pg.gdb", + "tab": "dlg_agnp", + "type": "gdb" + }] + }; + + ajax(getUrl("dataLoader/insertFiles"), "POST", JSON.stringify(obj), null, null, function (rs) { + console.log(rs); + app.data = null; + alert("code = " + rs.code + ", msg = " + rs.msg + ", result = " + rs.result); + }); + } + + // MDB + function insertMdb() { + if (app.data == null) return; + + var obj = { + metaEntity: { + depid: 1, + dirid: 10, + verid: 0, + //type: "file", + //cs: "CGCS 2000", + //scale: "1:1000", + //resolution: "0.5m", + gather: "2022-10-05 15:00:00", + descr: "娴嬭瘯Xls", + }, + fileEntities: app.data, + tabEntities: [ + { + "entity": "dlg25wboul", + "fileName": "test.mdb", + "subPath": "20221128010101\\test.mdb", + "tab": "dlg_25w_boul", + "type": "mdb" + }, + { + "entity": "dlg25wresa", + "fileName": "test.mdb", + "subPath": "20221128010101\\test.mdb", + "tab": "dlg_25w_resa", + "type": "mdb" + }/*, + { + "entity": "dlgagnp", + "fileName": "test.mdb", + "subPath": "20221128010101\\test.mdb", + "tab": "dlg_agnp", + "type": "mdb" + }*/] + }; + + ajax(getUrl("dataLoader/insertFiles"), "POST", JSON.stringify(obj), null, null, function (rs) { + console.log(rs); + app.data = null; + alert("code = " + rs.code + ", msg = " + rs.msg + ", result = " + rs.result); + }); + } + </script> + <script> + function uploadAttach() { + var formData = new FormData(); + var fs = document.getElementById("file3"); + if (fs.files.length == 0) { + alert("璇烽�夋嫨瑕佷笂浼犵殑鏂囦欢锛�"); + return; + } + for (var i = 0, c = fs.files.length; i < c; i++) { + formData.append("file", fs.files[i]); // fs.files[i].name,file + } + + $.ajax(getUrl("dataQuery/uploadFiles") + "&tabName=lf.sys_style&eventid=fa25979a5ef8b43ba82a0be35b3fb0d4", { + type: "post", + data: formData, + async: true, + cache: false, + processData: false, + contentType: false, + success: function (rs) { + console.log(rs); + document.getElementById("file3").value = ""; + alert("code = " + rs.code + ", msg = " + rs.msg + ", result = " + rs.result); + }, + error: function (e) { + console.error(e); + document.getElementById("file3").value = ""; + alert("涓婁紶鏂囦欢澶辫触锛�"); + } + }); + } + </script> + <script> + function downloadReq() { + var obj = { + pwd: encrypt.encrypt("Test!321&456"), + ids: [113, 120, 121, 122] + }; + + ajax(getUrl("meta/downloadReq"), "POST", JSON.stringify(obj), null, null, function (rs) { + console.log(rs); + alert("code = " + rs.code + ", msg = " + rs.msg + ", result = " + rs.result); + }); + } + + function selectDownloadFile() { + var guid = "e7d7161a4bf2b78b460f0ebcf5bcc83c"; // "5ce046cc05b186332775c03ac6792caf"; + var pwd = encodeURIComponent(encrypt.encrypt("Test!321&456")); // Admin@123 + + ajax(getUrl("meta/selectDownloadFile") + "&guid=" + guid + "&pwd=" + pwd, "GET", null, null, null, function (rs) { + console.log(rs); + //alert("code = " + rs.code + ", msg = " + rs.msg + ", result = " + rs.result); + if (rs.code != 200 || !rs.result) { + alert(rs.msg); + return; + } + + downloadFile(guid, pwd); + }); + } + + function downloadFile(guid, pwd) { + //var a = document.createElement('a'); + //a.style.display = 'none'; + //a.href = getUrl("meta/downloadFile") + "&guid=" + guid + "&pwd=" + encodeURIComponent(encrypt.encrypt("Admin@123")); + + //document.body.appendChild(a); + //a.click(); + //document.body.removeChild(a); + + var url = getUrl("meta/downloadFile") + "&guid=" + guid + "&pwd=" + pwd; + $("#downFrame").attr("src", url).click(); } </script> </head> <body> <form id="upForm" name="upForm" method="post" enctype="multipart/form-data" action="http://127.0.0.1:12316/file/upload"> 涓婁紶璺緞锛�<span id="pathSpan"></span>锛屽綋鍓嶄护鐗岋細<span id="tokenSpan"></span> - <hr /><br /><br /> + <hr /> + <br /> + <br /> 鏁版嵁涓婁紶锛� - <input id="file1" name="file1" type="file" multiple="multiple" /> + <input id="file1" type="file" multiple="multiple" /> <input value="涓婁紶鏂囦欢" type="button" onclick="uploadFiles();" /> <input value="鏌ヨ鏂囦欢" type="button" onclick="selectFiles();" /> <input value="鍒犻櫎鏂囦欢" type="button" onclick="deleteFiles();" /> <input value="鏂囦欢鍏ュ簱" type="button" onclick="insertFiles();" /> - <hr /><br /><br /> + <hr /> + <br /> + <br /> - 鏁版嵁鍏ュ簱锛� - <input id="file2" name="file2" type="file" multiple="multiple" accept=".xls,.xlsx,.mdb,.shp.zip,.gdb.zip" /> + 鏁版嵁鍏ュ簱锛� + <input id="file2" type="file" multiple="multiple" accept=".xls,.xlsx,.mdb,.shp.zip,.gdb.zip" /> <input value="涓婁紶鏂囦欢" type="button" onclick="uploadFiles2();" /> <input value="鏌ヨ鏂囦欢" type="button" onclick="selectFiles2();" /> <input value="鍒犻櫎鏂囦欢" type="button" onclick="deleteFiles2();" /> + <input value="璇诲彇鏄犲皠" type="button" onclick="readMappers();" /> <input value="Xls鍏ュ簱" type="button" onclick="insertXls();" /> - <hr /><br /><br /> + <input value="Shp鍏ュ簱" type="button" onclick="insertShps();" /> + <input value="Gdb鍏ュ簱" type="button" onclick="insertGdb();" /> + <input value="Mdb鍏ュ簱" type="button" onclick="insertMdb();" /> + <hr /> + <br /> + <br /> + + 鏁版嵁妫�绱細 + <input id="file3" type="file" multiple="multiple" /> + <input value="涓婁紶闄勪欢" type="button" onclick="uploadAttach();" /> + <hr /> + <br /> + <br /> + + 鍏冩暟鎹細 + <input value="璇锋眰涓嬭浇" type="button" onclick="downloadReq();" /> + <input value="涓嬭浇鏂囦欢" type="button" onclick="selectDownloadFile();" /> + <iframe id="downFrame" src="" style="display: none; border: 0; padding: 0; height: 0; width: 0"></iframe> + <hr /> + <br /> + <br /> </form> <br /> <br /> -- Gitblit v1.9.3