From 0a1ff7f86f00476c3f6e3ac7084be6f6f299de2f Mon Sep 17 00:00:00 2001
From: lty <876263681@qq.com>
Date: 星期五, 16 一月 2026 08:06:25 +0800
Subject: [PATCH] #
---
src/main/webapp/static/js/report/locMap.js | 120 ++++++++++++++++++++++++++++++++++++------------------------
1 files changed, 72 insertions(+), 48 deletions(-)
diff --git a/src/main/webapp/static/js/report/locMap.js b/src/main/webapp/static/js/report/locMap.js
index 268a7f3..205cd7d 100644
--- a/src/main/webapp/static/js/report/locMap.js
+++ b/src/main/webapp/static/js/report/locMap.js
@@ -1,14 +1,17 @@
-layui.use(['table','laydate', 'form'], function(){
+layui.use(['table', 'laydate', 'form'], function(){
var $ = layui.jquery;
var layer = layui.layer;
var form = layui.form;
- getLocMapRows();
- getLocTable(1);
+ // 鍒濆鍔犺浇
+ loadRowsOptions(); // 鍔犺浇銆屾帓銆嶉�夐」锛堝缁堥渶瑕侊級
+ loadLayersOptions(); // 鍔犺浇銆屽眰銆嶉�夐」锛堟彁鍓嶅噯澶囷級
+ getLocTable('byRow', 1); // 榛樿鎸夋帓 + 绗�1鎺�
- function getLocMapRows() {
+ // 鍔犺浇鎵�鏈夊彲鐢ㄦ帓
+ function loadRowsOptions() {
$.ajax({
- url: baseUrl+"/report/viewLocMapList/rows.action",
+ url: baseUrl + "/report/viewLocMapList/rows.action",
headers: {'token': localStorage.getItem('token')},
method: 'POST',
async: false,
@@ -16,70 +19,91 @@
if (res.code === 200) {
var tpl = $("#locMastRowTemplate").html();
var template = Handlebars.compile(tpl);
- var html = template(res);
- $('#rowSelect').append(html);
+ $('#rowSelect').append(template(res));
form.render('select');
} else if (res.code === 403) {
- top.location.href = baseUrl+"/";
- } else {
- layer.msg(res.msg)
+ top.location.href = baseUrl + "/";
}
}
});
}
- function getLocTable(row){
+ // 鍔犺浇鎵�鏈夊彲鐢ㄥ眰锛堥渶瑕佸悗绔敮鎸佹柊鎺ュ彛锛�
+ function loadLayersOptions() {
$.ajax({
- url: baseUrl+"/report/viewLocMapList.action",
+ url: baseUrl + "/report/viewLocMapList/layers.action", // 鈫� 闇�瑕佹柊澧炴帴鍙�
headers: {'token': localStorage.getItem('token')},
- data: {row: row},
+ method: 'POST',
+ async: false,
+ success: function (res) {
+ if (res.code === 200) {
+ var tpl = $("#locMastRowTemplate").html(); // 澶嶇敤妯℃澘
+ var template = Handlebars.compile(tpl);
+ $('#layerSelect').append(template(res));
+ form.render('select');
+ }
+ }
+ });
+ }
+
+ // 鏍稿績锛氭牴鎹ā寮忓姞杞藉簱浣嶈〃
+ function getLocTable(mode, value) {
+ var url = baseUrl + "/report/viewLocMapList.action";
+ var data = {};
+
+ if (mode === 'byRow') {
+ data.row = value;
+ } else if (mode === 'byLayer') {
+ data.layer = value;
+ }
+ $.ajax({
+ url: url,
+ headers: {'token': localStorage.getItem('token')},
+ data: data,
method: 'POST',
success: function (res) {
if (res.code === 200) {
var tpl = $("#locMapTemplate").html();
var template = Handlebars.compile(tpl);
- var html = template(res.data);
- $('#locMap').html(html);
+ $('#locMap').html(template(res.data));
} else if (res.code === 403) {
- top.location.href = baseUrl+"/";
+ top.location.href = baseUrl + "/";
} else {
- layer.msg(res.msg)
+ layer.msg(res.msg || '鍔犺浇澶辫触');
}
}
});
}
- form.on('select(row)', function (data) {
- getLocTable(data.value);
+ // 鐩戝惉 鏄剧ず妯″紡 鍒囨崲
+ form.on('select(viewMode)', function (data) {
+ var mode = data.value;
+
+ if (mode === 'byRow') {
+ $('#rowSelectBox').show();
+ $('#layerSelectBox').hide();
+ // 璇诲彇褰撳墠閫変腑鐨勬帓
+ var currentRow = $('#rowSelect').val() || 1;
+ getLocTable('byRow', currentRow);
+ } else if (mode === 'byLayer') {
+ $('#rowSelectBox').hide();
+ $('#layerSelectBox').show();
+ var currentLayer = $('#layerSelect').val() || 1;
+ getLocTable('byLayer', currentLayer);
+ }
});
-});
-var locNo = '';
-function locDetl(el) {
- var value = $(el).attr('title');
- var html = $(el).html();
- if (value===null
- ||value === undefined
- || value.trim()===''
- || html.trim()==='S'
- || html.trim()==='D'
- || html.trim()==='O'
- || html.trim()==='Z'
+ // 鐩戝惉 鎺� 鍙樺寲
+ form.on('select(row)', function (data) {
+ if ($('#viewMode').val() === 'byRow') {
+ getLocTable('byRow', data.value);
+ }
+ });
- ){
-
- } else {
- layer.open({
- type: 2,
- title: '搴撲綅鐗╂枡',
- maxmin: true,
- area: [top.detailWidth, top.detailHeight],
- shadeClose: true,
- content: 'locDetl.html',
- success: function(layero, index){
- locNo = value;
- }
- });
- }
-}
-
+ // 鐩戝惉 灞� 鍙樺寲
+ form.on('select(layer)', function (data) {
+ if ($('#viewMode').val() === 'byLayer') {
+ getLocTable('byLayer', data.value);
+ }
+ });
+});
\ No newline at end of file
--
Gitblit v1.9.1