whyczyk
2021-05-24 c71af224490b9fe9fdca0b3c0ace6e0714453be9
试验管理界面接口提交
1个文件已修改
173 ■■■■■ 已修改文件
src/pages/test/testManager/testing.vue 173 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/test/testManager/testing.vue
@@ -1,27 +1,27 @@
<template>
    <div class="flex-wrapper">
        <test-card :title="info.name">
        <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">2021年5月XX项目试验</span>
                    <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">李博士</span>
                    <span class="form-item-value">{{info.username}}</span>
                </div>
                <div class="form-item">
                    <label class="form-item-label">试验创建时间:</label>
                    <span class="form-item-value">2021/5/7 11:08:53</span>
                    <span class="form-item-value">{{info.createTime}}</span>
                </div>
                <div class="form-item">
                    <label class="form-item-label">预计完成时间:</label>
                    <span class="form-item-value">2021/5/7 15:00:00</span>
                    <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-select size="small"></el-select>
                        <el-input :value="info.typeName" placeholder="试验类型" disabled></el-input>
                    </div>
                </div>
                <div class="form-item flex">
@@ -35,13 +35,12 @@
                <div class="form-item flex">
                    <label class="form-item-label">参试人员:</label>
                    <div class="form-item-value">
                        <mw-avatar>李小红</mw-avatar>
                        <mw-avatar>张小刚</mw-avatar>
                        <mw-avatar>{{info.username}}</mw-avatar>
                    </div>
                </div>
            </div>
            <div class="form-footer" slot="footer">
                <el-button type="primary" size="mini">进入试验</el-button>
                <el-button type="primary" size="mini" @click="goTest">进入试验</el-button>
            </div>
        </test-card>
        <test-card no-footer>
@@ -49,74 +48,124 @@
                <span class="title-pillar"></span>
                试验进度
            </div>
            <mw-test-step></mw-test-step>
            <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";
export default {
    name: "testManagerTesting",
    components: {
        MwTestStep,
        MwAvatar,
        TestCard
    },
    data() {
        return {
            info: {
                name: '空载试验',
    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";
    export default {
        name: "testManagerTesting",
        components: {
            MwTestStep,
            MwAvatar,
            TestCard
        },
        data() {
            return {
                info: {},
                list: []
            }
        },
        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;
                        if (this.info.type == "fz") {
                            this.info.typeName = "负载试验"
                        } else if (this.info.type == "kz") {
                            this.info.typeName = "空载试验"
                        }
                        console.log(this.info)
                        this.experimentPoint(rs.data.id)
                    } 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() {
        }
    },
    methods: {},
    computed: {},
    mounted() {
    },
    destroyed() {
    }
}
</script>
<style scoped>
.flex-wrapper {
    display: flex;
    flex-direction: row;
}
    .flex-wrapper {
        display: flex;
        flex-direction: row;
    }
.form-wrapper {
    color: #999999;
    font-size: 14px;
}
    .form-wrapper {
        color: #999999;
        font-size: 14px;
    }
.form-item {
    margin-bottom: 8px;
}
    .form-item {
        margin-bottom: 8px;
    }
.form-item.inline {
    display: inline-block;
    margin-right: 32px;
}
    .form-item.inline {
        display: inline-block;
        margin-right: 32px;
    }
.form-item.flex {
    display: flex;
    flex-direction: row;
}
    .form-item.flex {
        display: flex;
        flex-direction: row;
    }
.form-item.flex .form-item-value {
    flex: 1;
}
    .form-item.flex .form-item-value {
        flex: 1;
    }
.form-item .form-item-label {
    display: inline-block;
    width: 108px;
    line-height: 40px;
    text-align: right;
}
    .form-item .form-item-label {
        display: inline-block;
        width: 108px;
        line-height: 40px;
        text-align: right;
    }
</style>