1
0
forked from dyf/dyf-vue-ui

Compare commits

..

112 Commits

Author SHA1 Message Date
ced4a5177f 添加 一个设备的控制面板及一些小优化 2026-04-16 10:04:43 +08:00
cce863c590 提交 2026-03-20 14:58:40 +08:00
09539ecfb8 100j页面功能优化 2026-03-19 13:52:37 +08:00
fee33a68c6 pc端100j功能完成 2026-03-19 11:42:26 +08:00
8584cc78b2 100j控制面板功能完成 2026-03-18 16:12:29 +08:00
7d604dcd53 100Jpc端页面开发 2026-03-17 18:39:40 +08:00
9ddb412b7a Merge branch 'liubiao-main' 2026-03-10 18:04:12 +08:00
1c9c5ab639 Merge branch 'main' of http://47.107.152.87:3000/dyf/dyf-vue-ui 2026-03-10 18:03:36 +08:00
d6675050e6 100j控制面包页面开发 2026-03-10 18:03:33 +08:00
ee50e38292 小优化 2026-03-10 17:30:43 +08:00
29752a70af 修复编辑蓝牙&4G设备时,IEMI不显示的问题 2026-03-06 11:47:57 +08:00
dyf
1307e1bddf Merge pull request '设备类型增加参数、说明、视频' (#30) from liubiao/dyf-vue-ui:main into main
Reviewed-on: dyf/dyf-vue-ui#30
2026-02-27 15:29:05 +08:00
0ff3e4b1bc 设备类型增加参数、说明、视频 2026-02-27 15:20:07 +08:00
dyf
3231df14d9 Merge pull request '修复首页“设备使用频次”功能X轴显示错误' (#29) from liubiao/dyf-vue-ui:main into main
Reviewed-on: dyf/dyf-vue-ui#29
2026-02-26 09:07:42 +08:00
4880ffc37c 修复首页“设备使用频次”功能X轴显示错误 2026-02-05 13:13:06 +08:00
dyf
26e4ab7539 Merge pull request 'main 设备功能类型控制支持筛选,文件管理功能增加更多类型扩大文件大小' (#28) from liubiao/dyf-vue-ui:main into main
Reviewed-on: dyf/dyf-vue-ui#28
2026-02-05 09:26:11 +08:00
5fb12d90ba merge upstream 2026-02-03 15:20:19 +08:00
c424fbd04b 设备功能类型控制支持筛选,文件管理功能增加更多类型扩大文件大小 2026-02-03 15:19:36 +08:00
dyf
15719b4a27 Merge pull request '设备类型添加图片' (#27) from liubiao/dyf-vue-ui:main into main
Reviewed-on: dyf/dyf-vue-ui#27
2026-01-12 11:20:17 +08:00
a1b3d03a0c 设备类型添加图片 2026-01-12 10:22:41 +08:00
33d2123778 增加配置节 2025-12-22 09:19:32 +08:00
5139a112c5 修复设备分组bug,设备维修bug 2025-12-11 18:26:50 +08:00
e7d2cc94f8 Merge branch 'liubiao-main' 2025-12-09 11:48:41 +08:00
eb8e4e1c69 删除有关所属客户字段 2025-12-09 11:47:32 +08:00
ead17e67bb 电子围栏功能添加 2025-11-28 17:06:06 +08:00
7eb35c9a4e 围栏弹窗改成全屏覆盖 2025-11-27 17:04:07 +08:00
5597a4c2ca 加入轨迹服务,围栏真实化
# Conflicts:
#	.env.development
2025-11-27 16:55:23 +08:00
010028da0d 修改测试地址 2025-11-19 16:44:18 +08:00
30079ec854 设备列表 2025-11-17 11:17:40 +08:00
3c504cb65c 670报警取消弹窗问题修复 2025-10-27 15:38:06 +08:00
aa7229e21b 6170控制面板代码优化 2025-10-13 17:01:11 +08:00
84af6f5cfe 670控制中心,收到消息自动更新状态 2025-10-11 13:55:09 +08:00
c7a05f2118 Merge branch 'main' of http://47.107.152.87:3000/liubiao/dyf-vue-ui 2025-10-11 11:01:31 +08:00
7445e789a4 修改设备分组功能默认展开左边的树,默认加载第一分组的数据 2025-10-11 11:01:03 +08:00
fabab0a577 优化控制面板,页面样式展示 2025-10-11 10:47:39 +08:00
8b53fbe0ca Merge branch 'liubiao-main' 2025-10-10 17:43:16 +08:00
65af3b6956 角色管理去掉导出按钮 2025-10-10 17:42:04 +08:00
47d8f14ad4 670小问题调整 2025-10-10 17:29:23 +08:00
1c664cc2f6 Merge branch 'main' of http://47.107.152.87:3000/liubiao/dyf-vue-ui 2025-10-10 12:02:54 +08:00
b89bc455f6 670控制中心频繁弹窗问题处理。 2025-10-10 11:59:52 +08:00
ee4eec1e2e 数据大屏跳转到新标签页,已修改 2025-10-10 11:41:42 +08:00
b6c64df004 优化细节 2025-10-09 15:42:08 +08:00
93166e0f71 Merge branch 'liubiao-main、' 2025-10-09 14:40:53 +08:00
dc28fb65ba 设备频次添加滚动条 2025-10-09 14:38:00 +08:00
03df0388b4 加入新图标 2025-10-09 13:46:02 +08:00
6d6d395bff 670控制中心小调整 2025-10-09 11:50:07 +08:00
75a7da4a19 Merge branch 'main' of http://47.107.152.87:3000/liubiao/dyf-vue-ui 2025-10-09 11:48:55 +08:00
8e552df724 6170控制面板添加解除报警逻辑 2025-10-09 11:40:21 +08:00
72699abdec 修改一些体验性问题 2025-10-08 14:19:47 +08:00
2dca6e3ff8 联调中心,控制设备仅在线状态,发送指令 2025-10-07 15:56:22 +08:00
63804635de Merge branch 'liubiao-main' 2025-10-07 15:46:48 +08:00
eb598255f3 报警地点,没有地点时,默认设置无 2025-10-07 15:46:08 +08:00
492d43c709 控制中心,添加设备绑定状态字段 2025-10-07 15:40:33 +08:00
8f28eb920f 修改人员信息2、3两个值反了的问题 2025-10-07 15:29:22 +08:00
4a4902ab72 联调中心,根据类型,上传logo调取不同接口,优化了其他代码 2025-10-07 10:57:49 +08:00
462656880c 大屏报警列表无缝轮播 2025-09-30 17:32:04 +08:00
80d1570e68 Merge branch 'main' of http://47.107.152.87:3000/dyf/dyf-vue-ui 2025-09-30 16:31:18 +08:00
fc3a8e58d9 优化体验性代码 2025-09-30 16:31:14 +08:00
9906c2653b 修改控制中心的体验性问题 2025-09-30 16:01:47 +08:00
52d18cf408 Merge branch 'main' of http://47.107.152.87:3000/liubiao/dyf-vue-ui 2025-09-30 13:31:30 +08:00
7081f28ee0 提交漏掉的文件 2025-09-30 13:29:54 +08:00
cb9ea99008 merge upstream 2025-09-30 12:10:05 +08:00
4aac36cd4c 控制中心添加670的控制,大屏页面问题 2025-09-30 12:08:50 +08:00
e7e58d28cc 大屏数据实时 2025-09-30 10:59:31 +08:00
af45e3fda3 样式优化 2025-09-29 17:20:00 +08:00
e0b9daa40e 实时报警数据定时 2025-09-29 17:00:40 +08:00
08c0d8ebd3 Merge branch 'liubiao-main' 2025-09-29 16:54:18 +08:00
7eb64f2d70 样式优化 2025-09-29 16:52:24 +08:00
13f72a49ae 修改地图后端有真实数据后跟假想的数据字段名称不一致导致的地图假死问题 2025-09-29 16:49:25 +08:00
28aa794e3f merge upstream 2025-09-29 15:28:02 +08:00
6454933d59 修改地图筛选图标 2025-09-29 14:06:18 +08:00
848f471ef1 实时报警,细节修改 2025-09-29 11:27:36 +08:00
a3be91c6ac 修改大屏,每个模块的图片,去掉标题文字 2025-09-29 11:08:17 +08:00
dyf
25aa857758 Merge branch 'main' into main 2025-09-29 09:33:00 +08:00
52d90d490b 实时报警进度条样式修改 2025-09-29 09:31:03 +08:00
428d5c90c8 Merge branch 'liubiao-main' 2025-09-29 08:49:27 +08:00
4288867acf 修改大屏。地图主题色,模块加黑色蒙版图片 2025-09-29 08:47:59 +08:00
070a398f7e 增加一些体验性的修改 2025-09-28 17:08:52 +08:00
277bf123ea 修改一些体验性问题 2025-09-28 16:41:41 +08:00
dd01ed36bd 完成跟深圳工程师的合并 2025-09-28 15:40:27 +08:00
47f5b7a0a6 Merge branch 'main' of http://47.107.152.87:3000/liubiao/dyf-vue-ui 2025-09-28 15:37:34 +08:00
e8b19513b4 完成大屏地图功能 2025-09-28 15:37:15 +08:00
b202de76ec 数据大屏图表接口对接 2025-09-28 15:28:15 +08:00
c4d00bfdc3 1 2025-09-27 17:58:15 +08:00
e865ea34b9 数据大屏整个框完成 2025-09-27 17:58:07 +08:00
997c88ae57 新增数据大屏页面 2025-09-27 16:10:17 +08:00
81df83be26 Merge branch 'main' of http://47.107.152.87:3000/liubiao/dyf-vue-ui 2025-09-26 17:09:06 +08:00
76c3a7c8bf 细节优化 2025-09-25 15:32:44 +08:00
cc53ee4d29 报警列表,无数据时添加无图片状态 2025-09-25 15:30:51 +08:00
066e6da017 Merge branch 'main' of http://47.107.152.87:3000/liubiao/dyf-vue-ui
# Conflicts:
#	src/views/fys-equipment/fenceAccessRecord/index.vue
2025-09-25 13:08:48 +08:00
fb13f40ac1 围栏进出记录添加地址 2025-09-25 13:05:54 +08:00
cf05f857bd 删除围栏多个>符号 2025-09-25 10:58:34 +08:00
dda3b11326 报警列表,修改时间显示不全的问题 2025-09-25 10:41:27 +08:00
f811445451 670控制中心小问题修复 2025-09-23 17:00:01 +08:00
d5f7c218bd merge upstream 2025-09-23 14:29:31 +08:00
ee795f3676 670控制中心问题调整 2025-09-23 14:27:11 +08:00
4527780cf8 Merge branch 'liubiao-main' 2025-09-23 10:35:37 +08:00
5d1e2d0b1c 修复菜单栏图标不显示问题 2025-09-23 10:32:29 +08:00
5d073b47fb 维修记录修改查询功能 2025-09-23 10:26:57 +08:00
7b0460c4e0 修改联调中心一个小问题 2025-09-23 08:47:51 +08:00
ae84b7cde4 merge upstream 2025-09-23 08:22:33 +08:00
2fc3d4ae67 体验性修改 2025-09-23 08:21:49 +08:00
872d7d1c14 控制面板,优化电量显示百分比 2025-09-22 18:01:41 +08:00
1701b6e4d3 Merge branch 'main' of http://47.107.152.87:3000/liubiao/dyf-vue-ui 2025-09-22 17:34:22 +08:00
c7cfa4c1de 修复一些体验性问题。 2025-09-22 17:34:06 +08:00
d632ba514c Merge branch 'liubiao-main' 2025-09-22 11:09:56 +08:00
ed9b519b77 设备列表,细节修改 2025-09-22 10:37:27 +08:00
2d005a5456 Merge branch 'main' of http://47.107.152.87:3000/dyf/dyf-vue-ui
# Conflicts:
#	.env.development
2025-09-22 10:33:06 +08:00
dbf39c5538 670控制中心小问题调整。 2025-09-22 10:26:41 +08:00
b1f5cfdd7a 首页,报警图表,字段顺序调整 2025-09-20 15:43:53 +08:00
eb4bb8c208 报警列表,持续时间动态计算 2025-09-20 14:25:32 +08:00
517998a0db 修复设备日志 2025-09-19 17:24:12 +08:00
137 changed files with 13068 additions and 2247 deletions

View File

@ -5,12 +5,13 @@ VITE_APP_TITLE = 云平台管理系统
VITE_APP_ENV = 'development'
# 开发环境
# VITE_APP_BASE_API = 'http://47.120.79.150/backend'
VITE_APP_BASE_API = 'http://192.168.110.56:8000'
VITE_APP_BASE_API = 'http://192.168.2.34:8000'
#VITE_APP_BASE_API = 'https://www.cnxhyc.com/jq'
# VITE_APP_BASE_API = 'http://192.168.110.57:8000'
#代永飞接口
# VITE_APP_BASE_API = 'http://457102h2d6.qicp.vip:24689'
VITE_AMAP_KEY='84a12a692ae378effdf741e16d584cd3'
# 应用访问路径 例如使用前缀 /admin/
VITE_APP_CONTEXT_PATH = '/'

View File

@ -2,13 +2,16 @@
VITE_APP_TITLE = 云平台管理系统
# 生产环境配置 晶全1
VITE_APP_ENV = 'https://fuyuanshen.com/backend'
VITE_APP_ENV = 'production'
# 生产环境配置 富源晟2
# VITE_APP_ENV = 'https://fuyuanshen.com/backend-fys'
# 应用访问路径 晶全1
VITE_APP_CONTEXT_PATH = '/jingquan/'
VITE_APP_CONTEXT_PATH = '/PC/'
# 高德地图Key
VITE_AMAP_KEY='84a12a692ae378effdf741e16d584cd3'
# 应用访问路径 富源晟2
#VITE_APP_CONTEXT_PATH = '/sys/'
@ -19,8 +22,10 @@ VITE_APP_MONITOR_ADMIN = '/admin/applications'
# SnailJob 控制台地址
VITE_APP_SNAILJOB_ADMIN = '/snail-job'
# 生产环境 晶全3
VITE_APP_BASE_API = '/backend'
# 生产环境 晶全3 代理访问
VITE_APP_BASE_API = 'https://www.cnxhyc.com/jq'
# VITE_APP_BASE_API = 'http://139.224.253.23:8000'
# 生产环境 富源晟3
#VITE_APP_BASE_API = '/backend-fys'

View File

@ -6,7 +6,12 @@
<meta name="renderer" content="webkit" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
<link rel="icon" href="/favicon.ico" />
<script src="https://webapi.amap.com/maps?v=2.0&key=90bc158992feb8ccd0145e168cab1307&plugin=AMap.CircleEditor"></script>
<script type="text/javascript">
window._AMapSecurityConfig = {
securityJsCode: "4239900f4fb7b2569df651ac814a28de",
};
</script>
<script src="https://webapi.amap.com/maps?v=2.0&key=78c36a1e251a95f1a21a9e5ea7a1331c&plugin=AMap.CircleEditor"></script>
<title>物联网管理平台</title>
<!--[if lt IE 11
]><script>

View File

@ -35,11 +35,13 @@
"image-conversion": "2.1.1",
"js-cookie": "3.0.5",
"jsencrypt": "3.3.2",
"lamejs": "^1.2.1",
"mitt": "^3.0.1",
"nprogress": "0.2.0",
"paho-mqtt": "^1.1.0",
"pinia": "3.0.2",
"qrcode-vue3": "^1.7.1",
"recorder-core": "^1.3.25011100",
"screenfull": "6.0.2",
"vue": "3.5.13",
"vue-cropper": "1.1.1",
@ -72,7 +74,7 @@
"sass": "1.87.0",
"terser": "^5.43.1",
"typescript": "~5.8.3",
"unocss": "^66.0.0",
"unocss": "^0.58.0",
"unplugin-auto-import": "19.1.2",
"unplugin-icons": "22.1.0",
"unplugin-vue-components": "28.5.0",

View File

@ -64,6 +64,34 @@ function DelFence(ids) {
})
}
//添加终端
function addTerminal(data){
return request({
url: '/api/equipment/geoFence/addTerminal',
method: 'post',
data: data
})
}
//删除终端
function delTerminal(data){
return request({
url: '/api/equipment/geoFence/delTerminal',
method: 'post',
data:data
})
}
//查询终端
function pageTerminal(data){
return request({
url:'api/device/pageTerminal',
method:'get',
params:data
});
}
export default{
updateFence:updateFence,
AddFence:AddFence,
@ -71,7 +99,10 @@ export default{
check:check,
geoFenceById:geoFenceById,
getList:getList,
DelFence:DelFence
DelFence:DelFence,
addTerminal:addTerminal,
delTerminal:delTerminal,
pageTerminal:pageTerminal
}

View File

@ -1,7 +1,7 @@
var map = null;
var circle = null;
var polygon = null;
import mapLocation from '@/assets/images/mapLocation.png';
function initMap() {
// let key = '90bc158992feb8ccd0145e168cab1307';
@ -9,12 +9,18 @@ function initMap() {
map = new AMap.Map("map", {
viewMode: '2D', //默认使用 2D 模式
zoom: 11, //地图级别
dragEnable: true, // 强制开启拖拽
zoomEnable: true, // 开启滚轮缩放(辅助验证)
center: [114.420739, 30.487514], //地图中心点
});
map.on('click',function(evt){
alert('您点击的位置:'+evt.lnglat.lng+' , '+ evt.lnglat.lat);
});
setTimeout(() => {
map.resize();
}, 1000);
// map.on('click',function(evt){
// alert('您点击的位置:'+evt.lnglat.lng+' , '+ evt.lnglat.lat);
// });
}
return new Promise((resolve, reject) => {
if(map){
@ -39,7 +45,7 @@ function AddPoint(point, index, dragEnd, click) {
let center = point ? new AMap.LngLat(point.lng, point.lat) : map.getCenter();
let marker = new AMap.Text({
icon: "http://wdxm.ztzhtech.com:8111/Script/Home/img/welComeImg/mapLocation.png",
icon: mapLocation,
position: center,
offset: new AMap.Pixel(-15, -24),
draggable: true,

View File

@ -0,0 +1,135 @@
import { param } from '@/utils';
import request from '@/utils/request';
// 详情信息
export const deviceDeatil = (id: string) => {
return request({
url: `/api/hby100j/device/${id}`,
method: 'get',
});
};
// 警示灯爆闪模式
export const strobeMode = (data: any) => {
return request({
url: `/api/hby100j/device/strobeMode`,
method: 'post',
data: data
});
};
// 灯光亮度
function lightModeSettings (data: any) {
return request({
url: `/api/hby100j/device/lightAdjustment`,
method: 'post',
data: data
});
};
//频率调节
function staticPowerSetting (data: any) {
return request({
url: `/api/hby100j/device/strobeFrequency`,
method: 'post',
data: data
});
};
// 修改音量
function settingUpdateVolume (data: any) {
return request({
url: `/api/hby100j/device/updateVolume`,
method: 'post',
data: data
});
};
// 强制报警
function SosSetting (data: any) {
return request({
url: `/api/hby100j/device/forceAlarmActivation`,
method: 'post',
data: data
});
};
// 语音列表
function queryAudioFileList (params: any) {
return request({
url: `/app/video/queryAudioFileList`,
method: 'get',
params: params
});
}
// 提取文本内容
function extractText (data: any) {
return request({
url: `/app/video/extract`,
method: 'post',
data: data
});
}
// 上传音频文件
function uploadAudioToOss (data: any) {
return request({
url: `/app/video/uploadAudioToOss`,
method: 'post',
data: data
});
}
// 文本转语音
export function videTtsToOss(data:any) {
return request({
url: `/app/video/ttsToOss`,
method: 'post',
data:data
})
}
// 重命名
export function videRenameAudioFile(data:any) {
return request({
url: `/app/video/renameAudioFile`,
method: 'post',
data:data
})
}
// 删除语音文件列表
export function deviceDeleteAudioFile(params:any) {
return request({
url: `/app/video/deleteAudioFile`,
method: 'get',
params:params
})
}
// 更新语音,使用语音
export function deviceUpdateVoice(data:any) {
return request({
url: `/app/hby100j/device/updateVoice`,
method: 'post',
data:data
})
}
// 语音播放
export function deviceVoiceBroadcast(data:any) {
return request({
url: `/app/hby100j/device/voiceBroadcast`,
method: 'post',
data:data
})
}
export default {
deviceDeatil,
lightModeSettings:lightModeSettings,
SosSetting:SosSetting,
staticPowerSetting:staticPowerSetting,
settingUpdateVolume:settingUpdateVolume,
queryAudioFileList,
videRenameAudioFile,
deviceDeleteAudioFile,
deviceUpdateVoice,
videTtsToOss,
uploadAudioToOss,
extractText,
strobeMode,
deviceVoiceBroadcast
};

View File

@ -26,6 +26,14 @@ function SosSetting (data: any) {
data: data
});
};
//批量强制报警
function SosSettingBatch(data:any){
return request({
url: `/api/xinghan/device/SOSGradeSettingsBatch`,
method: 'post',
data: data
});
}
//静电探测档位控制
function staticPowerSetting (data: any) {
@ -62,5 +70,6 @@ export default {
SosSetting:SosSetting,
staticPowerSetting:staticPowerSetting,
deviceRealTimeStatus:deviceRealTimeStatus,
SendMessage:SendMessage
SendMessage:SendMessage,
SosSettingBatch:SosSettingBatch
};

View File

@ -0,0 +1,114 @@
import xhyc from '@/api/controlCenter/controlPanel/670'
import fys from '@/api/controlCenter/controlPanel/index'
var dic = [{
typeNames: ['670'],//星汉的配置
sendMsg: {
cfg: ['sendMsg', 'deviceIds', 'deviceImeiList', 'instructValue', 'batchId'],
method: xhyc.SendMessage
},
SOS: {
cfg: ["deviceIds", "typeName", "batchId", "deviceImeiList", "instructValue"],
method: xhyc.SosSettingBatch
},
sendImg: {
cfg: [],
method: null
}
},
{
typeNames: ['6170', '210'],//富源晟的配置
sendMsg: {
cfg: ["deviceIds", "typeName", "batchId", "deviceImeiList", "sendMsg"],
method: fys.deviceSendMessage
},
SOS: {
cfg: ["deviceIds", "typeName", "batchId", "deviceImeiList", "instructValue"],
method: fys.sendAlarmMessage
},
sendImg: {
cfg: [],
method: null
}
},
{
typeNames: null,//如果找不到,以富源晟的配置为准
sendMsg: {
cfg: ["deviceIds", "typeName", "batchId", "deviceImeiList", "sendMsg"],
method: fys.deviceSendMessage
},
SOS: {
cfg: ["deviceIds", "typeName", "batchId", "deviceImeiList", "instructValue"],
method: fys.sendAlarmMessage
},
sendImg: {
cfg: [],
method: null
}
}
];
function getCfg(json, type) {
let f = dic.find(v => {
let flag = false;
for (let index = 0; index < v.typeNames.length; index++) {
let i = v.typeNames[index];
if (i.toLowerCase().indexOf(json.typeName.toLowerCase()) > -1 || json.typeName.toLowerCase().indexOf(i.toLowerCase()) > -1) {
flag = true;
break;
}
}
return flag;
});
if (!f) {
f = dic.find(v => {
return !v.typeNames;
});
}
if (f) {
let keys = f[type].cfg;
let method = f[type].method;
let formData = {};
keys.forEach(key => {
formData[key] = json[key];
});
return {
formData: formData,
method: method
}
}
return null;
}
//发送信息
function deviceSendMessage(json) {
let cfg = getCfg(json, 'sendMsg');
if (cfg.method) {
return cfg.method(cfg.formData);
}
return Promise.reject({ code: 500, msg: '配置中找不到该类型的设备' });
}
//强制报警
function sendAlarmMessage(json) {
let cfg = getCfg(json, 'SOS');
if (cfg.method) {
return cfg.method(cfg.formData);
}
return Promise.reject({ code: 500, msg: '配置中找不到该类型的设备' });
}
export default {
deviceSendMessage: deviceSendMessage,
sendAlarmMessage: sendAlarmMessage
}

View File

@ -1,3 +1,5 @@
import { string } from "vue-types";
export interface deviceQuery {
groupId: string;
pageNum: number;
@ -36,13 +38,12 @@ export interface DeviceDetail {
currentLightMode?: string;// 当前选中的灯光模式(如"strong",对应强光)
sendMsg: string;
lightBrightness: string;
personnelInfo: { // 人员信息(嵌套对象,根据接口调整)
unitName: string; // 单位
position: string; // 职位
name: string; // 姓名
code: string; // ID身份证/工号)
};
chargeState: string
strobeFrequency: string;
volume: string;
chargeState: string;
alarmStatus: number,
voiceStrobeAlarm?:number
voiceBroadcast?:number
}
// 定义灯光模式的类型接口
export interface LightMode {

View File

@ -58,8 +58,17 @@ function uploadBoot(formData){
// });
}
function getDeviceInfoById(id){
// 6170上传logo开机画面
function deviceUploadLogo(formData){
return request({
url: '/api/bjq/device/batchUploadLogo',
method: 'post',
data: formData
})
}
function getDeviceInfoById(id){
return request({
url: '/api/device/debug/detail/'+id,
method: 'get'
@ -67,11 +76,14 @@ function getDeviceInfoById(id){
}
export default{
getDevice:getDevice,
uploadFile:uploadFile,
addVideo:addVideo,
updateItem:updateItem,
uploadBoot:uploadBoot,
getDeviceInfoById:getDeviceInfoById
getDeviceInfoById:getDeviceInfoById,
deviceUploadLogo:deviceUploadLogo
}

View File

@ -0,0 +1,29 @@
import debugCenter from '@/api/debugCenter/debugCenter';
const uploadConfig = {
670: {
api: debugCenter.uploadBoot, // 670对应接口
requiredParams: ['deviceIds', 'file']
},
6170: {
api: debugCenter.deviceUploadLogo,
requiredParams: ['deviceIds', 'file',]
},
default: {
api: debugCenter.uploadBoot,
requiredParams: ['deviceIds', 'file']
}
};
function handleParams(deviceType, deviceIds, file) {
const formattedIds = Array.isArray(deviceIds) ? deviceIds : [deviceIds];
const formData = new FormData();
formattedIds.forEach(id => formData.append('deviceIds', id));
formData.append('file', file);
return formData;
}
export function uploadLogo(deviceType, deviceIds, file) {
const currentConfig = uploadConfig[deviceType] || uploadConfig.default;
const formData = handleParams(deviceType, deviceIds, file);
return currentConfig.api(formData);
}
export default { uploadLogo };

View File

@ -16,6 +16,7 @@ export interface AlarmVO {
deviceMac: string;
devicePic:string;
finishTime: string;
timeDiff:string
}

View File

@ -5,6 +5,8 @@ export interface deviceQuery extends PageQuery {
deviceType: string;
deviceStatus: string;
bluetoothName?: string; // 蓝牙名称查询字段
onlineStatus?: string;
bindingStatus?:string
}
export interface deviceForm {
@ -37,6 +39,7 @@ export interface deviceVO {
customerId?: string | number;
typeName?: string;
bluetoothName?: string; // 蓝牙名称字段
}
export interface deviceTypeOption {

View File

@ -17,7 +17,10 @@ export const addDeviceType = (data: any): AxiosPromise<deviceTypeVO[]> => {
return request({
url: '/api/deviceType/add',
method: 'post',
data: data
data: data,
headers:{
'Content-Type':'application/x-www-form-urlencoded;charset=UTF-8'
}
});
};
@ -26,6 +29,9 @@ export const updateDeviceType = (data: any): AxiosPromise<deviceTypeVO[]> => {
return request({
url: '/api/deviceType/update',
method: 'put',
headers:{
'Content-Type':'application/x-www-form-urlencoded;charset=UTF-8'
},
data
})
}
@ -34,6 +40,7 @@ export const deleteDeviceType = (ids: any): AxiosPromise<deviceTypeVO[]> => {
return request({
url: '/api/deviceType/delete',
method: 'delete',
data: ids
})
}

View File

@ -89,8 +89,9 @@ function getRepairList(data) {
"repairPart": data.repairPart,
"repairReason": data.repairReason,
"repairPerson": data.repairPerson,
"repairBeginTime": data.repairBeginTime,
"repairEndTime": data.repairBeginTime,
"repairBeginTime":data.Date?data.Date[0]:'',
"repairEndTime": data.Date?data.Date[1]:'',
"searchValue":data.searchValue,
"pageNum": data.pageNum,
"pageSize": data.pageSize
}
@ -126,6 +127,13 @@ function getDeviceTypeAll() {
});
}
function getDeviceAll(){
return request({
url:'api/device?pageNum=1&pageSize=99999',
method:'get'}
);
}
export default {
updateRepair: updateRepair,
addRepir: addRepir,
@ -133,5 +141,6 @@ export default {
getRepirDetail: getRepirDetail,
getRepairList: getRepairList,
dropRepir: dropRepir,
getDeviceTypeAll: getDeviceTypeAll
getDeviceTypeAll: getDeviceTypeAll,
getDeviceAll:getDeviceAll
}

View File

@ -0,0 +1,59 @@
import request from '@/utils/request';
// 获取设备总览 DataOverview
export const getDeviceOverview = (params) => {
return request({
url: '/api/largeScreen/getDeviceOverview',
method: 'get',
params: params
});
};
// 报警事件,报警总数统计
export const getAlarmStatistics = (params) => {
return request({
url: '/api/largeScreen/getAlarmStatistics',
method: 'get',
params: params
});
}
// 报警次数
export const getMonthlyAlarmStatistics = (params) => {
return request({
url: '/api/largeScreen/getMonthlyAlarmStatistics',
method: 'get',
params: params
});
}
// 设备类别
export const getDeviceCommunicationModeStatistics = (params = {}) => {
return request({
url: '/api/largeScreen/getDeviceCommunicationModeStatistics',
method: 'get',
params: params
});
}
// 设备使用频次
export const getDeviceUsageFrequency = (params = {}) => {
return request({
url: '/api/largeScreen/getDeviceUsageFrequency',
method: 'get',
params: params
});
}
// 实时报警
export const getRealtimeAlarm = (params = {}) => {
return request({
url: '/api/largeScreen/getRealtimeAlarm',
method: 'get',
params: params
});
}

View File

View File

@ -0,0 +1,241 @@
var map = null;
var layPoints = [];
function initMap(click) {
// let key = '90bc158992feb8ccd0145e168cab1307';
let init = function () {
map = new AMap.Map("map", {
viewMode: '2D', //默认使用 2D 模式
zoom: 11, //地图级别
center: [116.396477, 39.909278], //地图中心点
mapStyle: "amap://styles/darkblue"
});
map.on('click', function (evt) {
// alert('您点击的位置:'+evt.lnglat.lng+' , '+ evt.lnglat.lat);
if (click) {
click(evt.lnglat);
}
});
}
return new Promise((resolve, reject) => {
if (map) {
resolve(200);
return;
}
if (window.AMap) {
init();
resolve(200);
return;
}
reject({ code: 500, msg: '高德地图未能初始化成功' });
});
}
//添加一个点
function AddPoint(point, index, dragEnd, click, iconImg) {
return new Promise((resolve, reject) => {
try {
if (!point) {
reject("point不可用")
return;
}
if (!point.longitude || !point.latitude) {
reject("point的经纬度不可用")
return;
}
layPoints.push({ lng: point.longitude, lat: point.latitude });
let center = new AMap.LngLat(point.longitude, point.latitude);
let icon = new AMap.Icon({
size: new AMap.Size(45, 45), //图标尺寸
image: iconImg, //Icon 的图像
imageSize: new AMap.Size(45, 45), //根据所设置的大小拉伸或压缩图片
});
let marker = new AMap.Marker({
icon: icon,
position: center,
offset: new AMap.Pixel(-15, -24),
draggable: dragEnd ? true : false,
cursor: 'point',
title: point.isAlarming ? '正在报警:' + point.deviceName : point.deviceName,
text: index,
class: 'point',
extData: point,
anchor:'bottom-center'
});
marker.setMap(map);
let lays = map.getAllOverlays('text');
for (let i = 0; i < lays.length; i++) {
const element = lays[i];
let cls = element.getOptions();
if (cls.class) {
element.dom.classList.add(cls.class);
}
}
resolve(center);
} catch (ex) {
reject(ex)
}
});
}
function getCenter() {
var center = map.getCenter().toJSON();
return center;
}
function setCenter(lon, latitude) {
var position = new AMap.LngLat(lon, latitude); //传入经纬度
map.setCenter(position); //简写 设置地图中心点
}
function calcCenter() {
}
//画多边形
function DrawPoy(points) {
return new Promise((resolve, reject) => {
if (!map) {
reject("map未初始化");
return;
}
if (!points) {
reject("points未初始化");
return;
}
if (!points.coordinates) {
reject("coordinates未初始化");
return;
}
if (!Array.isArray(points.coordinates)) {
points.coordinates = JSON.parse(points.coordinates);
}
let path = [];
setTimeout(() => {
points.coordinates.filter(v => {
if (v.lng && v.lat) {
path.push(new AMap.LngLat(v.lng, v.lat));
layPoints.push({ lng: v.lng, lat: v.lat });
return true;
}
return false;
});
if (!path.length) {
reject("path为空");
}
let polygon = new AMap.Polygon({
path: path,
fillColor: '#F00C0C',
fillOpacity: 0.03,
strokeOpacity: 0.1,
strokeColor: '#F00C0C',
strokeWeight: 3,
strokeStyle: 'dashed',
// strokeDasharray: [50,50,50],
extData: points
});
map.add(polygon);
resolve("添加多边形成功");
}, 0);
});
}
//画圆形
function DrawCicle(points, raduis, dragEnd) {
return new Promise((resolve, reject) => {
if (!map) {
reject("map未初始化");
return;
}
if (!points) {
reject("points未初始化");
return;
}
if (!points.coordinates) {
reject("coordinates未初始化");
return;
}
if (!Array.isArray(points.coordinates)) {
points.coordinates = JSON.parse(points.coordinates);
}
if (!(points.coordinates[0].lng && points.coordinates[0].lat)) {
reject("圆的中心点不正确")
return;
}
let circle = new AMap.Circle({
center: [points.coordinates[0].lng, points.coordinates[0].lat],
radius: raduis ? raduis : 1000, //半径
borderWeight: 3,
strokeColor: "#F00C0C",
strokeWeight: 1,
strokeOpacity: 0.2,
fillOpacity: 0.4,
strokeStyle: 'dashed',
strokeDasharray: [10, 10],
// 线样式还支持 'dashed'
fillColor: '#1791fc',
zIndex: 50,
})
map.add(circle);
layPoints.push({ lng: points.coordinates[0].lng, lat: points.coordinates[0].lat });
resolve("添加圆成功");
});
}
//清除所有
function clearOverLays() {
map && map.clearMap();
layPoints = [];
}
function removeOverLay(lay) {
map && map.remove(lay);
}
function setFitView() {
if (map) { map.setFitView(); }
}
export default {
gdMap: map,
initMap: initMap,
AddPoint: AddPoint,
getCenter: getCenter,
DrawPoy: DrawPoy,
DrawCicle: DrawCicle,
clearOverLays: clearOverLays,
removeOverLay: removeOverLay,
setCenter: setCenter,
calcCenter: calcCenter,
setFitView: setFitView
}

View File

@ -0,0 +1,118 @@
import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ServiceVO, ServiceForm, ServiceQuery } from '@/api/system/service/types';
/**
* 查询轨迹服务列表
* @param query
* @returns {*}
*/
export const listService = (query?: ServiceQuery): AxiosPromise<ServiceVO[]> => {
return request({
url: '/api/trackService/list',
method: 'get',
params: query
});
};
/**
* 查询轨迹服务详细
* @param id
*/
export const getService = (id: string | number): AxiosPromise<ServiceVO> => {
return request({
url: '/api/trackService/' + id,
method: 'get'
});
};
/**
* 新增轨迹服务
* @param data
*/
export const addService = (data: ServiceForm) => {
return request({
url: '/api/trackService/add',
method: 'post',
data: data
});
};
/**
* 修改轨迹服务
* @param data
*/
export const updateService = (data: ServiceForm) => {
return Promise.reject({code:500,msg:'不允许此操作'});
// return request({
// url: '/api/trackService/update',
// method: 'put',
// data: data
// });
};
/**
* 删除轨迹服务
* @param id
*/
export const delService = (id: string | number | Array<string | number>) => {
// return request({
// url: '/api/trackService/' + id,
// method: 'delete'
// });
return Promise.reject({code:500,msg:'不允许此操作'});
};
//获取设备
export const getDevice = (data) => {
return request({
url: '/api/device',
method: 'get',
params:data
});
};
//获取设备
export const getDeviceList = (data) => {
return request({
url: '/api/device/list',
method: 'get',
params:data
});
};
//保存
export const terminalDevice=(data)=>{
return request({
url: '/api/trackService/terminal',
method: 'post',
data:data
});
}
//删除
export const delTerminalDevice=(id)=>{
return request({
url: '/api/trackService/delTerminal/'+id,
method: 'delete'
});
}
//获取地图的终端,列表查询
export const getMapDevice = (data) => {
return request({
url: '/api/trackService/listTerminal',
method: 'get',
params:data
});
};
//获取地图的终端,模糊查询
export const getMapDeviceByFilter = (data) => {
return request({
url: '/api/trackService/searchTerminal',
method: 'get',
params:data
});
};

View File

@ -0,0 +1,56 @@
export interface ServiceVO {
/**
*
*/
id: string | number;
/**
* 猎鹰服务ID
*/
sid: string | number;
/**
* 服务名称
*/
sname: string;
}
export interface ServiceForm extends BaseEntity {
/**
*
*/
id?: string | number;
/**
* 猎鹰服务ID
*/
sid?: string | number;
/**
* 服务名称
*/
sname?: string;
}
export interface ServiceQuery extends PageQuery {
/**
* 猎鹰服务ID
*/
sid?: string | number;
/**
* 服务名称
*/
sname?: string;
/**
* 日期范围参数
*/
params?: any;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 384 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 332 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 129 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 333 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 189 KiB

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg id="_图层_1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 17.99 18">
<path id="_矢量_42" d="M17.82,5.81L9.5.08c-.16-.11-.38-.11-.54,0L.2,5.81c-.13.08-.2.21-.2.35v11.41c0,.24.21.43.46.43h5.54c.25,0,.46-.19.46-.43v-2.48c0-1.42,1.17-2.65,2.68-2.69,1.57-.04,2.85,1.13,2.85,2.58v2.59c0,.24.21.43.46.43h5.08c.25,0,.46-.19.46-.43V6.15c0-.14-.06-.26-.18-.35h.01Z"/>
</svg>

After

Width:  |  Height:  |  Size: 417 B

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 16 18">
<path d="M8.1,3.9c.6,0,1-.5,1-1v-1.9C9.1.5,8.6,0,8.1,0s-1,.4-1,1v1.9c0,.6.4,1,1,1h0ZM3.3,5.7c-.4.4-1,.4-1.4,0l-1.6-1.5c-.4-.4-.4-.9,0-1.3.4-.4,1-.4,1.4,0l1.6,1.5c.4.4.4.9,0,1.3ZM12.6,5.7c.4.4,1,.4,1.4,0l1.6-1.5c.4-.4.4-.9,0-1.3-.4-.4-1-.4-1.4,0l-1.6,1.5c-.4.4-.4.9,0,1.3ZM3,15.4v-5.4c0-2.8,2.3-5.1,5-5.1s5.1,2.3,5.1,5.1v5.4h1.6c.7,0,1.3.6,1.3,1.3s-.6,1.3-1.3,1.3H1.5c-.7,0-1.3-.6-1.3-1.3s.6-1.3,1.3-1.3c0,0,1.6,0,1.6,0ZM10.1,11.3h-1.1c-.1,0-.2,0-.2-.2l.4-2.1c0-.1-.2-.2-.3-.1l-2.9,2.6c0,0,0,.2.1.2h1.2c0,0,.2,0,.2.2l-.4,2.1c0,.1.2.2.3.1l2.9-2.6c.1,0,0-.2-.1-.2Z"/>
</svg>

After

Width:  |  Height:  |  Size: 699 B

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 18 16">
<path id="_矢量_54" class="cls-1" d="M13.5,12.6v-1.1h2.2v1.1h2.2v2.3h-2.2v1.1h-2.2v-1.1H0v-2.3h13.5ZM7.9,6.9v-1.1h2.2v1.1h7.9v2.3h-7.9v1.1h-2.2v-1.1H0v-2.3s7.9,0,7.9,0ZM2.2,1.1V0h2.2v1.1h13.5v2.3H4.5v1.1h-2.2v-1.1H0V1.1h2.2Z"/>
</svg>

After

Width:  |  Height:  |  Size: 356 B

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 18 15">
<path d="M.8,0h16.4s.1,0,.2,0c0,0,.1,0,.1,0,0,0,.1,0,.1,0,0,0,0,0,.1,0,0,0,0,0,.1.1s0,0,0,.1c0,0,0,.1,0,.2,0,0,0,.1,0,.2v10.8c0,0,0,.1,0,.2,0,0,0,.1,0,.2,0,0,0,.1,0,.1,0,0,0,0-.1.1s0,0-.1.1c0,0,0,0-.1,0,0,0-.1,0-.1,0s-.1,0-.2,0H.8c0,0-.1,0-.2,0,0,0-.1,0-.1,0,0,0,0,0-.1,0s0,0-.1-.1c0,0,0,0,0-.1s0,0,0-.1c0,0,0-.1,0-.2C0,11.8,0,11.7,0,11.7V.8S0,.7,0,.7c0,0,0-.1,0-.2s0,0,0-.1c0,0,0,0,0-.1s0,0,.1,0c0,0,0,0,.1,0,0,0,.1,0,.1,0C.7,0,.8,0,.8,0h0ZM2.5,6.7h0s0,0,0,0c0,0,0,0,0,0s0,0,0,0,0,0,0,0,0,0,0,0c0,0,0,0,0,0v2.7s0,0,0,0,0,0,0,0c0,0,0,0,0,0s0,0,0,0c0,0,0,0,0,0s0,0,0,0h1s0,0,0,0c0,0,0,0,0,0,0,0,0,0,0,0s0,0,0,0,0,0,0,0c0,0,0,0,0,0v-2.7s0,0,0,0,0,0,0,0c0,0,0,0,0,0s0,0,0,0c0,0,0,0,0,0s0,0,0,0h-.9ZM6.5,5h0s0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0c0,0,0,0,0,0v4.3s0,0,0,0c0,0,0,0,0,0,0,0,0,0,0,0s0,0,0,0c0,0,0,0,0,0s0,0,0,0h1s0,0,0,0c0,0,0,0,0,0,0,0,0,0,0,0s0,0,0,0,0,0,0,0c0,0,0,0,0,0v-4.3s0,0,0,0c0,0,0,0,0,0,0,0,0,0,0,0s0,0,0,0c0,0,0,0,0,0s0,0,0,0c0,0-.9,0-.9,0ZM10.6,2.5h0s0,0,0,0c0,0,0,0,0,0,0,0,0,0,0,0s0,0,0,0,0,0,0,0c0,0,0,0,0,0v6.8s0,0,0,0,0,0,0,0c0,0,0,0,0,0s0,0,0,0c0,0,0,0,0,0,0,0,0,0,0,0h1s0,0,0,0c0,0,0,0,0,0s0,0,0,0,0,0,0,0,0,0,0,0c0,0,0,0,0,0V2.8s0,0,0,0,0,0,0,0c0,0,0,0,0,0s0,0,0,0c0,0,0,0,0,0s0,0,0,0h0s-.8,0-.8,0ZM14.7,5.8h0s0,0,0,0c0,0,0,0,0,0,0,0,0,0,0,0s0,0,0,0c0,0,0,0,0,0,0,0,0,0,0,0v3.5s0,0,0,0,0,0,0,0c0,0,0,0,0,0s0,0,0,0c0,0,0,0,0,0,0,0,0,0,0,0h1s0,0,0,0c0,0,0,0,0,0s0,0,0,0,0,0,0,0,0,0,0,0c0,0,0,0,0,0v-3.5s0,0,0,0c0,0,0,0,0,0,0,0,0,0,0,0s0,0,0,0c0,0,0,0,0,0s0,0,0,0h0s-.8,0-.8,0ZM6.6,14.2v-.5s0,0,0,0c0,0,0,0,0,0,0,0,0,0,0,0s0,0,0,0c0,0,0,0,0,0s0,0,0,0h4.3s0,0,0,0c0,0,0,0,0,0s0,0,0,0,0,0,0,0,0,0,0,0c0,0,0,0,0,0v.5h3.8s0,0,0,0c0,0,0,0,0,0s0,0,0,0,0,0,0,0,0,0,0,0c0,0,0,0,0,0v.2s0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0c0,0,0,0,0,0,0,0,0,0,0,0H2.8s0,0,0,0c0,0,0,0,0,0s0,0,0,0,0,0,0,0c0,0,0,0,0,0,0,0,0,0,0,0v-.2s0,0,0,0,0,0,0,0c0,0,0,0,0,0s0,0,0,0c0,0,0,0,0,0s0,0,0,0h3.8Z"/>
</svg>

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 16 18">
<path d="M5.8,2.4h4.4c.4,0,.7-.3.7-.7V.7c0-.4-.3-.7-.7-.7h-4.4c-.4,0-.7.3-.7.7v1.1c0,.4.3.7.7.7Z"/>
<path d="M13.8,1.3h-2.3v.7c0,.5-.4.8-.9.8h-5.2c-.5,0-.9-.4-.9-.8v-.7h-2.3C1,1.3,0,2.2,0,3.4v12.5c0,1.1,1,2.1,2.2,2.1h11.5c1.2,0,2.2-.9,2.2-2.1V3.4c0-1.2-1-2.1-2.2-2.1ZM13.2,13.4H3.3c-.3,0-.6-.2-.6-.5s.2-.5.6-.5h9.9c.3,0,.6.2.6.5s-.3.5-.6.5h0ZM13.2,10H3.3c-.3,0-.6-.2-.6-.5s.2-.5.6-.5h9.9c.3,0,.6.2.6.5s-.3.5-.6.5h0ZM13.2,6.5H3.3c-.3,0-.6-.2-.6-.5s.2-.5.6-.5h9.9c.3,0,.6.2.6.5s-.3.5-.6.5h0Z"/>
</svg>

After

Width:  |  Height:  |  Size: 633 B

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 18 18">
<path d="M16.9,12.8c-.1-.4-.3-.8-.5-1.2l.6-1-.5-.6-1,.6c-.3-.2-.7-.4-1.1-.4l-.3-1.2h-.8l-.3,1.2c-.4,0-.7.2-1.1.4l-1-.6-.5.6.6,1c-.2.4-.4.8-.5,1.2l-1.1.3v.8l1,.3c0,.5.2,1,.5,1.4l-.5.9.5.5.8-.5c.4.3.9.6,1.4.7l.2.9h.8l.2-.9c.3,0,.5-.1.8-.2s.5-.2.7-.4l.8.5.5-.5-.5-.9c.3-.4.4-.9.5-1.4l1-.3v-.8l-1.1-.3s0,0,0,0ZM13.7,15.6h-.2c0,0-.1,0-.2,0,0,0-.1,0-.2,0s-.1,0-.2,0c0,0-.1,0-.2,0,0,0-.1,0-.2-.1s-.1,0-.1-.1c0,0,0,0-.1-.1,0,0,0,0-.1-.1s0-.1-.1-.1c0,0,0-.1,0-.2,0,0,0-.1,0-.2s0-.1,0-.2,0-.1,0-.2c0,0,0-.1,0-.2v-.4c0,0,0-.1,0-.2,0,0,0-.1,0-.2,0,0,0-.1,0-.2s0-.1,0-.2c0,0,0-.1,0-.2s0-.1.1-.1c0,0,0-.1.1-.1,0,0,0,0,.1-.1s.1,0,.1-.1c0,0,.1,0,.2-.1s.1,0,.2,0c0,0,.1,0,.2,0,0,0,.1,0,.2,0,0,0,.1,0,.2,0h.4c0,0,.1,0,.2,0,0,0,.1,0,.2,0s.1,0,.2,0c0,0,.1,0,.2,0,0,0,.1,0,.2.1s.1,0,.1.1c0,0,0,0,.1.1,0,0,0,0,.1.1s0,.1.1.1c0,0,0,.1,0,.2,0,0,0,.1,0,.2s0,.1,0,.2,0,.1,0,.2c0,0,0,.1,0,.2v.4c0,0,0,.1,0,.2,0,0,0,.1,0,.2,0,0,0,.1,0,.2s0,.1,0,.2c0,0,0,.1,0,.2s0,.1-.1.1c0,0,0,.1-.1.1,0,0,0,0-.1.1s-.1,0-.1.1c0,0-.1,0-.2.1,0,0-.1,0-.2,0,0,0-.1,0-.2,0,0,0-.1,0-.2,0,0,0-.1,0-.2,0,0,0-.2,0-.2,0ZM10.4,9.6c-.6-.5-1.3-.8-2-1,1.4-.7,2.5-2.3,2.5-4S8.9,0,6.5,0,2.2,2,2.2,4.5s1,3.3,2.4,4C1.9,9.4,0,11.9,0,14.8,0,14.8,3.3,15.8,6.6,15.8s1.7,0,2.5-.2c-.1-.3-.2-.7-.3-1,0-.4-.1-.7-.1-1.1,0-1.6.7-3,1.7-3.9h0Z"/>
</svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 18 18">
<path d="M7.4,12.7c.3-2,1.8-3.2,2.4-3.7h0c0,0,.2,0,.3-.2,1.9-.7,3.2-2.3,3.2-4.3,0-2.5-2.3-4.6-5.1-4.6S3.1,2.1,3.1,4.6s1.4,3.6,3.3,4.3c-.9.2-1.8.6-2.5,1C.6,11.7,0,14.2,0,17.7s.3.3.6.3h9.9l-.9-.4c-.9-.4-2.7-2.3-2.3-4.9h0Z"/>
<path d="M13.2,11.6l-1.7,1.4v2.4h.7v-1.2h2v1.2h.7v-2.4l-1.7-1.4h0ZM14.9,11.9h-.3l.3.3v-.3Z"/>
<path d="M13.2,9.1c-2.7,0-4.8,2-4.8,4.4s2.2,4.4,4.8,4.4,4.8-2,4.8-4.4-2.1-4.4-4.8-4.4ZM15.9,13.6c0,0-.1,0-.3,0s-.1,0-.2,0v2c0,.2-.2.4-.5.4h-1.6v-1.2h-.6v1.2h-1.6c-.3,0-.5-.2-.5-.4v-2s0,0-.2,0-.2,0-.3,0,0-.2,0-.2,0-.2,0-.2l2.4-2c.3-.2.6-.2.9,0l.4.4c0,0,.2-.2.3-.2h.9c.2,0,.3.2.3.3v.8c0,.1,0,.2-.1.2l.5.5c0,0,0,.1,0,.2,0,0,0,.1,0,.2h0Z"/>
</svg>

After

Width:  |  Height:  |  Size: 804 B

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 18 18">
<path d="M17.2,2.8s0,0,0,0c-.1-.1-.3-.1-.4,0l-3.2,3.2c-.4.4-1,.4-1.4,0h-.1c-.4-.5-.4-1.1,0-1.5l3.2-3.2s0,0,0,0c0-.1,0-.3-.1-.4-2.2-1.3-5.1-1-7,.9-1.4,1.4-1.9,3.2-1.6,5,0,.3,0,.7-.3,1L0,13.9c0,0,0,.2,0,.2l3.8,3.8c0,0,.2,0,.2,0l6.2-6.2c.2-.2.6-.3,1-.3,1.8.3,3.7-.2,5-1.6,1.9-1.9,2.2-4.8.9-7h0Z"/>
</svg>

After

Width:  |  Height:  |  Size: 428 B

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 18 18">
<path id="_联调中心图标" class="cls-1" d="M9.8,12.3c-1.1,0-2.1-.4-2.9-1.2-.2-.2-.3-.5-.3-.8s.1-.6.3-.8c.4-.4,1.2-.4,1.6,0,.8.8,2.1.7,3-.2l3.5-3.5c.5-.5.7-1.1.7-1.7s0-.9-.6-1.3c-.5-.5-1-.6-1.4-.5-.6,0-1.1.3-1.6.7l-2,2c-.5-.5-2.4-.8-2.9-.3l3.3-3.3c.9-.9,2-1.4,3.1-1.4,1.2,0,2.3.4,3.1,1.2.8.8,1.2,1.8,1.2,2.9s-.5,2.4-1.4,3.3l-3.5,3.5c-.9.9-2.1,1.4-3.3,1.4M4.9,7.1l-3.5,3.5C.5,11.5,0,12.7,0,13.9s.4,2.1,1.2,2.9c.8.8,1.9,1.3,3.1,1.2,1.1,0,2.2-.5,3.1-1.4l3.3-3.3c-.5.5-2.5.2-2.9-.3l-2,2c-.4.4-1,.7-1.6.7-.4,0-.9,0-1.4-.6-.5-.4-.5-1-.5-1.3,0-.6.3-1.2.7-1.7l3.5-3.5c.9-.9,2.2-1,3-.2s.5.3.8.3.6-.1.8-.3.3-.5.3-.8-.1-.6-.3-.8c-.8-.8-1.9-1.2-2.9-1.2s-2.4.5-3.3,1.4h0Z"/>
</svg>

After

Width:  |  Height:  |  Size: 793 B

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 18 18">
<path d="M17.6,14.4l-6.4,3.5s-.1,0-.1,0c0,0-.1,0-.2,0h-.2c0,0-.1,0-.2,0,0,0-.1,0-.2,0,0,0-.1,0-.1,0s0,0-.1-.1,0,0-.1-.1c0-.1-.1-.3-.1-.4v-5.9c0,0,0-.1,0-.2,0,0,0-.1,0-.2,0,0,0-.1.1-.2,0,0,.1,0,.2-.1l6.4-3.5s.1,0,.1,0,.1,0,.2,0h.2c0,0,.1,0,.2,0,0,0,.1,0,.2,0,0,0,.1,0,.1,0,0,0,0,0,.1.1s0,0,.1.1c0,.1.1.3.1.4v5.9c0,0,0,.1,0,.2,0,0,0,.1,0,.2,0,0,0,.1-.1.2,0,0-.1,0-.2.1h0ZM.4,14.4c0,0-.1,0-.2-.1,0,0,0-.1-.1-.2,0,0,0-.1,0-.2C0,13.8,0,13.7,0,13.6v-5.9C0,7.3.4,7,.9,7s.3,0,.4.1l6.4,3.5c0,0,.1,0,.2.1,0,0,0,.1.1.2s0,.1,0,.2,0,.1,0,.2v5.9c0,.5-.4.8-.9.8s-.3,0-.4-.1L.4,14.4H.4ZM8.6.1c.3-.1.6-.1.9,0l7.3,3.9s0,0,0,0,0,0,0,0c0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0v.2s0,0,0,0c0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0l-7.3,3.9c0,0-.1,0-.2,0,0,0-.1,0-.2,0s-.1,0-.2,0-.1,0-.2,0L1.3,5.5s0,0,0,0c0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0v-.2s0,0,0,0c0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0s0,0,0,0c0,0,0,0,0,0,0,0,0,0,0,0L8.6.1h0Z"/>
</svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 18 18">
<path d="M17.8,5.8L9.5,0c-.2-.1-.4-.1-.5,0L.2,5.8c-.1,0-.2.2-.2.3v11.4c0,.2.2.4.5.4h5.5c.2,0,.5-.2.5-.4v-2.5c0-1.4,1.2-2.6,2.7-2.7,1.6,0,2.8,1.1,2.8,2.6v2.6c0,.2.2.4.5.4h5.1c.2,0,.5-.2.5-.4V6.2c0-.1,0-.3-.2-.3h0Z"/>
</svg>

After

Width:  |  Height:  |  Size: 345 B

BIN
src/assets/images/di.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

BIN
src/assets/images/diAc.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

BIN
src/assets/images/dw.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 523 B

BIN
src/assets/images/haiba.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1001 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
src/assets/images/hb.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
src/assets/images/hbAc.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
src/assets/images/high.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

BIN
src/assets/images/jieN.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 994 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1014 B

BIN
src/assets/images/jwd.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 330 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 877 B

BIN
src/assets/images/ly.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
src/assets/images/lz.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

BIN
src/assets/images/rb.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

BIN
src/assets/images/rbAc.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

BIN
src/assets/images/rg1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 304 B

BIN
src/assets/images/rg1Ac.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
src/assets/images/sg.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

BIN
src/assets/images/sgAc.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 768 B

BIN
src/assets/images/sos.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 849 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 865 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
src/assets/images/work.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 989 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 992 B

BIN
src/assets/images/zhong.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

BIN
src/assets/images/zk.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 320 B

BIN
src/assets/images/zt.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 125 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 992 B

BIN
src/assets/index/IMG.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -88,12 +88,7 @@ div:focus {
.pl-5 {
padding-left: 5px;
}
.p-2{
background: rgba(247, 248, 252, 1);
min-height: 100vh;
box-sizing: border-box;
padding: 15px;
}
.block {
display: block;

View File

@ -57,9 +57,9 @@ const props = defineProps({
// 数量限制
limit: propTypes.number.def(5),
// 大小限制(MB)
fileSize: propTypes.number.def(5),
fileSize: propTypes.number.def(200),
// 文件类型, 例如['png', 'jpg', 'jpeg']
fileType: propTypes.array.def(['doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx', 'txt', 'pdf']),
fileType: propTypes.array.def(['doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx', 'txt', 'pdf','apk','wgt','html','mp3','mp4','ttf']),
// 是否显示提示
isShowTip: propTypes.bool.def(true),
// 禁用组件(仅查看文件)

View File

@ -28,7 +28,6 @@ function copyTextToClipboard(input: string, { target = document.body } = {}) {
element.value = input;
// Prevent keyboard from showing on mobile
element.setAttribute('readonly', '');
element.style.contain = 'strict';
element.style.position = 'absolute';
element.style.left = '-9999px';

View File

@ -1,13 +1,16 @@
<template>
<div v-if="!item.hidden">
<template v-if="hasOneShowingChild(item, item.children) && (!onlyOneChild.children || onlyOneChild.noShowingChildren) && !item.alwaysShow">
<template
v-if="hasOneShowingChild(item, item.children) && (!onlyOneChild.children || onlyOneChild.noShowingChildren) && !item.alwaysShow">
<app-link v-if="onlyOneChild.meta" :to="resolvePath(onlyOneChild.path, onlyOneChild.query)">
<el-menu-item :index="resolvePath(onlyOneChild.path)" :class="{ 'submenu-title-noDropdown': !isNest }">
<svg-icon :icon-class="onlyOneChild.meta.icon || (item.meta && item.meta.icon)" />
<template #title>
<span class="menu-title" :title="hasTitle(onlyOneChild.meta.title)">{{ onlyOneChild.meta.title }}</span>
</template>
</el-menu-item>
<span @click="handleMenuClick(onlyOneChild, $event)">
<el-menu-item :index="resolvePath(onlyOneChild.path)" :class="{ 'submenu-title-noDropdown': !isNest }">
<svg-icon :icon-class="onlyOneChild.meta.icon || (item.meta && item.meta.icon)" />
<template #title>
<span class="menu-title" :title="hasTitle(onlyOneChild.meta.title)">{{ onlyOneChild.meta.title }}</span>
</template>
</el-menu-item>
</span>
</app-link>
</template>
@ -17,14 +20,8 @@
<span class="menu-title" :title="hasTitle(item.meta?.title)">{{ item.meta?.title }}</span>
</template>
<sidebar-item
v-for="(child, index) in item.children"
:key="child.path + index"
:is-nest="true"
:item="child"
:base-path="resolvePath(child.path)"
class="nest-menu"
/>
<sidebar-item v-for="(child, index) in item.children" :key="child.path + index" :is-nest="true" :item="child"
:base-path="resolvePath(child.path)" class="nest-menu" />
</el-sub-menu>
</div>
</template>
@ -77,8 +74,25 @@ const hasOneShowingChild = (parent: RouteRecordRaw, children?: RouteRecordRaw[])
return false;
};
const router = useRouter();
// 处理菜单点击,完全控制跳转行为
const handleMenuClick = (route, event) => {
console.log(route, 'route');
if (route.meta.openInNewTab) {
// 完全阻止默认行为和事件冒泡
event.preventDefault();
event.stopPropagation();
console.log('Opening in new tab:', route);
const resolvedRoute = router.resolve({
name: route.name || route.path
});
const fullUrl = new URL(resolvedRoute.href, window.location.origin).href;
window.open(fullUrl, '_blank');
} else {
}
};
const resolvePath = (routePath: string, routeQuery?: string): any => {
if (isExternal(routePath)) {
return routePath;
}

View File

@ -39,6 +39,12 @@ export const constantRoutes: RouteRecordRaw[] = [
component: () => import('@/views/error/401.vue'),
hidden: true
},
{
path: "/homeIndex",
name: "HomeIndex",
component: () => import("@/views/homeIndex/index.vue"),
meta: { title: '数据大屏', icon: '首页1.1', preload: true, keepAlive: true, openInNewTab: true },
},
{
path: '',
component: Layout,
@ -48,10 +54,11 @@ export const constantRoutes: RouteRecordRaw[] = [
path: '/index',
component: () => import('@/views/index.vue'),
name: 'Index',
meta: { title: '首页', icon: 'dashboard', affix: true,keepAlive: false }
meta: { title: '首页', icon: '首页1.1', affix: true, keepAlive: false }
}
]
},
{
path: '/user',
component: Layout,

View File

@ -17,8 +17,10 @@ export interface SubscribeOptions {
// 根据当前页面协议自动选择MQTT配置
const getMqttConfig = () => {
// 检测当前页面协议http: 或 https:
const isHttps = window.location.protocol === 'https:';
console.log(isHttps,'检测环境');
//const isHttps = window.location.protocol === 'https:';
const isHttps =true;// import.meta.env.VITE_APP_ENV === 'production' || window.location.protocol === 'https:';
console.log(isHttps,'检测环境');
return {
// 自动切换协议https页面用wsshttp页面用ws
@ -220,9 +222,7 @@ export function useMqtt() {
return;
}
const message = new Paho.Message(
typeof payload === 'string' ? payload : payload.toString()
);
const message = new Paho.Message(payload);
message.destinationName = topic;
message.qos = options.qos;

113
src/utils/timeConverter.ts Normal file
View File

@ -0,0 +1,113 @@
/**
* 时间转换工具类
* 提供时间格式化、时间差计算等功能
*/
export class TimeConverter {
/**
* 检查时间字符串是否有效
* @param timeStr 时间字符串
* @returns 是否有效的时间
*/
static isValidTime(timeStr: string): boolean {
if (!timeStr) return false;
return !isNaN(new Date(timeStr).getTime());
}
/**
* 格式化时间
* @param timeStr 时间字符串
* @param format 格式,可选值: 'YYYY-MM-DD', 'HH:mm:ss', 'YYYY-MM-DD HH:mm:ss'
* @returns 格式化后的时间字符串
*/
static formatTime(timeStr: string, format: 'YYYY-MM-DD' | 'HH:mm:ss' | 'YYYY-MM-DD HH:mm:ss' = 'YYYY-MM-DD HH:mm:ss'): string {
if (!this.isValidTime(timeStr)) return '无效时间';
const date = new Date(timeStr);
const year = date.getFullYear();
const month = this.padZero(date.getMonth() + 1);
const day = this.padZero(date.getDate());
const hours = this.padZero(date.getHours());
const minutes = this.padZero(date.getMinutes());
const seconds = this.padZero(date.getSeconds());
switch (format) {
case 'YYYY-MM-DD':
return `${year}-${month}-${day}`;
case 'HH:mm:ss':
return `${hours}:${minutes}:${seconds}`;
case 'YYYY-MM-DD HH:mm:ss':
default:
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
}
}
/**
* 计算与当前时间的差值(格式为 HH:mm:ss
* @param startTimeStr 起始时间字符串
* @returns 格式化的时间差字符串
*/
static calculateTimeDiff(startTimeStr: string): string {
if (!this.isValidTime(startTimeStr)) return '';
const startTime = new Date(startTimeStr).getTime();
const nowTime = new Date().getTime();
const diffMs = nowTime - startTime;
// 处理未来时间
if (diffMs < 0) {
return '00:00:00';
}
// 计算总秒数
const totalSeconds = Math.floor(diffMs / 1000);
// 计算时、分、秒
const hours = this.padZero(Math.floor(totalSeconds / 3600));
const minutes = this.padZero(Math.floor((totalSeconds % 3600) / 60));
const seconds = this.padZero(totalSeconds % 60);
return `${hours}:${minutes}:${seconds}`;
}
/**
* 数字补零
* @param num 数字
* @returns 补零后的字符串
*/
private static padZero(num: number): string {
return num < 10 ? `0${num}` : num.toString();
}
/**
* 创建一个时间差更新定时器
* @param startTimeStr 起始时间字符串
* @param callback 回调函数,接收计算后的时间差
* @param interval 刷新间隔(毫秒)
* @returns 定时器ID用于清除定时器
*/
static createTimeDiffTimer(
startTimeStr: string,
callback: (diffText: string) => void,
interval: number = 1000
): number {
// 立即执行一次
callback(this.calculateTimeDiff(startTimeStr));
// 设置定时器
const timerId = window.setInterval(() => {
callback(this.calculateTimeDiff(startTimeStr));
}, interval);
return timerId;
}
/**
* 清除时间差更新定时器
* @param timerId 定时器ID
*/
static clearTimeDiffTimer(timerId: number | null): void {
if (timerId) {
clearInterval(timerId);
}
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -4,4 +4,11 @@
</div>
</template>
<script setup lang="ts"></script>
<style lang="scss" scoped></style>
<style lang="scss" scoped>
.p-2{
background: rgba(247, 248, 252, 1);
min-height: 100vh;
box-sizing: border-box;
padding: 15px;
}
</style>

View File

@ -0,0 +1,264 @@
<template>
<div class="text-to-hex">
<canvas
ref="canvasRef"
:width="currentCanvasWidth"
:height="currentCanvasHeight"
class="offscreen-canvas"
></canvas>
</div>
</template>
<script setup>
import { ref, computed, onMounted } from 'vue';
// Props 定义
const props = defineProps({
txts: {
type: Array,
default: () => [],
validator: (value) => value.every(item => typeof item === 'string')
},
fontSize: {
type: Number,
default: 16,
validator: (value) => value > 0 && value <= 100
},
bgColor: {
type: String,
default: "#ffffff"
},
color: {
type: String,
default: "#000000"
},
fontFamily: {
type: String,
default: "PingFang SC, Microsoft YaHei, Arial, sans-serif"
}
});
// 响应式数据
const canvasRef = ref(null);
const currentCanvasWidth = ref(0);
const currentCanvasHeight = ref(0);
let ctx = null;
const canvasWarmed = ref(false);
// 计算属性
const validTxts = computed(() => {
return props.txts.filter(line => line && line.trim() !== '');
});
// 获取字符实际宽度
const getCharWidth = (char) => {
if (!ctx) return props.fontSize * 0.6;
ctx.font = `${props.fontSize}px ${props.fontFamily}`;
return ctx.measureText(char).width;
};
// 计算整行宽度(精确)
const calcLineWidth = (textLine) => {
if (!ctx) return textLine.length * props.fontSize * 0.6;
ctx.font = `${props.fontSize}px ${props.fontFamily}`;
let totalWidth = 0;
for (let i = 0; i < textLine.length; i++) {
totalWidth += ctx.measureText(textLine[i]).width;
}
return Math.ceil(totalWidth);
};
// 清除Canvas内容
const clearCanvas = () => {
if (!ctx) return;
ctx.fillStyle = props.bgColor;
ctx.fillRect(0, 0, currentCanvasWidth.value, currentCanvasHeight.value);
};
// 预热画布
const warmupCanvas = async () => {
if (canvasWarmed.value || !ctx) return;
try {
currentCanvasWidth.value = 16;
currentCanvasHeight.value = 16;
clearCanvas();
ctx.fillStyle = props.color;
ctx.font = `${props.fontSize}px ${props.fontFamily}`;
ctx.textBaseline = 'middle';
ctx.fillText('测', 0, 8);
// 等待字体加载完成
await document.fonts.ready;
// 获取像素数据验证画布可用
const imageData = ctx.getImageData(0, 0, 16, 16);
if (imageData) {
canvasWarmed.value = true;
}
// 额外等待确保字体完全渲染
await new Promise(resolve => setTimeout(resolve, 100));
} catch (ex) {
console.log("画布预热异常:", ex);
canvasWarmed.value = true;
}
};
// 像素数据转16进制矩阵
const convertCharToMatrix = (imageData, width, height) => {
let matrix = [];
const data = imageData.data;
// 只处理16x16的字符矩阵
for (let y = 0; y < 16; y++) {
let byte1 = 0, byte2 = 0;
for (let x = 0; x < 16; x++) {
// 计算实际像素位置需要考虑画布可能比16宽
let actualX = Math.floor(x * width / 16);
let actualY = Math.floor(y * height / 16);
let index = (actualY * width + actualX) * 4;
let red = data[index];
let green = data[index + 1];
let blue = data[index + 2];
// 判断是否为非背景色(根据颜色阈值)
// let isBlack = !(red > 200 && green > 200 && blue > 200);
let gray = (red + green + blue) / 3;
let isBlack = gray < 255 ;
if (x < 8) {
if (isBlack) {
byte1 |= 0x80 >> x;
}
} else {
if (isBlack) {
byte2 |= 0x80 >> (x - 8);
}
}
}
matrix.push('0x' + byte1.toString(16).padStart(2, '0').toUpperCase());
matrix.push('0x' + byte2.toString(16).padStart(2, '0').toUpperCase());
}
return matrix;
};
// 绘制单个字符并获取像素数据
const drawChar = async (char) => {
return new Promise((resolve, reject) => {
try {
// 获取字符宽度
const charWidth = getCharWidth(char);
const canvasWidth = Math.max(16, Math.ceil(charWidth));
// 调整画布尺寸
currentCanvasWidth.value = canvasWidth;
currentCanvasHeight.value = 16;
// 重置画布尺寸
if (canvasRef.value) {
canvasRef.value.width = canvasWidth;
canvasRef.value.height = 16;
}
// 清空画布
clearCanvas();
// 绘制字符
ctx.fillStyle = props.color;
ctx.font = `${props.fontSize}px ${props.fontFamily}`;
ctx.textBaseline = 'middle';
ctx.fillText(char, 0, 8);
// 获取像素数据
const imageData = ctx.getImageData(0, 0, canvasWidth, 16);
resolve({
char: char,
pixelData: imageData,
width: canvasWidth,
height: 16
});
} catch (err) {
reject(err);
}
});
};
// 绘制文本行并获取所有字符的矩阵数据
const drawLine = async (textLine) => {
const charMatrices = [];
for (let i = 0; i < textLine.length; i++) {
const char = textLine[i];
const result = await drawChar(char);
const matrix = convertCharToMatrix(result.pixelData, result.width, result.height);
charMatrices.push(matrix);
}
return charMatrices;
};
// 主方法:处理所有文本并返回十六进制矩阵数组
const drawAndGetPixels = async () => {
// 确保画布已预热
await warmupCanvas();
const result = [];
for (let i = 0; i < validTxts.value.length; i++) {
const line = validTxts.value[i];
const lineMatrices = await drawLine(line);
result.push(lineMatrices);
}
return result;
};
// 获取单个字符的十六进制矩阵(便捷方法)
const getCharHexMatrix = async (char) => {
await warmupCanvas();
const result = await drawChar(char);
return convertCharToMatrix(result.pixelData, result.width, result.height);
};
// 获取文本行的十六进制矩阵(便捷方法)
const getTextLineHexMatrix = async (textLine) => {
await warmupCanvas();
return await drawLine(textLine);
};
// 暴露方法给父组件
defineExpose({
drawAndGetPixels,
getCharHexMatrix,
getTextLineHexMatrix
});
// 生命周期
onMounted(() => {
if (canvasRef.value) {
ctx = canvasRef.value.getContext('2d');
}
});
</script>
<style scoped>
.text-to-hex {
position: relative;
}
.offscreen-canvas {
position: fixed;
left: -9999px;
top: -9999px;
visibility: hidden;
pointer-events: none;
}
</style>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More