This commit is contained in:
1378012178@qq.com 2025-06-25 09:04:13 +08:00
commit be943c35c6
15 changed files with 1719 additions and 6 deletions

View File

@ -33,6 +33,9 @@
</a-row>
</a-form>
</div>
<div>
{{registerTable.tableData}}
</div>
<!--引用表格-->
<BasicTable @register="registerTable">
<!--插槽:table标题-->

View File

@ -29,9 +29,7 @@ const nuIotTqApiRequestLogListModal3 = ref();
const nuIotTqApiRequestLogListModal10 = ref();
const nuIotTqApiRequestLogListModal11 = ref();
function initLog(record){
console.log("🚀 ~ initLog ~ record:", record)
activeKey.value = "3";
console.log("🚀 ~ initLog ~ activeKey.value:", activeKey.value)
getDataList(activeKey.value, record);
dbsbInfo.value = record;
}
@ -42,10 +40,10 @@ const nuIotTqApiRequestLogListModal11 = ref();
type: type,
cid: record.cid
}
if(type == '3'){
nuIotTqApiRequestLogListModal3.value.init(params);
}else if(type == '3'){
if(type == '9'){
nuIotTqApiRequestLogListModal9.value.init(params);
}else if(type == '3'){
nuIotTqApiRequestLogListModal3.value.init(params);
}else if(type == '10'){
nuIotTqApiRequestLogListModal10.value.init(params);
}else if(type == '11'){

View File

@ -0,0 +1,92 @@
<template>
<div class="p-2">
<a-tabs v-model:activeKey="activeKey" type="card" @change="handleChange">
<a-tab-pane key="42" tab="抄表" >
<NuIotTqApiRequestLogList ref="nuIotTqApiRequestLogListModal42"></NuIotTqApiRequestLogList>
</a-tab-pane>
<a-tab-pane key="49" tab="清零" force-render>
<NuIotTqApiRequestLogList ref="nuIotTqApiRequestLogListModal49"></NuIotTqApiRequestLogList>
</a-tab-pane>
<a-tab-pane key="43" tab="开阀" force-render>
<NuIotTqApiRequestLogList ref="nuIotTqApiRequestLogListModal43"></NuIotTqApiRequestLogList>
</a-tab-pane>
<a-tab-pane key="53" tab="关阀" force-render>
<NuIotTqApiRequestLogList ref="nuIotTqApiRequestLogListModal43"></NuIotTqApiRequestLogList>
</a-tab-pane>
</a-tabs>
</div>
</template>
<script lang="ts" name="departUtils-sysDepart" setup>
import { ref, reactive } from 'vue';
import NuIotTqApiRequestLogList from '/@/views/iot/tq/nuIotTqApiRequestLog/NuIotTqApiRequestLogList.vue';
const activeKey= ref('42');
const dbsbInfo = ref<any>({});
const nuIotTqApiRequestLogListModal42 = ref();
const nuIotTqApiRequestLogListModal43 = ref();
const nuIotTqApiRequestLogListModal49 = ref();
const nuIotTqApiRequestLogListModal53 = ref();
function initLog(record){
activeKey.value = "42";
getDataList(activeKey.value, record);
dbsbInfo.value = record;
}
function getDataList(type, record) {
console.log("🚀 ~ getDataList ~ type, record:", type, record)
var params = {
type: type,
cid: record.cid
}
if(type == '42'){
nuIotTqApiRequestLogListModal42.value.init(params);
}else if(type == '43'){
nuIotTqApiRequestLogListModal43.value.init(params);
}else if(type == '49'){
nuIotTqApiRequestLogListModal49.value.init(params);
}else if(type == '53'){
nuIotTqApiRequestLogListModal53.value.init(params);
}
}
function handleChange(key) {
console.log("🚀 ~ handleChange ~ key:", key)
activeKey.value = key;
getDataList(key, dbsbInfo.value);
}
defineExpose({
initLog,
});
</script>
<style lang="less" scoped>
.jeecg-basic-table-form-container {
padding: 0;
.table-page-search-submitButtons {
display: block;
margin-bottom: 24px;
white-space: nowrap;
}
.query-group-cust{
min-width: 100px !important;
}
.query-group-split-cust{
width: 30px;
display: inline-block;
text-align: center
}
.ant-form-item:not(.ant-form-item-with-help){
margin-bottom: 16px;
height: 32px;
}
:deep(.ant-picker),:deep(.ant-input-number){
width: 100%;
}
}
</style>

View File

@ -0,0 +1,66 @@
<template>
<j-modal :title="title" width="70%" :visible="visible" @ok="handleOk" :okButtonProps="{ class: { 'jee-hidden': disableSubmit } }" @cancel="handleCancel" cancelText="关闭">
<WaterApiLogList ref="registerForm" @ok="submitCallback" :formDisabled="disableSubmit" :formBpm="false"></WaterApiLogList>
</j-modal>
</template>
<script lang="ts" setup>
import { ref, nextTick, defineExpose } from 'vue';
import WaterApiLogList from './WaterApiLogList.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 showApiLog(record) {
title.value = '日志';
visible.value = true;
nextTick(() => {
registerForm.value.initLog(record);
});
}
/**
* 确定按钮点击事件
*/
function handleOk() {
registerForm.value.submitForm();
}
/**
* form保存回调事件
*/
function submitCallback(params) {
handleCancel();
emit('success',params);
}
/**
* 取消按钮回调事件
*/
function handleCancel() {
visible.value = false;
}
defineExpose({
showApiLog,
disableSubmit,
});
</script>
<style lang="less">
/**隐藏样式-modal确定按钮 */
.jee-hidden {
display: none !important;
}
</style>
<style lang="less" scoped></style>

View File

@ -0,0 +1,218 @@
<template>
<div class="p-2">
<!--查询区域-->
<div class="jeecg-basic-table-form-container">
<a-form ref="formRef" @keyup.enter.native="reload" :model="queryParam" :label-col="labelCol" :wrapper-col="wrapperCol">
<a-row :gutter="24">
<a-col :lg="6">
<a-form-item name="address">
<template #label><span title="同步类型">表号</span></template>
<a-input placeholder="请输入同步类型" v-model:value="queryParam.address" allow-clear ></a-input>
</a-form-item>
</a-col>
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<a-button type="primary" preIcon="ant-design:search-outlined" @click="reload">查询</a-button>
<a-button type="primary" preIcon="ant-design:reload-outlined" @click="searchReset" style="margin-left: 8px">重置</a-button>
</a-col>
</a-row>
</a-form>
</div>
<a-row>
<a-col v-for="(item,index) in tableData.records" :key="index" :xs="24" :sm="24" :md="12" :lg="12" :xl="8" :xxl="6" style="padding: 8px;">
<a-card style="width: 100%;border-radius: 8px;">
<template #title >
<div class="cardTitle">
<a-row>
<a-col :span="12">
<span style="margin-left:15px;font-size:14px;">表号{{item.address}}</span>
</a-col>
<a-col :span="12" style="text-align: right;">
<span style="margin-right:15px;font-size:14px;">{{item.relayState=='1'?'在线':'离线'}}</span>
</a-col>
</a-row>
</div>
</template>
<p>
<span>护理单元名称{{item.nuName?item.nuName:'未配置'}}</span>
</p>
<p>
<span>上次抄表时间{{item.readTime?item.readTime:'未抄表'}}</span>
</p>
<p style="margin-top: 20px;">
<span><Statistic title="用水量m³" :value="item.eleValue?item.eleValue:'无'" style="text-align:center;" /></span>
</p>
<a-divider />
<p style="text-align:center;">
<span>
<a @click="handleRead(item)">抄表</a>
<a-divider type="vertical" />
<a @click="handleControlLz(item)">开阀</a>
<a-divider type="vertical" />
<a @click="handleControlHz(item)">关阀</a>
<a-divider type="vertical" />
<a @click="handleReset(item)">清零</a>
<a-divider type="vertical" />
<a @click="showApiLog(item)">日志</a>
</span>
</p>
</a-card>
</a-col>
</a-row>
<div
style="float:right;bottom: 20px;z-index: 999;padding: 8px 16px;border-radius: 4px;display: flex;align-items: center;">
<span style="margin-right: 10px;"> {{ tableData.total }} 条数据</span>
<Pagination showLessItems v-model:current="pageParams.pageNo" :pageSize="pageParams.pageSize" size="small"
show-quick-jumper :total="tableData.total" @change="reload" />
</div>
<!--引用表格-->
<ApiLogModal ref="apiLogModal"></ApiLogModal>
</div>
</template>
<script lang="ts" name="iot-nuIotRegionInfo" setup>
import {reactive, ref,h,onMounted} from 'vue';
import { defHttp } from '/@/utils/http/axios';
import { Statistic } from 'ant-design-vue';
import {Modal} from "ant-design-vue";
import {list, eleReset, eleControl, eleRead } from './water.api';
import { Pagination } from 'ant-design-vue';
import ApiLogModal from "@/views/iot/tq/electricity/apilog/WaterApiLogModal.vue";
import { set } from 'lodash-es';
const formRef = ref();
const queryParam = reactive<any>({});
const apiLogModal = ref();
const tableData = ref<any>([]);
const pageParams = ref({ pageNo: 1, pageSize: 8 })
const labelCol = reactive({
xs:24,
sm:4,
xl:6,
xxl:4
});
const wrapperCol = reactive({
xs: 24,
sm: 20,
});
/**
* 重置
*/
function searchReset() {
formRef.value.resetFields();
//
reload();
}
//
async function handleRead(record) {
const params = {
'cid' : record.cid,
'address' : record.address,
};
await eleRead(params);
setTimeout(() => {
reload();
}, 4000);
}
//
async function handleControlLz(record) {
if(record.relayState == '0'){
Modal.info({
title: '开阀',
content: h('div', {}, [
h('p', '此水表已开阀!'),
]),
onOk() {},
});
return;
}
const params = {
'cid' : record.cid,
'address' : record.address,
'type' : '43',
};
await eleControl(params);
setTimeout(() => {
reload();
}, 4000);
}
//
async function handleControlHz(record) {
if(record.relayState == '1'){
Modal.info({
title: '关阀',
content: h('div', {}, [
h('p', '此水表已关阀!'),
]),
onOk() {},
});
return;
}
const params = {
'cid' : record.cid,
'address' : record.address,
'type' : '53',
};
await eleControl(params);
setTimeout(() => {
reload();
}, 4000);
}
//
async function handleReset(record) {
const params = {
'cid' : record.cid,
'address' : record.address,
};
await eleReset(params);
setTimeout(() => {
reload();
}, 4000);
}
/**
* 查看api日志
*/
function showApiLog(record){
console.log(record);
apiLogModal.value.disableSubmit = true;
apiLogModal.value.showApiLog(record);
}
function reload(){
queryParam.pageSize = pageParams.value.pageSize;
queryParam.pageNo = pageParams.value.pageNo;
defHttp.get({url: '/iot/tq/waterMeter/list',params:queryParam}).then(res => {
console.log("🚀 ~ defHttp.get ~ res:", res)
tableData.value = res;
});
}
//
onMounted(() => {
reload();
});
</script>
<style lang="less" scoped>
.cardTitle{
background: #1ea0fa;
width: 100%;
margin: -28px -24px;
padding-top: 15px;
border-radius: 5px 5px 0px 0px;
color: white;
height: 55px;
display: block;
position: absolute;
}
</style>

View File

@ -0,0 +1,46 @@
import { defHttp } from '/@/utils/http/axios';
enum Api {
list = '/iot/tq/waterMeter/list',
eleReset = '/iot/tq/waterMeter/waterReset',
eleControl = '/iot/tq/waterMeter/waterControl',
eleRead = '/iot/tq/waterMeter/waterRead',
getAllMeter = '/iot/tq/common/device/getAllMeter',
getAllCollector = '/iot/tq/common/device/getAllCollector',
}
/**
*
* @param params
*/
export const list = (params) => defHttp.get({ url: Api.list, params });
/**
*
* @param params
*/
export const eleReset = (params?) => defHttp.get({ url: Api.eleReset, params });
/**
*
* @param params
*/
export const eleControl = (params?) => defHttp.get({ url: Api.eleControl, params });
/**
*
* @param params
*/
export const eleRead = (params?) => defHttp.get({ url: Api.eleRead, params });
/**
*
* @param params
*/
export const getAllMeter = (params?) => defHttp.get({ url: Api.getAllMeter, params });
/**
*
* @param params
*/
export const getAllCollector = (params?) => defHttp.get({ url: Api.getAllCollector, params });

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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 });

