| | |
| | | <script src="js/jquery.1.12.4.js"></script> |
| | | <script src="js/rsa.min.js"></script> |
| | | <script src="js/rollups.js"></script> |
| | | <script src="js/insertFiles.js"></script> |
| | | <script> |
| | | var app = {}; |
| | | var path = "20221128010101"; |
| | | var path = "20230127"; |
| | | var url = "http://127.0.0.1:12316/server/"; |
| | | var token = "89248366-eb18-404f-a874-d0f94f84b832"; |
| | | var token = "dca04924-122a-4b1a-88b7-aca0c4a7ba47"; |
| | | |
| | | $(function () { |
| | | $("#pathSpan").html(path); |
| | |
| | | } |
| | | </script> |
| | | <script> |
| | | // 查询目录 |
| | | function selectPath() { |
| | | ajax(getUrl("dataUpload/selectPath"), "GET", null, null, null, function (rs) { |
| | | console.log(rs); |
| | | alert("code = " + rs.code + ", msg = " + rs.msg + ", result = " + rs.result); |
| | | path = rs.result; |
| | | }); |
| | | } |
| | | |
| | | // 上传文件 |
| | | function uploadFiles() { |
| | | var formData = new FormData(); |
| | |
| | | function deleteFiles() { |
| | | if (app.data == null) return; |
| | | |
| | | 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 (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-03 15:00:00", |
| | | descr: "测试文件上传", |
| | | }, |
| | | fileEntities: app.data |
| | | }; |
| | | |
| | | ajax(getUrl("dataUpload/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 uploadFiles2() { |
| | | 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 |
| | | } |
| | | |
| | | $.ajax(getUrl("dataLoader/uploadFiles") + "&path=" + path, { |
| | | type: "post", |
| | | data: formData, |
| | | async: true, |
| | | cache: false, |
| | | processData: false, |
| | | contentType: false, |
| | | success: function (rs) { |
| | | document.getElementById("file1").value = ""; |
| | | console.log(rs); |
| | | alert("code = " + rs.code + ", msg = " + rs.msg + ", result = " + rs.result); |
| | | }, |
| | | error: function (e) { |
| | | document.getElementById("file1").value = ""; |
| | | console.error(e); |
| | | alert("上传文件失败!"); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | // 查询文件 |
| | | function selectFiles2() { |
| | | 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); |
| | | app.data = rs.result; |
| | | }); |
| | | } |
| | | |
| | | // 删除文件 |
| | | function deleteFiles2() { |
| | | if (app.data == null) return; |
| | | |
| | | ajax(getUrl("dataLoader/deleteFiles"), "POST", JSON.stringify([data[0]]), null, null, function (rs) { |
| | | ajax(getUrl("dataUpload/deleteFiles"), "POST", JSON.stringify([data[0]]), null, null, function (rs) { |
| | | console.log(rs); |
| | | alert("code = " + rs.code + ", msg = " + rs.msg + ", result = " + rs.result); |
| | | selectFiles(); |
| | |
| | | |
| | | // 读取映射 |
| | | function readMappers() { |
| | | ajax(getUrl("dataLoader/selectMappers") + "&path=" + path, "GET", null, null, null, function (rs) { |
| | | ajax(getUrl("dataUpload/selectMappers") + "&path=" + path + "&dirid=163&verid=0&epsgCode=EPSG:4490", "GET", null, null, null, function (rs) { |
| | | console.log(rs); |
| | | alert("code = " + rs.code + ", msg = " + rs.msg + ", result = " + rs.result); |
| | | if (rs.code == 200) { |
| | |
| | | }); |
| | | } |
| | | |
| | | // Xls入库 |
| | | // Xls入库 * |
| | | function insertXls() { |
| | | if (app.data == null) return; |
| | | |
| | |
| | | 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"); |
| | |
| | | alert("code = " + rs.code + ", msg = " + rs.msg + ", result = " + rs.result); |
| | | }); |
| | | } |
| | | |
| | | // 综合数据入库 |
| | | function insertAllFiles() { |
| | | ajax(getUrl("dataUpload/insertFiles"), "POST", JSON.stringify(metaFiles), null, null, function (rs) { |
| | | console.log(rs); |
| | | alert("code = " + rs.code + ", msg = " + rs.msg + ", result = " + rs.result); |
| | | }); |
| | | } |
| | | |
| | | // 多文件入库 |
| | | function insertMultiFiles() { |
| | | if (!app.mappers) return; |
| | | ajax(getUrl("dataUpload/insertFiles"), "POST", JSON.stringify(app.mappers), null, null, function (rs) { |
| | | console.log(rs); |
| | | app.mappers = null; |
| | | alert("code = " + rs.code + ", msg = " + rs.msg + ", result = " + rs.result); |
| | | }); |
| | | } |
| | | |
| | | // 挂载附件 |
| | | function uploadAnnex() { |
| | | var formData = new FormData(); |
| | | var fs = document.getElementById("file1"); |
| | | 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 |
| | | } |
| | | formData.append("ids", 1209); |
| | | formData.append("ids", 1180); |
| | | formData.append("ids", 1387); |
| | | |
| | | //$.ajax(getUrl("dataUpload/uploadXlsAnnex") + "&path=" + path + "&ids=1209&ids=1180&ids=1387", { |
| | | $.ajax(getUrl("dataUpload/uploadXlsAnnex") + "&path=" + path, { |
| | | type: "post", |
| | | data: formData, |
| | | async: true, |
| | | cache: false, |
| | | processData: false, |
| | | contentType: false, |
| | | success: function (rs) { |
| | | console.log(rs); |
| | | document.getElementById("file1").value = ""; |
| | | alert("code = " + rs.code + ", msg = " + rs.msg + ", result = " + rs.result); |
| | | }, |
| | | error: function (e) { |
| | | console.error(e); |
| | | document.getElementById("file3").value = ""; |
| | | alert("上传文件失败!"); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | // 空间数据入库 |
| | | function insertDbFiles() { |
| | | ajax(getUrl("dataUpload/insertFiles"), "POST", JSON.stringify(dbFiles), null, null, function (rs) { |
| | | console.log(rs); |
| | | alert("code = " + rs.code + ", msg = " + rs.msg + ", result = " + rs.result); |
| | | }); |
| | | } |
| | | |
| | | // 请求管线分析 |
| | | function selectPipeAnalysis() { |
| | | var data = { |
| | | gid: 24, |
| | | tabs: ["bd.dlg_25w_hydl", "bd.dlg_25w_lrdl", "bd.dlg_25w_lrrl", "bd.dlg_25w_hyda"] |
| | | }; |
| | | ajax(getUrl("pipeline/selectPipeAnalysis"), "POST", JSON.stringify(data), null, null, function (rs) { |
| | | console.log(rs); |
| | | alert("code = " + rs.code + ", msg = " + rs.msg + ", result = " + rs.result); |
| | | }); |
| | | } |
| | | |
| | | // 管线分析结果下载 |
| | | function downloadPipeAnalysis() { |
| | | var data = { |
| | | pwd: encrypt.encrypt("Test!321&456"), |
| | | gid: 24, |
| | | tabs: ["bd.dlg_25w_hydl", "bd.dlg_25w_lrdl", "bd.dlg_25w_lrrl", "bd.dlg_25w_hyda"] |
| | | }; |
| | | ajax(getUrl("pipeline/downloadReq"), "POST", JSON.stringify(data), null, null, function (rs) { |
| | | console.log(rs); |
| | | alert("code = " + rs.code + ", msg = " + rs.msg + ", result = " + rs.result); |
| | | }); |
| | | } |
| | | </script> |
| | | </head> |
| | | <body> |
| | |
| | | <hr /> |
| | | <br /> |
| | | |
| | | 数据上传: |
| | | <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 /> |
| | | |
| | | 数据入库: |
| | | <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();" /> |
| | | <input value="Shp入库" type="button" onclick="insertShps();" /> |
| | | <input value="Gdb入库" type="button" onclick="insertGdb();" /> |
| | | <input value="Mdb入库" type="button" onclick="insertMdb();" /> |
| | | <input id="file1" type="file" multiple="multiple" accept=".xls,.xlsx,.mdb,.zip" /> |
| | | <input value="查询目录 *" type="button" onclick="selectPath();" /> |
| | | <input value="上传文件" type="button" onclick="uploadFiles();" /> |
| | | <input value="查询文件 *" type="button" onclick="selectFiles();" /> |
| | | <input value="删除文件" type="button" onclick="deleteFiles();" /> |
| | | <!--<input value="Xls入库" type="button" onclick="insertXls();" />--> |
| | | <input value="读取映射 *" type="button" onclick="readMappers();" /> |
| | | <input value="综合数据入库 *" type="button" onclick="insertAllFiles();" /> |
| | | <input value="空间数据入库 *" type="button" onclick="insertDbFiles();" /> |
| | | <input value="多文件入库 *" type="button" onclick="insertMultiFiles();" /> |
| | | <input value="挂载附件 *" type="button" onclick="uploadAnnex();" /> |
| | | <hr /> |
| | | <br /> |
| | | |
| | |
| | | 数据申请: |
| | | <input value="查询DB中溢出的单位ID" type="button" onclick="selectDbOverflowDep();" /> |
| | | <input value="插入数据申请" type="button" onclick="insertApply();" /> |
| | | <input value="请求管线分析" type="button" onclick="selectPipeAnalysis();" /> |
| | | <input value="管线分析结果下载" type="button" onclick="downloadPipeAnalysis();" /> |
| | | <hr /> |
| | | <br /> |
| | | </form> |