<template>
|
<div class="new-home">
|
<Form ref="newHome" :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">
|
<Select
|
v-model="home.StationName1"
|
@on-change="searchCity"
|
class="black">
|
<Option
|
v-for="item in linkage.province"
|
:key="item"
|
:value="item">{{item}}</Option>
|
<Option value="-100">其他</Option>
|
</Select>
|
</FormItem>
|
</i-col>
|
<i-col span="6">
|
<FormItem label="市" prop="StationName2">
|
<Select v-model="home.StationName2" @on-change="searchCounty" class="black">
|
<Option
|
v-for="item in linkage.city"
|
:key="item"
|
:value="item">{{item}}</Option>
|
<Option value="-100">其他</Option>
|
</Select>
|
</FormItem>
|
</i-col>
|
<i-col span="6">
|
<FormItem label="区县" prop="StationName5">
|
<Select v-model="home.StationName5" @on-change="handleCounty" class="black">
|
<Option
|
v-for="item in linkage.county"
|
:key="item"
|
:value="item">{{item}}</Option>
|
<Option value="-100">其他</Option>
|
</Select>
|
</FormItem>
|
</i-col>
|
<i-col span="6">
|
<FormItem label="机房名称" prop="StationName3">
|
<i-input type="text" v-model.trim="home.StationName3" placeholder="机房名称"></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"></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设备索引">
|
<i-input type="text" v-model.trim="home.GroupIndexInFBSDevice" placeholder="FBS设备索引"></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="BattGroupName">
|
<i-input type="text" v-model.trim="home.BattGroupName" 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="handleNewHome">确认添加</Button>
|
</div>
|
<Modal
|
v-model="other.provinceShow"
|
title="省"
|
class-name="vertical-center-modal"
|
@on-ok="handleOk('province')"
|
@on-cancel="handleCancel('province')">
|
<Select v-model="other.province" class="black">
|
<Option
|
v-for="item in other.provinces"
|
:key="item.key"
|
:value="item.name">{{item.name}}</Option>
|
</Select>
|
</Modal>
|
<Modal
|
v-model="other.cityShow"
|
title="市"
|
class-name="vertical-center-modal"
|
@on-ok="handleOk('city')"
|
@on-cancel="handleCancel('city')">
|
<Select v-model="other.city" class="black">
|
<Option
|
v-for="item in other.cities"
|
:key="item.key"
|
:value="item.name">{{item.name}}</Option>
|
</Select>
|
</Modal>
|
<Modal
|
v-model="other.countyShow"
|
title="区县"
|
class-name="vertical-center-modal"
|
@on-ok="handleOk('county')"
|
@on-cancel="handleCancel('county')">
|
<Select v-model="other.county" class="black">
|
<Option
|
v-for="item in other.counties"
|
:key="item.key"
|
:value="item.name">{{item.name}}</Option>
|
</Select>
|
</Modal>
|
</div>
|
</template>
|
<script>
|
import $ from 'jquery';
|
import LinkAge from '../assets/json/province-city-county'
|
import {ajax, LinkagePlus} from '../libs/common'
|
import { setTimeout } from 'timers';
|
export default {
|
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: '电池组1', // 电池组名称
|
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',},
|
]
|
},
|
linkage: {
|
province: [],
|
city: [],
|
county: []
|
},
|
other: {
|
linkage: new LinkagePlus(),
|
province: '',
|
provinceShow: false,
|
city: '',
|
cityShow: false,
|
county: '',
|
countyShow: false,
|
provinces: [],
|
cities: [],
|
counties: []
|
},
|
enLoading: false
|
}
|
},
|
methods: {
|
handleNewHome: function() {
|
this.$refs.newHome.validate((valid) => {
|
if(valid) {
|
this.addHome();
|
}else {
|
this.$Message.error('存在格式不合法数据!');
|
}
|
});
|
},
|
searchProvince: function() { // 省
|
var self = this;
|
// 请求后台
|
ajax({
|
url: 'BattInfAction!serchAllStationName1',
|
data: null,
|
success: function(res) {
|
var rs = JSON.parse(res.result);
|
var data = [];
|
var first = "";
|
if(rs.code == 1) {
|
data = rs.data;
|
first = data[0];
|
}
|
// console.log(data);
|
// 设置省
|
self.home.StationName1 = first;
|
self.linkage.province = data;
|
},
|
complete: function() {
|
self.searchCity();
|
}
|
});
|
},
|
searchCity: function() { // 市
|
var self = this;
|
// 构造查询对象
|
var searchParams = {
|
StationName1: this.home.StationName1
|
};
|
// 对StationName1=-100进行处理
|
if(this.home.StationName1 == -100) {
|
this.other.provinces = this.other.linkage.getProvince();
|
this.other.province = this.other.provinces[0].name;
|
this.other.provinceShow = true;
|
}
|
// 请求后台
|
ajax({
|
url: 'BattInfAction!serchAllStationName2',
|
data: 'json='+JSON.stringify(searchParams),
|
success: function(res) {
|
var rs = JSON.parse(res.result);
|
var data = [];
|
var first = '';
|
if(rs.code == 1) {
|
data = rs.data;
|
first = data[0];
|
}
|
// console.log(data);
|
// 设置市
|
self.home.StationName2 = first;
|
self.linkage.city = data;
|
},
|
complete: function() {
|
self.searchCounty();
|
}
|
});
|
},
|
searchCounty: function() { // 区县
|
var self = this;
|
// 构造查询对象
|
var searchParams = {
|
StationName1: this.home.StationName1,
|
StationName2: this.home.StationName2
|
};
|
// 对StationName2=-100进行处理
|
if(this.home.StationName2 == -100) {
|
if(this.home.StationName1 != undefined) {
|
var rs = this.other.linkage.getCity(this.home.StationName1);
|
// console.log(rs);
|
if(rs.code == 1) {
|
this.other.cities = rs.data;
|
this.other.city = this.other.cities[0].name;
|
this.other.cityShow = true;
|
}else {
|
this.$Message.warning(rs.msg);
|
this.home.StationName2 = "";
|
}
|
}else {
|
this.$Message.warning("请先选择省!");
|
}
|
}
|
// 请求后台
|
ajax({
|
url: 'BattInfAction!serchAllStationName5',
|
data: 'json='+JSON.stringify(searchParams),
|
success: function(res) {
|
var rs = JSON.parse(res.result);
|
var data = [];
|
var first = "";
|
if(rs.code == 1) {
|
data = rs.data;
|
first = data[0]
|
}
|
// console.log(data);
|
// 设置市
|
self.home.StationName5 = first;
|
self.linkage.county = data;
|
}
|
});
|
},
|
handleCounty: function() {
|
// 对StationName2=-100进行处理
|
if(this.home.StationName5 == -100) {
|
if(this.home.StationName1 != undefined && this.home.StationName2 != undefined) {
|
var rs = this.other.linkage.getCounty(this.home.StationName1, this.home.StationName2);
|
console.log(rs);
|
if(rs.code == 1) {
|
this.other.counties = rs.data;
|
this.other.county = this.other.counties[0].name;
|
this.other.countyShow = true;
|
}else {
|
this.$Message.warning(rs.msg);
|
this.home.StationName5 = "";
|
}
|
}else {
|
this.$Message.warning("请先选择省和市!");
|
}
|
}
|
},
|
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;
|
},
|
addHome: 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!add',
|
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.$Message.error('添加失败!');
|
}
|
},
|
error: function() {
|
self.$Message.error('添加失败!');
|
},
|
complete: function() {
|
// 关闭按钮的等待框
|
self.enLoading = false;
|
}
|
});
|
},
|
getMaxId: function() {
|
var self = this;
|
// 请求后台获取最大id
|
ajax({
|
url: "BattInfAction!searchMaxId",
|
data: null,
|
success: function(res) {
|
var rs = JSON.parse(res.result);
|
if(rs.code == 1) {
|
var data = rs.data;
|
self.home.BattGroupId = data[0]+1;
|
self.home.StationId = data[1]+1;
|
self.home.FBSDeviceId = data[2]+1;
|
}
|
}
|
});
|
},
|
handleOk: function(type) { // 处理联动确定事件
|
switch(type) {
|
case 'province':
|
if(!this.checkValInArr(this.other.province, this.linkage.province)) {
|
this.linkage.province.push(this.other.province);
|
}
|
this.home.StationName1 = this.other.province;
|
// 查询市
|
this.searchCity();
|
break;
|
case 'city':
|
if(!this.checkValInArr(this.other.city, this.linkage.city)) {
|
this.linkage.city.push(this.other.city);
|
}
|
this.home.StationName2 = this.other.city;
|
// 查询区县
|
this.searchCounty();
|
break;
|
case 'county':
|
if(!this.checkValInArr(this.other.county, this.linkage.county)) {
|
this.linkage.county.push(this.other.county);
|
}
|
this.home.StationName5 = this.other.county;
|
break;
|
}
|
},
|
handleCancel: function(type) {
|
switch(type) {
|
case 'province':
|
this.home.StationName1 = "";
|
// 查询市
|
this.searchCity();
|
break;
|
case 'city':
|
this.home.StationName2 = "";
|
// 查询区县
|
this.searchCounty();
|
break;
|
case 'county':
|
this.home.StationName5 = "";
|
break;
|
}
|
},
|
checkValInArr: function(val, arr) {
|
var rs = false;
|
// 遍历arr
|
for(var i=0; i<arr.length; i++) {
|
var _arr = arr[i];
|
if(val == _arr) {
|
rs = true;
|
break;
|
}
|
}
|
return rs;
|
}
|
},
|
mounted: function() {
|
// 获取今天的日期
|
var today = new Date().format('yyyy-MM-dd');
|
this.home.BattInUseDate = today;
|
// 读取所有已有省
|
this.searchProvince();
|
// 读取最大值
|
this.getMaxId();
|
// 设置其他的省-市-区县联动
|
this.other.linkage.setData(LinkAge);
|
}
|
}
|
</script>
|