View File

@ -0,0 +1,538 @@
import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
//列表数据
export const columns: BasicColumn[] = [
{
title: '单元编码',
align: "center",
dataIndex: 'nuId'
},
{
title: '单元名称',
align: "center",
dataIndex: 'nuName'
},
{
title: '设备序号',
align: "center",
dataIndex: 'sn'
},
{
title: '设备名称',
align: "center",
dataIndex: 'deviceName'
},
{
title: '机构',
align: "center",
dataIndex: 'departName'
},
{
title: '温度',
align: "center",
dataIndex: 'temperature'
},
{
title: '湿度',
align: "center",
dataIndex: 'humidity'
},
{
title: '最新上报时间',
align: "center",
dataIndex: 'reportingTime'
},
{
title: '告警数',
align: "center",
dataIndex: 'alarmCn',
defaultHidden: true,
},
{
title: '记录间隔',
align: "center",
dataIndex: 'recordInterval',
defaultHidden: true,
},
{
title: '上报间隔',
align: "center",
dataIndex: 'reportingInterval',
defaultHidden: true,
},
{
title: '电量',
align: "center",
dataIndex: 'electricity',
defaultHidden: true,
},
{
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 },
},
];

View File

@ -0,0 +1,177 @@
<template>
<div class="p-2">
<!--查询区域-->
<div class="jeecg-basic-table-form-container">
<a-form ref="formRef" @keyup.enter.native="reload" :model="queryParam" :label-col="labelCol" :wrapper-col="wrapperCol">
<a-row :gutter="24">
<a-col :lg="6">
<a-form-item name="sn">
<template #label><span title="同步类型">表号</span></template>
<a-input placeholder="请输入同步类型" v-model:value="queryParam.sn" allow-clear ></a-input>
</a-form-item>
</a-col>
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<a-button type="primary" preIcon="ant-design:search-outlined" @click="reload">查询</a-button>
<a-button type="primary" preIcon="ant-design:reload-outlined" @click="searchReset" style="margin-left: 8px">重置</a-button>
</a-col>
</a-row>
</a-form>
</div>
<a-row>
<a-col v-for="(item,index) in tableData.records" :key="index" :xs="24" :sm="24" :md="12" :lg="12" :xl="8" :xxl="6" style="padding: 8px;">
<a-card style="width: 100%;border-radius: 8px;">
<template #title >
<div class="cardTitle">
<a-row>
<a-col :span="12">
<span style="margin-left:15px;font-size:14px;">表号{{item.sn}}</span>
</a-col>
<a-col :span="12" style="text-align: right;">
<span style="margin-right:15px;font-size:14px;">{{item.status=='0'?'在线':'离线'}}</span>
</a-col>
</a-row>
</div>
</template>
<p>
<span>护理单元名称{{item.nuName?item.nuName:'未配置'}}</span>
</p>
<p>
<span>上次抄表时间{{item.readTime?item.readTime:'未抄表'}}</span>
</p>
<p style="margin-top: 20px;">
<a-row>
<a-col :span="12">
<span><Statistic title="温度" :value="item.temperature?item.temperature:'无'" style="text-align:center;" /></span>
</a-col>
<a-col :span="12">
<span><Statistic title="湿度" :value="item.humidity?item.humidity:'无'" style="text-align:center;" /></span>
</a-col>
</a-row>
</p>
<a-divider />
<p style="text-align:center;">
<span>
<a @click="handleRead(item)">抄表</a>
<a-divider type="vertical" />
<a @click="handleEdit(item)">配置</a>
<a-divider type="vertical" />
<a @click="showApiLog(item)">日志</a>
</span>
</p>
</a-card>
</a-col>
</a-row>
<div
style="float:right;bottom: 20px;z-index: 999;padding: 8px 16px;border-radius: 4px;display: flex;align-items: center;">
<span style="margin-right: 10px;"> {{ tableData.total }} 条数据</span>
<Pagination showLessItems v-model:current="pageParams.pageNo" :pageSize="pageParams.pageSize" size="small"
show-quick-jumper :total="tableData.total" @change="reload" />
</div>
<!--引用表格-->
<ApiLogAlarmModal ref="apiLogAlarmModal"></ApiLogAlarmModal>
<DeviceInfoDrawer @register="registerDrawer" @success="handleSuccess" />
</div>
</template>
<script lang="ts" name="iot-nuIotRegionInfo" setup>
import {reactive, ref,h,onMounted} from 'vue';
import { defHttp } from '/@/utils/http/axios';
import { Statistic } from 'ant-design-vue';
import {Modal} from "ant-design-vue";
import {list, eleReset, eleControl, eleRead } from './wsdDevice.api';
import {deleteDevice, updateDeviceRealTime} from './humid.api';
import { Pagination } from 'ant-design-vue';
import ApiLogAlarmModal from './components/ApiLogAlarmModal.vue'
import DeviceInfoDrawer from "./components/DeviceInfoDrawer.vue";
import { set } from 'lodash-es';
import {useDrawer} from "@/components/Drawer";
//drawer
const [registerDrawer, { openDrawer }] = useDrawer();
const formRef = ref();
const queryParam = reactive<any>({});
const apiLogAlarmModal = ref();
const tableData = ref<any>([]);
const pageParams = ref({ pageNo: 1, pageSize: 8 })
const labelCol = reactive({
xs:24,
sm:4,
xl:6,
xxl:4
});
const wrapperCol = reactive({
xs: 24,
sm: 20,
});
/**
* 重置
*/
function searchReset() {
formRef.value.resetFields();
//
reload();
}
//
async function handleRead(record) {
const params = {
'sn' : record.sn,
};
await updateDeviceRealTime(params);
setTimeout(() => {
reload();
}, 4000);
}
//
async function handleEdit(record) {
record["isUpdate"] = true;
console.log(record);
openDrawer(true, {
record,
isUpdate: true,
showFooter: true,
tenantSaas: false,
});
}
/**
* 查看api日志
*/
function showApiLog(record){
apiLogAlarmModal.value.disableSubmit = true;
apiLogAlarmModal.value.showLogAlarm(record);
}
function reload(){
queryParam.pageSize = pageParams.value.pageSize;
queryParam.pageNo = pageParams.value.pageNo;
defHttp.get({url: '/iot/yiweilian/humidDevice/list',params:queryParam}).then(res => {
console.log("🚀 ~ defHttp.get ~ res:", res)
tableData.value = res;
});
}
//
onMounted(() => {
reload();
});
</script>
<style lang="less" scoped>
.cardTitle{
background: #1ea0fa;
width: 100%;
margin: -28px -24px;
padding-top: 15px;
border-radius: 5px 5px 0px 0px;
color: white;
height: 55px;
display: block;
position: absolute;
}
</style>

View File

@ -0,0 +1,46 @@
import { defHttp } from '/@/utils/http/axios';
enum Api {
list = '/iot/tq/waterMeter/list',
eleReset = '/iot/tq/waterMeter/eleReset',
eleControl = '/iot/tq/waterMeter/eleControl',
eleRead = '/iot/tq/waterMeter/eleRead',
getAllMeter = '/iot/tq/common/device/getAllMeter',
getAllCollector = '/iot/tq/common/device/getAllCollector',
}
/**
*
* @param params
*/
export const list = (params) => defHttp.get({ url: Api.list, params });
/**
*
* @param params
*/
export const eleReset = (params?) => defHttp.get({ url: Api.eleReset, params });
/**
*
* @param params
*/
export const eleControl = (params?) => defHttp.get({ url: Api.eleControl, params });
/**
*
* @param params
*/
export const eleRead = (params?) => defHttp.get({ url: Api.eleRead, params });
/**
*
* @param params
*/
export const getAllMeter = (params?) => defHttp.get({ url: Api.getAllMeter, params });
/**
*
* @param params
*/
export const getAllCollector = (params?) => defHttp.get({ url: Api.getAllCollector, params });