fix: 对接电动门接口 电梯接口

This commit is contained in:
zhaohy
2024-08-19 16:15:37 +08:00
parent 45d914b16e
commit 580d82639d
9 changed files with 215 additions and 205 deletions

View File

@@ -29,9 +29,17 @@
</template>
<script setup lang="ts">
import { ref, onMounted } from 'vue';
import { ref, onMounted, onUnmounted } from 'vue';
import liftInfo from './liftInfo.vue';
import liftPage from './liftPage.vue';
import { liftSystemApi } from '/@/api/liftSystem';
import { http } from '/nerv-lib/util';
// 全局变量
import { items } from '/@/store/item';
// 全局变量
const state = items();
//位置文件
import { liftPosition, longPosition } from './liftPosition';
// 请求
//弹窗
@@ -42,85 +50,53 @@
const selctLeft = ref({});
// table页面 ref
const leftPage = ref(null);
// 初始化 ===========================================================
onMounted(() => {});
const liftBox = ref([]);
// tab页部分 ========================================================
const liftBox = ref([
{
name: '1站台西侧扶梯',
workState: 1,
faultState: 2,
direction: 1,
type: 2,
isLeft: true,
styleText: { left: '10%', bottom: '33%' },
},
{
name: '2站台西侧扶梯',
workState: 1,
faultState: 2,
direction: 1,
type: 2,
isLeft: true,
styleText: { left: '3%', bottom: '52%' },
},
{
name: '2站台东侧扶梯',
workState: 1,
faultState: 2,
direction: 1,
type: 2,
isLeft: true,
styleText: { left: '48%', bottom: '69%' },
},
{
name: '1站台东侧扶梯',
workState: 1,
faultState: 2,
direction: 1,
type: 2,
isLeft: true,
styleText: { left: '65%', bottom: '62%' },
},
{
name: '办公东区扶梯',
workState: 1,
faultState: 2,
direction: 1,
type: 2,
isLeft: true,
styleText: { left: '78%', bottom: '42%' },
},
{
name: '办公西区扶梯',
workState: 1,
faultState: 2,
direction: 1,
type: 2,
isLeft: true,
styleText: { left: '15%', bottom: '15%' },
},
{
name: '1站台直梯',
workState: 0,
faultState: 3,
direction: 0,
type: 1,
isLeft: false,
styleText: { left: '35%', bottom: '50%' },
},
{
name: '2站台直梯',
workState: 0,
faultState: 3,
direction: 0,
type: 1,
isLeft: false,
styleText: { left: '52%', bottom: '52%' },
},
]);
//获取电梯数据
const getList = () => {
let leftIndex = 0;
let longIndex = 0;
http
.get(liftSystemApi.getDeviceState, {
projectId: state.projectId,
siteId: state.siteId,
floor: 1,
})
.then((res) => {
let data = [];
res.data.forEach((item: any) => {
//用来区分直梯 还是 扶梯
if (item.record.deviceId.includes('0301')) {
data.push({
...item,
type: 2, //扶梯
isLeft: true, // 扶梯
styleText: liftPosition()[leftIndex++],
});
} else {
data.push({
...item,
type: 1,
isLeft: false,
styleText: longPosition()[longIndex++],
});
}
});
console.log(data);
liftBox.value = data;
});
};
//定时
const intervalId = setInterval(getList, 60000);
// 初始化 ===========================================================
onMounted(() => {
getList();
});
// 页面销毁
onUnmounted(() => {
// 这里写销毁时需要执行的逻辑
clearInterval(intervalId);
});
//点击获取详情
const clickLift = (item: any) => {
visible.value = true;