<template> <!-- 网元创建对话框 --> <el-dialog @close="close" style="font-size: 10px;" width='950px' :title=title v-dialogDrag :visible.sync="createAndCopyDeviceVisible"> <el-row> <el-form :model="form" :inline='true' ref="form"> <el-row> <el-form-item style="margin-bottom: -10px;float:left"> <el-form-item :label="'*'+ $t('DeviceConfigurationManagement.nodeType')+':'" :label-width="formLabelWidth"> <el-select size='mini' v-model="form.deviceTypeKey" :placeholder="$t('common.placeholderSelect')" @change="deviceTypeChange" style="width:200px"> <el-option v-for="item in deviceTypeList" :key="item.deviceTypeKey" :label="item.deviceTypeName" :value="item.deviceTypeKey"> </el-option> </el-select> </el-form-item> <el-form-item :label="'*'+ $t('DeviceConfigurationManagement.nodeModel')+':'" :label-width="formLabelWidth"> <el-select size="mini" v-model="form.deviceModel" style="width: 200px" :placeholder="$t('common.placeholderSelect')"> <el-option v-for="item in deviceModelList1" :key="item.deviceModelKey" :label="item.deviceModel" :value="item.deviceModel"> </el-option> </el-select> </el-form-item> </el-form-item> <el-form-item style="margin-bottom: -10px;float:left"> <el-form-item :label="'*'+ $t('DeviceConfigurationManagement.ipType')+':'" :label-width="formLabelWidth" prop="string"> <el-checkbox-group v-model="form.ipType" @change="ipTypeChange"> <el-checkbox :label=1>{{$t('DeviceConfigurationManagement.bussIP')}}</el-checkbox> <el-checkbox :label=0>{{$t('DeviceConfigurationManagement.manageIP')}}</el-checkbox> </el-checkbox-group> </el-form-item> </el-form-item> <el-form-item style="margin-bottom: -10px;float:left" v-if="bussShow"> <el-form-item :label="'*'+ $t('DeviceConfigurationManagement.bussIpAddress')+':'" :label-width="formLabelWidth" prop="string"> <el-input size='mini' :placeholder="$t('common.placeholder')" v-model="form.bussIpAddress" v-on:blur="bussIpAddressCheck(form.bussIpAddress)" style="width:200px"> </el-input> </el-form-item> <el-form-item :label="'*'+ $t('DeviceConfigurationManagement.bussProtocol')+':'" :label-width="formLabelWidth"> <template> <el-radio-group v-model="form.bussManageType" @change="bussIpProtocol"> <el-radio :label=0 size="mini">{{$t("ResourceManagement.SNMPProtocol")}}</el-radio> <el-radio :label=1 size="mini" style="margin-left: -20px">{{$t("ResourceManagement.ICMPProtocol")}}</el-radio> </el-radio-group> </template> </el-form-item> <el-button style="margin-bottom: -10px;" size='mini' type="primary" :disabled="bussDisable" @click="GetDevieceInfo(form.bussIpAddress)"> {{$t("DeviceConfigurationManagement.GetDevieceInfo")}} </el-button> </el-form-item> <el-form-item style="margin-bottom: -10px;float:left" v-if="manageShow"> <el-form-item :label="'*'+ $t('DeviceConfigurationManagement.manageIpAddress')+':'" :label-width="formLabelWidth" prop="string"> <el-input size='mini' :placeholder="$t('common.placeholder')" v-model="form.ipAddress" v-on:blur="ipCheck(form.ipAddress)" style="width:200px"> </el-input> </el-form-item> <el-form-item :label="'*'+ $t('DeviceConfigurationManagement.configProtocol')+':'" :label-width="formLabelWidth"> <template> <el-radio-group v-model="form.manageType" @change="manageProtocol"> <el-radio :label=0 size="mini">{{$t("ResourceManagement.SNMPProtocol")}}</el-radio> <el-radio :label=1 size="mini" style="margin-left: -20px">{{$t("ResourceManagement.ICMPProtocol")}}</el-radio> </el-radio-group> </template> </el-form-item> <el-button size='mini' type="primary" :disabled="manageDisable" @click="GetDevieceInfo"> {{$t("DeviceConfigurationManagement.GetDevieceInfo")}} </el-button> </el-form-item> <div v-if="snmpShow"> <el-form-item style="margin-bottom: -10px; float: left"> <el-form-item unselectable="on" :label="'*'+ $t('DeviceConfigurationManagement.snmpVersion')+':'" :label-width="formLabelWidth" prop="string"> <el-select clearable size='mini' v-model="form.snmpVersion" :placeholder="$t('common.placeholderSelect')" collapse-tags v-on:change="deviceSNMPCheck" style="width:200px"> <el-option v-for="item in deviceSNMPList" :key="item.key" :label="item.label" :value="item.key"> </el-option> </el-select> </el-form-item> <el-form-item :label="'*'+ $t('DeviceConfigurationManagement.trapPort')+':'" :label-width="formLabelWidth"> <el-input size='mini' :placeholder="$t('common.placeholder')" v-model="form.trapPort" v-on:blur="trapnumberCheck" style="width:200px"> </el-input> </el-form-item> </el-form-item> <el-form-item style="margin-bottom: -10px;float:left"> <el-form-item :label="'*'+ $t('DeviceConfigurationManagement.snmpPort')+':'" :label-width="formLabelWidth"> <el-input size='mini' :placeholder="$t('common.placeholder')" v-model="form.snmpPort" v-on:blur="getnumberCheck" style="width:200px"></el-input> </el-form-item> <el-form-item :label="'*' + $t('ResourceManagement.SNMPGroupName')+':'" :label-width="formLabelWidth"> <el-input size='mini' :placeholder="$t('common.placeholder')" v-model="form.snmpGroupName" style="width:200px" v-on:blur="snmpGroupNameCheck"> </el-input> </el-form-item> </el-form-item> </div> <el-form-item style="margin-bottom: -10px;float:left"> <el-form-item :label="'*'+ $t('DeviceConfigurationManagement.displayName')+':'" :label-width="formLabelWidth"> <el-input size='mini' :placeholder="$t('common.placeholder')" v-model="form.displayName" v-on:blur="deviceNameCheck" style="width:200px"> </el-input> </el-form-item> <el-form-item :label="'*'+ $t('DeviceConfigurationManagement.subnetKey')+':'" :label-width="formLabelWidth" prop="string"> <el-select clearable size='mini' v-model="form.subnetKey" filterable :placeholder="$t('common.placeholderSelect')" @change="subnetCheck" style="width:200px"> <el-option v-for="item in subnetList" :key="item.subnetKey" :label="item.subnetName" :value="item.subnetKey"> </el-option> </el-select> </el-form-item> </el-form-item> <el-form-item style="margin-bottom: 0px;float:left"> <el-form-item :label="'*'+ $t('DeviceConfigurationManagement.uuid')+':'" :label-width="formLabelWidth" prop="string"> <el-input size='mini' :placeholder="$t('common.placeholder')" v-model="form.uuid" v-on:blur="uuidCheck" style="width:200px"> </el-input> </el-form-item> <el-form-item :label="$t('DeviceConfigurationManagement.versionInfo')+':'" :label-width="formLabelWidth"> <el-input size='mini' :placeholder="$t('common.placeholder')" v-model="form.deviceVersion" style="width:200px"> </el-input> </el-form-item> </el-form-item> <el-form-item style="margin-bottom: 0px;float:left"> <el-form-item :label="'*' + $t('DeviceConfigurationManagement.stationKey')+':'" :label-width="formLabelWidth" prop="string"> <el-input size='mini' :placeholder="$t('common.placeholder')" v-model="form.station" style="width:200px"> </el-input> </el-form-item> <el-form-item :label="'*' + $t('DeviceConfigurationManagement.locationKey')+':'" :label-width="formLabelWidth" prop="string"> <el-input size='mini' :placeholder="$t('common.placeholder')" v-model="form.locationName" style="width:200px"> </el-input> </el-form-item> </el-form-item> <el-form-item style="margin-bottom: 0px;float:left"> <el-form-item :label="$t('DeviceConfigurationManagement.nodeDesc')+':'" :label-width="formLabelWidth"> <el-input type="textarea" :rows="3" :placeholder="$t('common.placeholder')" v-model="form.deviceDesc" style="width: 620px; margin-top: 10px;"> </el-input> </el-form-item> </el-form-item> <el-form-item style="margin-bottom: 0px;float:left"> <el-form-item :label="$t('DeviceConfigurationManagement.nodeStatus')+':'" :label-width="formLabelWidth" prop="string"> <el-select clearable size='mini' v-model="form.deviceStatus" :placeholder="$t('common.placeholderSelect')" v-on:change="deviceStatusCheck " style="width:200px"> <el-option v-for="item in deviceStatusList" :key="item.key" :label="item.label" :value="item.key"> </el-option> </el-select> </el-form-item> <el-form-item :label=" $t('DeviceConfigurationManagement.startTime')+':'" :label-width="formLabelWidth" prop="string"> <el-date-picker style="width: 200px" v-model="form.startTime" type="datetime" size="mini" format="yyyy-MM-dd HH:mm:ss" :clearable="false" align="center" :picker-options="startDatePicker"> </el-date-picker> </el-form-item> </el-form-item> <el-form-item style="float: left; margin-left: 10px"> <el-button @click="show" size='mini' style="float: left; margin-left: 100px"> {{info}} </el-button> </el-form-item> <el-form-item style="margin-bottom: 0px;float:left" v-show="showBook"> <el-form-item prop="number" :label="$t('BooKManagement.chargePerson')+':'" :label-width="formLabelWidth"> <el-input size='mini' :placeholder="$t('common.placeholder')" v-model="form.manager" style="width:200px"></el-input> </el-form-item> <el-form-item prop="number" :label="$t('BooKManagement.telephone')+':'" :label-width="formLabelWidth"> <el-input size='mini' :placeholder="$t('common.placeholder')" v-model="form.managerPhone" style="width:200px"></el-input> </el-form-item> </el-form-item> <el-form-item style="margin-bottom: 0px;float:left" v-show="showBook"> <el-form-item prop="number" :label="$t('BooKManagement.brand')+':'" :label-width="formLabelWidth"> <el-input size='mini' :placeholder="$t('common.placeholder')" v-model="form.brand" style="width:200px"></el-input> </el-form-item> <el-form-item prop="number" :label="$t('BooKManagement.factoryPerson')+':'" :label-width="formLabelWidth"> <el-input size='mini' :placeholder="$t('common.placeholder')" v-model="form.manufacturerLiaison" style="width:200px"></el-input> </el-form-item> </el-form-item> <el-form-item style="margin-bottom: 0px;float:left" v-show="showBook"> <el-form-item prop="number" :label="$t('BooKManagement.factoryTelephone')+':'" :label-width="formLabelWidth"> <el-input size='mini' :placeholder="$t('common.placeholder')" v-model="form.manufacturerPhone" style="width:200px"></el-input> </el-form-item> </el-form-item> </el-row> </el-form> </el-row> <el-row style="margin-bottom: 0px;" slot="footer" class="dialog-footer"> <el-button style="margin-bottom: -10px;" size='mini' type="primary" @click="createDevice" icon='el-icon-circle-check'>{{$t("common.ok")}} </el-button> <el-button style="margin-bottom: -10px;" size='mini' @click="close" icon='el-icon-circle-close'>{{$t("common.cancel")}}</el-button> </el-row> </el-dialog> </template> <script> import legitimacyCheck from '../../../utils/legitimacyCheck' import DeviceService from '@/domain/services/DeviceService' import SubnetService from '@/domain/services/SubnetService.js' import HelperUtil from '../../../utils/HelperUtil' export default { name: 'CreateAndCopyDeviceDialog', components: {}, props: ['command'], data () { return { createAndCopyDeviceVisible: true, initList: this.command.target, title: this.command.title, deviceInfo: {}, showBook: false, check: null, formLabelWidth: '200px', fullscreenLoading: false, subnetList: [], deviceTypeList: [], deviceModelList: [], deviceModelList1: [], disableFlag: true, // 双向绑定弹出窗口ipput域 manageShow: false, bussShow: true, manageDisable: false, bussDisable: false, snmpShow: true, form: { uuid: '', displayName: '', deviceTypeKey: '', deviceModel: '', subnetKey: '', ipType: [], ipAddress: '', bussIpAddress: '', snmpGroupName: 'publicCrscd', snmpVersion: 1, snmpPort: 161, trapPort: 162, manageType: 0, bussManageType: 0, ipmiUserName: '', ipmiPassword: '', ipmiFlag: true, // snmpFlag: false, deviceStatus: 0, deviceVersion: '', deviceDesc: '', startTime: '', configFileKey: '', configFileName: '', manufacturerLiaison: '', manufacturerPhone: '', manager: '', brand: '', managerPhone: '', station: '', locationName: '' }, // 网元状态下拉菜单 deviceStatusList: [ { key: 0, label: this.$t('DeviceConfigurationManagement.inUse') }, { key: 1, label: this.$t('DeviceConfigurationManagement.notInUse') } ], // SNMP版本下拉菜单 deviceSNMPList: [ { key: 0, label: 'v1' }, { key: 1, label: 'v2c' }, { key: 2, label: 'v3' } ] } }, methods: { /** * @Description : 车站输入 * @author : ls * @date : 2020/6/19 9:55 * @param : * @return : */ stationBlur: function (e) { this.form.station = e.target.value }, /** * @Description : 型号输入 * @author : ls * @date : 2020/6/19 9:58 * @param : * @return : */ deviceModelBlur: function (e) { this.form.deviceModel = e.target.value }, /** * @Description : 设置flag * @author : ls * @date : 2020/5/1 11:41 * @param : * @return : */ manageProtocol: function () { if (this.form.manageType === 0) { this.manageDisable = false this.snmpShow = true } else { this.manageDisable = true if (this.form.ipType.length === 1) { this.snmpShow = false } else { if (this.bussDisable) { this.snmpShow = false } } } }, /** * @Description : bussIpProtocol * @author : ls * @date : 2020/9/15 9:57 * @param : * @return : */ bussIpProtocol: function () { if (this.form.bussManageType === 0) { this.bussDisable = false this.snmpShow = true } else { this.bussDisable = true if (this.form.ipType.length === 1) { this.snmpShow = false } else { if (this.manageDisable) { this.snmpShow = false } } } }, /** * @Description : ipTypeChange * @author : ls * @date : 2020/9/14 12:16 * @param : * @return : */ ipTypeChange: function () { if (this.form.ipType.length === 2) { this.manageShow = true this.bussShow = true } else if (this.form.ipType.length === 1) { if (this.form.ipType[0] === 0) { this.manageShow = true this.bussShow = false } else if (this.form.ipType[0] === 1) { this.manageShow = false this.bussShow = true } } else { this.form.ipType.push(1) this.manageShow = false this.bussShow = true } }, show: function () { this.showBook = !this.showBook }, close () { this.command.done() }, /** * @Description : 创建网元信息初始化 * @author : ls * @date : 2020/5/1 15:07 * @param : * @return : */ createDeviceInit: function () { if (this.initList.bussIpAddress !== '' && this.initList.ipAddress === '') { this.form.ipType.push(1) this.form.bussManageType = this.initList.bussManageType this.form.bussIpAddress = this.initList.bussIpAddress this.form.manageType = 0 this.form.ipAddress = this.initList.ipAddress } if (this.initList.ipAddress !== '' && this.initList.bussIpAddress === '') { this.form.ipType.push(0) this.form.bussManageType = 0 this.form.bussIpAddress = this.initList.bussIpAddress this.form.manageType = this.initList.manageType this.form.ipAddress = this.initList.ipAddress } if (this.initList.ipAddress === '' && this.initList.bussIpAddress === '') { this.form.ipType.push(1) } if (this.initList.ipAddress !== '' && this.initList.bussIpAddress !== '') { this.form.ipType.push(0) this.form.ipType.push(1) this.form.bussManageType = this.initList.bussManageType this.form.bussIpAddress = this.initList.bussIpAddress this.form.manageType = this.initList.manageType this.form.ipAddress = this.initList.ipAddress } this.ipTypeChange() this.bussIpProtocol() this.manageProtocol() this.form.snmpVersion = this.initList.snmpVersion this.form.getPortName = this.initList.getPortName this.form.trapPort = this.initList.trapPort this.form.snmpGroupName = this.initList.snmpGroup this.form.uuid = this.initList.uuid this.form.displayName = this.initList.displayName this.form.deviceTypeKey = this.initList.deviceTypeKey this.form.deviceModel = this.initList.deviceModel this.form.deviceVersion = this.initList.deviceVersion this.form.subnetKey = this.initList.subnetKey this.form.snmpVersion = this.initList.snmpVersion this.form.snmpPort = this.initList.snmpPort this.form.trapPort = this.initList.trapPort this.form.deviceDesc = this.initList.deviceDesc this.form.startTime = HelperUtil.setDefaultDateTime()[1] this.form.delFlag = this.initList.delFlag this.form.station = this.initList.station this.form.locationName = this.initList.locationName this.form.deviceStatus = this.initList.deviceStatus this.form.modifyTime = this.initList.modifyTime this.form.brand = this.initList.brand this.form.manufacturerLiaison = this.initList.manufacturerLiaison this.form.manufacturerPhone = this.initList.manufacturerPhone this.form.manager = this.initList.manager this.form.managerPhone = this.initList.managerPhone }, /** * @Description : ip校验 * @author : ls * @date : 2020/6/18 11:21 * @param : * @return : */ ipTotalCheck: function (val) { if (val !== '') { if (!this.ipCheck(val)) { return false } } // if (val !== '') { // if (!this.bussIpAddressCheck(val)) { // return false // } // } return true }, /** * @Description :手动获取设备信息 * @author : * @param : * @return : * @exception : * @date */ GetDevieceInfo: function (val) { if (!this.ipTotalCheck(val)) { return } let _this = this let loadingInstance = _this.Loading.openLoading() DeviceService.postDeviceInfo(val).then(result => { _this.Loading.closeLoading(loadingInstance) // 成功 _this.form.displayName = result.displayName _this.form.uuid = result.uuid _this.form.deviceModel = result.deviceModel _this.form.deviceVersion = result.deviceVersion _this.form.deviceModel = result.deviceModel _this.form.snmpGroupName = result.snmpGroup _this.form.deviceVersion = result.deviceVersion _this.form.trapPort = result.trapPort _this.form.snmpPort = result.snmpPort _this.form.deviceVersion = result.deviceVersion _this.form.deviceStatus = result.deviceStatus _this.form.deviceDesc = result.deviceDesc }).catch(err => { // 关闭loading _this.Loading.closeLoading(loadingInstance) // 失败 _this.InfoTip.errorTip(_this, err) console.log(err) }) }, /** * @Description :创建网元 * @author : * @param : * @return : * @exception : * @date : */ createDevice: function () { if (!this.totalCheck()) { return } let device = {} device.uuid = this.form.uuid device.displayName = this.form.displayName device.deviceTypeKey = this.form.deviceTypeKey device.deviceModel = this.form.deviceModel device.station = this.form.station device.locationName = this.form.locationName device.subnetKey = this.form.subnetKey if (this.form.ipType.length === 2) { device.ipAddress = this.form.ipAddress device.bussIpAddress = this.form.bussIpAddress device.manageType = this.form.manageType device.bussManageType = this.form.bussManageType } else { if (this.form.ipType[0] === 1) { device.bussIpAddress = this.form.bussIpAddress device.bussManageType = this.form.bussManageType device.ipAddress = '' device.manageType = -999 } else { device.ipAddress = this.form.ipAddress device.manageType = this.form.manageType device.bussIpAddress = '' device.bussManageType = -999 } } device.manageType = this.form.manageType device.deviceStatus = this.form.deviceStatus device.deviceVersion = this.form.deviceVersion device.startTime = HelperUtil.dateToString(this.form.startTime) device.deviceDesc = this.form.deviceDesc device.delFlag = this.form.delFlag device.modifyTime = this.form.modifyTime device.brand = this.form.brand device.manufacturerLiaison = this.form.manufacturerLiaison device.manufacturerPhone = this.form.manufacturerPhone device.manager = this.form.manager device.managerPhone = this.form.managerPhone device.snmpVersion = this.form.snmpVersion device.snmpPort = this.form.snmpPort device.trapPort = this.form.trapPort device.snmpGroup = this.form.snmpGroupName let _this = this // 打开loaing let loadingInstance = _this.Loading.openLoading() // 调用函数 DeviceService.addDevice(device).then(result => { // 关闭loading _this.Loading.closeLoading(loadingInstance) _this.InfoTip.successTip(_this, HelperUtil.getStatusCodeObjectByCode(_this.successCode.ADD_CODE)) _this.close() }).catch(err => { // 关闭loading _this.Loading.closeLoading(loadingInstance) // 失败 _this.InfoTip.errorTip(_this, err) }) }, /** * @Description :获取全部子网信息, * @author : * @date : 2018/12/13 */ getAllSubnet () { let _this = this SubnetService.getAllSubnetCollection().then(result => { // 成功 _this.subnetList = Object.values(result) }).catch(err => { _this.InfoTip.errorTip(_this, err) }) }, /** * @Description : 获取网元类型 * @author : ls * @date : 2020/5/21 10:23 * @param : * @return : */ getAllDeviceType: function () { let _this = this DeviceService.getAllDeviceTypeCollection().then(result => { _this.deviceTypeList = Object.values(result) }).catch(err => { _this.InfoTip.errorTip(_this, err) }) }, /** * @Description : 获取网元型号 * @author : ls * @date : 2020/5/21 10:23 * @param : * @return : */ getAllDeviceModel: function () { let _this = this DeviceService.getAllDeviceModelCollection().then(result => { _this.deviceModelList = Object.values(result) this.deviceTypeChange() this.form.deviceModel = this.initList.deviceModel }).catch(err => { _this.InfoTip.errorTip(_this, err) }) }, // 时间合法性验证 /** * @Description : shijian * @author : ls * @date : 2020/4/24 14:44 * @param : * @return : */ timeCheck: function () { var result = this.check.timeCheck(this.form.startTime) if (!result) { this.InfoTip.warningTip(this, HelperUtil.getCheckStatusCodeObjectByCode(this.successCode.PLEASE_ENTER_VALID_TIME)) return false } return true }, /** * @Description : IP校验 * @author : ls * @date : 2020/6/18 10:41 * @param : * @return : */ ipCheck: function (val) { var result = this.check.ipCheck(val) if (!result) { this.InfoTip.warningTip(this, HelperUtil.getCheckStatusCodeObjectByCode(this.successCode.PLEASE_ENTER_VALID_DEVICE_IP_ADDRESS)) return false } return true }, /** * @Description : IP校验 * @author : ls * @date : 2020/6/18 10:41 * @param : * @return : */ bussIpAddressCheck: function (val) { var result = this.check.ipCheck(val) if (!result) { this.InfoTip.warningTip(this, HelperUtil.getCheckStatusCodeObjectByCode(this.successCode.PLEASE_ENTER_VALID_DEVICE_IP_ADDRESS)) return false } return true }, textLengthCheck: function (checkString) { var result = this.check.textLengthCheck(checkString) if (!result) { this.InfoTip.warningTip(this, HelperUtil.getCheckStatusCodeObjectByCode(this.successCode.LENGTH_CODE)) return false } return true }, /** * @Description : get端口校验 * @author : ls * @date : 2020/4/24 14:28 * @param : * @return : */ getnumberCheck: function () { if (!this.check.textNullCheck(this.form.snmpPort)) { this.InfoTip.warningTip(this, HelperUtil.getCheckStatusCodeObjectByCode(this.successCode.TEXT_NULL_CODE), this.$t('DeviceConfigurationManagement.snmpPort')) return false } var result = this.check.numberCheck(this.form.snmpPort) if (!result) { this.InfoTip.warningTip(this, HelperUtil.getCheckStatusCodeObjectByCode(this.successCode.PLEASE_ENTER_VALID_NUMBER)) return false } if (!this.textLengthCheck(this.form.snmpPort)) { return false } return true }, /** * @Description : trap端口校验 * @author : ls * @date : 2020/4/24 14:29 * @param : * @return : */ trapnumberCheck: function () { if (!this.check.textNullCheck(this.form.trapPort)) { this.InfoTip.warningTip(this, HelperUtil.getCheckStatusCodeObjectByCode(this.successCode.TEXT_NULL_CODE), this.$t('DeviceConfigurationManagement.trapPort')) return false } var result = this.check.numberCheck(this.form.trapPort) if (!result) { this.InfoTip.warningTip(this, HelperUtil.getCheckStatusCodeObjectByCode(this.successCode.PLEASE_ENTER_VALID_NUMBER)) return false } if (!this.textLengthCheck(this.form.trapPort)) { return false } return true }, /** * @Description : SNMP团体名校验 * @author : ls * @date : 2020/4/24 14:31 * @param : * @return : */ snmpGroupNameCheck: function () { if (!this.check.textNullCheck(this.form.snmpGroupName)) { // 输入不可为空 this.InfoTip.warningTip_alarm(this, HelperUtil.getCheckStatusCodeObjectByCode(this.successCode.TEXT_NULL_CODE), this.$t('ResourceManagement.SNMPGroupName')) return false } if (!this.textLengthCheck(this.form.snmpGroupName)) return false return true }, /** * @Description : UUID校验 * @author : ls * @date : 2020/4/24 14:34 * @param : * @return : */ uuidCheck: function () { var result = this.check.textNullCheck(this.form.uuid) if (!result) { this.InfoTip.warningTip(this, HelperUtil.getCheckStatusCodeObjectByCode(this.successCode.TEXT_NULL_CODE), this.$t('DeviceConfigurationManagement.uuid')) return false } if (!this.textLengthCheck(this.form.uuid)) { return false } return true }, /** * @Description : 网元版本信息校验 * @author : ls * @date : 2020/4/24 14:37 * @param : * @return : */ deviceVersionCheck: function () { var result = this.check.textNullCheck(this.form.deviceVersion) if (!result) { this.InfoTip.warningTip(this, HelperUtil.getCheckStatusCodeObjectByCode(this.successCode.TEXT_NULL_CODE), this.$t('DeviceConfigurationManagement.versionInfo')) return false } if (!this.textLengthCheck(this.form.deviceVersion)) { return false } return true }, /** * @Description : 网元名称校验 * @author : ls * @date : 2020/4/24 14:20 * @param : * @return : */ deviceNameCheck: function () { var result = this.check.textNullCheck(this.form.displayName) if (!result) { this.InfoTip.warningTip(this, HelperUtil.getCheckStatusCodeObjectByCode(this.successCode.TEXT_NULL_CODE), this.$t('DeviceConfigurationManagement.displayName')) return false } if (!this.textLengthCheck(this.form.displayName)) { return false } return true }, /** * @Description : 网元型号校验 * @author : ls * @date : 2020/4/24 14:39 * @param : * @return : */ deviceModelCheck: function () { var result = this.check.textNullCheck(this.form.deviceModel) if (!result) { this.InfoTip.warningTip(this, HelperUtil.getCheckStatusCodeObjectByCode(this.successCode.TEXT_NULL_CODE), this.$t('DeviceConfigurationManagement.nodeModel')) return false } if (!this.textLengthCheck(this.form.deviceModel)) { return false } return true }, /** * @Description : 子网校验 * @author : ls * @date : 2020/5/1 14:22 * @param : * @return : */ subnetCheck: function () { var result = this.check.textNullCheck(this.form.subnetKey) if (!result) { this.InfoTip.warningTip(this, HelperUtil.getCheckStatusCodeObjectByCode(this.successCode.TEXT_NULL_CODE), this.$t('DeviceConfigurationManagement.subnetKey')) return false } if (!this.textLengthCheck(this.form.subnetKey)) { return false } return true }, stationCheck: function () { var result = this.check.textNullCheck(this.form.station) if (!result) { this.InfoTip.warningTip(this, HelperUtil.getCheckStatusCodeObjectByCode(this.successCode.TEXT_NULL_CODE), this.$t('DeviceConfigurationManagement.stationKey')) return false } if (!this.textLengthCheck(this.form.station)) { return false } return true }, /** * @Description : 网元类型校验 * @author : ls * @date : 2020/5/1 14:20 * @param : * @return : */ deviceTypeCheck: function () { var result = this.check.textNullCheck(this.form.deviceTypeKey) if (!result) { this.InfoTip.warningTip(this, HelperUtil.getCheckStatusCodeObjectByCode(this.successCode.TEXT_NULL_CODE), this.$t('DeviceConfigurationManagement.nodeType')) return false } if (!this.textLengthCheck(this.form.deviceTypeKey)) { return false } return true }, /** * @Description : deviceTypeChange * @author : ls * @date : 2020/11/11 10:31 * @param : * @return : */ deviceTypeChange: function () { var a = [] if (this.form.deviceTypeKey !== '') { a = HelperUtil.deviceTypeChange(this.deviceModelList, this.form.deviceTypeKey, this.form.deviceModel) this.form.deviceModel = a[1] } else { a[0] = this.deviceModelList } this.deviceModelList1 = a[0] }, deviceSNMPCheck: function () { var result = this.check.textNullCheck(this.form.snmpVersion) if (!result) { this.InfoTip.warningTip(this, HelperUtil.getCheckStatusCodeObjectByCode(this.successCode.TEXT_NULL_CODE), this.$t('DeviceConfigurationManagement.snmpVersion')) return false } return true }, /** * @Description : 网元状态校验 * @author : ls * @date : 2020/4/24 14:43 * @param : * @return : */ deviceStatusCheck: function () { var result = this.check.textNullCheck(this.form.deviceStatus) if (!result) { this.InfoTip.warningTip(this, HelperUtil.getCheckStatusCodeObjectByCode(this.successCode.TEXT_NULL_CODE), this.$t('DeviceConfigurationManagement.deviceStatus')) return false } return true }, totalCheck: function () { if (this.form.ipType.length === 1) { if (this.form.ipType[0] === 0) { var result = this.check.textNullCheck(this.form.ipAddress) if (!result) { this.InfoTip.warningTip(this, HelperUtil.getCheckStatusCodeObjectByCode(this.successCode.TEXT_NULL_CODE), this.$t('DeviceConfigurationManagement.manageIP')) return false } else { if (!this.ipCheck(this.form.ipAddress)) { return false } } } else if (this.form.ipType[0] === 1) { var result1 = this.check.textNullCheck(this.form.bussIpAddress) if (!result1) { this.InfoTip.warningTip(this, HelperUtil.getCheckStatusCodeObjectByCode(this.successCode.TEXT_NULL_CODE), this.$t('DeviceConfigurationManagement.bussIP')) return false } else { if (!this.bussIpAddressCheck(this.form.bussIpAddress)) { return false } } } } else { var result3 = this.check.textNullCheck(this.form.bussIpAddress) if (!result3) { this.InfoTip.warningTip(this, HelperUtil.getCheckStatusCodeObjectByCode(this.successCode.TEXT_NULL_CODE), this.$t('DeviceConfigurationManagement.bussIP')) return false } else { if (!this.bussIpAddressCheck(this.form.bussIpAddress)) { return false } } var result2 = this.check.textNullCheck(this.form.ipAddress) if (!result2) { this.InfoTip.warningTip(this, HelperUtil.getCheckStatusCodeObjectByCode(this.successCode.TEXT_NULL_CODE), this.$t('DeviceConfigurationManagement.manageIP')) return false } else { if (!this.ipCheck(this.form.ipAddress)) { return false } } } if (!this.getnumberCheck()) { return false } if (!this.trapnumberCheck()) { return false } if (!this.deviceSNMPCheck()) { return false } if (!this.snmpGroupNameCheck()) { return false } if (!this.deviceNameCheck()) { return false } if (!this.subnetCheck()) { return false } if (!this.uuidCheck()) { return false } // if (!this.deviceVersionCheck()) { // return false // } if (!this.deviceTypeCheck()) { return false } if (!this.deviceModelCheck()) { return false } if (!this.stationCheck()) { return false } if (!this.deviceStatusCheck()) { return false } // if (!this.timeCheck()) { // return false // } return true } // ------------------------------- 结束合法性校验-------------- }, computed: { info: function () { if (this.showBook === true) { return this.$t('BooKManagement.clickHide') } else { return this.$t('BooKManagement.clickShow') } } }, // 初始化函数,加载数据 created: function () { this.check = legitimacyCheck() this.getAllSubnet() this.getAllDeviceType() this.getAllDeviceModel() this.createDeviceInit() } } </script> <style scoped> </style>