feat:联动控制,定时控制,通知推送功能代码提交。
This commit is contained in:
63
src/api/fishery/linkedCtrl/index.ts
Normal file
63
src/api/fishery/linkedCtrl/index.ts
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
import request from '@/utils/request';
|
||||||
|
import { AxiosPromise } from 'axios';
|
||||||
|
import { LinkedCtrlVO, LinkedCtrlForm, LinkedCtrlQuery } from '@/api/fishery/linkedCtrl/types';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询溶解氧联动控制列表
|
||||||
|
* @param query
|
||||||
|
* @returns {*}
|
||||||
|
*/
|
||||||
|
|
||||||
|
export const listLinkedCtrl = (query?: LinkedCtrlQuery): AxiosPromise<LinkedCtrlVO[]> => {
|
||||||
|
return request({
|
||||||
|
url: '/fishery/linkedCtrl/list',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询溶解氧联动控制详细
|
||||||
|
* @param id
|
||||||
|
*/
|
||||||
|
export const getLinkedCtrl = (id: string | number): AxiosPromise<LinkedCtrlVO> => {
|
||||||
|
return request({
|
||||||
|
url: '/fishery/linkedCtrl/' + id,
|
||||||
|
method: 'get'
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增溶解氧联动控制
|
||||||
|
* @param data
|
||||||
|
*/
|
||||||
|
export const addLinkedCtrl = (data: LinkedCtrlForm) => {
|
||||||
|
return request({
|
||||||
|
url: '/fishery/linkedCtrl',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改溶解氧联动控制
|
||||||
|
* @param data
|
||||||
|
*/
|
||||||
|
export const updateLinkedCtrl = (data: LinkedCtrlForm) => {
|
||||||
|
return request({
|
||||||
|
url: '/fishery/linkedCtrl',
|
||||||
|
method: 'put',
|
||||||
|
data: data
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除溶解氧联动控制
|
||||||
|
* @param id
|
||||||
|
*/
|
||||||
|
export const delLinkedCtrl = (id: string | number | Array<string | number>) => {
|
||||||
|
return request({
|
||||||
|
url: '/fishery/linkedCtrl/' + id,
|
||||||
|
method: 'delete'
|
||||||
|
});
|
||||||
|
};
|
||||||
113
src/api/fishery/linkedCtrl/types.ts
Normal file
113
src/api/fishery/linkedCtrl/types.ts
Normal file
@@ -0,0 +1,113 @@
|
|||||||
|
export interface LinkedCtrlVO {
|
||||||
|
/**
|
||||||
|
* 主键id
|
||||||
|
*/
|
||||||
|
id: string | number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备id
|
||||||
|
*/
|
||||||
|
deviceId: string | number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 溶解氧上限开关
|
||||||
|
*/
|
||||||
|
oxyUpperOpen: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 溶解氧上限值
|
||||||
|
*/
|
||||||
|
oxyUpperValue: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 溶解氧下限开关
|
||||||
|
*/
|
||||||
|
oxyLowerOpen: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 溶解氧下限值
|
||||||
|
*/
|
||||||
|
oxyLowerValue: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否触发上限关闭操作
|
||||||
|
*/
|
||||||
|
isOxyUpperTrigger: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
remark: string;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface LinkedCtrlForm extends BaseEntity {
|
||||||
|
/**
|
||||||
|
* 主键id
|
||||||
|
*/
|
||||||
|
id?: string | number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备id
|
||||||
|
*/
|
||||||
|
deviceId?: string | number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 溶解氧上限开关
|
||||||
|
*/
|
||||||
|
oxyUpperOpen?: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 溶解氧上限值
|
||||||
|
*/
|
||||||
|
oxyUpperValue?: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 溶解氧下限开关
|
||||||
|
*/
|
||||||
|
oxyLowerOpen?: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 溶解氧下限值
|
||||||
|
*/
|
||||||
|
oxyLowerValue?: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否触发上限关闭操作
|
||||||
|
*/
|
||||||
|
isOxyUpperTrigger?: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
remark?: string;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface LinkedCtrlQuery extends PageQuery {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备id
|
||||||
|
*/
|
||||||
|
deviceId?: string | number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 溶解氧上限开关
|
||||||
|
*/
|
||||||
|
oxyUpperOpen?: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 溶解氧下限开关
|
||||||
|
*/
|
||||||
|
oxyLowerOpen?: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否触发上限关闭操作
|
||||||
|
*/
|
||||||
|
isOxyUpperTrigger?: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 日期范围参数
|
||||||
|
*/
|
||||||
|
params?: any;
|
||||||
|
}
|
||||||
63
src/api/fishery/timingCtrl/index.ts
Normal file
63
src/api/fishery/timingCtrl/index.ts
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
import request from '@/utils/request';
|
||||||
|
import { AxiosPromise } from 'axios';
|
||||||
|
import { TimingCtrlVO, TimingCtrlForm, TimingCtrlQuery } from '@/api/fishery/timingCtrl/types';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询开关定时控制列表
|
||||||
|
* @param query
|
||||||
|
* @returns {*}
|
||||||
|
*/
|
||||||
|
|
||||||
|
export const listTimingCtrl = (query?: TimingCtrlQuery): AxiosPromise<TimingCtrlVO[]> => {
|
||||||
|
return request({
|
||||||
|
url: '/fishery/timingCtrl/list',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询开关定时控制详细
|
||||||
|
* @param id
|
||||||
|
*/
|
||||||
|
export const getTimingCtrl = (id: string | number): AxiosPromise<TimingCtrlVO> => {
|
||||||
|
return request({
|
||||||
|
url: '/fishery/timingCtrl/' + id,
|
||||||
|
method: 'get'
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增开关定时控制
|
||||||
|
* @param data
|
||||||
|
*/
|
||||||
|
export const addTimingCtrl = (data: TimingCtrlForm) => {
|
||||||
|
return request({
|
||||||
|
url: '/fishery/timingCtrl',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改开关定时控制
|
||||||
|
* @param data
|
||||||
|
*/
|
||||||
|
export const updateTimingCtrl = (data: TimingCtrlForm) => {
|
||||||
|
return request({
|
||||||
|
url: '/fishery/timingCtrl',
|
||||||
|
method: 'put',
|
||||||
|
data: data
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除开关定时控制
|
||||||
|
* @param id
|
||||||
|
*/
|
||||||
|
export const delTimingCtrl = (id: string | number | Array<string | number>) => {
|
||||||
|
return request({
|
||||||
|
url: '/fishery/timingCtrl/' + id,
|
||||||
|
method: 'delete'
|
||||||
|
});
|
||||||
|
};
|
||||||
98
src/api/fishery/timingCtrl/types.ts
Normal file
98
src/api/fishery/timingCtrl/types.ts
Normal file
@@ -0,0 +1,98 @@
|
|||||||
|
export interface TimingCtrlVO {
|
||||||
|
/**
|
||||||
|
* 主键id
|
||||||
|
*/
|
||||||
|
id: string | number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开关id
|
||||||
|
*/
|
||||||
|
switchId: string | number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开启时间
|
||||||
|
*/
|
||||||
|
openTime: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关闭时间
|
||||||
|
*/
|
||||||
|
closeTime: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 循环类型
|
||||||
|
*/
|
||||||
|
loopType: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否启用
|
||||||
|
*/
|
||||||
|
isOpen: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
remark: string;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface TimingCtrlForm extends BaseEntity {
|
||||||
|
/**
|
||||||
|
* 主键id
|
||||||
|
*/
|
||||||
|
id?: string | number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开关id
|
||||||
|
*/
|
||||||
|
switchId?: string | number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开启时间
|
||||||
|
*/
|
||||||
|
openTime?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关闭时间
|
||||||
|
*/
|
||||||
|
closeTime?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 循环类型
|
||||||
|
*/
|
||||||
|
loopType?: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否启用
|
||||||
|
*/
|
||||||
|
isOpen?: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
remark?: string;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface TimingCtrlQuery extends PageQuery {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开关id
|
||||||
|
*/
|
||||||
|
switchId?: string | number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 循环类型
|
||||||
|
*/
|
||||||
|
loopType?: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否启用
|
||||||
|
*/
|
||||||
|
isOpen?: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 日期范围参数
|
||||||
|
*/
|
||||||
|
params?: any;
|
||||||
|
}
|
||||||
@@ -5,6 +5,15 @@ export interface NoticeVO extends BaseEntity {
|
|||||||
noticeContent: string;
|
noticeContent: string;
|
||||||
status: string;
|
status: string;
|
||||||
remark: string;
|
remark: string;
|
||||||
|
/**
|
||||||
|
* 优先级
|
||||||
|
*/
|
||||||
|
priority: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 有效期
|
||||||
|
*/
|
||||||
|
deadTime: string;
|
||||||
createByName: string;
|
createByName: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -22,5 +31,7 @@ export interface NoticeForm {
|
|||||||
noticeContent: string;
|
noticeContent: string;
|
||||||
status: string;
|
status: string;
|
||||||
remark: string;
|
remark: string;
|
||||||
|
priority: number,
|
||||||
|
deadTime: undefined,
|
||||||
createByName: string;
|
createByName: string;
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -139,8 +139,17 @@
|
|||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="电量电话告警下限" align="center" prop="batteryWarnLower" />
|
<el-table-column label="电量电话告警下限" align="center" prop="batteryWarnLower" />
|
||||||
<el-table-column label="操作" align="center" fixed="right" class-name="small-padding fixed-width">
|
<el-table-column label="操作" align="center" fixed="right" width="240" class-name="small-padding fixed-width">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
|
<el-tooltip content="开关信息" placement="top" v-if="scope.row.deviceType === 2">
|
||||||
|
<el-button link type="primary" icon="Operation" @click="handleViewSwitch(scope.row)" v-hasPermi="['fishery:deviceSwitch:list']"></el-button>
|
||||||
|
</el-tooltip>
|
||||||
|
<el-tooltip content="联动控制" placement="top">
|
||||||
|
<el-button link type="primary" icon="Connection" @click="handleViewLinkedCtrl(scope.row)" v-hasPermi="['fishery:linkedCtrl:list']"></el-button>
|
||||||
|
</el-tooltip>
|
||||||
|
<el-tooltip content="校时记录" placement="top">
|
||||||
|
<el-button link type="primary" icon="Clock" @click="handleViewCorrectRecord(scope.row)" v-hasPermi="['fishery:deviceCorrectRecord:list']"></el-button>
|
||||||
|
</el-tooltip>
|
||||||
<el-tooltip content="修改" placement="top">
|
<el-tooltip content="修改" placement="top">
|
||||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['fishery:device:edit']"></el-button>
|
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['fishery:device:edit']"></el-button>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
@@ -568,6 +577,209 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
|
<!-- 开关信息对话框 -->
|
||||||
|
<el-dialog
|
||||||
|
:title="`开关信息 - ${currentDevice?.deviceName || ''} (${currentDevice?.serialNum || ''})`"
|
||||||
|
v-model="switchDialogVisible"
|
||||||
|
width="1400px"
|
||||||
|
append-to-body
|
||||||
|
@close="closeSwitchDialog"
|
||||||
|
>
|
||||||
|
<el-table
|
||||||
|
v-loading="switchLoading"
|
||||||
|
:data="switchList"
|
||||||
|
border
|
||||||
|
height="400px"
|
||||||
|
>
|
||||||
|
<el-table-column label="序号" align="center" prop="index" width="60"/>
|
||||||
|
<el-table-column label="开关名称" align="center" prop="switchName" width="150"/>
|
||||||
|
<el-table-column label="当前状态" align="center" prop="isOpen" width="100">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-tag :type="scope.row.isOpen === 1 ? 'success' : 'info'">
|
||||||
|
{{ scope.row.isOpen === 1 ? '开启' : '关闭' }}
|
||||||
|
</el-tag>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="测定电流(A)" align="center" prop="detectElectricValue" width="110"/>
|
||||||
|
<el-table-column label="测定电压(V)" align="center" prop="detectVoltageValue" width="110"/>
|
||||||
|
<el-table-column label="额定电流(A)" align="center" prop="rateElectricValue" width="110"/>
|
||||||
|
<el-table-column label="接线方式" align="center" prop="connectVoltageType" width="100">
|
||||||
|
<template #default="scope">
|
||||||
|
<dict-tag :options="connect_voltage_type" :value="scope.row.connectVoltageType"/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="电流告警开关" align="center" prop="electricWarnOpen" width="120">
|
||||||
|
<template #default="scope">
|
||||||
|
<dict-tag :options="open_close" :value="scope.row.electricWarnOpen"/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="额定电流设置" align="center" prop="rateElectricValue" />
|
||||||
|
<el-table-column label="联动状态" align="center" prop="isLinkedCtrl" >
|
||||||
|
<template #default="scope">
|
||||||
|
<dict-tag :options="is_linked_ctrl" :value="scope.row.isLinkedCtrl"/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="定时控制数量" align="center" prop="timingCtrlCount" width="110">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-tag type="info">{{ scope.row.timingCtrlCount || 0 }}</el-tag>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" align="center" width="120" fixed="right">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-tooltip content="定时控制" placement="top">
|
||||||
|
<el-button
|
||||||
|
link
|
||||||
|
type="primary"
|
||||||
|
icon="Timer"
|
||||||
|
@click="handleViewSwitchTimingCtrl(scope.row)"
|
||||||
|
v-hasPermi="['fishery:timingCtrl:list']"
|
||||||
|
>
|
||||||
|
</el-button>
|
||||||
|
</el-tooltip>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<template #footer>
|
||||||
|
<div class="dialog-footer">
|
||||||
|
<el-button @click="closeSwitchDialog">关 闭</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
|
||||||
|
<!-- 联动控制对话框 -->
|
||||||
|
<el-dialog
|
||||||
|
:title="`联动控制 - ${currentDevice?.deviceName || ''} (${currentDevice?.serialNum || ''})`"
|
||||||
|
v-model="linkedCtrlDialogVisible"
|
||||||
|
width="1200px"
|
||||||
|
append-to-body
|
||||||
|
@close="closeLinkedCtrlDialog"
|
||||||
|
>
|
||||||
|
<el-table
|
||||||
|
v-loading="linkedCtrlLoading"
|
||||||
|
:data="linkedCtrlList"
|
||||||
|
border
|
||||||
|
height="400px"
|
||||||
|
>
|
||||||
|
<el-table-column label="设备编号" align="center" prop="serialNum"/>
|
||||||
|
<el-table-column label="溶解氧上限开关" align="center" prop="oxyUpperOpen" >
|
||||||
|
<template #default="scope">
|
||||||
|
<dict-tag :options="open_close" :value="scope.row.oxyUpperOpen"/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="溶解氧上限值" align="center" prop="oxyUpperValue"/>
|
||||||
|
<el-table-column label="溶解氧下限开关" align="center" prop="oxyLowerOpen" >
|
||||||
|
<template #default="scope">
|
||||||
|
<dict-tag :options="open_close" :value="scope.row.oxyLowerOpen"/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="溶解氧下限值" align="center" prop="oxyLowerValue" />
|
||||||
|
<el-table-column label="是否触发上限关闭操作" align="center" prop="isOxyUpperTrigger" >
|
||||||
|
<template #default="scope">
|
||||||
|
<dict-tag :options="yes_no" :value="scope.row.isOxyUpperTrigger"/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<!-- 分页 -->
|
||||||
|
<pagination
|
||||||
|
v-show="linkedCtrlTotal > 0"
|
||||||
|
:total="linkedCtrlTotal"
|
||||||
|
v-model:page="linkedCtrlQueryParams.pageNum"
|
||||||
|
v-model:limit="linkedCtrlQueryParams.pageSize"
|
||||||
|
@pagination="getLinkedCtrlList"
|
||||||
|
class="mt-4"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<template #footer>
|
||||||
|
<div class="dialog-footer">
|
||||||
|
<el-button @click="closeLinkedCtrlDialog">关 闭</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
|
||||||
|
<!-- 校时记录对话框 -->
|
||||||
|
<el-dialog
|
||||||
|
:title="`校时记录 - ${currentDevice?.deviceName || ''} (${currentDevice?.serialNum || ''})`"
|
||||||
|
v-model="correctRecordDialogVisible"
|
||||||
|
width="1000px"
|
||||||
|
append-to-body
|
||||||
|
@close="closeCorrectRecordDialog"
|
||||||
|
>
|
||||||
|
<el-table
|
||||||
|
v-loading="correctRecordLoading"
|
||||||
|
:data="correctRecordList"
|
||||||
|
border
|
||||||
|
height="400px"
|
||||||
|
>
|
||||||
|
<el-table-column label="手机号" align="center" prop="mobilePhone" />
|
||||||
|
<el-table-column label="设备编号" align="center" prop="serialNum" width="160"/>
|
||||||
|
<el-table-column label="设备类型" align="center" prop="deviceType" >
|
||||||
|
<template #default="scope">
|
||||||
|
<dict-tag :options="aqu_device_type" :value="scope.row.deviceType"/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column label="溶解氧" align="center" prop="valueDissolvedOxygen" />
|
||||||
|
<el-table-column label="水温" align="center" prop="valueTemperature" />
|
||||||
|
<el-table-column label="饱和度" align="center" prop="valueSaturability" />
|
||||||
|
<el-table-column label="校准时间" align="center" prop="createTime" width="160"/>
|
||||||
|
<!-- <el-table-column label="备注" align="center" prop="remark" show-overflow-tooltip/> -->
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<!-- 分页 -->
|
||||||
|
<pagination
|
||||||
|
v-show="correctRecordTotal > 0"
|
||||||
|
:total="correctRecordTotal"
|
||||||
|
v-model:page="correctRecordQueryParams.pageNum"
|
||||||
|
v-model:limit="correctRecordQueryParams.pageSize"
|
||||||
|
@pagination="getCorrectRecordList"
|
||||||
|
class="mt-4"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<template #footer>
|
||||||
|
<div class="dialog-footer">
|
||||||
|
<el-button @click="closeCorrectRecordDialog">关 闭</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
|
||||||
|
<!-- 开关定时控制对话框 -->
|
||||||
|
<el-dialog
|
||||||
|
:title="`定时控制 - ${currentSwitch?.switchName || ''} (序号:${currentSwitch?.index || ''})`"
|
||||||
|
v-model="switchTimingCtrlDialogVisible"
|
||||||
|
width="800px"
|
||||||
|
append-to-body
|
||||||
|
@close="closeSwitchTimingCtrlDialog"
|
||||||
|
>
|
||||||
|
<el-table
|
||||||
|
v-loading="switchTimingCtrlLoading"
|
||||||
|
:data="switchTimingCtrlList"
|
||||||
|
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="closeSwitchTimingCtrlDialog">关 闭</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -578,9 +790,17 @@ import { listAquUser } from '@/api/fishery/aquUser';
|
|||||||
import { AquUserVO } from '@/api/fishery/aquUser/types';
|
import { AquUserVO } from '@/api/fishery/aquUser/types';
|
||||||
import { listPond } from '@/api/fishery/pond';
|
import { listPond } from '@/api/fishery/pond';
|
||||||
import { PondVO } from '@/api/fishery/pond/types';
|
import { PondVO } from '@/api/fishery/pond/types';
|
||||||
|
import { listDeviceSwitch } from '@/api/fishery/deviceSwitch';
|
||||||
|
import { DeviceSwitchVO } from '@/api/fishery/deviceSwitch/types';
|
||||||
|
import { listLinkedCtrl } from '@/api/fishery/linkedCtrl';
|
||||||
|
import { LinkedCtrlVO } from '@/api/fishery/linkedCtrl/types';
|
||||||
|
import { listTimingCtrl } from '@/api/fishery/timingCtrl';
|
||||||
|
import { TimingCtrlVO } from '@/api/fishery/timingCtrl/types';
|
||||||
|
import { listDeviceCorrectRecord } from '@/api/fishery/deviceCorrectRecord';
|
||||||
|
import { DeviceCorrectRecordVO } from '@/api/fishery/deviceCorrectRecord/types';
|
||||||
|
|
||||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||||
const { aqu_device_type, open_close } = toRefs<any>(proxy?.useDict('aqu_device_type', 'open_close'));
|
const { aqu_device_type, open_close, connect_voltage_type, yes_no, loop_type,is_linked_ctrl } = toRefs<any>(proxy?.useDict('aqu_device_type', 'open_close', 'connect_voltage_type', 'yes_no', 'loop_type', 'is_linked_ctrl'));
|
||||||
|
|
||||||
const deviceList = ref<DeviceVO[]>([]);
|
const deviceList = ref<DeviceVO[]>([]);
|
||||||
const buttonLoading = ref(false);
|
const buttonLoading = ref(false);
|
||||||
@@ -630,6 +850,40 @@ const pondQueryParams = reactive<{
|
|||||||
});
|
});
|
||||||
const pondTotal = ref(0);
|
const pondTotal = ref(0);
|
||||||
|
|
||||||
|
// 开关信息对话框
|
||||||
|
const switchDialogVisible = ref(false);
|
||||||
|
const switchList = ref<DeviceSwitchVO[]>([]);
|
||||||
|
const switchLoading = ref(false);
|
||||||
|
const currentDevice = ref<DeviceVO | null>(null);
|
||||||
|
|
||||||
|
// 联动控制对话框
|
||||||
|
const linkedCtrlDialogVisible = ref(false);
|
||||||
|
const linkedCtrlList = ref<LinkedCtrlVO[]>([]);
|
||||||
|
const linkedCtrlLoading = ref(false);
|
||||||
|
const linkedCtrlTotal = ref(0);
|
||||||
|
const linkedCtrlQueryParams = reactive({
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
deviceId: undefined as string | number | undefined
|
||||||
|
});
|
||||||
|
|
||||||
|
// 校时记录对话框
|
||||||
|
const correctRecordDialogVisible = ref(false);
|
||||||
|
const correctRecordList = ref<DeviceCorrectRecordVO[]>([]);
|
||||||
|
const correctRecordLoading = ref(false);
|
||||||
|
const correctRecordTotal = ref(0);
|
||||||
|
const correctRecordQueryParams = reactive({
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
deviceId: undefined as string | number | undefined
|
||||||
|
});
|
||||||
|
|
||||||
|
// 开关定时控制对话框
|
||||||
|
const switchTimingCtrlDialogVisible = ref(false);
|
||||||
|
const switchTimingCtrlList = ref<TimingCtrlVO[]>([]);
|
||||||
|
const switchTimingCtrlLoading = ref(false);
|
||||||
|
const currentSwitch = ref<DeviceSwitchVO | null>(null);
|
||||||
|
|
||||||
const queryFormRef = ref<ElFormInstance>();
|
const queryFormRef = ref<ElFormInstance>();
|
||||||
const deviceFormRef = ref<ElFormInstance>();
|
const deviceFormRef = ref<ElFormInstance>();
|
||||||
|
|
||||||
@@ -1069,6 +1323,129 @@ const cancelPondSelect = () => {
|
|||||||
pondSelectVisible.value = false;
|
pondSelectVisible.value = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/** 查看开关信息 */
|
||||||
|
const handleViewSwitch = async (row: DeviceVO) => {
|
||||||
|
currentDevice.value = row;
|
||||||
|
switchLoading.value = true;
|
||||||
|
try {
|
||||||
|
const res = await listDeviceSwitch({
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 100,
|
||||||
|
deviceId: row.id
|
||||||
|
});
|
||||||
|
switchList.value = res.rows || res.data || [];
|
||||||
|
switchDialogVisible.value = true;
|
||||||
|
} catch (error) {
|
||||||
|
console.error('加载开关信息失败:', error);
|
||||||
|
proxy?.$modal.msgError('加载开关信息失败');
|
||||||
|
} finally {
|
||||||
|
switchLoading.value = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 关闭开关信息对话框 */
|
||||||
|
const closeSwitchDialog = () => {
|
||||||
|
switchDialogVisible.value = false;
|
||||||
|
currentDevice.value = null;
|
||||||
|
switchList.value = [];
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 查看联动控制 */
|
||||||
|
const handleViewLinkedCtrl = async (row: DeviceVO) => {
|
||||||
|
currentDevice.value = row;
|
||||||
|
linkedCtrlQueryParams.deviceId = row.id;
|
||||||
|
linkedCtrlQueryParams.pageNum = 1;
|
||||||
|
await getLinkedCtrlList();
|
||||||
|
linkedCtrlDialogVisible.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 获取联动控制列表 */
|
||||||
|
const getLinkedCtrlList = async () => {
|
||||||
|
linkedCtrlLoading.value = true;
|
||||||
|
try {
|
||||||
|
const res = await listLinkedCtrl(linkedCtrlQueryParams);
|
||||||
|
linkedCtrlList.value = res.rows || res.data || [];
|
||||||
|
linkedCtrlTotal.value = res.total || 0;
|
||||||
|
} catch (error) {
|
||||||
|
console.error('加载联动控制失败:', error);
|
||||||
|
proxy?.$modal.msgError('加载联动控制失败');
|
||||||
|
} finally {
|
||||||
|
linkedCtrlLoading.value = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 关闭联动控制对话框 */
|
||||||
|
const closeLinkedCtrlDialog = () => {
|
||||||
|
linkedCtrlDialogVisible.value = false;
|
||||||
|
currentDevice.value = null;
|
||||||
|
linkedCtrlList.value = [];
|
||||||
|
linkedCtrlTotal.value = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 查看校时记录 */
|
||||||
|
const handleViewCorrectRecord = async (row: DeviceVO) => {
|
||||||
|
currentDevice.value = row;
|
||||||
|
correctRecordQueryParams.deviceId = row.id;
|
||||||
|
correctRecordQueryParams.pageNum = 1;
|
||||||
|
await getCorrectRecordList();
|
||||||
|
correctRecordDialogVisible.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 获取校时记录列表 */
|
||||||
|
const getCorrectRecordList = async () => {
|
||||||
|
correctRecordLoading.value = true;
|
||||||
|
try {
|
||||||
|
const res = await listDeviceCorrectRecord(correctRecordQueryParams);
|
||||||
|
correctRecordList.value = res.rows || res.data || [];
|
||||||
|
correctRecordTotal.value = res.total || 0;
|
||||||
|
} catch (error) {
|
||||||
|
console.error('加载校时记录失败:', error);
|
||||||
|
proxy?.$modal.msgError('加载校时记录失败');
|
||||||
|
} finally {
|
||||||
|
correctRecordLoading.value = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 关闭校时记录对话框 */
|
||||||
|
const closeCorrectRecordDialog = () => {
|
||||||
|
correctRecordDialogVisible.value = false;
|
||||||
|
currentDevice.value = null;
|
||||||
|
correctRecordList.value = [];
|
||||||
|
correctRecordTotal.value = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 查看开关的定时控制 */
|
||||||
|
const handleViewSwitchTimingCtrl = async (row: DeviceSwitchVO) => {
|
||||||
|
currentSwitch.value = row;
|
||||||
|
await getSwitchTimingCtrlList(row.id);
|
||||||
|
switchTimingCtrlDialogVisible.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 获取开关定时控制列表 */
|
||||||
|
const getSwitchTimingCtrlList = async (switchId: string | number) => {
|
||||||
|
switchTimingCtrlLoading.value = true;
|
||||||
|
try {
|
||||||
|
const res = await listTimingCtrl({
|
||||||
|
switchId: switchId,
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 1000 // 获取所有数据
|
||||||
|
});
|
||||||
|
switchTimingCtrlList.value = res.rows || res.data || [];
|
||||||
|
} catch (error) {
|
||||||
|
console.error('加载定时控制失败:', error);
|
||||||
|
proxy?.$modal.msgError('加载定时控制失败');
|
||||||
|
} finally {
|
||||||
|
switchTimingCtrlLoading.value = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 关闭开关定时控制对话框 */
|
||||||
|
const closeSwitchTimingCtrlDialog = () => {
|
||||||
|
switchTimingCtrlDialogVisible.value = false;
|
||||||
|
currentSwitch.value = null;
|
||||||
|
switchTimingCtrlList.value = [];
|
||||||
|
};
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
getList();
|
getList();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -46,17 +46,17 @@
|
|||||||
<el-table-column label="塘口名称" align="center" prop="pondName" />
|
<el-table-column label="塘口名称" align="center" prop="pondName" />
|
||||||
<el-table-column label="设备名称" align="center" prop="deviceName" />
|
<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="serialNum" width="150"/>
|
||||||
<el-table-column label="开关序号" align="center" prop="index" width="100"/>
|
<el-table-column label="开关序号" align="center" prop="index" width="80"/>
|
||||||
<el-table-column label="开关名称" align="center" prop="switchName" />
|
<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">
|
<template #default="scope">
|
||||||
<dict-tag :options="open_close" :value="scope.row.isOpen"/>
|
<dict-tag :options="open_close" :value="scope.row.isOpen"/>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="当前测定电流" align="center" prop="detectElectricValue" />
|
<el-table-column label="当前测定电流" align="center" prop="detectElectricValue" />
|
||||||
<el-table-column label="当前测定电压" align="center" prop="detectVoltageValue" />
|
<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">
|
<template #default="scope">
|
||||||
<dict-tag :options="connect_voltage_type" :value="scope.row.connectVoltageType"/>
|
<dict-tag :options="connect_voltage_type" :value="scope.row.connectVoltageType"/>
|
||||||
</template>
|
</template>
|
||||||
@@ -68,15 +68,19 @@
|
|||||||
<dict-tag :options="open_close" :value="scope.row.electricWarnOpen"/>
|
<dict-tag :options="open_close" :value="scope.row.electricWarnOpen"/>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="联动状态" align="center" prop="isLinkedCtrl">
|
<el-table-column label="联动状态" align="center" prop="isLinkedCtrl" width="80">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<dict-tag :options="is_linked_ctrl" :value="scope.row.isLinkedCtrl"/>
|
<dict-tag :options="is_linked_ctrl" :value="scope.row.isLinkedCtrl"/>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="上次操作开关时间" align="center" prop="lastTurnTime" width="180">
|
<el-table-column label="上次操作开关时间" align="center" prop="lastTurnTime" width="160"> </el-table-column>
|
||||||
</el-table-column>
|
<el-table-column label="定时控制数量" align="center" prop="timingCtrlCount" width="110"/>
|
||||||
<el-table-column label="操作" align="center" fixed="right" class-name="small-padding fixed-width">
|
|
||||||
|
<el-table-column label="操作" align="center" fixed="right" width="160" class-name="small-padding fixed-width">
|
||||||
<template #default="scope">
|
<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-tooltip content="修改" placement="top">
|
||||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['fishery:deviceSwitch:edit']"></el-button>
|
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['fishery:deviceSwitch:edit']"></el-button>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
@@ -159,15 +163,48 @@
|
|||||||
<el-dialog title="选择设备" v-model="deviceSelectVisible" width="1200px" append-to-body>
|
<el-dialog title="选择设备" v-model="deviceSelectVisible" width="1200px" append-to-body>
|
||||||
<!-- 搜索条件 -->
|
<!-- 搜索条件 -->
|
||||||
<el-form :model="deviceQueryParams" :inline="true" class="mb-4">
|
<el-form :model="deviceQueryParams" :inline="true" class="mb-4">
|
||||||
<el-form-item label="设备信息">
|
<el-form-item label="用户信息">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="deviceQueryParams.params.deviceKeyword"
|
v-model="deviceQueryParams.params.userKeyword"
|
||||||
placeholder="请输入设备名称或设备编号"
|
placeholder="请输入用户名或手机号"
|
||||||
clearable
|
clearable
|
||||||
style="width: 200px"
|
style="width: 200px"
|
||||||
@keyup.enter="handleDeviceQuery"
|
@keyup.enter="handleDeviceQuery"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</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-form-item>
|
||||||
<el-button type="primary" icon="Search" @click="handleDeviceQuery">搜索</el-button>
|
<el-button type="primary" icon="Search" @click="handleDeviceQuery">搜索</el-button>
|
||||||
<el-button icon="Refresh" @click="resetDeviceQuery">重置</el-button>
|
<el-button icon="Refresh" @click="resetDeviceQuery">重置</el-button>
|
||||||
@@ -181,12 +218,12 @@
|
|||||||
height="400px"
|
height="400px"
|
||||||
border
|
border
|
||||||
>
|
>
|
||||||
<el-table-column label="设备编号" align="center" prop="serialNum" width="150" />
|
<el-table-column label="用户名" align="center" prop="userName" />
|
||||||
<el-table-column label="设备名称" align="center" prop="deviceName" width="120" />
|
<el-table-column label="手机号" align="center" prop="mobilePhone" />
|
||||||
<el-table-column label="用户名" align="center" prop="userName" width="120" />
|
<el-table-column label="设备编号" align="center" prop="serialNum" />
|
||||||
<el-table-column label="手机号" align="center" prop="mobilePhone" width="120" />
|
<el-table-column label="设备名称" align="center" prop="deviceName" />
|
||||||
<el-table-column label="塘口名称" align="center" prop="pondName" width="120" />
|
<el-table-column label="塘口名称" align="center" prop="pondName" />
|
||||||
<el-table-column label="设备类型" align="center" prop="deviceType" width="120">
|
<el-table-column label="设备类型" align="center" prop="deviceType">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<dict-tag :options="aqu_device_type" :value="scope.row.deviceType"/>
|
<dict-tag :options="aqu_device_type" :value="scope.row.deviceType"/>
|
||||||
</template>
|
</template>
|
||||||
@@ -196,7 +233,12 @@
|
|||||||
<span>{{ parseTime(scope.row.bindTime, '{y}-{m}-{d}') }}</span>
|
<span>{{ parseTime(scope.row.bindTime, '{y}-{m}-{d}') }}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</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">
|
<template #default="scope">
|
||||||
<el-button
|
<el-button
|
||||||
type="primary"
|
type="primary"
|
||||||
@@ -225,6 +267,40 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
</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>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -233,9 +309,11 @@ import { listDeviceSwitch, getDeviceSwitch, delDeviceSwitch, addDeviceSwitch, up
|
|||||||
import { DeviceSwitchVO, DeviceSwitchQuery, DeviceSwitchForm } from '@/api/fishery/deviceSwitch/types';
|
import { DeviceSwitchVO, DeviceSwitchQuery, DeviceSwitchForm } from '@/api/fishery/deviceSwitch/types';
|
||||||
import { listDevice } from '@/api/fishery/device';
|
import { listDevice } from '@/api/fishery/device';
|
||||||
import { DeviceVO } from '@/api/fishery/device/types';
|
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 { 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 deviceSwitchList = ref<DeviceSwitchVO[]>([]);
|
||||||
const buttonLoading = ref(false);
|
const buttonLoading = ref(false);
|
||||||
@@ -254,20 +332,32 @@ const deviceSelectVisible = ref(false);
|
|||||||
const deviceQueryParams = reactive<{
|
const deviceQueryParams = reactive<{
|
||||||
pageNum: number;
|
pageNum: number;
|
||||||
pageSize: number;
|
pageSize: number;
|
||||||
|
serialNum?: string;
|
||||||
|
deviceName?: string;
|
||||||
deviceType?: number;
|
deviceType?: number;
|
||||||
params: {
|
params: {
|
||||||
|
userKeyword?: string;
|
||||||
deviceKeyword?: string;
|
deviceKeyword?: string;
|
||||||
};
|
};
|
||||||
}>({
|
}>({
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
|
serialNum: undefined,
|
||||||
|
deviceName: undefined,
|
||||||
deviceType: 2, // 默认查询测控一体机(假设值为2)
|
deviceType: 2, // 默认查询测控一体机(假设值为2)
|
||||||
params: {
|
params: {
|
||||||
|
userKeyword: undefined,
|
||||||
deviceKeyword: undefined
|
deviceKeyword: undefined
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
const deviceTotal = ref(0);
|
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 queryFormRef = ref<ElFormInstance>();
|
||||||
const deviceSwitchFormRef = ref<ElFormInstance>();
|
const deviceSwitchFormRef = ref<ElFormInstance>();
|
||||||
|
|
||||||
@@ -469,7 +559,10 @@ const getDeviceList = async () => {
|
|||||||
const openDeviceSelect = () => {
|
const openDeviceSelect = () => {
|
||||||
// 重置搜索条件
|
// 重置搜索条件
|
||||||
deviceQueryParams.pageNum = 1;
|
deviceQueryParams.pageNum = 1;
|
||||||
|
deviceQueryParams.serialNum = undefined;
|
||||||
|
deviceQueryParams.deviceName = undefined;
|
||||||
deviceQueryParams.deviceType = 2; // 测控一体机类型
|
deviceQueryParams.deviceType = 2; // 测控一体机类型
|
||||||
|
deviceQueryParams.params.userKeyword = undefined;
|
||||||
deviceQueryParams.params.deviceKeyword = undefined;
|
deviceQueryParams.params.deviceKeyword = undefined;
|
||||||
getDeviceList();
|
getDeviceList();
|
||||||
deviceSelectVisible.value = true;
|
deviceSelectVisible.value = true;
|
||||||
@@ -484,7 +577,10 @@ const handleDeviceQuery = () => {
|
|||||||
/** 重置设备搜索 */
|
/** 重置设备搜索 */
|
||||||
const resetDeviceQuery = () => {
|
const resetDeviceQuery = () => {
|
||||||
deviceQueryParams.pageNum = 1;
|
deviceQueryParams.pageNum = 1;
|
||||||
|
deviceQueryParams.serialNum = undefined;
|
||||||
|
deviceQueryParams.deviceName = undefined;
|
||||||
deviceQueryParams.deviceType = 2; // 测控一体机类型
|
deviceQueryParams.deviceType = 2; // 测控一体机类型
|
||||||
|
deviceQueryParams.params.userKeyword = undefined;
|
||||||
deviceQueryParams.params.deviceKeyword = undefined;
|
deviceQueryParams.params.deviceKeyword = undefined;
|
||||||
getDeviceList();
|
getDeviceList();
|
||||||
};
|
};
|
||||||
@@ -515,6 +611,38 @@ const cancelDeviceSelect = () => {
|
|||||||
deviceSelectVisible.value = false;
|
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(() => {
|
onMounted(() => {
|
||||||
getList();
|
getList();
|
||||||
});
|
});
|
||||||
|
|||||||
524
src/views/fishery/linkedCtrl/index.vue
Normal file
524
src/views/fishery/linkedCtrl/index.vue
Normal file
@@ -0,0 +1,524 @@
|
|||||||
|
<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" label-width="160px">
|
||||||
|
<el-form-item label="用户信息" prop="params.userKeyword">
|
||||||
|
<el-input v-model="queryParams.params.userKeyword" placeholder="请输入用户名或手机号" clearable @keyup.enter="handleQuery" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="设备信息" prop="params.deviceKeyword">
|
||||||
|
<el-input v-model="queryParams.params.deviceKeyword" placeholder="请输入设备名称或设备编号" clearable @keyup.enter="handleQuery" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="溶解氧上限开关" prop="oxyUpperOpen">
|
||||||
|
<el-select v-model="queryParams.oxyUpperOpen" placeholder="请选择溶解氧上限开关" clearable >
|
||||||
|
<el-option v-for="dict in open_close" :key="dict.value" :label="dict.label" :value="dict.value"/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="溶解氧下限开关" prop="oxyLowerOpen">
|
||||||
|
<el-select v-model="queryParams.oxyLowerOpen" placeholder="请选择溶解氧下限开关" clearable >
|
||||||
|
<el-option v-for="dict in open_close" :key="dict.value" :label="dict.label" :value="dict.value"/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="是否触发上限关闭操作" prop="isOxyUpperTrigger">
|
||||||
|
<el-select v-model="queryParams.isOxyUpperTrigger" placeholder="请选择是否触发上限关闭操作" clearable >
|
||||||
|
<el-option v-for="dict in yes_no" :key="dict.value" :label="dict.label" :value="dict.value"/>
|
||||||
|
</el-select>
|
||||||
|
</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="['fishery:linkedCtrl:add']">新增</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate()" v-hasPermi="['fishery:linkedCtrl:edit']">修改</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['fishery:linkedCtrl:remove']">删除</el-button>
|
||||||
|
</el-col>
|
||||||
|
<!-- <el-col :span="1.5">
|
||||||
|
<el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['fishery:linkedCtrl: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="linkedCtrlList" @selection-change="handleSelectionChange">
|
||||||
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
|
<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="oxyUpperOpen">
|
||||||
|
<template #default="scope">
|
||||||
|
<dict-tag :options="open_close" :value="scope.row.oxyUpperOpen"/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="溶解氧上限值" align="center" prop="oxyUpperValue" />
|
||||||
|
<el-table-column label="溶解氧下限开关" align="center" prop="oxyLowerOpen">
|
||||||
|
<template #default="scope">
|
||||||
|
<dict-tag :options="open_close" :value="scope.row.oxyLowerOpen"/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="溶解氧下限值" align="center" prop="oxyLowerValue" />
|
||||||
|
<el-table-column label="是否触发上限关闭操作" align="center" prop="isOxyUpperTrigger">
|
||||||
|
<template #default="scope">
|
||||||
|
<dict-tag :options="yes_no" :value="scope.row.isOxyUpperTrigger"/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" align="center" fixed="right" class-name="small-padding fixed-width">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-tooltip content="修改" placement="top">
|
||||||
|
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['fishery:linkedCtrl:edit']"></el-button>
|
||||||
|
</el-tooltip>
|
||||||
|
<el-tooltip content="删除" placement="top">
|
||||||
|
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['fishery:linkedCtrl: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" v-model="dialog.visible" width="600px" append-to-body>
|
||||||
|
<el-form ref="linkedCtrlFormRef" :model="form" :rules="rules" label-width="180px">
|
||||||
|
<el-form-item label="设备" prop="deviceId">
|
||||||
|
<el-input
|
||||||
|
v-model="selectedDeviceDisplay"
|
||||||
|
placeholder="请选择设备"
|
||||||
|
readonly
|
||||||
|
style="width: calc(100% - 90px); cursor: pointer;"
|
||||||
|
@click="openDeviceSelect"
|
||||||
|
>
|
||||||
|
<template #suffix>
|
||||||
|
<el-icon><Search /></el-icon>
|
||||||
|
</template>
|
||||||
|
</el-input>
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
style="margin-left: 10px;"
|
||||||
|
@click="openDeviceSelect"
|
||||||
|
>
|
||||||
|
选择
|
||||||
|
</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="溶解氧上限开关" prop="oxyUpperOpen">
|
||||||
|
<el-select v-model="form.oxyUpperOpen" placeholder="请选择溶解氧上限开关">
|
||||||
|
<el-option
|
||||||
|
v-for="dict in open_close"
|
||||||
|
:key="dict.value"
|
||||||
|
:label="dict.label"
|
||||||
|
:value="parseInt(dict.value)"
|
||||||
|
></el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="溶解氧上限值" prop="oxyUpperValue">
|
||||||
|
<el-input v-model="form.oxyUpperValue" placeholder="请输入溶解氧上限值" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="溶解氧下限开关" prop="oxyLowerOpen">
|
||||||
|
<el-select v-model="form.oxyLowerOpen" placeholder="请选择溶解氧下限开关">
|
||||||
|
<el-option
|
||||||
|
v-for="dict in open_close"
|
||||||
|
:key="dict.value"
|
||||||
|
:label="dict.label"
|
||||||
|
:value="parseInt(dict.value)"
|
||||||
|
></el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="溶解氧下限值" prop="oxyLowerValue">
|
||||||
|
<el-input v-model="form.oxyLowerValue" placeholder="请输入溶解氧下限值" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="是否触发上限关闭操作" prop="isOxyUpperTrigger">
|
||||||
|
<el-select v-model="form.isOxyUpperTrigger" placeholder="请选择是否触发上限关闭操作">
|
||||||
|
<el-option
|
||||||
|
v-for="dict in yes_no"
|
||||||
|
:key="dict.value"
|
||||||
|
:label="dict.label"
|
||||||
|
:value="parseInt(dict.value)"
|
||||||
|
></el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="备注" prop="remark">
|
||||||
|
<el-input v-model="form.remark" type="textarea" 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="选择设备" v-model="deviceSelectVisible" width="1200px" append-to-body>
|
||||||
|
<!-- 搜索条件 -->
|
||||||
|
<el-form :model="deviceQueryParams" :inline="true" class="mb-4">
|
||||||
|
<el-form-item label="用户信息">
|
||||||
|
<el-input
|
||||||
|
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>
|
||||||
|
<el-button type="primary" icon="Search" @click="handleDeviceQuery">搜索</el-button>
|
||||||
|
<el-button icon="Refresh" @click="resetDeviceQuery">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<!-- 设备表格 -->
|
||||||
|
<el-table
|
||||||
|
:data="deviceList"
|
||||||
|
highlight-current-row
|
||||||
|
height="400px"
|
||||||
|
border
|
||||||
|
>
|
||||||
|
<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="bindTime" width="120">
|
||||||
|
<template #default="scope">
|
||||||
|
<span>{{ parseTime(scope.row.bindTime, '{y}-{m}-{d}') }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<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"
|
||||||
|
size="small"
|
||||||
|
@click="handleDeviceSelect(scope.row)"
|
||||||
|
>
|
||||||
|
选择
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<!-- 分页 -->
|
||||||
|
<pagination
|
||||||
|
v-show="deviceTotal > 0"
|
||||||
|
:total="deviceTotal"
|
||||||
|
v-model:page="deviceQueryParams.pageNum"
|
||||||
|
v-model:limit="deviceQueryParams.pageSize"
|
||||||
|
@pagination="handleDevicePaginationChange"
|
||||||
|
class="mt-4"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<template #footer>
|
||||||
|
<div class="dialog-footer">
|
||||||
|
<el-button @click="cancelDeviceSelect">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup name="LinkedCtrl" lang="ts">
|
||||||
|
import { listLinkedCtrl, getLinkedCtrl, delLinkedCtrl, addLinkedCtrl, updateLinkedCtrl } from '@/api/fishery/linkedCtrl';
|
||||||
|
import { LinkedCtrlVO, LinkedCtrlQuery, LinkedCtrlForm } from '@/api/fishery/linkedCtrl/types';
|
||||||
|
import { listDevice } from '@/api/fishery/device';
|
||||||
|
import { DeviceVO } from '@/api/fishery/device/types';
|
||||||
|
|
||||||
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||||
|
const { yes_no, open_close } = toRefs<any>(proxy?.useDict('yes_no', 'open_close'));
|
||||||
|
|
||||||
|
const linkedCtrlList = ref<LinkedCtrlVO[]>([]);
|
||||||
|
const buttonLoading = ref(false);
|
||||||
|
const loading = ref(true);
|
||||||
|
const showSearch = ref(true);
|
||||||
|
const ids = ref<Array<string | number>>([]);
|
||||||
|
const single = ref(true);
|
||||||
|
const multiple = ref(true);
|
||||||
|
const total = ref(0);
|
||||||
|
|
||||||
|
// 设备选择相关
|
||||||
|
const deviceList = ref<DeviceVO[]>([]);
|
||||||
|
const selectedDevice = ref<DeviceVO | null>(null);
|
||||||
|
const deviceSelectVisible = ref(false);
|
||||||
|
const deviceQueryParams = reactive<{
|
||||||
|
pageNum: number;
|
||||||
|
pageSize: number;
|
||||||
|
serialNum?: string;
|
||||||
|
deviceName?: string;
|
||||||
|
params: {
|
||||||
|
userKeyword?: string;
|
||||||
|
};
|
||||||
|
}>({
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
serialNum: undefined,
|
||||||
|
deviceName: undefined,
|
||||||
|
params: {
|
||||||
|
userKeyword: undefined
|
||||||
|
}
|
||||||
|
});
|
||||||
|
const deviceTotal = ref(0);
|
||||||
|
|
||||||
|
// 设备显示文本
|
||||||
|
const selectedDeviceDisplay = computed(() => {
|
||||||
|
if (selectedDevice.value) {
|
||||||
|
return `${selectedDevice.value.deviceName} (${selectedDevice.value.serialNum})`;
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
});
|
||||||
|
|
||||||
|
const queryFormRef = ref<ElFormInstance>();
|
||||||
|
const linkedCtrlFormRef = ref<ElFormInstance>();
|
||||||
|
|
||||||
|
const dialog = reactive<DialogOption>({
|
||||||
|
visible: false,
|
||||||
|
title: ''
|
||||||
|
});
|
||||||
|
|
||||||
|
const initFormData: LinkedCtrlForm = {
|
||||||
|
id: undefined,
|
||||||
|
deviceId: undefined,
|
||||||
|
oxyUpperOpen: undefined,
|
||||||
|
oxyUpperValue: undefined,
|
||||||
|
oxyLowerOpen: undefined,
|
||||||
|
oxyLowerValue: undefined,
|
||||||
|
isOxyUpperTrigger: undefined,
|
||||||
|
remark: undefined
|
||||||
|
}
|
||||||
|
const data = reactive<PageData<LinkedCtrlForm, LinkedCtrlQuery>>({
|
||||||
|
form: {...initFormData},
|
||||||
|
queryParams: {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
deviceId: undefined,
|
||||||
|
oxyUpperOpen: undefined,
|
||||||
|
oxyLowerOpen: undefined,
|
||||||
|
isOxyUpperTrigger: undefined,
|
||||||
|
params: {
|
||||||
|
}
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
deviceId: [
|
||||||
|
{ required: true, message: "设备不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
oxyUpperOpen: [
|
||||||
|
{ required: true, message: "溶解氧上限开关不能为空", trigger: "change" }
|
||||||
|
],
|
||||||
|
oxyUpperValue: [
|
||||||
|
{ required: true, message: "溶解氧上限值不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
oxyLowerOpen: [
|
||||||
|
{ required: true, message: "溶解氧下限开关不能为空", trigger: "change" }
|
||||||
|
],
|
||||||
|
oxyLowerValue: [
|
||||||
|
{ required: true, message: "溶解氧下限值不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
isOxyUpperTrigger: [
|
||||||
|
{ required: true, message: "是否触发上限关闭操作不能为空", trigger: "change" }
|
||||||
|
],
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const { queryParams, form, rules } = toRefs(data);
|
||||||
|
|
||||||
|
/** 查询溶解氧联动控制列表 */
|
||||||
|
const getList = async () => {
|
||||||
|
loading.value = true;
|
||||||
|
const res = await listLinkedCtrl(queryParams.value);
|
||||||
|
linkedCtrlList.value = res.rows;
|
||||||
|
total.value = res.total;
|
||||||
|
loading.value = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 取消按钮 */
|
||||||
|
const cancel = () => {
|
||||||
|
reset();
|
||||||
|
dialog.visible = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 表单重置 */
|
||||||
|
const reset = () => {
|
||||||
|
form.value = {...initFormData};
|
||||||
|
selectedDevice.value = null;
|
||||||
|
linkedCtrlFormRef.value?.resetFields();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
const handleQuery = () => {
|
||||||
|
queryParams.value.pageNum = 1;
|
||||||
|
getList();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
const resetQuery = () => {
|
||||||
|
queryFormRef.value?.resetFields();
|
||||||
|
handleQuery();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 多选框选中数据 */
|
||||||
|
const handleSelectionChange = (selection: LinkedCtrlVO[]) => {
|
||||||
|
ids.value = selection.map(item => item.id);
|
||||||
|
single.value = selection.length != 1;
|
||||||
|
multiple.value = !selection.length;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 新增按钮操作 */
|
||||||
|
const handleAdd = () => {
|
||||||
|
reset();
|
||||||
|
dialog.visible = true;
|
||||||
|
dialog.title = "添加溶解氧联动控制";
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 修改按钮操作 */
|
||||||
|
const handleUpdate = async (row?: LinkedCtrlVO) => {
|
||||||
|
reset();
|
||||||
|
const _id = row?.id || ids.value[0]
|
||||||
|
const res = await getLinkedCtrl(_id);
|
||||||
|
Object.assign(form.value, res.data);
|
||||||
|
|
||||||
|
// 回显设备信息
|
||||||
|
if (form.value.deviceId) {
|
||||||
|
try {
|
||||||
|
const deviceRes = await listDevice({
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 1000
|
||||||
|
});
|
||||||
|
const deviceListData = deviceRes.rows || deviceRes.data || [];
|
||||||
|
const device = deviceListData.find(d => d.id.toString() === form.value.deviceId.toString());
|
||||||
|
if (device) {
|
||||||
|
selectedDevice.value = device;
|
||||||
|
} else {
|
||||||
|
selectedDevice.value = null;
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('加载设备信息失败:', error);
|
||||||
|
selectedDevice.value = null;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
selectedDevice.value = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
dialog.visible = true;
|
||||||
|
dialog.title = "修改溶解氧联动控制";
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 提交按钮 */
|
||||||
|
const submitForm = () => {
|
||||||
|
linkedCtrlFormRef.value?.validate(async (valid: boolean) => {
|
||||||
|
if (valid) {
|
||||||
|
buttonLoading.value = true;
|
||||||
|
if (form.value.id) {
|
||||||
|
await updateLinkedCtrl(form.value).finally(() => buttonLoading.value = false);
|
||||||
|
} else {
|
||||||
|
await addLinkedCtrl(form.value).finally(() => buttonLoading.value = false);
|
||||||
|
}
|
||||||
|
proxy?.$modal.msgSuccess("操作成功");
|
||||||
|
dialog.visible = false;
|
||||||
|
await getList();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 删除按钮操作 */
|
||||||
|
const handleDelete = async (row?: LinkedCtrlVO) => {
|
||||||
|
const _ids = row?.id || ids.value;
|
||||||
|
await proxy?.$modal.confirm('是否确认删除溶解氧联动控制编号为"' + _ids + '"的数据项?').finally(() => loading.value = false);
|
||||||
|
await delLinkedCtrl(_ids);
|
||||||
|
proxy?.$modal.msgSuccess("删除成功");
|
||||||
|
await getList();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 导出按钮操作 */
|
||||||
|
const handleExport = () => {
|
||||||
|
proxy?.download('fishery/linkedCtrl/export', {
|
||||||
|
...queryParams.value
|
||||||
|
}, `linkedCtrl_${new Date().getTime()}.xlsx`)
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 获取设备列表 */
|
||||||
|
const getDeviceList = async () => {
|
||||||
|
const res = await listDevice(deviceQueryParams);
|
||||||
|
deviceList.value = res.rows || res.data || [];
|
||||||
|
deviceTotal.value = res.total || 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 打开设备选择对话框 */
|
||||||
|
const openDeviceSelect = () => {
|
||||||
|
deviceQueryParams.pageNum = 1;
|
||||||
|
deviceQueryParams.serialNum = undefined;
|
||||||
|
deviceQueryParams.deviceName = undefined;
|
||||||
|
deviceQueryParams.params.userKeyword = undefined;
|
||||||
|
getDeviceList();
|
||||||
|
deviceSelectVisible.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 搜索设备 */
|
||||||
|
const handleDeviceQuery = () => {
|
||||||
|
deviceQueryParams.pageNum = 1;
|
||||||
|
getDeviceList();
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 重置设备搜索 */
|
||||||
|
const resetDeviceQuery = () => {
|
||||||
|
deviceQueryParams.pageNum = 1;
|
||||||
|
deviceQueryParams.serialNum = undefined;
|
||||||
|
deviceQueryParams.deviceName = undefined;
|
||||||
|
deviceQueryParams.params.userKeyword = undefined;
|
||||||
|
getDeviceList();
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 设备分页改变 */
|
||||||
|
const handleDevicePaginationChange = () => {
|
||||||
|
getDeviceList();
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 选择设备 */
|
||||||
|
const handleDeviceSelect = (device: DeviceVO) => {
|
||||||
|
selectedDevice.value = device;
|
||||||
|
form.value.deviceId = device.id;
|
||||||
|
deviceSelectVisible.value = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 取消设备选择 */
|
||||||
|
const cancelDeviceSelect = () => {
|
||||||
|
deviceSelectVisible.value = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
getList();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
513
src/views/fishery/timingCtrl/index.vue
Normal file
513
src/views/fishery/timingCtrl/index.vue
Normal file
@@ -0,0 +1,513 @@
|
|||||||
|
<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="用户信息" prop="params.userKeyword">
|
||||||
|
<el-input v-model="queryParams.params.userKeyword" placeholder="请输入用户名或手机号" clearable @keyup.enter="handleQuery" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="设备信息" prop="params.deviceKeyword">
|
||||||
|
<el-input v-model="queryParams.params.deviceKeyword" placeholder="请输入设备名称或设备编号" clearable @keyup.enter="handleQuery" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="开关名称" prop="params.switchKeyword">
|
||||||
|
<el-input v-model="queryParams.params.switchKeyword" placeholder="请输入开关名称" clearable @keyup.enter="handleQuery" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="循环类型" prop="loopType">
|
||||||
|
<el-select v-model="queryParams.loopType" placeholder="请选择循环类型" clearable >
|
||||||
|
<el-option v-for="dict in loop_type" :key="dict.value" :label="dict.label" :value="dict.value"/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="是否启用" prop="isOpen">
|
||||||
|
<el-select v-model="queryParams.isOpen" placeholder="请选择是否启用" clearable >
|
||||||
|
<el-option v-for="dict in open_close" :key="dict.value" :label="dict.label" :value="dict.value"/>
|
||||||
|
</el-select>
|
||||||
|
</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="['fishery:timingCtrl:add']">新增</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate()" v-hasPermi="['fishery:timingCtrl:edit']">修改</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['fishery:timingCtrl:remove']">删除</el-button>
|
||||||
|
</el-col>
|
||||||
|
<!-- <el-col :span="1.5">
|
||||||
|
<el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['fishery:timingCtrl: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="timingCtrlList" @selection-change="handleSelectionChange">
|
||||||
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
|
<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="switchName"/>
|
||||||
|
<el-table-column label="开启时间" align="center" prop="openTime" width="180">
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="关闭时间" align="center" prop="closeTime" width="180">
|
||||||
|
</el-table-column>
|
||||||
|
<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-column label="操作" align="center" fixed="right" class-name="small-padding fixed-width">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-tooltip content="修改" placement="top">
|
||||||
|
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['fishery:timingCtrl:edit']"></el-button>
|
||||||
|
</el-tooltip>
|
||||||
|
<el-tooltip content="删除" placement="top">
|
||||||
|
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['fishery:timingCtrl: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" v-model="dialog.visible" width="500px" append-to-body>
|
||||||
|
<el-form ref="timingCtrlFormRef" :model="form" :rules="rules" label-width="80px">
|
||||||
|
<el-form-item label="开关" prop="switchId">
|
||||||
|
<el-input
|
||||||
|
v-model="selectedSwitchDisplay"
|
||||||
|
placeholder="请选择开关"
|
||||||
|
readonly
|
||||||
|
style="width: calc(100% - 90px); cursor: pointer;"
|
||||||
|
@click="openSwitchSelect"
|
||||||
|
>
|
||||||
|
<template #suffix>
|
||||||
|
<el-icon><Search /></el-icon>
|
||||||
|
</template>
|
||||||
|
</el-input>
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
style="margin-left: 10px;"
|
||||||
|
@click="openSwitchSelect"
|
||||||
|
>
|
||||||
|
选择
|
||||||
|
</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="开启时间" prop="openTime">
|
||||||
|
<el-date-picker clearable
|
||||||
|
v-model="form.openTime"
|
||||||
|
type="datetime"
|
||||||
|
value-format="YYYY-MM-DD HH:mm:ss"
|
||||||
|
placeholder="请选择开启时间">
|
||||||
|
</el-date-picker>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="关闭时间" prop="closeTime">
|
||||||
|
<el-date-picker clearable
|
||||||
|
v-model="form.closeTime"
|
||||||
|
type="datetime"
|
||||||
|
value-format="YYYY-MM-DD HH:mm:ss"
|
||||||
|
placeholder="请选择关闭时间">
|
||||||
|
</el-date-picker>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="循环类型" prop="loopType">
|
||||||
|
<el-select v-model="form.loopType" placeholder="请选择循环类型">
|
||||||
|
<el-option
|
||||||
|
v-for="dict in loop_type"
|
||||||
|
:key="dict.value"
|
||||||
|
:label="dict.label"
|
||||||
|
:value="parseInt(dict.value)"
|
||||||
|
></el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="是否启用" prop="isOpen">
|
||||||
|
<el-select v-model="form.isOpen" placeholder="请选择是否启用">
|
||||||
|
<el-option
|
||||||
|
v-for="dict in open_close"
|
||||||
|
:key="dict.value"
|
||||||
|
:label="dict.label"
|
||||||
|
:value="parseInt(dict.value)"
|
||||||
|
></el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="备注" prop="remark">
|
||||||
|
<el-input v-model="form.remark" type="textarea" 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="选择开关" v-model="switchSelectVisible" width="1200px" append-to-body>
|
||||||
|
<!-- 搜索条件 -->
|
||||||
|
<el-form :model="switchQueryParams" :inline="true" class="mb-4">
|
||||||
|
<el-form-item label="用户信息">
|
||||||
|
<el-input
|
||||||
|
v-model="switchQueryParams.params.userKeyword"
|
||||||
|
placeholder="请输入用户名或手机号"
|
||||||
|
clearable
|
||||||
|
style="width: 200px"
|
||||||
|
@keyup.enter="handleSwitchQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="设备编号">
|
||||||
|
<el-input
|
||||||
|
v-model="switchQueryParams.params.deviceKeyword"
|
||||||
|
placeholder="请输入设备编号"
|
||||||
|
clearable
|
||||||
|
style="width: 180px"
|
||||||
|
@keyup.enter="handleSwitchQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="开关名称">
|
||||||
|
<el-input
|
||||||
|
v-model="switchQueryParams.switchName"
|
||||||
|
placeholder="请输入开关名称"
|
||||||
|
clearable
|
||||||
|
style="width: 180px"
|
||||||
|
@keyup.enter="handleSwitchQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" icon="Search" @click="handleSwitchQuery">搜索</el-button>
|
||||||
|
<el-button icon="Refresh" @click="resetSwitchQuery">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<!-- 开关表格 -->
|
||||||
|
<el-table
|
||||||
|
:data="switchList"
|
||||||
|
highlight-current-row
|
||||||
|
height="400px"
|
||||||
|
border
|
||||||
|
>
|
||||||
|
<el-table-column label="用户名" align="center" prop="userName" />
|
||||||
|
<el-table-column label="手机号" align="center" prop="mobilePhone" />
|
||||||
|
<el-table-column label="设备编号" align="center" prop="serialNum" width="150"/>
|
||||||
|
<el-table-column label="设备名称" align="center" prop="deviceName" />
|
||||||
|
<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="pondName" />
|
||||||
|
<el-table-column label="当前状态" align="center" prop="isOpen" width="100">
|
||||||
|
<template #default="scope">
|
||||||
|
<dict-tag :options="open_close" :value="scope.row.isOpen"/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" align="center" width="100">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
size="small"
|
||||||
|
@click="handleSwitchSelect(scope.row)"
|
||||||
|
>
|
||||||
|
选择
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<!-- 分页 -->
|
||||||
|
<pagination
|
||||||
|
v-show="switchTotal > 0"
|
||||||
|
:total="switchTotal"
|
||||||
|
v-model:page="switchQueryParams.pageNum"
|
||||||
|
v-model:limit="switchQueryParams.pageSize"
|
||||||
|
@pagination="handleSwitchPaginationChange"
|
||||||
|
class="mt-4"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<template #footer>
|
||||||
|
<div class="dialog-footer">
|
||||||
|
<el-button @click="cancelSwitchSelect">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup name="TimingCtrl" lang="ts">
|
||||||
|
import { listTimingCtrl, getTimingCtrl, delTimingCtrl, addTimingCtrl, updateTimingCtrl } from '@/api/fishery/timingCtrl';
|
||||||
|
import { TimingCtrlVO, TimingCtrlQuery, TimingCtrlForm } from '@/api/fishery/timingCtrl/types';
|
||||||
|
import { listDeviceSwitch } from '@/api/fishery/deviceSwitch';
|
||||||
|
import { DeviceSwitchVO } from '@/api/fishery/deviceSwitch/types';
|
||||||
|
|
||||||
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||||
|
const { loop_type,open_close } = toRefs<any>(proxy?.useDict('loop_type','open_close'));
|
||||||
|
|
||||||
|
const timingCtrlList = ref<TimingCtrlVO[]>([]);
|
||||||
|
const buttonLoading = ref(false);
|
||||||
|
const loading = ref(true);
|
||||||
|
const showSearch = ref(true);
|
||||||
|
const ids = ref<Array<string | number>>([]);
|
||||||
|
const single = ref(true);
|
||||||
|
const multiple = ref(true);
|
||||||
|
const total = ref(0);
|
||||||
|
|
||||||
|
// 开关选择相关
|
||||||
|
const switchList = ref<DeviceSwitchVO[]>([]);
|
||||||
|
const selectedSwitch = ref<DeviceSwitchVO | null>(null);
|
||||||
|
const switchSelectVisible = ref(false);
|
||||||
|
const switchQueryParams = reactive<{
|
||||||
|
pageNum: number;
|
||||||
|
pageSize: number;
|
||||||
|
switchName?: string;
|
||||||
|
params: {
|
||||||
|
userKeyword?: string;
|
||||||
|
deviceKeyword?: string;
|
||||||
|
};
|
||||||
|
}>({
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
switchName: undefined,
|
||||||
|
params: {
|
||||||
|
userKeyword: undefined,
|
||||||
|
deviceKeyword: undefined
|
||||||
|
}
|
||||||
|
});
|
||||||
|
const switchTotal = ref(0);
|
||||||
|
|
||||||
|
// 开关显示文本
|
||||||
|
const selectedSwitchDisplay = computed(() => {
|
||||||
|
if (selectedSwitch.value) {
|
||||||
|
const deviceName = (selectedSwitch.value as any).deviceName || '';
|
||||||
|
return `${selectedSwitch.value.switchName}${deviceName ? ' - ' + deviceName : ''} (序号:${selectedSwitch.value.index})`;
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
});
|
||||||
|
|
||||||
|
const queryFormRef = ref<ElFormInstance>();
|
||||||
|
const timingCtrlFormRef = ref<ElFormInstance>();
|
||||||
|
|
||||||
|
const dialog = reactive<DialogOption>({
|
||||||
|
visible: false,
|
||||||
|
title: ''
|
||||||
|
});
|
||||||
|
|
||||||
|
const initFormData: TimingCtrlForm = {
|
||||||
|
id: undefined,
|
||||||
|
switchId: undefined,
|
||||||
|
openTime: undefined,
|
||||||
|
closeTime: undefined,
|
||||||
|
loopType: undefined,
|
||||||
|
isOpen: undefined,
|
||||||
|
remark: undefined
|
||||||
|
}
|
||||||
|
const data = reactive<PageData<TimingCtrlForm, TimingCtrlQuery>>({
|
||||||
|
form: {...initFormData},
|
||||||
|
queryParams: {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
switchId: undefined,
|
||||||
|
loopType: undefined,
|
||||||
|
isOpen: undefined,
|
||||||
|
params: {
|
||||||
|
}
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
switchId: [
|
||||||
|
{ required: true, message: "开关不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
openTime: [
|
||||||
|
{ required: true, message: "开启时间不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
closeTime: [
|
||||||
|
{ required: true, message: "关闭时间不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
loopType: [
|
||||||
|
{ required: true, message: "循环类型不能为空", trigger: "change" }
|
||||||
|
],
|
||||||
|
isOpen: [
|
||||||
|
{ required: true, message: "是否启用不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const { queryParams, form, rules } = toRefs(data);
|
||||||
|
|
||||||
|
/** 查询开关定时控制列表 */
|
||||||
|
const getList = async () => {
|
||||||
|
loading.value = true;
|
||||||
|
const res = await listTimingCtrl(queryParams.value);
|
||||||
|
timingCtrlList.value = res.rows;
|
||||||
|
total.value = res.total;
|
||||||
|
loading.value = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 取消按钮 */
|
||||||
|
const cancel = () => {
|
||||||
|
reset();
|
||||||
|
dialog.visible = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 表单重置 */
|
||||||
|
const reset = () => {
|
||||||
|
form.value = {...initFormData};
|
||||||
|
selectedSwitch.value = null;
|
||||||
|
timingCtrlFormRef.value?.resetFields();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
const handleQuery = () => {
|
||||||
|
queryParams.value.pageNum = 1;
|
||||||
|
getList();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
const resetQuery = () => {
|
||||||
|
queryFormRef.value?.resetFields();
|
||||||
|
handleQuery();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 多选框选中数据 */
|
||||||
|
const handleSelectionChange = (selection: TimingCtrlVO[]) => {
|
||||||
|
ids.value = selection.map(item => item.id);
|
||||||
|
single.value = selection.length != 1;
|
||||||
|
multiple.value = !selection.length;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 新增按钮操作 */
|
||||||
|
const handleAdd = () => {
|
||||||
|
reset();
|
||||||
|
dialog.visible = true;
|
||||||
|
dialog.title = "添加开关定时控制";
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 修改按钮操作 */
|
||||||
|
const handleUpdate = async (row?: TimingCtrlVO) => {
|
||||||
|
reset();
|
||||||
|
const _id = row?.id || ids.value[0]
|
||||||
|
const res = await getTimingCtrl(_id);
|
||||||
|
Object.assign(form.value, res.data);
|
||||||
|
|
||||||
|
// 回显开关信息
|
||||||
|
if (form.value.switchId) {
|
||||||
|
try {
|
||||||
|
const switchRes = await listDeviceSwitch({
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 1000
|
||||||
|
});
|
||||||
|
const switchListData = switchRes.rows || switchRes.data || [];
|
||||||
|
const switchItem = switchListData.find(s => s.id.toString() === form.value.switchId.toString());
|
||||||
|
if (switchItem) {
|
||||||
|
selectedSwitch.value = switchItem;
|
||||||
|
} else {
|
||||||
|
selectedSwitch.value = null;
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('加载开关信息失败:', error);
|
||||||
|
selectedSwitch.value = null;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
selectedSwitch.value = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
dialog.visible = true;
|
||||||
|
dialog.title = "修改开关定时控制";
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 提交按钮 */
|
||||||
|
const submitForm = () => {
|
||||||
|
timingCtrlFormRef.value?.validate(async (valid: boolean) => {
|
||||||
|
if (valid) {
|
||||||
|
buttonLoading.value = true;
|
||||||
|
if (form.value.id) {
|
||||||
|
await updateTimingCtrl(form.value).finally(() => buttonLoading.value = false);
|
||||||
|
} else {
|
||||||
|
await addTimingCtrl(form.value).finally(() => buttonLoading.value = false);
|
||||||
|
}
|
||||||
|
proxy?.$modal.msgSuccess("操作成功");
|
||||||
|
dialog.visible = false;
|
||||||
|
await getList();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 删除按钮操作 */
|
||||||
|
const handleDelete = async (row?: TimingCtrlVO) => {
|
||||||
|
const _ids = row?.id || ids.value;
|
||||||
|
await proxy?.$modal.confirm('是否确认删除开关定时控制编号为"' + _ids + '"的数据项?').finally(() => loading.value = false);
|
||||||
|
await delTimingCtrl(_ids);
|
||||||
|
proxy?.$modal.msgSuccess("删除成功");
|
||||||
|
await getList();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 导出按钮操作 */
|
||||||
|
const handleExport = () => {
|
||||||
|
proxy?.download('fishery/timingCtrl/export', {
|
||||||
|
...queryParams.value
|
||||||
|
}, `timingCtrl_${new Date().getTime()}.xlsx`)
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 获取开关列表 */
|
||||||
|
const getSwitchList = async () => {
|
||||||
|
const res = await listDeviceSwitch(switchQueryParams);
|
||||||
|
switchList.value = res.rows || res.data || [];
|
||||||
|
switchTotal.value = res.total || 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 打开开关选择对话框 */
|
||||||
|
const openSwitchSelect = () => {
|
||||||
|
switchQueryParams.pageNum = 1;
|
||||||
|
switchQueryParams.switchName = undefined;
|
||||||
|
switchQueryParams.params.userKeyword = undefined;
|
||||||
|
switchQueryParams.params.deviceKeyword = undefined;
|
||||||
|
getSwitchList();
|
||||||
|
switchSelectVisible.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 搜索开关 */
|
||||||
|
const handleSwitchQuery = () => {
|
||||||
|
switchQueryParams.pageNum = 1;
|
||||||
|
getSwitchList();
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 重置开关搜索 */
|
||||||
|
const resetSwitchQuery = () => {
|
||||||
|
switchQueryParams.pageNum = 1;
|
||||||
|
switchQueryParams.switchName = undefined;
|
||||||
|
switchQueryParams.params.userKeyword = undefined;
|
||||||
|
switchQueryParams.params.deviceKeyword = undefined;
|
||||||
|
getSwitchList();
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 开关分页改变 */
|
||||||
|
const handleSwitchPaginationChange = () => {
|
||||||
|
getSwitchList();
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 选择开关 */
|
||||||
|
const handleSwitchSelect = (switchItem: DeviceSwitchVO) => {
|
||||||
|
selectedSwitch.value = switchItem;
|
||||||
|
form.value.switchId = switchItem.id;
|
||||||
|
switchSelectVisible.value = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 取消开关选择 */
|
||||||
|
const cancelSwitchSelect = () => {
|
||||||
|
switchSelectVisible.value = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
getList();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
@@ -48,23 +48,28 @@
|
|||||||
<el-table-column type="selection" width="55" align="center" />
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
<el-table-column v-if="false" label="序号" align="center" prop="noticeId" width="100" />
|
<el-table-column v-if="false" label="序号" align="center" prop="noticeId" width="100" />
|
||||||
<el-table-column label="公告标题" align="center" prop="noticeTitle" :show-overflow-tooltip="true" />
|
<el-table-column label="公告标题" align="center" prop="noticeTitle" :show-overflow-tooltip="true" />
|
||||||
|
<el-table-column label="内容" align="center" prop="noticeContent"/>
|
||||||
<el-table-column label="公告类型" align="center" prop="noticeType" width="100">
|
<el-table-column label="公告类型" align="center" prop="noticeType" width="100">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<dict-tag :options="sys_notice_type" :value="scope.row.noticeType" />
|
<dict-tag :options="sys_notice_type" :value="scope.row.noticeType" />
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
<el-table-column label="状态" align="center" prop="status" width="100">
|
<el-table-column label="状态" align="center" prop="status" width="100">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<dict-tag :options="sys_notice_status" :value="scope.row.status" />
|
<dict-tag :options="sys_notice_status" :value="scope.row.status" />
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="创建者" align="center" prop="createByName" width="100" />
|
<el-table-column label="优先级" align="center" prop="priority" width="100" />
|
||||||
<el-table-column label="创建时间" align="center" prop="createTime" width="100">
|
<el-table-column label="有效期" align="center" prop="deadTime" width="120" >
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<span>{{ proxy.parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
|
<span>{{ proxy.parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
<el-table-column label="操作人员" align="center" prop="createByName" width="120" />
|
||||||
|
<el-table-column label="创建时间" align="center" prop="createTime" width="160">
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" align="center" width="150" class-name="small-padding fixed-width">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-tooltip content="修改" placement="top">
|
<el-tooltip content="修改" placement="top">
|
||||||
<el-button v-hasPermi="['system:notice:edit']" link type="primary" icon="Edit" @click="handleUpdate(scope.row)"></el-button>
|
<el-button v-hasPermi="['system:notice:edit']" link type="primary" icon="Edit" @click="handleUpdate(scope.row)"></el-button>
|
||||||
@@ -94,6 +99,21 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="优先级" prop="priority">
|
||||||
|
<el-input v-model="form.priority" placeholder="请输入优先级" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="有效期" prop="deadTime">
|
||||||
|
<el-date-picker clearable
|
||||||
|
v-model="form.deadTime"
|
||||||
|
type="date"
|
||||||
|
value-format="YYYY-MM-DD"
|
||||||
|
placeholder="请选择有效期">
|
||||||
|
</el-date-picker>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
<el-col :span="24">
|
<el-col :span="24">
|
||||||
<el-form-item label="状态">
|
<el-form-item label="状态">
|
||||||
<el-radio-group v-model="form.status">
|
<el-radio-group v-model="form.status">
|
||||||
@@ -103,7 +123,7 @@
|
|||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="24">
|
<el-col :span="24">
|
||||||
<el-form-item label="内容">
|
<el-form-item label="内容">
|
||||||
<editor v-model="form.noticeContent" :min-height="192" />
|
<editor v-model="form.noticeContent" :min-height="162" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
@@ -148,6 +168,8 @@ const initFormData: NoticeForm = {
|
|||||||
noticeContent: '',
|
noticeContent: '',
|
||||||
status: '0',
|
status: '0',
|
||||||
remark: '',
|
remark: '',
|
||||||
|
priority: 1,
|
||||||
|
deadTime: undefined,
|
||||||
createByName: ''
|
createByName: ''
|
||||||
};
|
};
|
||||||
const data = reactive<PageData<NoticeForm, NoticeQuery>>({
|
const data = reactive<PageData<NoticeForm, NoticeQuery>>({
|
||||||
@@ -162,6 +184,8 @@ const data = reactive<PageData<NoticeForm, NoticeQuery>>({
|
|||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
noticeTitle: [{ required: true, message: '公告标题不能为空', trigger: 'blur' }],
|
noticeTitle: [{ required: true, message: '公告标题不能为空', trigger: 'blur' }],
|
||||||
|
priority: [{ required: true, message: '优先级不能为空', trigger: 'change' }],
|
||||||
|
deadTime: [{ required: true, message: '有效期不能为空', trigger: 'change' }],
|
||||||
noticeType: [{ required: true, message: '公告类型不能为空', trigger: 'change' }]
|
noticeType: [{ required: true, message: '公告类型不能为空', trigger: 'change' }]
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user