From 7635dc25bd2a4d565df496b2d96354639966768d Mon Sep 17 00:00:00 2001
From: Junjie <xjj@123>
Date: 星期四, 25 九月 2025 11:09:44 +0800
Subject: [PATCH] #
---
src/main/webapp/static/js/basMap/basMap.js | 143 ++++++++++++++++++++++++++++++++---------------
1 files changed, 97 insertions(+), 46 deletions(-)
diff --git a/src/main/webapp/static/js/basMap/basMap.js b/src/main/webapp/static/js/basMap/basMap.js
index bcd94be..a21e47d 100644
--- a/src/main/webapp/static/js/basMap/basMap.js
+++ b/src/main/webapp/static/js/basMap/basMap.js
@@ -1,19 +1,20 @@
var pageCurr;
layui.config({
base: baseUrl + "/static/layui/lay/modules/"
-}).use(['table','laydate', 'form', 'admin'], function(){
+}).use(['table', 'laydate', 'form', 'admin', 'upload'], function () {
var table = layui.table;
var $ = layui.jquery;
var layer = layui.layer;
var layDate = layui.laydate;
var form = layui.form;
var admin = layui.admin;
+ var upload = layui.upload;
// 鏁版嵁娓叉煋
tableIns = table.render({
elem: '#basMap',
headers: {token: localStorage.getItem('token')},
- url: baseUrl+'/basMap/list/auth',
+ url: baseUrl + '/basMap/list/auth',
page: true,
limit: 15,
limits: [15, 30, 50, 100, 200, 500],
@@ -22,15 +23,19 @@
height: 'full-120',
cols: [[
{type: 'checkbox'}
- ,{field: 'id', align: 'center',title: '#'}
- ,{field: 'data', align: 'center',title: '瀹炴椂鏁版嵁'}
- ,{field: 'createTime$', align: 'center',title: '鍒涘缓鏃堕棿'}
- ,{field: 'updateTime$', align: 'center',title: '鏇存柊鏃堕棿'}
- ,{field: 'lastData', align: 'center',title: '鏈�杩戞暟鎹�'}
- ,{field: 'lev', align: 'center',title: '灞傛暟'}
- ,{field: 'originData', align: 'center',title: '鍘熷鍦板浘'}
+ // ,{field: 'id', align: 'center',title: '#'}
+ , {field: 'lev', align: 'center', title: '灞傛暟'}
+ , {field: 'data', align: 'center', title: '瀹炴椂鏁版嵁'}
+ , {field: 'createTime$', align: 'center', title: '鍒涘缓鏃堕棿'}
+ , {field: 'updateTime$', align: 'center', title: '鏇存柊鏃堕棿'}
+ , {field: 'lastData', align: 'center', title: '鏈�杩戞暟鎹�'}
+ , {field: 'originData', align: 'center', title: '鍘熷鍦板浘'}
+ , {field: 'baseRow', align: 'center', title: '鍩哄噯鎺�'}
+ , {field: 'baseRowCode', align: 'center', title: '鍩哄噯鎺�-code'}
+ , {field: 'baseBay', align: 'center', title: '鍩哄噯鍒�'}
+ , {field: 'baseBayCode', align: 'center', title: '鍩哄噯鍒�-code'}
- ,{fixed: 'right', title:'鎿嶄綔', align: 'center', toolbar: '#operate', width:120}
+ , {fixed: 'right', title: '鎿嶄綔', align: 'center', toolbar: '#operate', width: 120}
]],
request: {
pageName: 'curr',
@@ -47,19 +52,34 @@
response: {
statusCode: 200
},
- done: function(res, curr, count) {
+ done: function (res, curr, count) {
if (res.code === 403) {
- top.location.href = baseUrl+"/";
+ top.location.href = baseUrl + "/";
}
- pageCurr=curr;
+ pageCurr = curr;
limit();
+ }
+ });
+
+ // 娓叉煋
+ upload.render({
+ elem: '.demo-class-accept', // 缁戝畾澶氫釜鍏冪礌
+ url: baseUrl + "/basMap/upload", // 姝ゅ閰嶇疆浣犺嚜宸辩殑涓婁紶鎺ュ彛鍗冲彲
+ accept: 'file', // 鏅�氭枃浠�
+ done: function (res) {
+ if (res.code == 200) {
+ layer.msg('瀵煎叆鎴愬姛');
+ tableReload()
+ }else {
+ layer.msg(res.msg, {icon: 2})
+ }
}
});
// 鐩戝惉鎺掑簭浜嬩欢
table.on('sort(basMap)', function (obj) {
var searchData = {};
- $.each($('#search-box [name]').serializeArray(), function() {
+ $.each($('#search-box [name]').serializeArray(), function () {
searchData[this.name] = this.value;
});
searchData['orderByField'] = obj.field;
@@ -73,23 +93,26 @@
// 鐩戝惉澶村伐鍏锋爮浜嬩欢
table.on('toolbar(basMap)', function (obj) {
var checkStatus = table.checkStatus(obj.config.id).data;
- switch(obj.event) {
+ switch (obj.event) {
case 'addData':
showEditModel();
break;
case 'deleteData':
- if (checkStatus.length === 0) {
- layer.msg('璇烽�夋嫨瑕佸垹闄ょ殑鏁版嵁', {icon: 2});
- return;
- }
- del(checkStatus.map(function (d) {
- return d.id;
- }));
- break;
+ if (checkStatus.length === 0) {
+ layer.msg('璇烽�夋嫨瑕佸垹闄ょ殑鏁版嵁', {icon: 2});
+ return;
+ }
+ del(checkStatus.map(function (d) {
+ return d.id;
+ }));
+ break;
+ case 'initLocMast':
+ initLocMast()
+ break;
case 'exportData':
- admin.confirm('纭畾瀵煎嚭Excel鍚�', {shadeClose: true}, function(){
- var titles=[];
- var fields=[];
+ admin.confirm('纭畾瀵煎嚭Excel鍚�', {shadeClose: true}, function () {
+ var titles = [];
+ var fields = [];
obj.config.cols[0].map(function (col) {
if (col.type === 'normal' && col.hide === false && col.toolbar == null) {
titles.push(col.title);
@@ -97,7 +120,7 @@
}
});
var exportData = {};
- $.each($('#search-box [name]').serializeArray(), function() {
+ $.each($('#search-box [name]').serializeArray(), function () {
exportData[this.name] = this.value;
});
var param = {
@@ -105,18 +128,18 @@
'fields': fields
};
$.ajax({
- url: baseUrl+"/basMap/export/auth",
+ url: baseUrl + "/basMap/export/auth",
headers: {'token': localStorage.getItem('token')},
data: JSON.stringify(param),
- dataType:'json',
- contentType:'application/json;charset=UTF-8',
+ dataType: 'json',
+ contentType: 'application/json;charset=UTF-8',
method: 'POST',
success: function (res) {
layer.closeAll();
if (res.code === 200) {
- table.exportFile(titles,res.data,'xls');
+ table.exportFile(titles, res.data, 'xls');
} else if (res.code === 403) {
- top.location.href = baseUrl+"/";
+ top.location.href = baseUrl + "/";
} else {
layer.msg(res.msg, {icon: 2})
}
@@ -128,7 +151,7 @@
});
// 鐩戝惉琛屽伐鍏蜂簨浠�
- table.on('tool(basMap)', function(obj){
+ table.on('tool(basMap)', function (obj) {
var data = obj.data;
switch (obj.event) {
case 'edit':
@@ -139,6 +162,33 @@
break;
}
});
+
+ function initLocMast() {
+ layer.confirm('纭畾鍒濆鍖栧簱浣嶆暟鎹悧锛�', {
+ skin: 'layui-layer-admin',
+ shade: .1
+ }, function (i) {
+ layer.close(i);
+ var loadIndex = layer.load(2);
+ $.ajax({
+ url: baseUrl + "/locMast/init",
+ headers: {'token': localStorage.getItem('token')},
+ data: {},
+ method: 'POST',
+ success: function (res) {
+ layer.close(loadIndex);
+ if (res.code === 200) {
+ layer.msg(res.msg, {icon: 1});
+ tableReload();
+ } else if (res.code === 403) {
+ top.location.href = baseUrl + "/";
+ } else {
+ layer.msg(res.msg, {icon: 2});
+ }
+ }
+ })
+ });
+ }
/* 寮圭獥 - 鏂板銆佷慨鏀� */
function showEditModel(mData) {
@@ -153,19 +203,19 @@
form.on('submit(editSubmit)', function (data) {
var loadIndex = layer.load(2);
$.ajax({
- url: baseUrl+"/basMap/"+(mData?'update':'add')+"/auth",
+ url: baseUrl + "/basMap/" + (mData ? 'update' : 'add') + "/auth",
headers: {'token': localStorage.getItem('token')},
data: data.field,
method: 'POST',
success: function (res) {
layer.close(loadIndex);
- if (res.code === 200){
+ if (res.code === 200) {
layer.close(dIndex);
layer.msg(res.msg, {icon: 1});
tableReload();
- } else if (res.code === 403){
- top.location.href = baseUrl+"/";
- }else {
+ } else if (res.code === 403) {
+ top.location.href = baseUrl + "/";
+ } else {
layer.msg(res.msg, {icon: 2});
}
}
@@ -187,17 +237,17 @@
layer.close(i);
var loadIndex = layer.load(2);
$.ajax({
- url: baseUrl+"/basMap/delete/auth",
+ url: baseUrl + "/basMap/delete/auth",
headers: {'token': localStorage.getItem('token')},
data: {ids: ids},
method: 'POST',
success: function (res) {
layer.close(loadIndex);
- if (res.code === 200){
+ if (res.code === 200) {
layer.msg(res.msg, {icon: 1});
tableReload();
- } else if (res.code === 403){
- top.location.href = baseUrl+"/";
+ } else if (res.code === 403) {
+ top.location.href = baseUrl + "/";
} else {
layer.msg(res.msg, {icon: 2});
}
@@ -224,22 +274,23 @@
setTimeout(function () {
layDate.render({
elem: '.layui-laydate-range'
- ,type: 'datetime'
- ,range: true
+ , type: 'datetime'
+ , range: true
});
layDate.render({
elem: '#createTime\\$',
type: 'datetime',
- value: data!==undefined?data['createTime\\$']:null
+ value: data !== undefined ? data['createTime\\$'] : null
});
layDate.render({
elem: '#updateTime\\$',
type: 'datetime',
- value: data!==undefined?data['updateTime\\$']:null
+ value: data !== undefined ? data['updateTime\\$'] : null
});
}, 300);
}
+
layDateRender();
});
--
Gitblit v1.9.1