fix:修改idc状态为 switch按钮

This commit is contained in:
zhangyu
2020-11-11 14:30:34 +08:00
parent 29e617b4a9
commit b1c9f9f201
5 changed files with 40 additions and 20 deletions

View File

@@ -541,6 +541,8 @@ const cn = {
featureTitle: "属性",
endpointUpNum:'代表正常的数量',
endpointNum:'代表总的数量',
active:"Active",
Total:"Total",
},
config: {
config: "设置",

View File

@@ -542,7 +542,8 @@ const en = {
endPoint: 'End point',//'EndPoint'
alert: 'Alert',//'告警'
},
active:"Active",
Total:"Total",
},
config: {
config: 'Settings',//"设置"

View File

@@ -40,13 +40,15 @@
<!--</select-area>-->
<!--</el-form-item>-->
<el-form-item :label='$t("config.dc.state")' prop="state">
<el-select value-key="value" popper-class="config-dropdown" v-model="editDc.state" placeholder="" size="small">
<el-option @click.native="" v-for="item in $CONSTANTS.setting.DcState" :key="item.value" :label="item.label" :value="item.value" :id="'dc-principal-op-'+item.value">
<span>{{item.label}}</span>
</el-option>
</el-select>
<el-switch
v-model="editDc.state"
active-value="ON"
inactive-value="OFF"
active-color="#ee9d3f"
>
</el-switch>
</el-form-item>
<el-form-item :label='$t("config.dc.longitude")' prop="longitude">
<el-form-item :label='$t("config.dc.longitude")' prop="longitude" :rules="[{required:editDc.latitude,trigger:'blur'}]">
<el-input-number
placeholder=""
v-model="editDc.longitude"
@@ -58,7 +60,7 @@
:precision="5"
/>
</el-form-item>
<el-form-item :label='$t("config.dc.latitude")' prop="latitude">
<el-form-item :label='$t("config.dc.latitude")' prop="latitude" :rules="[{required:editDc.longitude,trigger:'blur'}]">
<el-input-number
placeholder=""
v-model="editDc.latitude"
@@ -135,10 +137,10 @@
param.areaId = param.area.id;
}
if(!regNum.test(param.longitude)){
param.longitude=''
param.longitude=null
}
if(!regNum.test(param.latitude)){
param.latitude=''
param.latitude=null
}
this.$put('idc', param).then(response => {
@@ -155,10 +157,10 @@
param.areaId = param.area.id;
}
if(!regNum.test(param.longitude)){
param.longitude=''
param.longitude=null;
}
if(!regNum.test(param.latitude)){
param.latitude=''
param.latitude=null;
}
this.$post('idc', param).then(response => {
if (response.code === 200) {

View File

@@ -103,8 +103,7 @@
<template v-if="item.prop=='Module'">
<el-tooltip placement="right" effect="light">
<div slot="content">
{{scope.row.endpointNum-scope.row.endpointDownNum}}&nbsp;{{$t('asset.endpointUpNum')}}<br/>
{{scope.row.endpointNum}}&nbsp;{{$t('asset.endpointNum')}}
{{$t('asset.active')}} / {{$t('asset.total')}}
</div>
<span class="link" @click="showEndpoint(scope.row)" style="padding: 2px 8px">{{scope.row.endpointNum-scope.row.endpointDownNum}}/{{scope.row.endpointNum}}</span>
</el-tooltip>

View File

@@ -79,8 +79,13 @@
<template v-else>-</template>
</template>
<template v-else-if="item.prop == 'state'">
<template v-if="scope.row.state">{{$CONSTANTS.setting.DcState.find(val=>val.value===scope.row.state).label}}</template>
<template v-else>-</template>
<el-switch
v-model="scope.row.state"
active-value="ON"
inactive-value="OFF"
active-color="#ee9d3f"
@change="(val)=>{statusChange(scope.row)}"
/>
</template>
<template v-else-if="item.prop == 'longitude'">
<template v-if="regNumTest(scope.row.longitude)">{{scope.row.longitude}}</template>
@@ -210,10 +215,6 @@
label: this.$t("overall.name"),
prop: 'name',
show: true,
}, {
label: this.$t('config.dc.state'),
prop: 'state',
show: true
}, {
label: this.$t('config.dc.longitude'),
prop: 'longitude',
@@ -242,6 +243,10 @@
label: this.$t('asset.principal'),
prop: 'principal',
show: true
}, {
label: this.$t('config.dc.state'),
prop: 'state',
show: true
}, {
label: this.$t('config.account.option'),
prop: 'option',
@@ -379,6 +384,17 @@
});
});
},
statusChange(idc) {
this.$put('idc', idc).then(response => {
if (response.code === 200) {
this.rightBox.show = false;
this.$message({duration: 1000, type: 'success', message: this.$t("tip.saveSuccess")});
} else {
this.$message.error(response.msg);
}
this.getTableData();
});
},
getTableData() {
this.$set(this.searchLabel, "pageNo", this.pageObj.pageNo);
this.$set(this.searchLabel, "pageSize", this.pageObj.pageSize);