he wei
2024-09-21 70edda3b00f2528a473c28ec5a50b739ed160f0f
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
<template>
  <div class="params-dialog">
    <div class="row">
      <div class="label">电池组号</div>
      <div class="value">
        <el-select v-model="battGroupNum">
          <el-option v-for="(item, idx) in List" :key="'list_' + idx" :label="item.label" :value="item.value"></el-option>
        </el-select>
      </div>
    </div>
    <div class="form-footer">
      <three-btn @click="stop">停止</three-btn>
      <three-btn @click="$emit('close')">关闭</three-btn>
    </div>
  </div>
</template>
 
<script>
import const_9141 from "@/assets/js/const/const_9141";
import {
  controllerParalle as stop,
} from "../js/realTime";
 
export default {
  props: {
    batt: {
      type: Object,
      default() {
        return {};
      },
    },
    type: {
      type: String,
      default: 'charge'
    },
  },
  data() {
    let {
      cmd,
      testCmd,
      groupIndexList,
    } = const_9141;
    return {
      battGroupNum: 0,
      List: [
        ...groupIndexList,
        {
          label: '全部',
          value: 255
        }
      ],
      cmd,
      testCmd,
    };
  },
  methods: {
    // 启动
    stop() {
      // 启动组 this.startNum
      // 等待框
      let loading = this.$layer.loading(1);
      let params = {
        opCmd: this.cmd.stop,
        devId: this.batt.fbsdeviceId,
        battGroupNum: this.battGroupNum,
        testCmd: this.testCmd[this.type],
      }
      // 请求后台
      stop(params)
        .then((res) => {
          res = res.data;
          if (res.code && res.data) {
            // 提示信息
            this.$layer.msg("操作成功");
            // 关闭弹出框
            this.$emit("close");
          } else {
            // 提示信息
            this.$layer.msg("操作失败");
          }
          // 关闭等待框
          this.$layer.close(loading);
        })
        .catch((error) => {
          console.log(error);
          // 关闭等待框
          this.$layer.close(loading);
          // 提示信息
          this.$layer.msg("操作失败,请求异常!");
        });
    },
  },
  computed: {
  },
  mounted() {
    console.log(this.batt);
  },
};
</script>
 
<style scoped>
.row {
  display: flex;
  align-items: center;
}
.label {
  display: inline-block;
  width: 5em;
  font-weight: bold;
  text-align: right;
  margin-right: .4em;
}
.value {
  flex: 1;
}
.form-footer {
  margin-top: 16px;
  margin-bottom: 16px;
  text-align: right;
}
 
.form-footer .three-btn {
  margin-left: 12px;
}
</style>