<template>
|
<div class="Enteroverhaul">
|
<div class="btns">
|
<el-button class="btn" type="primary" @click="startMaintenceTask">
|
<div
|
style="
|
display: flex;
|
flex-direction: column;
|
align-items: center;
|
justify-content: center;
|
"
|
>
|
<img
|
style="width: 4.75rem; height: 4.75rem"
|
src="@/assets/Enteroverhaul/start.png"
|
alt=""
|
/>
|
<span
|
style="
|
color: rgba(0, 239, 248, 1);
|
font-size: 1.25rem;
|
margin-top: 1.6rem;
|
"
|
class="btn_text"
|
>开始检修</span
|
>
|
</div>
|
</el-button>
|
<el-button
|
class="btn"
|
type="primary"
|
style="margin-left: 6.81rem"
|
@click="stopMaintenceTask"
|
>
|
<div
|
style="
|
display: flex;
|
flex-direction: column;
|
align-items: center;
|
justify-content: center;
|
"
|
>
|
<img
|
style="width: 4.75rem; height: 4.75rem"
|
src="@/assets/Enteroverhaul/pause.png"
|
alt=""
|
/>
|
<span
|
style="
|
color: rgba(0, 239, 248, 1);
|
font-size: 1.25rem;
|
margin-top: 1.6rem;
|
"
|
class="btn_text"
|
>结束检修</span
|
>
|
</div>
|
</el-button>
|
</div>
|
<div class="content_box">
|
<el-table
|
:height="isMobile ? '' : '250'"
|
empty-text="暂无数据"
|
:data="tableData"
|
style="width: 100%"
|
:header-cell-style="{
|
height: '1.61rem',
|
color: '#1AC8FE',
|
background: '#0A5B91',
|
fontSize: '2rem',
|
}"
|
:cell-style="{
|
color: '#fff',
|
background: '#147BAF',
|
fontSize: '2.5rem',
|
}"
|
>
|
<el-table-column
|
prop="userTrueName"
|
label="用户名称"
|
align="center"
|
min-width="1%"
|
/>
|
<el-table-column
|
prop="unit"
|
label="单位"
|
align="center"
|
min-width="1%"
|
/>
|
<el-table-column
|
prop="userteam"
|
align="center"
|
label="班组"
|
min-width="1%"
|
/>
|
<el-table-column
|
prop="roleName"
|
align="center"
|
label="角色"
|
min-width="1%"
|
/>
|
<el-table-column
|
prop="ipAddress"
|
label="轨道站"
|
align="center"
|
min-width="1%"
|
/>
|
<el-table-column
|
prop="maintenanceStatus"
|
label="检修状态"
|
align="center"
|
min-width="1%"
|
>
|
<template #default="scope">
|
<span v-if="scope.row.maintenanceStatus === 0">未开始</span>
|
<span v-else-if="scope.row.maintenanceStatus === 1">进行中</span>
|
<span v-else-if="scope.row.maintenanceStatus === 2"
|
>已结束</span
|
></template
|
>
|
</el-table-column>
|
<el-table-column
|
prop="maintenancStartTime"
|
label="开始时间"
|
align="center"
|
min-width="2%"
|
/>
|
<el-table-column prop="" label="操作" align="center" min-width="2%">
|
<template #default="scope">
|
<el-button
|
type="primary"
|
size="small"
|
@click="forceOffline(scope.row)"
|
>
|
强制下线</el-button
|
>
|
</template>
|
</el-table-column>
|
</el-table>
|
</div>
|
<el-pagination
|
style="margin-top: 2rem"
|
background
|
layout="prev, pager, next"
|
:total="pageTotal"
|
@current-change="handleCurrentChange"
|
/>
|
</div>
|
</template>
|
<script setup>
|
import { onMounted, reactive, ref, toRef } from "vue";
|
import store from "@/store/index";
|
import {
|
MaintenanceTasksOfTheDay,
|
StartMaintenceTask,
|
StopMaintenanceTask,
|
} from "@/api/user";
|
import {
|
YShowStartTake,
|
PersonnelMonitoring,
|
ForceOffline,
|
} from "@/api/newapi/Maintenance.js";
|
import { ElMessage } from "element-plus";
|
|
const userInfo = ref(store.state.userInfo);
|
const isStart = ref(false); //是否开始检修
|
const tableData = ref([]); //检修任务数据
|
const isMobile = ref(false); //是否是移动端
|
const obj = {
|
selectType: "",
|
inputcontent: "",
|
};
|
const queryForm = toRef({ ...obj });
|
//分页请求参数
|
const pageQuery = reactive({
|
page: 1, //当前页面
|
rows: 20, //每页显示条数
|
order: "desc", //排序方式
|
sort: "", //排序字段
|
wheres: "", //条件查询
|
});
|
const pageTotal = ref(0); //总条数
|
//获取当天检修任务
|
const getMaintenanceTasksOfTheDay = async () => {
|
MaintenanceTasksOfTheDay({
|
account: userInfo.value.userName,
|
}).then((res) => {
|
tableData.value = [res.data];
|
});
|
};
|
const getStartTake = async () => {
|
PersonnelMonitoring({
|
pageIndex: pageQuery.page,
|
pageSize: pageQuery.rows,
|
searchKeyword: queryForm.value.inputcontent,
|
}).then((res) => {
|
if (res.data.length > 0) {
|
isStart.value = true;
|
} else {
|
isStart.value = false;
|
}
|
pageTotal.value = res.data.totalCount;
|
tableData.value = res.data.items;
|
});
|
};
|
const startdisabled = ref(false); //开始按钮是否禁用
|
//开始检修
|
const startMaintenceTask = async () => {
|
StartMaintenceTask({
|
account: userInfo.value.userName,
|
}).then((res) => {
|
getStartTake();
|
});
|
};
|
//结束检修
|
const stopMaintenceTask = async () => {
|
StopMaintenanceTask({
|
account: userInfo.value.userName,
|
}).then((res) => {
|
isStart.value = false;
|
getStartTake();
|
});
|
};
|
// 强制下线
|
const forceOffline = async (row) => {
|
ForceOffline({
|
id: row.id,
|
account: userInfo.value.userName,
|
}).then((res) => {
|
ElMessage({
|
message: res.message,
|
type: "success",
|
duration: 2000,
|
});
|
getStartTake();
|
});
|
};
|
const handleCurrentChange = (val) => {
|
pageQuery.page = val;
|
getStartTake();
|
};
|
|
onMounted(() => {
|
console.log(pageQuery);
|
|
// getMaintenanceTasksOfTheDay();
|
// 获取当前屏幕得宽度
|
const screenWidth = window.innerWidth;
|
if (screenWidth <= 1080) {
|
isMobile.value = true;
|
}
|
getStartTake();
|
});
|
</script>
|
<style lang="scss" scoped>
|
.Enteroverhaul {
|
display: flex;
|
flex-direction: column;
|
align-items: center;
|
|
.btns {
|
margin-top: 7%;
|
.btn {
|
width: 12.19rem;
|
height: 11.63rem;
|
background-image: url("@/assets/Enteroverhaul/btnbg.png");
|
background-size: 100% 100%;
|
background-repeat: no-repeat;
|
border: none;
|
}
|
}
|
|
.content_box {
|
width: 95%;
|
height: 40%;
|
background-color: rgba(9, 48, 104, 1);
|
color: rgba(16, 16, 16, 1);
|
font-size: 0.88rem;
|
box-shadow: 0rem 0.13rem 0.38rem 0rem rgba(6, 229, 231, 1);
|
border: 0.06rem solid rgba(6, 229, 231, 1);
|
margin-top: 5.19rem;
|
}
|
}
|
:deep(.el-table__empty-block) {
|
background-color: rgb(9, 48, 104);
|
}
|
@media screen and (max-width: 1080px) {
|
.Enteroverhaul {
|
display: flex;
|
flex-direction: column;
|
align-items: center;
|
|
.btns {
|
margin-top: 7%;
|
.btn {
|
width: 25.19rem;
|
height: 24.63rem;
|
background-image: url("@/assets/Enteroverhaul/btnbg.png");
|
background-size: 100% 100%;
|
background-repeat: no-repeat;
|
border: none;
|
.btn_text {
|
font-size: 2.88rem !important;
|
}
|
}
|
}
|
|
.content_box {
|
width: 95%;
|
height: 40%;
|
background-color: rgba(9, 48, 104, 1);
|
color: rgba(16, 16, 16, 1);
|
font-size: 0.88rem;
|
box-shadow: 0rem 0.13rem 0.38rem 0rem rgba(6, 229, 231, 1);
|
border: 0.06rem solid rgba(6, 229, 231, 1);
|
margin-top: 5.19rem;
|
}
|
}
|
}
|
</style>
|