forked from dyf/dyf-vue-ui
Compare commits
21 Commits
ee4eec1e2e
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| a1b3d03a0c | |||
| 33d2123778 | |||
| 5139a112c5 | |||
| e7d2cc94f8 | |||
| eb8e4e1c69 | |||
| ead17e67bb | |||
| 7eb35c9a4e | |||
| 5597a4c2ca | |||
| 010028da0d | |||
| 30079ec854 | |||
| 3c504cb65c | |||
| aa7229e21b | |||
| 84af6f5cfe | |||
| c7a05f2118 | |||
| 7445e789a4 | |||
| fabab0a577 | |||
| 8b53fbe0ca | |||
| 65af3b6956 | |||
| 47d8f14ad4 | |||
| 1c664cc2f6 | |||
| b89bc455f6 |
@ -5,12 +5,13 @@ VITE_APP_TITLE = 云平台管理系统
|
||||
VITE_APP_ENV = 'development'
|
||||
|
||||
# 开发环境
|
||||
#VITE_APP_BASE_API = 'https://fuyuanshen.com/backend'
|
||||
VITE_APP_BASE_API = 'https://www.cnxhyc.com/jq'
|
||||
#VITE_APP_BASE_API = 'http://192.168.2.34:8000'
|
||||
# VITE_APP_BASE_API = 'http://139.224.253.23: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 = '/'
|
||||
|
||||
@ -2,13 +2,16 @@
|
||||
VITE_APP_TITLE = 云平台管理系统
|
||||
|
||||
# 生产环境配置 晶全1
|
||||
VITE_APP_ENV = 'https://fuyuanshen.com/backend'
|
||||
VITE_APP_ENV = 'https://www.cnxhyc.com'
|
||||
|
||||
# 生产环境配置 富源晟2
|
||||
# VITE_APP_ENV = 'https://fuyuanshen.com/backend-fys'
|
||||
|
||||
# 应用访问路径 晶全1
|
||||
VITE_APP_CONTEXT_PATH = '/jingquan/'
|
||||
VITE_APP_CONTEXT_PATH = '/'
|
||||
|
||||
# 高德地图Key
|
||||
VITE_AMAP_KEY='84a12a692ae378effdf741e16d584cd3'
|
||||
|
||||
# 应用访问路径 富源晟2
|
||||
#VITE_APP_CONTEXT_PATH = '/sys/'
|
||||
@ -19,8 +22,8 @@ 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'
|
||||
|
||||
# 生产环境 富源晟3
|
||||
#VITE_APP_BASE_API = '/backend-fys'
|
||||
|
||||
@ -1,174 +0,0 @@
|
||||
|
||||
<style scoped>
|
||||
.dashboard-container {
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
background: radial-gradient( 0% 0% at 0% 0%, #091B2D 0%, #0C2644 100%), #267AD0;
|
||||
}
|
||||
|
||||
/* 全屏地图 - 背景图层 */
|
||||
.fullscreen-map {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 1;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
/* 顶部栏 */
|
||||
.top-bar {
|
||||
position: relative;
|
||||
z-index: 10;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 12px 20px;
|
||||
background-color: rgba(74, 85, 104, 0.9);
|
||||
color: #fff;
|
||||
font-size: 14px;
|
||||
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
|
||||
.top-bar h1 {
|
||||
font-size: 18px;
|
||||
margin: 0;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.header-info {
|
||||
display: flex;
|
||||
gap: 16px;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.header-info span {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
/* 悬浮模块容器 */
|
||||
.floating-modules {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: calc(100% - 60px); /* 减去顶部栏高度 */
|
||||
z-index: 5;
|
||||
padding: 20px;
|
||||
box-sizing: border-box;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.left-modules,
|
||||
.right-modules {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 16px;
|
||||
width: 100%;
|
||||
flex: 1;
|
||||
pointer-events: auto;
|
||||
}
|
||||
|
||||
.bottom-middle-module {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
max-width: 800px;
|
||||
pointer-events: auto;
|
||||
}
|
||||
|
||||
.module-card {
|
||||
background-color: rgba(107, 114, 128, 0.9);
|
||||
border-radius: 6px;
|
||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
|
||||
border: 1px solid rgba(255, 255, 255, 0.1);
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.module-card:hover {
|
||||
box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
|
||||
.module-header {
|
||||
padding: 10px 14px;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: #fff;
|
||||
border-bottom: 1px solid rgba(255, 255, 255, 0.2);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
background: linear-gradient(90deg, #3b82f6, #60a5fa);
|
||||
}
|
||||
|
||||
.module-header::before {
|
||||
content: '';
|
||||
display: inline-block;
|
||||
width: 8px;
|
||||
height: 16px;
|
||||
margin-right: 8px;
|
||||
border-radius: 2px;
|
||||
background-color: inherit;
|
||||
}
|
||||
|
||||
.module-content {
|
||||
padding: 14px;
|
||||
color: #e5e7eb;
|
||||
font-size: 13px;
|
||||
height: calc(100% - 36px);
|
||||
box-sizing: border-box;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.overview-card .module-header::before { background-color: #3b82f6; }
|
||||
.alarm-card .module-header::before { background-color: #ef4444; }
|
||||
.realtime-card .module-header::before { background-color: #f97316; }
|
||||
.module-card:nth-child(2) .module-header::before { background-color: #8b5cf6; }
|
||||
.module-card:nth-child(3) .module-header::before { background-color: #06b6d4; }
|
||||
|
||||
@media (max-width: 1400px) {
|
||||
.left-modules,
|
||||
.right-modules {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 1200px) {
|
||||
.left-modules,
|
||||
.right-modules {
|
||||
width: 100%;
|
||||
}
|
||||
.bottom-middle-module {
|
||||
max-width: 600px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 900px) {
|
||||
.left-modules,
|
||||
.right-modules {
|
||||
width: 100%;
|
||||
}
|
||||
.bottom-middle-module {
|
||||
max-width: 500px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.left-modules,
|
||||
.right-modules {
|
||||
width: 100%;
|
||||
}
|
||||
.bottom-middle-module {
|
||||
max-width: 100%;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@ -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>
|
||||
|
||||
@ -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
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -6,6 +6,7 @@ export interface deviceQuery extends PageQuery {
|
||||
deviceStatus: string;
|
||||
bluetoothName?: string; // 蓝牙名称查询字段
|
||||
onlineStatus?: string;
|
||||
bindingStatus?:string
|
||||
}
|
||||
|
||||
export interface deviceForm {
|
||||
@ -38,6 +39,7 @@ export interface deviceVO {
|
||||
customerId?: string | number;
|
||||
typeName?: string;
|
||||
bluetoothName?: string; // 蓝牙名称字段
|
||||
|
||||
}
|
||||
|
||||
export interface deviceTypeOption {
|
||||
|
||||
@ -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
|
||||
})
|
||||
}
|
||||
|
||||
118
src/api/system/service/api.ts
Normal file
118
src/api/system/service/api.ts
Normal 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
|
||||
});
|
||||
};
|
||||
56
src/api/system/service/types.ts
Normal file
56
src/api/system/service/types.ts
Normal 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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
1090
src/views/controlCenter/018A/index.vue
Normal file
1090
src/views/controlCenter/018A/index.vue
Normal file
File diff suppressed because it is too large
Load Diff
@ -592,17 +592,15 @@ const getMainLightModeLabel = (mode: any) => {
|
||||
// 处理设备消息
|
||||
const handleDeviceMessage = (msg: any) => {
|
||||
try {
|
||||
// 解析设备消息(假设格式为 { state: [类型, 模式值, 亮度, 续航...] })
|
||||
const payloadObj = JSON.parse(msg.payload.toString());
|
||||
const deviceState = payloadObj.state; // 设备状态数组
|
||||
if (!Array.isArray(deviceState)) {
|
||||
return;
|
||||
}
|
||||
// 用switch处理不同的消息类型(deviceState[0])
|
||||
switch (deviceState[0]) {
|
||||
case 1:
|
||||
// 类型1灯光主键
|
||||
const lightModeId = getMainLightModeLabel(deviceState[1]); // 获取模式ID(如'strong')
|
||||
const lightModeId = getMainLightModeLabel(deviceState[1]);
|
||||
const brightness = deviceState[2]; // 亮度值
|
||||
const batteryTime = deviceState[3]; // 续航时间
|
||||
console.log('灯光模式消息:', { 模式ID: lightModeId, 亮度: brightness, 续航: batteryTime });
|
||||
@ -625,7 +623,7 @@ const handleDeviceMessage = (msg: any) => {
|
||||
break;
|
||||
case 12:
|
||||
// 灯光主键
|
||||
const lightModeIdA = getMainLightModeLabel(deviceState[1]); // 获取模式ID(如'strong')
|
||||
const lightModeIdA = getMainLightModeLabel(deviceState[1]);
|
||||
if (lightModeIdA !== 'unknown') {
|
||||
lightModes.value.forEach(mode => {
|
||||
const isActive = mode.id === lightModeIdA;
|
||||
@ -650,7 +648,6 @@ const handleDeviceMessage = (msg: any) => {
|
||||
|
||||
break;
|
||||
default:
|
||||
// 其他类型消息(不处理,仅打印)
|
||||
console.log('未处理的消息类型:', deviceState[0]);
|
||||
break;
|
||||
}
|
||||
@ -658,7 +655,7 @@ const handleDeviceMessage = (msg: any) => {
|
||||
}
|
||||
};
|
||||
onMounted(async () => {
|
||||
await getList(); // 先获取设备信息
|
||||
await getList();
|
||||
// 连接mqtt
|
||||
onConnect(async () => {
|
||||
const deviceImei = deviceDetail.value.deviceImei;
|
||||
@ -684,7 +681,7 @@ onMounted(async () => {
|
||||
handleDeviceMessage(msg);
|
||||
});
|
||||
onError((err) => {
|
||||
console.error('MQTT连接失败原因:', err.message); // 关键:打印连接失败的具体原因
|
||||
console.error('MQTT连接失败原因:', err.message);
|
||||
});
|
||||
connect();
|
||||
});
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
<div class="device-page p-2">
|
||||
<!-- 头部信息栏 -->
|
||||
<div class="header-bar">
|
||||
<div>设备名称:{{ deviceDetail.deviceName }},IMEI:{{deviceDetail.deviceImei }}</div>
|
||||
<div>设备名称:{{ deviceDetail.deviceName }},IMEI:{{ deviceDetail.deviceImei }}</div>
|
||||
<div>设备型号:{{ deviceDetail.typeName }}</div>
|
||||
<div class="device-status">
|
||||
设备状态:
|
||||
@ -19,8 +19,8 @@
|
||||
<el-row :gutter="20" class="content-row" :class="deviceDetail.sta_ShakeBit == 1 || deviceDetail.staSOSGrade == 1 ? '' : 'displayNone'">
|
||||
<el-col :lg="24" :xs="24">
|
||||
<div class="staticRwo" :class="deviceDetail.sta_ShakeBit == 1 ? '' : 'displayNone'">设备静止报警中!</div>
|
||||
<div class="staticRwo" :class="(deviceDetail.staSOSGrade == 1 && Status.timeOut>0) ? '' : 'displayNone'" @click="showClose()">
|
||||
设备强制报警中<span v-show="Status.timeOut>0">,{{ Status.timeOut }}S</span>!
|
||||
<div class="staticRwo" :class="deviceDetail.staSOSGrade == 1 && Status.timeOut > 0 ? '' : 'displayNone'" @click="showClose()">
|
||||
设备强制报警中<span v-show="Status.timeOut > 0">,{{ Status.timeOut }}S</span>!
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@ -99,11 +99,11 @@
|
||||
</div>
|
||||
<div class="form-item">
|
||||
<span class="form-label">职位:</span>
|
||||
<el-input v-if="deviceDetail" placeholder="请输入职位" v-model="deviceDetail.personnelInfo.name" />
|
||||
<el-input v-if="deviceDetail" placeholder="请输入职位" v-model="deviceDetail.personnelInfo.position" />
|
||||
</div>
|
||||
<div class="form-item">
|
||||
<span class="form-label">姓名:</span>
|
||||
<el-input v-if="deviceDetail" placeholder="请输入姓名" v-model="deviceDetail.personnelInfo.position" />
|
||||
<el-input v-if="deviceDetail" placeholder="请输入姓名" v-model="deviceDetail.personnelInfo.name" />
|
||||
</div>
|
||||
<div class="form-item">
|
||||
<span class="form-label">ID:</span>
|
||||
@ -209,7 +209,6 @@ import strongLightActive from '@/assets/images/strong-light_HL.png';
|
||||
import floodLightDefault from '@/assets/images/flood-light.png';
|
||||
import floodLightActive from '@/assets/images/flood-light_HL.png';
|
||||
|
||||
|
||||
import di from '@/assets/images/di.png';
|
||||
import diAc from '@/assets/images/diAc.png';
|
||||
import high from '@/assets/images/high.png';
|
||||
@ -314,7 +313,7 @@ const staticModes = ref<any[]>([
|
||||
id: '2',
|
||||
name: '中档',
|
||||
icon: zhong, // 直接使用导入的变量
|
||||
activeIcon:zhongAc,
|
||||
activeIcon: zhongAc,
|
||||
|
||||
active: false
|
||||
},
|
||||
@ -385,7 +384,7 @@ const deviceDetail = ref<any>({
|
||||
});
|
||||
|
||||
//模式设置
|
||||
const handleModeClick = async (id: string, type: string) => {
|
||||
const handleModeClick = async (id: string, type: string) => {
|
||||
if (Status[type] == id) {
|
||||
return;
|
||||
}
|
||||
@ -394,7 +393,7 @@ const handleModeClick = async (id: string, type: string) => {
|
||||
|
||||
let dic = { promise: null, callback: null, key: '' };
|
||||
|
||||
//测试环境假装成功
|
||||
//测试环境假装成功
|
||||
dic.promise = Promise.resolve({ code: 200, msg: '操作成功' });
|
||||
|
||||
let arr = [];
|
||||
@ -418,7 +417,7 @@ const handleModeClick = async (id: string, type: string) => {
|
||||
});
|
||||
};
|
||||
|
||||
dic.promise.then((res) => {
|
||||
dic.promise.then((res) => {
|
||||
if (res.code === 200) {
|
||||
Status[type] = id;
|
||||
ElMessage.closeAll();
|
||||
@ -427,37 +426,35 @@ const handleModeClick = async (id: string, type: string) => {
|
||||
dic.callback();
|
||||
}
|
||||
if (callback) {
|
||||
|
||||
callback();
|
||||
}
|
||||
|
||||
} else {
|
||||
proxy?.$modal.msgError(res.msg);
|
||||
}
|
||||
});
|
||||
};
|
||||
if(type == 'sosMode' && Status.sosMode=== '1' && id==='0' && timer){
|
||||
if (type == 'sosMode' && Status.sosMode === '1' && id === '0' && timer) {
|
||||
showClose();
|
||||
return;
|
||||
}
|
||||
else if (type == 'sosMode' && id === '1') {
|
||||
} else if (type == 'sosMode' && id === '1' && timer == null) {
|
||||
ShowConfirm({
|
||||
title: '提示',
|
||||
text: '您确认开启180秒强制报警',
|
||||
cancelCallback: null,
|
||||
cancelCallback: () => {
|
||||
timer = null;
|
||||
},
|
||||
OkCallback: () => {
|
||||
sendCmd(function () {
|
||||
|
||||
Status.confirm.Visible = false;
|
||||
deviceDetail.value.staSOSGrade="1";
|
||||
deviceDetail.value.staSOSGrade = '1';
|
||||
Status.timeOut = 180;
|
||||
timer = setInterval(() => {
|
||||
if (Status.timeOut === 0) {
|
||||
clearInterval(timer);
|
||||
timer = null;
|
||||
hideConfirm();
|
||||
handleModeClick('1','sosMode');
|
||||
deviceDetail.value.staSOSGrade="0";
|
||||
handleModeClick('1', 'sosMode');
|
||||
deviceDetail.value.staSOSGrade = '0';
|
||||
return;
|
||||
}
|
||||
|
||||
@ -476,26 +473,32 @@ const handleModeClick = async (id: string, type: string) => {
|
||||
};
|
||||
|
||||
const getList = () => {
|
||||
api.deviceRealTimeStatus(route.params.deviceId).then((res) => {
|
||||
if (res && res.code == 200) {
|
||||
let keys = Object.keys(res.data);
|
||||
keys.forEach((key) => {
|
||||
deviceDetail.value[key] = res.data[key];
|
||||
});
|
||||
Status.sosMode = res.data.staSOSGrade;
|
||||
Status.staticPower = res.data.staDetectGrade;
|
||||
Status.lightMode = res.data.staLightGrade;
|
||||
if(!deviceDetail.value.personnelInfo){
|
||||
deviceDetail.value.personnelInfo={
|
||||
'id': null,
|
||||
'deviceId': null,
|
||||
'name': null,
|
||||
'position': null,
|
||||
'unitName': null,
|
||||
'code': null
|
||||
return new Promise((resolve, reject) => {
|
||||
api
|
||||
.deviceRealTimeStatus(route.params.deviceId)
|
||||
.then((res) => {
|
||||
if (res && res.code == 200) {
|
||||
|
||||
let keys = Object.keys(res.data);
|
||||
keys.forEach((key) => {
|
||||
deviceDetail.value[key] = res.data[key];
|
||||
});
|
||||
Status.sosMode = res.data.staSOSGrade;
|
||||
Status.staticPower = res.data.staDetectGrade;
|
||||
Status.lightMode = res.data.staLightGrade;
|
||||
if (!deviceDetail.value.personnelInfo) {
|
||||
deviceDetail.value.personnelInfo = {
|
||||
'id': null,
|
||||
'deviceId': null,
|
||||
'name': null,
|
||||
'position': null,
|
||||
'unitName': null,
|
||||
'code': null
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
.finally(resolve);
|
||||
});
|
||||
};
|
||||
|
||||
@ -561,8 +564,6 @@ const sendTextMessage = async () => {
|
||||
batchId: ''
|
||||
};
|
||||
|
||||
|
||||
|
||||
api.SendMessage(json).then((res) => {
|
||||
if (res.code === 200) {
|
||||
ElMessage.closeAll();
|
||||
@ -571,6 +572,7 @@ const sendTextMessage = async () => {
|
||||
proxy?.$modal.msgError(res.msg);
|
||||
}
|
||||
});
|
||||
|
||||
};
|
||||
const lookMap = (row: any) => {
|
||||
console.log(row, 'row');
|
||||
@ -586,52 +588,63 @@ const lookMap = (row: any) => {
|
||||
function showClose() {
|
||||
Status.confirm.Visible = true;
|
||||
Status.confirm.OkTxt = '关闭';
|
||||
Status.confirm.OkCallback=()=>{
|
||||
clearInterval(timer);
|
||||
timer=null;
|
||||
handleModeClick('0','sosMode');
|
||||
deviceDetail.value.staSOSGrade="0";
|
||||
|
||||
Status.timeOut=0;
|
||||
|
||||
Status.confirm.OkCallback = () => {
|
||||
clearInterval(timer);
|
||||
timer = null;
|
||||
handleModeClick('0', 'sosMode');
|
||||
deviceDetail.value.staSOSGrade = '0';
|
||||
|
||||
Status.timeOut = 0;
|
||||
|
||||
hideConfirm();
|
||||
}
|
||||
};
|
||||
}
|
||||
// 处理设备消息
|
||||
const handleDeviceMessage = (payload: any) => {
|
||||
let json = JSON.parse(payload);
|
||||
let json = null;
|
||||
try {
|
||||
json = JSON.parse(payload);
|
||||
} catch (ex) {
|
||||
return;
|
||||
}
|
||||
|
||||
let keys = Object.keys(json);
|
||||
|
||||
function parseDataMQ(json) {
|
||||
deviceDetail.value.staDetectGrade = json.sta_DetectGrade;
|
||||
deviceDetail.value.staLightGrade = json.sta_LightGrade;
|
||||
deviceDetail.value.staDetectResult = json.sta_DetectResult;
|
||||
deviceDetail.value.staSOSGrade = json.sta_SOSGrade;
|
||||
deviceDetail.value.sta_ShakeBit = json.sta_ShakeBit;
|
||||
deviceDetail.value.staPowerTime = json.sta_PowerTime;
|
||||
deviceDetail.value.staPowerPercent = json.sta_PowerPercent;
|
||||
deviceDetail.value.longitude = json.sta_longitude;
|
||||
deviceDetail.value.latitude = json.sta_latitude;
|
||||
deviceDetail.value.onlineStatus = 1;
|
||||
try {
|
||||
debugger;
|
||||
deviceDetail.value.staDetectGrade = json.sta_DetectGrade;
|
||||
deviceDetail.value.staLightGrade = json.sta_LightGrade;
|
||||
deviceDetail.value.staDetectResult = json.sta_DetectResult;
|
||||
deviceDetail.value.staSOSGrade = json.sta_SOSGrade;
|
||||
deviceDetail.value.sta_ShakeBit = json.sta_ShakeBit;
|
||||
deviceDetail.value.staPowerTime = json.sta_PowerTime;
|
||||
deviceDetail.value.staPowerPercent = json.sta_PowerPercent;
|
||||
deviceDetail.value.longitude = json.sta_longitude;
|
||||
deviceDetail.value.latitude = json.sta_latitude;
|
||||
deviceDetail.value.onlineStatus = 1;
|
||||
|
||||
Status.sosMode = json.sta_SOSGrade;
|
||||
Status.staticPower = json.sta_DetectGrade;
|
||||
Status.lightMode = json.sta_LightGrade;
|
||||
Status.sosMode = json.sta_SOSGrade;
|
||||
Status.staticPower = json.sta_DetectGrade;
|
||||
Status.lightMode = json.sta_LightGrade;
|
||||
console.log('Status=', Status);
|
||||
console.log('sosModes=', sosModes.value);
|
||||
console.log('sta_SOSGrade=', json.sta_SOSGrade);
|
||||
if (json.sta_PowerPercent < 20) {
|
||||
centerDialogVisible.value = true;
|
||||
}
|
||||
|
||||
if (json.sta_PowerPercent < 20) {
|
||||
centerDialogVisible.value = true;
|
||||
}
|
||||
|
||||
if (json.sta_SOSGrade == 1 && json.sta_ShakeBit == 1) {
|
||||
confirm('设备SOS报警、静止预警中');
|
||||
return;
|
||||
}
|
||||
if (json.sta_SOSGrade == 1) {
|
||||
confirm('设备SOS报警中');
|
||||
}
|
||||
if (json.sta_ShakeBit == 1) {
|
||||
confirm('设备静止报警中');
|
||||
}
|
||||
if (json.sta_SOSGrade == 1 && json.sta_ShakeBit == 1) {
|
||||
confirm('设备SOS报警、静止预警中');
|
||||
return;
|
||||
}
|
||||
if (json.sta_SOSGrade == 1) {
|
||||
confirm('设备SOS报警中');
|
||||
}
|
||||
if (json.sta_ShakeBit == 1) {
|
||||
confirm('设备静止报警中');
|
||||
}
|
||||
} catch (err) {}
|
||||
}
|
||||
|
||||
if (keys.indexOf('sta_DetectGrade') > -1) {
|
||||
@ -639,11 +652,21 @@ const handleDeviceMessage = (payload: any) => {
|
||||
console.log('收到设备上报的数据', payload);
|
||||
parseDataMQ(json);
|
||||
}
|
||||
|
||||
|
||||
if(keys.indexOf('sta_BreakNews')>-1){
|
||||
if(json.sta_BreakNews==='I get it'){
|
||||
|
||||
confirm('用户已确认收到紧急通知');
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
onMounted(async () => {
|
||||
await getList(); // 先获取设备信息
|
||||
// 连接mqtt
|
||||
onConnect(async () => {
|
||||
|
||||
const deviceImei = deviceDetail.value.deviceImei;
|
||||
if (!deviceImei) {
|
||||
return;
|
||||
@ -657,6 +680,7 @@ onMounted(async () => {
|
||||
});
|
||||
// 2. 注册消息接收回调(核心:处理设备发送的消息)
|
||||
onMessage((msg) => {
|
||||
|
||||
console.log('收到新消息:', {
|
||||
主题: msg.topic,
|
||||
内容: msg.payload,
|
||||
@ -664,7 +688,7 @@ onMounted(async () => {
|
||||
QoS: msg.qos
|
||||
});
|
||||
// 在这里处理消息(根据实际业务逻辑)
|
||||
handleDeviceMessage(msg);
|
||||
handleDeviceMessage(msg.payload);
|
||||
});
|
||||
onError((err) => {
|
||||
console.error('MQTT连接失败原因:', err.message); // 关键:打印连接失败的具体原因
|
||||
@ -745,7 +769,7 @@ window.hideConfirm = function () {
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.p-2{
|
||||
.p-2 {
|
||||
background: rgba(247, 248, 252, 1);
|
||||
min-height: 100vh;
|
||||
box-sizing: border-box;
|
||||
|
||||
@ -222,7 +222,7 @@ onUnmounted(() => {
|
||||
}
|
||||
|
||||
.amap-container {
|
||||
height: calc(100vh - 22vh);
|
||||
height: calc(100vh - 25vh);
|
||||
border-radius: 4px;
|
||||
overflow: hidden;
|
||||
width: 100%;
|
||||
|
||||
@ -82,7 +82,7 @@
|
||||
</transition>
|
||||
<el-card class="Maplist">
|
||||
<div v-if="isListView" key="list">
|
||||
<el-table v-loading="loading" border :data="deviceList" @selection-change="handleSelectionChange">
|
||||
<el-table v-loading="loading" border :data="deviceList" @selection-change="handleSelectionChange" height="calc(100vh - 310px)">
|
||||
<el-table-column type="selection" width="50" align="center" :selectable="isSelectable" />
|
||||
<el-table-column label="设备名称" align="center" prop="deviceName" />
|
||||
<el-table-column label="设备图片" align="center" prop="devicePic">
|
||||
@ -575,7 +575,7 @@ const forceAlarm = async () => {
|
||||
}
|
||||
|
||||
.Maplist {
|
||||
height: calc(100vh - 24vh);
|
||||
overflow: auto;
|
||||
//height: calc(100vh - 24vh);
|
||||
//overflow: auto;
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -58,7 +58,7 @@
|
||||
</transition>
|
||||
<el-card class="Maplist">
|
||||
<div>
|
||||
<el-table v-loading="loading" border :data="deviceList" @selection-change="handleSelectionChange">
|
||||
<el-table v-loading="loading" border :data="deviceList" @selection-change="handleSelectionChange" height="calc(100vh - 400px)">
|
||||
<el-table-column type="selection" width="50" align="center" />
|
||||
<el-table-column label="设备名称" align="center" prop="deviceName" />
|
||||
<el-table-column label="设备型号" align="center" prop="deviceType" />
|
||||
@ -299,7 +299,7 @@ height: calc(100vh - 8vh);
|
||||
}
|
||||
|
||||
.Maplist {
|
||||
height: calc(100vh - 24vh);
|
||||
overflow: auto;
|
||||
height: calc(100vh - 24vh);
|
||||
// overflow: auto;
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -58,7 +58,7 @@
|
||||
</transition>
|
||||
<el-card class="Maplist">
|
||||
<div>
|
||||
<el-table v-loading="loading" border :data="deviceList" @selection-change="handleSelectionChange">
|
||||
<el-table v-loading="loading" border :data="deviceList" @selection-change="handleSelectionChange" height="calc(100vh - 400px)">
|
||||
<el-table-column type="selection" width="50" align="center" />
|
||||
<el-table-column label="设备名称" align="center" prop="deviceName" />
|
||||
<el-table-column label="设备型号" align="center" prop="deviceType" />
|
||||
@ -308,6 +308,6 @@ height: calc(100vh - 8vh);
|
||||
|
||||
.Maplist {
|
||||
height: calc(100vh - 24vh);
|
||||
overflow: auto;
|
||||
// overflow: auto;
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
<template>
|
||||
<div class="p-2">
|
||||
<transition :enter-active-class="proxy?.animate.searchAnimate.enter"
|
||||
:leave-active-class="proxy?.animate.searchAnimate.leave">
|
||||
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
|
||||
<div v-show="showSearch" class="mb-[10px]">
|
||||
<el-card shadow="hover">
|
||||
<el-form ref="queryFormRef" :model="queryParams" :inline="true">
|
||||
@ -24,14 +23,10 @@
|
||||
<el-button type="primary" plain icon="Plus" @click="handleAdd()">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="success" plain :disabled="single" icon="Edit" @click="handleUpdate()">
|
||||
修改
|
||||
</el-button>
|
||||
<el-button type="success" plain :disabled="single" icon="Edit" @click="handleUpdate()"> 修改 </el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" plain :disabled="multiple" icon="Delete" @click="handleDelete()">
|
||||
删除
|
||||
</el-button>
|
||||
<el-button type="danger" plain :disabled="multiple" icon="Delete" @click="handleDelete()"> 删除 </el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:show-search="showSearch" :search="true" @query-table="getList"></right-toolbar>
|
||||
</el-row>
|
||||
@ -42,8 +37,7 @@
|
||||
<el-table-column label="型号名称" align="center" prop="typeName" />
|
||||
<el-table-column label="类型code" align="center" prop="appModelDictionary">
|
||||
<template #default="scope">
|
||||
{{appmodelDictionaryOptions.find(item => item.dictValue === String(scope.row.appModelDictionary))?.dictLabel
|
||||
}}
|
||||
{{ appmodelDictionaryOptions.find((item) => item.dictValue === String(scope.row.appModelDictionary))?.dictLabel }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="是否支持蓝牙" align="center" prop="isSupportBle">
|
||||
@ -81,14 +75,11 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination v-show="total > 0" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize"
|
||||
:total="total" @pagination="getList" />
|
||||
<pagination v-show="total > 0" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" :total="total" @pagination="getList" />
|
||||
</el-card>
|
||||
|
||||
|
||||
<!-- 添加或修改用户配置对话框 -->
|
||||
<el-dialog ref="formDialogRef" v-model="dialog.visible" :title="dialog.title" width="30%" append-to-body
|
||||
@close="closeDialog">
|
||||
<el-dialog ref="formDialogRef" v-model="dialog.visible" :title="dialog.title" width="30%" append-to-body @close="closeDialog">
|
||||
<el-form ref="userFormRef" :model="form" :rules="rules" label-width="120px">
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
@ -101,14 +92,12 @@
|
||||
<el-col :span="24">
|
||||
<el-form-item label="路由跳转" prop="appModelDictionary">
|
||||
<el-select v-model="form.appModelDictionary" placeholder="请选择" @change="handlePcRouteChange">
|
||||
<el-option v-for="item in appmodelDictionaryOptions" :key="item.dictCode" :label="item.dictLabel"
|
||||
:value="item.dictValue" />
|
||||
<el-option v-for="item in appmodelDictionaryOptions" :key="item.dictCode" :label="item.dictLabel" :value="item.dictValue" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="pc路由跳转" prop="pcModelDictionary" style="display: none;">
|
||||
<el-form-item label="pc路由跳转" prop="pcModelDictionary" style="display: none">
|
||||
<el-select v-model="form.pcModelDictionary" placeholder="请选择">
|
||||
<el-option v-for="item in pcmodelDictionaryOptions" :key="item.dictCode" :label="item.dictLabel"
|
||||
:value="item.dictValue" />
|
||||
<el-option v-for="item in pcmodelDictionaryOptions" :key="item.dictCode" :label="item.dictLabel" :value="item.dictValue" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
@ -147,6 +136,22 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="设备图片" prop="devicePic">
|
||||
<input type="file" id="fileTypeImg" accept="image/*" style="display: none" />
|
||||
<div class="devicePic typeImgContent" v-if="form.devicePic">
|
||||
<img class="img" :src="form.devicePic" />
|
||||
<div class="mask center" @click.stop="DropImg(form)">
|
||||
<el-icon class="avatar-uploader-icon"><Delete /></el-icon>
|
||||
</div>
|
||||
</div>
|
||||
<div class="devicePic typeImgAdd center" v-else @click.stop="AddImg(form)">
|
||||
<el-icon class="avatar-uploader-icon"><Plus /></el-icon>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
@ -164,7 +169,23 @@ import { deviceTypeQuery } from '@/api/equipmentManagement/deviceType/types';
|
||||
import { getDicts } from '@/api/system/dict/data';
|
||||
import { to } from 'await-to-js';
|
||||
import { ComponentInternalInstance, getCurrentInstance, onMounted, reactive, ref, toRefs } from 'vue';
|
||||
import { ElDialog, ElForm, ElFormItem, ElInput, ElRow, ElCol, ElButton, ElCard, ElSelect, ElOption, ElDatePicker, ElTable, ElTableColumn, ElTooltip, ElSwitch } from 'element-plus';
|
||||
import {
|
||||
ElDialog,
|
||||
ElForm,
|
||||
ElFormItem,
|
||||
ElInput,
|
||||
ElRow,
|
||||
ElCol,
|
||||
ElButton,
|
||||
ElCard,
|
||||
ElSelect,
|
||||
ElOption,
|
||||
ElDatePicker,
|
||||
ElTable,
|
||||
ElTableColumn,
|
||||
ElTooltip,
|
||||
ElSwitch
|
||||
} from 'element-plus';
|
||||
interface deviceTypeVO {
|
||||
id: string | number;
|
||||
typeName: string;
|
||||
@ -176,9 +197,9 @@ interface deviceTypeVO {
|
||||
communicationMode: number;
|
||||
createTime: string;
|
||||
createByName: string;
|
||||
devicePic: string;
|
||||
}
|
||||
interface DeviceTypeForm extends deviceTypeVO {
|
||||
}
|
||||
interface DeviceTypeForm extends deviceTypeVO {}
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
const deviceTypeList = ref<deviceTypeVO[]>();
|
||||
const loading = ref(true);
|
||||
@ -190,9 +211,11 @@ const total = ref(0);
|
||||
const queryFormRef = ref<InstanceType<typeof ElForm>>();
|
||||
const userFormRef = ref<InstanceType<typeof ElForm>>();
|
||||
const formDialogRef = ref<InstanceType<typeof ElDialog>>();
|
||||
const loadingIng = ref(false)
|
||||
const loadingIng = ref(false);
|
||||
const appmodelDictionaryOptions = ref<any[]>([]);
|
||||
const pcmodelDictionaryOptions = ref<any[]>([]);
|
||||
var fileC = null;
|
||||
var uploadFile=false;
|
||||
const dialog = reactive<DialogOption>({
|
||||
visible: false,
|
||||
title: ''
|
||||
@ -207,7 +230,7 @@ const initFormData: DeviceTypeForm = {
|
||||
communicationMode: 0,
|
||||
id: '',
|
||||
createTime: '',
|
||||
createByName: '',
|
||||
createByName: ''
|
||||
};
|
||||
|
||||
const initData = {
|
||||
@ -215,28 +238,20 @@ const initData = {
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
typeName: '',
|
||||
typeName: ''
|
||||
},
|
||||
rules: {
|
||||
typeName: [
|
||||
{ required: true, message: '请输入设备类型名称', trigger: 'blur' },
|
||||
],
|
||||
appModelDictionary: [
|
||||
{ required: true, message: '请选择类型code', trigger: 'blur' },
|
||||
],
|
||||
locateMode: [
|
||||
{ required: true, message: '请选择定位方式', trigger: 'blur' },
|
||||
],
|
||||
communicationMode: [
|
||||
{ required: true, message: '请选择通讯方式', trigger: 'blur' },
|
||||
],
|
||||
typeName: [{ required: true, message: '请输入设备类型名称', trigger: 'blur' }],
|
||||
appModelDictionary: [{ required: true, message: '请选择类型code', trigger: 'blur' }],
|
||||
locateMode: [{ required: true, message: '请选择定位方式', trigger: 'blur' }],
|
||||
communicationMode: [{ required: true, message: '请选择通讯方式', trigger: 'blur' }]
|
||||
}
|
||||
};
|
||||
|
||||
const data = reactive<{
|
||||
form: DeviceTypeForm,
|
||||
queryParams: deviceTypeQuery,
|
||||
rules: any
|
||||
form: DeviceTypeForm;
|
||||
queryParams: deviceTypeQuery;
|
||||
rules: any;
|
||||
}>(initData);
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data);
|
||||
@ -252,11 +267,11 @@ const getList = async () => {
|
||||
const getDict = async () => {
|
||||
const res = await getDicts('app_model_dictionary');
|
||||
appmodelDictionaryOptions.value = res.data;
|
||||
}
|
||||
};
|
||||
const pcgetDict = async () => {
|
||||
const res = await getDicts('pc_model_dictionary');
|
||||
pcmodelDictionaryOptions.value = res.data;
|
||||
}
|
||||
};
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
queryParams.value.pageNum = 1;
|
||||
@ -270,13 +285,9 @@ const resetQuery = () => {
|
||||
};
|
||||
// PC路由变化时,同步对应APP路由
|
||||
const handlePcRouteChange = (pcDictValue: string) => {
|
||||
const selectedPcItem = appmodelDictionaryOptions.value.find(
|
||||
item => item.dictValue === pcDictValue
|
||||
);
|
||||
const selectedPcItem = appmodelDictionaryOptions.value.find((item) => item.dictValue === pcDictValue);
|
||||
if (!selectedPcItem) return;
|
||||
const matchedAppItem = pcmodelDictionaryOptions.value.find(
|
||||
item => item.dictLabel === selectedPcItem.dictLabel
|
||||
);
|
||||
const matchedAppItem = pcmodelDictionaryOptions.value.find((item) => item.dictLabel === selectedPcItem.dictLabel);
|
||||
if (matchedAppItem) {
|
||||
form.value.pcModelDictionary = matchedAppItem.dictValue;
|
||||
} else {
|
||||
@ -287,13 +298,15 @@ const handlePcRouteChange = (pcDictValue: string) => {
|
||||
|
||||
/** 删除按钮操作 */
|
||||
const handleDelete = async (row?: deviceTypeVO) => {
|
||||
const deviceTypeIds = row ? [row.id] : ids.value.map(item => item.id);
|
||||
const typeNames = row ? row.typeName : ids.value.map(item => item.typeName).join(',');
|
||||
const [err] = await to(proxy?.$modal.confirm('是否确认删除"' + typeNames + '"的数据项?', '系统提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}) as any);
|
||||
const deviceTypeIds = row ? [row.id] : ids.value.map((item) => item.id);
|
||||
const typeNames = row ? row.typeName : ids.value.map((item) => item.typeName).join(',');
|
||||
const [err] = await to(
|
||||
proxy?.$modal.confirm('是否确认删除"' + typeNames + '"的数据项?', '系统提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}) as any
|
||||
);
|
||||
if (!err) {
|
||||
await api.deleteDeviceType(deviceTypeIds);
|
||||
await getList();
|
||||
@ -350,7 +363,7 @@ const submitForm = () => {
|
||||
if (valid) {
|
||||
loadingIng.value = true;
|
||||
try {
|
||||
const payload = {
|
||||
let payload = {
|
||||
...form.value,
|
||||
appModelDictionary: form.value.appModelDictionary,
|
||||
pcModelDictionary: form.value.pcModelDictionary,
|
||||
@ -358,7 +371,27 @@ const submitForm = () => {
|
||||
locateMode: Number(form.value.locateMode),
|
||||
communicationMode: Number(form.value.communicationMode)
|
||||
};
|
||||
form.value.id ? await api.updateDeviceType(payload) : await api.addDeviceType(payload);
|
||||
|
||||
|
||||
|
||||
let formData = new FormData();
|
||||
let keys=Object.keys(payload);
|
||||
|
||||
keys.forEach(key=>{
|
||||
if(key!=='devicePic'){
|
||||
if(payload[key]!==null && payload[key]!==undefined){
|
||||
formData.append(key,payload[key]);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
if(uploadFile && fileC && fileC.files.length){
|
||||
formData.append('file',fileC.files[0]);
|
||||
}
|
||||
|
||||
//如果要上传文件就用formData,不上传使用payload
|
||||
form.value.id ? await api.updateDeviceType(formData) : await api.addDeviceType(formData);
|
||||
proxy?.$modal.msgSuccess('操作成功');
|
||||
dialog.visible = false;
|
||||
await getList();
|
||||
@ -369,6 +402,25 @@ const submitForm = () => {
|
||||
});
|
||||
};
|
||||
|
||||
//删除图片
|
||||
function DropImg(item) {
|
||||
ElMessageBox.confirm('删除后不可恢复,您确认要删除吗?', '提醒', {
|
||||
confirmButtonText: '确认',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
form.value.devicePic = null;
|
||||
})
|
||||
.catch(() => {});
|
||||
}
|
||||
|
||||
//选择图片
|
||||
function AddImg(item) {
|
||||
uploadFile=false;
|
||||
initControl();
|
||||
fileC.click();
|
||||
|
||||
}
|
||||
/**
|
||||
* 关闭用户弹窗
|
||||
*/
|
||||
@ -386,9 +438,106 @@ const resetForm = () => {
|
||||
form.value.id = '';
|
||||
};
|
||||
|
||||
function initControl() {
|
||||
if (fileC) {
|
||||
fileC.value="";
|
||||
return;
|
||||
}
|
||||
|
||||
fileC = document.getElementById('fileTypeImg');
|
||||
fileC.addEventListener('change', function () {
|
||||
if (this.files.length) {
|
||||
let file = this.files[0];
|
||||
if (file.type.indexOf('image/') === 0) {
|
||||
|
||||
let reader = new FileReader();
|
||||
|
||||
reader.onload = function (e) {
|
||||
uploadFile=true;
|
||||
form.value.devicePic = e.target.result;
|
||||
};
|
||||
|
||||
reader.onerror = function () {
|
||||
console.log('读取文件失败!');
|
||||
};
|
||||
|
||||
reader.readAsDataURL(file);
|
||||
} else {
|
||||
// form.value.devicePic = null;
|
||||
}
|
||||
} else {
|
||||
// form.value.devicePic = null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getList(); // 初始化列表数据
|
||||
getDict();
|
||||
pcgetDict() //pc跳转
|
||||
pcgetDict(); //pc跳转
|
||||
});
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.devicePic {
|
||||
width: 120px;
|
||||
height: 120px;
|
||||
border-radius: 6px;
|
||||
box-sizing: border-box;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.typeImgContent {
|
||||
background-color: #ffffff;
|
||||
border: 1px solid rgb(220, 223, 230);
|
||||
position: relative;
|
||||
|
||||
}
|
||||
|
||||
.typeImgContent .img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: contain;
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
z-index: 0;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.center {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: nowrap;
|
||||
align-content: center;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.typeImgAdd {
|
||||
background-color: #fafafa;
|
||||
border: 1px dashed rgb(205, 208, 214);
|
||||
font-size: 30px;
|
||||
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.mask {
|
||||
background-color: #1c1c1c80;
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
z-index: 1;
|
||||
width: 0px;
|
||||
height: 0px;
|
||||
cursor: pointer;
|
||||
overflow: hidden;
|
||||
color: #ff0000;
|
||||
font-size: 25px;
|
||||
}
|
||||
|
||||
.typeImgContent:hover .mask {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -183,7 +183,7 @@ watch(
|
||||
font-size: 14px;
|
||||
font-weight: 400;
|
||||
|
||||
letter-spacing: 0px;
|
||||
letter-spacing: 0px;
|
||||
text-align: left;
|
||||
float: left;
|
||||
}
|
||||
|
||||
@ -15,23 +15,29 @@
|
||||
<el-form-item label="设备IMEI" prop="deviceImei">
|
||||
<el-input v-model="queryParams.deviceImei" placeholder="请输入设备IMEI" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item label="设备类型" prop="deviceType">
|
||||
<el-select v-model="queryParams.deviceType" placeholder="设备类型">
|
||||
<el-form-item label="设备类型" prop="deviceType" >
|
||||
<el-select v-model="queryParams.deviceType" placeholder="设备类型" clearable>
|
||||
<el-option v-for="item in deviceTypeOptions" :key="item.value" :label="item.typeName"
|
||||
:value="item.id" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="设备状态" prop="deviceStatus" v-hasPermi="['equipment:devices:allocate']">
|
||||
<el-select v-model="queryParams.deviceStatus" placeholder="设备状态" style="margin-left: 10px">
|
||||
<el-select v-model="queryParams.deviceStatus" placeholder="设备状态" clearable>
|
||||
<el-option label="正常" value="1" />
|
||||
<el-option label="失效" value="0" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="在线状态" prop="onlineStatus">
|
||||
<el-select v-model="queryParams.onlineStatus" placeholder="在线状态" style="margin-left: 10px">
|
||||
<el-select v-model="queryParams.onlineStatus" placeholder="在线状态" clearable>
|
||||
<el-option label="在线" value="1" />
|
||||
<el-option label="离线" value="0" />
|
||||
<el-option label="故障" value="2" />
|
||||
<el-option label="故障" value="2" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="绑定状态" prop="bindingStatus">
|
||||
<el-select v-model="queryParams.bindingStatus" placeholder="绑定状态" clearable>
|
||||
<el-option label="已绑定" value="1" />
|
||||
<el-option label="未绑定" value="0" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建时间">
|
||||
@ -312,11 +318,11 @@
|
||||
<span style="color: #409eff">批量导入完成,共检测到 <span style="color: #e6a23c">{{ importResult.total }}</span> 条数据,导入成功
|
||||
<span style="color: #67c23a">{{ importResult.succeed }}</span> 条,失败
|
||||
<span style="color: red">{{ importResult.errorSun }}</span> 条。</span>
|
||||
<p v-if="importResult.errorSun > 0" style="padding: 10px">
|
||||
<a :href="importResult.link">>>> 上传失败明细下载 <i class="el-icon-download" /></a>
|
||||
</p>
|
||||
</div>
|
||||
</el-upload>
|
||||
<p v-if="importResult.errorSun > 0" style="padding: 10px">
|
||||
<a :href="importResult.link">>>> 上传失败明细下载 <i class="el-icon-download" /></a>
|
||||
</p>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button @click="importDialogVisible = false">取 消</el-button>
|
||||
@ -459,7 +465,8 @@ const initData: PageData<deviceForm, deviceQuery> = {
|
||||
deviceImei: '',
|
||||
deviceType: '',
|
||||
deviceStatus: '',
|
||||
onlineStatus:''
|
||||
onlineStatus: '',
|
||||
bindingStatus:''
|
||||
},
|
||||
rules: {
|
||||
deviceName: [{ required: true, message: '请输入设备名称', trigger: 'blur' }],
|
||||
@ -909,7 +916,7 @@ const handleBatchImport = () => {
|
||||
const downloadTemplate = () => {
|
||||
// 这里可用 window.open 或 a 标签下载模板
|
||||
const link = document.createElement('a');
|
||||
link.href = 'https://fuyuanshen.com/fys/Equipmentimporttemplate/EquipmentImportTemplate.xlsx';
|
||||
link.href = 'https://www.cnxhyc.com/jquan/Equipmentimporttemplate/EquipmentImportTemplate.xlsx';
|
||||
link.download = '设备数据导入模板.xlsx'; // 可选:指定下载文件名
|
||||
link.style.display = 'none'; // 隐藏标签
|
||||
document.body.appendChild(link);
|
||||
@ -917,11 +924,11 @@ const downloadTemplate = () => {
|
||||
document.body.removeChild(link); // 移除标签
|
||||
};
|
||||
const beforeImportUpload = (file: any) => {
|
||||
const isLt5M = file.size / 1024 / 1024 < 5;
|
||||
if (!isLt5M) {
|
||||
proxy?.$modal.msgError('上传文件大小不能超过 5MB!');
|
||||
}
|
||||
return isLt5M;
|
||||
// const isLt5M = file.size / 1024 / 1024 < 5;
|
||||
// if (!isLt5M) {
|
||||
// proxy?.$modal.msgError('上传文件大小不能超过 5MB!');
|
||||
// }
|
||||
// return isLt5M;
|
||||
};
|
||||
|
||||
//添加tokenf方法head_upload 直接返回 getBearerToken()
|
||||
@ -930,10 +937,8 @@ const handleImportSuccess = (response: any) => {
|
||||
if (response.code == 200) {
|
||||
console.log('导入成功了么');
|
||||
importResult.value.isShow = true;
|
||||
|
||||
if (response.data) {
|
||||
console.log(response.data, 'response.data');
|
||||
|
||||
importResult.value.succeed = response.data.successCount;
|
||||
importResult.value.errorSun = response.data.failureCount;
|
||||
importResult.value.total = importResult.value.succeed + importResult.value.errorSun;
|
||||
@ -944,6 +949,9 @@ const handleImportSuccess = (response: any) => {
|
||||
}
|
||||
getList(); // 初始化列表数据
|
||||
} else {
|
||||
if (importUpload.value) {
|
||||
importUpload.value.clearFiles();
|
||||
}
|
||||
proxy?.$modal.msgError(response.msg);
|
||||
}
|
||||
};
|
||||
@ -967,15 +975,13 @@ const handleBatchAssignConfirm = () => {
|
||||
customerId: batchAssignCustomerId.value, // 目标客户ID
|
||||
deviceIds: selectedIds // 选中的设备ID数组
|
||||
};
|
||||
api
|
||||
.deviceAssignCustomer(data)
|
||||
.then((res) => {
|
||||
if (res.code == 200) {
|
||||
batchAssignDialogVisible.value = false;
|
||||
getList();
|
||||
return proxy?.$modal.msgSuccess(`分配成功`);
|
||||
}
|
||||
})
|
||||
api.deviceAssignCustomer(data).then((res) => {
|
||||
if (res.code == 200) {
|
||||
batchAssignDialogVisible.value = false;
|
||||
getList();
|
||||
return proxy?.$modal.msgSuccess(`分配成功`);
|
||||
}
|
||||
})
|
||||
.catch(() => { });
|
||||
};
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div class="content" v-loading="Status.fullLoading">
|
||||
<div class="main">
|
||||
<div class="TopTool">
|
||||
<div class ="TopTool">
|
||||
<div class="button-row">
|
||||
<el-button type="primary" icon="Plus" @click.stop="ShowEdit(null, true, formRef)">新增维修</el-button>
|
||||
<el-button type="primary" plain icon="Download" @click.stop="ExportRecord()">导出</el-button>
|
||||
@ -9,14 +9,8 @@
|
||||
</div>
|
||||
|
||||
<div class="rightSearch">
|
||||
<el-input
|
||||
:suffix-icon="'Search'"
|
||||
clearable
|
||||
v-model="advanceSearch.searchValue"
|
||||
class="responsive-input"
|
||||
placeholder="名称"
|
||||
@input="txtSearch"
|
||||
>
|
||||
<el-input :suffix-icon="'Search'" clearable v-model="advanceSearch.searchValue" class="responsive-input"
|
||||
placeholder="名称" @input="txtSearch">
|
||||
</el-input>
|
||||
|
||||
<el-button style="margin-left: 10px" type="primary" @click.stop="ToggleAdvance()">高级筛选</el-button>
|
||||
@ -43,17 +37,9 @@
|
||||
<el-input v-model="advanceSearch.repairReason" placeholder="请输入" clearable />
|
||||
</el-form-item> -->
|
||||
<el-form-item label="维修时间">
|
||||
<el-date-picker
|
||||
v-model="advanceSearch.Date"
|
||||
type="daterange"
|
||||
format="YYYY-MM-DD"
|
||||
style="width: 240px"
|
||||
value-format="YYYY-MM-DD"
|
||||
range-separator="-"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
:size="'default'"
|
||||
/>
|
||||
<el-date-picker v-model="advanceSearch.Date" type="daterange" format="YYYY-MM-DD" style="width: 240px"
|
||||
value-format="YYYY-MM-DD" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"
|
||||
:size="'default'" />
|
||||
<div>
|
||||
<el-button style="margin-left: 5px" type="primary" @click.stop="Search()">查询</el-button>
|
||||
<el-button type="primary" @click.stop="Reset()">重置</el-button>
|
||||
@ -71,7 +57,8 @@
|
||||
<el-table-column label="损坏原因" align="center" prop="repairReason" />
|
||||
<el-table-column label="维修人员" align="center" prop="repairPerson" />
|
||||
|
||||
<el-table-column label="操作" align="center" fixed="right" width="280" class-name="small-padding fixed-width opt">
|
||||
<el-table-column label="操作" align="center" fixed="right" width="280"
|
||||
class-name="small-padding fixed-width opt">
|
||||
<template #default="scope">
|
||||
<div class="center">
|
||||
<el-text class="mx-1" type="primary" @click.stop="ShowEdit(scope.row, true, formRef)">编辑</el-text>
|
||||
@ -81,47 +68,29 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination
|
||||
v-show="pagin.total > 0"
|
||||
v-model:page="advanceSearch.pageNum"
|
||||
v-model:limit="advanceSearch.pageSize"
|
||||
:total="pagin.total"
|
||||
@pagination="getRecordList"
|
||||
/>
|
||||
<pagination v-show="pagin.total > 0" v-model:page="advanceSearch.pageNum" v-model:limit="advanceSearch.pageSize"
|
||||
:total="pagin.total" @pagination="getRecordList" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 新增、编辑弹出层 -->
|
||||
<el-dialog
|
||||
class="editPop"
|
||||
v-model="Status.ShowEditPop"
|
||||
:data-val="Status.ShowEditPop"
|
||||
:title="!cEdit.isEdit ? '维修详情' : cEdit.recordId ? '编辑维修' : '新增维修'"
|
||||
width="800"
|
||||
:draggable="true"
|
||||
>
|
||||
<el-dialog class="editPop" v-model="Status.ShowEditPop" :data-val="Status.ShowEditPop"
|
||||
:title="!cEdit.isEdit ? '维修详情' : cEdit.recordId ? '编辑维修' : '新增维修'" width="800" :draggable="true">
|
||||
<div class="form">
|
||||
<el-form :model="cEdit" ref="formRef" style="max-width: 750px" :rules="rules">
|
||||
<el-form-item label="设备名称" label-position="right" prop="deviceId">
|
||||
<!-- <el-input v-model="selectedRow['deviceName']" :readonly="true" @click.stop="ShowDevice('Edit', true)" placeholder="请选择设备" /> -->
|
||||
<el-select v-model="cEdit.deviceId" placeholder="选择设备" clearable :disabled="!cEdit.isEdit" filterable>
|
||||
<el-option v-for="item in deviceDist" :key="item.deviceId" :label="item.deviceName" :value="item.deviceId"
|
||||
/></el-select>
|
||||
<el-option v-for="item in deviceDist" :key="item.deviceId" :label="item.deviceName"
|
||||
:value="item.deviceId" /></el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="维修人员" label-position="right" prop="repairPerson">
|
||||
<el-input v-model="cEdit.repairPerson" :readonly="!cEdit.isEdit" placeholder="请输入姓名" />
|
||||
</el-form-item>
|
||||
<el-form-item label="维修时间" label-position="right" prop="repairTime">
|
||||
<el-date-picker
|
||||
v-model="cEdit.repairTime"
|
||||
:readonly="!cEdit.isEdit"
|
||||
type="datetime"
|
||||
placeholder="请选择时间"
|
||||
format="YYYY-MM-DD HH:mm:ss"
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
style="width: 100%"
|
||||
/>
|
||||
<el-date-picker v-model="cEdit.repairTime" :readonly="!cEdit.isEdit" type="datetime" placeholder="请选择时间"
|
||||
format="YYYY-MM-DD HH:mm:ss" value-format="YYYY-MM-DD HH:mm:ss" style="width: 100%" />
|
||||
</el-form-item>
|
||||
<el-form-item label="维修部位" label-position="right" prop="repairPart">
|
||||
<el-input v-model="cEdit.repairPart" :readonly="!cEdit.isEdit" placeholder="请输入维修部位" />
|
||||
@ -131,19 +100,10 @@
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="损坏照片" label-position="right">
|
||||
<el-upload
|
||||
:disabled="!cEdit.isEdit"
|
||||
ref="beforeUploadRef"
|
||||
class="upload-demo"
|
||||
action=""
|
||||
:auto-upload="false"
|
||||
:on-change="handleFileChange1"
|
||||
:file-list="beforeFiles"
|
||||
accept=".jpg,.jpeg,.png,.gif.webp"
|
||||
:limit="9"
|
||||
list-type="picture-card"
|
||||
:class="{ 'hide-add-btn': !cEdit.isEdit }"
|
||||
>
|
||||
<el-upload :disabled="!cEdit.isEdit" ref="beforeUploadRef" class="upload-demo" action=""
|
||||
:auto-upload="false" :on-change="handleFileChange1" :file-list="beforeFiles"
|
||||
accept=".jpg,.jpeg,.png,.gif.webp" :limit="9" list-type="picture-card"
|
||||
:class="{ 'hide-add-btn': !cEdit.isEdit }">
|
||||
<el-icon>
|
||||
<Plus />
|
||||
</el-icon>
|
||||
@ -168,19 +128,9 @@
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="修复照片" label-position="right">
|
||||
<el-upload
|
||||
:disabled="!cEdit.isEdit"
|
||||
ref="afterUploadRef"
|
||||
class="upload-demo"
|
||||
action=""
|
||||
:auto-upload="false"
|
||||
:on-change="handleFileChange2"
|
||||
:file-list="afterFiles"
|
||||
accept=".jpg,.jpeg,.png,.gif.webp"
|
||||
:limit="9"
|
||||
list-type="picture-card"
|
||||
:class="{ 'hide-add-btn': !cEdit.isEdit }"
|
||||
>
|
||||
<el-upload :disabled="!cEdit.isEdit" ref="afterUploadRef" class="upload-demo" action="" :auto-upload="false"
|
||||
:on-change="handleFileChange2" :file-list="afterFiles" accept=".jpg,.jpeg,.png,.gif.webp" :limit="9"
|
||||
list-type="picture-card" :class="{ 'hide-add-btn': !cEdit.isEdit }">
|
||||
<el-icon>
|
||||
<Plus />
|
||||
</el-icon>
|
||||
@ -321,7 +271,8 @@
|
||||
</el-dialog> -->
|
||||
|
||||
<!-- 提示框 -->
|
||||
<el-dialog :width="300" :draggable="true" v-model="Status.confirm.Visible" :title="Status.confirm.title" width="500" center>
|
||||
<el-dialog :width="300" :draggable="true" v-model="Status.confirm.Visible" :title="Status.confirm.title" width="500"
|
||||
center>
|
||||
<span>
|
||||
{{ Status.confirm.text }}
|
||||
</span>
|
||||
@ -509,18 +460,21 @@ function ToggleAdvance() {
|
||||
|
||||
//显示编辑
|
||||
function ShowEdit(item = undefined, isEdit = true, formEl = undefined) {
|
||||
// 先隐藏弹窗,避免提前渲染错误状态
|
||||
Status.ShowEditPop = true;
|
||||
let def = {
|
||||
recordId: null, //维修记录id
|
||||
|
||||
deviceId: '', //设备id
|
||||
repairTime: '', //维修时间
|
||||
repairPart: '', //维修部位
|
||||
repairReason: '', //维修原因
|
||||
repairPerson: '', //维修人员,
|
||||
recordId: null,
|
||||
deviceId: '',
|
||||
repairTime: '',
|
||||
repairPart: '',
|
||||
repairReason: '',
|
||||
repairPerson: '',
|
||||
imageIds: []
|
||||
};
|
||||
|
||||
// 先重置表单和状态,避免残留
|
||||
ResetFormData();
|
||||
// 先赋值 isEdit 基础状态
|
||||
cEdit.isEdit = isEdit;
|
||||
let promise1 = new Promise((resolve, reject) => {
|
||||
if (item) {
|
||||
api
|
||||
@ -542,60 +496,43 @@ function ShowEdit(item = undefined, isEdit = true, formEl = undefined) {
|
||||
|
||||
promise1
|
||||
.then((res) => {
|
||||
debugger;
|
||||
item = res;
|
||||
if (!item) {
|
||||
// 新增场景,isEdit 保持 true
|
||||
cEdit.isEdit = isEdit;
|
||||
return;
|
||||
}
|
||||
let keys = Object.keys(cEdit);
|
||||
keys.forEach((key, i) => {
|
||||
if (item) {
|
||||
//编辑
|
||||
// 编辑/详情场景,赋值数据
|
||||
if (item[key] !== undefined) {
|
||||
cEdit[key] = item[key];
|
||||
} else {
|
||||
cEdit[key] = def[key];
|
||||
}
|
||||
} else {
|
||||
//新增
|
||||
// 新增场景
|
||||
cEdit[key] = def[key];
|
||||
}
|
||||
});
|
||||
debugger;
|
||||
if (item.images && item.images.length) {
|
||||
// 处理图片逻辑(保持原有代码)
|
||||
beforeFiles.value = item.images
|
||||
.filter((v) => {
|
||||
if (v.imageType == 'BEFORE') {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
})
|
||||
.map((v) => {
|
||||
return { name: v.imageId, url: v.imageUrl, id: v.imageId };
|
||||
});
|
||||
|
||||
.filter((v) => v.imageType == 'BEFORE')
|
||||
.map((v) => ({ name: v.imageId, url: v.imageUrl, id: v.imageId }));
|
||||
afterFiles.value = item.images
|
||||
.filter((v) => {
|
||||
if (v.imageType == 'AFTER') {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
})
|
||||
.map((v) => {
|
||||
return { name: v.imageId, url: v.imageUrl, id: v.imageId };
|
||||
});
|
||||
|
||||
if (!formEl) return;
|
||||
|
||||
formEl.validate();
|
||||
.filter((v) => v.imageType == 'AFTER')
|
||||
.map((v) => ({ name: v.imageId, url: v.imageUrl, id: v.imageId }));
|
||||
if (formEl) formEl.validate();
|
||||
}
|
||||
if (item) {
|
||||
selectedRow.value['deviceName'] = item.deviceName;
|
||||
}
|
||||
|
||||
// 确保 isEdit 最终赋值正确(覆盖异步过程中可能的异常)
|
||||
cEdit.isEdit = isEdit;
|
||||
// 所有状态赋值完成后,再显示弹窗
|
||||
Status.ShowEditPop = true;
|
||||
})
|
||||
.finally(() => {});
|
||||
}
|
||||
@ -611,11 +548,9 @@ function ShowDevice(type, isvalid) {
|
||||
if (isvalid && !cEdit.isEdit) {
|
||||
return;
|
||||
}
|
||||
|
||||
Status.CheckDeviceType = type;
|
||||
Status.ShowCheckDevice = true;
|
||||
selectedRowId.value = '';
|
||||
|
||||
if (total.value === 0) {
|
||||
handleQuery();
|
||||
}
|
||||
@ -643,11 +578,8 @@ function ResetFormData() {
|
||||
cEdit.repairPart = ''; //维修部位
|
||||
cEdit.repairReason = ''; //维修原因
|
||||
cEdit.repairPerson = ''; //维修人员
|
||||
|
||||
cEdit.imageIds = [];
|
||||
|
||||
selectedRow.value = { deviceName: '', deviceId: '' };
|
||||
|
||||
clearUploadFiles();
|
||||
}
|
||||
|
||||
@ -749,7 +681,7 @@ function ExportRecord() {
|
||||
proxy?.download('/equipment/repairRecords/export', advanceSearch, `维修记录_${new Date().getTime()}.xlsx`, 'post').finally(hideloading);
|
||||
}
|
||||
|
||||
function RowSelectionChange(row) {}
|
||||
function RowSelectionChange(row) { }
|
||||
//获取已选中的行
|
||||
var getSelectionRows = (gridInstance) => {
|
||||
if (gridInstance.value) {
|
||||
@ -950,8 +882,9 @@ const rules = reactive<FormRules<RuleForm>>({
|
||||
:deep .el-form--inline .el-form-item {
|
||||
margin-right: 15px !important;
|
||||
}
|
||||
:deep .el-dialog__body .form {
|
||||
}
|
||||
|
||||
:deep .el-dialog__body .form {}
|
||||
|
||||
:deep .el-dialog__body,
|
||||
.dialog__body {
|
||||
position: relative;
|
||||
@ -1064,6 +997,7 @@ input:focus {
|
||||
margin-right: 10px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
:deep .el-dialog__footer,
|
||||
.el-dialog__footer {
|
||||
padding-top: 0px !important;
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div class="content" v-loading="Status.fullLoading">
|
||||
<div class="percent100">
|
||||
<div class="percent100" v-show="!Status.showEdit && !Status.showDevice">
|
||||
<div class="topTool">
|
||||
<div class="button-row">
|
||||
<el-button type="primary" @click.stop="ShowEdit(null)"
|
||||
@ -16,8 +16,7 @@
|
||||
<div>
|
||||
<el-form :inline="true" :model="queryParams" class="demo-form-inline" @submit.native.prevent>
|
||||
<el-form-item label="" style="margin-right: 15px">
|
||||
<el-input :suffix-icon="'Search'" v-model="queryParams.name" placeholder="名称" clearable
|
||||
@input="handleQuery"/>
|
||||
<el-input :suffix-icon="'Search'" v-model="queryParams.name" placeholder="名称" clearable @input="handleQuery" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item style="margin-right: 0px">
|
||||
@ -81,6 +80,7 @@
|
||||
<el-table-column label="操作" fixed="right" width="180" class-name="small-padding fixed-width">
|
||||
<template #default="scope">
|
||||
<el-button link type="primary" @click="ShowEdit(scope.row)">编辑</el-button>
|
||||
<el-button link type="primary" @click="ShowDevice(scope.row)">终端管理</el-button>
|
||||
<el-button link type="danger" @click="DropFence(scope.row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@ -95,9 +95,17 @@
|
||||
</div>
|
||||
|
||||
<!-- 围栏编辑弹出层 -->
|
||||
<el-dialog width="calc(calc(100% - 250px) * 0.9)" v-model="Status.showEdit" :title="'编辑围栏'" :draggable="true">
|
||||
<div class="editLayer percent100 popLayer" v-show="Status.showEdit" :title="'编辑围栏'">
|
||||
<div class="abClose" @click="CloseEdit">
|
||||
<el-icon><Close /></el-icon>
|
||||
</div>
|
||||
<div>
|
||||
<el-form :inline="true" :model="cEdit" label-width="auto">
|
||||
<el-form-item label="服务id">
|
||||
<el-select v-model="cEdit.sid" placeholder="请选择" :disabled="cEdit.id !== null">
|
||||
<el-option v-for="(item, index) in services" :key="item.sid" :label="item.sname" :value="item.sid" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="围栏名称">
|
||||
<el-input v-model="cEdit.name" />
|
||||
</el-form-item>
|
||||
@ -126,25 +134,135 @@
|
||||
</div>
|
||||
<div>
|
||||
<el-button type="primary" @click.stop="AddPoint()"
|
||||
><el-icon><Plus /></el-icon>添加坐标</el-button
|
||||
><el-icon><Plus /></el-icon>添加点</el-button
|
||||
>
|
||||
|
||||
<el-button type="primary" @click.stop="ClearPoint()">
|
||||
<el-button type="danger" @click.stop="ClearPoint()">
|
||||
<el-icon><Delete /></el-icon>清空</el-button
|
||||
>
|
||||
</div>
|
||||
<div class="map" id="map"></div>
|
||||
<div class="center footerBtn" style="margin-top: 20px">
|
||||
<el-button type="primary" @click="SaveFormData"> 确定 </el-button>
|
||||
<el-button type="primary" plain @click="CloseEdit"> 取消 </el-button>
|
||||
<el-button type="danger" plain @click="CloseEdit"> 关闭 </el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 终端维护的弹窗 -->
|
||||
<div class="percent100 deviceLayer popLayer" v-show="Status.showDevice">
|
||||
<div class="abClose" @click="CloseDevice">
|
||||
<el-icon><Close /></el-icon>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="gridContent">
|
||||
<div class="button-row">
|
||||
<el-button type="primary" @click="showCheckDevice" class="fleft"
|
||||
><el-icon><Plus /></el-icon>添加</el-button
|
||||
>
|
||||
<el-button type="danger" @click="DropDevice(null)" class="fleft"
|
||||
><el-icon><Delete /></el-icon>删除</el-button
|
||||
>
|
||||
<div class="fright">
|
||||
<el-form :inline="true">
|
||||
<el-form-item label="" prop="checkedKey">
|
||||
<el-input v-model="searchFilter.nocheckKey" placeholder="imei查询" clearable @keyup.enter="SearchDevice" />
|
||||
</el-form-item>
|
||||
<!-- <el-form-item>
|
||||
<el-button type="primary" icon="Search" @click="SearchDevice">搜索</el-button>
|
||||
</el-form-item> -->
|
||||
</el-form>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
|
||||
<el-table ref="gridDevice" v-loading="Status.deviceLoading" border :data="DeviceList" @selection-change="ZDSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<!-- <el-table-column label="deviceId" align="center" prop="deviceId" />
|
||||
<el-table-column label="id" align="center" prop="id" /> -->
|
||||
<el-table-column label="设备类型" align="center" prop="typeName" />
|
||||
<el-table-column label="设备名称" align="center" prop="deviceName" />
|
||||
<el-table-column label="IMEI" align="center" prop="deviceImei" />
|
||||
<el-table-column label="Mac" align="center" prop="deviceMac" />
|
||||
<el-table-column label="蓝牙名称" align="center" prop="bluetoothName" />
|
||||
<!-- <el-table-column label="高德服务id" align="center" prop="sid" /> -->
|
||||
<el-table-column label="高德终端id" align="center" prop="tid" />
|
||||
<el-table-column label="高德轨迹id" align="center" prop="trid" />
|
||||
|
||||
<el-table-column label="操作" fixed="right" width="180" class-name="small-padding fixed-width">
|
||||
<template #default="scope">
|
||||
<el-icon color="#FF0000" @click="DropDevice(scope.row)"><Delete /></el-icon>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination
|
||||
v-show="devicePage.total > 0"
|
||||
v-model:page="devicePage.pageNum"
|
||||
v-model:limit="devicePage.pageSize"
|
||||
:total="devicePage.total"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</div>
|
||||
<div class="center footerBtn" style="margin-top: 20px">
|
||||
<el-button type="danger" plain @click="CloseDevice"> 关闭 </el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<el-dialog :title="'选择终端'" :draggable="true" footer-class="dilogFooter" v-model="Status.showCheckDevice" width="65%" append-to-body>
|
||||
<div class="deviceContent">
|
||||
<div class="filter">
|
||||
<el-form :inline="true">
|
||||
<el-form-item label="关键字" prop="checkedKey">
|
||||
<el-input v-model="searchFilter.checkedKey" placeholder="imei查询" clearable @keyup.enter="searchZD" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="Search" @click="searchZD">搜索</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
|
||||
<div class="checked">
|
||||
<el-table
|
||||
v-loading="Status.showCheckDeviceLoading"
|
||||
border
|
||||
:data="checkedDevices"
|
||||
@selection-change="handleSelectionChange"
|
||||
ref="multipleTableRef"
|
||||
row-key="id"
|
||||
>
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<!-- <el-table-column label="deviceId" align="center" prop="deviceId" />
|
||||
<el-table-column label="id" align="center" prop="id" /> -->
|
||||
<el-table-column label="设备类型" align="center" prop="typeName" />
|
||||
<el-table-column label="设备名称" align="center" prop="deviceName" />
|
||||
<el-table-column label="IMEI" align="center" prop="deviceImei" />
|
||||
<el-table-column label="Mac" align="center" prop="deviceMac" />
|
||||
<el-table-column label="蓝牙名称" align="center" prop="bluetoothName" />
|
||||
<!-- <el-table-column label="高德服务id" align="center" prop="sid" /> -->
|
||||
<el-table-column label="高德终端id" align="center" prop="tid" />
|
||||
<el-table-column label="高德轨迹id" align="center" prop="trid" />
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
:total="checkedPageParams.total"
|
||||
v-model:page="checkedPageParams.pageNum"
|
||||
v-model:limit="checkedPageParams.pageSize"
|
||||
@pagination="searchZD"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<template #footer>
|
||||
<div class="center footerBtn" style="margin-top: 20px">
|
||||
<el-button type="primary" @click="SaveChecked"> 确定 </el-button>
|
||||
<el-button type="danger" plain @click="CloseCheckDevice"> 关闭 </el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 提示框 -->
|
||||
<el-dialog :width="300" :draggable="true" v-model="Status.confirm.Visible" :title="Status.confirm.title" center>
|
||||
<span :class="Status.confirm.isWarn">
|
||||
{{ Status.confirm.text }}
|
||||
</span>
|
||||
<span :class="Status.confirm.isWarn" v-html="Status.confirm.text"> </span>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button type="primary" @click="Status.confirm.OkCallback"> 确定 </el-button>
|
||||
@ -159,9 +277,13 @@
|
||||
import api from '@/api/FenceManager/fence';
|
||||
import common from '@/utils/common';
|
||||
import map from '@/api/FenceManager/mapOpt';
|
||||
|
||||
import { listService } from '@/api/system/service/api';
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
|
||||
import { getDevice } from '@/api/system/service/api';
|
||||
|
||||
const mapApiKey = import.meta.env.VITE_AMAP_KEY;
|
||||
|
||||
var grid = ref(null);
|
||||
|
||||
//全局状态控制
|
||||
@ -179,7 +301,12 @@ var Status = reactive({
|
||||
isWarn: false //是否警告色
|
||||
},
|
||||
showSearch: [], //是否显示高级查询
|
||||
showEdit: false //是否显示编辑弹窗
|
||||
showEdit: false, //是否显示编辑弹窗
|
||||
showDevice: false, //是否显示终端维护
|
||||
deviceLoading: false, //终端查询的loading
|
||||
|
||||
showCheckDevice: false, //是否显示选择终端
|
||||
showCheckDeviceLoading: false
|
||||
});
|
||||
//查询的条件
|
||||
var queryParams = reactive({
|
||||
@ -197,17 +324,373 @@ var cEdit = reactive({
|
||||
areaType: null,
|
||||
coordinates: [],
|
||||
radius: undefined,
|
||||
isActive: null
|
||||
isActive: null,
|
||||
sid: null,
|
||||
gfid: null
|
||||
});
|
||||
var checkGf = reactive({
|
||||
//当前正在操作的数据
|
||||
sid: null,
|
||||
gfid: null
|
||||
});
|
||||
|
||||
//页码控件数据
|
||||
var pagin = reactive({
|
||||
total: 0
|
||||
});
|
||||
var devicePage = reactive({
|
||||
total: 0,
|
||||
pageNum: 1,
|
||||
pageSize: 10
|
||||
});
|
||||
|
||||
var checkedPageParams = reactive({
|
||||
pageNum: 1,
|
||||
pageSize: 20,
|
||||
total: 0
|
||||
});
|
||||
|
||||
//列表数据
|
||||
var List = ref<any[]>(null);
|
||||
|
||||
var services = ref<any[]>(null);
|
||||
|
||||
var DeviceList = ref<any[]>(null);
|
||||
|
||||
const checkZd = ref<any>([]);
|
||||
|
||||
var checkedDevices = ref([]);
|
||||
const searchFilter = ref({
|
||||
nocheckKey: '',
|
||||
checkedKey: ''
|
||||
});
|
||||
|
||||
const ids = ref<any>([]);
|
||||
|
||||
//显示终端
|
||||
function ShowDevice(item) {
|
||||
Status.showDevice = true;
|
||||
checkGf = item;
|
||||
SearchDevice();
|
||||
}
|
||||
//选择终端
|
||||
|
||||
function ZDSelectionChange(selection: any[]) {
|
||||
checkZd.value = selection;
|
||||
}
|
||||
//查询已选择的终端
|
||||
function SearchDevice() {
|
||||
Status.deviceLoading = true;
|
||||
|
||||
let searchMap = () => {
|
||||
let json = {
|
||||
key: mapApiKey,
|
||||
sid: checkGf.sid,
|
||||
gfid: checkGf.gfid
|
||||
};
|
||||
let formData = [];
|
||||
if (json) {
|
||||
let keys = Object.keys(json);
|
||||
for (let index = 0; index < keys.length; index++) {
|
||||
let key = keys[index];
|
||||
let encodedKey = encodeURIComponent(key);
|
||||
let encodedValue = encodeURIComponent(json[key]);
|
||||
formData.push(`${encodedKey}=${encodedValue}`);
|
||||
}
|
||||
}
|
||||
|
||||
let queryString = formData.join('&'); // 拼接成 key1=value1&key2=value2
|
||||
|
||||
request({
|
||||
url: 'https://tsapi.amap.com/v1/track/geofence/terminal/list?' + queryString,
|
||||
method: 'GET',
|
||||
data: ''
|
||||
})
|
||||
.then((res) => {
|
||||
if (res && res.errcode === 10000) {
|
||||
DeviceList.value = res.data.results;
|
||||
devicePage.total = res.data.count;
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
Status.deviceLoading = false;
|
||||
});
|
||||
};
|
||||
|
||||
let searchSys = () => {
|
||||
let json = {
|
||||
fenceId: checkGf.gfid,
|
||||
sid: checkGf.sid,
|
||||
isTid: true,
|
||||
pageNum: devicePage.pageNum,
|
||||
pageSize: devicePage.pageSize,
|
||||
deviceImei: searchFilter.value.nocheckKey
|
||||
};
|
||||
api
|
||||
.pageTerminal(json)
|
||||
.then((res) => {
|
||||
if (res && res.code === 200) {
|
||||
DeviceList.value = res.rows;
|
||||
devicePage.total = res.total;
|
||||
return;
|
||||
}
|
||||
|
||||
DeviceList.value = [];
|
||||
devicePage.total = 0;
|
||||
})
|
||||
.finally(() => {
|
||||
Status.deviceLoading = false;
|
||||
});
|
||||
};
|
||||
|
||||
searchSys();
|
||||
}
|
||||
|
||||
//关闭终端
|
||||
function CloseDevice() {
|
||||
Status.showDevice = false;
|
||||
}
|
||||
//显示选择终端
|
||||
function showCheckDevice() {
|
||||
Status.showCheckDevice = true;
|
||||
searchZD();
|
||||
}
|
||||
|
||||
//查询待选择的终端
|
||||
function searchZD() {
|
||||
return new Promise((resolve, reject) => {
|
||||
let json = {
|
||||
fenceId: checkGf.gfid,
|
||||
sid: checkGf.sid,
|
||||
isTid: false,
|
||||
pageNum: checkedPageParams.pageNum,
|
||||
pageSize: checkedPageParams.pageSize,
|
||||
deviceImei: searchFilter.value.checkedKey
|
||||
};
|
||||
|
||||
api
|
||||
.pageTerminal(json)
|
||||
.then((res) => {
|
||||
if (res.code === 200) {
|
||||
checkedDevices.value = res.rows;
|
||||
checkedPageParams.total = res.total;
|
||||
resolve(res);
|
||||
return;
|
||||
}
|
||||
resolve(null);
|
||||
})
|
||||
.catch((ex) => {
|
||||
resolve(null);
|
||||
})
|
||||
.finally(() => {
|
||||
Status.showCheckDeviceLoading = false;
|
||||
});
|
||||
});
|
||||
|
||||
// return new Promise((resolve, reject) => {
|
||||
// let para = {
|
||||
// deviceStatus: 1,
|
||||
// isTid: true,
|
||||
// sid: cEdit.sid,
|
||||
// pageNum: checkedPageParams.pageNum,
|
||||
// pageSize: checkedPageParams.pageSize,
|
||||
// deviceImei: searchFilter.value.checkedKey
|
||||
// };
|
||||
// checkedPageParams.total = 0;
|
||||
// Status.showCheckDeviceLoading = true;
|
||||
// getDevice(para)
|
||||
// .then((res) => {
|
||||
// console.log('查询已选择设备成功');
|
||||
// if (res.code === 200) {
|
||||
// checkedDevices.value = res.rows;
|
||||
// checkedPageParams.total = res.total;
|
||||
// resolve(res);
|
||||
// return;
|
||||
// }
|
||||
// resolve(null);
|
||||
// })
|
||||
// .catch((ex) => {
|
||||
// resolve(null);
|
||||
// })
|
||||
// .finally(() => {
|
||||
// Status.showCheckDeviceLoading = false;
|
||||
// });
|
||||
// });
|
||||
}
|
||||
//关闭选择终端
|
||||
function CloseCheckDevice() {
|
||||
Status.showCheckDevice = false;
|
||||
}
|
||||
//保存选择的终端
|
||||
function SaveChecked() {
|
||||
if (ids.value.length === 0) {
|
||||
alert('请选择终端');
|
||||
return;
|
||||
}
|
||||
if (ids.value.length > 100) {
|
||||
alert('最多只能选100条数据');
|
||||
return;
|
||||
}
|
||||
let tids = ids.value
|
||||
.map((v) => {
|
||||
return v.tid;
|
||||
})
|
||||
.join(',');
|
||||
|
||||
let deviceIds = ids.value.map((v) => {
|
||||
return v.deviceId;
|
||||
});
|
||||
let mapAdd = () => {
|
||||
//先从高德添加数据,成功后再提交后台
|
||||
return new Promise((resolve, reject) => {
|
||||
let url = 'https://tsapi.amap.com/v1/track/geofence/terminal/bind';
|
||||
let method = 'POST';
|
||||
let data = {
|
||||
key: mapApiKey,
|
||||
sid: checkGf.sid,
|
||||
gfid: checkGf.gfid,
|
||||
tids: tids
|
||||
};
|
||||
|
||||
request({ url: url, method: method, data: data })
|
||||
.then((res) => {
|
||||
if (res && res.errcode === 10000) {
|
||||
resolve(res);
|
||||
return;
|
||||
// alert('操作成功');
|
||||
//
|
||||
} else {
|
||||
alert(res.errmsg);
|
||||
reject(res);
|
||||
}
|
||||
})
|
||||
.catch((ex) => {
|
||||
reject(ex);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
mapAdd()
|
||||
.then((res) => {
|
||||
let json = {
|
||||
sid: checkGf.sid,
|
||||
fenceId: checkGf.gfid,
|
||||
deviceIds: deviceIds
|
||||
};
|
||||
api
|
||||
.addTerminal(json)
|
||||
.then((result) => {
|
||||
//高德添加成功了,提交到后台
|
||||
if (result && result.code === 200) {
|
||||
alert('操作成功');
|
||||
} else {
|
||||
alert('在高德保存成功,系统保存失败,失败数据:' + JSON.stringify(json));
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
SearchDevice();
|
||||
});
|
||||
})
|
||||
.then((ex) => {});
|
||||
}
|
||||
|
||||
//删除终端
|
||||
function DropDevice(row) {
|
||||
let arr = [];
|
||||
if (row) {
|
||||
arr = [row];
|
||||
} else {
|
||||
arr = checkZd.value;
|
||||
}
|
||||
if (arr.length === 0) {
|
||||
alert('请选择要删除的数据');
|
||||
return;
|
||||
}
|
||||
if (arr.length > 100) {
|
||||
alert('最多只能选择100条数据');
|
||||
return;
|
||||
}
|
||||
|
||||
let tids = arr
|
||||
.map((v) => {
|
||||
return v.tid;
|
||||
})
|
||||
.join(',');
|
||||
|
||||
let deviceIds = arr.map((v) => {
|
||||
return v.deviceId;
|
||||
});
|
||||
|
||||
let mapDrop = () => {
|
||||
//从高德删除
|
||||
return new Promise((resolve, reject) => {
|
||||
let url = 'https://tsapi.amap.com/v1/track/geofence/terminal/unbind';
|
||||
|
||||
let data = {
|
||||
key: mapApiKey,
|
||||
sid: checkGf.sid,
|
||||
gfid: checkGf.gfid,
|
||||
tids: tids
|
||||
};
|
||||
request({
|
||||
url: url,
|
||||
method: 'POST',
|
||||
data: data
|
||||
})
|
||||
.then((res) => {
|
||||
if (res && res.errcode === 10000) {
|
||||
resolve(res);
|
||||
return;
|
||||
} else {
|
||||
alert(res.errmsg);
|
||||
reject(res);
|
||||
}
|
||||
})
|
||||
.catch((ex) => {
|
||||
alert(JSON.stringify(ex));
|
||||
reject(ex);
|
||||
});
|
||||
});
|
||||
};
|
||||
//先从高德删除,再从系统删除
|
||||
let execDrop = () => {
|
||||
mapDrop().then((res) => {
|
||||
let json = {
|
||||
sid: checkGf.sid,
|
||||
fenceId: checkGf.gfid,
|
||||
deviceIds: deviceIds
|
||||
};
|
||||
api
|
||||
.delTerminal(json)
|
||||
.then((result) => {
|
||||
//从系统删除
|
||||
if (result && result.code === 200) {
|
||||
alert('操作成功');
|
||||
|
||||
return;
|
||||
}
|
||||
alert('<div class="red">从高德删除成功,但从系统删除失败了,失败数据:' + JSON.stringify(json) + '</div>');
|
||||
})
|
||||
.finally(() => {
|
||||
SearchDevice();
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
confirm('<div class="red">删除后不可恢复,您确认删除所选数据吗?</div>', execDrop, null, '提示');
|
||||
}
|
||||
|
||||
const handleSelectionChange = (selection: any[]) => {
|
||||
ids.value = selection;
|
||||
};
|
||||
|
||||
//查询所有服务
|
||||
function getServices() {
|
||||
listService({ pageNum: 1, pageSize: 9999 }).then((res) => {
|
||||
if (res.code === 200) {
|
||||
services.value = res.rows;
|
||||
}
|
||||
});
|
||||
}
|
||||
//显示隐藏高级查询
|
||||
function showSearch() {
|
||||
if (Status.showSearch.length > 0) {
|
||||
@ -216,6 +699,7 @@ function showSearch() {
|
||||
Status.showSearch = ['1'];
|
||||
}
|
||||
}
|
||||
|
||||
function ShowEdit(item) {
|
||||
Status.showEdit = true;
|
||||
if (item) {
|
||||
@ -236,7 +720,10 @@ function ShowEdit(item) {
|
||||
cEdit.coordinates = [];
|
||||
cEdit.radius = null;
|
||||
cEdit.isActive = null;
|
||||
cEdit.sid = null;
|
||||
cEdit.gfid = null;
|
||||
}
|
||||
getServices();
|
||||
map.clearOverLays();
|
||||
setTimeout(() => {
|
||||
map
|
||||
@ -258,6 +745,7 @@ function ShowEdit(item) {
|
||||
});
|
||||
}, 500);
|
||||
}
|
||||
|
||||
function CloseEdit() {
|
||||
Status.showEdit = false;
|
||||
let defCfg = {
|
||||
@ -267,7 +755,9 @@ function CloseEdit() {
|
||||
areaType: null,
|
||||
coordinates: [],
|
||||
radius: null,
|
||||
isActive: null
|
||||
isActive: null,
|
||||
sid: null,
|
||||
gfid: null
|
||||
};
|
||||
let keys = Object.keys(defCfg);
|
||||
keys.forEach((key) => {
|
||||
@ -378,29 +868,240 @@ function AddPoint(point, i) {
|
||||
refreshOverLayer();
|
||||
});
|
||||
}
|
||||
//调用高德的接口添加/修改围栏
|
||||
function updateGeoFence() {
|
||||
const legalChars = cEdit.name.match(/[\u4e00-\u9fa5a-zA-Z0-9_\-]/g) || [];
|
||||
|
||||
let geoFenceName = legalChars.join('').slice(0, 128);
|
||||
|
||||
let json = {
|
||||
key: mapApiKey,
|
||||
sid: cEdit.sid,
|
||||
name: geoFenceName,
|
||||
desc: geoFenceName
|
||||
};
|
||||
if (cEdit.gfid && cEdit.id) {
|
||||
//修改围栏
|
||||
json.gfid = cEdit.gfid;
|
||||
}
|
||||
let url = '';
|
||||
if (cEdit.areaType == 0) {
|
||||
//多边形新增/修改
|
||||
|
||||
json.points = cEdit.coordinates
|
||||
.map((v) => {
|
||||
return v.lng + ',' + v.lat;
|
||||
})
|
||||
.join(';');
|
||||
if (!cEdit.id) {
|
||||
url = 'https://tsapi.amap.com/v1/track/geofence/add/polygon';
|
||||
} else {
|
||||
url = 'https://tsapi.amap.com/v1/track/geofence/update/polygon';
|
||||
}
|
||||
} else if (cEdit.areaType == 1) {
|
||||
//圆形新增/修改
|
||||
json.center = cEdit.coordinates[0].lng + ',' + cEdit.coordinates[0].lat;
|
||||
json.radius = parseFloat(cEdit.radius);
|
||||
if (!cEdit.id) {
|
||||
url = 'https://tsapi.amap.com/v1/track/geofence/add/circle';
|
||||
} else {
|
||||
url = 'https://tsapi.amap.com/v1/track/geofence/update/circle';
|
||||
}
|
||||
}
|
||||
|
||||
return request({
|
||||
url: url,
|
||||
method: 'POST',
|
||||
data: json
|
||||
});
|
||||
}
|
||||
|
||||
function dropGeoFence(arr) {
|
||||
let ids = arr.filter((v) => {
|
||||
return v.gfid;
|
||||
});
|
||||
let defaultSucc = Promise.resolve({ errcode: 10000, msg: '操作成功' });
|
||||
if (ids.length === 0) {
|
||||
return defaultSucc;
|
||||
}
|
||||
|
||||
let sids = [];
|
||||
|
||||
arr.filter((v) => {
|
||||
let f = sids.find((sid) => {
|
||||
return sid === v.sid;
|
||||
});
|
||||
if (!f && v.sid) {
|
||||
sids.push(v.sid);
|
||||
}
|
||||
});
|
||||
|
||||
let task = (sid, gfids) => {
|
||||
if (!gfids || !sid) {
|
||||
return defaultSucc;
|
||||
}
|
||||
|
||||
let json = {
|
||||
key: mapApiKey,
|
||||
sid: sid,
|
||||
gfids: gfids
|
||||
};
|
||||
|
||||
const url = 'https://tsapi.amap.com/v1/track/geofence/delete';
|
||||
return request({
|
||||
url: url,
|
||||
method: 'POST',
|
||||
data: json
|
||||
});
|
||||
};
|
||||
|
||||
let promises = [];
|
||||
for (let i = 0; i < sids.length; i++) {
|
||||
const serviceId = sids[i];
|
||||
const gfids = arr
|
||||
.filter((v) => {
|
||||
return v.sid === serviceId && v.gfid;
|
||||
})
|
||||
.map((v) => {
|
||||
return v.gfid;
|
||||
})
|
||||
.join(',');
|
||||
|
||||
if (serviceId && gfids) {
|
||||
promises.push(task(serviceId, gfids));
|
||||
}
|
||||
}
|
||||
|
||||
if (promises.length) {
|
||||
return Promise.allSettled(promises)
|
||||
.then((res) => {
|
||||
let succIds = [];
|
||||
for (let i = 0; i < promises.length; i++) {
|
||||
if (res[i].status === 'fulfilled') {
|
||||
let result = res[i].value;
|
||||
if (result.errcode === 10000) {
|
||||
succIds = succIds.concat(result.data.gfids);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (succIds.length > 0) {
|
||||
return Promise.resolve({ errcode: 10000, data: succIds });
|
||||
} else {
|
||||
return Promise.resolve({ errcode: 10000, errmsg: 'UNKNOWN_ERROR' });
|
||||
}
|
||||
})
|
||||
.catch((ex) => {
|
||||
console.log('出现异常', ex);
|
||||
});
|
||||
} else {
|
||||
return defaultSucc;
|
||||
}
|
||||
}
|
||||
|
||||
function request(cfg) {
|
||||
return new Promise((resolve, reject) => {
|
||||
let json = cfg.data;
|
||||
let url = cfg.url;
|
||||
let method = cfg.method;
|
||||
|
||||
let formData = [];
|
||||
if (json) {
|
||||
let keys = Object.keys(json);
|
||||
for (let index = 0; index < keys.length; index++) {
|
||||
let key = keys[index];
|
||||
let encodedKey = encodeURIComponent(key);
|
||||
let encodedValue = encodeURIComponent(json[key]);
|
||||
formData.push(`${encodedKey}=${encodedValue}`);
|
||||
}
|
||||
}
|
||||
|
||||
let queryString = formData.join('&'); // 拼接成 key1=value1&key2=value2
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.open(method, url, true);
|
||||
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded;charset=UTF-8');
|
||||
xhr.responseType = 'json';
|
||||
xhr.onreadystatechange = function () {
|
||||
// readyState=4 表示请求完成,status=200 表示响应成功
|
||||
if (xhr.readyState === XMLHttpRequest.DONE) {
|
||||
if (xhr.status >= 200 && xhr.status < 300) {
|
||||
// 成功:返回响应数据
|
||||
resolve(xhr.response);
|
||||
} else {
|
||||
// 失败:返回状态码和错误信息
|
||||
reject(new Error(`请求失败:状态码 ${xhr.status},信息:${xhr.statusText}`));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// 6. 监听网络错误(如断网、跨域、服务器不可达)
|
||||
xhr.onerror = function () {
|
||||
reject(new Error('网络错误:请求无法完成'));
|
||||
};
|
||||
|
||||
// 7. 监听超时(可选,建议设置)
|
||||
xhr.ontimeout = function () {
|
||||
reject(new Error('请求超时:超过指定时间未响应'));
|
||||
};
|
||||
|
||||
// 8. 设置超时时间(毫秒)
|
||||
xhr.timeout = 20000; // 20秒超时
|
||||
|
||||
try {
|
||||
// 9. 发送请求:将 JSON 对象转为字符串
|
||||
xhr.send(queryString);
|
||||
} catch (error) {
|
||||
// 捕获数据序列化错误
|
||||
reject(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//保存数据
|
||||
function SaveFormData() {
|
||||
if (cEdit.areaType == 0 && cEdit.coordinates.length < 3) {
|
||||
alert('多边形的围栏至少需要3个点');
|
||||
return;
|
||||
let err = [];
|
||||
if (!cEdit.sid) {
|
||||
err.push('请选择服务id');
|
||||
}
|
||||
if (!cEdit.name) {
|
||||
err.push('请填写围栏名称');
|
||||
}
|
||||
if (cEdit.areaType === null) {
|
||||
err.push('请选择围栏类型');
|
||||
} else {
|
||||
if (cEdit.areaType == 0 && cEdit.coordinates.length < 3) {
|
||||
err.push('多边形的围栏至少需要3个点');
|
||||
}
|
||||
if (cEdit.areaType == 1 && cEdit.coordinates.length == 0) {
|
||||
err.push('圆形的围栏至少需要1个点');
|
||||
}
|
||||
}
|
||||
|
||||
if (cEdit.areaType == 1 && cEdit.coordinates.length == 0) {
|
||||
alert('圆形的围栏至少需要1个点');
|
||||
if (err.length) {
|
||||
alert(err.join('<br/>'));
|
||||
return;
|
||||
}
|
||||
|
||||
let promise = Promise.resolve({ code: 200, msg: '操作成功' });
|
||||
Status.fullLoading = true;
|
||||
let json = Object.assign({}, cEdit);
|
||||
json.coordinates = JSON.stringify(json.coordinates);
|
||||
if (cEdit.id !== null) {
|
||||
//编辑
|
||||
promise = api.updateFence(json);
|
||||
} else {
|
||||
//新增
|
||||
promise = api.AddFence(json);
|
||||
}
|
||||
|
||||
promise = updateGeoFence()
|
||||
.then((res) => {
|
||||
if (res.errcode === 10000) {
|
||||
if (cEdit.id !== null) {
|
||||
//编辑
|
||||
return api.updateFence(json);
|
||||
} else {
|
||||
//新增
|
||||
json.gfid = res.data.gfid;
|
||||
return api.AddFence(json);
|
||||
}
|
||||
}
|
||||
return Promise.resolve({ code: 500, msg: res.errmsg });
|
||||
})
|
||||
.catch((ex) => {
|
||||
return { code: ex.code, msg: ex.message };
|
||||
});
|
||||
|
||||
promise
|
||||
.then((res) => {
|
||||
@ -427,28 +1128,53 @@ function DropFence(item) {
|
||||
return;
|
||||
}
|
||||
|
||||
let execDelete=()=>{
|
||||
let execDelete = () => {
|
||||
//先从高德删除围栏,再从后台删除
|
||||
dropGeoFence(arr).then((res) => {
|
||||
if (res.errcode === 10000) {
|
||||
let dropIds = res.data;
|
||||
if (!dropIds) {
|
||||
alert('从高德地图删除围栏失败');
|
||||
return;
|
||||
}
|
||||
let ids = [];
|
||||
|
||||
arr = arr
|
||||
.map((v) => {
|
||||
return v.id;
|
||||
})
|
||||
.join(',');
|
||||
api.DelFence(arr).then((res) => {
|
||||
if (res.code == 200) {
|
||||
handleQuery();
|
||||
arr.filter((v) => {
|
||||
if (!v.gfid || !v.sid) {
|
||||
ids.push(v.id);
|
||||
return true;
|
||||
}
|
||||
if (dropIds) {
|
||||
let f = dropIds.find((gfid) => {
|
||||
return gfid === v.gfid;
|
||||
});
|
||||
if (f) {
|
||||
ids.push(v.id);
|
||||
}
|
||||
} else {
|
||||
ids.push(v.id);
|
||||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
if (!ids.length) {
|
||||
alert('操作没有成功');
|
||||
return;
|
||||
}
|
||||
ids = ids.join(',');
|
||||
api.DelFence(ids).then((res) => {
|
||||
if (res.code == 200) {
|
||||
handleQuery();
|
||||
}
|
||||
alert(res.msg);
|
||||
});
|
||||
} else {
|
||||
alert(res.errmsg);
|
||||
}
|
||||
alert(res.msg);
|
||||
});
|
||||
}
|
||||
|
||||
confirm(
|
||||
'删除后不可恢复,您确认?',
|
||||
execDelete,
|
||||
null,
|
||||
'提示'
|
||||
);
|
||||
};
|
||||
|
||||
confirm('删除后不可恢复,您确认?', execDelete, null, '提示');
|
||||
}
|
||||
|
||||
function getList() {
|
||||
@ -609,9 +1335,9 @@ onMounted(() => {
|
||||
|
||||
.map {
|
||||
width: 100%;
|
||||
height: calc(58vh - 50px);
|
||||
height: calc(100% - 200px);
|
||||
box-sizing: border-box;
|
||||
border: 1px solid #7371719e;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 8px;
|
||||
margin-top: 10px;
|
||||
}
|
||||
@ -651,4 +1377,32 @@ onMounted(() => {
|
||||
// width: 100%;
|
||||
// left: 0px;
|
||||
}
|
||||
|
||||
.deviceLayer .gridContent {
|
||||
width: 100%;
|
||||
height: calc(100% - 50px);
|
||||
}
|
||||
.button-row {
|
||||
margin-top: 10px;
|
||||
width:auto;
|
||||
height: 36px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.popLayer {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.popLayer .abClose {
|
||||
position: absolute;
|
||||
top: 15px;
|
||||
right: 15px;
|
||||
z-index: 9;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.red,
|
||||
:deep .red {
|
||||
color: #ff0000;
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -10,7 +10,8 @@
|
||||
</div>
|
||||
|
||||
<div class="treeContent">
|
||||
<el-tree :data="treeData" :props="defaultProps" accordion @node-click="handleNodeClick" :highlight-current="true">
|
||||
<el-tree :default-expand-all="true" :data="treeData" :props="defaultProps" accordion
|
||||
@node-click="handleNodeClick" :highlight-current="true">
|
||||
<template #default="{ node, data }">
|
||||
<div class="custom-tree-node">
|
||||
<span :class="data.parentId != null ? '' : 'treeBold'">{{ node.label }}</span>
|
||||
@ -60,7 +61,7 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<div class="btnSearch" @click="getDeviceList()">查询</div>
|
||||
<div class="btnSearch" @click="getDeviceList">查询</div>
|
||||
<div class="btnReset" @click="ResetQuery()">重置</div>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
@ -76,14 +77,8 @@
|
||||
<el-button type="danger" plain @click="groupDelDevice()">删除</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<el-table
|
||||
ref="grid"
|
||||
height="calc(100vh - 320px)"
|
||||
v-loading="Status.loading"
|
||||
border
|
||||
:data="deviceList"
|
||||
@selection-change="RowSelectionChange"
|
||||
>
|
||||
<el-table ref="grid" height="calc(100vh - 320px)" v-loading="Status.loading" border :data="deviceList"
|
||||
@selection-change="RowSelectionChange">
|
||||
<el-table-column type="selection" width="50" align="center" />
|
||||
<el-table-column label="设备名称" align="center" prop="deviceName" />
|
||||
|
||||
@ -91,11 +86,9 @@
|
||||
<template #default="scope">
|
||||
<el-popover placement="right" trigger="click">
|
||||
<template #reference>
|
||||
<img
|
||||
:src="scope.row.devicePic"
|
||||
<img :src="scope.row.devicePic"
|
||||
style="width: 40px; height: 40px; cursor: pointer; object-fit: contain"
|
||||
class="hover:opacity-80 transition-opacity"
|
||||
/>
|
||||
class="hover:opacity-80 transition-opacity" />
|
||||
</template>
|
||||
<img :src="scope.row.devicePic" style="max-width: 600px; max-height: 600px; object-fit: contain" />
|
||||
</el-popover>
|
||||
@ -120,13 +113,8 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination
|
||||
v-show="pagin.total > 0"
|
||||
v-model:page="GjSearchForm.pageNum"
|
||||
v-model:limit="GjSearchForm.pageSize"
|
||||
:total="pagin.total"
|
||||
@pagination="getDeviceList"
|
||||
/>
|
||||
<pagination v-show="pagin.total > 0" v-model:page="GjSearchForm.pageNum" v-model:limit="GjSearchForm.pageSize"
|
||||
:total="pagin.total" @pagination="getDeviceList" />
|
||||
</el-card>
|
||||
</div>
|
||||
</div>
|
||||
@ -134,7 +122,8 @@
|
||||
<div class="clear"></div>
|
||||
|
||||
<!-- 提示框 -->
|
||||
<el-dialog :width="300" :draggable="true" v-model="Status.confirm.Visible" :title="Status.confirm.title" width="500" center>
|
||||
<el-dialog :width="300" :draggable="true" v-model="Status.confirm.Visible" :title="Status.confirm.title" width="500"
|
||||
center>
|
||||
<span>
|
||||
{{ Status.confirm.text }}
|
||||
</span>
|
||||
@ -148,7 +137,7 @@
|
||||
|
||||
<!-- 选择分组的弹窗 -->
|
||||
<el-dialog v-model="Status.dialogGroupVisible" title="选择分组" width="500" :draggable="true">
|
||||
<el-tree :data="treeData" :props="defaultProps" accordion>
|
||||
<el-tree :data="treeData" :props="defaultProps" accordion default-expand-all>
|
||||
<template #default="{ node, data }">
|
||||
<div class="custom-tree-node" @click.stop="CheckGroup(data)">
|
||||
<span :class="data.parentId != null ? '' : 'treeBold'">{{ node.label }}</span>
|
||||
@ -156,12 +145,16 @@
|
||||
</div>
|
||||
</template>
|
||||
</el-tree>
|
||||
<el-button type="primary" @click="OkCheckGroup()"> 确定 </el-button>
|
||||
<el-button type="primary" @click="CancelCheckGroup()"> 取消 </el-button>
|
||||
<div style="text-align: right;">
|
||||
|
||||
<el-button @click="CancelCheckGroup()"> 取消 </el-button>
|
||||
<el-button type="primary" @click="OkCheckGroup()"> 确定 </el-button>
|
||||
</div>
|
||||
|
||||
</el-dialog>
|
||||
|
||||
<!-- 选择设备的穿梭框 -->
|
||||
<el-dialog v-model="Status.dialogDeviceVisible" title="选择设备" width="800" :draggable="true">
|
||||
<el-dialog v-model="Status.dialogDeviceVisible" title="选择设备" width="630" :draggable="true">
|
||||
<el-transfer :titles="['所有设备', '已选择设备']" v-model="transfer.value" :data="transfer.data" :filterable="true" />
|
||||
|
||||
<div class="center" style="margin-top: 10px">
|
||||
@ -171,13 +164,13 @@
|
||||
</el-dialog>
|
||||
|
||||
<!-- 添加节点的弹出框 -->
|
||||
<el-dialog :width="350" :draggable="true" v-model="Status.dialogEditNode" :title="cEdit.id ? '修改分组' :(cEdit.pNode?'新增子节点': '新增根节点')" center>
|
||||
<el-dialog :width="350" :draggable="true" v-model="Status.dialogEditNode"
|
||||
:title="cEdit.id ? '修改分组' : cEdit.pNode ? '新增子节点' : '新增根节点'" center>
|
||||
<div>
|
||||
<el-form class="demo-form-inline" :inline="true" :model="cEdit" label-width="auto" style="width: 100%">
|
||||
<el-form-item label="分组名称"> <el-input v-model="cEdit.groupName" placeholder="请输入" /> </el-form-item
|
||||
>
|
||||
<div style="text-indent: 68px;color: #f56c6c;margin-top: -15px;">{{ cEdit.groupName?'':'请输入分组名称' }}</div>
|
||||
</el-form>
|
||||
<el-form-item label="分组名称"> <el-input v-model="cEdit.groupName" placeholder="请输入" /> </el-form-item>
|
||||
<div style="text-indent: 68px; color: #f56c6c; margin-top: -15px">{{ cEdit.groupName ? '' : '请输入分组名称' }}</div>
|
||||
</el-form>
|
||||
</div>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
@ -319,36 +312,41 @@ var hideloading = closeLoading;
|
||||
function ResetQuery() {
|
||||
GjSearchForm.deviceType = '';
|
||||
GjSearchForm.netMode = '';
|
||||
getDeviceList()
|
||||
|
||||
}
|
||||
//查询某个节点的设备
|
||||
var getDeviceList = () => {
|
||||
if (!checkNode.val) {
|
||||
pagin.total = 0;
|
||||
deviceList.value = [];
|
||||
return;
|
||||
}
|
||||
|
||||
let para = {
|
||||
nodeCode: checkNode.val,
|
||||
pageIndex: GjSearchForm.pageNum,
|
||||
pageSize: GjSearchForm.pageSize,
|
||||
communicationMode: GjSearchForm.netMode,
|
||||
deviceType: GjSearchForm.deviceType,
|
||||
deviceName: GjSearchForm.deviceName
|
||||
};
|
||||
showloading();
|
||||
api
|
||||
.getNodeDevice(para)
|
||||
.then((res) => {
|
||||
const getDeviceList = () => {
|
||||
// 无论是否有 checkNode.val,都返回 Promise
|
||||
return new Promise((resolve, reject) => {
|
||||
if (!checkNode.val && checkNode.val !== '') { // 排除全部设备的空字符串
|
||||
pagin.total = 0;
|
||||
deviceList.value = [];
|
||||
hideloading(); // 确保 loading 关闭
|
||||
resolve();
|
||||
return;
|
||||
}
|
||||
showloading();
|
||||
let para = {
|
||||
nodeCode: checkNode.val || '', // 空ID对应全部设备
|
||||
pageIndex: GjSearchForm.pageNum,
|
||||
pageSize: GjSearchForm.pageSize,
|
||||
communicationMode: GjSearchForm.netMode,
|
||||
deviceType: GjSearchForm.deviceType,
|
||||
deviceName: GjSearchForm.deviceName
|
||||
};
|
||||
api.getNodeDevice(para).then((res: any) => {
|
||||
console.log(res, 'ressss');
|
||||
deviceList.value = res.rows;
|
||||
pagin.total = res.total;
|
||||
})
|
||||
.catch((ex) => {
|
||||
resolve();
|
||||
}).catch((ex) => {
|
||||
console.log('出现了异常', ex);
|
||||
})
|
||||
.finally(() => {
|
||||
reject(ex); // 抛出错误
|
||||
}).finally(() => {
|
||||
hideloading();
|
||||
});
|
||||
});
|
||||
};
|
||||
//树控件节点点击事件
|
||||
var handleNodeClick = (node) => {
|
||||
@ -360,10 +358,26 @@ var handleNodeClick = (node) => {
|
||||
getDeviceList();
|
||||
};
|
||||
|
||||
const ALL_DEVICE_NODE = {
|
||||
id: '',
|
||||
groupName: '全部设备',
|
||||
parentId: null,
|
||||
children: [],
|
||||
isAll: true
|
||||
};
|
||||
//树控件筛选后显示的数据源
|
||||
var treeData = computed(() => {
|
||||
let arr = api.treeNodeSearch(treeDataOrin.value, searchTxt.value, 'groupName', 'children');
|
||||
return arr;
|
||||
let newArr = [JSON.parse(JSON.stringify(ALL_DEVICE_NODE))];
|
||||
if (arr.length) {
|
||||
newArr = newArr.concat(arr);
|
||||
}
|
||||
if (newArr.length && !checkNode.val) {
|
||||
checkNode.val = newArr[0].id; // 空ID
|
||||
Promise.resolve(getDeviceList()).finally(() => {
|
||||
});
|
||||
}
|
||||
return newArr;
|
||||
});
|
||||
|
||||
//显示/隐藏高级筛选
|
||||
@ -379,7 +393,7 @@ var editNode = (node) => {
|
||||
Status.isEditTreeNode = true;
|
||||
cEdit.value.editNode = node;
|
||||
cEdit.value.pNode = null;
|
||||
Status.dialogEditNode=true;
|
||||
Status.dialogEditNode = true;
|
||||
//
|
||||
};
|
||||
|
||||
@ -413,7 +427,7 @@ var completeEdit = (node) => {
|
||||
if (res.code == 200) {
|
||||
alert('操作成功');
|
||||
RefreshTree();
|
||||
Status.dialogEditNode=false;
|
||||
Status.dialogEditNode = false;
|
||||
} else {
|
||||
alert(res.msg);
|
||||
}
|
||||
@ -477,7 +491,7 @@ var addNode = (node) => {
|
||||
};
|
||||
|
||||
var saveNode = () => {
|
||||
if(!cEdit.value.groupName){
|
||||
if (!cEdit.value.groupName) {
|
||||
return;
|
||||
}
|
||||
let val = new Date().getTime();
|
||||
@ -551,6 +565,7 @@ var getSelectionRows = () => {
|
||||
|
||||
var RefreshTree = function () {
|
||||
api.getTreeData(searchTxt.value).then((res) => {
|
||||
console.log(res, 'reddddd');
|
||||
treeDataOrin.value = res;
|
||||
});
|
||||
};
|
||||
@ -622,9 +637,8 @@ var showDevice = () => {
|
||||
let arr = res1.rows.map((item) => ({
|
||||
key: item.deviceId,
|
||||
label: item.deviceName //,
|
||||
// disabled: item.groupId && item.groupId == checkNode.val ? false : item.groupId ? true : false
|
||||
}));
|
||||
|
||||
;
|
||||
transfer.data = arr;
|
||||
}
|
||||
}
|
||||
@ -917,8 +931,8 @@ onMounted(() => {
|
||||
}
|
||||
|
||||
.custom-tree-node .iconContent .icon {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
width: 15px;
|
||||
height: 15px;
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
|
||||
687
src/views/fys-equipment/trackService/index.vue
Normal file
687
src/views/fys-equipment/trackService/index.vue
Normal file
@ -0,0 +1,687 @@
|
||||
<template>
|
||||
<div class="p-2">
|
||||
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
|
||||
<div v-show="showSearch" class="mb-[10px]">
|
||||
<el-card shadow="hover">
|
||||
<el-form ref="queryFormRef" :model="queryParams" :inline="true">
|
||||
<!-- <el-form-item label="猎鹰服务ID" prop="sid">
|
||||
<el-input v-model="queryParams.sid" placeholder="请输入猎鹰服务ID" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item> -->
|
||||
<el-form-item label="服务名称" prop="sname">
|
||||
<el-input v-model="queryParams.sname" placeholder="请输入服务名称" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
</div>
|
||||
</transition>
|
||||
|
||||
<el-card shadow="never">
|
||||
<template #header>
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['system:service:add']">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate()" v-hasPermi="['system:service:edit']"
|
||||
>修改</el-button
|
||||
>
|
||||
</el-col>
|
||||
|
||||
<!-- <el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['system:service:export']">导出</el-button>
|
||||
</el-col> -->
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
</template>
|
||||
|
||||
<el-table v-loading="loading" border :data="serviceList" @selection-change="handleSelectionChange">
|
||||
<el-table-column label="猎鹰服务ID" align="center" prop="sid" />
|
||||
<el-table-column label="服务名称" align="center" prop="sname" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template #default="scope">
|
||||
<el-tooltip content="关联设备" placement="top">
|
||||
<el-button link type="primary" icon="Connection" @click="ShowCheckDevice(scope.row)" v-hasPermi="['system:service:edit']"></el-button>
|
||||
</el-tooltip>
|
||||
<el-tooltip content="修改" placement="top">
|
||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['system:service:edit']"></el-button>
|
||||
</el-tooltip>
|
||||
<el-tooltip content="终端" placement="top">
|
||||
<el-button link type="primary" icon="View" @click="ShowMapDevice(scope.row)"></el-button>
|
||||
</el-tooltip>
|
||||
<!-- <el-tooltip content="删除" placement="top">
|
||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['system:service:remove']"></el-button>
|
||||
</el-tooltip> -->
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
|
||||
</el-card>
|
||||
<!-- 添加或修改轨迹服务对话框 -->
|
||||
<el-dialog :title="dialog.title" :draggable="true" v-model="dialog.visible" width="500px" append-to-body>
|
||||
<el-form ref="serviceFormRef" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="服务名称" prop="sname">
|
||||
<el-input v-model="form.sname" placeholder="请输入服务名称" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 关联设备维护 -->
|
||||
<el-dialog :title="dialog.connectTitle" :draggable="true" footer-class="dilogFooter" v-model="dialog.connectVisible" width="80%" append-to-body>
|
||||
<div class="deviceContent" v-loading="dialog.connctLoading">
|
||||
<div class="filter">
|
||||
<el-form :inline="true">
|
||||
<el-form-item label="关键字" prop="checkedKey">
|
||||
<el-input v-model="searchFilter.checkedKey" placeholder="imei查询" clearable @keyup.enter="handleTerminalQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="Search" @click="searchCheckedDevice">搜索</el-button>
|
||||
<el-button icon="Refresh" @click="searchFilter.checkedKey='';searchCheckedDevice()">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<div>
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="Plus" @click="ShowAllDevice" v-hasPermi="['system:service:add']">新增</el-button>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="DelChecked()" v-hasPermi="['system:service:remove']"
|
||||
>删除</el-button
|
||||
>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
<div class="checked">
|
||||
<el-table
|
||||
v-loading="loading"
|
||||
border
|
||||
:data="checkedDevices"
|
||||
@selection-change="handleSelectionChange"
|
||||
reserve-selection="true"
|
||||
ref="multipleTableRef"
|
||||
row-key="id"
|
||||
>
|
||||
<el-table-column type="selection" width="55" align="center" reserve-selection="true" />
|
||||
<!-- <el-table-column label="deviceId" align="center" prop="deviceId" />
|
||||
<el-table-column label="id" align="center" prop="id" /> -->
|
||||
<el-table-column label="设备类型" align="center" prop="typeName" />
|
||||
<el-table-column label="设备名称" align="center" prop="deviceName" />
|
||||
<el-table-column label="IMEI" align="center" prop="deviceImei" />
|
||||
<el-table-column label="Mac" align="center" prop="deviceMac" />
|
||||
<el-table-column label="蓝牙名称" align="center" prop="bluetoothName" />
|
||||
<!-- <el-table-column label="高德服务id" align="center" prop="sid" /> -->
|
||||
<el-table-column label="高德终端id" align="center" prop="tid" />
|
||||
<el-table-column label="高德轨迹id" align="center" prop="trid" />
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
:total="checkedPageParams.total"
|
||||
v-model:page="checkedPageParams.pageNum"
|
||||
v-model:limit="checkedPageParams.pageSize"
|
||||
@pagination="searchCheckedDevice"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button @click="cancelConn">关闭</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog title="选择设备" :draggable="true" footer-class="dilogFooter" v-model="dialog.checkVisible" width="65%" append-to-body>
|
||||
<div class="checkdeviceContent" v-loading="dialog.checkLoading">
|
||||
<div class="filter">
|
||||
<el-form :inline="true">
|
||||
<el-form-item label="关键字" prop="nocheckKey">
|
||||
<el-input v-model="searchFilter.nocheckKey" placeholder="imei查询" clearable @keyup.enter="handleTerminalQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="Search" @click="searchNoCheckDevice">搜索</el-button>
|
||||
<el-button icon="Refresh" @click="searchFilter.nocheckKey='';searchNoCheckDevice()">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<div class="noCheck">
|
||||
<el-table v-loading="loading" border :data="noCheckDevices" @selection-change="checkNocheckChange" row-key="id">
|
||||
<el-table-column type="selection" width="55" align="center" :selectable="selectable" />
|
||||
<!-- <el-table-column label="deviceId" align="center" prop="deviceId" />
|
||||
<el-table-column label="id" align="center" prop="id" /> -->
|
||||
<el-table-column label="设备类型" align="center" prop="typeName" />
|
||||
<el-table-column label="设备名称" align="center" prop="deviceName" />
|
||||
<el-table-column label="IMEI" align="center" prop="deviceImei" />
|
||||
<el-table-column label="Mac" align="center" prop="deviceMac" />
|
||||
<el-table-column label="蓝牙名称" align="center" prop="bluetoothName" />
|
||||
<el-table-column label="高德服务id" align="center" prop="sid" />
|
||||
<el-table-column label="高德终端id" align="center" prop="tid" />
|
||||
<el-table-column label="高德轨迹id" align="center" prop="trid" />
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
:total="noCheckPageParams.total"
|
||||
v-model:page="noCheckPageParams.pageNum"
|
||||
v-model:limit="noCheckPageParams.pageSize"
|
||||
@pagination="searchNoCheckDevice"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button :loading="buttonLoading" type="primary" :disabled="checkNoFlag" @click="checkedOK">保 存</el-button>
|
||||
<el-button @click="cancelCheck">取 消</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog title="查看终端" :draggable="true" footer-class="dilogFooter" v-model="dialog.showMap" width="70%" append-to-body>
|
||||
<div class="checkdeviceContent" v-loading="dialog.viewLoading">
|
||||
<div class="filter">
|
||||
<el-form :inline="true">
|
||||
<el-form-item label="关键字" prop="keywork">
|
||||
<el-input v-model="TerminalQuery.keywork" placeholder="终端名称/描述/自定义内容" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="Search" @click="handleTerminalQuery">搜索</el-button>
|
||||
<el-button icon="Refresh" @click="resetTterminalQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
|
||||
<div class="noCheck">
|
||||
<el-table v-loading="loading" border :data="mapDevices" reserve-selection="true" row-key="tid">
|
||||
<el-table-column label="终端设备id" align="center" prop="tid" />
|
||||
<el-table-column label="终端名称" align="center" prop="name" />
|
||||
<el-table-column label="创建时间" align="center" prop="createtime" />
|
||||
<el-table-column label="最后定位时间" align="center" prop="locatetime" />
|
||||
<el-table-column label="终端描述" align="center" prop="desc" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template #default="scope">
|
||||
<el-tooltip content="删除" placement="top">
|
||||
<el-button link type="primary" icon="Delete" @click="deleteDevice(scope.row)" v-hasPermi="['system:service:remove']"></el-button>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
:total="viewDevicePageParams.total"
|
||||
v-model:page="viewDevicePageParams.pageNum"
|
||||
v-model:limit="viewDevicePageParams.pageSize"
|
||||
@pagination="ShowMapDevice"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button :loading="buttonLoading" type="primary" :disabled="checkNoFlag" @click="checkedOK">保 存</el-button>
|
||||
<el-button @click="HideMapDevice">取 消</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="Service" lang="ts">
|
||||
import {
|
||||
listService,
|
||||
getService,
|
||||
delService,
|
||||
addService,
|
||||
updateService,
|
||||
getDevice,
|
||||
terminalDevice,
|
||||
delTerminalDevice,
|
||||
getMapDevice,
|
||||
getMapDeviceByFilter,
|
||||
getDeviceList
|
||||
} from '@/api/system/service/api';
|
||||
import { ServiceVO, ServiceQuery, ServiceForm } from '@/api/system/service/types';
|
||||
import type { TableInstance } from 'element-plus';
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
|
||||
const serviceList = ref<ServiceVO[]>([]);
|
||||
const buttonLoading = ref(false);
|
||||
const loading = ref(true);
|
||||
const showSearch = ref(true);
|
||||
const ids = ref<any>([]);
|
||||
const checkNoDevices = ref<any>([]);
|
||||
const single = ref(true);
|
||||
const multiple = ref(true);
|
||||
const checkNoFlag = ref(true);
|
||||
const total = ref(0);
|
||||
const multipleTableRef = ref<TableInstance>();
|
||||
const queryFormRef = ref<ElFormInstance>();
|
||||
const serviceFormRef = ref<ElFormInstance>();
|
||||
|
||||
const dialog = reactive({
|
||||
visible: false,
|
||||
title: '',
|
||||
connectVisible: false,
|
||||
connectTitle: '编辑关联设备',
|
||||
connctLoading: false,
|
||||
checkVisible: false,
|
||||
checkLoading: false,
|
||||
showMap: false,
|
||||
viewLoading: false
|
||||
});
|
||||
|
||||
|
||||
const searchFilter=ref({
|
||||
nocheckKey:'',
|
||||
checkedKey:''
|
||||
});
|
||||
const initFormData: ServiceForm = {
|
||||
id: undefined,
|
||||
sid: undefined,
|
||||
sname: undefined
|
||||
};
|
||||
const data = reactive<PageData<ServiceForm, ServiceQuery>>({
|
||||
form: { ...initFormData },
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
sid: undefined,
|
||||
sname: undefined,
|
||||
params: {}
|
||||
},
|
||||
rules: {
|
||||
id: [{ required: true, message: '不能为空', trigger: 'blur' }]
|
||||
}
|
||||
});
|
||||
|
||||
var cEdit = reactive<ServiceVO>({
|
||||
id: null,
|
||||
sid: null,
|
||||
sname: null
|
||||
});
|
||||
|
||||
var noCheckPageParams = reactive({
|
||||
pageNum: 1,
|
||||
pageSize: 20,
|
||||
total: 0
|
||||
});
|
||||
var checkedPageParams = reactive({
|
||||
pageNum: 1,
|
||||
pageSize: 20,
|
||||
total: 0
|
||||
});
|
||||
|
||||
var viewDevicePageParams = reactive({
|
||||
pageNum: 1,
|
||||
pageSize: 50,
|
||||
total: 0
|
||||
});
|
||||
|
||||
var noCheckDevices = ref([]);
|
||||
var checkedDevices = ref([]);
|
||||
var mapDevices = ref([]);
|
||||
const { queryParams, form, rules } = toRefs(data);
|
||||
/** 重置按钮操作 */
|
||||
const resetTterminalQuery = () => {
|
||||
TerminalQuery.value.keywork = '';
|
||||
ShowMapDevice(cEdit);
|
||||
};
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleTerminalQuery = () => {
|
||||
viewDevicePageParams.pageNum = 1;
|
||||
ShowMapDevice(cEdit);
|
||||
};
|
||||
|
||||
//查看终端
|
||||
function ShowMapDevice(row) {
|
||||
debugger;
|
||||
dialog.showMap = true;
|
||||
if(row && row.sid){
|
||||
cEdit = row;
|
||||
}
|
||||
|
||||
|
||||
let para2 = { sid: cEdit.sid,
|
||||
filter: TerminalQuery.value.keywork,
|
||||
page: viewDevicePageParams.pageNum,
|
||||
pagesize: viewDevicePageParams.pageSize
|
||||
};
|
||||
|
||||
dialog.viewLoading = true;
|
||||
|
||||
let p2 = getMapDeviceByFilter(para2);
|
||||
|
||||
p2.then((res) => {
|
||||
if (res.code === 200) {
|
||||
mapDevices.value = res.rows;
|
||||
viewDevicePageParams.total = res.total;
|
||||
} else {
|
||||
mapDevices.value = [];
|
||||
viewDevicePageParams.total = 0;
|
||||
}
|
||||
}).finally(() => {
|
||||
dialog.viewLoading = false;
|
||||
});
|
||||
}
|
||||
|
||||
function HideMapDevice() {
|
||||
dialog.showMap = false;
|
||||
cEdit = null;
|
||||
}
|
||||
|
||||
/** 查询轨迹服务列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true;
|
||||
const res = await listService(queryParams.value);
|
||||
serviceList.value = res.rows;
|
||||
total.value = res.total;
|
||||
loading.value = false;
|
||||
};
|
||||
|
||||
/** 取消按钮 */
|
||||
const cancel = () => {
|
||||
reset();
|
||||
dialog.visible = false;
|
||||
};
|
||||
|
||||
function selectable(row, index) {
|
||||
if (row.sid) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//查询未选择的设备
|
||||
const searchNoCheckDevice = () => {
|
||||
return new Promise((resolve, reject) => {
|
||||
let para = {
|
||||
deviceStatus: 1,
|
||||
// isTid: false,
|
||||
// sid: cEdit.sid,
|
||||
pageNum: noCheckPageParams.pageNum,
|
||||
pageSize: noCheckPageParams.pageSize,
|
||||
deviceImei:searchFilter.value.nocheckKey
|
||||
};
|
||||
dialog.checkLoading = true;
|
||||
getDeviceList(para)
|
||||
.then((res) => {
|
||||
debugger;
|
||||
if (res.code === 200) {
|
||||
noCheckDevices.value = res.rows;
|
||||
noCheckPageParams.total = res.total;
|
||||
resolve(res);
|
||||
|
||||
return;
|
||||
}
|
||||
resolve(null);
|
||||
})
|
||||
.catch((ex) => {
|
||||
resolve(null);
|
||||
})
|
||||
.finally(() => {
|
||||
dialog.checkLoading = false;
|
||||
});
|
||||
});
|
||||
};
|
||||
//查询已选择的设备
|
||||
const searchCheckedDevice = () => {
|
||||
return new Promise((resolve, reject) => {
|
||||
let para = {
|
||||
deviceStatus: 1,
|
||||
isTid: true,
|
||||
sid: cEdit.sid,
|
||||
pageNum: checkedPageParams.pageNum,
|
||||
pageSize: checkedPageParams.pageSize,
|
||||
deviceImei:searchFilter.value.checkedKey
|
||||
};
|
||||
checkedPageParams.total = 0;
|
||||
dialog.connctLoading = true;
|
||||
getDevice(para)
|
||||
.then((res) => {
|
||||
console.log('查询已选择设备成功');
|
||||
if (res.code === 200) {
|
||||
debugger;
|
||||
checkedDevices.value = res.rows;
|
||||
checkedPageParams.total = res.total;
|
||||
resolve(res);
|
||||
return;
|
||||
}
|
||||
resolve(null);
|
||||
})
|
||||
.catch((ex) => {
|
||||
resolve(null);
|
||||
})
|
||||
.finally(() => {
|
||||
dialog.connctLoading = false;
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
/** 关闭关联设备的弹窗 */
|
||||
const cancelConn = () => {
|
||||
dialog.connectVisible = false;
|
||||
};
|
||||
const cancelCheck = () => {
|
||||
dialog.checkVisible = false;
|
||||
};
|
||||
//弹出选择框
|
||||
const ShowCheckDevice = (row) => {
|
||||
cEdit = row;
|
||||
dialog.connectVisible = true;
|
||||
searchCheckedDevice();
|
||||
};
|
||||
const ShowAllDevice = () => {
|
||||
dialog.checkVisible = true;
|
||||
|
||||
searchNoCheckDevice();
|
||||
};
|
||||
//删除某一个
|
||||
const deleteDevice = (row) => {
|
||||
proxy?.$modal.confirm('删除后不可恢复,是否确认选中的的数据项?').then((res) => {
|
||||
// delTerminalDevice(row.tid).then((res) => {
|
||||
// if (res.code === 200) {
|
||||
// proxy?.$modal.msgSuccess(res.msg);
|
||||
// searchCheckedDevice();
|
||||
// } else {
|
||||
// proxy?.$modal.alertError('操作失败');
|
||||
// }
|
||||
// });
|
||||
});
|
||||
};
|
||||
//删除所选
|
||||
const DelChecked = () => {
|
||||
if (!ids.value.length) {
|
||||
proxy?.$modal.msgError('请选择要删除的数据');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
let id = ids.value
|
||||
.map((v) => {
|
||||
return v.deviceId;
|
||||
})
|
||||
.join(',');
|
||||
|
||||
proxy?.$modal.confirm('删除后不可恢复,是否确认选中的的数据项?').then((res) => {
|
||||
delTerminalDevice(id).then((res) => {
|
||||
if (res.code === 200) {
|
||||
proxy?.$modal.msgSuccess(res.msg);
|
||||
searchCheckedDevice();
|
||||
} else {
|
||||
proxy?.$modal.alertError('操作失败');
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
//选中某一些设备
|
||||
const checkedOK = () => {
|
||||
if (!checkNoFlag.value) {
|
||||
if (checkNoDevices.value.length > 0) {
|
||||
let arr = checkNoDevices.value.map((v) => {
|
||||
return { deviceImei: v.deviceImei, typeName: v.typeName, id: v.id };
|
||||
});
|
||||
let data = { sid: cEdit.sid, deviceList: arr };
|
||||
terminalDevice(data).then((res) => {
|
||||
if (res.code === 200) {
|
||||
proxy?.$modal.msgSuccess('操作成功');
|
||||
searchNoCheckDevice();
|
||||
searchCheckedDevice();
|
||||
} else {
|
||||
proxy?.$modal.msgError('操作失败');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/** 表单重置 */
|
||||
const reset = () => {
|
||||
form.value = { ...initFormData };
|
||||
serviceFormRef.value?.resetFields();
|
||||
};
|
||||
|
||||
const TerminalQuery = ref({
|
||||
keywork: ''
|
||||
});
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
queryParams.value.pageNum = 1;
|
||||
getList();
|
||||
};
|
||||
|
||||
/** 重置按钮操作 */
|
||||
const resetQuery = () => {
|
||||
queryFormRef.value?.resetFields();
|
||||
handleQuery();
|
||||
};
|
||||
/** 多选框选中数据 */
|
||||
const handleSelectionChange = (selection: ServiceVO[]) => {
|
||||
ids.value = selection;
|
||||
if (selection.length) {
|
||||
multiple.value = false;
|
||||
} else {
|
||||
multiple.value = true;
|
||||
}
|
||||
};
|
||||
|
||||
const checkNocheckChange = (selection: ServiceVO[]) => {
|
||||
checkNoDevices.value = selection;
|
||||
if (selection.length) {
|
||||
checkNoFlag.value = false;
|
||||
} else {
|
||||
checkNoFlag.value = true;
|
||||
}
|
||||
};
|
||||
|
||||
/** 新增按钮操作 */
|
||||
const handleAdd = () => {
|
||||
reset();
|
||||
dialog.visible = true;
|
||||
dialog.title = '添加轨迹服务';
|
||||
};
|
||||
|
||||
/** 修改按钮操作 */
|
||||
const handleUpdate = async (row?: ServiceVO) => {
|
||||
reset();
|
||||
const _id = row?.id || ids.value[0];
|
||||
const res = await getService(_id);
|
||||
Object.assign(form.value, res.data);
|
||||
dialog.visible = true;
|
||||
dialog.title = '修改轨迹服务';
|
||||
};
|
||||
|
||||
/** 提交按钮 */
|
||||
const submitForm = () => {
|
||||
serviceFormRef.value?.validate(async (valid: boolean) => {
|
||||
if (valid) {
|
||||
buttonLoading.value = true;
|
||||
if (form.value.id) {
|
||||
await updateService(form.value).finally(() => (buttonLoading.value = false));
|
||||
} else {
|
||||
await addService(form.value).finally(() => (buttonLoading.value = false));
|
||||
}
|
||||
proxy?.$modal.msgSuccess('操作成功');
|
||||
dialog.visible = false;
|
||||
await getList();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/** 删除按钮操作 */
|
||||
const handleDelete = async (row?: ServiceVO) => {
|
||||
const _ids = row?.id || ids.value;
|
||||
await proxy?.$modal.confirm('是否确认删除轨迹服务编号为"' + _ids + '"的数据项?').finally(() => (loading.value = false));
|
||||
await delService(_ids);
|
||||
proxy?.$modal.msgSuccess('删除成功');
|
||||
await getList();
|
||||
};
|
||||
|
||||
/** 导出按钮操作 */
|
||||
const handleExport = () => {
|
||||
proxy?.download(
|
||||
'system/service/export',
|
||||
{
|
||||
...queryParams.value
|
||||
},
|
||||
`service_${new Date().getTime()}.xlsx`
|
||||
);
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
getList();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.deviceContent {
|
||||
width: 100%;
|
||||
height: 75vh;
|
||||
}
|
||||
|
||||
.checkdeviceContent {
|
||||
width: 100%;
|
||||
height: 65vh;
|
||||
}
|
||||
|
||||
.noCheck,
|
||||
.checked {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
/* border: 1px solid #b8b6b6; */
|
||||
border-radius: 8px;
|
||||
padding: 8px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.dilogFooter {
|
||||
text-align: center;
|
||||
}
|
||||
.center {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: nowrap;
|
||||
align-content: center;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.cell,
|
||||
:deep .cell {
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
:deep .el-checkbox__input.is-disabled .el-checkbox__inner,
|
||||
.el-checkbox__input.is-disabled .el-checkbox__inner {
|
||||
background-color: #e5e5e5 !important;
|
||||
}
|
||||
</style>
|
||||
@ -43,9 +43,9 @@
|
||||
删除
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<!-- <el-col :span="1.5">
|
||||
<el-button v-hasPermi="['system:dict:export']" type="warning" plain icon="Download" @click="handleExport">导出</el-button>
|
||||
</el-col>
|
||||
</el-col> -->
|
||||
<el-col :span="1.5">
|
||||
<el-button v-hasPermi="['system:dict:remove']" type="danger" plain icon="Refresh" @click="handleRefreshCache">刷新缓存</el-button>
|
||||
</el-col>
|
||||
|
||||
@ -48,9 +48,9 @@
|
||||
<el-col :span="1.5">
|
||||
<el-button v-hasPermi="['system:role:delete']" type="danger" plain :disabled="ids.length === 0" @click="handleDelete()">删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<!-- <el-col :span="1.5">
|
||||
<el-button v-hasPermi="['system:role:export']" type="warning" plain icon="Download" @click="handleExport">导出</el-button>
|
||||
</el-col>
|
||||
</el-col> -->
|
||||
<right-toolbar v-model:show-search="showSearch" @query-table="getList"></right-toolbar>
|
||||
</el-row>
|
||||
</template>
|
||||
@ -84,7 +84,7 @@
|
||||
<el-button v-hasPermi="['system:role:edit']" link type="primary" icon="CircleCheck" @click="handleDataScope(scope.row)"></el-button>
|
||||
</el-tooltip>
|
||||
<el-tooltip v-if="scope.row.roleId !== 1" content="分配用户" placement="top">
|
||||
<el-button v-hasPermi="['system:role:edit']" link type="primary" icon="User" @click="handleAuthUser(scope.row)"></el-button>
|
||||
<el-button v-hasPermi="['system:role:edit']" link type="primary" icon="User" @click=" (scope.row)"></el-button>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
@ -61,7 +61,7 @@
|
||||
<el-tab-pane label="在线设备" name="onlineDevice">
|
||||
<onlineDevice :devices="state.devices" />
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="App版本" name="appVer">
|
||||
<el-tab-pane label="" name="appVer" style="visibility: hidden;" >
|
||||
<appVer />
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
|
||||
Reference in New Issue
Block a user