diff --git a/nezha-fronted/src/components/common/js/validate.js b/nezha-fronted/src/components/common/js/validate.js index f3c752cd5..fce7ee240 100644 --- a/nezha-fronted/src/components/common/js/validate.js +++ b/nezha-fronted/src/components/common/js/validate.js @@ -1,5 +1,4 @@ import vm from '../../../main' -import ca from "element-ui/src/locale/lang/ca"; export function host(rule, value, callback) { const hostReg = /^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$/ diff --git a/nezha-fronted/src/components/page/asset/accountConfig.vue b/nezha-fronted/src/components/page/asset/accountConfig.vue index 0a11bd601..b28e68fd1 100644 --- a/nezha-fronted/src/components/page/asset/accountConfig.vue +++ b/nezha-fronted/src/components/page/asset/accountConfig.vue @@ -15,15 +15,15 @@ -->
-
{{$t('project.endpoint.endpoint')}}
+
{{$t('asset.createAssetTab.password')}}
-
{{$t('project.metrics.metrics')}}
+
{{$t('asset.createAssetTab.ssh')}}
- -
{{account.authType}}
- + +
{{account.authType==1?$t('asset.createAssetTab.password'):$t('asset.createAssetTab.ssh')}}
+
{{account.user}}
@@ -79,7 +79,6 @@ export default { { validator: validateFile, trigger: 'change'} ] }, - validateResult:false, uploadTip:'' } }, @@ -120,7 +119,8 @@ export default { validateAccount:function(){ this.validateResult=false; this.$refs.accountForm.validate((valid) => { - this.validateResult=valid; + this.$emit("setValidateResult",valid); + console.log(valid) }); }, validateFile:function(){ diff --git a/nezha-fronted/src/components/page/asset/asset.vue b/nezha-fronted/src/components/page/asset/asset.vue index 2368ca2a8..38aeabd1a 100644 --- a/nezha-fronted/src/components/page/asset/asset.vue +++ b/nezha-fronted/src/components/page/asset/asset.vue @@ -82,7 +82,7 @@ {{scope.row.state==1 ? $t('asset.createAssetTab.inStock') : $t('asset.createAssetTab.notInStock')}}
-
+
-
-
{{assetViewData.idcName}} @@ -471,9 +375,13 @@ {{cabinetSelectedData.remark}} -
{{$t('asset.createAssetTab.cli')}}
+
{{$t('asset.createAssetTab.cli')}} + +
- + @@ -486,6 +394,7 @@ {{$t('overall.ok')}}
+
@@ -522,6 +431,7 @@ uploadFile: null }] }, + accountSwitch:false,//true 开启,false 关闭 accountData: '', assetViewData: { assetType: '', @@ -676,7 +586,9 @@ ] }, uploadFileList:[], - formData:null + formData:null, + module:{}, + accountValideResult:true } }, /*computed: { @@ -765,7 +677,8 @@ // this.assetData.accounts[0].pwd = response.data.list[0].accounts[0].pwd // this.assetData.accounts[0].port = response.data.list[0].accounts[0].port // this.assetData.accounts[0].cert = response.data.list[0].accounts[0].privateKey - this.assetData.accounts[0]=response.data.list[0].accounts[0]?response.data.list[0].accounts[0]:this.assetData.accounts[0]; + this.assetData.accounts=response.data.list[0].accounts[0]?response.data.list[0].accounts:[]; + this.accountSwitch=this.assetData.accounts.length>0; this.idcSelectedData.location = response.data.list[0].idc.location this.idcSelectedData.principal = response.data.list[0].idc.principal this.idcSelectedData.tel = response.data.list[0].idc.tel @@ -776,6 +689,23 @@ }) } }, + openModuleBox(module) { + this.module = module; + this.$refs.moduleBox.show(true); + this.$refs['moduleListPop' + this.obj.id].show(false); + }, + refreshTabData:function(){ + this.$emit('refreshData', 'true'); + }, + jumpToAlertMsg(assetId) { + this.$store.commit('assetForAlertListChange', assetId); + this.$router.push({ + path: "/alertList", + query: { + t: +new Date() + } + }); + }, getIDCOptionData() { this.$get('idc').then(response => { if (response.code === 200) { @@ -884,10 +814,12 @@ } } } - this.$refs.accountConfigBox[0].validateAccount(); - let accountValideResult=this.$refs.accountConfigBox[0].validateResult; + + if(this.$refs.accountConfigBox&&this.$refs.accountConfigBox.length>0){ + this.$refs.accountConfigBox[0].validateAccount(); + } this.$refs.assetEditForm.validate((valid) => { - if (valid&&accountValideResult) { + if (valid&&this.accountValideResult) { this.$put('asset', form,{'Content-Type': 'multipart/form-data'}).then(res => { const h = this.$createElement; if (res.code === 200) { @@ -966,6 +898,9 @@ }) } }, + setAccountValideResult:function(result){ + this.accountValideResult=result; + }, //新增型号弹框关闭后重置弹框内容 resetVendor() { this.addVendorData.value = ''; diff --git a/nezha-fronted/src/components/page/asset/moduleListPop.vue b/nezha-fronted/src/components/page/asset/moduleListPop.vue index f25a7beb5..ed5cbfca1 100644 --- a/nezha-fronted/src/components/page/asset/moduleListPop.vue +++ b/nezha-fronted/src/components/page/asset/moduleListPop.vue @@ -24,7 +24,9 @@