whychdw
2019-12-09 064c6d5b84fd6ddbbe4c20c41d139f7371460985
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
<template>
    <div class="new-home">
        <Form ref="newBatt" :model="home" :rules="rules">
            <Row :gutter="8">
                <!-- <i-col span="6">
                    <FormItem label="机房编号">
                        <i-input type="text" v-model.trim="home.StationId" placeholder="机房编号" disabled></i-input>
                    </FormItem>
                </i-col> -->
                <i-col span="6">
                    <FormItem label="省" prop="StationName1">
                        <i-input type="text" v-model.trim="home.StationName1" placeholder="省" disabled></i-input>
                    </FormItem>
                </i-col>
                <i-col span="6">
                    <FormItem label="市" prop="StationName2">
                        <i-input type="text" v-model.trim="home.StationName2" placeholder="市" disabled></i-input>
                    </FormItem>
                </i-col>
                <i-col span="6">
                    <FormItem label="区县" prop="StationName5">
                        <i-input type="text" v-model.trim="home.StationName5" placeholder="区县" disabled></i-input>
                    </FormItem>
                </i-col>
                <i-col span="6">
                    <FormItem label="机房名称" prop="StationName3">
                        <i-input type="text" v-model.trim="home.StationName3" placeholder="机房名称" disabled></i-input>
                    </FormItem>
                </i-col>
                <!-- <i-col span="6">
                    <FormItem label="机房IP">
                        <i-input type="text" v-model.trim="home.StationIp" placeholder="机房IP"></i-input>
                    </FormItem>
                </i-col> -->
                <!-- <i-col span="6">
                    <FormItem label="设备名称">
                        <i-input type="text" v-model.trim="home.StationName4" placeholder="设备名称"></i-input>
                    </FormItem>
                </i-col> -->
                <!-- <i-col span="6">
                    <FormItem label="FBS设备ID" prop="FBSDeviceId">
                        <i-input type="text" v-model.trim="home.FBSDeviceId" placeholder="FBS设备ID" disabled></i-input>
                    </FormItem>
                </i-col> -->
                <!-- <i-col span="6">
                    <FormItem label="FBS设备IP">
                        <i-input type="text" v-model.trim="home.FbsDeviceIp" placeholder="FBS设备IP"></i-input>
                    </FormItem>
                </i-col> -->
                <!-- <i-col span="6">
                    <FormItem label="子网掩码">
                        <i-input type="text" v-model.trim="home.FbsDeviceIp_YM" placeholder="子网掩码"></i-input>
                    </FormItem>
                </i-col> -->
                <!-- <i-col span="6">
                    <FormItem label="网关">
                        <i-input type="text" v-model.trim="home.FbsDeviceIp_WG" placeholder="网关"></i-input>
                    </FormItem>
                </i-col> -->
                <!-- <i-col span="6">
                    <FormItem label="FBS设备名称">
                        <i-input type="text" v-model.trim="home.FBSDeviceName" placeholder="FBS设备名称"></i-input>
                    </FormItem>
                </i-col> -->
                <!-- <i-col span="6">
                    <FormItem label="FBS设备索引">
                        <Select v-model="home.GroupIndexInFBSDevice" class="black">
                            <Option :value="0">0</Option>
                            <Option :value="1">1</Option>
                            <Option :value="2">2</Option>
                            <Option :value="3">3</Option>
                        </Select>
                    </FormItem>
                </i-col> -->
                <i-col span="6">
                    <FormItem label="电池组名称" prop="BattGroupName">
                        <i-input type="text" v-model.trim="home.BattGroupName" placeholder="电池组名称"></i-input>
                    </FormItem>
                </i-col>
                <!-- <i-col span="6">
                    <FormItem label="电池组ID" prop="BattGroupId">
                        <i-input type="text" v-model.trim="home.BattGroupId" placeholder="电池组ID"></i-input>
                    </FormItem>
                </i-col> -->
                <!-- <i-col span="6">
                    <FormItem label="机房内电池组组数">
                        <i-input type="text" v-model.trim="home.BattGroupNum" placeholder="机房内电池组组数"></i-input>
                    </FormItem>
                </i-col> -->
                <i-col span="6">
                    <FormItem label="浮充电压阀值" prop="FloatVolLevel">
                        <i-input type="text" v-model.trim="home.FloatVolLevel" placeholder="浮充电压阀值" disabled></i-input>
                    </FormItem>
                </i-col>
                <i-col span="6">
                    <FormItem label="离线电压阀值" prop="OfflineVolLevel">
                        <i-input type="text" v-model.trim="home.OfflineVolLevel" placeholder="离线电压阀值" disabled></i-input>
                    </FormItem>
                </i-col>
                <i-col span="6">
                    <FormItem label="浮充阀值" prop="BattFloatCurrent">
                        <i-input type="text" v-model.trim="home.BattFloatCurrent" placeholder="浮充阀值"></i-input>
                    </FormItem>
                </i-col>
                <i-col span="6">
                    <FormItem label="单体数量" prop="MonCount">
                        <i-input type="number" @on-change="handleVol" v-model.trim="home.MonCount" placeholder="单体数量"></i-input>
                    </FormItem>
                </i-col>
                <i-col span="6">
                    <FormItem label="标称容量" prop="MonCapStd">
                        <i-input type="text" v-model.trim="home.MonCapStd" placeholder="标称容量"></i-input>
                    </FormItem>
                </i-col>
                <i-col span="6">
                    <FormItem label="标称单体电压" prop="MonVolStd">
                        <i-input type="text" @on-change="handleVol" v-model.trim="home.MonVolStd" placeholder="标称单体电压"></i-input>
                    </FormItem>
                </i-col>
                <!-- <i-col span="6">
                    <FormItem label="标称单体内阻">
                        <i-input type="text" v-model.trim="home.MonResStd" placeholder="标称单体内阻"></i-input>
                    </FormItem>
                </i-col> -->
                <!-- <i-col span="6">
                    <FormItem label="标称单体电导">
                        <i-input type="text" v-model.trim="home.MonSerStd" placeholder="标称单体电导"></i-input>
                    </FormItem>
                </i-col> -->
                <!-- <i-col span="6">
                    <FormItem label="单体电压次低偏移量">
                        <i-input type="text" v-model.trim="home.MonVolLowToAvg" placeholder="单体电压次低偏移量"></i-input>
                    </FormItem>
                </i-col> -->
                <!-- <i-col span="6">
                    <FormItem label="负载电流">
                        <i-input type="text" v-model.trim="home.Load_curr" placeholder="负载电流"></i-input>
                    </FormItem>
                </i-col> -->
                <i-col span="6">
                    <FormItem label="最大核容电流" prop="DisCurrMax">
                        <i-input type="text" v-model.trim="home.DisCurrMax" placeholder="最大核容电流"></i-input>
                    </FormItem>
                </i-col>
                <i-col span="6">
                    <FormItem label="基站手机号码" prop="station_phone">
                        <i-input type="text" v-model.trim="home.station_phone" placeholder="基站手机号码"></i-input>
                    </FormItem>
                </i-col>
                <i-col span="6">
                    <FormItem label="电池品牌" prop="BattProducer">
                        <i-input type="text" v-model.trim="home.BattProducer" placeholder="电池品牌"></i-input>
                    </FormItem>
                </i-col>
                <i-col span="6">
                    <FormItem label="电池型号" prop="BattModel">
                        <i-input type="text" v-model.trim="home.BattModel" placeholder="电池型号"></i-input>
                    </FormItem>
                </i-col>
                <!-- <i-col span="6">
                    <FormItem label="电池生产日期">
                        <DatePicker type="date" v-model.trim="home.productDate" placeholder="电池生产日期"></DatePicker>
                    </FormItem>
                </i-col> -->
                <i-col span="6">
                    <FormItem label="投入使用日期" prop="BattInUseDate">
                        <DatePicker type="date" v-model.trim="home.BattInUseDate" placeholder="投入使用日期"></DatePicker>
                    </FormItem>
                </i-col>
            </Row>
        </Form>
        <div style="text-align:right; background-color: #FFFFFF;">
            <Button :loading="enLoading" type="primary" @click="handleEditBatt">确认修改</Button>
        </div>
    </div>
