<template>
|
<div class="flex-wrapper">
|
<test-card :title="info.typeName">
|
<div class="form-wrapper">
|
<div class="form-item inline">
|
<label class="form-item-label">试验项目名称:</label>
|
<span class="form-item-value">{{info.projectName}}</span>
|
</div>
|
<div class="form-item inline">
|
<label class="form-item-label">试验创建人:</label>
|
<span class="form-item-value">{{info.username}}</span>
|
</div>
|
<div class="form-item">
|
<label class="form-item-label">试验创建时间:</label>
|
<span class="form-item-value">{{info.createTime}}</span>
|
</div>
|
<div class="form-item">
|
<label class="form-item-label">预计完成时间:</label>
|
<span class="form-item-value">{{info.endTime}}</span>
|
</div>
|
<div class="form-item flex">
|
<label class="form-item-label">试验类型:</label>
|
<div class="form-item-value">
|
<el-input :value="info.typeName" placeholder="试验类型" disabled></el-input>
|
</div>
|
</div>
|
<div class="form-item flex">
|
<label class="form-item-label">受试设备:</label>
|
<div class="form-item-value">
|
<el-checkbox readonly="readonly">设备一</el-checkbox>
|
<el-checkbox readonly="readonly">设备二</el-checkbox>
|
<el-checkbox readonly="readonly">设备三</el-checkbox>
|
</div>
|
</div>
|
<div class="form-item flex">
|
<label class="form-item-label">参试人员:</label>
|
<div class="form-item-value">
|
<mw-avatar>{{info.username}}</mw-avatar>
|
</div>
|
</div>
|
</div>
|
<div class="form-footer" slot="footer">
|
<el-button type="primary" size="mini" @click="goTest">进入试验</el-button>
|
</div>
|
</test-card>
|
<test-card no-footer v-if="stepShow">
|
<div slot="title" class="page-panel-title">
|
<span class="title-pillar"></span>
|
试验进度
|
</div>
|
<mw-test-step :list="list"></mw-test-step>
|
</test-card>
|
</div>
|
</template>
|
|
<script>
|
import TestCard from "@/components/smallModule/TestCard";
|
import MwAvatar from "@/components/smallModule/mwAvatar";
|
import MwTestStep from "@/components/smallModule/mwTestStep";
|
import {
|
getExitTest,
|
experimentPoint
|
} from "@/pages/test/js/api";
|
import {getItemByValue} from "@/assets/js/tools";
|
import {constTestType} from "@/pages/test/js/const";
|
export default {
|
name: "testManagerTesting",
|
components: {
|
MwTestStep,
|
MwAvatar,
|
TestCard
|
},
|
data() {
|
return {
|
info: {},
|
list: [],
|
stepShow: false,
|
}
|
},
|
methods: {
|
experimentPoint(id) {
|
let postData = {
|
experimentId: id
|
}
|
experimentPoint(postData).then((res) => {
|
let rsData = res.data;
|
if (rsData.code == 1) {
|
rsData.data.map(item => {
|
this.list.push({
|
name: item.name,
|
status: item.status,
|
start: item.startTime ? `开始时间${item.startTime}` : '',
|
end: item.endTime ? `完成时间${item.endTime}` : '',
|
endText: item.averagePower ? `平均功率${item.averagePower}kW` : '',
|
})
|
})
|
}
|
}).catch((err) => {
|
console.log(err)
|
});
|
},
|
checkIsTesting() {
|
getExitTest().then(res => {
|
let rs = res.data;
|
if (rs.code == 1) {
|
this.info = rs.data;
|
let type = this.info.type;
|
let testInfo = getItemByValue(type, constTestType);
|
if (testInfo != -1) {
|
this.info.typeName = testInfo.label;
|
this.stepShow = testInfo.step;
|
// 显示测试步骤
|
if(this.stepShow) {
|
this.experimentPoint(rs.data.id);
|
}
|
|
}else {
|
this.info.typeName = "未知试验类型";
|
}
|
|
|
} else {
|
this.dialogVisible = true;
|
}
|
}).catch(error => {
|
|
});
|
},
|
goTest() {
|
if (this.info.type == "fz") {
|
this.$router.push('/index/loadTest');
|
} else if (this.info.type == "kz") {
|
this.$router.push('/index/noLoadTest');
|
}
|
}
|
},
|
computed: {},
|
mounted() {
|
this.checkIsTesting()
|
},
|
destroyed() {
|
|
}
|
}
|
</script>
|
|
<style scoped>
|
.flex-wrapper {
|
display: flex;
|
flex-direction: row;
|
}
|
|
.form-wrapper {
|
color: #999999;
|
font-size: 14px;
|
}
|
|
.form-item {
|
margin-bottom: 8px;
|
}
|
|
.form-item.inline {
|
display: inline-block;
|
margin-right: 32px;
|
}
|
|
.form-item.flex {
|
display: flex;
|
flex-direction: row;
|
}
|
|
.form-item.flex .form-item-value {
|
flex: 1;
|
}
|
|
.form-item .form-item-label {
|
display: inline-block;
|
width: 108px;
|
line-height: 40px;
|
text-align: right;
|
}
|
</style>
|