分支自 SuZhouGuanHong/TaiYuanTaiZhong

dengjunjie
2024-04-16 f0e2d9d2c7c41b311217bdb2c4d114ff53f6a146
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
<template>
    <div class="content">
        <el-button type="primary" size="small" @click="this.$router.push({ path: 'home' })">返回</el-button>
 
        <h3>子车参数设置</h3>
        <div>
            <div class="item" v-for="item in childerParm" :key="item.dbAddress">
                <el-row>
                    <el-col :span="2"> </el-col>
                    <el-col :span="8">
                        <div class="lable">{{ item.name }}</div>
                    </el-col>
                    <el-col :span="8">
                        <el-input size="small" type="number" placeholder="请输入值" v-model="item.value"></el-input>
                    </el-col>
                    <el-col :span="4"> </el-col>
                </el-row>
            </div>
        </div>
        <div class="buttom">
            <el-button type="success" size="small" @click="SaveAndSet">保存并设置</el-button>
            <el-button type="primary" size="small" @click="GetChidlerParm(true)">刷新</el-button>
        </div>
 
    </div>
</template>
 
<script>
import { ElMessage as Message } from 'element-plus';
 
export default {
    data() {
        return {
            childerParm: "" //子车参数
        };
    },
    mounted() {
        this.GetChidlerParm();
    },
    methods: {
        GetChidlerParm(isRefrence) {
            this.http.post("/api/Childer/GetChidlerParm", {}, true).then((x) => {
                if (!x.status)
                    return Message.error(x.message);
                this.childerParm = JSON.parse(x.data);
                if (isRefrence) {
                    Message.success('刷新成功');
                }
            });
        },
        SaveAndSet() {
            this.http.post("/api/Childer/SetChilderParm", this.childerParm, true).then((x) => {
                if (!x.status)
                    return Message.error(x.message);
                Message.success(x.message);
            });
        }
    },
}
</script>
 
<style scoped>
.content {
    margin: 20px auto;
    width: 50%;
    border: 1px solid red;
    padding: 10px;
    border-radius: 5px;
}
 
h3 {
    text-align: center;
    padding-bottom: 10px;
}
 
.item {
    margin-top: 10px;
}
 
.lable {
    font-size: 13.5px;
    text-align: right;
    padding-right: 10px;
}
 
.buttom {
    margin-top: 8px;
    display: flex;
    justify-content: space-around;
}
</style>