fix:电动门对接接口
This commit is contained in:
6
hx-ai-intelligent/src/api/electricDoor.ts
Normal file
6
hx-ai-intelligent/src/api/electricDoor.ts
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
import { BASE_URL } from './index';
|
||||||
|
|
||||||
|
export enum electricDoorApi {
|
||||||
|
getDeviceState = `${BASE_URL}/eleDoorCtrl/getDeviceState`, // 查询设备最新状态
|
||||||
|
getDeviceRecordList = `${BASE_URL}/eleDoorCtrl/getDeviceRecordList`, // 查询设备日志列表
|
||||||
|
}
|
@@ -23,7 +23,7 @@
|
|||||||
visible = !visible;
|
visible = !visible;
|
||||||
}
|
}
|
||||||
">
|
">
|
||||||
<template v-for="index in 4">
|
<template v-for="(item, index) in dataSource" :key="item.deviceInfoCode">
|
||||||
<div
|
<div
|
||||||
style="
|
style="
|
||||||
flex: 1;
|
flex: 1;
|
||||||
@@ -33,8 +33,8 @@
|
|||||||
border: 1px solid #ab8757;
|
border: 1px solid #ab8757;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
"
|
"
|
||||||
:style="{ 'background-color': ['#e43e1e', '#f59a23', '#bbcf10', '#62d7a7'][index - 1] }">
|
:style="{ 'background-color': ['#e43e1e', '#f59a23', '#bbcf10', '#62d7a7'][0] }">
|
||||||
{{ ['A号门', 'B号门', 'C号门', 'D号门'][index - 1] }}
|
{{ ['A号门', 'B号门', 'C号门', 'D号门'][0] }}
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
@@ -54,14 +54,14 @@
|
|||||||
:pagination="false"
|
:pagination="false"
|
||||||
:customRow="customRow">
|
:customRow="customRow">
|
||||||
<template #bodyCell="{ record, column }">
|
<template #bodyCell="{ record, column }">
|
||||||
<template v-if="column.dataIndex === 'state'">
|
<template v-if="column.dataIndex === 'EGstRu'">
|
||||||
<a-tag
|
<a-tag
|
||||||
style="background-color: rgba(0, 0, 0, 0.5); width: 50px"
|
style="background-color: rgba(0, 0, 0, 0.5); width: 50px"
|
||||||
:style="{
|
:style="{
|
||||||
border: '1px solid' + ['#39d7bb', '#f3614d', '#ffa403'][record.status - 1],
|
border: '1px solid' + ['#39d7bb', '#f3614d', '#ffa403'][record.EGstRu],
|
||||||
color: ['#39d7bb', '#f3614d', '#ffa403'][record.status - 1],
|
color: ['#39d7bb', '#f3614d', '#ffa403'][record.EGstRu],
|
||||||
}"
|
}"
|
||||||
>{{ record.state }}</a-tag
|
>{{ record.EGstRu }}</a-tag
|
||||||
>
|
>
|
||||||
</template>
|
</template>
|
||||||
</template>
|
</template>
|
||||||
@@ -98,13 +98,28 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, onMounted, onUnmounted } from 'vue';
|
import { ref, onMounted, onUnmounted } from 'vue';
|
||||||
import electricDoorTables from './tables.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 { DoubleLeftOutlined, DoubleRightOutlined } from '@ant-design/icons-vue';
|
||||||
|
// 全局变量
|
||||||
|
import { items } from '/@/store/item';
|
||||||
|
// 全局变量
|
||||||
|
const state = items();
|
||||||
const getDoorList = () => {
|
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(() => {
|
onMounted(() => {
|
||||||
//调用电梯接口 定时获取电梯接口 获取当前门状态
|
//调用电梯接口 定时获取电梯接口 获取当前门状态
|
||||||
@@ -139,47 +154,21 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '执行时间',
|
title: '执行时间',
|
||||||
dataIndex: 'age',
|
dataIndex: 'time',
|
||||||
key: 'age',
|
key: 'time',
|
||||||
width: 100,
|
width: 100,
|
||||||
|
customRender: ({ value }) => {
|
||||||
|
return value.substring(11, 19);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '状态',
|
title: '状态',
|
||||||
dataIndex: 'state',
|
dataIndex: 'EGstRu',
|
||||||
key: 'state',
|
key: 'EGstRu',
|
||||||
width: 160,
|
width: 160,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
const dataSource = [
|
const dataSource = ref([]);
|
||||||
{
|
|
||||||
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 visible = ref(false);
|
const visible = ref(false);
|
||||||
//详情属性
|
//详情属性
|
||||||
const detailed = ref(false);
|
const detailed = ref(false);
|
||||||
|
@@ -12,6 +12,13 @@
|
|||||||
</template>
|
</template>
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { ref } from 'vue';
|
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 {
|
export default {
|
||||||
setup() {
|
setup() {
|
||||||
@@ -21,6 +28,7 @@
|
|||||||
pagination.value.pageSize = pageSize;
|
pagination.value.pageSize = pageSize;
|
||||||
console.log(current, pageSize);
|
console.log(current, pageSize);
|
||||||
};
|
};
|
||||||
|
const info = ref({});
|
||||||
const pagination = ref({
|
const pagination = ref({
|
||||||
total: 0,
|
total: 0,
|
||||||
size: 'small',
|
size: 'small',
|
||||||
@@ -48,7 +56,7 @@
|
|||||||
width: 80,
|
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: '关闭' },
|
{ 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: '关闭' },
|
{ 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 toggle = (data: any) => {
|
const getList = () => {
|
||||||
console.log(data, '数据');
|
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) => {
|
||||||
|
info.value = data;
|
||||||
|
getList();
|
||||||
|
};
|
||||||
|
return {
|
||||||
|
columnLog,
|
||||||
|
dataSourceLog,
|
||||||
|
toggle,
|
||||||
|
pagination,
|
||||||
|
handleChangePage,
|
||||||
|
info,
|
||||||
|
getList,
|
||||||
};
|
};
|
||||||
return { columnLog, dataSourceLog, toggle, pagination, handleChangePage };
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
Reference in New Issue
Block a user