forked from dyf/dyf-vue-ui
提交
This commit is contained in:
@ -5,7 +5,7 @@ VITE_APP_TITLE = 云平台管理系统
|
||||
VITE_APP_ENV = 'development'
|
||||
|
||||
# 开发环境
|
||||
VITE_APP_BASE_API = 'http://192.168.2.34:8000'
|
||||
VITE_APP_BASE_API = 'http://47.120.79.150/backend'
|
||||
|
||||
# 应用访问路径 例如使用前缀 /admin/
|
||||
VITE_APP_CONTEXT_PATH = '/'
|
||||
|
@ -11,7 +11,7 @@ VITE_APP_ENV = 'https://fuyuanshen.com/backend'
|
||||
VITE_APP_CONTEXT_PATH = '/jingquan/'
|
||||
|
||||
# 应用访问路径 富源晟2
|
||||
#VITE_APP_CONTEXT_PATH = '/sys/'
|
||||
#VITE_APP_CONTEXT_PATH = '/sys/'
|
||||
|
||||
# 监控地址
|
||||
VITE_APP_MONITOR_ADMIN = '/admin/applications'
|
||||
|
@ -14,12 +14,13 @@ export interface deviceQuery {
|
||||
|
||||
}
|
||||
export interface deviceVO {
|
||||
id: number; // 设备ID
|
||||
deviceName: string; // 设备名称(对应子组件的device.name)
|
||||
id: string; // 设备ID
|
||||
deviceName?: string | Number; // 设备名称(对应子组件的device.name)
|
||||
typeName: string; // 设备类型/型号(对应子组件的device.model)
|
||||
onlineStatus: 0 | 1; // 设备状态(0=失效/离线,1=正常/在线,对应子组件的device.status)
|
||||
lng?: number; // 经度(地图打点用)
|
||||
lat?: number; // 纬度(地图打点用)
|
||||
lat?: number; // 纬度(地图打点用
|
||||
|
||||
// 其他字段...
|
||||
}
|
||||
// 1. 定义设备详情的类型(根据接口返回字段调整!关键:和后端返回的字段名一致)
|
||||
|
@ -39,9 +39,10 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import {deviceVO } from '@/api/controlCenter/controlPanel/types';
|
||||
const props = defineProps({
|
||||
deviceList: {
|
||||
type: Array,
|
||||
type: Array as PropType<deviceVO[]>, // 用PropType指定数组元素为DeviceItem
|
||||
required: false,
|
||||
default: () => [] // 数组/对象类型的默认值必须用函数返回,避免引用共享
|
||||
}
|
||||
@ -54,7 +55,7 @@ declare var AMap: any;
|
||||
const mapRef = ref<HTMLDivElement | null>(null);
|
||||
let mapInstance: any = null;
|
||||
// 复选框状态管理
|
||||
const checkedDeviceIds = ref(); // 存储选中的设备ID
|
||||
const checkedDeviceIds = ref(); // 存储选中的设备ID
|
||||
const checkAll = ref(false); // 全选状态
|
||||
// 全选/取消全选
|
||||
const handleCheckAllChange = (val: boolean) => {
|
||||
|
@ -78,19 +78,19 @@
|
||||
<div class="label">报警事项</div>
|
||||
<div class="alearm">
|
||||
<template v-if="item.deviceAction === 0">强制报警
|
||||
<span v-if="item.treatmentState === 1">({{ item.startTime.split(' ')[1] || '' }})</span>
|
||||
<span v-if="item.treatmentState === 1">({{ item.startTime.split(' ')[1] || '' }})</span>
|
||||
</template>
|
||||
<template v-else-if="item.deviceAction === 1">撞击闯入
|
||||
<span v-if="item.treatmentState === 1">({{ item.startTime.split(' ')[1] || '' }})</span>
|
||||
</template>
|
||||
<template v-else-if="item.deviceAction === 2">手动报警
|
||||
<span v-if="item.treatmentState === 1">({{ item.startTime.split(' ')[1] || '' }})</span>
|
||||
<span v-if="item.treatmentState === 1">({{ item.startTime.split(' ')[1] || '' }})</span>
|
||||
</template>
|
||||
<template v-else-if="item.deviceAction === 3">电子围栏告警
|
||||
<span v-if="item.treatmentState === 1">({{ item.startTime.split(' ')[1] || '' }})</span>
|
||||
</template>
|
||||
<template v-else-if="item.deviceAction === 4">强制告警
|
||||
<span v-if="item.treatmentState === 1">({{ item.startTime.split(' ')[1] || '' }})</span>
|
||||
<span v-if="item.treatmentState === 1">({{ item.startTime.split(' ')[1] || '' }})</span>
|
||||
</template>
|
||||
</div>
|
||||
<div class="label">报警地点:</div>
|
||||
@ -98,7 +98,7 @@
|
||||
{{ item.location }}
|
||||
</div>
|
||||
<div v-if="item.treatmentState === 0" class="dl_bot d_fl">
|
||||
<div>时长:{{ item.durationTime}}</div>
|
||||
<div>时长:{{ item.durationTime }}</div>
|
||||
<div>解除: {{ item.finishTime.split(' ')[1] || '' }}</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -118,22 +118,22 @@
|
||||
<el-table-column label="报警地点" align="center" prop="location" />
|
||||
<el-table-column label="报警事项" align="center" prop="deviceAction">
|
||||
<template #default="scope">
|
||||
<div v-if="scope.row.deviceAction == 0">强制报警</div>
|
||||
<div v-if="scope.row.deviceAction == 1">撞击闯入</div>
|
||||
<div v-if="scope.row.deviceAction == 2">手动报警</div>
|
||||
<div v-if="scope.row.deviceAction == 3">电子围栏告警</div>
|
||||
<div v-if="scope.row.deviceAction == 4">强制告警</div>
|
||||
<el-tag type="danger" v-if="scope.row.deviceAction == 0">强制报警</el-tag>
|
||||
<el-tag type="danger" v-if="scope.row.deviceAction == 1">撞击闯入</el-tag>
|
||||
<el-tag type="danger" v-if="scope.row.deviceAction == 2">手动报警</el-tag>
|
||||
<el-tag type="danger" v-if="scope.row.deviceAction == 3">电子围栏告警</el-tag>
|
||||
<el-tag type="danger" v-if="scope.row.deviceAction == 4">强制告警</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="报警持续时间" align="center" prop="durationTime" width="180">
|
||||
<template #default="scope">
|
||||
<span>{{ scope.row.durationTime }}</span>
|
||||
<el-tag type="danger">{{ scope.row.durationTime }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="处理状态" align="center" prop="treatmentState">
|
||||
<template #default="scope">
|
||||
<div v-if="scope.row.treatmentState == 0">已处理</div>
|
||||
<div v-if="scope.row.treatmentState == 1">未处理</div>
|
||||
<div class="ysStatus" v-if="scope.row.treatmentState == 0">已处理</div>
|
||||
<el-tag type="danger" v-if="scope.row.treatmentState == 1">未处理</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="报警时间" align="center" prop="startTime" />
|
||||
@ -244,14 +244,6 @@ const resetQuery = () => {
|
||||
queryFormRef.value?.resetFields();
|
||||
handleQuery();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
onMounted(() => {
|
||||
getList();
|
||||
getDeviceType()
|
||||
@ -259,7 +251,7 @@ onMounted(() => {
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.custom-alarm-card {
|
||||
height:298px;
|
||||
height: 298px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
box-shadow: 0px 0px 6px 0px rgba(0, 27, 74, 0.1);
|
||||
@ -381,4 +373,8 @@ onMounted(() => {
|
||||
color: rgba(56, 64, 79, 0.6);
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.ysStatus {
|
||||
color: #00A552;
|
||||
}
|
||||
</style>
|
||||
|
@ -98,15 +98,15 @@
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="pc路由跳转" prop="modelDictionary">
|
||||
<el-select v-model="form.modelDictionary" placeholder="请选择">
|
||||
<el-option v-for="item in pcmodelDictionaryOptions" :key="item.dictValue" :label="item.dictLabel"
|
||||
<el-form-item label="路由跳转" prop="appModelDictionary">
|
||||
<el-select v-model="form.appModelDictionary" placeholder="请选择" @change="handlePcRouteChange">
|
||||
<el-option v-for="item in appmodelDictionaryOptions" :key="item.dictCode" :label="item.dictLabel"
|
||||
:value="item.dictValue" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="app路由跳转" prop="modelDictionary">
|
||||
<el-select v-model="form.modelDictionary" placeholder="请选择">
|
||||
<el-option v-for="item in appmodelDictionaryOptions" :key="item.dictValue" :label="item.dictLabel"
|
||||
<el-form-item label="pc路由跳转" prop="pcModelDictionary" style="display: none;">
|
||||
<el-select v-model="form.pcModelDictionary" placeholder="请选择" >
|
||||
<el-option v-for="item in pcmodelDictionaryOptions" :key="item.dictCode" :label="item.dictLabel"
|
||||
:value="item.dictValue" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
@ -169,6 +169,8 @@ interface deviceTypeVO {
|
||||
isSupportBle: boolean;
|
||||
locateMode: number;
|
||||
modelDictionary: string;
|
||||
appModelDictionary: string;
|
||||
pcModelDictionary: string;
|
||||
communicationMode: number;
|
||||
createTime: string;
|
||||
createByName: string;
|
||||
@ -197,7 +199,9 @@ const initFormData: DeviceTypeForm = {
|
||||
typeName: '',
|
||||
isSupportBle: false,
|
||||
locateMode: 0,
|
||||
modelDictionary: '',
|
||||
// modelDictionary: '',
|
||||
appModelDictionary: '',
|
||||
pcModelDictionary: '',
|
||||
communicationMode: 0,
|
||||
id: '',
|
||||
createTime: '',
|
||||
@ -215,7 +219,7 @@ const initData = {
|
||||
typeName: [
|
||||
{ required: true, message: '请输入设备类型名称', trigger: 'blur' },
|
||||
],
|
||||
modelDictionary: [
|
||||
appModelDictionary: [
|
||||
{ required: true, message: '请选择类型code', trigger: 'blur' },
|
||||
],
|
||||
locateMode: [
|
||||
@ -262,6 +266,22 @@ const resetQuery = () => {
|
||||
queryParams.value.pageNum = 1;
|
||||
getList();
|
||||
};
|
||||
// PC路由变化时,同步对应APP路由
|
||||
const handlePcRouteChange = (pcDictValue: string) => {
|
||||
const selectedPcItem = appmodelDictionaryOptions.value.find(
|
||||
item => item.dictValue === pcDictValue
|
||||
);
|
||||
if (!selectedPcItem) return;
|
||||
const matchedAppItem = pcmodelDictionaryOptions.value.find(
|
||||
item => item.dictLabel === selectedPcItem.dictLabel
|
||||
);
|
||||
if (matchedAppItem) {
|
||||
form.value.pcModelDictionary = matchedAppItem.dictValue;
|
||||
} else {
|
||||
form.value.pcModelDictionary = '';
|
||||
console.warn(`没有找到dictLabel为${selectedPcItem.dictLabel}的APP路由`);
|
||||
}
|
||||
};
|
||||
|
||||
/** 删除按钮操作 */
|
||||
const handleDelete = async (row?: deviceTypeVO) => {
|
||||
@ -313,7 +333,8 @@ const handleUpdate = async (row?: DeviceTypeForm) => {
|
||||
const deviceData = row || ids.value[0];
|
||||
Object.assign(form.value, deviceData);
|
||||
// 确保数据类型正确
|
||||
form.value.modelDictionary = String(form.value.modelDictionary || '');
|
||||
form.value.appModelDictionary = String(form.value.appModelDictionary || '');
|
||||
form.value.pcModelDictionary = String(form.value.pcModelDictionary || '');
|
||||
form.value.locateMode = Number(form.value.locateMode) || 0;
|
||||
form.value.communicationMode = Number(form.value.communicationMode) || 0;
|
||||
} catch (error) {
|
||||
@ -329,9 +350,9 @@ const submitForm = () => {
|
||||
try {
|
||||
const payload = {
|
||||
...form.value,
|
||||
appModelDictionary: form.value.modelDictionary,
|
||||
pcModelDictionary:form.value.modelDictionary,
|
||||
|
||||
appModelDictionary: form.value.appModelDictionary,
|
||||
pcModelDictionary: form.value.pcModelDictionary,
|
||||
|
||||
locateMode: Number(form.value.locateMode),
|
||||
communicationMode: Number(form.value.communicationMode)
|
||||
};
|
||||
@ -368,5 +389,4 @@ onMounted(() => {
|
||||
getDict();
|
||||
pcgetDict() //pc跳转
|
||||
});
|
||||
|
||||
</script>
|
||||
|
Reference in New Issue
Block a user