This commit is contained in:
邱贞招 2024-06-17 09:55:17 +08:00
parent 0802a32395
commit 52ccdb39d7
7 changed files with 172 additions and 39 deletions

View File

@ -50,3 +50,27 @@ export function allDevice() {
method: 'get' method: 'get'
}) })
} }
// 开锁
export function handleUnlocking(data){
return request({
url: '/appVerify/admin/unlocking?sn='+data.sn,
method: 'post'
})
}
// 关锁
export function handleLock(data){
return request({
url: '/appVerify/admin/lock?sn='+data.sn,
method: 'post'
})
}
// 响铃寻车
export function ring(data){
return request({
url: '/app/device/ring?sn='+data.sn,
method: 'post'
})
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 137 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 79 KiB

After

Width:  |  Height:  |  Size: 83 KiB

View File

@ -56,7 +56,7 @@ export default {
status:true, status:true,
}; };
}, },
props: ["pathList", "dataId"], props: ["pathList", "dataId","lon","lat"],
mounted() { mounted() {
if (this.dataId) { if (this.dataId) {
this.start(); this.start();
@ -112,6 +112,8 @@ export default {
async echart() { async echart() {
clearInterval(this.timer); clearInterval(this.timer);
console.log("接收参数", this.pathList); console.log("接收参数", this.pathList);
console.log("接收参数", this.lon);
console.log("接收参数", this.lat);
// console.log(typeof JSON.parse(this.pathList)); // console.log(typeof JSON.parse(this.pathList));
await AMapLoader.load({ await AMapLoader.load({
key: globalConfig.aMap.key, // WebKey load key: globalConfig.aMap.key, // WebKey load
@ -126,8 +128,8 @@ export default {
this.map = new AMap.Map("container", { this.map = new AMap.Map("container", {
//id //id
viewMode: "3D", //3D viewMode: "3D", //3D
zoom: 18, // zoom: 13, //
center: [120.356031, 26.94088], //-- center: [this.lon,this.lat], //--
}); });
this.map.setFitView(); this.map.setFitView();
}) })
@ -220,7 +222,7 @@ export default {
} }
.input-card-left { .input-card-left {
position: absolute; position: absolute;
bottom: 20px; top: -40px;
left: 20px; left: 20px;
font-size: 13px; font-size: 13px;
line-height: 20px; line-height: 20px;

View File

@ -96,21 +96,21 @@
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> <el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="电子围栏" prop="boundaryStr"> <el-form-item label="电子围栏" prop="boundaryStr">
<area-map :key="key" v-model="form.boundaryStr" :dataId="form.areaId" :pathList="form.boundaryStr" <area-map :key="key" v-model="form.boundaryStr" :dataId="form.areaId" :pathList="form.boundaryStr" :lon="form.longitude" :lat="form.latitude"
@center="center" @mapList="mapList" /> @center="center" @mapList="mapList" />
</el-form-item> </el-form-item>
<el-row> <!-- <el-row>-->
<el-col :span="12"> <!-- <el-col :span="12">-->
<el-form-item label="经度" prop="longitude"> <!-- <el-form-item label="经度" prop="longitude">-->
<el-input v-model="form.longitude" placeholder="请输入经度" disabled /> <!-- <el-input v-model="form.longitude" placeholder="请输入经度" disabled />-->
</el-form-item> <!-- </el-form-item>-->
</el-col> <!-- </el-col>-->
<el-col :span="12"> <!-- <el-col :span="12">-->
<el-form-item label="纬度" prop="latitude"> <!-- <el-form-item label="纬度" prop="latitude">-->
<el-input v-model="form.latitude" placeholder="请输入纬度" disabled /> <!-- <el-input v-model="form.latitude" placeholder="请输入纬度" disabled />-->
</el-form-item> <!-- </el-form-item>-->
</el-col> <!-- </el-col>-->
</el-row> <!-- </el-row>-->
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button> <el-button type="primary" @click="submitForm"> </el-button>

View File

@ -91,12 +91,12 @@
<el-table v-loading="loading" :data="deviceList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="deviceList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<!-- <el-table-column label="id" align="center" prop="deviceId" />--> <el-table-column label="运营商" align="center" prop="deptName" v-if="userName == 'admin'"/>
<el-table-column label="设备mac" align="center" prop="mac" /> <el-table-column label="设备mac" align="center" prop="mac" />
<el-table-column label="SN" align="center" prop="sn" /> <el-table-column label="SN" align="center" prop="sn" />
<el-table-column label="型号" align="center" prop="model" /> <el-table-column label="车辆型号" align="center" prop="model" />
<el-table-column label="车牌号" align="center" prop="vehicleNum" /> <el-table-column label="车牌号" align="center" prop="vehicleNum" />
<el-table-column label="区" align="center" prop="areaName" /> <el-table-column label="运营区" align="center" prop="areaName" />
<el-table-column label="定位" align="center" prop="location" :show-overflow-tooltip="true"/> <el-table-column label="定位" align="center" prop="location" :show-overflow-tooltip="true"/>
<el-table-column label="剩余电量(%)" align="center" prop="remainingPower" /> <el-table-column label="剩余电量(%)" align="center" prop="remainingPower" />
<el-table-column label="车辆状态" align="center" prop="status"> <el-table-column label="车辆状态" align="center" prop="status">
@ -122,8 +122,6 @@
</el-popover> </el-popover>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="经度" align="center" prop="longitude" />
<el-table-column label="纬度" align="center" prop="latitude" />
<el-table-column label="创建时间" align="center" prop="createTime" width="180"> <el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span> <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
@ -148,10 +146,38 @@
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-view" icon="el-icon-edit"
@click="handleListing(scope.row)" @click="handleListing(scope.row)"
v-hasPermi="['system:fault:query']" v-hasPermi="['system:fault:query']"
>{{ scope.row.status === '0' ? '上架' : '下架' }}</el-button> >{{ scope.row.status === '0' ? '上架' : '下架' }}</el-button>
<el-button v-if="scope.row.status!= '3'"
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUnlocking(scope.row)"
v-hasPermi="['system:device:unlocking']"
>开锁</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleLock(scope.row)"
v-hasPermi="['system:device:lock']"
>关锁</el-button>
<el-button v-if="scope.row.status!= '0'"
size="mini"
type="text"
icon="el-icon-edit"
@click="handleOnline(scope.row)"
v-hasPermi="['system:device:online']"
>{{ scope.row.status === '8' ? '上线' : '下线' }}</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="ring(scope.row)"
v-hasPermi="['system:device:ring']"
>响铃寻车</el-button>
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
@ -181,17 +207,17 @@
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="SN" prop="sn"> <el-form-item label="SN" prop="sn">
<el-input v-model="form.sn" placeholder="请输入设备SN" /> <el-input v-model="form.sn" placeholder="请输入设备SN" :disabled="title=='修改设备'"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="MAC" prop="mac"> <el-form-item label="MAC" prop="mac">
<el-input v-model="form.mac" placeholder="请输入设备MAC" /> <el-input v-model="form.mac" placeholder="请输入设备MAC" :disabled="title=='修改设备'" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="型号" prop="modelId" > <el-form-item label="车辆型号" prop="modelId" >
<el-select v-model="form.modelId" placeholder="请选择型号"> <el-select v-model="form.modelId" placeholder="请选择车辆型号">
<el-option <el-option
v-for="item in modelOptions" v-for="item in modelOptions"
:key="item.modelId" :key="item.modelId"
@ -314,7 +340,15 @@
</template> </template>
<script> <script>
import { listDevice, getDevice, delDevice, addDevice, updateDevice } from "@/api/system/device"; import {
listDevice,
getDevice,
delDevice,
addDevice,
updateDevice,
handleLock,
handleUnlocking, ring
} from '@/api/system/device'
import Map from "@/components/Map"; import Map from "@/components/Map";
import OrderRecord from "@/views/system/device/components/orderRecord.vue"; import OrderRecord from "@/views/system/device/components/orderRecord.vue";
import RepairRecord from "@/views/system/device/components/repairRecord.vue"; import RepairRecord from "@/views/system/device/components/repairRecord.vue";
@ -342,6 +376,7 @@ export default {
}, },
data() { data() {
return { return {
userName: undefined,
activeIndex: '1', activeIndex: '1',
// //
loading: true, loading: true,
@ -401,6 +436,8 @@ export default {
}; };
}, },
created() { created() {
console.log("当前用户信息:",this.$store.state.user.name)
this.userName = this.$store.state.user.name;
this.getList(); this.getList();
console.log("------"+this.activeIndex) console.log("------"+this.activeIndex)
}, },
@ -452,13 +489,12 @@ export default {
this.deviceList = response.rows; this.deviceList = response.rows;
this.total = response.total; this.total = response.total;
this.loading = false; this.loading = false;
listModel(this.queryParams).then(response => { });
this.modelOptions = response.rows; listModel(this.queryParams).then(response => {
listArea(this.queryParams).then(response => { this.modelOptions = response.rows;
this.areaOptions = response.rows; });
listArea(this.queryParams).then(response => {
}); this.areaOptions = response.rows;
});
}); });
}, },
// //
@ -535,8 +571,46 @@ export default {
let form1 = response.data; let form1 = response.data;
let text = form1.status === '0'? '上架': '下架'; let text = form1.status === '0'? '上架': '下架';
form1.status = form1.status === '0'? '1': '0'; form1.status = form1.status === '0'? '1': '0';
this.$modal.confirm('是否确认'+text+'设备MAC为"' + form1.mac + '"的设备吗?').then(function() { if(form1.areaId == null){
return updateDevice(form1); this.$modal.msgError("未绑定运营区,无法上架!")
}else{
this.$modal.confirm('是否确认'+text+'设备MAC为"' + form1.mac + '"的设备吗?').then(function() {
return updateDevice(form1);
}).then(() => {
this.getList();
this.$modal.msgSuccess("操作成功");
}).catch(() => {
});
}
});
},
handleOnline(row) {
this.reset();
const deviceId = row.deviceId || this.ids
getDevice(deviceId).then(response => {
let form1 = response.data;
let text = form1.status === '8'? '上线': '下线';
form1.status = form1.status === '8'? '1': '8';
if(form1.areaId == null){
this.$modal.msgError("未绑定运营区,无法上线!")
}else{
this.$modal.confirm('是否确认'+text+'设备MAC为"' + form1.mac + '"的设备吗?').then(function() {
return updateDevice(form1);
}).then(() => {
this.getList();
this.$modal.msgSuccess("操作成功");
}).catch(() => {
});
}
});
},
handleUnlocking(row) {
this.reset();
const deviceId = row.deviceId || this.ids
getDevice(deviceId).then(response => {
let form1 = response.data;
this.$modal.confirm('是否确认开锁吗?').then(function() {
return handleUnlocking(form1);
}).then(() => { }).then(() => {
this.getList(); this.getList();
this.$modal.msgSuccess("操作成功"); this.$modal.msgSuccess("操作成功");
@ -544,6 +618,31 @@ export default {
}); });
}); });
}, },
handleLock(row) {
this.reset();
const deviceId = row.deviceId || this.ids
getDevice(deviceId).then(response => {
let form1 = response.data;
this.$modal.confirm('是否确认关锁吗?').then(function() {
return handleLock(form1);
}).then(() => {
this.getList();
this.$modal.msgSuccess("操作成功");
}).catch(() => {
});
});
},
ring(row) {
this.reset();
const deviceId = row.deviceId || this.ids
getDevice(deviceId).then(response => {
let form1 = response.data;
ring(form1).then(response => {
this.getList();
this.$modal.msgSuccess("操作成功");
});
});
},
/** 提交按钮 */ /** 提交按钮 */
submitForm() { submitForm() {
this.$refs["form"].validate(valid => { this.$refs["form"].validate(valid => {

View File

@ -72,7 +72,7 @@
this.map = new AMap.Map("container", { this.map = new AMap.Map("container", {
// id // id
viewMode: "3D", // 3D viewMode: "3D", // 3D
zoom: 18, // zoom: 13, //
center: [120.356031,26.94088], //-- center: [120.356031,26.94088], //--
}); });
// //
@ -90,8 +90,16 @@
listDevice().then(response => { listDevice().then(response => {
this.deviceList = response.rows; this.deviceList = response.rows;
this.deviceList.forEach(device => { this.deviceList.forEach(device => {
this.addMarker(device.longitude,device.latitude,device.status,device.onlineStatus); //
if (device.longitude !== null && device.latitude !== null &&
!isNaN(device.longitude) && !isNaN(device.latitude)) {
this.addMarker(device.longitude, device.latitude, device.status, device.onlineStatus);
} else {
console.warn(`无效的经纬度值: 经度=${device.longitude}, 纬度=${device.latitude}`);
}
}); });
}).catch(error => {
console.error('获取设备列表失败:', error);
}); });
}, },
areaBoundary(){ areaBoundary(){