forked from dyf/dyf-vue-ui
加入轨迹服务,围栏真实化
# Conflicts: # .env.development
This commit is contained in:
@ -5,12 +5,13 @@ VITE_APP_TITLE = 云平台管理系统
|
|||||||
VITE_APP_ENV = 'development'
|
VITE_APP_ENV = 'development'
|
||||||
|
|
||||||
# 开发环境
|
# 开发环境
|
||||||
#VITE_APP_BASE_API = 'https://fuyuanshen.com/backend'
|
# VITE_APP_BASE_API = 'http://139.224.253.23:8000'
|
||||||
VITE_APP_BASE_API = 'https://www.cnxhyc.com/jq'
|
# VITE_APP_BASE_API = 'https://www.cnxhyc.com/jq'
|
||||||
# VITE_APP_BASE_API = 'http://139.224.253.23:8000'
|
VITE_APP_BASE_API = 'http://192.168.110.56:8000'
|
||||||
#代永飞接口
|
#代永飞接口
|
||||||
# VITE_APP_BASE_API = 'http://457102h2d6.qicp.vip:24689'
|
# VITE_APP_BASE_API = 'http://457102h2d6.qicp.vip:24689'
|
||||||
|
|
||||||
|
VITE_AMAP_KEY='84a12a692ae378effdf741e16d584cd3'
|
||||||
|
|
||||||
# 应用访问路径 例如使用前缀 /admin/
|
# 应用访问路径 例如使用前缀 /admin/
|
||||||
VITE_APP_CONTEXT_PATH = '/'
|
VITE_APP_CONTEXT_PATH = '/'
|
||||||
|
|||||||
@ -21,6 +21,7 @@ VITE_APP_SNAILJOB_ADMIN = '/snail-job'
|
|||||||
|
|
||||||
# 生产环境 晶全3
|
# 生产环境 晶全3
|
||||||
VITE_APP_BASE_API = 'http://139.224.253.23:8000'
|
VITE_APP_BASE_API = 'http://139.224.253.23:8000'
|
||||||
|
VITE_AMAP_KEY='84a12a692ae378effdf741e16d584cd3'
|
||||||
|
|
||||||
# 生产环境 富源晟3
|
# 生产环境 富源晟3
|
||||||
#VITE_APP_BASE_API = '/backend-fys'
|
#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>
|
|
||||||
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -592,17 +592,15 @@ const getMainLightModeLabel = (mode: any) => {
|
|||||||
// 处理设备消息
|
// 处理设备消息
|
||||||
const handleDeviceMessage = (msg: any) => {
|
const handleDeviceMessage = (msg: any) => {
|
||||||
try {
|
try {
|
||||||
// 解析设备消息(假设格式为 { state: [类型, 模式值, 亮度, 续航...] })
|
|
||||||
const payloadObj = JSON.parse(msg.payload.toString());
|
const payloadObj = JSON.parse(msg.payload.toString());
|
||||||
const deviceState = payloadObj.state; // 设备状态数组
|
const deviceState = payloadObj.state; // 设备状态数组
|
||||||
if (!Array.isArray(deviceState)) {
|
if (!Array.isArray(deviceState)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// 用switch处理不同的消息类型(deviceState[0])
|
|
||||||
switch (deviceState[0]) {
|
switch (deviceState[0]) {
|
||||||
case 1:
|
case 1:
|
||||||
// 类型1灯光主键
|
// 类型1灯光主键
|
||||||
const lightModeId = getMainLightModeLabel(deviceState[1]); // 获取模式ID(如'strong')
|
const lightModeId = getMainLightModeLabel(deviceState[1]);
|
||||||
const brightness = deviceState[2]; // 亮度值
|
const brightness = deviceState[2]; // 亮度值
|
||||||
const batteryTime = deviceState[3]; // 续航时间
|
const batteryTime = deviceState[3]; // 续航时间
|
||||||
console.log('灯光模式消息:', { 模式ID: lightModeId, 亮度: brightness, 续航: batteryTime });
|
console.log('灯光模式消息:', { 模式ID: lightModeId, 亮度: brightness, 续航: batteryTime });
|
||||||
@ -625,7 +623,7 @@ const handleDeviceMessage = (msg: any) => {
|
|||||||
break;
|
break;
|
||||||
case 12:
|
case 12:
|
||||||
// 灯光主键
|
// 灯光主键
|
||||||
const lightModeIdA = getMainLightModeLabel(deviceState[1]); // 获取模式ID(如'strong')
|
const lightModeIdA = getMainLightModeLabel(deviceState[1]);
|
||||||
if (lightModeIdA !== 'unknown') {
|
if (lightModeIdA !== 'unknown') {
|
||||||
lightModes.value.forEach(mode => {
|
lightModes.value.forEach(mode => {
|
||||||
const isActive = mode.id === lightModeIdA;
|
const isActive = mode.id === lightModeIdA;
|
||||||
@ -650,7 +648,6 @@ const handleDeviceMessage = (msg: any) => {
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// 其他类型消息(不处理,仅打印)
|
|
||||||
console.log('未处理的消息类型:', deviceState[0]);
|
console.log('未处理的消息类型:', deviceState[0]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -658,7 +655,7 @@ const handleDeviceMessage = (msg: any) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
await getList(); // 先获取设备信息
|
await getList();
|
||||||
// 连接mqtt
|
// 连接mqtt
|
||||||
onConnect(async () => {
|
onConnect(async () => {
|
||||||
const deviceImei = deviceDetail.value.deviceImei;
|
const deviceImei = deviceDetail.value.deviceImei;
|
||||||
@ -684,7 +681,7 @@ onMounted(async () => {
|
|||||||
handleDeviceMessage(msg);
|
handleDeviceMessage(msg);
|
||||||
});
|
});
|
||||||
onError((err) => {
|
onError((err) => {
|
||||||
console.error('MQTT连接失败原因:', err.message); // 关键:打印连接失败的具体原因
|
console.error('MQTT连接失败原因:', err.message);
|
||||||
});
|
});
|
||||||
connect();
|
connect();
|
||||||
});
|
});
|
||||||
|
|||||||
@ -572,6 +572,7 @@ const sendTextMessage = async () => {
|
|||||||
proxy?.$modal.msgError(res.msg);
|
proxy?.$modal.msgError(res.msg);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
};
|
};
|
||||||
const lookMap = (row: any) => {
|
const lookMap = (row: any) => {
|
||||||
console.log(row, 'row');
|
console.log(row, 'row');
|
||||||
@ -651,6 +652,15 @@ const handleDeviceMessage = (payload: any) => {
|
|||||||
console.log('收到设备上报的数据', payload);
|
console.log('收到设备上报的数据', payload);
|
||||||
parseDataMQ(json);
|
parseDataMQ(json);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(keys.indexOf('sta_BreakNews')>-1){
|
||||||
|
if(json.sta_BreakNews==='I get it'){
|
||||||
|
|
||||||
|
confirm('用户已确认收到紧急通知');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
await getList(); // 先获取设备信息
|
await getList(); // 先获取设备信息
|
||||||
|
|||||||
@ -312,11 +312,11 @@
|
|||||||
<span style="color: #409eff">批量导入完成,共检测到 <span style="color: #e6a23c">{{ importResult.total }}</span> 条数据,导入成功
|
<span style="color: #409eff">批量导入完成,共检测到 <span style="color: #e6a23c">{{ importResult.total }}</span> 条数据,导入成功
|
||||||
<span style="color: #67c23a">{{ importResult.succeed }}</span> 条,失败
|
<span style="color: #67c23a">{{ importResult.succeed }}</span> 条,失败
|
||||||
<span style="color: red">{{ importResult.errorSun }}</span> 条。</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>
|
</div>
|
||||||
</el-upload>
|
</el-upload>
|
||||||
|
<p v-if="importResult.errorSun > 0" style="padding: 10px">
|
||||||
|
<a :href="importResult.link">>>> 上传失败明细下载 <i class="el-icon-download" /></a>
|
||||||
|
</p>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<div class="dialog-footer">
|
<div class="dialog-footer">
|
||||||
<el-button @click="importDialogVisible = false">取 消</el-button>
|
<el-button @click="importDialogVisible = false">取 消</el-button>
|
||||||
|
|||||||
@ -16,8 +16,7 @@
|
|||||||
<div>
|
<div>
|
||||||
<el-form :inline="true" :model="queryParams" class="demo-form-inline" @submit.native.prevent>
|
<el-form :inline="true" :model="queryParams" class="demo-form-inline" @submit.native.prevent>
|
||||||
<el-form-item label="" style="margin-right: 15px">
|
<el-form-item label="" style="margin-right: 15px">
|
||||||
<el-input :suffix-icon="'Search'" v-model="queryParams.name" placeholder="名称" clearable
|
<el-input :suffix-icon="'Search'" v-model="queryParams.name" placeholder="名称" clearable @input="handleQuery" />
|
||||||
@input="handleQuery"/>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item style="margin-right: 0px">
|
<el-form-item style="margin-right: 0px">
|
||||||
@ -98,6 +97,11 @@
|
|||||||
<el-dialog width="calc(calc(100% - 250px) * 0.9)" v-model="Status.showEdit" :title="'编辑围栏'" :draggable="true">
|
<el-dialog width="calc(calc(100% - 250px) * 0.9)" v-model="Status.showEdit" :title="'编辑围栏'" :draggable="true">
|
||||||
<div>
|
<div>
|
||||||
<el-form :inline="true" :model="cEdit" label-width="auto">
|
<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-form-item label="围栏名称">
|
||||||
<el-input v-model="cEdit.name" />
|
<el-input v-model="cEdit.name" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@ -142,9 +146,7 @@
|
|||||||
|
|
||||||
<!-- 提示框 -->
|
<!-- 提示框 -->
|
||||||
<el-dialog :width="300" :draggable="true" v-model="Status.confirm.Visible" :title="Status.confirm.title" center>
|
<el-dialog :width="300" :draggable="true" v-model="Status.confirm.Visible" :title="Status.confirm.title" center>
|
||||||
<span :class="Status.confirm.isWarn">
|
<span :class="Status.confirm.isWarn" v-html="Status.confirm.text"> </span>
|
||||||
{{ Status.confirm.text }}
|
|
||||||
</span>
|
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<div class="dialog-footer">
|
<div class="dialog-footer">
|
||||||
<el-button type="primary" @click="Status.confirm.OkCallback"> 确定 </el-button>
|
<el-button type="primary" @click="Status.confirm.OkCallback"> 确定 </el-button>
|
||||||
@ -159,9 +161,12 @@
|
|||||||
import api from '@/api/FenceManager/fence';
|
import api from '@/api/FenceManager/fence';
|
||||||
import common from '@/utils/common';
|
import common from '@/utils/common';
|
||||||
import map from '@/api/FenceManager/mapOpt';
|
import map from '@/api/FenceManager/mapOpt';
|
||||||
|
import { listService } from '@/api/system/service/api';
|
||||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||||
|
|
||||||
|
import { writeHeapSnapshot } from 'v8';
|
||||||
|
const mapApiKey = import.meta.env.VITE_AMAP_KEY;
|
||||||
|
|
||||||
var grid = ref(null);
|
var grid = ref(null);
|
||||||
|
|
||||||
//全局状态控制
|
//全局状态控制
|
||||||
@ -197,7 +202,9 @@ var cEdit = reactive({
|
|||||||
areaType: null,
|
areaType: null,
|
||||||
coordinates: [],
|
coordinates: [],
|
||||||
radius: undefined,
|
radius: undefined,
|
||||||
isActive: null
|
isActive: null,
|
||||||
|
sid: null,
|
||||||
|
gfid: null
|
||||||
});
|
});
|
||||||
|
|
||||||
//页码控件数据
|
//页码控件数据
|
||||||
@ -207,7 +214,15 @@ var pagin = reactive({
|
|||||||
|
|
||||||
//列表数据
|
//列表数据
|
||||||
var List = ref<any[]>(null);
|
var List = ref<any[]>(null);
|
||||||
|
var services = ref<any[]>(null);
|
||||||
|
//查询所有服务
|
||||||
|
function getServices() {
|
||||||
|
listService({ pageNum: 1, pageSize: 9999 }).then((res) => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
services.value = res.rows;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
//显示隐藏高级查询
|
//显示隐藏高级查询
|
||||||
function showSearch() {
|
function showSearch() {
|
||||||
if (Status.showSearch.length > 0) {
|
if (Status.showSearch.length > 0) {
|
||||||
@ -217,6 +232,7 @@ function showSearch() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
function ShowEdit(item) {
|
function ShowEdit(item) {
|
||||||
|
debugger;
|
||||||
Status.showEdit = true;
|
Status.showEdit = true;
|
||||||
if (item) {
|
if (item) {
|
||||||
let keys = Object.keys(item);
|
let keys = Object.keys(item);
|
||||||
@ -236,7 +252,10 @@ function ShowEdit(item) {
|
|||||||
cEdit.coordinates = [];
|
cEdit.coordinates = [];
|
||||||
cEdit.radius = null;
|
cEdit.radius = null;
|
||||||
cEdit.isActive = null;
|
cEdit.isActive = null;
|
||||||
|
cEdit.sid = null;
|
||||||
|
cEdit.gfid = null;
|
||||||
}
|
}
|
||||||
|
getServices();
|
||||||
map.clearOverLays();
|
map.clearOverLays();
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
map
|
map
|
||||||
@ -267,7 +286,9 @@ function CloseEdit() {
|
|||||||
areaType: null,
|
areaType: null,
|
||||||
coordinates: [],
|
coordinates: [],
|
||||||
radius: null,
|
radius: null,
|
||||||
isActive: null
|
isActive: null,
|
||||||
|
sid: null,
|
||||||
|
gfid: null
|
||||||
};
|
};
|
||||||
let keys = Object.keys(defCfg);
|
let keys = Object.keys(defCfg);
|
||||||
keys.forEach((key) => {
|
keys.forEach((key) => {
|
||||||
@ -378,29 +399,247 @@ function AddPoint(point, i) {
|
|||||||
refreshOverLayer();
|
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() {
|
function SaveFormData() {
|
||||||
if (cEdit.areaType == 0 && cEdit.coordinates.length < 3) {
|
debugger;
|
||||||
alert('多边形的围栏至少需要3个点');
|
let err = [];
|
||||||
return;
|
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) {
|
if (err.length) {
|
||||||
alert('圆形的围栏至少需要1个点');
|
alert(err.join('<br/>'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let promise = Promise.resolve({ code: 200, msg: '操作成功' });
|
let promise = Promise.resolve({ code: 200, msg: '操作成功' });
|
||||||
Status.fullLoading = true;
|
Status.fullLoading = true;
|
||||||
let json = Object.assign({}, cEdit);
|
let json = Object.assign({}, cEdit);
|
||||||
json.coordinates = JSON.stringify(json.coordinates);
|
json.coordinates = JSON.stringify(json.coordinates);
|
||||||
if (cEdit.id !== null) {
|
|
||||||
//编辑
|
promise = updateGeoFence()
|
||||||
promise = api.updateFence(json);
|
.then((res) => {
|
||||||
} else {
|
if (res.errcode === 10000) {
|
||||||
//新增
|
if (cEdit.id !== null) {
|
||||||
promise = api.AddFence(json);
|
//编辑
|
||||||
}
|
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
|
promise
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
@ -416,6 +655,7 @@ function SaveFormData() {
|
|||||||
}
|
}
|
||||||
//删除围栏
|
//删除围栏
|
||||||
function DropFence(item) {
|
function DropFence(item) {
|
||||||
|
debugger;
|
||||||
let arr = [];
|
let arr = [];
|
||||||
if (item) {
|
if (item) {
|
||||||
arr = [item];
|
arr = [item];
|
||||||
@ -427,28 +667,56 @@ function DropFence(item) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let execDelete=()=>{
|
let execDelete = () => {
|
||||||
|
debugger;
|
||||||
|
|
||||||
arr = arr
|
//先从高德删除围栏,再从后台删除
|
||||||
.map((v) => {
|
dropGeoFence(arr).then((res) => {
|
||||||
return v.id;
|
debugger;
|
||||||
})
|
if (res.errcode === 10000) {
|
||||||
.join(',');
|
let dropIds = res.data;
|
||||||
api.DelFence(arr).then((res) => {
|
if (!dropIds) {
|
||||||
if (res.code == 200) {
|
alert('从高德地图删除围栏失败');
|
||||||
handleQuery();
|
return;
|
||||||
|
}
|
||||||
|
let ids = [];
|
||||||
|
|
||||||
|
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() {
|
function getList() {
|
||||||
|
|||||||
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>
|
||||||
Reference in New Issue
Block a user