main #25
@ -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://192.168.2.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 = '/'
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
VITE_APP_TITLE = 云平台管理系统
|
VITE_APP_TITLE = 云平台管理系统
|
||||||
|
|
||||||
# 生产环境配置 晶全1
|
# 生产环境配置 晶全1
|
||||||
VITE_APP_ENV = 'https://fuyuanshen.com/backend'
|
VITE_APP_ENV = 'https://www.cnxhyc.com'
|
||||||
|
|
||||||
# 生产环境配置 富源晟2
|
# 生产环境配置 富源晟2
|
||||||
# VITE_APP_ENV = 'https://fuyuanshen.com/backend-fys'
|
# VITE_APP_ENV = 'https://fuyuanshen.com/backend-fys'
|
||||||
@ -19,8 +19,8 @@ VITE_APP_MONITOR_ADMIN = '/admin/applications'
|
|||||||
# SnailJob 控制台地址
|
# SnailJob 控制台地址
|
||||||
VITE_APP_SNAILJOB_ADMIN = '/snail-job'
|
VITE_APP_SNAILJOB_ADMIN = '/snail-job'
|
||||||
|
|
||||||
# 生产环境 晶全3
|
# 生产环境 晶全3 代理访问
|
||||||
VITE_APP_BASE_API = '/backend'
|
VITE_APP_BASE_API = '/jq'
|
||||||
|
|
||||||
# 生产环境 富源晟3
|
# 生产环境 富源晟3
|
||||||
#VITE_APP_BASE_API = '/backend-fys'
|
#VITE_APP_BASE_API = '/backend-fys'
|
||||||
|
|||||||
@ -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{
|
export default{
|
||||||
updateFence:updateFence,
|
updateFence:updateFence,
|
||||||
AddFence:AddFence,
|
AddFence:AddFence,
|
||||||
@ -71,7 +99,10 @@ export default{
|
|||||||
check:check,
|
check:check,
|
||||||
geoFenceById:geoFenceById,
|
geoFenceById:geoFenceById,
|
||||||
getList:getList,
|
getList:getList,
|
||||||
DelFence:DelFence
|
DelFence:DelFence,
|
||||||
|
addTerminal:addTerminal,
|
||||||
|
delTerminal:delTerminal,
|
||||||
|
pageTerminal:pageTerminal
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
var map = null;
|
var map = null;
|
||||||
var circle = null;
|
var circle = null;
|
||||||
var polygon = null;
|
var polygon = null;
|
||||||
|
import mapLocation from '@/assets/images/mapLocation.png';
|
||||||
|
|
||||||
function initMap() {
|
function initMap() {
|
||||||
// let key = '90bc158992feb8ccd0145e168cab1307';
|
// let key = '90bc158992feb8ccd0145e168cab1307';
|
||||||
@ -9,12 +9,18 @@ function initMap() {
|
|||||||
map = new AMap.Map("map", {
|
map = new AMap.Map("map", {
|
||||||
viewMode: '2D', //默认使用 2D 模式
|
viewMode: '2D', //默认使用 2D 模式
|
||||||
zoom: 11, //地图级别
|
zoom: 11, //地图级别
|
||||||
|
dragEnable: true, // 强制开启拖拽
|
||||||
|
zoomEnable: true, // 开启滚轮缩放(辅助验证)
|
||||||
center: [114.420739, 30.487514], //地图中心点
|
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) => {
|
return new Promise((resolve, reject) => {
|
||||||
if(map){
|
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 center = point ? new AMap.LngLat(point.lng, point.lat) : map.getCenter();
|
||||||
|
|
||||||
let marker = new AMap.Text({
|
let marker = new AMap.Text({
|
||||||
icon: "http://wdxm.ztzhtech.com:8111/Script/Home/img/welComeImg/mapLocation.png",
|
icon: mapLocation,
|
||||||
position: center,
|
position: center,
|
||||||
offset: new AMap.Pixel(-15, -24),
|
offset: new AMap.Pixel(-15, -24),
|
||||||
draggable: true,
|
draggable: true,
|
||||||
|
|||||||
@ -6,6 +6,7 @@ export interface deviceQuery extends PageQuery {
|
|||||||
deviceStatus: string;
|
deviceStatus: string;
|
||||||
bluetoothName?: string; // 蓝牙名称查询字段
|
bluetoothName?: string; // 蓝牙名称查询字段
|
||||||
onlineStatus?: string;
|
onlineStatus?: string;
|
||||||
|
bindingStatus?:string
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface deviceForm {
|
export interface deviceForm {
|
||||||
@ -38,6 +39,7 @@ export interface deviceVO {
|
|||||||
customerId?: string | number;
|
customerId?: string | number;
|
||||||
typeName?: string;
|
typeName?: string;
|
||||||
bluetoothName?: string; // 蓝牙名称字段
|
bluetoothName?: string; // 蓝牙名称字段
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface deviceTypeOption {
|
export interface deviceTypeOption {
|
||||||
|
|||||||
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -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(); // 先获取设备信息
|
||||||
|
|||||||
@ -15,23 +15,29 @@
|
|||||||
<el-form-item label="设备IMEI" prop="deviceImei">
|
<el-form-item label="设备IMEI" prop="deviceImei">
|
||||||
<el-input v-model="queryParams.deviceImei" placeholder="请输入设备IMEI" clearable />
|
<el-input v-model="queryParams.deviceImei" placeholder="请输入设备IMEI" clearable />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="设备类型" prop="deviceType">
|
<el-form-item label="设备类型" prop="deviceType" >
|
||||||
<el-select v-model="queryParams.deviceType" placeholder="设备类型">
|
<el-select v-model="queryParams.deviceType" placeholder="设备类型" clearable>
|
||||||
<el-option v-for="item in deviceTypeOptions" :key="item.value" :label="item.typeName"
|
<el-option v-for="item in deviceTypeOptions" :key="item.value" :label="item.typeName"
|
||||||
:value="item.id" />
|
:value="item.id" />
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="设备状态" prop="deviceStatus" v-hasPermi="['equipment:devices:allocate']">
|
<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="1" />
|
||||||
<el-option label="失效" value="0" />
|
<el-option label="失效" value="0" />
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="在线状态" prop="onlineStatus">
|
<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="1" />
|
||||||
<el-option label="离线" value="0" />
|
<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-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="创建时间">
|
<el-form-item label="创建时间">
|
||||||
@ -314,9 +320,9 @@
|
|||||||
<span style="color: red">{{ importResult.errorSun }}</span> 条。</span>
|
<span style="color: red">{{ importResult.errorSun }}</span> 条。</span>
|
||||||
</div>
|
</div>
|
||||||
</el-upload>
|
</el-upload>
|
||||||
<p v-if="importResult.errorSun > 0" style="padding: 10px">
|
<p v-if="importResult.errorSun > 0" style="padding: 10px">
|
||||||
<a :href="importResult.link">>>> 上传失败明细下载 <i class="el-icon-download" /></a>
|
<a :href="importResult.link">>>> 上传失败明细下载 <i class="el-icon-download" /></a>
|
||||||
</p>
|
</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>
|
||||||
@ -459,7 +465,8 @@ const initData: PageData<deviceForm, deviceQuery> = {
|
|||||||
deviceImei: '',
|
deviceImei: '',
|
||||||
deviceType: '',
|
deviceType: '',
|
||||||
deviceStatus: '',
|
deviceStatus: '',
|
||||||
onlineStatus:''
|
onlineStatus: '',
|
||||||
|
bindingStatus:''
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
deviceName: [{ required: true, message: '请输入设备名称', trigger: 'blur' }],
|
deviceName: [{ required: true, message: '请输入设备名称', trigger: 'blur' }],
|
||||||
@ -909,7 +916,7 @@ const handleBatchImport = () => {
|
|||||||
const downloadTemplate = () => {
|
const downloadTemplate = () => {
|
||||||
// 这里可用 window.open 或 a 标签下载模板
|
// 这里可用 window.open 或 a 标签下载模板
|
||||||
const link = document.createElement('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.download = '设备数据导入模板.xlsx'; // 可选:指定下载文件名
|
||||||
link.style.display = 'none'; // 隐藏标签
|
link.style.display = 'none'; // 隐藏标签
|
||||||
document.body.appendChild(link);
|
document.body.appendChild(link);
|
||||||
@ -917,11 +924,11 @@ const downloadTemplate = () => {
|
|||||||
document.body.removeChild(link); // 移除标签
|
document.body.removeChild(link); // 移除标签
|
||||||
};
|
};
|
||||||
const beforeImportUpload = (file: any) => {
|
const beforeImportUpload = (file: any) => {
|
||||||
const isLt5M = file.size / 1024 / 1024 < 5;
|
// const isLt5M = file.size / 1024 / 1024 < 5;
|
||||||
if (!isLt5M) {
|
// if (!isLt5M) {
|
||||||
proxy?.$modal.msgError('上传文件大小不能超过 5MB!');
|
// proxy?.$modal.msgError('上传文件大小不能超过 5MB!');
|
||||||
}
|
// }
|
||||||
return isLt5M;
|
// return isLt5M;
|
||||||
};
|
};
|
||||||
|
|
||||||
//添加tokenf方法head_upload 直接返回 getBearerToken()
|
//添加tokenf方法head_upload 直接返回 getBearerToken()
|
||||||
@ -930,10 +937,8 @@ const handleImportSuccess = (response: any) => {
|
|||||||
if (response.code == 200) {
|
if (response.code == 200) {
|
||||||
console.log('导入成功了么');
|
console.log('导入成功了么');
|
||||||
importResult.value.isShow = true;
|
importResult.value.isShow = true;
|
||||||
|
|
||||||
if (response.data) {
|
if (response.data) {
|
||||||
console.log(response.data, 'response.data');
|
console.log(response.data, 'response.data');
|
||||||
|
|
||||||
importResult.value.succeed = response.data.successCount;
|
importResult.value.succeed = response.data.successCount;
|
||||||
importResult.value.errorSun = response.data.failureCount;
|
importResult.value.errorSun = response.data.failureCount;
|
||||||
importResult.value.total = importResult.value.succeed + importResult.value.errorSun;
|
importResult.value.total = importResult.value.succeed + importResult.value.errorSun;
|
||||||
@ -944,6 +949,9 @@ const handleImportSuccess = (response: any) => {
|
|||||||
}
|
}
|
||||||
getList(); // 初始化列表数据
|
getList(); // 初始化列表数据
|
||||||
} else {
|
} else {
|
||||||
|
if (importUpload.value) {
|
||||||
|
importUpload.value.clearFiles();
|
||||||
|
}
|
||||||
proxy?.$modal.msgError(response.msg);
|
proxy?.$modal.msgError(response.msg);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -967,15 +975,13 @@ const handleBatchAssignConfirm = () => {
|
|||||||
customerId: batchAssignCustomerId.value, // 目标客户ID
|
customerId: batchAssignCustomerId.value, // 目标客户ID
|
||||||
deviceIds: selectedIds // 选中的设备ID数组
|
deviceIds: selectedIds // 选中的设备ID数组
|
||||||
};
|
};
|
||||||
api
|
api.deviceAssignCustomer(data).then((res) => {
|
||||||
.deviceAssignCustomer(data)
|
if (res.code == 200) {
|
||||||
.then((res) => {
|
batchAssignDialogVisible.value = false;
|
||||||
if (res.code == 200) {
|
getList();
|
||||||
batchAssignDialogVisible.value = false;
|
return proxy?.$modal.msgSuccess(`分配成功`);
|
||||||
getList();
|
}
|
||||||
return proxy?.$modal.msgSuccess(`分配成功`);
|
})
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch(() => { });
|
.catch(() => { });
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="content" v-loading="Status.fullLoading">
|
<div class="content" v-loading="Status.fullLoading">
|
||||||
<div class="main">
|
<div class="main">
|
||||||
<div class="TopTool">
|
<div class ="TopTool">
|
||||||
<div class="button-row">
|
<div class="button-row">
|
||||||
<el-button type="primary" icon="Plus" @click.stop="ShowEdit(null, true, formRef)">新增维修</el-button>
|
<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>
|
<el-button type="primary" plain icon="Download" @click.stop="ExportRecord()">导出</el-button>
|
||||||
@ -9,14 +9,8 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="rightSearch">
|
<div class="rightSearch">
|
||||||
<el-input
|
<el-input :suffix-icon="'Search'" clearable v-model="advanceSearch.searchValue" class="responsive-input"
|
||||||
:suffix-icon="'Search'"
|
placeholder="名称" @input="txtSearch">
|
||||||
clearable
|
|
||||||
v-model="advanceSearch.searchValue"
|
|
||||||
class="responsive-input"
|
|
||||||
placeholder="名称"
|
|
||||||
@input="txtSearch"
|
|
||||||
>
|
|
||||||
</el-input>
|
</el-input>
|
||||||
|
|
||||||
<el-button style="margin-left: 10px" type="primary" @click.stop="ToggleAdvance()">高级筛选</el-button>
|
<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-input v-model="advanceSearch.repairReason" placeholder="请输入" clearable />
|
||||||
</el-form-item> -->
|
</el-form-item> -->
|
||||||
<el-form-item label="维修时间">
|
<el-form-item label="维修时间">
|
||||||
<el-date-picker
|
<el-date-picker v-model="advanceSearch.Date" type="daterange" format="YYYY-MM-DD" style="width: 240px"
|
||||||
v-model="advanceSearch.Date"
|
value-format="YYYY-MM-DD" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"
|
||||||
type="daterange"
|
:size="'default'" />
|
||||||
format="YYYY-MM-DD"
|
|
||||||
style="width: 240px"
|
|
||||||
value-format="YYYY-MM-DD"
|
|
||||||
range-separator="-"
|
|
||||||
start-placeholder="开始日期"
|
|
||||||
end-placeholder="结束日期"
|
|
||||||
:size="'default'"
|
|
||||||
/>
|
|
||||||
<div>
|
<div>
|
||||||
<el-button style="margin-left: 5px" type="primary" @click.stop="Search()">查询</el-button>
|
<el-button style="margin-left: 5px" type="primary" @click.stop="Search()">查询</el-button>
|
||||||
<el-button type="primary" @click.stop="Reset()">重置</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="repairReason" />
|
||||||
<el-table-column label="维修人员" align="center" prop="repairPerson" />
|
<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">
|
<template #default="scope">
|
||||||
<div class="center">
|
<div class="center">
|
||||||
<el-text class="mx-1" type="primary" @click.stop="ShowEdit(scope.row, true, formRef)">编辑</el-text>
|
<el-text class="mx-1" type="primary" @click.stop="ShowEdit(scope.row, true, formRef)">编辑</el-text>
|
||||||
@ -81,47 +68,29 @@
|
|||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
<pagination
|
<pagination v-show="pagin.total > 0" v-model:page="advanceSearch.pageNum" v-model:limit="advanceSearch.pageSize"
|
||||||
v-show="pagin.total > 0"
|
:total="pagin.total" @pagination="getRecordList" />
|
||||||
v-model:page="advanceSearch.pageNum"
|
|
||||||
v-model:limit="advanceSearch.pageSize"
|
|
||||||
:total="pagin.total"
|
|
||||||
@pagination="getRecordList"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 新增、编辑弹出层 -->
|
<!-- 新增、编辑弹出层 -->
|
||||||
<el-dialog
|
<el-dialog class="editPop" v-model="Status.ShowEditPop" :data-val="Status.ShowEditPop"
|
||||||
class="editPop"
|
:title="!cEdit.isEdit ? '维修详情' : cEdit.recordId ? '编辑维修' : '新增维修'" width="800" :draggable="true">
|
||||||
v-model="Status.ShowEditPop"
|
|
||||||
:data-val="Status.ShowEditPop"
|
|
||||||
:title="!cEdit.isEdit ? '维修详情' : cEdit.recordId ? '编辑维修' : '新增维修'"
|
|
||||||
width="800"
|
|
||||||
:draggable="true"
|
|
||||||
>
|
|
||||||
<div class="form">
|
<div class="form">
|
||||||
<el-form :model="cEdit" ref="formRef" style="max-width: 750px" :rules="rules">
|
<el-form :model="cEdit" ref="formRef" style="max-width: 750px" :rules="rules">
|
||||||
<el-form-item label="设备名称" label-position="right" prop="deviceId">
|
<el-form-item label="设备名称" label-position="right" prop="deviceId">
|
||||||
<!-- <el-input v-model="selectedRow['deviceName']" :readonly="true" @click.stop="ShowDevice('Edit', true)" placeholder="请选择设备" /> -->
|
<!-- <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-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-option v-for="item in deviceDist" :key="item.deviceId" :label="item.deviceName"
|
||||||
/></el-select>
|
:value="item.deviceId" /></el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="维修人员" label-position="right" prop="repairPerson">
|
<el-form-item label="维修人员" label-position="right" prop="repairPerson">
|
||||||
<el-input v-model="cEdit.repairPerson" :readonly="!cEdit.isEdit" placeholder="请输入姓名" />
|
<el-input v-model="cEdit.repairPerson" :readonly="!cEdit.isEdit" placeholder="请输入姓名" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="维修时间" label-position="right" prop="repairTime">
|
<el-form-item label="维修时间" label-position="right" prop="repairTime">
|
||||||
<el-date-picker
|
<el-date-picker v-model="cEdit.repairTime" :readonly="!cEdit.isEdit" type="datetime" placeholder="请选择时间"
|
||||||
v-model="cEdit.repairTime"
|
format="YYYY-MM-DD HH:mm:ss" value-format="YYYY-MM-DD HH:mm:ss" style="width: 100%" />
|
||||||
: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>
|
||||||
<el-form-item label="维修部位" label-position="right" prop="repairPart">
|
<el-form-item label="维修部位" label-position="right" prop="repairPart">
|
||||||
<el-input v-model="cEdit.repairPart" :readonly="!cEdit.isEdit" placeholder="请输入维修部位" />
|
<el-input v-model="cEdit.repairPart" :readonly="!cEdit.isEdit" placeholder="请输入维修部位" />
|
||||||
@ -131,19 +100,10 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="损坏照片" label-position="right">
|
<el-form-item label="损坏照片" label-position="right">
|
||||||
<el-upload
|
<el-upload :disabled="!cEdit.isEdit" ref="beforeUploadRef" class="upload-demo" action=""
|
||||||
:disabled="!cEdit.isEdit"
|
:auto-upload="false" :on-change="handleFileChange1" :file-list="beforeFiles"
|
||||||
ref="beforeUploadRef"
|
accept=".jpg,.jpeg,.png,.gif.webp" :limit="9" list-type="picture-card"
|
||||||
class="upload-demo"
|
:class="{ 'hide-add-btn': !cEdit.isEdit }">
|
||||||
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>
|
<el-icon>
|
||||||
<Plus />
|
<Plus />
|
||||||
</el-icon>
|
</el-icon>
|
||||||
@ -168,19 +128,9 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="修复照片" label-position="right">
|
<el-form-item label="修复照片" label-position="right">
|
||||||
<el-upload
|
<el-upload :disabled="!cEdit.isEdit" ref="afterUploadRef" class="upload-demo" action="" :auto-upload="false"
|
||||||
:disabled="!cEdit.isEdit"
|
:on-change="handleFileChange2" :file-list="afterFiles" accept=".jpg,.jpeg,.png,.gif.webp" :limit="9"
|
||||||
ref="afterUploadRef"
|
list-type="picture-card" :class="{ 'hide-add-btn': !cEdit.isEdit }">
|
||||||
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>
|
<el-icon>
|
||||||
<Plus />
|
<Plus />
|
||||||
</el-icon>
|
</el-icon>
|
||||||
@ -321,7 +271,8 @@
|
|||||||
</el-dialog> -->
|
</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>
|
<span>
|
||||||
{{ Status.confirm.text }}
|
{{ Status.confirm.text }}
|
||||||
</span>
|
</span>
|
||||||
@ -509,18 +460,21 @@ function ToggleAdvance() {
|
|||||||
|
|
||||||
//显示编辑
|
//显示编辑
|
||||||
function ShowEdit(item = undefined, isEdit = true, formEl = undefined) {
|
function ShowEdit(item = undefined, isEdit = true, formEl = undefined) {
|
||||||
|
// 先隐藏弹窗,避免提前渲染错误状态
|
||||||
Status.ShowEditPop = true;
|
Status.ShowEditPop = true;
|
||||||
let def = {
|
let def = {
|
||||||
recordId: null, //维修记录id
|
recordId: null,
|
||||||
|
deviceId: '',
|
||||||
deviceId: '', //设备id
|
repairTime: '',
|
||||||
repairTime: '', //维修时间
|
repairPart: '',
|
||||||
repairPart: '', //维修部位
|
repairReason: '',
|
||||||
repairReason: '', //维修原因
|
repairPerson: '',
|
||||||
repairPerson: '', //维修人员,
|
|
||||||
imageIds: []
|
imageIds: []
|
||||||
};
|
};
|
||||||
|
// 先重置表单和状态,避免残留
|
||||||
|
ResetFormData();
|
||||||
|
// 先赋值 isEdit 基础状态
|
||||||
|
cEdit.isEdit = isEdit;
|
||||||
let promise1 = new Promise((resolve, reject) => {
|
let promise1 = new Promise((resolve, reject) => {
|
||||||
if (item) {
|
if (item) {
|
||||||
api
|
api
|
||||||
@ -542,60 +496,43 @@ function ShowEdit(item = undefined, isEdit = true, formEl = undefined) {
|
|||||||
|
|
||||||
promise1
|
promise1
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
debugger;
|
|
||||||
item = res;
|
item = res;
|
||||||
if (!item) {
|
if (!item) {
|
||||||
|
// 新增场景,isEdit 保持 true
|
||||||
cEdit.isEdit = isEdit;
|
cEdit.isEdit = isEdit;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let keys = Object.keys(cEdit);
|
let keys = Object.keys(cEdit);
|
||||||
keys.forEach((key, i) => {
|
keys.forEach((key, i) => {
|
||||||
if (item) {
|
if (item) {
|
||||||
//编辑
|
// 编辑/详情场景,赋值数据
|
||||||
if (item[key] !== undefined) {
|
if (item[key] !== undefined) {
|
||||||
cEdit[key] = item[key];
|
cEdit[key] = item[key];
|
||||||
} else {
|
} else {
|
||||||
cEdit[key] = def[key];
|
cEdit[key] = def[key];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//新增
|
// 新增场景
|
||||||
cEdit[key] = def[key];
|
cEdit[key] = def[key];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
debugger;
|
|
||||||
if (item.images && item.images.length) {
|
if (item.images && item.images.length) {
|
||||||
|
// 处理图片逻辑(保持原有代码)
|
||||||
beforeFiles.value = item.images
|
beforeFiles.value = item.images
|
||||||
.filter((v) => {
|
.filter((v) => v.imageType == 'BEFORE')
|
||||||
if (v.imageType == 'BEFORE') {
|
.map((v) => ({ name: v.imageId, url: v.imageUrl, id: v.imageId }));
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
})
|
|
||||||
.map((v) => {
|
|
||||||
return { name: v.imageId, url: v.imageUrl, id: v.imageId };
|
|
||||||
});
|
|
||||||
|
|
||||||
afterFiles.value = item.images
|
afterFiles.value = item.images
|
||||||
.filter((v) => {
|
.filter((v) => v.imageType == 'AFTER')
|
||||||
if (v.imageType == 'AFTER') {
|
.map((v) => ({ name: v.imageId, url: v.imageUrl, id: v.imageId }));
|
||||||
return true;
|
if (formEl) formEl.validate();
|
||||||
}
|
|
||||||
return false;
|
|
||||||
})
|
|
||||||
.map((v) => {
|
|
||||||
return { name: v.imageId, url: v.imageUrl, id: v.imageId };
|
|
||||||
});
|
|
||||||
|
|
||||||
if (!formEl) return;
|
|
||||||
|
|
||||||
formEl.validate();
|
|
||||||
}
|
}
|
||||||
if (item) {
|
if (item) {
|
||||||
selectedRow.value['deviceName'] = item.deviceName;
|
selectedRow.value['deviceName'] = item.deviceName;
|
||||||
}
|
}
|
||||||
|
// 确保 isEdit 最终赋值正确(覆盖异步过程中可能的异常)
|
||||||
cEdit.isEdit = isEdit;
|
cEdit.isEdit = isEdit;
|
||||||
|
// 所有状态赋值完成后,再显示弹窗
|
||||||
|
Status.ShowEditPop = true;
|
||||||
})
|
})
|
||||||
.finally(() => {});
|
.finally(() => {});
|
||||||
}
|
}
|
||||||
@ -611,11 +548,9 @@ function ShowDevice(type, isvalid) {
|
|||||||
if (isvalid && !cEdit.isEdit) {
|
if (isvalid && !cEdit.isEdit) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status.CheckDeviceType = type;
|
Status.CheckDeviceType = type;
|
||||||
Status.ShowCheckDevice = true;
|
Status.ShowCheckDevice = true;
|
||||||
selectedRowId.value = '';
|
selectedRowId.value = '';
|
||||||
|
|
||||||
if (total.value === 0) {
|
if (total.value === 0) {
|
||||||
handleQuery();
|
handleQuery();
|
||||||
}
|
}
|
||||||
@ -643,11 +578,8 @@ function ResetFormData() {
|
|||||||
cEdit.repairPart = ''; //维修部位
|
cEdit.repairPart = ''; //维修部位
|
||||||
cEdit.repairReason = ''; //维修原因
|
cEdit.repairReason = ''; //维修原因
|
||||||
cEdit.repairPerson = ''; //维修人员
|
cEdit.repairPerson = ''; //维修人员
|
||||||
|
|
||||||
cEdit.imageIds = [];
|
cEdit.imageIds = [];
|
||||||
|
|
||||||
selectedRow.value = { deviceName: '', deviceId: '' };
|
selectedRow.value = { deviceName: '', deviceId: '' };
|
||||||
|
|
||||||
clearUploadFiles();
|
clearUploadFiles();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -749,7 +681,7 @@ function ExportRecord() {
|
|||||||
proxy?.download('/equipment/repairRecords/export', advanceSearch, `维修记录_${new Date().getTime()}.xlsx`, 'post').finally(hideloading);
|
proxy?.download('/equipment/repairRecords/export', advanceSearch, `维修记录_${new Date().getTime()}.xlsx`, 'post').finally(hideloading);
|
||||||
}
|
}
|
||||||
|
|
||||||
function RowSelectionChange(row) {}
|
function RowSelectionChange(row) { }
|
||||||
//获取已选中的行
|
//获取已选中的行
|
||||||
var getSelectionRows = (gridInstance) => {
|
var getSelectionRows = (gridInstance) => {
|
||||||
if (gridInstance.value) {
|
if (gridInstance.value) {
|
||||||
@ -950,8 +882,9 @@ const rules = reactive<FormRules<RuleForm>>({
|
|||||||
:deep .el-form--inline .el-form-item {
|
:deep .el-form--inline .el-form-item {
|
||||||
margin-right: 15px !important;
|
margin-right: 15px !important;
|
||||||
}
|
}
|
||||||
:deep .el-dialog__body .form {
|
|
||||||
}
|
:deep .el-dialog__body .form {}
|
||||||
|
|
||||||
:deep .el-dialog__body,
|
:deep .el-dialog__body,
|
||||||
.dialog__body {
|
.dialog__body {
|
||||||
position: relative;
|
position: relative;
|
||||||
@ -1064,6 +997,7 @@ input:focus {
|
|||||||
margin-right: 10px;
|
margin-right: 10px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
:deep .el-dialog__footer,
|
:deep .el-dialog__footer,
|
||||||
.el-dialog__footer {
|
.el-dialog__footer {
|
||||||
padding-top: 0px !important;
|
padding-top: 0px !important;
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="content" v-loading="Status.fullLoading">
|
<div class="content" v-loading="Status.fullLoading">
|
||||||
<div class="percent100">
|
<div class="percent100" v-show="!Status.showEdit && !Status.showDevice">
|
||||||
<div class="topTool">
|
<div class="topTool">
|
||||||
<div class="button-row">
|
<div class="button-row">
|
||||||
<el-button type="primary" @click.stop="ShowEdit(null)"
|
<el-button type="primary" @click.stop="ShowEdit(null)"
|
||||||
@ -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">
|
||||||
@ -81,6 +80,7 @@
|
|||||||
<el-table-column label="操作" fixed="right" width="180" class-name="small-padding fixed-width">
|
<el-table-column label="操作" fixed="right" width="180" class-name="small-padding fixed-width">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-button link type="primary" @click="ShowEdit(scope.row)">编辑</el-button>
|
<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>
|
<el-button link type="danger" @click="DropFence(scope.row)">删除</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
@ -95,9 +95,17 @@
|
|||||||
</div>
|
</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>
|
<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>
|
||||||
@ -126,25 +134,135 @@
|
|||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<el-button type="primary" @click.stop="AddPoint()"
|
<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
|
<el-icon><Delete /></el-icon>清空</el-button
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
<div class="map" id="map"></div>
|
<div class="map" id="map"></div>
|
||||||
<div class="center footerBtn" style="margin-top: 20px">
|
<div class="center footerBtn" style="margin-top: 20px">
|
||||||
<el-button type="primary" @click="SaveFormData"> 确定 </el-button>
|
<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>
|
||||||
|
|
||||||
|
<!-- 终端维护的弹窗 -->
|
||||||
|
<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>
|
||||||
|
|
||||||
<!-- 提示框 -->
|
<!-- 提示框 -->
|
||||||
<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 +277,13 @@
|
|||||||
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 { getDevice } from '@/api/system/service/api';
|
||||||
|
|
||||||
|
const mapApiKey = import.meta.env.VITE_AMAP_KEY;
|
||||||
|
|
||||||
var grid = ref(null);
|
var grid = ref(null);
|
||||||
|
|
||||||
//全局状态控制
|
//全局状态控制
|
||||||
@ -179,7 +301,12 @@ var Status = reactive({
|
|||||||
isWarn: false //是否警告色
|
isWarn: false //是否警告色
|
||||||
},
|
},
|
||||||
showSearch: [], //是否显示高级查询
|
showSearch: [], //是否显示高级查询
|
||||||
showEdit: false //是否显示编辑弹窗
|
showEdit: false, //是否显示编辑弹窗
|
||||||
|
showDevice: false, //是否显示终端维护
|
||||||
|
deviceLoading: false, //终端查询的loading
|
||||||
|
|
||||||
|
showCheckDevice: false, //是否显示选择终端
|
||||||
|
showCheckDeviceLoading: false
|
||||||
});
|
});
|
||||||
//查询的条件
|
//查询的条件
|
||||||
var queryParams = reactive({
|
var queryParams = reactive({
|
||||||
@ -197,17 +324,373 @@ var cEdit = reactive({
|
|||||||
areaType: null,
|
areaType: null,
|
||||||
coordinates: [],
|
coordinates: [],
|
||||||
radius: undefined,
|
radius: undefined,
|
||||||
isActive: null
|
isActive: null,
|
||||||
|
sid: null,
|
||||||
|
gfid: null
|
||||||
|
});
|
||||||
|
var checkGf = reactive({
|
||||||
|
//当前正在操作的数据
|
||||||
|
sid: null,
|
||||||
|
gfid: null
|
||||||
});
|
});
|
||||||
|
|
||||||
//页码控件数据
|
//页码控件数据
|
||||||
var pagin = reactive({
|
var pagin = reactive({
|
||||||
total: 0
|
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 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() {
|
function showSearch() {
|
||||||
if (Status.showSearch.length > 0) {
|
if (Status.showSearch.length > 0) {
|
||||||
@ -216,6 +699,7 @@ function showSearch() {
|
|||||||
Status.showSearch = ['1'];
|
Status.showSearch = ['1'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function ShowEdit(item) {
|
function ShowEdit(item) {
|
||||||
Status.showEdit = true;
|
Status.showEdit = true;
|
||||||
if (item) {
|
if (item) {
|
||||||
@ -236,7 +720,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
|
||||||
@ -258,6 +745,7 @@ function ShowEdit(item) {
|
|||||||
});
|
});
|
||||||
}, 500);
|
}, 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
function CloseEdit() {
|
function CloseEdit() {
|
||||||
Status.showEdit = false;
|
Status.showEdit = false;
|
||||||
let defCfg = {
|
let defCfg = {
|
||||||
@ -267,7 +755,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 +868,240 @@ 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) {
|
let err = [];
|
||||||
alert('多边形的围栏至少需要3个点');
|
if (!cEdit.sid) {
|
||||||
return;
|
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) => {
|
||||||
@ -427,28 +1128,53 @@ function DropFence(item) {
|
|||||||
return;
|
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
|
arr.filter((v) => {
|
||||||
.map((v) => {
|
if (!v.gfid || !v.sid) {
|
||||||
return v.id;
|
ids.push(v.id);
|
||||||
})
|
return true;
|
||||||
.join(',');
|
}
|
||||||
api.DelFence(arr).then((res) => {
|
if (dropIds) {
|
||||||
if (res.code == 200) {
|
let f = dropIds.find((gfid) => {
|
||||||
handleQuery();
|
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() {
|
||||||
@ -609,9 +1335,9 @@ onMounted(() => {
|
|||||||
|
|
||||||
.map {
|
.map {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: calc(58vh - 50px);
|
height: calc(100% - 200px);
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
border: 1px solid #7371719e;
|
border: 1px solid #ccc;
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
}
|
}
|
||||||
@ -651,4 +1377,32 @@ onMounted(() => {
|
|||||||
// width: 100%;
|
// width: 100%;
|
||||||
// left: 0px;
|
// 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>
|
</style>
|
||||||
|
|||||||
@ -10,7 +10,8 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="treeContent">
|
<div class="treeContent">
|
||||||
<el-tree :default-expand-all="true" :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 }">
|
<template #default="{ node, data }">
|
||||||
<div class="custom-tree-node">
|
<div class="custom-tree-node">
|
||||||
<span :class="data.parentId != null ? '' : 'treeBold'">{{ node.label }}</span>
|
<span :class="data.parentId != null ? '' : 'treeBold'">{{ node.label }}</span>
|
||||||
@ -60,7 +61,7 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<div class="btnSearch" @click="getDeviceList()">查询</div>
|
<div class="btnSearch" @click="getDeviceList">查询</div>
|
||||||
<div class="btnReset" @click="ResetQuery()">重置</div>
|
<div class="btnReset" @click="ResetQuery()">重置</div>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
@ -76,14 +77,8 @@
|
|||||||
<el-button type="danger" plain @click="groupDelDevice()">删除</el-button>
|
<el-button type="danger" plain @click="groupDelDevice()">删除</el-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<el-table
|
<el-table ref="grid" height="calc(100vh - 320px)" v-loading="Status.loading" border :data="deviceList"
|
||||||
ref="grid"
|
@selection-change="RowSelectionChange">
|
||||||
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 type="selection" width="50" align="center" />
|
||||||
<el-table-column label="设备名称" align="center" prop="deviceName" />
|
<el-table-column label="设备名称" align="center" prop="deviceName" />
|
||||||
|
|
||||||
@ -91,11 +86,9 @@
|
|||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-popover placement="right" trigger="click">
|
<el-popover placement="right" trigger="click">
|
||||||
<template #reference>
|
<template #reference>
|
||||||
<img
|
<img :src="scope.row.devicePic"
|
||||||
:src="scope.row.devicePic"
|
|
||||||
style="width: 40px; height: 40px; cursor: pointer; object-fit: contain"
|
style="width: 40px; height: 40px; cursor: pointer; object-fit: contain"
|
||||||
class="hover:opacity-80 transition-opacity"
|
class="hover:opacity-80 transition-opacity" />
|
||||||
/>
|
|
||||||
</template>
|
</template>
|
||||||
<img :src="scope.row.devicePic" style="max-width: 600px; max-height: 600px; object-fit: contain" />
|
<img :src="scope.row.devicePic" style="max-width: 600px; max-height: 600px; object-fit: contain" />
|
||||||
</el-popover>
|
</el-popover>
|
||||||
@ -120,13 +113,8 @@
|
|||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
<pagination
|
<pagination v-show="pagin.total > 0" v-model:page="GjSearchForm.pageNum" v-model:limit="GjSearchForm.pageSize"
|
||||||
v-show="pagin.total > 0"
|
:total="pagin.total" @pagination="getDeviceList" />
|
||||||
v-model:page="GjSearchForm.pageNum"
|
|
||||||
v-model:limit="GjSearchForm.pageSize"
|
|
||||||
:total="pagin.total"
|
|
||||||
@pagination="getDeviceList"
|
|
||||||
/>
|
|
||||||
</el-card>
|
</el-card>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -134,7 +122,8 @@
|
|||||||
<div class="clear"></div>
|
<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>
|
<span>
|
||||||
{{ Status.confirm.text }}
|
{{ Status.confirm.text }}
|
||||||
</span>
|
</span>
|
||||||
@ -148,7 +137,7 @@
|
|||||||
|
|
||||||
<!-- 选择分组的弹窗 -->
|
<!-- 选择分组的弹窗 -->
|
||||||
<el-dialog v-model="Status.dialogGroupVisible" title="选择分组" width="500" :draggable="true">
|
<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 }">
|
<template #default="{ node, data }">
|
||||||
<div class="custom-tree-node" @click.stop="CheckGroup(data)">
|
<div class="custom-tree-node" @click.stop="CheckGroup(data)">
|
||||||
<span :class="data.parentId != null ? '' : 'treeBold'">{{ node.label }}</span>
|
<span :class="data.parentId != null ? '' : 'treeBold'">{{ node.label }}</span>
|
||||||
@ -156,12 +145,16 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-tree>
|
</el-tree>
|
||||||
<el-button type="primary" @click="OkCheckGroup()"> 确定 </el-button>
|
<div style="text-align: right;">
|
||||||
<el-button type="primary" @click="CancelCheckGroup()"> 取消 </el-button>
|
|
||||||
|
<el-button @click="CancelCheckGroup()"> 取消 </el-button>
|
||||||
|
<el-button type="primary" @click="OkCheckGroup()"> 确定 </el-button>
|
||||||
|
</div>
|
||||||
|
|
||||||
</el-dialog>
|
</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" />
|
<el-transfer :titles="['所有设备', '已选择设备']" v-model="transfer.value" :data="transfer.data" :filterable="true" />
|
||||||
|
|
||||||
<div class="center" style="margin-top: 10px">
|
<div class="center" style="margin-top: 10px">
|
||||||
@ -171,13 +164,8 @@
|
|||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
<!-- 添加节点的弹出框 -->
|
<!-- 添加节点的弹出框 -->
|
||||||
<el-dialog
|
<el-dialog :width="350" :draggable="true" v-model="Status.dialogEditNode"
|
||||||
:width="350"
|
:title="cEdit.id ? '修改分组' : cEdit.pNode ? '新增子节点' : '新增根节点'" center>
|
||||||
:draggable="true"
|
|
||||||
v-model="Status.dialogEditNode"
|
|
||||||
:title="cEdit.id ? '修改分组' : cEdit.pNode ? '新增子节点' : '新增根节点'"
|
|
||||||
center
|
|
||||||
>
|
|
||||||
<div>
|
<div>
|
||||||
<el-form class="demo-form-inline" :inline="true" :model="cEdit" label-width="auto" style="width: 100%">
|
<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>
|
<el-form-item label="分组名称"> <el-input v-model="cEdit.groupName" placeholder="请输入" /> </el-form-item>
|
||||||
@ -324,38 +312,40 @@ var hideloading = closeLoading;
|
|||||||
function ResetQuery() {
|
function ResetQuery() {
|
||||||
GjSearchForm.deviceType = '';
|
GjSearchForm.deviceType = '';
|
||||||
GjSearchForm.netMode = '';
|
GjSearchForm.netMode = '';
|
||||||
|
getDeviceList()
|
||||||
|
|
||||||
}
|
}
|
||||||
//查询某个节点的设备
|
//查询某个节点的设备
|
||||||
var getDeviceList = () => {
|
const getDeviceList = () => {
|
||||||
if (!checkNode.val) {
|
// 无论是否有 checkNode.val,都返回 Promise
|
||||||
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();
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
api
|
if (!checkNode.val && checkNode.val !== '') { // 排除全部设备的空字符串
|
||||||
.getNodeDevice(para)
|
pagin.total = 0;
|
||||||
.then((res) => {
|
deviceList.value = [];
|
||||||
deviceList.value = res.rows;
|
hideloading(); // 确保 loading 关闭
|
||||||
pagin.total = res.total;
|
resolve();
|
||||||
})
|
return;
|
||||||
.catch((ex) => {
|
}
|
||||||
console.log('出现了异常', ex);
|
showloading();
|
||||||
})
|
let para = {
|
||||||
.finally(() => {
|
nodeCode: checkNode.val || '', // 空ID对应全部设备
|
||||||
hideloading();
|
pageIndex: GjSearchForm.pageNum,
|
||||||
resolve();
|
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;
|
||||||
|
resolve();
|
||||||
|
}).catch((ex) => {
|
||||||
|
console.log('出现了异常', ex);
|
||||||
|
reject(ex); // 抛出错误
|
||||||
|
}).finally(() => {
|
||||||
|
hideloading();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
//树控件节点点击事件
|
//树控件节点点击事件
|
||||||
@ -368,16 +358,26 @@ var handleNodeClick = (node) => {
|
|||||||
getDeviceList();
|
getDeviceList();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const ALL_DEVICE_NODE = {
|
||||||
|
id: '',
|
||||||
|
groupName: '全部设备',
|
||||||
|
parentId: null,
|
||||||
|
children: [],
|
||||||
|
isAll: true
|
||||||
|
};
|
||||||
//树控件筛选后显示的数据源
|
//树控件筛选后显示的数据源
|
||||||
var treeData = computed(() => {
|
var treeData = computed(() => {
|
||||||
let arr = api.treeNodeSearch(treeDataOrin.value, searchTxt.value, 'groupName', 'children');
|
let arr = api.treeNodeSearch(treeDataOrin.value, searchTxt.value, 'groupName', 'children');
|
||||||
if (arr.length && !checkNode.val) {
|
let newArr = [JSON.parse(JSON.stringify(ALL_DEVICE_NODE))];
|
||||||
checkNode.val = arr[0].id;
|
if (arr.length) {
|
||||||
getDeviceList().finally(() => {
|
newArr = newArr.concat(arr);
|
||||||
checkNode.val = '';
|
}
|
||||||
|
if (newArr.length && !checkNode.val) {
|
||||||
|
checkNode.val = newArr[0].id; // 空ID
|
||||||
|
Promise.resolve(getDeviceList()).finally(() => {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return arr;
|
return newArr;
|
||||||
});
|
});
|
||||||
|
|
||||||
//显示/隐藏高级筛选
|
//显示/隐藏高级筛选
|
||||||
@ -565,6 +565,7 @@ var getSelectionRows = () => {
|
|||||||
|
|
||||||
var RefreshTree = function () {
|
var RefreshTree = function () {
|
||||||
api.getTreeData(searchTxt.value).then((res) => {
|
api.getTreeData(searchTxt.value).then((res) => {
|
||||||
|
console.log(res, 'reddddd');
|
||||||
treeDataOrin.value = res;
|
treeDataOrin.value = res;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@ -636,9 +637,8 @@ var showDevice = () => {
|
|||||||
let arr = res1.rows.map((item) => ({
|
let arr = res1.rows.map((item) => ({
|
||||||
key: item.deviceId,
|
key: item.deviceId,
|
||||||
label: item.deviceName //,
|
label: item.deviceName //,
|
||||||
// disabled: item.groupId && item.groupId == checkNode.val ? false : item.groupId ? true : false
|
|
||||||
}));
|
}));
|
||||||
|
;
|
||||||
transfer.data = arr;
|
transfer.data = arr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
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>
|
||||||
@ -1,6 +1,83 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>敬请期待</div>
|
<el-form :model="user" label-width="80px">
|
||||||
|
<div v-for="item in user">
|
||||||
|
<el-form-item :label="item.dictLabel" prop="dictLabel">
|
||||||
|
<el-input v-model="item.dictLabel" disabled />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="版本号" prop="dictValue">
|
||||||
|
<el-input v-model="item.dictValue" placeholder="请输入版本号" clearable />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="下载地址" prop="remark">
|
||||||
|
<el-input v-model="item.remark" placeholder="请输入wgt下载地址" clearable />
|
||||||
|
</el-form-item>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" @click="submit">保存</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import request from '@/utils/request';
|
||||||
|
const user = ref([
|
||||||
|
{
|
||||||
|
'dictValue': '',
|
||||||
|
'dictLabel': 'ios',
|
||||||
|
'remark': ''
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'dictValue': '',
|
||||||
|
'dictLabel': 'android',
|
||||||
|
'remark': ''
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
|
||||||
|
function getCfg() {
|
||||||
|
request({
|
||||||
|
url: '/app/auth/version',
|
||||||
|
method: 'get'
|
||||||
|
}).then((res) => {
|
||||||
|
if (res && res.code === 200) {
|
||||||
|
user.value.forEach((v) => {
|
||||||
|
let f = res.data.find((item) => {
|
||||||
|
return item.dictLabel === v.dictLabel;
|
||||||
|
});
|
||||||
|
if (f) {
|
||||||
|
v.dictValue = f.dictValue;
|
||||||
|
v.remark = f.remark;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function submit() {
|
||||||
|
let flag = [];
|
||||||
|
user.value.forEach((v) => {
|
||||||
|
let keys = Object.keys(v);
|
||||||
|
keys.forEach((k) => {
|
||||||
|
if (!v[k]) {
|
||||||
|
flag.push(false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
if (flag.length > 0) {
|
||||||
|
ElMessageBox.alert('所有项都是必填');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
request({
|
||||||
|
url: '/api/xinghan/device/UpVersion',
|
||||||
|
method: 'post',
|
||||||
|
data: user.value
|
||||||
|
}).then((res) => {
|
||||||
|
if (res && res.code === 200) {
|
||||||
|
ElMessageBox.alert('操作成功');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
getCfg();
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -61,7 +61,9 @@
|
|||||||
<el-tab-pane label="在线设备" name="onlineDevice">
|
<el-tab-pane label="在线设备" name="onlineDevice">
|
||||||
<onlineDevice :devices="state.devices" />
|
<onlineDevice :devices="state.devices" />
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
|
<el-tab-pane label="" name="appVer" style="visibility: hidden;" >
|
||||||
|
<appVer />
|
||||||
|
</el-tab-pane>
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
</el-card>
|
</el-card>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
|||||||
Reference in New Issue
Block a user