testview.html 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8" />
  5. <meta name="viewport" content="width=device-width,initial-scale=1.0" />
  6. <title></title>
  7. <style>
  8. pre {
  9. outline: 1px solid #ccc;
  10. padding: 5px;
  11. margin: 5px;
  12. }
  13. .string {
  14. color: green;
  15. }
  16. .number {
  17. color: darkorange;
  18. }
  19. .boolean {
  20. color: blue;
  21. }
  22. .null {
  23. color: magenta;
  24. }
  25. .key {
  26. color: red;
  27. }
  28. </style>
  29. </head>
  30. <body>
  31. <label>表名:<input type="text" id="tablename" value="map_xzqh_cun_polyline" /></label></br>
  32. <label>查询条件语句:<input type="text" id="sqlWhere" value="" /></label></br>
  33. <label>排序语句 :<input type="text" id="orderByField" value="" /></label></br>
  34. <button onclick="a()">基础查询</button>
  35. <button onclick="b()">新增</button>
  36. <button onclick="c()">缓冲区查询</button>
  37. <button onclick="d()">空间查询</button>
  38. <button onclick="e()">3dtile查询</button>
  39. <button onclick="f()">分段</button>
  40. <pre id="result"></pre>
  41. </body>
  42. <script src="../public/js/jquery-2.0.3.min.js"></script>
  43. <script>
  44. var key = "0l23456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
  45. function syntaxHighlight(json) {
  46. if (typeof json != 'string') {
  47. json = JSON.stringify(json, undefined, 2);
  48. }
  49. json = json.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
  50. return json.replace(/("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)/g, function (match) {
  51. var cls = 'number';
  52. if (/^"/.test(match)) {
  53. if (/:$/.test(match)) {
  54. cls = 'key';
  55. } else {
  56. cls = 'string';
  57. }
  58. } else if (/true|false/.test(match)) {
  59. cls = 'boolean';
  60. } else if (/null/.test(match)) {
  61. cls = 'null';
  62. }
  63. return '<span class="' + cls + '">' + match + '</span>';
  64. });
  65. }
  66. function f() {
  67. var value = document.getElementById("tablename").value;
  68. let fd = {
  69. XZQDM: '370612090001',
  70. }
  71. // let dataParameters = {
  72. // tableName: toCode(value, key),
  73. // name: fd,
  74. // type: '段', //lb能分段和米
  75. // number: 3, // 排序条件
  76. // };
  77. let dataParameters = {
  78. tableName: toCode(value, key),
  79. name: fd,
  80. point_one: '121.6480450140001 37.4888497860001', //随便一点
  81. point_two: '121.6480450140001 37.4888497860001', // 随便一点或者起点或者终点
  82. };
  83. $('#result').empty();
  84. $.ajax({
  85. async: true,
  86. dataType: 'json',
  87. type: 'post',
  88. // url: 'http://218.59.194.82:13181/getSpatialQuery',
  89. // url: 'http://10.88.77.130:8092/',
  90. // url: 'http://127.0.0.1:8082/getLineInterpolatePoints',
  91. url: 'http://127.0.0.1:8082/getLineDistance',
  92. data: dataParameters,
  93. success: function (temp) {
  94. try {
  95. $('#result').html(syntaxHighlight(temp));
  96. console.log(temp)
  97. } catch (e) {
  98. console.log(e);
  99. // return false;
  100. }
  101. },
  102. error: function (jqXHR, textStatus, errorThrown) {
  103. console.log("错误:" + jqXHR.status);
  104. }
  105. });
  106. }
  107. function a() {
  108. var value = document.getElementById("tablename").value;
  109. var sqlWhere = document.getElementById("sqlWhere").value;
  110. var orderByField = document.getElementById("orderByField").value;
  111. let dataParameters = {
  112. tableName: toCode(value, key),
  113. sqlWhere: toCode(sqlWhere, key), // 查询过滤条件
  114. orderByField: toCode(orderByField, key), // 排序条件
  115. };
  116. $('#result').empty();
  117. $.ajax({
  118. async: true,
  119. dataType: 'json',
  120. type: 'get',
  121. // url: 'http://218.59.194.82:13189/getTableList',
  122. // url: 'http://10.88.77.134:8085/getTableList',
  123. url: 'http://127.0.0.1:8093/getTableList',
  124. data: dataParameters,
  125. success: function (temp) {
  126. try {
  127. $('#result').html(syntaxHighlight(temp));
  128. console.log(temp)
  129. } catch (e) {
  130. console.log(e);
  131. // return false;
  132. }
  133. },
  134. error: function (jqXHR, textStatus, errorThrown) {
  135. console.log("错误:" + jqXHR.status);
  136. }
  137. });
  138. }
  139. function toCode(str, key) { //加密字符串
  140. //定义密钥,36个字母和数字
  141. var l = key.length; //获取密钥的长度
  142. var a = key.split(""); //把密钥字符串转换为字符数组
  143. var s = "", b, bl, b2, b3; //定义临时变量
  144. for (var i = 0; i < str.length; i++) { //遍历字符串
  145. b = str.charCodeAt(i); //逐个提取每个字符,并获取Unicode编码值
  146. bl = b % l; //求Unicode编码值得余数
  147. b = (b - bl) / l; //求最大倍数
  148. b2 = b % l; //求最大倍数的于是
  149. b = (b - b2) / l; //求最大倍数
  150. b3 = b % l; //求最大倍数的余数
  151. s += a[b3] + a[b2] + a[bl]; //根据余数值映射到密钥中对应下标位置的字符
  152. }
  153. return s; //返回这些映射的字符
  154. }
  155. function e() {
  156. $('#result').empty();
  157. $.ajax({
  158. async: true,
  159. // dataType: 'json',
  160. type: 'get',
  161. // url: 'http://218.59.194.82:13092/11294/tileset.json',
  162. // url: 'http://10.88.77.134:8085/get3dTiles/hedata/tileset.json',
  163. url: 'http://127.0.0.1:8092/11294/tileset.json',
  164. // url: 'http://127.0.0.1:8092/getMbTiles/dz/18/215787/160352.png',
  165. success: function (temp) {
  166. try {
  167. $('#result').html(syntaxHighlight(temp));
  168. console.log(temp)
  169. } catch (e) {
  170. console.log(e);
  171. // return false;
  172. }
  173. },
  174. error: function (jqXHR, textStatus, errorThrown) {
  175. console.log("错误:" + jqXHR.status);
  176. }
  177. });
  178. }
  179. function d() {
  180. var value = document.getElementById("tablename").value;
  181. var sqlWhere = document.getElementById("sqlWhere").value;
  182. var orderByField = document.getElementById("orderByField").value;
  183. let dataParameters = {
  184. tableName: value,
  185. sqlWhere: sqlWhere, // 查询过滤条件
  186. orderByField: orderByField, // 排序条件
  187. };
  188. $('#result').empty();
  189. $.ajax({
  190. async: true,
  191. dataType: 'json',
  192. type: 'get',
  193. // url: 'http://218.59.194.82:13092/getGeoJson',
  194. url: 'http://10.88.77.131:8081/getGeoJson',
  195. // url: 'http://127.0.0.1:8092/getGeoJson',
  196. data: dataParameters,
  197. success: function (temp) {
  198. try {
  199. $('#result').html(syntaxHighlight(temp));
  200. console.log(temp)
  201. } catch (e) {
  202. console.log(e);
  203. // return false;
  204. }
  205. },
  206. error: function (jqXHR, textStatus, errorThrown) {
  207. console.log("错误:" + jqXHR.status);
  208. }
  209. });
  210. }
  211. function b() {
  212. var value = document.getElementById("tablename").value;
  213. let fd = {
  214. heading: 1,
  215. name: '愉快Indian',
  216. x: 1,
  217. y: 1,
  218. z: 1,
  219. userId: 1,
  220. screenshot: '',
  221. pitch: 1,
  222. roll: 2
  223. }
  224. let dataParameters = {
  225. tableName: value,
  226. keyValue: "",
  227. formData: fd
  228. };
  229. $('#result').empty();
  230. $.ajax({
  231. async: true,
  232. dataType: 'json',
  233. type: 'post',
  234. // url: 'http://218.59.194.82:13092/',
  235. url: 'http://127.0.0.1:8082/postSubmit',
  236. data: dataParameters,
  237. success: function (temp) {
  238. try {
  239. $('#result').html(syntaxHighlight(temp));
  240. console.log(temp)
  241. } catch (e) {
  242. console.log(e);
  243. // return false;
  244. }
  245. },
  246. error: function (jqXHR, textStatus, errorThrown) {
  247. console.log("错误:" + jqXHR.status);
  248. }
  249. });
  250. }
  251. function c() {
  252. var value = document.getElementById("tablename").value;
  253. let dataParameters = {
  254. tableName: toCode(value, key),
  255. spatialType: '点',
  256. // coordinate: "121.639245162136 37.4792291346178", // 查询过滤条件
  257. coordinate: "", // 查询过滤条件
  258. buffer: "", // 排序条件
  259. sqlWhere: toCode("1=1", key),
  260. };
  261. $('#result').empty();
  262. $.ajax({
  263. async: true,
  264. dataType: 'json',
  265. type: 'get',
  266. // url: 'http://218.59.194.82:13181/getSpatialQuery',
  267. // url: 'http://10.88.77.130:8092/',
  268. url: 'http://127.0.0.1:8082/getSpatialQuery',
  269. data: dataParameters,
  270. success: function (temp) {
  271. try {
  272. $('#result').html(syntaxHighlight(temp));
  273. console.log(temp)
  274. } catch (e) {
  275. console.log(e);
  276. // return false;
  277. }
  278. },
  279. error: function (jqXHR, textStatus, errorThrown) {
  280. console.log("错误:" + jqXHR.status);
  281. }
  282. });
  283. }
  284. </script>
  285. </html>