</template>
<script>
import {ajax} from '../libs/common'
export default {
    props: {
        info: {
            type: [Number, Object],
            default: function() {
                return -1;
            }
        }
    },
    data(){
        return {
            home: {
                StationId: '42000064',      // 机房编号
                StationName1: '',   // 省 
                StationName2: '',   // 市
                StationName5: '',   // 区县
                StationName3: '',   // 机房名称
                StationName4: 'LD-9',   // 设备名称
                StationName: '',    // 全称(省+市+区县+机房名称+设备名称)
                StationIp: '192.168.0.5',      // 机房IP
                FBSDeviceId: '401900227',    // FBS设备ID(重要)
                FbsDeviceIp: '192.168.0.88',    // FBS设备IP(重要)
                FbsDeviceIp_YM: '255.255.255.0', // 子网掩码
                FbsDeviceIp_WG: '192.168.0.1', // 网关
                FBSDeviceName: 'LD-9',  // FBS设备名称
                GroupIndexInFBSDevice: '0', // FBS设备索引
                BattGroupId: '1000131',    // 电池组ID
                BattGroupNum: '1',   // 机房内电池组组数
                BattGroupName: '',  // 电池组名称
                FloatVolLevel: '120.6',  // 浮充电压阀值
                OfflineVolLevel: '115.9', // 离线电压阀值
                BattFloatCurrent: '0.6', // 浮充阀值
                MonCount: '9',   // 单体数量
                MonCapStd: '40',  // 标称容量
                MonVolStd: '12',  // 标称单体电压
                MonResStd: '0.2',  // 标称单体内阻
                MonSerStd: '5000',  // 标称单体电导
                MonVolLowToAvg: '0.05', // 单体电压次低偏移量
                Load_curr: '10',  // 负载电流
                DisCurrMax: '4', // 最大核容电流
                station_phone: '',  // 基站手机号码
                BattProducer: '',   // 电池品牌
                BattModel: '',      // 电池型号
                BattProductDate: '2006-07-06',    // 电池生产日期
                BattInUseDate: '2019-11-28',        // 投入使用日期
                // 分割线
                Vol_grade: '0',      // 电压等级(kV)
                Manufacturers: '',  // 生产厂家
                Assetequipment: '', // 是否资产级设备
                Deviceclasspath: '',    // 设备分类全路径
                Deviceoperationdepartment: '',  // 设备运维部门
                PropertyRightUnit: '',  // 产权单位
                PropertyAttribute: '',  // 产权属性
                FactoryNumber: '',      // 出厂编号
                OperationTeam: '',      // 运维(保管)班组
                DeviceIdentityCode: '', // 设备身份编码
                ProjectType: '',        // 项目类型
                BatteryApplicationType: '',     // 蓄电池应用类型
                SingleRatedVoltage: '0',     // 单电压额定电压
                RemoteMonitor: '',      // 是否实现远程监控
                BatttIndependentPlaced: '',     // 是否独立蓄电池室放置
                JunChargeVoltageValue: '0',      // 均充电压设定值
            },
            rules: {
                StationName1: [
                    { required: true, message: '不能为空', trigger: 'blur',},
                ],
                StationName2: [
                    { required: true, message: '不能为空', trigger: 'blur',},
                ],
                StationName5: [
                    { required: true, message: '不能为空', trigger: 'blur',},
                ],
                StationName3: [
                    { required: true, message: '不能为空', trigger: 'blur',},
                ],
                FBSDeviceId: [
                    { required: true, message: '不能为空', trigger: 'blur',transform(value) {
                        return value.toString();
                    }},
                    { type:"integer", message: '请输入数字格式', trigger: 'blur',transform(value) {
                        return Number(value);
                    }},
                ],
                BattGroupId: [
                    { required: true, message: '不能为空', trigger: 'blur',transform(value) {
                        return value.toString();
                    }},
                    { type:"integer", message: '请输入数字格式', trigger: 'blur',transform(value) {
                        return Number(value);
                    }},
                ],
                BattGroupName:[
                    { required: true, message: '不能为空', trigger: 'blur',},
                ],
                FloatVolLevel: [
                    { required: true, message: '不能为空', trigger: 'blur',transform(value) {
                        return value.toString();
                    }},
                    { type:"number", message: '请输入数字格式', trigger: 'blur',transform(value) {
                        return Number(value);
                    }},
                ],
                OfflineVolLevel: [
                    { required: true, message: '不能为空', trigger: 'blur',transform(value) {
                        return value.toString();
                    }},
                    { type:"number", message: '请输入数字格式', trigger: 'blur',transform(value) {
                        return Number(value);
                    }},
                ],
                BattFloatCurrent: [
                    { required: true, message: '不能为空', trigger: 'blur',transform(value) {
                        return value.toString();
                    }},
                    { type:"number", message: '请输入数字格式', trigger: 'blur',transform(value) {
                        return Number(value);
                    }},
                ],
                MonCount: [
                    { required: true, message: '不能为空', trigger: 'blur',transform(value) {
                        return value.toString();
                    }},
                    { type:"integer", message: '请输入数字格式', trigger: 'blur',transform(value) {
                        return Number(value);
                    }},
                ],
                MonCapStd: [
                    { required: true, message: '不能为空', trigger: 'blur',transform(value) {
                        return value.toString();
                    }},
                    { type:"number", message: '请输入数字格式', trigger: 'blur',transform(value) {
                        return Number(value);
                    }},
                ],
                MonVolStd: [
                    { required: true, message: '不能为空', trigger: 'blur',transform(value) {
                        return value.toString();
                    }},
                    { type:"number", message: '请输入数字格式', trigger: 'blur',transform(value) {
                        return Number(value);
                    }},
                ],
                DisCurrMax: [
                    { required: true, message: '不能为空', trigger: 'blur',transform(value) {
                        return value.toString();
                    }},
                    { type:"number", message: '请输入数字格式', trigger: 'blur',transform(value) {
                        return Number(value);
                    }},
                ],
                station_phone: [
                    { required: true, message: '不能为空', trigger: 'blur',},
                ],
                BattProducer: [
                    { required: true, message: '不能为空', trigger: 'blur',},
                ],
                BattModel: [
                    { required: true, message: '不能为空', trigger: 'blur',},
                ],
                BattInUseDate: [
                    { type: 'date', required: true, message: '不能为空', trigger: 'blur',},
                ]
            },
            enLoading: false
        }
    },
    methods: {
        init: function() {
            if(typeof(this.info) == 'object') {
                Object.assign(this.home, this.info);
            }
        },
        handleEditBatt: function() {
            this.$refs.newBatt.validate((valid) => {
                if(valid) {
                    this.editBatt();
                }else {
                    this.$Message.error('存在格式不合法数据!');
                }
            });
        },
        handleVol: function() {
            var monCount = this.home.MonCount;
            var vol = this.home.MonVolStd;
            var chargeVol = (vol*1.117*monCount).toFixed(1);
            var outlineVol = (vol*1.073*monCount).toFixed(1);
            this.home.FloatVolLevel = chargeVol;
            this.home.OfflineVolLevel = outlineVol;
        },
        editBatt: function() {
            var self = this;
            var home = Object.assign({}, this.home);
            // 省-市-区县-机房名称-设备名称
            home.StationName = home.StationName1+'-'+home.StationName2+'-'+home.StationName5+'-'+
                                home.StationName3+'-'+home.StationName4;
            home.BattProductDate = new Date(home.BattProductDate).format("yyyy-MM-dd");
            home.BattInUseDate = new Date(home.BattInUseDate).format("yyyy-MM-dd");
            // 构造查询条件
            var searchParams = [home];
            // 加载等待框
            this.enLoading = true;
            // 请求后台添加
            ajax({
                url: 'BattInfAction!update',
                data: 'json='+JSON.stringify(searchParams),
                success: function(res) {
                    var rs = JSON.parse(res.result);
                    if(rs.code == 1) {
                        self.$emit('ensure', true);
                        self.$Message.success('修改成功!');
                    }else {
                        self.$emit('ensure', false);
                        self.$Message.success('修改失败!');
                    }
                },
                complete: function() {
                    // 关闭按钮的等待框
                    self.enLoading = false;
                }
            });
        },
    },
    mounted: function() {
        // 初始化信息
        this.init();
    }
}
</script>