feat:联动控制,定时控制,通知推送功能代码提交。

This commit is contained in:
tianyongbao
2025-10-23 14:23:07 +08:00
parent 6fa884c709
commit 3b13ee1708
11 changed files with 3034 additions and 56 deletions

View File

@@ -46,17 +46,17 @@
<el-table-column label="塘口名称" align="center" prop="pondName" />
<el-table-column label="设备名称" align="center" prop="deviceName" />
<el-table-column label="设备编号" align="center" prop="serialNum" width="150"/>
<el-table-column label="开关序号" align="center" prop="index" width="100"/>
<el-table-column label="开关名称" align="center" prop="switchName" />
<el-table-column label="开关序号" align="center" prop="index" width="80"/>
<el-table-column label="开关名称" align="center" prop="switchName" width="150"/>
<el-table-column label="开关状态" align="center" prop="isOpen">
<el-table-column label="开关状态" align="center" prop="isOpen" width="80">
<template #default="scope">
<dict-tag :options="open_close" :value="scope.row.isOpen"/>
</template>
</el-table-column>
<el-table-column label="当前测定电流" align="center" prop="detectElectricValue" />
<el-table-column label="当前测定电压" align="center" prop="detectVoltageValue" />
<el-table-column label="接线方式" align="center" prop="connectVoltageType">
<el-table-column label="接线方式" align="center" prop="connectVoltageType" width="100">
<template #default="scope">
<dict-tag :options="connect_voltage_type" :value="scope.row.connectVoltageType"/>
</template>
@@ -68,15 +68,19 @@
<dict-tag :options="open_close" :value="scope.row.electricWarnOpen"/>
</template>
</el-table-column>
<el-table-column label="联动状态" align="center" prop="isLinkedCtrl">
<el-table-column label="联动状态" align="center" prop="isLinkedCtrl" width="80">
<template #default="scope">
<dict-tag :options="is_linked_ctrl" :value="scope.row.isLinkedCtrl"/>
</template>
</el-table-column>
<el-table-column label="上次操作开关时间" align="center" prop="lastTurnTime" width="180">
</el-table-column>
<el-table-column label="操作" align="center" fixed="right" class-name="small-padding fixed-width">
<el-table-column label="上次操作开关时间" align="center" prop="lastTurnTime" width="160"> </el-table-column>
<el-table-column label="定时控制数量" align="center" prop="timingCtrlCount" width="110"/>
<el-table-column label="操作" align="center" fixed="right" width="160" class-name="small-padding fixed-width">
<template #default="scope">
<el-tooltip content="定时控制" placement="top">
<el-button link type="primary" icon="Timer" @click="handleViewTimingCtrl(scope.row)" v-hasPermi="['fishery:timingCtrl:list']"></el-button>
</el-tooltip>
<el-tooltip content="修改" placement="top">
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['fishery:deviceSwitch:edit']"></el-button>
</el-tooltip>
@@ -159,15 +163,48 @@
<el-dialog title="选择设备" v-model="deviceSelectVisible" width="1200px" append-to-body>
<!-- 搜索条件 -->
<el-form :model="deviceQueryParams" :inline="true" class="mb-4">
<el-form-item label="设备信息">
<el-form-item label="用户信息">
<el-input
v-model="deviceQueryParams.params.deviceKeyword"
placeholder="请输入设备名称或设备编号"
v-model="deviceQueryParams.params.userKeyword"
placeholder="请输入用户名或手机号"
clearable
style="width: 200px"
@keyup.enter="handleDeviceQuery"
/>
</el-form-item>
<el-form-item label="设备编号">
<el-input
v-model="deviceQueryParams.serialNum"
placeholder="请输入设备编号"
clearable
style="width: 180px"
@keyup.enter="handleDeviceQuery"
/>
</el-form-item>
<el-form-item label="设备名称">
<el-input
v-model="deviceQueryParams.deviceName"
placeholder="请输入设备名称"
clearable
style="width: 180px"
@keyup.enter="handleDeviceQuery"
/>
</el-form-item>
<el-form-item label="设备类型">
<el-select
v-model="deviceQueryParams.deviceType"
placeholder="请选择设备类型"
disabled
style="width: 150px"
>
<el-option
v-for="dict in aqu_device_type"
:key="dict.value"
:label="dict.label"
:value="parseInt(dict.value)"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="Search" @click="handleDeviceQuery">搜索</el-button>
<el-button icon="Refresh" @click="resetDeviceQuery">重置</el-button>
@@ -181,12 +218,12 @@
height="400px"
border
>
<el-table-column label="设备编号" align="center" prop="serialNum" width="150" />
<el-table-column label="设备名称" align="center" prop="deviceName" width="120" />
<el-table-column label="用户名" align="center" prop="userName" width="120" />
<el-table-column label="手机号" align="center" prop="mobilePhone" width="120" />
<el-table-column label="塘口名称" align="center" prop="pondName" width="120" />
<el-table-column label="设备类型" align="center" prop="deviceType" width="120">
<el-table-column label="用户名" align="center" prop="userName" />
<el-table-column label="手机号" align="center" prop="mobilePhone" />
<el-table-column label="设备编号" align="center" prop="serialNum" />
<el-table-column label="设备名称" align="center" prop="deviceName" />
<el-table-column label="塘口名称" align="center" prop="pondName" />
<el-table-column label="设备类型" align="center" prop="deviceType">
<template #default="scope">
<dict-tag :options="aqu_device_type" :value="scope.row.deviceType"/>
</template>
@@ -196,7 +233,12 @@
<span>{{ parseTime(scope.row.bindTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="100" fixed="right">
<el-table-column label="服务到期时间" align="center" prop="deadTime" width="120">
<template #default="scope">
<span>{{ parseTime(scope.row.deadTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="100">
<template #default="scope">
<el-button
type="primary"
@@ -225,6 +267,40 @@
</div>
</template>
</el-dialog>
<!-- 定时控制对话框 -->
<el-dialog
:title="`定时控制 - ${currentSwitch?.switchName || ''} (序号:${currentSwitch?.index || ''})`"
v-model="timingCtrlDialogVisible"
width="800px"
append-to-body
@close="closeTimingCtrlDialog"
>
<el-table
v-loading="timingCtrlLoading"
:data="timingCtrlList"
border
height="400px"
>
<el-table-column label="开启时间" align="center" prop="openTime" />
<el-table-column label="关闭时间" align="center" prop="closeTime" />
<el-table-column label="循环类型" align="center" prop="loopType" >
<template #default="scope">
<dict-tag :options="loop_type" :value="scope.row.loopType"/>
</template>
</el-table-column>
<el-table-column label="是否启用" align="center" prop="isOpen" >
<template #default="scope">
<dict-tag :options="open_close" :value="scope.row.isOpen"/>
</template>
</el-table-column>
</el-table>
<template #footer>
<div class="dialog-footer">
<el-button @click="closeTimingCtrlDialog"> </el-button>
</div>
</template>
</el-dialog>
</div>
</template>
@@ -233,9 +309,11 @@ import { listDeviceSwitch, getDeviceSwitch, delDeviceSwitch, addDeviceSwitch, up
import { DeviceSwitchVO, DeviceSwitchQuery, DeviceSwitchForm } from '@/api/fishery/deviceSwitch/types';
import { listDevice } from '@/api/fishery/device';
import { DeviceVO } from '@/api/fishery/device/types';
import { listTimingCtrl } from '@/api/fishery/timingCtrl';
import { TimingCtrlVO } from '@/api/fishery/timingCtrl/types';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { aqu_device_type, open_close, connect_voltage_type, is_linked_ctrl } = toRefs<any>(proxy?.useDict('aqu_device_type', 'open_close', 'connect_voltage_type', 'is_linked_ctrl'));
const { aqu_device_type, open_close, connect_voltage_type, is_linked_ctrl, loop_type } = toRefs<any>(proxy?.useDict('aqu_device_type', 'open_close', 'connect_voltage_type', 'is_linked_ctrl', 'loop_type'));
const deviceSwitchList = ref<DeviceSwitchVO[]>([]);
const buttonLoading = ref(false);
@@ -254,20 +332,32 @@ const deviceSelectVisible = ref(false);
const deviceQueryParams = reactive<{
pageNum: number;
pageSize: number;
serialNum?: string;
deviceName?: string;
deviceType?: number;
params: {
userKeyword?: string;
deviceKeyword?: string;
};
}>({
pageNum: 1,
pageSize: 10,
serialNum: undefined,
deviceName: undefined,
deviceType: 2, // 默认查询测控一体机假设值为2
params: {
userKeyword: undefined,
deviceKeyword: undefined
}
});
const deviceTotal = ref(0);
// 定时控制对话框
const timingCtrlDialogVisible = ref(false);
const timingCtrlList = ref<TimingCtrlVO[]>([]);
const timingCtrlLoading = ref(false);
const currentSwitch = ref<DeviceSwitchVO | null>(null);
const queryFormRef = ref<ElFormInstance>();
const deviceSwitchFormRef = ref<ElFormInstance>();
@@ -469,7 +559,10 @@ const getDeviceList = async () => {
const openDeviceSelect = () => {
// 重置搜索条件
deviceQueryParams.pageNum = 1;
deviceQueryParams.serialNum = undefined;
deviceQueryParams.deviceName = undefined;
deviceQueryParams.deviceType = 2; // 测控一体机类型
deviceQueryParams.params.userKeyword = undefined;
deviceQueryParams.params.deviceKeyword = undefined;
getDeviceList();
deviceSelectVisible.value = true;
@@ -484,7 +577,10 @@ const handleDeviceQuery = () => {
/** 重置设备搜索 */
const resetDeviceQuery = () => {
deviceQueryParams.pageNum = 1;
deviceQueryParams.serialNum = undefined;
deviceQueryParams.deviceName = undefined;
deviceQueryParams.deviceType = 2; // 测控一体机类型
deviceQueryParams.params.userKeyword = undefined;
deviceQueryParams.params.deviceKeyword = undefined;
getDeviceList();
};
@@ -515,6 +611,38 @@ const cancelDeviceSelect = () => {
deviceSelectVisible.value = false;
};
/** 查看定时控制 */
const handleViewTimingCtrl = async (row: DeviceSwitchVO) => {
currentSwitch.value = row;
await getTimingCtrlList(row.id);
timingCtrlDialogVisible.value = true;
};
/** 获取定时控制列表 */
const getTimingCtrlList = async (switchId: string | number) => {
timingCtrlLoading.value = true;
try {
const res = await listTimingCtrl({
switchId: switchId,
pageNum: 1,
pageSize: 1000 // 获取所有数据
});
timingCtrlList.value = res.rows || res.data || [];
} catch (error) {
console.error('加载定时控制失败:', error);
proxy?.$modal.msgError('加载定时控制失败');
} finally {
timingCtrlLoading.value = false;
}
};
/** 关闭定时控制对话框 */
const closeTimingCtrlDialog = () => {
timingCtrlDialogVisible.value = false;
currentSwitch.value = null;
timingCtrlList.value = [];
};
onMounted(() => {
getList();
});