whychdw
2021-05-24 393c717d50fe8933e57d3014c6932b2acb750a50
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<template>
    <div class="test-check">
        <div class="test-explain">
            <p class="p-h">前置条件检查</p>
        </div>
        <div class="test-explain"
            v-loading="loading"
            element-loading-text="检查中"
            element-loading-spinner="el-icon-loading"
            element-loading-background="rgba(0, 0, 0, 0)">
            <table>
                <tbody>
                <tr v-for="(item, key) in list" :key="'item'+key">
                    <td class="td-name">{{ item.name }}</td>
                    <td>{{ item.valueDescription }}</td>
                    <td class="td-status">{{ item.status ? "检查正常" : "检查异常" }}</td>
                </tr>
                </tbody>
            </table>
        </div>
        <div class="test-check-button" v-if="showButton">
            <el-button type="primary" size="small" @click="startTest">开始试验</el-button>
        </div>
    </div>
</template>
 
<script>
import {checkPrecondition} from "@/pages/test/js/api";
 
export default {
    name: "testStepCheck",
    props: {
        type: {
            type: String,
            default: ""
        }
    },
    data() {
        return {
            loading: false,
            showButton: false,
            list: [],
        }
    },
    methods: {
        checkPrecondition() {
            this.loading = true;
            this.$nextTick(() => {
                checkPrecondition(this.type).then(res => {
                    let rs = res.data;
                    let data = [];
                    if (rs.code == 1) {
                        data = rs.data;
                    }
                    this.list = data;
                    this.loading = false;
                    this.showButton = true;
                }).catch(error => {
                    this.loading = false;
                    console.log(error);
                });
            });
        },
        startTest() {
            this.$emit('startTest');
        }
    },
    mounted() {
        this.checkPrecondition();
    }
}
</script>
 
<style scoped>
.p-h {
    font-size: 18px;
    font-weight: 700;
}
 
.test-check {
    min-height: 300px;
}
 
.test-explain table {
    margin-left: 32px;
}
 
.test-explain table td {
    padding: 4px 16px;
}
 
.test-explain table td.td-name {
    text-align: right;
}
 
.test-explain table td.td-status {
    font-weight: 700;
}
 
.test-check-button {
    padding: 8px 16px;
    text-align: right;
}
</style>