<template> <!-- 修改网络物理连接dialog (节点名称不能修改) --> <el-dialog @close="close" @opened="updateNetworkPhysicsLinkInit" v-if="UpdateNetworkPhysicsLinkVisible" v-dialogDrag style="font-size: 10px;" width='450px' :title="$t('NetworkPhysicsLinkConfigurationManagement.updateNetworkPhysicsLink')" :visible.sync="UpdateNetworkPhysicsLinkVisible"> <el-form :model="form" inline="true"> <el-form-item :label="'*'+$t('NetworkPhysicsLinkConfigurationManagement.nodeName')+':'" :label-width="formLabelWidth" style="margin-bottom: -10px;"> <el-input size = 'mini' :placeholder="$t('common.placeholder')" v-model="form.nodeName" v-on:blur="nodeNameCheck" autocomplete="off" style="width: 200px" disabled></el-input> </el-form-item> <el-form-item :label="'*'+$t('NetworkPhysicsLinkConfigurationManagement.accessBusiness')+':'" :label-width="formLabelWidth" style="margin-bottom: -10px;"> <el-input size = 'mini' :placeholder="$t('common.placeholder')" v-model="form.description" v-on:blur="descriptionCheck" autocomplete="off" style="width: 200px"></el-input> </el-form-item> <el-form-item :label="'*'+$t('NetworkPhysicsLinkConfigurationManagement.deviceKey')+':'" :label-width="formLabelWidth" style="margin-bottom: -10px;"> <el-select v-model="form.deviceKey" size="mini" :placeholder="$t('common.selectOption')" v-on:change="deviceKeyCheck" autocomplete="off" style="width: 200px"> <el-option v-for="item in deviceList" :key="item.deviceKey" :label="item.deviceName" :value="item.deviceKey"> </el-option> </el-select> </el-form-item> <el-form-item :label="'*'+$t('NetworkPhysicsLinkConfigurationManagement.port')+':'" :label-width="formLabelWidth" style="margin-bottom: -10px;"> <el-input size = 'mini' :placeholder="$t('common.placeholder')" v-model="form.port" v-on:blur="portNameCheck" autocomplete="off" style="width: 200px"></el-input> </el-form-item> </el-form> <div slot="footer" class="dialog-footer"> <el-button size='mini' type="primary" @click="updateNetworkPhysicsLink" v-loading.fullscreen.lock="fullscreenLoading"> {{ $t('common.updateBtn') }} </el-button> <el-button size='mini' @click="close">{{ $t('common.cancel') }}</el-button> </div> </el-dialog> </template> <script> import NetworkPhysicsService from '@/domain/services/NetworkPhysicsService.js' import DeviceService from '@/domain/services/DeviceService' import legitimacyCheck from "../../../utils/legitimacyCheck"; import HelperUtil from"../../../utils/HelperUtil"; export default { props: ['command'], data: function(){ return{ initList: this.command.target, UpdateNetworkPhysicsLinkVisible: true, formLabelWidth: '150px', deviceList: [], usingDeviceList: [], form:{ nodeName: "", description: "", deviceKey: "", port: "", }, // 数据加载过程中,覆盖界面 fullscreenLoading: false, } }, methods:{ close() { this.command.done(); }, /** * @Description :根据设备状态,过滤设备集合 * @author : zyh * @param : * @return : * @exception : * @date : */ handleDevice() { let _this = this; this.deviceList.forEach(function (device) { if (device.deviceStatus === 0) { _this.usingDeviceList.push(device) } }) }, /** * @Description :获取全部网元信息 * @author : zyh * @date : */ getAllDeviceInit: function () { let _this = this; DeviceService.getAllDeviceCollection().then(result => { //成功 _this.deviceList = Object.values(result) _this.handleDevice(); }).catch(err => { //失败 _this.InfoTip.errorTip(_this,err); }) }, //------------------------------------创建开始------------------------------------------------------------------- updateNetworkPhysicsLinkInit(){ this.form.nodeName = this.initList.nodeName; this.form.description = this.initlist.description; this.form.deviceKey = this.initlist.deviceKey; this.form.port = this.initlist.port; }, updateNetworkPhysicsLink() { let _this = this if (!this.totalCheck()) { } else { let netPhy={}; netPhy.nodeName = this.form.nodeName; netPhy.description = this.form.description; netPhy.deviceKey = this.form.deviceKey; netPhy.port = this.form.port; NetworkPhysicsService.modifyNetPhyLink(netPhy).then(result => { //成功 _this.InfoTip.successTip(_this, HelperUtil.getStatusCodeObjectByCode(_this.successCode.MODIFY_CODE)); _this.command.done(); }).catch(err => { //失败 _this.InfoTip.errorTip(_this, err); // _this.command.done(); }); } }, //------------------------------------创建结束------------------------------------------------------------------- //------------------------------------验证开始------------------------------------------------------------------- /** * @Description :节点名称校验: 不能为空 * @author : * @param : * @return : * @exception : * @date : */ nodeNameCheck: function(){ let netPhyCheck = legitimacyCheck() if (!netPhyCheck.textNullCheck(this.form.nodeName)) { this.InfoTip.warningTip(this, HelperUtil.getCheckStatusCodeObjectByCode(this.successCode.TEXT_NULL_CODE),this.$t('NetworkPhysicsLinkConfigurationManagement.nodeName')) return false } if(!this.textLengthCheck(this.form.nodeName)){return false} return true }, /** * @Description :接入业务校验: 不能为空 * @author : * @param : * @return : * @exception : * @date : */ descriptionCheck: function(){ let netPhyCheck = legitimacyCheck() if (!netPhyCheck.textNullCheck(this.form.description)) { this.InfoTip.warningTip(this, HelperUtil.getCheckStatusCodeObjectByCode(this.successCode.TEXT_NULL_CODE),this.$t('NetworkPhysicsLinkConfigurationManagement.description')) return false } if(!this.textLengthCheck(this.form.description)){return false} return true }, /** * @Description :设备名称校验: 不能为空 * @author : * @param : * @return : * @exception : * @date : */ deviceKeyCheck: function(){ let netPhyCheck = legitimacyCheck() if (!netPhyCheck.textNullCheck(this.form.deviceKey)) { this.InfoTip.warningTip(this, HelperUtil.getCheckStatusCodeObjectByCode(this.successCode.TEXT_NULL_CODE),this.$t('NetworkPhysicsLinkConfigurationManagement.deviceKey')) return false } if(!this.textLengthCheck(this.form.deviceKey)){return false} return true }, /** * @Description :端口名称校验: 不能为空,应数字 * @author : * @param : * @return : * @exception : * @date : */ portNameCheck: function () { let netPhyCheck = legitimacyCheck() if (!netPhyCheck.textNullCheck(this.form.port)) { this.InfoTip.warningTip(this, HelperUtil.getCheckStatusCodeObjectByCode(this.successCode.TEXT_NULL_CODE),this.$t('NetworkPhysicsLinkConfigurationManagement.port')) return false }else if( parseInt(this.form.port)>99|| parseInt(this.form.port)<0){ this.InfoTip.warningTip(this, HelperUtil.getCheckStatusCodeObjectByCode(this.successCode.PORT_BETWEEN_0_99)) return false } if(!this.textLengthCheck(this.form.port)){return false} if(!this.numCheck(this.form.port)){return false} return true }, /** * @Description :文本框所输入的字符长度校验: 控制在20之内 * @author : * @param : * @return : * @exception : * @date : */ textLengthCheck: function (checkString) { let netPhyCheck = legitimacyCheck() if (!netPhyCheck.textLengthCheck(checkString)) { this.InfoTip.warningTip(this, HelperUtil.getCheckStatusCodeObjectByCode(this.successCode.LENGTH_CODE)) return false } return true }, /** * @Description :输入数字 * @author : * @param : * @return : * @exception : * @date : */ numCheck: function (checkNumber) { let netPhyCheck = legitimacyCheck() if (!netPhyCheck.numberCheck(checkNumber)) { this.InfoTip.warningTip(this, HelperUtil.getCheckStatusCodeObjectByCode(this.successCode.PLEASE_ENTER_VALID_NUMBER)) return false } return true }, totalCheck(){ if( this.nodeNameCheck()&& this.descriptionCheck()&& this.deviceKeyCheck()&& this.portNameCheck()) return true else{ return false } }, //------------------------------------验证结束------------------------------------------------------------------- }, created(){ this.getAllDeviceInit() this.updateNetworkPhysicsLinkInit() }, } </script> <style scoped> </style>