| | |
| | | placeholder="请选择交换机" |
| | | v-model="name" |
| | | clearable filterable |
| | | :disabled="nameDisabled" |
| | | > |
| | | <option disabled selected value >请选择交换机</option> |
| | | <option v-for="item in switchList" |
| | |
| | | placeholder="请选择交换机柜" |
| | | v-model="cabinetName" |
| | | clearable filterable |
| | | :disabled="cabinetNameDisabled" |
| | | > |
| | | <option disabled selected value >请选择交换机柜</option> |
| | | <option v-for="item in cabinetList" |
| | |
| | | placeholder="请选择厂区" |
| | | disabled clearable filterable |
| | | v-model="selectcode" |
| | | :disabled="areaCodeDisabled" |
| | | > |
| | | <!-- @change="updateDeviceList" --> |
| | | <option disabled selected value>- 请选择厂区</option> |
| | |
| | | // selectswitchindex: "", |
| | | cabinetList:[], |
| | | switchList:[], |
| | | nameDisabled: false, |
| | | cabinetNameDisabled: false, |
| | | areaCodeDisabled: false, |
| | | }; |
| | | }, |
| | | mounted() { |
| | |
| | | }, |
| | | async submit() { |
| | | //todo 提交设备 |
| | | if (!this.isValidIP(this.ipAddress)) { |
| | | this.$message.warning("请输入有效的IP地址"); |
| | | return; |
| | | } |
| | | if (!this.name || !this.selectcode || !this.cabinetName || !this.networkPort) { |
| | | this.$message.warning("数据未填写完整"); |
| | | return; |
| | |
| | | this.$message.success("创建成功"); |
| | | this.open = false; |
| | | this.$emit("update", {}); |
| | | this.$emit("update-server-info", this.code,this.name); |
| | | } |
| | | }, |
| | | openform(locInfo = {}) { |
| | |
| | | this.open = !this.open; |
| | | } |
| | | }, |
| | | openConfigform(code, cabinetName) { |
| | | openConfigform(code, switchName,cabinetName,config) { |
| | | console.log('openConfigform',code,switchName,cabinetName); |
| | | if (this.open) { |
| | | this.open = !this.open; |
| | | } else { |
| | |
| | | this.locInfo = {}; |
| | | this.selectcode = code; |
| | | console.log("this.locInfo", this.locInfo); |
| | | this.name = cabinetName; |
| | | this.name = switchName; |
| | | this.cabinetName = cabinetName; |
| | | this.port = this.locInfo.port || ""; |
| | | this.networkPort = this.locInfo.name || ""; |
| | | this.macAddress = this.locInfo.macAddress || ""; |
| | | this.ipAddress = this.locInfo.ipAddress || ""; |
| | | |
| | | this.open = !this.open; |
| | | } |
| | | if (config === 1) { |
| | | this.nameDisabled = true; // 将nameDisabled设置为禁用 |
| | | this.cabinetNameDisabled = true; // 将cabinetName设置为禁用 |
| | | this.areaCodeDisabled = true; // 将areaCode设置为不禁用 |
| | | } |
| | | }, |
| | | isValidIP(ip) { |
| | | const regex = /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/; |
| | | return regex.test(ip); |
| | | }, |
| | | }, |
| | | watch: { |