温湿度
This commit is contained in:
parent
f980d717ca
commit
fa0d05a03d
|
@ -0,0 +1,114 @@
|
|||
<template>
|
||||
<!--引用表格-->
|
||||
<BasicTable @register="registerTable">
|
||||
<!--插槽:table标题-->
|
||||
<template #tableTitle>
|
||||
</template>
|
||||
<template v-slot:bodyCell="{ column, record, index, text }">
|
||||
</template>
|
||||
</BasicTable>
|
||||
</template>
|
||||
|
||||
<script lang="ts" name="yiweilian-apiLogList" setup>
|
||||
import { ref, reactive } from 'vue';
|
||||
import { BasicTable, useTable, TableAction } from '/@/components/Table';
|
||||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
import { alarmColumns, alarmQuerySchema } from '../humid.data';
|
||||
import { alarmList } from '../humid.api';
|
||||
import { useUserStore } from '/@/store/modules/user';
|
||||
|
||||
const formRef = ref();
|
||||
const queryParam = reactive<any>({});
|
||||
const toggleSearchStatus = ref<boolean>(false);
|
||||
const registerModal = ref();
|
||||
const userStore = useUserStore();
|
||||
//注册table数据
|
||||
const { prefixCls, tableContext } = useListPage({
|
||||
tableProps: {
|
||||
title: '告警日志',
|
||||
api: alarmList,
|
||||
columns:alarmColumns,
|
||||
canResize:false,
|
||||
showActionColumn: false,
|
||||
// showTableSetting: false,
|
||||
formConfig: {
|
||||
//labelWidth: 120,
|
||||
schemas: alarmQuerySchema,
|
||||
autoSubmitOnEnter:false,
|
||||
showAdvancedButton:false,
|
||||
fieldMapToNumber: [
|
||||
],
|
||||
fieldMapToTime: [
|
||||
],
|
||||
},
|
||||
actionColumn: {
|
||||
width: 120,
|
||||
fixed: 'right',
|
||||
},
|
||||
beforeFetch: async (params) => {
|
||||
return Object.assign(params, queryParam);
|
||||
},
|
||||
},
|
||||
});
|
||||
const [registerTable, { reload, collapseAll, updateTableDataRecord, findTableDataRecord, getDataSource }, { rowSelection, selectedRowKeys }] = tableContext;
|
||||
const labelCol = reactive({
|
||||
xs:24,
|
||||
sm:8,
|
||||
xl:6,
|
||||
xxl:8
|
||||
});
|
||||
const wrapperCol = reactive({
|
||||
xs: 24,
|
||||
sm: 16,
|
||||
});
|
||||
|
||||
/**
|
||||
* 高级查询事件
|
||||
*/
|
||||
function handleSuperQuery(params) {
|
||||
Object.keys(params).map((k) => {
|
||||
queryParam[k] = params[k];
|
||||
});
|
||||
searchQuery();
|
||||
}
|
||||
|
||||
/**
|
||||
* 成功回调
|
||||
*/
|
||||
function handleSuccess() {
|
||||
(selectedRowKeys.value = []) && reload();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询
|
||||
*/
|
||||
function searchQuery() {
|
||||
reload();
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置
|
||||
*/
|
||||
function searchReset() {
|
||||
formRef.value.resetFields();
|
||||
selectedRowKeys.value = [];
|
||||
//刷新数据
|
||||
reload();
|
||||
}
|
||||
|
||||
function init(record) {
|
||||
console.log("🚀 ~ init ~ record:", record)
|
||||
queryParam.sn = record.sn;
|
||||
reload();
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
init,
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
|
||||
</style>
|
|
@ -0,0 +1,56 @@
|
|||
<template>
|
||||
<a-tabs v-model:activeKey="activeKey" type="card" @change="handleChange">
|
||||
<a-tab-pane key="1" tab="抄表">
|
||||
<ApiLogList ref="apiLogList"></ApiLogList>
|
||||
</a-tab-pane>
|
||||
<a-tab-pane key="2" tab="告警" force-render>
|
||||
<AlarmList ref="alarmList"></AlarmList>
|
||||
</a-tab-pane>
|
||||
</a-tabs>
|
||||
</template>
|
||||
|
||||
<script lang="ts" name="departUtils-sysDepart" setup>
|
||||
import { ref, reactive } from 'vue';
|
||||
import ApiLogList from './ApiLogList.vue';
|
||||
import AlarmList from './AlarmList.vue';
|
||||
const activeKey= ref('1');
|
||||
const dbsbInfo = ref<any>({});
|
||||
const apiLogList = ref();
|
||||
const alarmList = ref();
|
||||
|
||||
function init(record){
|
||||
activeKey.value = "1";
|
||||
getDataList(activeKey.value, record);
|
||||
dbsbInfo.value = record;
|
||||
}
|
||||
|
||||
function getDataList(type, record) {
|
||||
console.log("🚀 ~ getDataList ~ type, record:", type, record)
|
||||
var params = {
|
||||
sn: record.sn
|
||||
}
|
||||
if(type == '1'){
|
||||
apiLogList.value.init(params);
|
||||
}else if(type == '2'){
|
||||
alarmList.value.init(params);
|
||||
}
|
||||
}
|
||||
|
||||
function handleChange(key) {
|
||||
console.log("🚀 ~ handleChange ~ key:", key)
|
||||
activeKey.value = key;
|
||||
getDataList(key, dbsbInfo.value);
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
init,
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
//:deep(.ant-tabs-nav){
|
||||
// margin: 0 !important;
|
||||
//}
|
||||
</style>
|
|
@ -0,0 +1,66 @@
|
|||
<template>
|
||||
<j-modal :title="title" width="70%" :visible="visible" @ok="handleOk" :okButtonProps="{ class: { 'jee-hidden': disableSubmit } }" @cancel="handleCancel" cancelText="关闭">
|
||||
<ApiLogAlarmList ref="registerForm" @ok="submitCallback" :formDisabled="disableSubmit" :formBpm="false"></ApiLogAlarmList>
|
||||
</j-modal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, nextTick, defineExpose } from 'vue';
|
||||
import ApiLogAlarmList from './ApiLogAlarmList.vue'
|
||||
import JModal from '/@/components/Modal/src/JModal/JModal.vue';
|
||||
|
||||
const title = ref<string>('');
|
||||
const width = ref<number>(800);
|
||||
const visible = ref<boolean>(false);
|
||||
const disableSubmit = ref<boolean>(false);
|
||||
const registerForm = ref();
|
||||
const emit = defineEmits(['register', 'success']);
|
||||
|
||||
|
||||
/**
|
||||
* 日志
|
||||
* @param record
|
||||
*/
|
||||
function showLogAlarm(record) {
|
||||
title.value = '日志';
|
||||
visible.value = true;
|
||||
nextTick(() => {
|
||||
registerForm.value.init(record);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 确定按钮点击事件
|
||||
*/
|
||||
function handleOk() {
|
||||
registerForm.value.submitForm();
|
||||
}
|
||||
|
||||
/**
|
||||
* form保存回调事件
|
||||
*/
|
||||
function submitCallback(params) {
|
||||
handleCancel();
|
||||
emit('success',params);
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消按钮回调事件
|
||||
*/
|
||||
function handleCancel() {
|
||||
visible.value = false;
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
showLogAlarm,
|
||||
disableSubmit,
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="less">
|
||||
/**隐藏样式-modal确定按钮 */
|
||||
.jee-hidden {
|
||||
display: none !important;
|
||||
}
|
||||
</style>
|
||||
<style lang="less" scoped></style>
|
|
@ -0,0 +1,114 @@
|
|||
<template>
|
||||
<!--引用表格-->
|
||||
<BasicTable @register="registerTable">
|
||||
<!--插槽:table标题-->
|
||||
<template #tableTitle>
|
||||
</template>
|
||||
<template v-slot:bodyCell="{ column, record, index, text }">
|
||||
</template>
|
||||
</BasicTable>
|
||||
</template>
|
||||
|
||||
<script lang="ts" name="yiweilian-apiLogList" setup>
|
||||
import { ref, reactive } from 'vue';
|
||||
import { BasicTable, useTable, TableAction } from '/@/components/Table';
|
||||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
import { logColumns, logQuerySchema } from '../humid.data';
|
||||
import { logList } from '../humid.api';
|
||||
import { useUserStore } from '/@/store/modules/user';
|
||||
|
||||
const formRef = ref();
|
||||
const queryParam = reactive<any>({});
|
||||
const toggleSearchStatus = ref<boolean>(false);
|
||||
const registerModal = ref();
|
||||
const userStore = useUserStore();
|
||||
//注册table数据
|
||||
const { prefixCls, tableContext } = useListPage({
|
||||
tableProps: {
|
||||
title: '操作日志',
|
||||
api: logList,
|
||||
columns:logColumns,
|
||||
canResize:false,
|
||||
showActionColumn: false,
|
||||
// showTableSetting: false,
|
||||
formConfig: {
|
||||
//labelWidth: 120,
|
||||
schemas: logQuerySchema,
|
||||
autoSubmitOnEnter:false,
|
||||
showAdvancedButton:false,
|
||||
fieldMapToNumber: [
|
||||
],
|
||||
fieldMapToTime: [
|
||||
],
|
||||
},
|
||||
actionColumn: {
|
||||
width: 120,
|
||||
fixed: 'right',
|
||||
},
|
||||
beforeFetch: async (params) => {
|
||||
return Object.assign(params, queryParam);
|
||||
},
|
||||
},
|
||||
});
|
||||
const [registerTable, { reload, collapseAll, updateTableDataRecord, findTableDataRecord, getDataSource }, { rowSelection, selectedRowKeys }] = tableContext;
|
||||
const labelCol = reactive({
|
||||
xs:24,
|
||||
sm:8,
|
||||
xl:6,
|
||||
xxl:8
|
||||
});
|
||||
const wrapperCol = reactive({
|
||||
xs: 24,
|
||||
sm: 16,
|
||||
});
|
||||
|
||||
/**
|
||||
* 高级查询事件
|
||||
*/
|
||||
function handleSuperQuery(params) {
|
||||
Object.keys(params).map((k) => {
|
||||
queryParam[k] = params[k];
|
||||
});
|
||||
searchQuery();
|
||||
}
|
||||
|
||||
/**
|
||||
* 成功回调
|
||||
*/
|
||||
function handleSuccess() {
|
||||
(selectedRowKeys.value = []) && reload();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询
|
||||
*/
|
||||
function searchQuery() {
|
||||
reload();
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置
|
||||
*/
|
||||
function searchReset() {
|
||||
formRef.value.resetFields();
|
||||
selectedRowKeys.value = [];
|
||||
//刷新数据
|
||||
reload();
|
||||
}
|
||||
|
||||
function init(record) {
|
||||
console.log("🚀 ~ init ~ record:", record)
|
||||
queryParam.sn = record.sn;
|
||||
reload();
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
init,
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
|
||||
</style>
|
|
@ -0,0 +1,119 @@
|
|||
<template>
|
||||
<BasicDrawer
|
||||
v-bind="$attrs"
|
||||
@register="registerDrawer"
|
||||
:title="getTitle"
|
||||
:width="adaptiveWidth"
|
||||
@ok="handleSubmit"
|
||||
:showFooter="showFooter"
|
||||
destroyOnClose
|
||||
>
|
||||
<BasicForm @register="registerForm" >
|
||||
<template #customInput="{ model, field }">
|
||||
<a-button preIcon="ant-design:appstore-outlined" @click="readParameters(model)">读取</a-button>
|
||||
</template>
|
||||
</BasicForm>
|
||||
</BasicDrawer>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import {defineComponent, ref, computed, unref, useAttrs, createVNode, h} from 'vue';
|
||||
import { BasicForm, useForm } from '/@/components/Form/index';
|
||||
import { BasicDrawer, useDrawerInner } from '/@/components/Drawer';
|
||||
import { useDrawerAdaptiveWidth } from '/@/hooks/jeecg/useAdaptiveWidth';
|
||||
import {Modal} from "ant-design-vue";
|
||||
import {ExclamationCircleOutlined} from "@ant-design/icons-vue";
|
||||
import { formSchema } from "../humid.data";
|
||||
import {insertDevice, updateDevice, getDeviceParameters} from '../humid.api';
|
||||
import {getMultitransUrl} from "@/views/iot/tplink/camera/camera.api";
|
||||
|
||||
// 声明Emits
|
||||
const emit = defineEmits(['success', 'register']);
|
||||
const attrs = useAttrs();
|
||||
const isUpdate = ref(true);
|
||||
const rowId = ref('');
|
||||
const departOptions = ref([]);
|
||||
let isFormDepartUser = false;
|
||||
//表单配置
|
||||
const [registerForm, { setProps, resetFields, setFieldsValue, validate, updateSchema }] = useForm({
|
||||
labelWidth: 90,
|
||||
schemas: formSchema,
|
||||
showActionButtonGroup: false,
|
||||
});
|
||||
const showFooter = ref(true);
|
||||
//表单赋值
|
||||
const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => {
|
||||
await resetFields();
|
||||
showFooter.value = data?.showFooter ?? true;
|
||||
setDrawerProps({ confirmLoading: false, showFooter: showFooter.value });
|
||||
isUpdate.value = !!data?.isUpdate;
|
||||
// 无论新增还是编辑,都可以设置表单值
|
||||
if (typeof data.record === 'object') {
|
||||
setFieldsValue({
|
||||
...data.record,
|
||||
});
|
||||
}
|
||||
// 隐藏底部时禁用整个表单
|
||||
setProps({ disabled: !showFooter.value });
|
||||
});
|
||||
//获取标题
|
||||
const getTitle = computed(() => {
|
||||
if (!unref(isUpdate)) {
|
||||
return '新增温湿度';
|
||||
} else {
|
||||
return unref(showFooter) ? '编辑温湿度' : '温湿度详情';
|
||||
}
|
||||
});
|
||||
const { adaptiveWidth } = useDrawerAdaptiveWidth();
|
||||
|
||||
/**
|
||||
* 提交事件
|
||||
*/
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
let values = await validate();
|
||||
console.log('values==>',values);
|
||||
setDrawerProps({ confirmLoading: true });
|
||||
let params = values;
|
||||
console.log('params==>',params);
|
||||
if (!unref(isUpdate)) {
|
||||
//新增
|
||||
await insertDevice(params);
|
||||
} else {
|
||||
//修改
|
||||
await updateDevice(params);
|
||||
}
|
||||
//关闭弹窗
|
||||
closeDrawer();
|
||||
//刷新列表
|
||||
emit('success');
|
||||
} finally {
|
||||
setDrawerProps({ confirmLoading: false });
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 读取参数
|
||||
* @param record
|
||||
*/
|
||||
function readParameters(record){
|
||||
getDeviceParameters({
|
||||
"sn":record.sn
|
||||
}).then(res=> {
|
||||
console.log(res);
|
||||
if (typeof res === 'object') {
|
||||
setFieldsValue({
|
||||
...res,
|
||||
});
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
:deep(.ant-input-number) {
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,60 @@
|
|||
import { defHttp } from '/@/utils/http/axios';
|
||||
|
||||
enum Api {
|
||||
list = '/iot/yiweilian/humidDevice/list',
|
||||
insertDevice = '/iot/yiweilian/humidDevice/insertDevice',
|
||||
updateDevice = '/iot/yiweilian/humidDevice/updateDevice',
|
||||
deleteDevice = '/iot/yiweilian/humidDevice/deleteDevice',
|
||||
getDeviceParameters = '/iot/yiweilian/humidDevice/getDeviceParameters',
|
||||
updateDeviceRealTime = '/iot/yiweilian/humidDevice/updateDeviceRealTime',
|
||||
logList = '/iot/yiweilian/humidDevice/logList',
|
||||
alarmList = '/iot/yiweilian/humidAlarm/list',
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表接口
|
||||
* @param params
|
||||
*/
|
||||
export const list = (params) => defHttp.get({ url: Api.list, params });
|
||||
|
||||
/**
|
||||
* 添加
|
||||
* @param params
|
||||
*/
|
||||
export const insertDevice = (params?) => defHttp.get({ url: Api.insertDevice, params });
|
||||
|
||||
/**
|
||||
* 更新
|
||||
* @param params
|
||||
*/
|
||||
export const updateDevice = (params?) => defHttp.get({ url: Api.updateDevice, params });
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* @param params
|
||||
*/
|
||||
export const deleteDevice = (params?) => defHttp.get({ url: Api.deleteDevice, params });
|
||||
|
||||
/**
|
||||
* 获取设备配置参数
|
||||
* @param params
|
||||
*/
|
||||
export const getDeviceParameters = (params?) => defHttp.get({ url: Api.getDeviceParameters, params });
|
||||
|
||||
/**
|
||||
* 抄表
|
||||
* @param params
|
||||
*/
|
||||
export const updateDeviceRealTime = (params?) => defHttp.get({ url: Api.updateDeviceRealTime, params });
|
||||
|
||||
/**
|
||||
* 操作日志
|
||||
* @param params
|
||||
*/
|
||||
export const logList = (params?) => defHttp.get({ url: Api.logList, params });
|
||||
|
||||
/**
|
||||
* 告警日志
|
||||
* @param params
|
||||
*/
|
||||
export const alarmList = (params?) => defHttp.get({ url: Api.alarmList, params });
|
|
@ -0,0 +1,529 @@
|
|||
import {BasicColumn} from '/@/components/Table';
|
||||
import {FormSchema} from '/@/components/Table';
|
||||
|
||||
//列表数据
|
||||
export const columns: BasicColumn[] = [
|
||||
{
|
||||
title: '机构',
|
||||
align: "center",
|
||||
dataIndex: 'departName'
|
||||
},
|
||||
{
|
||||
title: '护理单元',
|
||||
align: "center",
|
||||
dataIndex: 'nuName'
|
||||
},
|
||||
{
|
||||
title: '设备序号',
|
||||
align: "center",
|
||||
dataIndex: 'sn'
|
||||
},
|
||||
{
|
||||
title: '设备名称',
|
||||
align: "center",
|
||||
dataIndex: 'deviceName'
|
||||
},
|
||||
{
|
||||
title: '告警数',
|
||||
align: "center",
|
||||
dataIndex: 'alarmCn'
|
||||
},
|
||||
{
|
||||
title: '记录间隔',
|
||||
align: "center",
|
||||
dataIndex: 'recordInterval'
|
||||
},
|
||||
{
|
||||
title: '上报间隔',
|
||||
align: "center",
|
||||
dataIndex: 'reportingInterval'
|
||||
},
|
||||
{
|
||||
title: '温度',
|
||||
align: "center",
|
||||
dataIndex: 'temperature'
|
||||
},
|
||||
{
|
||||
title: '湿度',
|
||||
align: "center",
|
||||
dataIndex: 'humidity'
|
||||
},
|
||||
{
|
||||
title: '最新上报时间',
|
||||
align: "center",
|
||||
dataIndex: 'reportingTime'
|
||||
},
|
||||
{
|
||||
title: '电量',
|
||||
align: "center",
|
||||
dataIndex: 'electricity'
|
||||
},
|
||||
{
|
||||
title: '在线状态',
|
||||
align: "center",
|
||||
dataIndex: 'status',
|
||||
customRender:({record})=>{
|
||||
return record.status?(record.status=='0'?'在线':'离线'):'';
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
export const searchFormSchema: FormSchema[] = [
|
||||
{
|
||||
label: '机构',
|
||||
field: 'deviceStatus',
|
||||
component: 'JDictSelectTag',
|
||||
componentProps: {
|
||||
placeholder: '请选择机构',
|
||||
dictCode: 'sys_depart,depart_name,id,org_category = 1 order by depart_name asc',
|
||||
},
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{
|
||||
label: '护理单元',
|
||||
field: 'deviceStatus',
|
||||
component: 'JDictSelectTag',
|
||||
componentProps: {
|
||||
placeholder: '请选择护理单元',
|
||||
dictCode: 'nu_base_info,nu_name,id,del_flag = 0 order by nu_name asc',
|
||||
},
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{
|
||||
label: '设备序号',
|
||||
field: 'sn',
|
||||
component: 'Input',
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{
|
||||
label: '在线状态',
|
||||
field: 'status',
|
||||
component: 'JDictSelectTag',
|
||||
componentProps: {
|
||||
placeholder: '请选择状态',
|
||||
options: [
|
||||
{ label: '在线', value: '0' },
|
||||
{ label: '离线', value: '1' },
|
||||
],
|
||||
},
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
];
|
||||
|
||||
export const formSchema: FormSchema[] = [
|
||||
{
|
||||
label: '',
|
||||
field: 'isUpdate',
|
||||
component: 'Input',
|
||||
ifShow: false,
|
||||
},
|
||||
{
|
||||
label: '设备序号',
|
||||
field: 'sn',
|
||||
component: 'Input',
|
||||
dynamicDisabled: ({ values }) => {
|
||||
return values.isUpdate;
|
||||
},
|
||||
required: true,
|
||||
labelWidth: '160px'
|
||||
},
|
||||
{
|
||||
label: '设备名称',
|
||||
field: 'deviceName',
|
||||
component: 'Input',
|
||||
required: true,
|
||||
labelWidth: '160px'
|
||||
},
|
||||
{
|
||||
label: '时区',
|
||||
field: 'timeCode',
|
||||
component: 'JDictSelectTag',
|
||||
componentProps: {
|
||||
placeholder: '请选择时区',
|
||||
options: [
|
||||
{ label: '北京时间', value: '01' },
|
||||
/* { label: '纽约时间', value: '02' },*/
|
||||
],
|
||||
},
|
||||
required: true,
|
||||
labelWidth: '160px'
|
||||
},
|
||||
{
|
||||
label: '设备类型',
|
||||
field: 'deviceTypes',
|
||||
component: 'Input',
|
||||
show: false,
|
||||
},
|
||||
{
|
||||
label: '记录间隔(分钟)',
|
||||
field: 'recordInterval',
|
||||
component: 'InputNumber',
|
||||
ifShow: ({ values }) => {
|
||||
//有值就是显示
|
||||
return values.isUpdate;
|
||||
},
|
||||
required: true,
|
||||
labelWidth: '160px'
|
||||
},
|
||||
{
|
||||
label: '上报间隔(分钟)',
|
||||
field: 'reportingInterval',
|
||||
component: 'InputNumber',
|
||||
ifShow: ({ values }) => {
|
||||
//有值就是显示
|
||||
return values.isUpdate;
|
||||
},
|
||||
required: true,
|
||||
labelWidth: '160px'
|
||||
},
|
||||
{
|
||||
label: '历史上报时刻(00:00)',
|
||||
field: 'historyReportTime',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
size:'default',
|
||||
showNow: true,
|
||||
},
|
||||
ifShow: ({ values }) => {
|
||||
//有值就是显示
|
||||
return values.isUpdate;
|
||||
},
|
||||
required: true,
|
||||
labelWidth: '160px'
|
||||
},
|
||||
{
|
||||
label: '历史上报间隔(小时)',
|
||||
field: 'historyInterval',
|
||||
component: 'InputNumber',
|
||||
ifShow: ({ values }) => {
|
||||
//有值就是显示
|
||||
return values.isUpdate;
|
||||
},
|
||||
required: true,
|
||||
labelWidth: '160px'
|
||||
},
|
||||
{
|
||||
label: '温度预警-上限',
|
||||
field: 'temperatureHigh',
|
||||
component: 'InputNumber',
|
||||
ifShow: ({ values }) => {
|
||||
//有值就是显示
|
||||
return values.isUpdate;
|
||||
},
|
||||
required: true,
|
||||
labelWidth: '160px'
|
||||
},
|
||||
{
|
||||
label: '温度预警-下限',
|
||||
field: 'temperatureLow',
|
||||
component: 'InputNumber',
|
||||
ifShow: ({ values }) => {
|
||||
//有值就是显示
|
||||
return values.isUpdate;
|
||||
},
|
||||
required: true,
|
||||
labelWidth: '160px'
|
||||
},
|
||||
{
|
||||
label: '温度缓冲值',
|
||||
field: 'temperatureBuffer',
|
||||
component: 'InputNumber',
|
||||
ifShow: ({ values }) => {
|
||||
//有值就是显示
|
||||
return values.isUpdate;
|
||||
},
|
||||
required: true,
|
||||
labelWidth: '160px'
|
||||
},
|
||||
{
|
||||
label: '湿度预警-上限',
|
||||
field: 'humidityHigh',
|
||||
component: 'InputNumber',
|
||||
ifShow: ({ values }) => {
|
||||
//有值就是显示
|
||||
return values.isUpdate;
|
||||
},
|
||||
required: true,
|
||||
labelWidth: '160px'
|
||||
},
|
||||
{
|
||||
label: '湿度预警-下限',
|
||||
field: 'humidityLow',
|
||||
component: 'InputNumber',
|
||||
ifShow: ({ values }) => {
|
||||
//有值就是显示
|
||||
return values.isUpdate;
|
||||
},
|
||||
required: true,
|
||||
labelWidth: '160px'
|
||||
},
|
||||
{
|
||||
label: '湿度缓冲值',
|
||||
field: 'humidityBuffer',
|
||||
component: 'InputNumber',
|
||||
ifShow: ({ values }) => {
|
||||
//有值就是显示
|
||||
return values.isUpdate;
|
||||
},
|
||||
required: true,
|
||||
labelWidth: '160px'
|
||||
},
|
||||
{
|
||||
label: '断电报警开关',
|
||||
field: 'izOutages',
|
||||
component: 'JDictSelectTag',
|
||||
componentProps: {
|
||||
placeholder: '请选择开关',
|
||||
options: [
|
||||
{ label: '开启', value: '0' },
|
||||
{ label: '关闭', value: '1' },
|
||||
],
|
||||
},
|
||||
ifShow: ({ values }) => {
|
||||
//有值就是显示
|
||||
return values.isUpdate;
|
||||
},
|
||||
required: true,
|
||||
labelWidth: '160px'
|
||||
},
|
||||
{
|
||||
label: '低电报警开关',
|
||||
field: 'izLowBattery',
|
||||
component: 'JDictSelectTag',
|
||||
componentProps: {
|
||||
placeholder: '请选择开关',
|
||||
options: [
|
||||
{ label: '开启', value: '0' },
|
||||
{ label: '关闭', value: '1' },
|
||||
],
|
||||
},
|
||||
ifShow: ({ values }) => {
|
||||
//有值就是显示
|
||||
return values.isUpdate;
|
||||
},
|
||||
required: true,
|
||||
labelWidth: '160px'
|
||||
},
|
||||
{
|
||||
label: '上下线通知开关',
|
||||
field: 'izOnline',
|
||||
component: 'JDictSelectTag',
|
||||
componentProps: {
|
||||
placeholder: '请选择开关',
|
||||
options: [
|
||||
{ label: '开启', value: '0' },
|
||||
{ label: '关闭', value: '1' },
|
||||
],
|
||||
},
|
||||
ifShow: ({ values }) => {
|
||||
//有值就是显示
|
||||
return values.isUpdate;
|
||||
},
|
||||
required: true,
|
||||
labelWidth: '160px'
|
||||
},
|
||||
{
|
||||
label: '读取参数',
|
||||
field: 'id',
|
||||
component: 'Input',
|
||||
slot: 'customInput',
|
||||
ifShow: ({ values }) => {
|
||||
//有值就是显示
|
||||
return values.isUpdate;
|
||||
},
|
||||
labelWidth: '160px'
|
||||
}
|
||||
];
|
||||
|
||||
//列表数据
|
||||
export const logColumns: BasicColumn[] = [
|
||||
{
|
||||
title: '设备序号',
|
||||
align: "center",
|
||||
dataIndex: 'sn'
|
||||
},
|
||||
{
|
||||
title: '操作时间',
|
||||
align: "center",
|
||||
dataIndex: 'optTime'
|
||||
},
|
||||
{
|
||||
title: '操作人',
|
||||
align: "center",
|
||||
dataIndex: 'optBy'
|
||||
},
|
||||
{
|
||||
title: '操作类型',
|
||||
align: "center",
|
||||
dataIndex: 'optType',
|
||||
customRender:({record})=>{
|
||||
if(record.optType == 'insert'){
|
||||
return '新增';
|
||||
}else if(record.optType == 'update'){
|
||||
return '修改';
|
||||
}else if(record.optType == 'delete'){
|
||||
return '删除';
|
||||
}else{
|
||||
return '';
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '记录间隔',
|
||||
align: "center",
|
||||
dataIndex: 'recordInterval'
|
||||
},
|
||||
{
|
||||
title: '上报间隔',
|
||||
align: "center",
|
||||
dataIndex: 'reportingInterval'
|
||||
},
|
||||
{
|
||||
title: '历史数据上报时刻',
|
||||
align: "center",
|
||||
dataIndex: 'historyReportTime'
|
||||
},
|
||||
{
|
||||
title: '历史数据上报间隔',
|
||||
align: "center",
|
||||
dataIndex: 'historyInterval'
|
||||
},
|
||||
{
|
||||
title: '温度预警-上限',
|
||||
align: "center",
|
||||
dataIndex: 'temperatureHigh'
|
||||
},
|
||||
{
|
||||
title: '温度预警-下限',
|
||||
align: "center",
|
||||
dataIndex: 'temperatureLow'
|
||||
},
|
||||
{
|
||||
title: '温度缓冲值',
|
||||
align: "center",
|
||||
dataIndex: 'temperatureBuffer'
|
||||
},
|
||||
{
|
||||
title: '湿度预警-上限',
|
||||
align: "center",
|
||||
dataIndex: 'humidityHigh'
|
||||
},
|
||||
{
|
||||
title: '湿度预警-下限',
|
||||
align: "center",
|
||||
dataIndex: 'humidityLow'
|
||||
},
|
||||
{
|
||||
title: '湿度缓冲值',
|
||||
align: "center",
|
||||
dataIndex: 'humidityBuffer'
|
||||
},
|
||||
{
|
||||
title: '断电报警',
|
||||
align: "center",
|
||||
dataIndex: 'izOutages',
|
||||
customRender:({record})=>{
|
||||
return record.izOutages?(record.izOutages=='0'?'开启':'关闭'):'';
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '低电报警',
|
||||
align: "center",
|
||||
dataIndex: 'izLowBattery',
|
||||
customRender:({record})=>{
|
||||
return record.izLowBattery?(record.izLowBattery=='0'?'开启':'关闭'):'';
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '上下线通知',
|
||||
align: "center",
|
||||
dataIndex: 'izOnline',
|
||||
customRender:({record})=>{
|
||||
return record.izOnline?(record.izOnline=='0'?'开启':'关闭'):'';
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
export const logQuerySchema: FormSchema[] = [
|
||||
{
|
||||
label: '操作类型',
|
||||
field: 'optType',
|
||||
component: 'JDictSelectTag',
|
||||
componentProps: {
|
||||
placeholder: '请选择操作类型',
|
||||
options: [
|
||||
{ label: '新增', value: 'insert' },
|
||||
{ label: '修改', value: 'update' },
|
||||
{ label: '删除', value: 'delete' },
|
||||
],
|
||||
},
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
];
|
||||
|
||||
//列表数据
|
||||
export const alarmColumns: BasicColumn[] = [
|
||||
{
|
||||
title: '设备序号',
|
||||
align: "center",
|
||||
dataIndex: 'sn'
|
||||
},
|
||||
{
|
||||
title: '状态',
|
||||
align: "center",
|
||||
dataIndex: 'status',
|
||||
customRender:({record})=>{
|
||||
if(record.optType == '0'){
|
||||
return '告警';
|
||||
}else {
|
||||
return '清除';
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '告警时间',
|
||||
align: "center",
|
||||
dataIndex: 'wrDate'
|
||||
},
|
||||
{
|
||||
title: '告警内容',
|
||||
align: "center",
|
||||
dataIndex: 'wrContent'
|
||||
},
|
||||
{
|
||||
title: '告警值',
|
||||
align: "center",
|
||||
dataIndex: 'wrData'
|
||||
},
|
||||
{
|
||||
title: '清除时间',
|
||||
align: "center",
|
||||
dataIndex: 'clearDate'
|
||||
},
|
||||
{
|
||||
title: '清除内容',
|
||||
align: "center",
|
||||
dataIndex: 'clearContent'
|
||||
},
|
||||
{
|
||||
title: '清除值',
|
||||
align: "center",
|
||||
dataIndex: 'clearData'
|
||||
},
|
||||
];
|
||||
|
||||
export const alarmQuerySchema: FormSchema[] = [
|
||||
{
|
||||
label: '告警状态',
|
||||
field: 'status',
|
||||
component: 'JDictSelectTag',
|
||||
componentProps: {
|
||||
placeholder: '请选择告警状态',
|
||||
options: [
|
||||
{ label: '告警', value: '0' },
|
||||
{ label: '清除', value: '1' },
|
||||
],
|
||||
},
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
];
|
|
@ -0,0 +1,156 @@
|
|||
<template>
|
||||
<div>
|
||||
<!--引用表格-->
|
||||
<BasicTable @register="registerTable">
|
||||
<!--插槽:table标题-->
|
||||
<template #tableTitle>
|
||||
<a-button type="primary" preIcon="ant-design:plus-outlined" @click="handleInsert"> 添加设备</a-button>
|
||||
</template>
|
||||
<template #bodyCell="{ column, record, index, text }">
|
||||
<template v-if="column.dataIndex === 'status'">
|
||||
<span v-if="record.status ==='0'" style="color:green">
|
||||
在线
|
||||
</span>
|
||||
<span v-else style="color:red">
|
||||
离线
|
||||
</span>
|
||||
</template>
|
||||
</template>
|
||||
<!--操作栏-->
|
||||
<template #action="{ record }">
|
||||
<TableAction :actions="getTableAction(record)"/>
|
||||
</template>
|
||||
</BasicTable>
|
||||
<DeviceInfoDrawer @register="registerDrawer" @success="handleSuccess" />
|
||||
<ApiLogAlarmModal ref="apiLogAlarmModal"></ApiLogAlarmModal>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" name="iot-nuIotRegionInfo" setup>
|
||||
import {reactive, ref,h} from 'vue';
|
||||
import { BasicTable, useTable, TableAction } from '/@/components/Table';
|
||||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
import { useUserStore } from '/@/store/modules/user';
|
||||
import {Modal} from "ant-design-vue";
|
||||
import {list, deleteDevice, updateDeviceRealTime} from './humid.api';
|
||||
import { columns, searchFormSchema } from './humid.data';
|
||||
import {useModal} from "@/components/Modal";
|
||||
import {useDrawer} from "@/components/Drawer";
|
||||
import ApiLogAlarmModal from './components/ApiLogAlarmModal.vue'
|
||||
const apiLogAlarmModal = ref();
|
||||
//注册drawer
|
||||
const [registerDrawer, { openDrawer }] = useDrawer();
|
||||
const queryParam = reactive<any>({});
|
||||
//注册model
|
||||
const [registerModal, {openModal}] = useModal();
|
||||
//注册table数据
|
||||
const { prefixCls,tableContext,onExportXls,onImportXls } = useListPage({
|
||||
tableProps:{
|
||||
title: '温湿度',
|
||||
api: list,
|
||||
columns,
|
||||
canResize:false,
|
||||
showIndexColumn: true,
|
||||
formConfig: {
|
||||
//labelWidth: 120,
|
||||
schemas: searchFormSchema,
|
||||
autoSubmitOnEnter:true,
|
||||
showAdvancedButton:true,
|
||||
fieldMapToNumber: [
|
||||
],
|
||||
fieldMapToTime: [
|
||||
],
|
||||
},
|
||||
actionColumn: {
|
||||
width: 200,
|
||||
fixed:'right'
|
||||
},
|
||||
beforeFetch: (params) => {
|
||||
return Object.assign(params, queryParam);
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
const [registerTable, {reload},{ rowSelection, selectedRowKeys }] = tableContext
|
||||
|
||||
/**
|
||||
* 成功回调
|
||||
*/
|
||||
function handleSuccess() {
|
||||
(selectedRowKeys.value = []) && reload();
|
||||
}
|
||||
|
||||
/**
|
||||
* 操作栏
|
||||
*/
|
||||
function getTableAction(record){
|
||||
return [
|
||||
{
|
||||
label: '抄表',
|
||||
onClick: handleRead.bind(null, record),
|
||||
},
|
||||
{
|
||||
label: '编辑',
|
||||
onClick: handleEdit.bind(null, record),
|
||||
},
|
||||
{
|
||||
label: '删除',
|
||||
popConfirm: {
|
||||
title: '是否确认删除',
|
||||
confirm: handleDelete.bind(null, record),
|
||||
placement: 'topLeft',
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '日志',
|
||||
onClick: handleApiLogAlarm.bind(null, record),
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
// 抄电表
|
||||
async function handleRead(record: Recordable) {
|
||||
const params = {
|
||||
'sn' : record.sn,
|
||||
};
|
||||
await updateDeviceRealTime(params);
|
||||
handleSuccess()
|
||||
}
|
||||
|
||||
function handleInsert(){
|
||||
let record = {};
|
||||
record["isUpdate"] = false;
|
||||
openDrawer(true, {
|
||||
isUpdate: false,
|
||||
showFooter: true,
|
||||
tenantSaas: false,
|
||||
});
|
||||
}
|
||||
|
||||
// 编辑
|
||||
async function handleEdit(record: Recordable) {
|
||||
record["isUpdate"] = true;
|
||||
console.log(record);
|
||||
openDrawer(true, {
|
||||
record,
|
||||
isUpdate: true,
|
||||
showFooter: true,
|
||||
tenantSaas: false,
|
||||
});
|
||||
}
|
||||
|
||||
// 删除
|
||||
async function handleDelete(record: Recordable) {
|
||||
const params = {
|
||||
'sn' : record.sn,
|
||||
};
|
||||
await deleteDevice(params);
|
||||
handleSuccess();
|
||||
}
|
||||
|
||||
function handleApiLogAlarm(record){
|
||||
apiLogAlarmModal.value.disableSubmit = true;
|
||||
apiLogAlarmModal.value.showLogAlarm(record);
|
||||
}
|
||||
|
||||
</script>
|
Loading…
Reference in New Issue