大屏添加船 及船上车信息

This commit is contained in:
浅念
2025-06-11 17:20:52 +08:00
parent 8b13b88b3e
commit 7d57c9988e
15 changed files with 1838 additions and 216 deletions
+72 -17
View File
@@ -7,11 +7,11 @@ function loadJSONSync(url) {
if (xhr.status === 200) {
return JSON.parse(xhr.responseText);
} else {
console.error('请求失败,状态码:', xhr.status);
// console.error('请求失败,状态码:', xhr.status);
return null;
}
} catch (e) {
console.error('请求过程中出错:', e);
// console.error('请求过程中出错:', e);
return null;
}
}
@@ -20,6 +20,8 @@ const elements = {
htmlElement: document.documentElement,
bodyElement: document.body
};
// const baseURL='https://dashboard-server.hesuu.com'
var baseURL='http://219.157.255.213:25505'
var city_data;
function addlist() {
$('.citylist').liMarquee('destroy');
@@ -65,7 +67,7 @@ $(".citylist").on('click', '.item', function() {
if(langs=='zh'){$(".inner").html('<img src="../img/none1.jpg" alt="" />')}
}
$(".vin").html(data.vin)
$(".classify").html(data.location.name)
$(".classify").html(data.location?data.location.name:'')
$(".model").html(data.model)
$(".destination").html(data.final_location!=null?data.final_location.name:'')
$(".fbo_destination").html(data.fbo_destination)
@@ -121,14 +123,17 @@ function listsc1() {
}
var count;
var currentPage=1;
var statusnew='';
function Vehiclefn1(currentPage,lang){
$.ajax({
url:'https://dashboard-server.hesuu.com/Vehicle',
url:baseURL+'/Vehicle',
type:'POST',
data:{
lang: lang,
page: currentPage,
pageSize: 50
pageSize: 50,
status:statusnew
},
success: function(result){
if(result.code==0){
@@ -140,14 +145,16 @@ function Vehiclefn1(currentPage,lang){
}
});
}
function Vehiclefn(lang){
function Vehiclefn(lang,status){
statusnew = status
$.ajax({
url:'https://dashboard-server.hesuu.com/Vehicle',
url:baseURL+'/Vehicle',
type:'POST',
data:{
lang: lang,
page: currentPage,
pageSize: 50
pageSize: 50,
status:status
},
success: function(result){
if(result.code==0){
@@ -160,6 +167,16 @@ function Vehiclefn(lang){
v+='<span>'+arr[n]+'</span>'
}
$(".all").html(v)
$(".cartitle").html('')
$(".inner").html('')
$(".vin").html('')
$(".classify").html('')
$(".model").html('')
$(".destination").html('')
$(".fbo_destination").html('')
$(".departure_time").html('')
$(".status").html('')
$(".arrival_time").html('')
addlist()
}else{
alert(result.message)
@@ -169,10 +186,33 @@ function Vehiclefn(lang){
}
var myChart = echarts.init(document.getElementById('world'));
var lineDatas;
function locationfn(lang){
var shipListdatas;//运输中 船
var navigatedatas;//待发船
var production;//生产城市
function locationfn(lang,status){
$.ajax({
url:'https://dashboard-server.hesuu.com/location',
url:baseURL+'/location/production',
type:'POST',
async:false,
data:{lang:lang,status:status},
success: function(result){
production = result.data
}
});
$.ajax({
url:baseURL+'/Vehicle/shipList',
type:'POST',
async:false,
data:{lang:lang},
success: function(result){
navigatedatas = result.data.navigate
shipListdatas = result.data.pending
}
});
$.ajax({
url:baseURL+'/location',
type:'POST',
async:false,
data:{lang:lang},
success: function(result){
lineDatas = result.data
@@ -185,7 +225,25 @@ function locationfn(lang){
});
}
// 状态按钮切换功能
document.querySelectorAll('.statusbtn > div').forEach(btn => {
btn.addEventListener('click', function() {
// 移除所有按钮的 active 类
document.querySelectorAll('.statusbtn > div').forEach(b => b.classList.remove('active'));
// 为当前点击的按钮添加 active 类
this.classList.add('active');
var status = $(this).attr('data-id')
currentPage =1
if(status=='all'){
status = ''
}
Vehiclefn(this.currentLang,status)
locationfn(this.currentLang,status)
// console.log(status)
// // 获取当前状态
// const status = this.className.split(' ')[0]; // 获取按钮的类名(statusall, status1, status2 等)
});
});
const i18n = {
currentLang: 'en', // 默认语言
init: function() {
@@ -201,8 +259,8 @@ const i18n = {
elements.htmlElement.dir = 'ltr';
elements.bodyElement.removeAttribute('dir');
}
Vehiclefn(this.currentLang)
locationfn(this.currentLang)
Vehiclefn(this.currentLang,'')
locationfn(this.currentLang,'')
// var selectedText1 = localStorage.getItem('langtext')?localStorage.getItem('langtext'):'中文';
// $(".select-selected").text(selectedText1);
// 点击选项时更新选择
@@ -224,7 +282,7 @@ const i18n = {
that.toggleLanguage($(this).attr('data-id'))
currentPage =1
Vehiclefn($(this).attr('data-id'))
locationfn($(this).attr('data-id'))
locationfn($(this).attr('data-id'),'')
});
// $('#langSwitch').click(() =>{
@@ -238,7 +296,6 @@ const i18n = {
},
loadLanguage: function(lang) {
var data = loadJSONSync(`./js/lang/${lang}.json`);
console.log(data)
$('[data-i18n]').each(function() {
const key = $(this).data('i18n');
$(this).text(data[key]); // 更新文本内容
@@ -254,8 +311,6 @@ const i18n = {
// });
},
toggleLanguage: function(selectedText) {
console.log(selectedText)
console.log('111')
this.currentLang = selectedText;
this.loadLanguage(this.currentLang);