Browse Source

fix:电动门对接接口

temp
zhaohy 3 months ago
parent
commit
3e390a8ce1
  1. 6
      hx-ai-intelligent/src/api/electricDoor.ts
  2. 79
      hx-ai-intelligent/src/view/equipmentControl/electricDoor/index.vue
  3. 41
      hx-ai-intelligent/src/view/equipmentControl/electricDoor/tables.vue

6
hx-ai-intelligent/src/api/electricDoor.ts

@ -0,0 +1,6 @@
import { BASE_URL } from './index';
export enum electricDoorApi {
getDeviceState = `${BASE_URL}/eleDoorCtrl/getDeviceState`, // 查询设备最新状态
getDeviceRecordList = `${BASE_URL}/eleDoorCtrl/getDeviceRecordList`, // 查询设备日志列表
}

79
hx-ai-intelligent/src/view/equipmentControl/electricDoor/index.vue

@ -23,7 +23,7 @@
visible = !visible;
}
">
<template v-for="index in 4">
<template v-for="(item, index) in dataSource" :key="item.deviceInfoCode">
<div
style="
flex: 1;
@ -33,8 +33,8 @@
border: 1px solid #ab8757;
font-weight: 500;
"
:style="{ 'background-color': ['#e43e1e', '#f59a23', '#bbcf10', '#62d7a7'][index - 1] }">
{{ ['A号门', 'B号门', 'C号门', 'D号门'][index - 1] }}
:style="{ 'background-color': ['#e43e1e', '#f59a23', '#bbcf10', '#62d7a7'][0] }">
{{ ['A号门', 'B号门', 'C号门', 'D号门'][0] }}
</div>
</template>
</div>
@ -54,14 +54,14 @@
:pagination="false"
:customRow="customRow">
<template #bodyCell="{ record, column }">
<template v-if="column.dataIndex === 'state'">
<template v-if="column.dataIndex === 'EGstRu'">
<a-tag
style="background-color: rgba(0, 0, 0, 0.5); width: 50px"
:style="{
border: '1px solid' + ['#39d7bb', '#f3614d', '#ffa403'][record.status - 1],
color: ['#39d7bb', '#f3614d', '#ffa403'][record.status - 1],
border: '1px solid' + ['#39d7bb', '#f3614d', '#ffa403'][record.EGstRu],
color: ['#39d7bb', '#f3614d', '#ffa403'][record.EGstRu],
}"
>{{ record.state }}</a-tag
>{{ record.EGstRu }}</a-tag
>
</template>
</template>
@ -98,13 +98,28 @@
<script setup lang="ts">
import { ref, onMounted, onUnmounted } from 'vue';
import electricDoorTables from './tables.vue';
import { electricDoorApi } from '/@/api/electricDoor';
import { http } from '/nerv-lib/util';
import { DoubleLeftOutlined, DoubleRightOutlined } from '@ant-design/icons-vue';
//
import { items } from '/@/store/item';
//
const state = items();
const getDoorList = () => {
console.log('数据');
http
.get(electricDoorApi.getDeviceState, {
projectId: state.projectId,
siteId: state.siteId,
floor: 1,
})
.then((res) => {
if (res.msg === 'success') {
console.log(res, '数据');
dataSource.value = res.data;
}
});
};
const intervalId = setInterval(getDoorList, 3000);
const intervalId = setInterval(getDoorList, 10000);
//
onMounted(() => {
//
@ -139,47 +154,21 @@
},
{
title: '执行时间',
dataIndex: 'age',
key: 'age',
dataIndex: 'time',
key: 'time',
width: 100,
customRender: ({ value }) => {
return value.substring(11, 19);
},
},
{
title: '状态',
dataIndex: 'state',
key: 'state',
dataIndex: 'EGstRu',
key: 'EGstRu',
width: 160,
},
];
const dataSource = [
{
key: '1',
name: 'A号门',
age: '23:50:20',
state: '开启',
status: 1,
},
{
key: '2',
name: 'B号门',
age: '23:50:20',
state: '关闭',
status: 2,
},
{
key: '3',
name: 'C号门',
age: '23:50:20',
state: '维护中',
status: 3,
},
{
key: '4',
name: 'D号门',
age: '23:50:20',
state: '维护中',
status: 3,
},
];
const dataSource = ref([]);
const visible = ref(false);
//
const detailed = ref(false);

41
hx-ai-intelligent/src/view/equipmentControl/electricDoor/tables.vue

@ -12,6 +12,13 @@
</template>
<script lang="ts">
import { ref } from 'vue';
import { http } from '/nerv-lib/util';
import { electricDoorApi } from '/@/api/electricDoor';
//
import { items } from '/@/store/item';
//
const state = items();
export default {
setup() {
@ -21,6 +28,7 @@
pagination.value.pageSize = pageSize;
console.log(current, pageSize);
};
const info = ref({});
const pagination = ref({
total: 0,
size: 'small',
@ -48,7 +56,7 @@
width: 80,
},
];
const dataSourceLog = [
const dataSourceLog = ref([
{ age: '2024-07-26 23:50:20', state: '开启' },
{ age: '2024-07-26 23:50:20', state: '关闭' },
{ age: '2024-07-26 23:50:20', state: '开启' },
@ -74,11 +82,36 @@
{ age: '2024-07-26 23:50:20', state: '开启' },
{ age: '2024-07-26 23:50:20', state: '关闭' },
{ age: '2024-07-26 23:50:20', state: '开启' },
];
]);
const getList = () => {
http
.get(electricDoorApi.getDeviceRecordList, {
projectId: state.projectId,
siteId: state.siteId,
codeList: info.value.deviceInfoCode,
page: pagination.value.current,
size: pagination.value.pageSize,
})
.then((res) => {
if (res.msg === 'success') {
console.log(res, '数据');
dataSourceLog.value = res.data;
}
});
};
const toggle = (data: any) => {
console.log(data, '数据');
info.value = data;
getList();
};
return {
columnLog,
dataSourceLog,
toggle,
pagination,
handleChangePage,
info,
getList,
};
return { columnLog, dataSourceLog, toggle, pagination, handleChangePage };
},
};
</script>

Loading…
Cancel
Save